From 0864e1061a26e870aea4e51fb49774baf18b5f9d Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Mon, 21 Jul 2014 16:45:08 -0400 Subject: [PATCH] Merge a few more fixes --- .../mekanism/common/CommonWorldTickHandler.java | 3 ++- src/main/java/mekanism/common/Mekanism.java | 13 +++++++++++++ src/main/java/mekanism/common/recipe/BinRecipe.java | 13 ++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main/java/mekanism/common/CommonWorldTickHandler.java b/src/main/java/mekanism/common/CommonWorldTickHandler.java index e698856a9..470a1c9b3 100644 --- a/src/main/java/mekanism/common/CommonWorldTickHandler.java +++ b/src/main/java/mekanism/common/CommonWorldTickHandler.java @@ -131,7 +131,7 @@ public class CommonWorldTickHandler int dimensionId = world.provider.dimensionId; - //Credit to E. Beef :) + //Credit to E. Beef if(chunkRegenMap.containsKey(dimensionId)) { Queue chunksToGen = chunkRegenMap.get(dimensionId); @@ -152,6 +152,7 @@ public class CommonWorldTickHandler fmlRandom.setSeed((xSeed*nextChunk.chunkXPos + zSeed*nextChunk.chunkZPos) ^ world.getSeed()); Mekanism.genHandler.generate(fmlRandom, nextChunk.chunkXPos, nextChunk.chunkZPos, world, world.getChunkProvider(), world.getChunkProvider()); + Mekanism.logger.info("[Mekanism] Regenerating ores at chunk " + nextChunk); } if(chunksToGen.isEmpty()) diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 95e2a60c1..b563c3014 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -215,6 +215,7 @@ public class Mekanism /** A list of the usernames of players who have donated to Mekanism. */ public static List donators = new ArrayList(); + /** The server's world tick handler. */ public static CommonWorldTickHandler worldTickHandler = new CommonWorldTickHandler(); /** The Mekanism world generation handler. */ @@ -1508,6 +1509,18 @@ public class Mekanism } } + @SubscribeEvent + public void chunkSave(ChunkDataEvent.Save event) + { + if(!event.world.isRemote) + { + NBTTagCompound nbtTags = event.getData(); + + nbtTags.setInteger("MekanismWorldGen", baseWorldGenVersion); + nbtTags.setInteger("MekanismUserWorldGen", userWorldGenVersion); + } + } + @SubscribeEvent public synchronized void onChunkDataLoad(ChunkDataEvent.Load event) { diff --git a/src/main/java/mekanism/common/recipe/BinRecipe.java b/src/main/java/mekanism/common/recipe/BinRecipe.java index 54b680714..9cb36e00d 100644 --- a/src/main/java/mekanism/common/recipe/BinRecipe.java +++ b/src/main/java/mekanism/common/recipe/BinRecipe.java @@ -10,14 +10,21 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; -public class BinRecipe implements IRecipe//, ICraftingHandler +public class BinRecipe implements IRecipe { + private static boolean registered; + public BinRecipe() { - MinecraftForge.EVENT_BUS.register(this); + if(!registered) + { + FMLCommonHandler.instance().bus().register(this); + registered = true; + } } @Override @@ -114,7 +121,7 @@ public class BinRecipe implements IRecipe//, ICraftingHandler } @SubscribeEvent - public void onCrafting(ItemCraftedEvent event) //EntityPlayer player, ItemStack item, IInventory craftMatrix) + public void onCrafting(ItemCraftedEvent event) { if(getResult(event.craftMatrix) != null) {