forked from modmuss50/fabric-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabric.html
338 lines (272 loc) · 11.9 KB
/
fabric.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Fabric Versions</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.14.2/styles/default.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body{
font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
padding-left: 8%;
padding-right: 8%;
}
.clipboard_btn{
padding-bottom: 2px;
}
@media screen and (min-width: 600px) {
.mobile-break { display: none; }
}
#title_fabric{
font-family: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-weight: 300;
color:rgb(66, 66, 66);
font-size: 26px;
}
.left-float{
float: left;
}
.right-float{
float: right;
}
</style>
</head>
<body>
<a href = "https://fabricmc.net" style="text-decoration: none;color: inherit;" >
<nav style="display:inline;">
<span style="display:inherit;" id="title_fabric">
<img src = "https://fabricmc.net/assets/logo.png"> fabric</span>
</nav></a>
<br>
<br>
<h1><span class="left-float">Fabric Latest Versions</span>
<span class = "right-float"><img alt="Discord" src="https://img.shields.io/discord/507304429255393322.svg?label=discord"> <img
alt="GitHub stars" src="https://img.shields.io/github/stars/FabricMC/yarn.svg?label=Yarn&style=social"> <img
alt="GitHub stars" src="https://img.shields.io/github/stars/FabricMC/fabric.svg?label=Fabric&style=social"></span></h1>
<br><br><br>
<p><span class="col-md-3">Minecraft Version:</span>
<select name="versions" id="versions" onchange="updateSelection()" class="form-control col-md-3">
</select>
</p><br>
<p>Note fabric-api version may not be the correct version for the given minecraft version. See the <a
href="https://minecraft.curseforge.com/projects/rift/files">curseforge</a> page.</p>
<div class = "border" style="padding-left: 1%;padding-right: 1%; padding-top: 1%;">
<div>
<h4 class="left-float">build.gradle</h4><br class="mobile-break"><br class="mobile-break">
<button data-clipboard-target="#fabric_gradle_code" class="clipboard_btn btn btn-light btn-lg right-float"><i class="fa fa-clipboard" aria-hidden="true"></i>
Copy to Clipboard</button><br>
</div>
<br>
<div name="code">
<pre><code class="gradle" id="fabric_gradle_code">dependencies {
minecraft "com.mojang:minecraft:{minecraft_version}"
mappings "net.fabricmc:yarn:{yarn_version}:v2"
modImplementation "net.fabricmc:fabric-loader:{loader_version}"
//Fabric api
modImplementation "{fabric_maven}{fabric_version}"
}</code></pre>
</div>
<br><hr><br>
<div>
<h4 class="left-float">gradle.properties</h4><br class="mobile-break"><br class="mobile-break">
<button data-clipboard-target="#fabric_properties_code" class="clipboard_btn btn btn-light btn-lg right-float"><i class="fa fa-clipboard" aria-hidden="true"></i>
Copy to Clipboard</button><br>
</div>
<br>
<div name="code">
<pre><code class="properties" id="fabric_properties_code">minecraft_version={minecraft_version}
yarn_mappings={yarn_version}
loader_version={loader_version}
#Fabric api
fabric_version={fabric_version}</code></pre>
</div>
</div>
<hr>
<h2>Mappings Migration</h2>
<p>Mappings can be auto updated by using the following command. See the <a href="https://fabricmc.net/wiki/tutorial:migratemappings">wiki page</a> for more help.</p>
<div name="code">
<pre><code class="bash">./gradlew migrateMappings --mappings "{yarn_version}"</code></pre>
</div>
<hr>
<h2>Loom Version</h2>
<br>
<table class="table table-bordered" style="font-size: 18px;">
<tr>
<th>Recommended</th>
<th>Stable</th>
<th>Latest</th>
</tr>
<tr>
<td>0.2.6-SNAPSHOT</td>
<td>0.2.7-SNAPSHOT</td>
<td id="loomlatestVersion">{latest-loom}</td>
</tr>
</table>
<br>
<p>When upgrading to loom 0.2.6 make sure to take a look at the upgrade guide <a href="https://gist.github.com/modmuss50/5e9415c7b6ea0fc96e56002a2b5f4fc7">here</a></p>
<p>Want to help improve this page? Fork it on <a href="https://github.com/modmuss50/fabric-versions">github</a></p>
<p>Note: Copying to clipboard will not work on browsers that support HTML 5 (most browsers do).<br>
It will be a problem only if you're using internet explorer, or another old browser.</p>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.14.2/highlight.min.js"></script>
<script charset="UTF-8"
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/gradle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelectorAll('pre code').forEach((block) => {
hljs.highlightBlock(block);
});
});
</script>
<script>
new ClipboardJS('.clipboard_btn');
document.addEventListener('DOMContentLoaded', function () {
//Taken from https://stackoverflow.com/questions/1144783/how-to-replace-all-occurrences-of-a-string-in-javascript
String.prototype.replaceAll = function (search, replacement) {
var target = this;
return target.replace(new RegExp(search, 'g'), replacement);
};
getJSON("https://meta.fabricmc.net/v1/versions/game", function (data) {
populateVersions(data);
});
}, false);
var mcVersions;
function populateVersions(versions) {
var versionList = document.getElementById("versions");
var stable;
for (i in versions) {
var version = versions[i];
if (version.stable && stable == null) {
stable = version.version;
}
var option = document.createElement("option");
option.text = version.version;
versionList.add(option);
}
mcVersions = versions;
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has("version")) {
versionList.value = urlParams.get("version");
} else {
versionList.value = stable;
}
load();
}
function updateSelection() {
var versionList = document.getElementById("versions");
insertParam("version", versionList.value);
}
function load() {
var versionList = document.getElementById("versions");
var urlParams = new URLSearchParams(window.location.search);
var version = versionList.value;
if (urlParams.has("version")) {
version = urlParams.get("version");
}
getJSON("https://meta.fabricmc.net/v1/versions/loader/" + version, function (data) {
var meta = data[0];
var codeBlocks = document.getElementsByName("code");
for (i in codeBlocks) {
var block = codeBlocks[i];
block.innerHTML = block.innerHTML.replaceAll("{minecraft_version}", meta.mappings.gameVersion);
block.innerHTML = block.innerHTML.replaceAll("{yarn_version}", meta.mappings.version);
block.innerHTML = block.innerHTML.replaceAll("{loader_version}", meta.loader.version);
}
});
var versionUrl = "https://maven.fabricmc.net/net/fabricmc/fabric/maven-metadata.xml";
var mavenStr = "net.fabricmc:fabric:";
var newApi = true;
for(i in mcVersions){
var vi = mcVersions[i].version;
if(vi === "1.14"){
newApi = false;
break;
}
if(vi === version){
break;
}
}
if (newApi) {
versionUrl = "https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/maven-metadata.xml";
mavenStr = "net.fabricmc.fabric-api:fabric-api:";
}
var branch = "1.15"
//TODO make this better
if(version === "1.14.4"){
branch = "1.14"
}
if (version.startsWith("20w")) {
branch = "1.16"
}
findVersion(versionUrl, branch,
function (version) {
var codeBlocks = document.getElementsByName("code");
for (i in codeBlocks) {
var block = codeBlocks[i];
block.innerHTML = block.innerHTML.replaceAll("{fabric_version}", version);
block.innerHTML = block.innerHTML.replaceAll("{fabric_maven}", mavenStr);
}
});
findVersion("https://maven.modmuss50.me/fabric-loom/fabric-loom.gradle.plugin/maven-metadata.xml", null,
function (aversion) {
document.getElementById("loomlatestVersion").innerHTML = document.getElementById("loomlatestVersion").innerHTML.replaceAll("{latest-loom}", aversion);
});
}
function findVersion(url, branch, onLoad) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xhttp.responseText, "text/xml");
var versions = xmlDoc.getElementsByTagName("version");
var latestVersion = xmlDoc.getElementsByTagName("release")[0].childNodes[0].nodeValue;
Object.keys(versions).forEach(function(value, number) {
var version = versions[number].childNodes[0].nodeValue;
if(version.endsWith(branch)){
latestVersion = versions[number].childNodes[0].nodeValue;
}
console.log(versions[number].childNodes[0].nodeValue)
});
onLoad(latestVersion)
}
};
//Get around caching issues
var milliseconds = (new Date).getTime();
url += "?t=" + milliseconds
xhttp.open("GET", url, true);
xhttp.send();
}
function getJSON(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.onload = function () {
var status = xhr.status;
if (status === 200) {
callback(xhr.response);
} else {
console.log('Something went wrong: ' + status);
}
};
xhr.send();
};
//Thanks https://stackoverflow.com/questions/486896/adding-a-parameter-to-the-url-with-javascript
function insertParam(key, value) {
key = encodeURI(key); value = encodeURI(value);
var kvp = document.location.search.substr(1).split('&');
var i = kvp.length; var x; while (i--) {
x = kvp[i].split('=');
if (x[0] == key) {
x[1] = value;
kvp[i] = x.join('=');
break;
}
}
if (i < 0) { kvp[kvp.length] = [key, value].join('='); }
//this will reload the page, it's likely better to store this until finished
document.location.search = kvp.join('&');
}
</script>
</html>