Skip to content

Commit 1c84a50

Browse files
committed
Update to stable_39 mappings
1 parent afee62b commit 1c84a50

20 files changed

+57
-94
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ targetCompatibility = 1.8
6060
minecraft {
6161
version "1.12.2-14.23.4.2703"
6262
runDir "run"
63-
mappings "snapshot_20180607"
63+
mappings "stable_39"
6464
makeObfSourceJar false
6565

6666
def args = [

src/main/java/org/dimdev/vanillafix/VanillaFix.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
package org.dimdev.vanillafix;
22

3-
import net.minecraft.block.Block;
4-
import net.minecraft.block.material.Material;
53
import net.minecraft.crash.CrashReport;
6-
import net.minecraft.creativetab.CreativeTabs;
7-
import net.minecraft.item.Item;
8-
import net.minecraft.item.ItemBlock;
94
import net.minecraft.util.ReportedException;
10-
import net.minecraft.util.ResourceLocation;
115
import net.minecraftforge.common.ForgeModContainer;
126
import net.minecraftforge.common.MinecraftForge;
137
import net.minecraftforge.common.config.Config;
148
import net.minecraftforge.common.config.ConfigManager;
159
import net.minecraftforge.fml.common.Mod;
1610
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
17-
import net.minecraftforge.fml.common.registry.GameRegistry;
18-
import net.minecraftforge.registries.IForgeRegistry;
1911
import org.apache.logging.log4j.Logger;
2012

2113
import java.io.File;
@@ -30,8 +22,6 @@
3022
updateJSON = "https://gist.githubusercontent.com/Runemoro/28e8cf4c24a5f17f508a5d34f66d229f/raw/vanillafix_update.json")
3123
public class VanillaFix {
3224
private static final int CONFIG_VERSION = 1;
33-
private static final boolean DEBUG_BLOCK_IDS = false;
34-
private static final boolean DEBUG_ITEM_IDS = false;
3525
private static final boolean DEBUG_INIT_ERROR = false; // For testing the init error screen outside of dev. Don't forget to unset!
3626

3727
@Mod.EventHandler
@@ -77,32 +67,6 @@ public void onPreInit(FMLPreInitializationEvent event) {
7767
// Don't render terrain on main thread for higher FPS, but possibly seeing missing chunks
7868
ForgeModContainer.alwaysSetupTerrainOffThread = true;
7969

80-
IForgeRegistry<Block> blockRegistry = GameRegistry.findRegistry(Block.class);
81-
IForgeRegistry<Item> itemRegistry = GameRegistry.findRegistry(Item.class);
82-
83-
if (DEBUG_BLOCK_IDS) {
84-
for (int i = 0; i < 5000; i++) {
85-
Block block = new Block(Material.GROUND)
86-
.setCreativeTab(CreativeTabs.BUILDING_BLOCKS)
87-
.setUnlocalizedName("block_" + i)
88-
.setRegistryName(new ResourceLocation("vanillafix:block_" + i));
89-
90-
blockRegistry.register(block);
91-
itemRegistry.register(new ItemBlock(block).setRegistryName(new ResourceLocation("vanillafix:block_" + i)));
92-
}
93-
}
94-
95-
if (DEBUG_ITEM_IDS) {
96-
for (int i = 0; i < 40000; i++) {
97-
Item item = new Item()
98-
.setCreativeTab(CreativeTabs.FOOD)
99-
.setUnlocalizedName("item_" + i)
100-
.setRegistryName(new ResourceLocation("vanillafix:item_" + i));
101-
102-
itemRegistry.register(item);
103-
}
104-
}
105-
10670
if (DEBUG_INIT_ERROR) throw new ReportedException(new CrashReport("Debug init crash", new Throwable()));
10771
}
10872
}

src/main/java/org/dimdev/vanillafix/VanillaFixLoadingPlugin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
@IFMLLoadingPlugin.SortingIndex(Integer.MIN_VALUE + 10000)
3131
public class VanillaFixLoadingPlugin implements IFMLLoadingPlugin {
3232
private static final Logger log = LogManager.getLogger();
33-
private static final String MCP_VERSION = "20180618-1.12"; // TODO: Use version for current Minecraft version!
3433
private static boolean initialized = false;
3534

3635
public static LoadingConfig config;
@@ -124,13 +123,13 @@ public static void initialize() {
124123
// Initialize StacktraceDeobfuscator
125124
log.info("Initializing StacktraceDeobfuscator");
126125
try {
127-
File mappings = new File(modDir, "methods-" + MCP_VERSION + ".csv");
126+
File mappings = new File(modDir, "methods-stable_39.csv");
128127
if (mappings.exists()) {
129128
log.info("Found MCP method mappings: " + mappings.getName());
130129
} else {
131130
log.info("Downloading MCP method mappings to: " + mappings.getName());
132131
}
133-
StacktraceDeobfuscator.init(mappings, MCP_VERSION);
132+
StacktraceDeobfuscator.init(mappings);
134133
} catch (Exception e) {
135134
log.error("Failed to get MCP data!", e);
136135
}

src/main/java/org/dimdev/vanillafix/blockstates/NumericalBlockState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ public int getStrongPower(IBlockAccess blockAccess, BlockPos pos, EnumFacing sid
283283
}
284284

285285
@Override
286-
public EnumPushReaction getMobilityFlag() {
287-
return block.getMobilityFlag(this);
286+
public EnumPushReaction getPushReaction() {
287+
return block.getPushReaction(this);
288288
}
289289

290290
@Override

src/main/java/org/dimdev/vanillafix/blockstates/NumericalExtendedBlockState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ public int getStrongPower(IBlockAccess blockAccess, BlockPos pos, EnumFacing sid
299299
}
300300

301301
@Override
302-
public EnumPushReaction getMobilityFlag() {
303-
return normalState.getMobilityFlag();
302+
public EnumPushReaction getPushReaction() {
303+
return normalState.getPushReaction();
304304
}
305305

306306
@Override

src/main/java/org/dimdev/vanillafix/bugs/mixins/client/MixinMinecraft.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@Mixin(Minecraft.class)
3030
public abstract class MixinMinecraft implements IThreadListener, ISnooperInfo {
3131
@Shadow @Final private static Logger LOGGER;
32-
@Shadow @Final public Profiler mcProfiler;
32+
@Shadow @Final public Profiler profiler;
3333

3434
@Shadow public GuiIngame ingameGUI;
3535

@@ -42,9 +42,9 @@ private void endStartGUISection(Profiler profiler, String name) {
4242
/** @reason Part 2 of GUI logic fix. */
4343
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureManager;tick()V", ordinal = 0))
4444
private void tickTextureManagerWithCorrectProfiler(TextureManager textureManager) {
45-
mcProfiler.endStartSection("textures");
45+
profiler.endStartSection("textures");
4646
textureManager.tick();
47-
mcProfiler.endStartSection("gui");
47+
profiler.endStartSection("gui");
4848
}
4949

5050
/** @reason Make saving screenshots async (https://bugs.mojang.com/browse/MC-33383) */

src/main/java/org/dimdev/vanillafix/bugs/mixins/client/MixinNetHandlerPlayClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void handleRespawn(SPacketRespawn packetIn) {
3535
client.displayGuiScreen(null);
3636

3737
Scoreboard scoreboard = world.getScoreboard();
38-
world = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, client.world.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), client.mcProfiler);
38+
world = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, client.world.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), client.profiler);
3939
world.setWorldScoreboard(scoreboard);
4040
client.loadWorld(world);
4141
client.player.dimension = packetIn.getDimensionID();

src/main/java/org/dimdev/vanillafix/crashes/CrashUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static void outputReport(CrashReport report) {
4646
reportName += Minecraft.getMinecraft().isCallingFromMinecraftThread() ? "-client" : "-server";
4747
reportName += ".txt";
4848

49-
File reportsDir = isClient() ? new File(Minecraft.getMinecraft().mcDataDir, "crash-reports") : new File("crash-reports");
49+
File reportsDir = isClient() ? new File(Minecraft.getMinecraft().gameDir, "crash-reports") : new File("crash-reports");
5050
File reportFile = new File(reportsDir, reportName);
5151

5252
report.saveToFile(reportFile);

src/main/java/org/dimdev/vanillafix/crashes/StacktraceDeobfuscator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ public final class StacktraceDeobfuscator {
1818
* If the file does not exits, downloads latest method mappings and saves them to it.
1919
* Initializes a HashMap between obfuscated and deobfuscated names from that file.
2020
*/
21-
public static void init(File mappings, String version) {
21+
public static void init(File mappings) {
2222
if (srgMcpMethodMap != null) return;
2323

2424
// Download the file if necessary
2525
if (!mappings.exists()) {
2626
HttpURLConnection connection = null;
2727
try {
28-
URL mappingsURL = new URL("http://export.mcpbot.bspk.rs/mcp_snapshot_nodoc/" + version + "/mcp_snapshot_nodoc-" + version + ".zip");
28+
URL mappingsURL = new URL("http://export.mcpbot.bspk.rs/mcp_stable_nodoc/39-1.12/mcp_stable_nodoc-39-1.12.zip");
2929
connection = (HttpURLConnection) mappingsURL.openConnection();
3030
connection.setDoInput(true);
3131
connection.connect();
@@ -110,7 +110,7 @@ public static String deobfuscateMethodName(String srgName) {
110110
}
111111

112112
public static void main(String[] args) {
113-
init(new File("methods.csv"), "20180519-1.12");
113+
init(new File("methods.csv"));
114114
for (Map.Entry<String, String> entry : srgMcpMethodMap.entrySet()) {
115115
System.out.println(entry.getKey() + " <=> " + entry.getValue());
116116
}

src/main/java/org/dimdev/vanillafix/crashes/mixins/client/MixinMinecraft.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public abstract class MixinMinecraft implements IThreadListener, ISnooperInfo, I
7878
@Shadow public TextureManager renderEngine;
7979
@Shadow public FontRenderer fontRenderer;
8080
@Shadow private int leftClickCounter;
81-
@Shadow private Framebuffer framebufferMc;
82-
@Shadow private IReloadableResourceManager mcResourceManager;
83-
@Shadow private SoundHandler mcSoundHandler;
81+
@Shadow private Framebuffer framebuffer;
82+
@Shadow private IReloadableResourceManager resourceManager;
83+
@Shadow private SoundHandler soundHandler;
8484
@Shadow @Final private List<IResourcePack> defaultResourcePacks;
85-
@Shadow private LanguageManager mcLanguageManager;
86-
@Shadow @Final private MetadataSerializer metadataSerializer_;
85+
@Shadow private LanguageManager languageManager;
86+
@Shadow @Final private MetadataSerializer metadataSerializer;
8787

8888
@Shadow @SuppressWarnings("RedundantThrows") private void init() throws LWJGLException, IOException {}
8989
@Shadow @SuppressWarnings("RedundantThrows") private void runGameLoop() throws IOException {}
@@ -178,19 +178,19 @@ public void displayInitErrorScreen(CrashReport report) {
178178
LOGGER.error("Failed to load VanillaFix resource pack", t);
179179
}
180180

181-
mcResourceManager = new SimpleReloadableResourceManager(metadataSerializer_);
182-
renderEngine = new TextureManager(mcResourceManager);
183-
mcResourceManager.registerReloadListener(renderEngine);
181+
resourceManager = new SimpleReloadableResourceManager(metadataSerializer);
182+
renderEngine = new TextureManager(resourceManager);
183+
resourceManager.registerReloadListener(renderEngine);
184184

185-
mcLanguageManager = new LanguageManager(metadataSerializer_, gameSettings.language);
186-
mcResourceManager.registerReloadListener(mcLanguageManager);
185+
languageManager = new LanguageManager(metadataSerializer, gameSettings.language);
186+
resourceManager.registerReloadListener(languageManager);
187187

188188
refreshResources(); // TODO: Why is this necessary?
189189
fontRenderer = new FontRenderer(gameSettings, new ResourceLocation("textures/font/ascii.png"), renderEngine, false);
190-
mcResourceManager.registerReloadListener(fontRenderer);
190+
resourceManager.registerReloadListener(fontRenderer);
191191

192-
mcSoundHandler = new SoundHandler(mcResourceManager, gameSettings);
193-
mcResourceManager.registerReloadListener(mcSoundHandler);
192+
soundHandler = new SoundHandler(resourceManager, gameSettings);
193+
resourceManager.registerReloadListener(soundHandler);
194194

195195
running = true;
196196
try {
@@ -215,7 +215,7 @@ private void runGUILoop(GuiScreen screen) throws IOException {
215215

216216
GlStateManager.pushMatrix();
217217
GlStateManager.clear(16640);
218-
framebufferMc.bindFramebuffer(true);
218+
framebuffer.bindFramebuffer(true);
219219
GlStateManager.enableTexture2D();
220220

221221
GlStateManager.viewport(0, 0, displayWidth, displayHeight);
@@ -237,11 +237,11 @@ private void runGUILoop(GuiScreen screen) throws IOException {
237237
int mouseY = height - Mouse.getY() * height / displayHeight - 1;
238238
currentScreen.drawScreen(mouseX, mouseY, 0);
239239

240-
framebufferMc.unbindFramebuffer();
240+
framebuffer.unbindFramebuffer();
241241
GlStateManager.popMatrix();
242242

243243
GlStateManager.pushMatrix();
244-
framebufferMc.framebufferRender(displayWidth, displayHeight);
244+
framebuffer.framebufferRender(displayWidth, displayHeight);
245245
GlStateManager.popMatrix();
246246

247247
updateDisplay();

0 commit comments

Comments
 (0)