diff --git a/common/net/minecraftforge/common/MinecraftForge.java b/common/net/minecraftforge/common/MinecraftForge.java index f576a2948..128bf876b 100644 --- a/common/net/minecraftforge/common/MinecraftForge.java +++ b/common/net/minecraftforge/common/MinecraftForge.java @@ -1,8 +1,40 @@ package net.minecraftforge.common; +import net.minecraft.src.*; +import net.minecraftforge.common.ForgeHooks.GrassEntry; +import net.minecraftforge.common.ForgeHooks.SeedEntry; import net.minecraftforge.event.EventBus; public class MinecraftForge { - public static final EventBus eventBus = new EventBus(); + /** + * The core Forge EventBus, all events for Forge will be fired on this, + * you should use this to register all your listeners. + * This replaces every register*Handler() function in the old version of Forge. + */ + public static final EventBus EVENT_BUS = new EventBus(); + + + /** Register a new plant to be planted when bonemeal is used on grass. + * @param block The block to place. + * @param metadata The metadata to set for the block when being placed. + * @param weight The weight of the plant, where red flowers are + * 10 and yellow flowers are 20. + */ + public static void addGrassPlant(Block block, int metadata, int weight) + { + ForgeHooks.grassList.add(new GrassEntry(block, metadata, weight)); + } + + /** + * Register a new seed to be dropped when breaking tall grass. + * + * @param seed The item to drop as a seed. + * @param weight The relative probability of the seeds, + * where wheat seeds are 10. + */ + public static void addGrassSeed(ItemStack seed, int weight) + { + ForgeHooks.seedList.add(new SeedEntry(seed, weight)); + } } diff --git a/common/net/minecraftforge/oredict/OreDictionary.java b/common/net/minecraftforge/oredict/OreDictionary.java index 83d63b5b2..171053ff4 100644 --- a/common/net/minecraftforge/oredict/OreDictionary.java +++ b/common/net/minecraftforge/oredict/OreDictionary.java @@ -117,7 +117,7 @@ public class OreDictionary ArrayList ores = getOres(id); ore = ore.copy(); ores.add(ore); - MinecraftForge.eventBus.post(new OreRegisterEvent(name, ore)); + MinecraftForge.EVENT_BUS.post(new OreRegisterEvent(name, ore)); } public static class OreRegisterEvent extends Event diff --git a/eclipse/.metadata/.gitignore b/eclipse/.metadata/.gitignore index 0ef40f1d0..ff4ba8469 100644 --- a/eclipse/.metadata/.gitignore +++ b/eclipse/.metadata/.gitignore @@ -1,3 +1,4 @@ /.mylyn/ .lock -version.ini \ No newline at end of file +version.ini +/*.log diff --git a/patches/common/net/minecraft/src/AnvilChunkLoader.java.patch b/patches/common/net/minecraft/src/AnvilChunkLoader.java.patch index b48ccfbf7..1d1d8d40e 100644 --- a/patches/common/net/minecraft/src/AnvilChunkLoader.java.patch +++ b/patches/common/net/minecraft/src/AnvilChunkLoader.java.patch @@ -14,7 +14,7 @@ var5 = this.readChunkFromNBT(par1World, par4NBTTagCompound.getCompoundTag("Level")); } -+ MinecraftForge.eventBus.post(new ChunkDataEvent.Load(var5, par4NBTTagCompound)); ++ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(var5, par4NBTTagCompound)); return var5; } } @@ -22,7 +22,7 @@ var3.setTag("Level", var4); this.writeChunkToNBT(par2Chunk, par1World, var4); this.func_75824_a(par2Chunk.getChunkCoordIntPair(), var3); -+ MinecraftForge.eventBus.post(new ChunkDataEvent.Save(par2Chunk, var3)); ++ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(par2Chunk, var3)); } catch (Exception var5) { diff --git a/patches/common/net/minecraft/src/EntityItem.java.patch b/patches/common/net/minecraft/src/EntityItem.java.patch index ebde7f29a..9dfe9c125 100644 --- a/patches/common/net/minecraft/src/EntityItem.java.patch +++ b/patches/common/net/minecraft/src/EntityItem.java.patch @@ -15,7 +15,7 @@ int var2 = this.item.stackSize; + EntityItemPickupEvent event = new EntityItemPickupEvent(this, par1EntityPlayer); -+ MinecraftForge.eventBus.post(event); ++ MinecraftForge.EVENT_BUS.post(event); + + if (delayBeforeCanPickup == 0 && (!event.isCanceled() || item.stackSize <= 0)) + { diff --git a/patches/common/net/minecraft/src/ItemBow.java.patch b/patches/common/net/minecraft/src/ItemBow.java.patch index 2fb67d4ba..d69ef0923 100644 --- a/patches/common/net/minecraft/src/ItemBow.java.patch +++ b/patches/common/net/minecraft/src/ItemBow.java.patch @@ -16,7 +16,7 @@ + int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4; + + ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, var6); -+ MinecraftForge.eventBus.post(event); ++ MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) + { + return; @@ -36,7 +36,7 @@ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack); -+ MinecraftForge.eventBus.post(event); ++ MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) + { + return event.getResultStack(); diff --git a/patches/minecraft/net/minecraft/src/Chunk.java.patch b/patches/minecraft/net/minecraft/src/Chunk.java.patch index c11335a39..53054363c 100644 --- a/patches/minecraft/net/minecraft/src/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/src/Chunk.java.patch @@ -265,7 +265,7 @@ List var4 = var1[var3]; this.worldObj.addLoadedEntities(var4); } -+ MinecraftForge.eventBus.post(new ChunkEvent.Load(this)); ++ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); } /** @@ -273,7 +273,7 @@ List var4 = var5[var3]; this.worldObj.unloadEntities(var4); } -+ MinecraftForge.eventBus.post(new ChunkEvent.Unload(this)); ++ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); } /**