<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Caleb Sacks</title>
    <description>The latest articles on DEV Community by Caleb Sacks (@clabe45).</description>
    <link>https://dev.to/clabe45</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F215031%2F24938994-6231-49ed-8d38-3a298fdc1a77.jpeg</url>
      <title>DEV Community: Caleb Sacks</title>
      <link>https://dev.to/clabe45</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/clabe45"/>
    <language>en</language>
    <item>
      <title>Diff Decompiled Minecraft Versions</title>
      <dc:creator>Caleb Sacks</dc:creator>
      <pubDate>Sun, 03 Jul 2022 06:28:22 +0000</pubDate>
      <link>https://dev.to/clabe45/diff-decompiled-minecraft-versions-43ml</link>
      <guid>https://dev.to/clabe45/diff-decompiled-minecraft-versions-43ml</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;⚠️ You cannot publish any of Minecraft's source code!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this tutorial, we'll be using &lt;a href="https://github.com/clabe45/shulkr"&gt;shulkr&lt;/a&gt; to see all the code changes introduced in the Wild Update for Minecraft: Java Edition.&lt;/p&gt;




&lt;h2&gt;
  
  
  Installing Shulkr
&lt;/h2&gt;

&lt;p&gt;Shulkr lets you decompile, manage and compare multiple versions of Minecraft: Java Edition. It can be installed with pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install -U shulkr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will need Git and Python 3 installed to use it. (You will also need JDK 17 or later if you wish to use &lt;a href="https://github.com/FabricMC/yarn"&gt;yarn&lt;/a&gt; mappings.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Decompiling Minecraft 1.18.2
&lt;/h2&gt;

&lt;p&gt;To start, let's decompile the last patch of the Caves &amp;amp; Cliffs update:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir minecraft
cd minecraft
shulkr --mappings mojang 1.18.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a git repo in the current directory with three commits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git log --oneline
49f1ec5 (HEAD -&amp;gt; main, tag: 1.18.2) version 1.18.2
87b4c68 add .gitignore
51f09e4 add .shulkr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The most recent commit is the only one that we care about. It adds a &lt;strong&gt;src&lt;/strong&gt; directory with the client and server sources.&lt;/p&gt;

&lt;p&gt;Shulkr's current default is to decompile Minecraft using yarn mappings. To use the official ones published by Mojang, we include &lt;code&gt;--mappings mojang&lt;/code&gt;. We only need to supply this once per repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decompiling Minecraft 1.19
&lt;/h2&gt;

&lt;p&gt;Now, we have two options for decompiling the Wild Update. We could tell shulkr to decompile and commit each of 1.19's snapshots separately, or we could tell it to just generate 1.19 as a single commit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Generating Each Snapshot Individually:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shulkr ...1.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we use the &lt;a href="https://github.com/clabe45/shulkr#version-patterns"&gt;snapshot range&lt;/a&gt; syntax to include every snapshot up until (and including) 1.19.&lt;/p&gt;

&lt;p&gt;If we look at the commit history, we now see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git log --oneline
75c1db5 (HEAD -&amp;gt; main, tag: 1.19) version 1.19
db6f94c (tag: 1.19-rc2) version 1.19-rc2
920103c (tag: 1.19-rc1) version 1.19-rc1
9b22ccc (tag: 1.19-pre5) version 1.19-pre5
92ccdc0 (tag: 1.19-pre4) version 1.19-pre4
86eeac5 (tag: 1.19-pre3) version 1.19-pre3
4e6b60f (tag: 1.19-pre2) version 1.19-pre2
e2f126e (tag: 1.19-pre1) version 1.19-pre1
7b2ed57 (tag: 22w19a) version 22w19a
d77b8bc (tag: 22w18a) version 22w18a
8c26849 (tag: 22w17a) version 22w17a
473997f (tag: 22w16b) version 22w16b
c2abe5b (tag: 22w16a) version 22w16a
1f1d0e3 (tag: 22w15a) version 22w15a
c9d0fbd (tag: 22w14a) version 22w14a
2461716 (tag: 22w13oneblockatatime) version 22w13oneblockatatime
ada384b (tag: 22w13a) version 22w13a
f149097 (tag: 22w12a) version 22w12a
e2f0705 (tag: 22w11a) version 22w11a
49f1ec5 (tag: 1.18.2) version 1.18.2
87b4c68 add .gitignore
51f09e4 add .shulkr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generating 1.19 as a Single Commit:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shulkr 1.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will run much faster than the previous one, because we're only decompiling one version. If we look at the commit history here, we see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git log --oneline
e23cdba (HEAD -&amp;gt; main, tag: 1.19) version 1.19
49f1ec5 (tag: 1.18.2) version 1.18.2
87b4c68 add .gitignore
51f09e4 add .shulkr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Comparing Versions
&lt;/h2&gt;

&lt;p&gt;Now, we can see all the code that was changed in 1.19:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff 1.18.2 1.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To simply list the modified files, we can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff --stat 1.18.2 1.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for checking out this tutorial 😄 If anything goes wrong, please &lt;a href="https://github.com/clabe45/shulkr/issues"&gt;open an issue&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
