From d28615499770fb15cb1e2060bfdef5a563ee3903 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 6 Aug 2012 03:35:57 -0700 Subject: [PATCH] More progress on converting patches from 1.2.5 --- .../client/ForgeHooksClient.java | 180 +++++ common/forge_at.cfg | 11 + .../net/minecraftforge/common/ForgeHooks.java | 142 ++++ .../minecraftforge/common/MinecraftForge.java | 158 ++++ .../event/entity/UseHoeEvent.java | 43 + eclipse/.metadata/.plugins/.gitignore | 7 + ...c-2.9.96.199.zip => fml-src-2.9.97.200.zip | Bin 196696 -> 196696 bytes .../net/minecraft/src/forge/ForgeHooks.java | 27 - .../minecraft/src/forge/IConnectRedstone.java | 26 - .../minecraft/src/forge/MinecraftForge.java | 138 ---- .../minecraft/src/AnvilSaveHandler.java.patch | 20 + .../minecraft/src/BlockContainer.java.patch | 24 + .../src/EnchantmentHelper.java.patch | 11 + .../net/minecraft/src/SlotCrafting.java.patch | 10 + .../minecraft/src/WorldGenDeadBush.java.patch | 22 + .../src/WorldGenTallGrass.java.patch | 22 + .../net/minecraft/src/Block.java.patch | 735 ++++++++++++++++++ .../net/minecraft/src/BlockChest.java.patch | 53 ++ .../net/minecraft/src/BlockCrops.java.patch | 50 ++ .../net/minecraft/src/BlockDoor.java.patch | 38 + .../net/minecraft/src/BlockFire.java.patch | 257 ++++++ .../net/minecraft/src/BlockLadder.java.patch | 89 +++ .../net/minecraft/src/BlockLeaves.java.patch | 93 +++ .../net/minecraft/src/BlockLog.java.patch | 36 + .../minecraft/src/BlockNetherStalk.java.patch | 60 ++ .../minecraft/src/BlockPistonBase.java.patch | 11 + .../src/BlockRedstoneWire.java.patch | 11 + .../net/minecraft/src/BlockSnow.java.patch | 54 ++ .../net/minecraft/src/BlockTorch.java.patch | 133 ++++ .../minecraft/src/BlockTrapDoor.java.patch | 56 ++ .../net/minecraft/src/BlockVine.java.patch | 50 ++ .../net/minecraft/src/Chunk.java.patch | 4 +- .../minecraft/src/ContainerFurnace.java.patch | 11 + .../minecraft/src/EffectRenderer.java.patch | 148 ++++ .../net/minecraft/src/Enchantment.java.patch | 17 + .../net/minecraft/src/EntityOcelot.java.patch | 13 + .../net/minecraft/src/EntityPlayer.java.patch | 36 + .../net/minecraft/src/ItemBlock.java.patch | 12 + .../net/minecraft/src/ItemHoe.java.patch | 29 + .../net/minecraft/src/ItemTool.java.patch | 25 + .../net/minecraft/src/StatList.java.patch | 15 + .../net/minecraft/src/Tessellator.java.patch | 187 +++++ .../net/minecraft/src/TileEntity.java.patch | 32 + .../net/minecraft/src/World.java.patch | 96 ++- .../minecraft/src/WorldProvider.java.patch | 85 ++ .../net/minecraft/src/Chunk.java.patch | 4 +- .../net/minecraft/src/World.java.patch | 86 +- 47 files changed, 3170 insertions(+), 197 deletions(-) create mode 100644 client/net/minecraftforge/client/ForgeHooksClient.java create mode 100644 common/net/minecraftforge/event/entity/UseHoeEvent.java rename fml-src-2.9.96.199.zip => fml-src-2.9.97.200.zip (93%) delete mode 100644 forge_common/net/minecraft/src/forge/IConnectRedstone.java create mode 100644 patches/common/net/minecraft/src/AnvilSaveHandler.java.patch create mode 100644 patches/common/net/minecraft/src/BlockContainer.java.patch create mode 100644 patches/common/net/minecraft/src/EnchantmentHelper.java.patch create mode 100644 patches/common/net/minecraft/src/SlotCrafting.java.patch create mode 100644 patches/common/net/minecraft/src/WorldGenDeadBush.java.patch create mode 100644 patches/common/net/minecraft/src/WorldGenTallGrass.java.patch create mode 100644 patches/minecraft/net/minecraft/src/Block.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockChest.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockCrops.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockDoor.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockFire.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockLadder.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockLeaves.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockLog.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockSnow.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockTorch.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch create mode 100644 patches/minecraft/net/minecraft/src/BlockVine.java.patch create mode 100644 patches/minecraft/net/minecraft/src/ContainerFurnace.java.patch create mode 100644 patches/minecraft/net/minecraft/src/EffectRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/src/Enchantment.java.patch create mode 100644 patches/minecraft/net/minecraft/src/EntityOcelot.java.patch create mode 100644 patches/minecraft/net/minecraft/src/EntityPlayer.java.patch create mode 100644 patches/minecraft/net/minecraft/src/ItemBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/src/ItemHoe.java.patch create mode 100644 patches/minecraft/net/minecraft/src/ItemTool.java.patch create mode 100644 patches/minecraft/net/minecraft/src/StatList.java.patch create mode 100644 patches/minecraft/net/minecraft/src/Tessellator.java.patch create mode 100644 patches/minecraft/net/minecraft/src/TileEntity.java.patch create mode 100644 patches/minecraft/net/minecraft/src/WorldProvider.java.patch diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java new file mode 100644 index 000000000..3b6d9e0df --- /dev/null +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -0,0 +1,180 @@ +package net.minecraftforge.client; + +import java.util.HashMap; +import java.util.TreeSet; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.src.Block; +import net.minecraft.src.ModLoader; +import net.minecraft.src.RenderBlocks; +import net.minecraft.src.Tessellator; + +public class ForgeHooksClient +{ + private static class TesKey implements Comparable + { + public final int texture, subid; + public TesKey(int textureID, int subID) + { + texture = textureID; + subid = subID; + } + + public int compareTo(TesKey key) + { + if (subid == key.subid) + { + return texture - key.texture; + } + return subid - key.subid; + } + + public boolean equals(Object obj) + { + return compareTo((TesKey)obj) == 0; + } + + public int hashCode() + { + return texture + 31 * subid; + } + } + + public static HashMap tessellators = new HashMap(); + public static HashMap textures = new HashMap(); + public static TreeSet renderTextures = new TreeSet(); + public static Tessellator defaultTessellator = null; + public static boolean inWorld = false; + + public static void bindTexture(String texture, int subID) + { + Integer texID = textures.get(texture); + if (texID == null) + { + texID = ModLoader.getMinecraftInstance().renderEngine.getTexture(texture); + textures.put(texture, texID); + } + if (!inWorld) + { + /*if (unbindContext != null) + { + unbindContext.afterRenderContext(); + unbindContext = null; + }*/ + if (Tessellator.instance.isDrawing) + { + int mode = Tessellator.instance.drawMode; + Tessellator.instance.draw(); + Tessellator.instance.startDrawing(mode); + } + GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID); + /*unbindContext = renderHandlers.get(new TesKey(texID, subID)); + if (unbindContext != null) + { + unbindContext.beforeRenderContext(); + }*/ + return; + } + bindTessellator(texID, subID); + } + + public static void unbindTexture() + { + if (inWorld) + { + Tessellator.instance = defaultTessellator; + } + else + { + if (Tessellator.instance.isDrawing) + { + int mode = Tessellator.instance.drawMode; + Tessellator.instance.draw(); + /*if (unbindContext != null) + { + unbindContext.afterRenderContext(); + unbindContext = null; + }*/ + Tessellator.instance.startDrawing(mode); + } + GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png")); + return; + } + } + + protected static void bindTessellator(int texture, int subID) + { + TesKey key = new TesKey(texture, subID); + Tessellator tess = tessellators.get(key); + + if (tess == null) + { + tess = new Tessellator(); + tess.textureID = texture; + tessellators.put(key, tess); + } + + if (inWorld && !renderTextures.contains(key)) + { + renderTextures.add(key); + tess.startDrawingQuads(); + tess.setTranslation(defaultTessellator.xOffset, defaultTessellator.yOffset, defaultTessellator.zOffset); + } + + Tessellator.instance = tess; + } + + static int renderPass = -1; + public static void beforeRenderPass(int pass) + { + renderPass = pass; + defaultTessellator = Tessellator.instance; + Tessellator.renderingWorldRenderer = true; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png")); + renderTextures.clear(); + inWorld = true; + } + + public static void afterRenderPass(int pass) + { + renderPass = -1; + inWorld = false; + for (TesKey info : renderTextures) + { + //IRenderContextHandler handler = renderHandlers.get(info); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, info.texture); + Tessellator tess = tessellators.get(info); + //if (handler == null) + //{ + tess.draw(); + /*} + else + { + Tessellator.instance = tess; + handler.beforeRenderContext(); + tess.draw(); + handler.afterRenderContext(); + }*/ + } + GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png")); + Tessellator.renderingWorldRenderer = false; + Tessellator.instance = defaultTessellator; + } + + public static void beforeBlockRender(Block block, RenderBlocks render) + { + if (!block.isDefaultTexture && render.overrideBlockTexture == -1) + { + bindTexture(block.getTextureFile(), 0); + } + } + + public static void afterBlockRender(Block block, RenderBlocks render) + { + if (!block.isDefaultTexture && render.overrideBlockTexture == -1) + { + unbindTexture(); + } + } +} diff --git a/common/forge_at.cfg b/common/forge_at.cfg index cae160a26..2aade0744 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -8,3 +8,14 @@ public avd.w # yOffset public avd.x # zOffset public-f avd.a # instance remove final public avd.z # isDrawing +#ItemPickaxe +public+f rp.c # blocksEffectiveAgainst +#ItemAxe +public+f re.c # blocksEffectiveAgainst +#ItemSpade +public+f sa.c # blocksEffectiveAgainst +#ItemTool +public gs.a # efficiencyOnProperMaterial +public gs.bY # damageVsEntity +#EntityEnderman +public no.d # EntityEnderman.carriableBlocks diff --git a/common/net/minecraftforge/common/ForgeHooks.java b/common/net/minecraftforge/common/ForgeHooks.java index 5c276daec..5f1d402b8 100644 --- a/common/net/minecraftforge/common/ForgeHooks.java +++ b/common/net/minecraftforge/common/ForgeHooks.java @@ -50,12 +50,154 @@ public class ForgeHooks return entry.seed.copy(); } + private static boolean toolInit = false; + static HashMap toolClasses = new HashMap(); + static HashMap toolHarvestLevels = new HashMap(); + static HashSet toolEffectiveness = new HashSet(); + + public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) + { + if (block.blockMaterial.isHarvestable()) + { + return true; + } + ItemStack stack = player.inventory.getCurrentItem(); + if (stack == null) + { + return player.canHarvestBlock(block); + } + + List info = (List)toolClasses.get(stack); + if (info == null) + { + return player.canHarvestBlock(block); + } + Object[] tmp = info.toArray(); + String toolClass = (String)tmp[0]; + int harvestLevel = (Integer)tmp[1]; + + Integer blockHarvestLevel = (Integer)toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass)); + if (blockHarvestLevel == null) + { + return player.canHarvestBlock(block); + } + if (blockHarvestLevel > harvestLevel) + { + return false; + } + return true; + } + + public static float blockStrength(Block block, EntityPlayer player, World world, int x, int y, int z) + { + int metadata = world.getBlockMetadata(x, y, z); + float hardness = block.getBlockHardness(world, x, y, z); + if (hardness < 0.0F) + { + return 0.0F; + } + + if (!canHarvestBlock(block, player, metadata)) + { + return 1.0F / hardness / 100F; + } + else + { + return player.getCurrentPlayerStrVsBlock(block, metadata) / hardness / 30F; + } + } + + public static boolean isToolEffective(ItemStack stack, Block block, int metadata) + { + List toolClass = (List)toolClasses.get(stack.getItem()); + if (toolClass == null) + { + return false; + } + return toolEffectiveness.contains(Arrays.asList(block, metadata, (String)toolClass.get(0))); + } + + static void initTools() + { + if (toolInit) + { + return; + } + toolInit = true; + + MinecraftForge.setToolClass(Item.pickaxeWood, "pickaxe", 0); + MinecraftForge.setToolClass(Item.pickaxeStone, "pickaxe", 1); + MinecraftForge.setToolClass(Item.pickaxeSteel, "pickaxe", 2); + MinecraftForge.setToolClass(Item.pickaxeGold, "pickaxe", 0); + MinecraftForge.setToolClass(Item.pickaxeDiamond, "pickaxe", 3); + + MinecraftForge.setToolClass(Item.axeWood, "axe", 0); + MinecraftForge.setToolClass(Item.axeStone, "axe", 1); + MinecraftForge.setToolClass(Item.axeSteel, "axe", 2); + MinecraftForge.setToolClass(Item.axeGold, "axe", 0); + MinecraftForge.setToolClass(Item.axeDiamond, "axe", 3); + + MinecraftForge.setToolClass(Item.shovelWood, "shovel", 0); + MinecraftForge.setToolClass(Item.shovelStone, "shovel", 1); + MinecraftForge.setToolClass(Item.shovelSteel, "shovel", 2); + MinecraftForge.setToolClass(Item.shovelGold, "shovel", 0); + MinecraftForge.setToolClass(Item.shovelDiamond, "shovel", 3); + + MinecraftForge.setBlockHarvestLevel(Block.obsidian, "pickaxe", 3); + MinecraftForge.setBlockHarvestLevel(Block.oreDiamond, "pickaxe", 2); + MinecraftForge.setBlockHarvestLevel(Block.blockDiamond, "pickaxe", 2); + MinecraftForge.setBlockHarvestLevel(Block.oreGold, "pickaxe", 2); + MinecraftForge.setBlockHarvestLevel(Block.blockGold, "pickaxe", 2); + MinecraftForge.setBlockHarvestLevel(Block.oreIron, "pickaxe", 1); + MinecraftForge.setBlockHarvestLevel(Block.blockSteel, "pickaxe", 1); + MinecraftForge.setBlockHarvestLevel(Block.oreLapis, "pickaxe", 1); + MinecraftForge.setBlockHarvestLevel(Block.blockLapis, "pickaxe", 1); + MinecraftForge.setBlockHarvestLevel(Block.oreRedstone, "pickaxe", 2); + MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing, "pickaxe", 2); + MinecraftForge.removeBlockEffectiveness(Block.oreRedstone, "pickaxe"); + MinecraftForge.removeBlockEffectiveness(Block.obsidian, "pickaxe"); + MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing, "pickaxe"); + + for (Block block : ItemPickaxe.blocksEffectiveAgainst) + { + MinecraftForge.setBlockHarvestLevel(block, "pickaxe", 0); + } + + for (Block block : ItemSpade.blocksEffectiveAgainst) + { + MinecraftForge.setBlockHarvestLevel(block, "shovel", 0); + } + + for (Block block : ItemAxe.blocksEffectiveAgainst) + { + MinecraftForge.setBlockHarvestLevel(block, "axe", 0); + } + + } + static { grassList.add(new GrassEntry(Block.plantYellow, 0, 20)); grassList.add(new GrassEntry(Block.plantRed, 0, 10)); seedList.add(new SeedEntry(new ItemStack(Item.seeds), 10)); + initTools(); System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion()); ModLoader.getLogger().info(String.format("MinecraftForge v%s Initialized", ForgeVersion.getVersion())); } + + public static String getTexture(String _default, Object obj) + { + if (obj instanceof Item) + { + return ((Item)obj).getTextureFile(); + } + else if (obj instanceof Block) + { + return ((Block)obj).getTextureFile(); + } + else + { + return _default; + } + } } diff --git a/common/net/minecraftforge/common/MinecraftForge.java b/common/net/minecraftforge/common/MinecraftForge.java index 128bf876b..ba913431b 100644 --- a/common/net/minecraftforge/common/MinecraftForge.java +++ b/common/net/minecraftforge/common/MinecraftForge.java @@ -1,5 +1,7 @@ package net.minecraftforge.common; +import java.util.*; + import net.minecraft.src.*; import net.minecraftforge.common.ForgeHooks.GrassEntry; import net.minecraftforge.common.ForgeHooks.SeedEntry; @@ -13,6 +15,7 @@ public class MinecraftForge * This replaces every register*Handler() function in the old version of Forge. */ public static final EventBus EVENT_BUS = new EventBus(); + public static boolean SPAWNER_ALLOW_ON_INVERTED = false; /** Register a new plant to be planted when bonemeal is used on grass. @@ -37,4 +40,159 @@ public class MinecraftForge { ForgeHooks.seedList.add(new SeedEntry(seed, weight)); } + + /** + * + * Register a tool as a tool class with a given harvest level. + * + * @param tool The custom tool to register. + * @param toolClass The tool class to register as. The predefined tool + * clases are "pickaxe", "shovel", "axe". You can add + * others for custom tools. + * @param harvestLevel The harvest level of the tool. + */ + public static void setToolClass(Item tool, String toolClass, int harvestLevel) + { + ForgeHooks.toolClasses.put(tool, Arrays.asList(toolClass, harvestLevel)); + } + + /** + * Register a block to be harvested by a tool class. This is the metadata + * sensitive version, use it if your blocks are using metadata variants. + * By default, this sets the block class as effective against that type. + * + * @param block The block to register. + * @param metadata The metadata for the block subtype. + * @param toolClass The tool class to register as able to remove this block. + * You may register the same block multiple times with different tool + * classes, if multiple tool types can be used to harvest this block. + * @param harvestLevel The minimum tool harvest level required to successfully + * harvest the block. + * @see setToolClass for details on tool classes. + */ + public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel) + { + List key = Arrays.asList(block, metadata, toolClass); + ForgeHooks.toolHarvestLevels.put(key, harvestLevel); + ForgeHooks.toolEffectiveness.add(key); + } + + /** + * Remove a block effectiveness mapping. Since setBlockHarvestLevel + * makes the tool class effective against the block by default, this can be + * used to remove that mapping. This will force a block to be harvested at + * the same speed regardless of tool quality, while still requiring a given + * harvesting level. + * + * @param block The block to remove effectiveness from. + * @param metadata The metadata for the block subtype. + * @param toolClass The tool class to remove the effectiveness mapping from. + * @see setToolClass for details on tool classes. + */ + public static void removeBlockEffectiveness(Block block, int metadata, String toolClass) + { + List key = Arrays.asList(block, metadata, toolClass); + ForgeHooks.toolEffectiveness.remove(key); + } + + /** + * Register a block to be harvested by a tool class. + * By default, this sets the block class as effective against that type. + * + * @param block The block to register. + * @param toolClass The tool class to register as able to remove this block. + * You may register the same block multiple times with different tool + * classes, if multiple tool types can be used to harvest this block. + * @param harvestLevel The minimum tool harvest level required to successfully + * harvest the block. + * @see setToolClass for details on tool classes. + */ + public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel) + { + for (int metadata = 0; metadata < 16; metadata++) + { + List key = Arrays.asList(block, metadata, toolClass); + ForgeHooks.toolHarvestLevels.put(key, harvestLevel); + ForgeHooks.toolEffectiveness.add(key); + } + } + + /** + * Returns the block harvest level for a particular tool class. + * + * @param block The block to check. + * @param metadata The metadata for the block subtype. + * @param toolClass The tool class to check as able to remove this block. + * @see setToolClass for details on tool classes. + * @return The harvest level or -1 if no mapping exists. + */ + public static int getBlockHarvestLevel(Block block, int metadata, String toolClass) + { + ForgeHooks.initTools(); + List key = Arrays.asList(block, metadata, toolClass); + Integer harvestLevel = (Integer)ForgeHooks.toolHarvestLevels.get(key); + if(harvestLevel == null) + { + return -1; + } + return harvestLevel; + } + + /** + * Remove a block effectiveness mapping. Since setBlockHarvestLevel + * makes the tool class effective against the block by default, this can be + * used to remove that mapping. This will force a block to be harvested at + * the same speed regardless of tool quality, while still requiring a given + * harvesting level. + * + * @param block The block to remove effectiveness from. + * @param toolClass The tool class to remove the effectiveness mapping from. + * @see setToolClass for details on tool classes. + */ + public static void removeBlockEffectiveness(Block block, String toolClass) + { + for (int metadata = 0; metadata < 16; metadata++) + { + List key = Arrays.asList(block, metadata, toolClass); + ForgeHooks.toolEffectiveness.remove(key); + } + } + + /** + * Method invoked by FML before any other mods are loaded. + */ + public static void initialize() + { + //Cause the classes to initialize if they already haven't + Block.stone.getTextureFile(); + Item.appleGold.getTextureFile(); + + Block filler = null; + try + { + filler = Block.class.getConstructor(int.class, Material.class).newInstance(256, Material.air); + }catch (Exception e){} + + if (filler == null) + { + throw new RuntimeException("Could not create Forge filler block"); + } + + for (int x = 256; x < 4096; x++) + { + if (Item.itemsList[x - 256] != null) + { + Block.blocksList[x] = filler; + } + } + + boolean[] temp = new boolean[4096]; + for (int x = 0; x < EntityEnderman.carriableBlocks.length; x++) + { + temp[x] = EntityEnderman.carriableBlocks[x]; + } + EntityEnderman.carriableBlocks = temp; + + + } } diff --git a/common/net/minecraftforge/event/entity/UseHoeEvent.java b/common/net/minecraftforge/event/entity/UseHoeEvent.java new file mode 100644 index 000000000..554d12b75 --- /dev/null +++ b/common/net/minecraftforge/event/entity/UseHoeEvent.java @@ -0,0 +1,43 @@ +package net.minecraftforge.event.entity; + +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.ItemStack; +import net.minecraft.src.World; + +public class UseHoeEvent extends PlayerEvent +{ + + public final ItemStack current; + public final World world; + public final int x; + public final int y; + public final int z; + + private boolean handeled = false; + + public UseHoeEvent(EntityPlayer player, ItemStack current, World world, int x, int y, int z) + { + super(player); + this.current = current; + this.world = world; + this.x = x; + this.y = y; + this.z = z; + } + + @Override + public boolean isCancelable() + { + return true; + } + + public boolean isHandeled() + { + return handeled; + } + + public void setHandeled() + { + handeled = true; + } +} diff --git a/eclipse/.metadata/.plugins/.gitignore b/eclipse/.metadata/.plugins/.gitignore index 074e4a685..2624991c0 100644 --- a/eclipse/.metadata/.plugins/.gitignore +++ b/eclipse/.metadata/.plugins/.gitignore @@ -10,3 +10,10 @@ /org.eclipse.team.cvs.core/ /org.eclipse.ui.workbench/ /org.eclipse.wb.discovery.core/ +/org.eclipse.recommenders.rcp/ +/org.eclipse.recommenders.completion.rcp.overrides/ +/org.eclipse.recommenders.completion.rcp.calls/ +/org.eclipse.mylyn.context.core/ +/org.eclipse.search/ +/org.eclipse.jdt.debug.ui/ +/org.eclipse.ui.editors/ diff --git a/fml-src-2.9.96.199.zip b/fml-src-2.9.97.200.zip similarity index 93% rename from fml-src-2.9.96.199.zip rename to fml-src-2.9.97.200.zip index 088d8a4b3521e6854024389ea27cf1304e9385b6..0b22de2de74df71c36128076ae95f3b46e4f1c09 100644 GIT binary patch delta 5182 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 M0AK!wWuVCTKl8o)7ytkO diff --git a/forge_common/net/minecraft/src/forge/ForgeHooks.java b/forge_common/net/minecraft/src/forge/ForgeHooks.java index d81fc9250..08ef1ca95 100644 --- a/forge_common/net/minecraft/src/forge/ForgeHooks.java +++ b/forge_common/net/minecraft/src/forge/ForgeHooks.java @@ -40,33 +40,6 @@ import java.util.logging.Level; public class ForgeHooks { - - public static void plantGrassPlant(World world, int x, int y, int z) - { - int index = world.rand.nextInt(plantGrassWeight); - ProbableItem item = getRandomItem(plantGrassList, index); - if (item == null || Block.blocksList[item.ItemID] == null) - { - return; - } - if (mod_MinecraftForge.DISABLE_DARK_ROOMS && !Block.blocksList[item.ItemID].canBlockStay(world, x, y, z)) - { - return; - } - world.setBlockAndMetadataWithNotify(x, y, z, item.ItemID, item.Metadata); - } - - public static ItemStack getGrassSeed(World world) - { - int index = world.rand.nextInt(seedGrassWeight); - ProbableItem item = getRandomItem(seedGrassList, index); - if (item == null) - { - return null; - } - return new ItemStack(item.ItemID, item.Quantity, item.Metadata); - } - // Tool Path // ------------------------------------------------------------ public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) diff --git a/forge_common/net/minecraft/src/forge/IConnectRedstone.java b/forge_common/net/minecraft/src/forge/IConnectRedstone.java deleted file mode 100644 index 6e581369f..000000000 --- a/forge_common/net/minecraft/src/forge/IConnectRedstone.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This software is provided under the terms of the Minecraft Forge Public - * License v1.0. - */ - -package net.minecraft.src.forge; - -import net.minecraft.src.Block; -import net.minecraft.src.IBlockAccess; - -/** - * This interface is to be implemented by Block classes. It will override - * standard algorithms controlling connection between two blocks by redstone - * - * @see Block - */ -public interface IConnectRedstone -{ - /** - * When this returns false, the block at location i, j, k cannot make - * a redstone connection in the direction given in parameter, otherwise - * it can. Use to control which sides are inputs and outputs for redstone - * wires. - */ - public boolean canConnectRedstone(IBlockAccess world, int X, int Y, int Z, int direction); -} diff --git a/forge_common/net/minecraft/src/forge/MinecraftForge.java b/forge_common/net/minecraft/src/forge/MinecraftForge.java index d0c51c7e6..7eb70a56c 100644 --- a/forge_common/net/minecraft/src/forge/MinecraftForge.java +++ b/forge_common/net/minecraft/src/forge/MinecraftForge.java @@ -28,144 +28,6 @@ import java.util.Map.Entry; public class MinecraftForge { - // ------------------------------------------------------------ - - /** Register a new plant to be planted when bonemeal is used on grass. - * @param bid The block ID to plant. - * @param metadata The metadata to plant. - * @param probability The relative probability of the plant, where red flowers are - * 10 and yellow flowers are 20. - */ - public static void addGrassPlant(int blockID, int metadata, int probability) - { - ForgeHooks.addPlantGrass(blockID, metadata, probability); - } - - /** Register a new seed to be dropped when breaking tall grass. - * @param bid The item ID of the seeds. - * @param metadata The metadata of the seeds. - * @param quantity The quantity of seeds to drop. - * @param probability The relative probability of the seeds, where wheat seeds are - * 10. - */ - public static void addGrassSeed(int itemID, int metadata, int quantity, int probability) - { - ForgeHooks.addGrassSeed(itemID, metadata, quantity, probability); - } - - /** Register a tool as a tool class with a given harvest level. - * - * @param tool The custom tool to register. - * @param toolClass The tool class to register as. The predefined tool - * clases are "pickaxe", "shovel", "axe". You can add others for custom - * tools. - * @param harvestLevel The harvest level of the tool. - */ - public static void setToolClass(Item tool, String toolClass, int harvestLevel) - { - ForgeHooks.initTools(); - ForgeHooks.toolClasses.put(tool.shiftedIndex, Arrays.asList(toolClass, harvestLevel)); - } - - /** Register a block to be harvested by a tool class. This is the metadata - * sensitive version, use it if your blocks are using metadata variants. - * By default, this sets the block class as effective against that type. - * - * @param block The block to register. - * @param metadata The metadata for the block subtype. - * @param toolClass The tool class to register as able to remove this block. - * You may register the same block multiple times with different tool - * classes, if multiple tool types can be used to harvest this block. - * @param harvestLevel The minimum tool harvest level required to successfully - * harvest the block. - * @see setToolClass for details on tool classes. - */ - public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel) - { - ForgeHooks.initTools(); - List key = Arrays.asList(block.blockID, metadata, toolClass); - ForgeHooks.toolHarvestLevels.put(key, harvestLevel); - ForgeHooks.toolEffectiveness.add(key); - } - - /** Remove a block effectiveness mapping. Since setBlockHarvestLevel - * makes the tool class effective against the block by default, this can be - * used to remove that mapping. This will force a block to be harvested at - * the same speed regardless of tool quality, while still requiring a given - * harvesting level. - * @param block The block to remove effectiveness from. - * @param metadata The metadata for the block subtype. - * @param toolClass The tool class to remove the effectiveness mapping from. - * @see setToolClass for details on tool classes. - */ - public static void removeBlockEffectiveness(Block block, int metadata, String toolClass) - { - ForgeHooks.initTools(); - List key = Arrays.asList(block.blockID, metadata, toolClass); - ForgeHooks.toolEffectiveness.remove(key); - } - - /** Register a block to be harvested by a tool class. - * By default, this sets the block class as effective against that type. - * - * @param block The block to register. - * @param toolClass The tool class to register as able to remove this block. - * You may register the same block multiple times with different tool - * classes, if multiple tool types can be used to harvest this block. - * @param harvestLevel The minimum tool harvest level required to successfully - * harvest the block. - * @see setToolClass for details on tool classes. - */ - public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel) - { - ForgeHooks.initTools(); - for (int metadata = 0; metadata < 16; metadata++) - { - List key = Arrays.asList(block.blockID, metadata, toolClass); - ForgeHooks.toolHarvestLevels.put(key, harvestLevel); - ForgeHooks.toolEffectiveness.add(key); - } - } - - /** Returns the block harvest level for a particular tool class. - * - * @param block The block to check. - * @param metadata The metadata for the block subtype. - * @param toolClass The tool class to check as able to remove this block. - * @see setToolClass for details on tool classes. - * @return The harvest level or -1 if no mapping exists. - */ - public static int getBlockHarvestLevel(Block block, int metadata, String toolClass) - { - ForgeHooks.initTools(); - List key = Arrays.asList(block.blockID, metadata, toolClass); - Integer harvestLevel = (Integer)ForgeHooks.toolHarvestLevels.get(key); - if(harvestLevel == null) - { - return -1; - } - return harvestLevel; - } - - /** Remove a block effectiveness mapping. Since setBlockHarvestLevel - * makes the tool class effective against the block by default, this can be - * used to remove that mapping. This will force a block to be harvested at - * the same speed regardless of tool quality, while still requiring a given - * harvesting level. - * @param block The block to remove effectiveness from. - * @param toolClass The tool class to remove the effectiveness mapping from. - * @see setToolClass for details on tool classes. - */ - public static void removeBlockEffectiveness(Block block, String toolClass) - { - ForgeHooks.initTools(); - for (int metadata = 0; metadata < 16; metadata++) - { - List key = Arrays.asList(block.blockID, metadata, toolClass); - ForgeHooks.toolEffectiveness.remove(key); - } - } - /** * Kill minecraft with an error message. */ diff --git a/patches/common/net/minecraft/src/AnvilSaveHandler.java.patch b/patches/common/net/minecraft/src/AnvilSaveHandler.java.patch new file mode 100644 index 000000000..d53a1d601 --- /dev/null +++ b/patches/common/net/minecraft/src/AnvilSaveHandler.java.patch @@ -0,0 +1,20 @@ +--- ../src_base/common/net/minecraft/src/AnvilSaveHandler.java ++++ ../src_work/common/net/minecraft/src/AnvilSaveHandler.java +@@ -17,15 +17,9 @@ + File var2 = this.getSaveDirectory(); + File var3; + +- if (par1WorldProvider instanceof WorldProviderHell) ++ if (par1WorldProvider.getSaveFolder() != null) + { +- var3 = new File(var2, "DIM-1"); +- var3.mkdirs(); +- return new AnvilChunkLoader(var3); +- } +- else if (par1WorldProvider instanceof WorldProviderEnd) +- { +- var3 = new File(var2, "DIM1"); ++ var3 = new File(var2, par1WorldProvider.getSaveFolder()); + var3.mkdirs(); + return new AnvilChunkLoader(var3); + } diff --git a/patches/common/net/minecraft/src/BlockContainer.java.patch b/patches/common/net/minecraft/src/BlockContainer.java.patch new file mode 100644 index 000000000..8a9c656d3 --- /dev/null +++ b/patches/common/net/minecraft/src/BlockContainer.java.patch @@ -0,0 +1,24 @@ +--- ../src_base/common/net/minecraft/src/BlockContainer.java ++++ ../src_work/common/net/minecraft/src/BlockContainer.java +@@ -20,7 +20,7 @@ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); +- par1World.setBlockTileEntity(par2, par3, par4, this.createNewTileEntity(par1World)); ++ par1World.setBlockTileEntity(par2, par3, par4, this.createNewTileEntity(par1World, par1World.getBlockMetadata(par2, par3, par4))); + } + + /** +@@ -36,6 +36,12 @@ + * each class overrdies this to return a new + */ + public abstract TileEntity createNewTileEntity(World var1); ++ ++ ++ public TileEntity createNewTileEntity(World world, int metadata) ++ { ++ return createNewTileEntity(world); ++ } + + /** + * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile diff --git a/patches/common/net/minecraft/src/EnchantmentHelper.java.patch b/patches/common/net/minecraft/src/EnchantmentHelper.java.patch new file mode 100644 index 000000000..4a40fb424 --- /dev/null +++ b/patches/common/net/minecraft/src/EnchantmentHelper.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/common/net/minecraft/src/EnchantmentHelper.java ++++ ../src_work/common/net/minecraft/src/EnchantmentHelper.java +@@ -365,7 +365,7 @@ + { + Enchantment var7 = var4[var6]; + +- if (var7 != null && var7.type.canEnchantItem(var2)) ++ if (var7 != null && var7.canEnchantItem(par1ItemStack)) + { + for (int var8 = var7.getMinLevel(); var8 <= var7.getMaxLevel(); ++var8) + { diff --git a/patches/common/net/minecraft/src/SlotCrafting.java.patch b/patches/common/net/minecraft/src/SlotCrafting.java.patch new file mode 100644 index 000000000..ea298d2b5 --- /dev/null +++ b/patches/common/net/minecraft/src/SlotCrafting.java.patch @@ -0,0 +1,10 @@ +--- ../src_base/common/net/minecraft/src/SlotCrafting.java ++++ ../src_work/common/net/minecraft/src/SlotCrafting.java +@@ -107,6 +107,7 @@ + */ + public void onPickupFromSlot(ItemStack par1ItemStack) + { ++ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); + this.onCrafting(par1ItemStack); + + for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2) diff --git a/patches/common/net/minecraft/src/WorldGenDeadBush.java.patch b/patches/common/net/minecraft/src/WorldGenDeadBush.java.patch new file mode 100644 index 000000000..60c7bc398 --- /dev/null +++ b/patches/common/net/minecraft/src/WorldGenDeadBush.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/common/net/minecraft/src/WorldGenDeadBush.java ++++ ../src_work/common/net/minecraft/src/WorldGenDeadBush.java +@@ -16,10 +16,16 @@ + { + int var11; + +- for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) ++ Block block = null; ++ do + { +- ; +- } ++ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)]; ++ if (block != null && !block.isLeaves(par1World, par3, par4, par5)) ++ { ++ break; ++ } ++ par4--; ++ } while (par4 > 0); + + for (int var7 = 0; var7 < 4; ++var7) + { diff --git a/patches/common/net/minecraft/src/WorldGenTallGrass.java.patch b/patches/common/net/minecraft/src/WorldGenTallGrass.java.patch new file mode 100644 index 000000000..e51c8c184 --- /dev/null +++ b/patches/common/net/minecraft/src/WorldGenTallGrass.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/common/net/minecraft/src/WorldGenTallGrass.java ++++ ../src_work/common/net/minecraft/src/WorldGenTallGrass.java +@@ -18,10 +18,16 @@ + { + int var11; + +- for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4) ++ Block block = null; ++ do + { +- ; +- } ++ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)]; ++ if (block != null && !block.isLeaves(par1World, par3, par4, par5)) ++ { ++ break; ++ } ++ par4--; ++ } while (par4 > 0); + + for (int var7 = 0; var7 < 128; ++var7) + { diff --git a/patches/minecraft/net/minecraft/src/Block.java.patch b/patches/minecraft/net/minecraft/src/Block.java.patch new file mode 100644 index 000000000..2dde4109b --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Block.java.patch @@ -0,0 +1,735 @@ +--- ../src_base/minecraft/net/minecraft/src/Block.java ++++ ../src_work/minecraft/net/minecraft/src/Block.java +@@ -1,7 +1,13 @@ + package net.minecraft.src; + ++import java.util.ArrayList; + import java.util.List; + import java.util.Random; ++ ++import net.minecraftforge.common.ForgeHooks; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.common.Orientation; ++import static net.minecraftforge.common.Orientation.*; + + public class Block + { +@@ -277,6 +283,7 @@ + lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0; + canBlockGrass[par1] = !par2Material.getCanBlockGrass(); + } ++ isDefaultTexture = (getTextureFile() != null && getTextureFile().equalsIgnoreCase("/terrain.png")); + } + + /** +@@ -415,9 +422,10 @@ + return this.needsRandomTick; + } + ++ @Deprecated //Forge: New Metadata sensitive version. + public boolean hasTileEntity() + { +- return this.isBlockContainer; ++ return hasTileEntity(0); + } + + /** +@@ -438,7 +446,7 @@ + */ + public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { +- return par1IBlockAccess.getBrightness(par2, par3, par4, lightValue[par1IBlockAccess.getBlockId(par2, par3, par4)]); ++ return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); + } + + /** +@@ -446,7 +454,7 @@ + */ + public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { +- return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, lightValue[par1IBlockAccess.getBlockId(par2, par3, par4)]); ++ return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); + } + + /** +@@ -607,8 +615,7 @@ + */ + public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) + { +- float var6 = this.getBlockHardness(par2World, par3, par4, par5); +- return var6 < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? 1.0F / var6 / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this) / var6 / 30.0F); ++ return ForgeHooks.blockStrength(this, par1EntityPlayer, par2World, par3, par4, par5); + } + + /** +@@ -626,18 +633,13 @@ + { + if (!par1World.isRemote) + { +- int var8 = this.quantityDroppedWithBonus(par7, par1World.rand); +- +- for (int var9 = 0; var9 < var8; ++var9) ++ ArrayList items = getBlockDropped(par1World, par2, par3, par4, par5, par7); ++ ++ for (ItemStack item : items) + { + if (par1World.rand.nextFloat() <= par6) + { +- int var10 = this.idDropped(par5, par1World.rand, par7); +- +- if (var10 > 0) +- { +- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5))); +- } ++ this.dropBlockAsItem_do(par1World, par2, par3, par4, item); + } + } + } +@@ -964,7 +966,7 @@ + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + par2EntityPlayer.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory)) ++ if (this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory)) + { + ItemStack var8 = this.createStackedBlock(par6); + +@@ -1218,4 +1220,638 @@ + canBlockGrass[0] = true; + StatList.initBreakableStats(); + } ++ ++ /* =================================================== FORGE START =====================================*/ ++ protected static int blockFireSpreadSpeed[] = new int[blocksList.length]; ++ protected static int blockFlammability[] = new int[blocksList.length]; ++ protected String currentTexture = "/terrain.png"; ++ public boolean isDefaultTexture = true; ++ ++ /** ++ * Get a light value for this block, normal ranges are between 0 and 15 ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return The light value ++ */ ++ public int getLightValue(IBlockAccess world, int x, int y, int z) ++ { ++ return lightValue[blockID]; ++ } ++ ++ /** ++ * Checks if a player or entity can use this block to 'climb' like a ladder. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block should act like a ladder ++ */ ++ public boolean isLadder(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Return true if the block is a normal, solid cube. This ++ * determines indirect power state, entity ejection from blocks, and a few ++ * others. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block is a full cube ++ */ ++ public boolean isBlockNormalCube(World world, int x, int y, int z) ++ { ++ return blockMaterial.isOpaque() && renderAsNormalBlock(); ++ } ++ ++ /** ++ * Checks if the block is a solid face on the given side, used by placement logic. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @param size The side to check ++ * @return True if the block is solid on the specified side. ++ */ ++ public boolean isBlockSolidOnSide(World world, int x, int y, int z, Orientation side) ++ { ++ int meta = world.getBlockMetadata(x, y, z); ++ if (this instanceof BlockStep) ++ { ++ return (((meta & 8) == 8 && (side == UP)) || isOpaqueCube()); ++ } ++ else if (this instanceof BlockFarmland) ++ { ++ return (side != DOWN && side != UP); ++ } ++ else if (this instanceof BlockStairs) ++ { ++ boolean flipped = ((meta & 4) != 0); ++ return ((meta & 3) + side.ordinal() == 5) || (side == UP && flipped); ++ } ++ return isBlockNormalCube(world, x, y, z); ++ } ++ ++ /** ++ * Determines if a new block can be replace the space occupied by this one, ++ * Used in the player's placement code to make the block act like water, and lava. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block is replaceable by another block ++ */ ++ public boolean isBlockReplaceable(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if this block should set fire and deal fire damage ++ * to entities coming into contact with it. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block should deal damage ++ */ ++ public boolean isBlockBurning(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines this block should be treated as an air block ++ * by the rest of the code. This method is primarily ++ * useful for creating pure logic-blocks that will be invisible ++ * to the player and otherwise interact as air would. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block considered air ++ */ ++ public boolean isAirBlock(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. ++ * ++ * @param player The player damaging the block, may be null ++ * @param meta The block's current metadata ++ * @return True to spawn the drops ++ */ ++ public boolean canHarvestBlock(EntityPlayer player, int meta) ++ { ++ return ForgeHooks.canHarvestBlock(this, player, meta); ++ } ++ ++ /** ++ * Called when a player removes a block. This is responsible for ++ * actually destroying the block, and the block is intact at time of call. ++ * This is called regardless of whether the player can harvest the block or ++ * not. ++ * ++ * Return true if the block is actually destroyed. ++ * ++ * Note: When used in multiplayer, this is called on both client and ++ * server sides! ++ * ++ * @param world The current world ++ * @param player The player damaging the block, may be null ++ * @param x X Position ++ * @param y Y position ++ * @param z Z position ++ * @return True if the block is actually destroyed. ++ */ ++ public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) ++ { ++ return world.setBlockWithNotify(x, y, z, 0); ++ } ++ ++ /** ++ * Called when a new CreativeContainer is opened, populate the list ++ * with all of the items for this block you want a player in creative mode ++ * to have access to. ++ * ++ * @param itemList The list of items to display on the creative inventory. ++ */ ++ public void addCreativeItems(ArrayList itemList) ++ { ++ } ++ ++ /** ++ * Chance that fire will spread and consume this block. ++ * 300 being a 100% chance, 0, being a 0% chance. ++ * ++ * @param world The current world ++ * @param x The blocks X position ++ * @param y The blocks Y position ++ * @param z The blocks Z position ++ * @param metadata The blocks current metadata ++ * @param face The face that the fire is coming from ++ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire ++ */ ++ public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, Orientation face) ++ { ++ return blockFlammability[blockID]; ++ } ++ ++ /** ++ * Called when fire is updating, checks if a block face can catch fire. ++ * ++ * ++ * @param world The current world ++ * @param x The blocks X position ++ * @param y The blocks Y position ++ * @param z The blocks Z position ++ * @param metadata The blocks current metadata ++ * @param face The face that the fire is coming from ++ * @return True if the face can be on fire, false otherwise. ++ */ ++ public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, Orientation face) ++ { ++ return getFlammability(world, x, y, z, metadata, face) > 0; ++ } ++ ++ /** ++ * Called when fire is updating on a neighbor block. ++ * The higher the number returned, the faster fire will spread around this block. ++ * ++ * @param world The current world ++ * @param x The blocks X position ++ * @param y The blocks Y position ++ * @param z The blocks Z position ++ * @param metadata The blocks current metadata ++ * @param face The face that the fire is coming from ++ * @return A number that is used to determine the speed of fire growth around the block ++ */ ++ public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, Orientation face) ++ { ++ return blockFireSpreadSpeed[blockID]; ++ } ++ ++ /** ++ * Currently only called by fire when it is on top of this block. ++ * Returning true will prevent the fire from naturally dying during updating. ++ * Also prevents firing from dying from rain. ++ * ++ * @param world The current world ++ * @param x The blocks X position ++ * @param y The blocks Y position ++ * @param z The blocks Z position ++ * @param metadata The blocks current metadata ++ * @param side The face that the fire is coming from ++ * @return ++ */ ++ public boolean isFireSource(World world, int x, int y, int z, int metadata, Orientation side) ++ { ++ if (blockID == Block.netherrack.blockID && side == UP) ++ { ++ return true; ++ } ++ if ((world.provider instanceof WorldProviderEnd) && blockID == Block.bedrock.blockID && side == UP) ++ { ++ return true; ++ } ++ return false; ++ } ++ ++ /** ++ * Called by BlockFire to setup the burn values of vanilla blocks. ++ * @param id The block id ++ * @param encouragement How much the block encourages fire to spread ++ * @param flammability how easy a block is to catch fire ++ */ ++ public static void setBurnProperties(int id, int encouragement, int flammability) ++ { ++ blockFireSpreadSpeed[id] = encouragement; ++ blockFlammability[id] = flammability; ++ } ++ ++ /** ++ * Called throughout the code as a replacement for block instanceof BlockContainer ++ * Moving this to the Block base class allows for mods that wish to extend vinella ++ * blocks, and also want to have a tile entity on that block, may. ++ * ++ * Return true from this function to specify this block has a tile entity. ++ * ++ * @param metadata Metadata of the current block ++ * @return True if block has a tile entity, false otherwise ++ */ ++ public boolean hasTileEntity(int metadata) ++ { ++ return isBlockContainer; ++ } ++ ++ /** ++ * Called throughout the code as a replacement for BlockContainer.getBlockEntity ++ * Return the same thing you would from that function. ++ * This will fall back to BlockContainer.getBlockEntity if this block is a BlockContainer. ++ * ++ * @param metadata The Metadata of the current block ++ * @return A instance of a class extending TileEntity ++ */ ++ public TileEntity createTileEntity(World world, int metadata) ++ { ++ if (this instanceof BlockContainer) ++ { ++ return ((BlockContainer)this).createNewTileEntity(world, metadata); ++ } ++ return null; ++ } ++ ++ /** ++ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand) ++ * version in 1.1. ++ * ++ * @param meta Blocks Metadata ++ * @param fortune Current item fortune level ++ * @param random Random number generator ++ * @return The number of items to drop ++ */ ++ public int quantityDropped(int meta, int fortune, Random random) ++ { ++ return quantityDroppedWithBonus(fortune, random); ++ } ++ ++ /** ++ * This returns a complete list of items dropped from this block. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param Y Y Position ++ * @param Z Z Position ++ * @param metadata Current metadata ++ * @param fortune Breakers fortune level ++ * @return A ArrayList containing all items this block drops ++ */ ++ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ ++ int count = quantityDropped(metadata, fortune, world.rand); ++ for(int i = 0; i < count; i++) ++ { ++ int id = idDropped(metadata, world.rand, 0); ++ if (id > 0) ++ { ++ ret.add(new ItemStack(id, 1, damageDropped(metadata))); ++ } ++ } ++ return ret; ++ } ++ ++ /** ++ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. ++ * ++ * @param world The world ++ * @param player The player doing the harvesting ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param metadata The metadata ++ * @return True if the block can be directly harvested using silk touch ++ */ ++ public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) ++ { ++ if (this instanceof BlockGlass) ++ { ++ return true; ++ } ++ return renderAsNormalBlock() && !hasTileEntity(metadata); ++ } ++ ++ /** ++ * Determines if a specified mob type can spawn on this block, returning false will ++ * prevent any mob from spawning on the block. ++ * ++ * @param type The Mob Category Type ++ * @param world The current world ++ * @param x The X Position ++ * @param y The Y Position ++ * @param z The Z Position ++ * @return True to allow a mob of the specified category to spawn, false to prevent it. ++ */ ++ public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z) ++ { ++ int meta = world.getBlockMetadata(x, y, z); ++ if (this instanceof BlockStep) ++ { ++ if (MinecraftForge.SPAWNER_ALLOW_ON_INVERTED) ++ { ++ return (((meta & 8) == 8) || isOpaqueCube()); ++ } ++ else ++ { ++ return isNormalCube(this.blockID); ++ } ++ } ++ else if (this instanceof BlockStairs) ++ { ++ if (MinecraftForge.SPAWNER_ALLOW_ON_INVERTED) ++ { ++ return ((meta & 4) != 0); ++ } ++ else ++ { ++ return isNormalCube(this.blockID); ++ } ++ } ++ return isBlockSolidOnSide(world, x, y, z, UP); ++ } ++ ++ /** ++ * Determines if this block is classified as a Bed, Allowing ++ * players to sleep in it, though the block has to specifically ++ * perform the sleeping functionality in it's activated event. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param player The player or camera entity, null in some cases. ++ * @return True to treat this as a bed ++ */ ++ public boolean isBed(World world, int x, int y, int z, EntityLiving player) ++ { ++ return blockID == Block.bed.blockID; ++ } ++ ++ /** ++ * Returns the position that the player is moved to upon ++ * waking up, or respawning at the bed. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param player The player or camera entity, null in some cases. ++ * @return The spawn position ++ */ ++ public ChunkCoordinates getBedSpawnPosition(World world, int x, int y, int z, EntityPlayer player) ++ { ++ return BlockBed.getNearestEmptyChunkCoordinates(world, x, y, z, 0); ++ } ++ ++ /** ++ * Called when a user either starts or stops sleeping in the bed. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param player The player or camera entity, null in some cases. ++ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed ++ */ ++ public void setBedOccupied(World world, int x, int y, int z, EntityPlayer player, boolean occupied) ++ { ++ BlockBed.setBedOccupied(world, x, y, z, occupied); ++ } ++ ++ /** ++ * Returns the direction of the block. Same values that ++ * are returned by BlockDirectional ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return Bed direction ++ */ ++ public int getBedDirection(IBlockAccess world, int x, int y, int z) ++ { ++ return BlockBed.getDirection(world.getBlockMetadata(x, y, z)); ++ } ++ ++ /** ++ * Determines if the current block is the foot half of the bed. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return True if the current block is the foot side of a bed. ++ */ ++ public boolean isBedFoot(IBlockAccess world, int x, int y, int z) ++ { ++ return BlockBed.isBlockHeadOfBed(world.getBlockMetadata(x, y, z)); ++ } ++ ++ /** ++ * Called when a leaf should start its decay process. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ */ ++ public void beginLeavesDecay(World world, int x, int y, int z){} ++ ++ /** ++ * Determines if this block can prevent leaves connected to it from decaying. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return true if the presence this block can prevent leaves from decaying. ++ */ ++ public boolean canSustainLeaves(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return true if this block is considered leaves. ++ */ ++ public boolean isLeaves(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Used during tree growth to determine if newly generated leaves can replace this block. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return true if this block can be replaced by growing leaves. ++ */ ++ public boolean canBeReplacedByLeaves(World world, int x, int y, int z) ++ { ++ return !Block.opaqueCubeLookup[this.blockID]; ++ } ++ ++ /** ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return true if the block is wood (logs) ++ */ ++ public boolean isWood(World world, int x, int y, int z) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if the current block is replaceable by Ore veins during world generation. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return True to allow this block to be replaced by a ore ++ */ ++ public boolean isGenMineableReplaceable(World world, int x, int y, int z) ++ { ++ return blockID == stone.blockID; ++ } ++ ++ /** ++ * Grabs the current texture file used for this block ++ */ ++ public String getTextureFile() ++ { ++ return currentTexture; ++ } ++ ++ /** ++ * Sets the current texture file for this block, used when rendering. ++ * Default is "/terrain.png" ++ * ++ * @param texture The texture file ++ */ ++ public void setTextureFile(String texture) ++ { ++ currentTexture = texture; ++ isDefaultTexture = false; ++ } ++ ++ ++ /** ++ * Location sensitive version of getExplosionRestance ++ * ++ * @param par1Entity ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param explosionX ++ * @param explosionY ++ * @param explosionZ ++ * @return ++ */ ++ public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) ++ { ++ return getExplosionResistance(par1Entity); ++ } ++ ++ /** ++ * Determine if this block can make a redstone connection on the side provided, ++ * Useful to control which sides are inputs and outputs for redstone wires. ++ * ++ * Side: ++ * -1: UP ++ * 0: NORTH ++ * 1: EAST ++ * 2: SOUTH ++ * 3: WEST ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param side The side that is trying to make the connection ++ * @return True to make the connection ++ */ ++ public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) ++ { ++ return Block.blocksList[blockID].canProvidePower() && side != -1; ++ } ++ ++ /** ++ * Determines if a torch can be placed on the top surface of this block. ++ * Useful for creating your own block that torches can be on, such as fences. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return True to allow the torch to be placed ++ */ ++ public boolean canPlaceTorchOnTop(World world, int x, int y, int z) ++ { ++ if (world.doesBlockHaveSolidTopSurface(x, y, z)) ++ { ++ return true; ++ } ++ else ++ { ++ int id = world.getBlockId(x, y, z); ++ return id == Block.fence.blockID || id == Block.netherFence.blockID || id == Block.glass.blockID; ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/src/BlockChest.java.patch b/patches/minecraft/net/minecraft/src/BlockChest.java.patch new file mode 100644 index 000000000..47b69d276 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockChest.java.patch @@ -0,0 +1,53 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockChest.java ++++ ../src_work/minecraft/net/minecraft/src/BlockChest.java +@@ -2,6 +2,8 @@ + + import java.util.Iterator; + import java.util.Random; ++ ++import static net.minecraftforge.common.Orientation.*; + + public class BlockChest extends BlockContainer + { +@@ -379,7 +381,7 @@ + { + return true; + } +- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) ++ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) + { + return true; + } +@@ -387,19 +389,19 @@ + { + return true; + } +- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) +- { +- return true; +- } +- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) +- { +- return true; +- } +- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) +- { +- return true; +- } +- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) ++ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) ++ { ++ return true; ++ } ++ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) ++ { ++ return true; ++ } ++ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) ++ { ++ return true; ++ } ++ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockCrops.java.patch b/patches/minecraft/net/minecraft/src/BlockCrops.java.patch new file mode 100644 index 000000000..320c0f3f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockCrops.java.patch @@ -0,0 +1,50 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockCrops.java ++++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java +@@ -1,5 +1,6 @@ + package net.minecraft.src; + ++import java.util.ArrayList; + import java.util.Random; + + public class BlockCrops extends BlockFlower +@@ -136,25 +137,26 @@ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); ++ } ++ ++ @Override ++ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ if (metadata == 7) ++ { ++ ret.add(new ItemStack(Item.wheat)); ++ } + +- if (!par1World.isRemote) ++ for (int n = 0; n < 3 + fortune; n++) + { +- int var8 = 3 + par7; +- +- for (int var9 = 0; var9 < var8; ++var9) ++ if (world.rand.nextInt(15) <= metadata) + { +- if (par1World.rand.nextInt(15) <= par5) +- { +- float var10 = 0.7F; +- float var11 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F; +- float var12 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F; +- float var13 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F; +- EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var11), (double)((float)par3 + var12), (double)((float)par4 + var13), new ItemStack(Item.seeds)); +- var14.delayBeforeCanPickup = 10; +- par1World.spawnEntityInWorld(var14); +- } ++ ret.add(new ItemStack(Item.seeds)); + } + } ++ ++ return ret; + } + + /** diff --git a/patches/minecraft/net/minecraft/src/BlockDoor.java.patch b/patches/minecraft/net/minecraft/src/BlockDoor.java.patch new file mode 100644 index 000000000..a7c700dd2 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockDoor.java.patch @@ -0,0 +1,38 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockDoor.java ++++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java +@@ -1,6 +1,8 @@ + package net.minecraft.src; + + import java.util.Random; ++ ++import static net.minecraftforge.common.Orientation.*; + + public class BlockDoor extends Block + { +@@ -257,7 +259,7 @@ + { + if (this.blockMaterial == Material.iron) + { +- return true; ++ return false; //Allow items to interact with the door + } + else + { +@@ -327,7 +329,7 @@ + var7 = true; + } + +- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP)) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + var7 = true; +@@ -392,7 +394,7 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { +- return par3 >= 255 ? false : par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4); ++ return par3 >= 255 ? false : par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4); + } + + /** diff --git a/patches/minecraft/net/minecraft/src/BlockFire.java.patch b/patches/minecraft/net/minecraft/src/BlockFire.java.patch new file mode 100644 index 000000000..2caa28172 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockFire.java.patch @@ -0,0 +1,257 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockFire.java ++++ ../src_work/minecraft/net/minecraft/src/BlockFire.java +@@ -1,6 +1,9 @@ + package net.minecraft.src; + + import java.util.Random; ++ ++import net.minecraftforge.common.Orientation; ++import static net.minecraftforge.common.Orientation.*; + + public class BlockFire extends Block + { +@@ -25,6 +28,8 @@ + */ + public void initializeBlock() + { ++ abilityToCatchFire = Block.blockFlammability; ++ chanceToEncourageFire = Block.blockFireSpreadSpeed; + this.setBurnRate(Block.planks.blockID, 5, 20); + this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20); + this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20); +@@ -49,8 +54,7 @@ + */ + private void setBurnRate(int par1, int par2, int par3) + { +- this.chanceToEncourageFire[par1] = par2; +- this.abilityToCatchFire[par1] = par3; ++ Block.setBurnProperties(par1, par2, par3); + } + + /** +@@ -108,12 +112,8 @@ + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { +- boolean var6 = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; +- +- if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID) +- { +- var6 = true; +- } ++ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; ++ boolean var6 = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP)); + + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { +@@ -137,12 +137,12 @@ + + if (!var6 && !this.canNeighborBurn(par1World, par2, par3, par4)) + { +- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || var7 > 3) ++ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) || var7 > 3) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } + } +- else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && var7 == 15 && par5Random.nextInt(4) == 0) ++ else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && var7 == 15 && par5Random.nextInt(4) == 0) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + } +@@ -156,12 +156,12 @@ + var9 = -50; + } + +- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7); +- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7); +- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7); +- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7); +- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7); +- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7); ++ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7, WEST ); ++ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7, EAST ); ++ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7, UP ); ++ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7, DOWN); ++ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7, SOUTH); ++ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7, NORTH); + + for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10) + { +@@ -211,7 +211,16 @@ + + private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) + { +- int var8 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; ++ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP); ++ } ++ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, Orientation face) ++ { ++ int var8 = 0; ++ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)]; ++ if (block != null) ++ { ++ var8 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face); ++ } + + if (par6Random.nextInt(par5) < var8) + { +@@ -245,7 +254,12 @@ + */ + private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) + { +- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1))))); ++ return canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST ) || ++ canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST ) || ++ canBlockCatchFire(par1World, par2, par3 - 1, par4, UP ) || ++ canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN ) || ++ canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH) || ++ canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH); + } + + /** +@@ -261,12 +275,12 @@ + } + else + { +- int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5); +- var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6); +- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6); ++ int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5, WEST); ++ var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6, EAST ); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6, UP ); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6, DOWN ); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6, SOUTH); ++ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6, NORTH); + return var6; + } + } +@@ -281,21 +295,24 @@ + + /** + * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z +- */ ++ * Deprecated for a side-sensitive version ++ */ ++ @Deprecated + public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { +- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0; ++ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, UP); + } + + /** + * Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the + * current number passed in it will return its number instead of the passed in one. Args: world, x, y, z, + * curChanceToEncourageFire +- */ ++ * Deprecated for a side-sensitive version ++ */ ++ @Deprecated + public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5) + { +- int var6 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)]; +- return var6 > par5 ? var6 : par5; ++ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP); + } + + /** +@@ -351,9 +368,9 @@ + float var8; + float var9; + +- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4)) +- { +- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4)) ++ if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP)) ++ { ++ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -364,7 +381,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4)) ++ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -375,7 +392,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1)) ++ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -386,7 +403,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1)) ++ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -397,7 +414,7 @@ + } + } + +- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4)) ++ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN)) + { + for (var6 = 0; var6 < 2; ++var6) + { +@@ -419,4 +436,46 @@ + } + } + } ++ ++ /** ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param face The side the fire is coming from ++ * @return True if the face can catch fire. ++ */ ++ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, Orientation face) ++ { ++ Block block = Block.blocksList[world.getBlockId(x, y, z)]; ++ if (block != null) ++ { ++ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face); ++ } ++ return false; ++ } ++ ++ /** ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @param oldChance The previous maximum chance. ++ * @param face The side the fire is coming from ++ * @return The chance of the block catching fire, or oldChance if it is higher ++ */ ++ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, Orientation face) ++ { ++ int newChance = 0; ++ Block block = Block.blocksList[world.getBlockId(x, y, z)]; ++ if (block != null) ++ { ++ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face); ++ } ++ return (newChance > oldChance ? newChance : oldChance); ++ } + } diff --git a/patches/minecraft/net/minecraft/src/BlockLadder.java.patch b/patches/minecraft/net/minecraft/src/BlockLadder.java.patch new file mode 100644 index 000000000..8b14b66ee --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockLadder.java.patch @@ -0,0 +1,89 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java ++++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java +@@ -1,6 +1,9 @@ + package net.minecraft.src; + + import java.util.Random; ++ ++import net.minecraftforge.common.Orientation; ++import static net.minecraftforge.common.Orientation.*; + + public class BlockLadder extends Block + { +@@ -103,7 +106,10 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { +- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); ++ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) || ++ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH); + } + + /** +@@ -113,22 +119,22 @@ + { + int var9 = par1World.getBlockMetadata(par2, par3, par4); + +- if ((var9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if ((var9 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) + { + var9 = 2; + } + +- if ((var9 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if ((var9 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) + { + var9 = 3; + } + +- if ((var9 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if ((var9 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) + { + var9 = 4; + } + +- if ((var9 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if ((var9 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) + { + var9 = 5; + } +@@ -145,22 +151,22 @@ + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + +- if (var6 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) ++ if (var6 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) + { + var7 = true; + } + +- if (var6 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) ++ if (var6 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) + { + var7 = true; + } + +- if (var6 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) ++ if (var6 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) + { + var7 = true; + } + +- if (var6 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) ++ if (var6 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) + { + var7 = true; + } +@@ -181,4 +187,10 @@ + { + return 1; + } ++ ++ @Override ++ public boolean isLadder(World world, int x, int y, int z) ++ { ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch new file mode 100644 index 000000000..198905ffb --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockLeaves.java.patch @@ -0,0 +1,93 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockLeaves.java ++++ ../src_work/minecraft/net/minecraft/src/BlockLeaves.java +@@ -1,9 +1,12 @@ + package net.minecraft.src; + ++import java.util.ArrayList; + import java.util.List; + import java.util.Random; + +-public class BlockLeaves extends BlockLeavesBase ++import net.minecraftforge.common.IShearable; ++ ++public class BlockLeaves extends BlockLeavesBase implements IShearable + { + /** + * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can +@@ -91,10 +94,9 @@ + { + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); + +- if (var12 == Block.leaves.blockID) ++ if (Block.blocksList[var12] != null) + { +- int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); +- par1World.setBlockMetadata(par2 + var9, par3 + var10, par4 + var11, var13 | 8); ++ Block.blocksList[var10].beginLeavesDecay(par1World, par2 + var9, par3 + var10, par4 + var11); + } + } + } +@@ -140,11 +142,13 @@ + { + var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14); + +- if (var15 == Block.wood.blockID) ++ Block block = Block.blocksList[var15]; ++ ++ if (block != null && block.canSustainLeaves(par1World, par2 + var12, par3 + var13, par4 + var14)) + { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0; + } +- else if (var15 == Block.leaves.blockID) ++ else if (block != null && block.isLeaves(par1World, par2 + var12, par3 + var13, par4 + var14)) + { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2; + } +@@ -285,15 +289,7 @@ + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { +- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) +- { +- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); +- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3)); +- } +- else +- { +- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); +- } ++ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + + /** +@@ -340,4 +336,30 @@ + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + } ++ ++ @Override ++ public boolean isShearable(ItemStack item, World world, int x, int y, int z) ++ { ++ return true; ++ } ++ ++ @Override ++ public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); ++ return ret; ++ } ++ ++ @Override ++ public void beginLeavesDecay(World world, int x, int y, int z) ++ { ++ world.setBlockMetadata(x, y, z, world.getBlockMetadata(x, y, z) | 8); ++ } ++ ++ @Override ++ public boolean isLeaves(World world, int x, int y, int z) ++ { ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/src/BlockLog.java.patch b/patches/minecraft/net/minecraft/src/BlockLog.java.patch new file mode 100644 index 000000000..b4853dd39 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockLog.java.patch @@ -0,0 +1,36 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockLog.java ++++ ../src_work/minecraft/net/minecraft/src/BlockLog.java +@@ -57,14 +57,9 @@ + { + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); + +- if (var12 == Block.leaves.blockID) ++ if (Block.blocksList[var12] != null) + { +- int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); +- +- if ((var13 & 8) == 0) +- { +- par1World.setBlockMetadata(par2 + var9, par3 + var10, par4 + var11, var13 | 8); +- } ++ Block.blocksList[var10].beginLeavesDecay(par1World, par2 + var9, par3 + var10, par4 + var11); + } + } + } +@@ -144,4 +139,16 @@ + { + return new ItemStack(this.blockID, 1, limitToValidMetadata(par1)); + } ++ ++ @Override ++ public boolean canSustainLeaves(World world, int x, int y, int z) ++ { ++ return true; ++ } ++ ++ @Override ++ public boolean isWood(World world, int x, int y, int z) ++ { ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch b/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch new file mode 100644 index 000000000..aed60fc01 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockNetherStalk.java.patch @@ -0,0 +1,60 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockNetherStalk.java ++++ ../src_work/minecraft/net/minecraft/src/BlockNetherStalk.java +@@ -1,5 +1,6 @@ + package net.minecraft.src; + ++import java.util.ArrayList; + import java.util.Random; + + public class BlockNetherStalk extends BlockFlower +@@ -67,25 +68,7 @@ + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { +- if (!par1World.isRemote) +- { +- int var8 = 1; +- +- if (par5 >= 3) +- { +- var8 = 2 + par1World.rand.nextInt(3); +- +- if (par7 > 0) +- { +- var8 += par1World.rand.nextInt(par7 + 1); +- } +- } +- +- for (int var9 = 0; var9 < var8; ++var9) +- { +- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds)); +- } +- } ++ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + } + + /** +@@ -111,4 +94,23 @@ + { + return Item.netherStalkSeeds.shiftedIndex; + } ++ ++ @Override ++ public ArrayList getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ int count = 1; ++ ++ if (metadata >= 3) ++ { ++ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0); ++ } ++ ++ for (int i = 0; i < count; i++) ++ { ++ ret.add(new ItemStack(Item.netherStalkSeeds)); ++ } ++ ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch new file mode 100644 index 000000000..dea69ca51 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockPistonBase.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockPistonBase.java ++++ ../src_work/minecraft/net/minecraft/src/BlockPistonBase.java +@@ -364,7 +364,7 @@ + return false; + } + +- return !(Block.blocksList[par0] instanceof BlockContainer); ++ return !par1World.blockHasTileEntity(par2, par3, par4); + } + } + diff --git a/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch new file mode 100644 index 000000000..80b97d424 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockRedstoneWire.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java ++++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java +@@ -550,7 +550,7 @@ + } + else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID) + { +- return Block.blocksList[var5].canProvidePower() && par4 != -1; ++ return (Block.blocksList[var5] != null && Block.blocksList[var5].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4)); + } + else + { diff --git a/patches/minecraft/net/minecraft/src/BlockSnow.java.patch b/patches/minecraft/net/minecraft/src/BlockSnow.java.patch new file mode 100644 index 000000000..eae26843d --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockSnow.java.patch @@ -0,0 +1,54 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockSnow.java ++++ ../src_work/minecraft/net/minecraft/src/BlockSnow.java +@@ -55,7 +55,8 @@ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3 - 1, par4); +- return var5 != 0 && (var5 == Block.leaves.blockID || Block.blocksList[var5].isOpaqueCube()) ? par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement() : false; ++ Block block = Block.blocksList[var5]; ++ return block != null && (block.isLeaves(par1World, par2, par3 - 1, par4) || Block.blocksList[var5].isOpaqueCube()) ? par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement() : false; + } + + /** +@@ -74,7 +75,6 @@ + { + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { +- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockWithNotify(par2, par3, par4, 0); + return false; + } +@@ -90,15 +90,7 @@ + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { +- int var7 = Item.snowball.shiftedIndex; +- float var8 = 0.7F; +- double var9 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; +- double var11 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; +- double var13 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D; +- EntityItem var15 = new EntityItem(par1World, (double)par3 + var9, (double)par4 + var11, (double)par5 + var13, new ItemStack(var7, 1, 0)); +- var15.delayBeforeCanPickup = 10; +- par1World.spawnEntityInWorld(var15); +- par1World.setBlockWithNotify(par3, par4, par5, 0); ++ dropBlockAsItem(par1World, par3, par4, par5, par6, 0); + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + } + +@@ -115,7 +107,7 @@ + */ + public int quantityDropped(Random par1Random) + { +- return 0; ++ return 1; + } + + /** +@@ -125,7 +117,6 @@ + { + if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) + { +- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockWithNotify(par2, par3, par4, 0); + } + } diff --git a/patches/minecraft/net/minecraft/src/BlockTorch.java.patch b/patches/minecraft/net/minecraft/src/BlockTorch.java.patch new file mode 100644 index 000000000..9b0793f57 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockTorch.java.patch @@ -0,0 +1,133 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java ++++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java +@@ -1,6 +1,9 @@ + package net.minecraft.src; + + import java.util.Random; ++ ++import net.minecraftforge.common.Orientation; ++import static net.minecraftforge.common.Orientation.*; + + public class BlockTorch extends Block + { +@@ -50,15 +53,8 @@ + */ + private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) + { +- if (par1World.doesBlockHaveSolidTopSurface(par2, par3, par4)) +- { +- return true; +- } +- else +- { +- int var5 = par1World.getBlockId(par2, par3, par4); +- return var5 == Block.fence.blockID || var5 == Block.netherFence.blockID || var5 == Block.glass.blockID; +- } ++ int id = par1World.getBlockId(par2, par3, par4); ++ return (Block.blocksList[id] != null && Block.blocksList[id].canPlaceTorchOnTop(par1World, par2, par3, par4)); + } + + /** +@@ -66,7 +62,11 @@ + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { +- return par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) ? true : this.canPlaceTorchOn(par1World, par2, par3 - 1, par4)))); ++ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) || ++ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) || ++ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) || ++ canPlaceTorchOn(par1World, par2, par3 - 1, par4); + } + + /** +@@ -81,22 +81,22 @@ + var9 = 5; + } + +- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) ++ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) + { + var9 = 4; + } + +- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) ++ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) + { + var9 = 3; + } + +- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) ++ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, NORTH, true)) + { + var9 = 2; + } + +- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) ++ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, SOUTH, true)) + { + var9 = 1; + } +@@ -122,19 +122,19 @@ + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { +- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) ++ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1); + } +- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) ++ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2); + } +- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) ++ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3); + } +- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) ++ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 4); + } +@@ -157,22 +157,22 @@ + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + +- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && var6 == 1) +- { +- var7 = true; +- } +- +- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && var6 == 2) +- { +- var7 = true; +- } +- +- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && var6 == 3) +- { +- var7 = true; +- } +- +- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && var6 == 4) ++ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) && var6 == 1) ++ { ++ var7 = true; ++ } ++ ++ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) && var6 == 2) ++ { ++ var7 = true; ++ } ++ ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) && var6 == 3) ++ { ++ var7 = true; ++ } ++ ++ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) && var6 == 4) + { + var7 = true; + } diff --git a/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch new file mode 100644 index 000000000..33fd69c7f --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockTrapDoor.java.patch @@ -0,0 +1,56 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java ++++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java +@@ -1,7 +1,13 @@ + package net.minecraft.src; ++ ++import net.minecraftforge.common.Orientation; + + public class BlockTrapDoor extends Block + { ++ ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; ++ + protected BlockTrapDoor(int par1, Material par2Material) + { + super(par1, par2Material); +@@ -183,7 +189,7 @@ + --var7; + } + +- if (!isValidSupportBlock(par1World.getBlockId(var7, par3, var8))) ++ if (!(isValidSupportBlock(par1World.getBlockId(var7, par3, var8)) || par1World.isBlockSolidOnSide(var7, par3, var8, Orientation.getOrientation((var6 & 3) + 2)))) + { + par1World.setBlockWithNotify(par2, par3, par4, 0); + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); +@@ -243,6 +249,10 @@ + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { ++ if (disableValidation) ++ { ++ return true; ++ } + if (par5 == 0) + { + return false; +@@ -273,7 +283,7 @@ + --par2; + } + +- return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)); ++ return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)) || par1World.isBlockSolidOnSide(par2, par3, par4, Orientation.UP); + } + } + +@@ -288,6 +298,10 @@ + */ + private static boolean isValidSupportBlock(int par0) + { ++ if (disableValidation) ++ { ++ return true; ++ } + if (par0 <= 0) + { + return false; diff --git a/patches/minecraft/net/minecraft/src/BlockVine.java.patch b/patches/minecraft/net/minecraft/src/BlockVine.java.patch new file mode 100644 index 000000000..86014d8aa --- /dev/null +++ b/patches/minecraft/net/minecraft/src/BlockVine.java.patch @@ -0,0 +1,50 @@ +--- ../src_base/minecraft/net/minecraft/src/BlockVine.java ++++ ../src_work/minecraft/net/minecraft/src/BlockVine.java +@@ -2,7 +2,10 @@ + + import java.util.Random; + +-public class BlockVine extends Block ++import java.util.ArrayList; ++import net.minecraftforge.common.IShearable; ++ ++public class BlockVine extends Block implements IShearable + { + public BlockVine(int par1) + { +@@ -424,14 +427,26 @@ + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { +- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex) +- { +- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); +- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0)); +- } +- else +- { +- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); +- } ++ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); ++ } ++ ++ @Override ++ public boolean isShearable(ItemStack item, World world, int x, int y, int z) ++ { ++ return true; ++ } ++ ++ @Override ++ public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) ++ { ++ ArrayList ret = new ArrayList(); ++ ret.add(new ItemStack(this, 1, 0)); ++ return ret; ++ } ++ ++ @Override ++ public boolean isLadder(World world, int x, int y, int z) ++ { ++ return true; + } + } diff --git a/patches/minecraft/net/minecraft/src/Chunk.java.patch b/patches/minecraft/net/minecraft/src/Chunk.java.patch index 53054363c..ab95fd704 100644 --- a/patches/minecraft/net/minecraft/src/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/src/Chunk.java.patch @@ -121,7 +121,7 @@ if (var14 == null) { - var14 = ((BlockContainer)Block.blocksList[par4]).createNewTileEntity(this.worldObj); -+ var14 = Block.blocksList[par4].getTileEntity(this.worldObj, par5); ++ var14 = Block.blocksList[par4].createTileEntity(this.worldObj, par5); this.worldObj.setBlockTileEntity(var12, par2, var13, var14); } @@ -215,7 +215,7 @@ if (var5 == null) { - var5 = ((BlockContainer)Block.blocksList[var6]).createNewTileEntity(this.worldObj); -+ var5 = Block.blocksList[var6].createNewTileEntity(this.worldObj, meta); ++ var5 = Block.blocksList[var6].createTileEntity(this.worldObj, meta); this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5); } diff --git a/patches/minecraft/net/minecraft/src/ContainerFurnace.java.patch b/patches/minecraft/net/minecraft/src/ContainerFurnace.java.patch new file mode 100644 index 000000000..1eddfca0c --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ContainerFurnace.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/src/ContainerFurnace.java ++++ ../src_work/minecraft/net/minecraft/src/ContainerFurnace.java +@@ -119,7 +119,7 @@ + } + else if (par1 != 1 && par1 != 0) + { +- if (FurnaceRecipes.smelting().getSmeltingResult(var4.getItem().shiftedIndex) != null) ++ if (FurnaceRecipes.smelting().getSmeltingResult(var4) != null) + { + if (!this.mergeItemStack(var4, 0, 1, false)) + { diff --git a/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch new file mode 100644 index 000000000..d80084070 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EffectRenderer.java.patch @@ -0,0 +1,148 @@ +--- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java ++++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java +@@ -1,9 +1,19 @@ + package net.minecraft.src; + + import java.util.ArrayList; ++import java.util.Hashtable; ++import java.util.Iterator; + import java.util.List; ++import java.util.Map.Entry; + import java.util.Random; ++ ++import net.minecraftforge.client.ForgeHooksClient; ++import net.minecraftforge.common.ForgeHooks; ++import com.google.common.collect.ArrayListMultimap; ++import com.google.common.collect.Multimap; ++ + import org.lwjgl.opengl.GL11; ++ + + public class EffectRenderer + { +@@ -15,6 +25,8 @@ + /** RNG. */ + private Random rand = new Random(); + ++ private Multimap effectList = ArrayListMultimap.create(); ++ + public EffectRenderer(World par1World, RenderEngine par2RenderEngine) + { + if (par1World != null) +@@ -55,6 +67,17 @@ + { + this.fxLayers[var1].remove(var2--); + } ++ } ++ } ++ ++ Iterator> itr = effectList.entries().iterator(); ++ while (itr.hasNext()) ++ { ++ EntityFX fx = itr.next().getValue(); ++ fx.onUpdate(); ++ if (fx.isDead) ++ { ++ itr.remove(); + } + } + } +@@ -109,6 +132,26 @@ + var10.draw(); + } + } ++ ++ for (String key : effectList.keySet()) ++ { ++ ForgeHooksClient.bindTexture(key, 0); ++ for (EntityFX entry : effectList.get(key)) ++ { ++ Tessellator tessallator = Tessellator.instance; ++ //GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderer.getTexture(key)); ++ tessallator.startDrawingQuads(); ++ ++ if (entry.getFXLayer() != 3) ++ { ++ tessallator.setBrightness(entry.getBrightnessForRender(par2)); ++ entry.renderParticle(tessallator, par2, var3, var7, var4, var5, var6); ++ } ++ ++ tessallator.draw(); ++ } ++ ForgeHooksClient.unbindTexture(); ++ } + } + + public void func_78872_b(Entity par1Entity, float par2) +@@ -141,6 +184,8 @@ + { + this.fxLayers[var2].clear(); + } ++ ++ effectList.clear(); + } + + public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5) +@@ -160,7 +205,7 @@ + double var13 = (double)par2 + ((double)var9 + 0.5D) / (double)var7; + double var15 = (double)par3 + ((double)var10 + 0.5D) / (double)var7; + int var17 = this.rand.nextInt(6); +- this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_70596_a(par1, par2, par3)); ++ this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_70596_a(par1, par2, par3), var6); + } + } + } +@@ -212,12 +257,51 @@ + var8 = (double)par1 + var6.maxX + (double)var7; + } + +- this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_70596_a(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); ++ this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_70596_a(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F), var6); + } + } + + public String getStatistics() + { +- return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); ++ int size = 0; ++ for (List x : fxLayers) ++ { ++ size += x.size(); ++ } ++ size += effectList.size(); ++ return Integer.toString(size); ++ } ++ ++ public void addEffect(EntityFX effect, Object obj) ++ { ++ if (obj == null || !(obj instanceof Block || obj instanceof Item)) ++ { ++ addEffect(effect); ++ return; ++ } ++ ++ if (obj instanceof Item && ((Item)obj).isDefaultTexture) ++ { ++ addEffect(effect); ++ return; ++ } ++ ++ if (obj instanceof Block && ((Block)obj).isDefaultTexture) ++ { ++ addEffect(effect); ++ return; ++ } ++ ++ String texture = "/terrain.png"; ++ if (effect.getFXLayer() == 0) ++ { ++ texture = "/particles.png"; ++ } ++ else if (effect.getFXLayer() == 2) ++ { ++ texture = "/gui/items.png"; ++ } ++ texture = ForgeHooks.getTexture(texture, obj); ++ effectList.put(texture, effect); + } + } diff --git a/patches/minecraft/net/minecraft/src/Enchantment.java.patch b/patches/minecraft/net/minecraft/src/Enchantment.java.patch new file mode 100644 index 000000000..574b635f2 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Enchantment.java.patch @@ -0,0 +1,17 @@ +--- ../src_base/minecraft/net/minecraft/src/Enchantment.java ++++ ../src_work/minecraft/net/minecraft/src/Enchantment.java +@@ -191,4 +191,14 @@ + String var2 = StatCollector.translateToLocal(this.getName()); + return var2 + " " + StatCollector.translateToLocal("enchantment.level." + par1); + } ++ ++ /** ++ * Called to determine if this enchantment can be applied to a ItemStack ++ * @param item The ItemStack that the enchantment might be put on ++ * @return True if the item is valid, false otherwise ++ */ ++ public boolean canEnchantItem(ItemStack item) ++ { ++ return type.canEnchantItem(item.getItem()); ++ } + } diff --git a/patches/minecraft/net/minecraft/src/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/src/EntityOcelot.java.patch new file mode 100644 index 000000000..e8b443bd4 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EntityOcelot.java.patch @@ -0,0 +1,13 @@ +--- ../src_base/minecraft/net/minecraft/src/EntityOcelot.java ++++ ../src_work/minecraft/net/minecraft/src/EntityOcelot.java +@@ -321,7 +321,9 @@ + + int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); + +- if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID) ++ Block block = Block.blocksList[var4]; ++ ++ if (var4 == Block.grass.blockID || (block != null && block.isLeaves(worldObj, var1, var2 - 1, var3))) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch new file mode 100644 index 000000000..d92c0b3f0 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/EntityPlayer.java.patch @@ -0,0 +1,36 @@ +--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java ++++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java +@@ -2,6 +2,8 @@ + + import java.util.Iterator; + import java.util.List; ++ ++import net.minecraftforge.common.ForgeHooks; + + public abstract class EntityPlayer extends EntityLiving implements ICommandSender + { +@@ -673,13 +675,21 @@ + + /** + * Returns how strong the player is against the specified block at this moment +- */ ++ * Deprecated in favor of the moresensitive version ++ */ ++ @Deprecated + public float getCurrentPlayerStrVsBlock(Block par1Block) + { +- float var2 = this.inventory.getStrVsBlock(par1Block); ++ return getCurrentPlayerStrVsBlock(par1Block, 0); ++ } ++ ++ public float getCurrentPlayerStrVsBlock(Block par1Block, int meta) ++ { ++ ItemStack stack = inventory.getCurrentItem(); ++ float var2 = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta)); + int var3 = EnchantmentHelper.getEfficiencyModifier(this.inventory); + +- if (var3 > 0 && this.inventory.canHarvestBlock(par1Block)) ++ if (var3 > 0 && ForgeHooks.canHarvestBlock(par1Block, this, meta)) + { + var2 += (float)(var3 * var3 + 1); + } diff --git a/patches/minecraft/net/minecraft/src/ItemBlock.java.patch b/patches/minecraft/net/minecraft/src/ItemBlock.java.patch new file mode 100644 index 000000000..b65d663c2 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemBlock.java.patch @@ -0,0 +1,12 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemBlock.java ++++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java +@@ -30,7 +30,8 @@ + { + par7 = 1; + } +- else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID) ++ else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID ++ && (Block.blocksList[var11] != null && !Block.blocksList[var11].isBlockReplaceable(par3World, par4, par5, par6))) + { + if (par7 == 0) + { diff --git a/patches/minecraft/net/minecraft/src/ItemHoe.java.patch b/patches/minecraft/net/minecraft/src/ItemHoe.java.patch new file mode 100644 index 000000000..0dbb3dc23 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemHoe.java.patch @@ -0,0 +1,29 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemHoe.java ++++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java +@@ -1,4 +1,7 @@ + package net.minecraft.src; ++ ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.UseHoeEvent; + + public class ItemHoe extends Item + { +@@ -21,6 +24,18 @@ + } + else + { ++ UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6); ++ MinecraftForge.EVENT_BUS.post(event); ++ if (event.isCanceled()) ++ { ++ return false; ++ } ++ if (event.isHandeled()) ++ { ++ par1ItemStack.damageItem(1, par2EntityPlayer); ++ return true; ++ } ++ + int var11 = par3World.getBlockId(par4, par5, par6); + int var12 = par3World.getBlockId(par4, par5 + 1, par6); + diff --git a/patches/minecraft/net/minecraft/src/ItemTool.java.patch b/patches/minecraft/net/minecraft/src/ItemTool.java.patch new file mode 100644 index 000000000..a7cf0911e --- /dev/null +++ b/patches/minecraft/net/minecraft/src/ItemTool.java.patch @@ -0,0 +1,25 @@ +--- ../src_base/minecraft/net/minecraft/src/ItemTool.java ++++ ../src_work/minecraft/net/minecraft/src/ItemTool.java +@@ -1,4 +1,6 @@ + package net.minecraft.src; ++ ++import net.minecraftforge.common.ForgeHooks; + + public class ItemTool extends Item + { +@@ -94,4 +96,15 @@ + { + return this.toolMaterial.toString(); + } ++ ++ /** FORGE: Overridden to allow custom tool effectiveness */ ++ @Override ++ public float getStrVsBlock(ItemStack stack, Block block, int meta) ++ { ++ if (ForgeHooks.isToolEffective(stack, block, meta)) ++ { ++ return efficiencyOnProperMaterial; ++ } ++ return getStrVsBlock(stack, block); ++ } + } diff --git a/patches/minecraft/net/minecraft/src/StatList.java.patch b/patches/minecraft/net/minecraft/src/StatList.java.patch new file mode 100644 index 000000000..846a19034 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/StatList.java.patch @@ -0,0 +1,15 @@ +--- ../src_base/minecraft/net/minecraft/src/StatList.java ++++ ../src_work/minecraft/net/minecraft/src/StatList.java +@@ -166,9 +166,9 @@ + */ + private static StatBase[] initMinableStats(String par0Str, int par1) + { +- StatBase[] var2 = new StatBase[256]; +- +- for (int var3 = 0; var3 < 256; ++var3) ++ StatBase[] var2 = new StatBase[Block.blocksList.length]; ++ ++ for (int var3 = 0; var3 < Block.blocksList.length; ++var3) + { + if (Block.blocksList[var3] != null && Block.blocksList[var3].getEnableStats()) + { diff --git a/patches/minecraft/net/minecraft/src/Tessellator.java.patch b/patches/minecraft/net/minecraft/src/Tessellator.java.patch new file mode 100644 index 000000000..2287d7ee1 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/Tessellator.java.patch @@ -0,0 +1,187 @@ +--- ../src_base/minecraft/net/minecraft/src/Tessellator.java ++++ ../src_work/minecraft/net/minecraft/src/Tessellator.java +@@ -5,12 +5,20 @@ + import java.nio.FloatBuffer; + import java.nio.IntBuffer; + import java.nio.ShortBuffer; ++import java.util.Arrays; ++ + import org.lwjgl.opengl.ARBVertexBufferObject; + import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GLContext; + + public class Tessellator + { ++ private static int nativeBufferSize = 0x200000; ++ private static int trivertsInBuffer = (nativeBufferSize / 48) * 6; ++ public static boolean renderingWorldRenderer = false; ++ public boolean defaultTexture = false; ++ private int rawBufferSize = 0; ++ public int textureID = 0; + /** + * Boolean used to check whether quads should be drawn as four triangles. Initialized to true and never changed. + */ +@@ -22,16 +30,16 @@ + private static boolean tryVBO = false; + + /** The byte buffer used for GL allocation. */ +- private ByteBuffer byteBuffer; ++ private static ByteBuffer byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4); + + /** The same memory as byteBuffer, but referenced as an integer buffer. */ +- private IntBuffer intBuffer; ++ private static IntBuffer intBuffer = byteBuffer.asIntBuffer(); + + /** The same memory as byteBuffer, but referenced as an float buffer. */ +- private FloatBuffer floatBuffer; ++ private static FloatBuffer floatBuffer = byteBuffer.asFloatBuffer(); + + /** Short buffer */ +- private ShortBuffer shortBuffer; ++ private static ShortBuffer shortBuffer = byteBuffer.asShortBuffer(); + + /** Raw integer array. */ + private int[] rawBuffer; +@@ -107,10 +115,10 @@ + public boolean isDrawing = false; + + /** Whether we are currently using VBO or not. */ +- private boolean useVBO = false; ++ private static boolean useVBO = false; + + /** An IntBuffer used to store the indices of vertex buffer objects. */ +- private IntBuffer vertexBuffers; ++ private static IntBuffer vertexBuffers; + + /** + * The index of the last VBO used. This is used in round-robin fashion, sequentially, through the vboCount vertex +@@ -119,25 +127,28 @@ + private int vboIndex = 0; + + /** Number of vertex buffer objects allocated for use. */ +- private int vboCount = 10; ++ private static int vboCount = 10; + + /** The size of the buffers used (in integers). */ + private int bufferSize; + + private Tessellator(int par1) + { +- this.bufferSize = par1; +- this.byteBuffer = GLAllocation.createDirectByteBuffer(par1 * 4); +- this.intBuffer = this.byteBuffer.asIntBuffer(); +- this.floatBuffer = this.byteBuffer.asFloatBuffer(); +- this.shortBuffer = this.byteBuffer.asShortBuffer(); +- this.rawBuffer = new int[par1]; +- this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; +- +- if (this.useVBO) +- { +- this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount); +- ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers); ++ } ++ ++ public Tessellator() ++ { ++ } ++ ++ static ++ { ++ instance.defaultTexture = true; ++ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; ++ ++ if (useVBO) ++ { ++ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); ++ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); + } + } + +@@ -154,12 +165,23 @@ + { + this.isDrawing = false; + +- if (this.vertexCount > 0) +- { ++ int offs = 0; ++ while (offs < vertexCount) ++ { ++ int vtc = 0; ++ if (drawMode == 7 && convertQuadsToTriangles) ++ { ++ vtc = Math.min(vertexCount - offs, trivertsInBuffer); ++ } ++ else ++ { ++ vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5); ++ } + this.intBuffer.clear(); +- this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex); ++ this.intBuffer.put(this.rawBuffer, offs * 8, vtc * 8); + this.byteBuffer.position(0); +- this.byteBuffer.limit(this.rawBufferIndex * 4); ++ this.byteBuffer.limit(vtc * 32); ++ offs += vtc; + + if (this.useVBO) + { +@@ -245,11 +267,11 @@ + + if (this.drawMode == 7 && convertQuadsToTriangles) + { +- GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, this.vertexCount); ++ GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vtc); + } + else + { +- GL11.glDrawArrays(this.drawMode, 0, this.vertexCount); ++ GL11.glDrawArrays(this.drawMode, 0, vtc); + } + + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +@@ -275,6 +297,12 @@ + { + GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); + } ++ } ++ ++ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3)) ++ { ++ rawBufferSize = 0; ++ rawBuffer = null; + } + + int var1 = this.rawBufferIndex * 4; +@@ -439,6 +467,19 @@ + */ + public void addVertex(double par1, double par3, double par5) + { ++ if (rawBufferIndex >= rawBufferSize - 32) ++ { ++ if (rawBufferSize == 0) ++ { ++ rawBufferSize = 0x10000; ++ rawBuffer = new int[rawBufferSize]; ++ } ++ else ++ { ++ rawBufferSize *= 2; ++ rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize); ++ } ++ } + ++this.addedVertices; + + if (this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0) +@@ -497,12 +538,6 @@ + this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset)); + this.rawBufferIndex += 8; + ++this.vertexCount; +- +- if (this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) +- { +- this.draw(); +- this.isDrawing = true; +- } + } + + /** diff --git a/patches/minecraft/net/minecraft/src/TileEntity.java.patch b/patches/minecraft/net/minecraft/src/TileEntity.java.patch new file mode 100644 index 000000000..e0f9f79f7 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/TileEntity.java.patch @@ -0,0 +1,32 @@ +--- ../src_base/minecraft/net/minecraft/src/TileEntity.java ++++ ../src_work/minecraft/net/minecraft/src/TileEntity.java +@@ -243,4 +243,29 @@ + addMapping(TileEntityEnchantmentTable.class, "EnchantTable"); + addMapping(TileEntityEndPortal.class, "Airportal"); + } ++ ++ /** ++ * Determines if this TileEntity requires update calls. ++ * @return True if you want updateEntity() to be called, false if not ++ */ ++ public boolean canUpdate() ++ { ++ return true; ++ } ++ ++ /** ++ * Called when you receive a TileEntityData packet for the location this ++ * TileEntity is currently in. On the client, the NetworkManager will always ++ * be the remote server. On the server, it will be whomever is responsible for ++ * sending the packet. ++ * ++ * @param net The NetworkManager the packet originated from ++ * @param pkt The data packet ++ */ ++ public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt){} ++ ++ /** ++ * Called when the chunk this TileEntity is on is Unloaded. ++ */ ++ public void onChunkUnload(){} + } diff --git a/patches/minecraft/net/minecraft/src/World.java.patch b/patches/minecraft/net/minecraft/src/World.java.patch index a11add15f..ebf6ab1c6 100644 --- a/patches/minecraft/net/minecraft/src/World.java.patch +++ b/patches/minecraft/net/minecraft/src/World.java.patch @@ -1,6 +1,24 @@ --- ../src_base/minecraft/net/minecraft/src/World.java +++ ../src_work/minecraft/net/minecraft/src/World.java -@@ -273,7 +273,8 @@ +@@ -8,8 +8,17 @@ + import java.util.Random; + import java.util.Set; + ++import net.minecraftforge.common.Orientation; ++ + public abstract class World implements IBlockAccess + { ++ /** ++ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. ++ * Modders should change this variable to a higher value if it is less then the radius ++ * of one of there entities. ++ */ ++ public static double MAX_ENTITY_RADIUS = 2.0D; ++ + /** + * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately + */ +@@ -273,7 +282,8 @@ public boolean blockHasTileEntity(int par1, int par2, int par3) { int var4 = this.getBlockId(par1, par2, par3); @@ -10,3 +28,79 @@ } /** +@@ -2562,8 +2572,7 @@ + */ + public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) + { +- Block var4 = Block.blocksList[this.getBlockId(par1, par2, par3)]; +- return var4 == null ? false : (var4.blockMaterial.isOpaque() && var4.renderAsNormalBlock() ? true : (var4 instanceof BlockStairs ? (this.getBlockMetadata(par1, par2, par3) & 4) == 4 : (var4 instanceof BlockHalfSlab ? (this.getBlockMetadata(par1, par2, par3) & 8) == 8 : false))); ++ return isBlockSolidOnSide(par1, par2, par3, Orientation.UP); + } + + /** +@@ -3917,4 +3926,65 @@ + var7.destroyBlockPartially(par1, par2, par3, par4, par5); + } + } ++ ++ /** ++ * Adds a single TileEntity to the world. ++ * @param entity The TileEntity to be added. ++ */ ++ public void addTileEntity(TileEntity entity) ++ { ++ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; ++ if(entity.canUpdate()) ++ { ++ dest.add(entity); ++ } ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param X Block X Position ++ * @param Y Block Y Position ++ * @param Z Block Z Position ++ * @param side The Side in question ++ * @return True if the side is solid ++ */ ++ public boolean isBlockSolidOnSide(int X, int Y, int Z, Orientation side) ++ { ++ return isBlockSolidOnSide(X, Y, Z, side, false); ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param X Block X Position ++ * @param Y Block Y Position ++ * @param Z Block Z Position ++ * @param side The Side in question ++ * @param _default The defult to return if the block doesn't exist. ++ * @return True if the side is solid ++ */ ++ public boolean isBlockSolidOnSide(int X, int Y, int Z, Orientation side, boolean _default) ++ { ++ if (X < -30000000 || Z < -30000000 || X >= 30000000 || Z >= 30000000) ++ { ++ return _default; ++ } ++ ++ Chunk var5 = this.chunkProvider.provideChunk(X >> 4, Z >> 4); ++ if (var5 == null || var5.isEmpty()) ++ { ++ return _default; ++ } ++ ++ Block block = Block.blocksList[getBlockId(X, Y, Z)]; ++ if(block == null) ++ { ++ return false; ++ } ++ ++ return block.isBlockSolidOnSide(this, X, Y, Z, side); ++ } + } diff --git a/patches/minecraft/net/minecraft/src/WorldProvider.java.patch b/patches/minecraft/net/minecraft/src/WorldProvider.java.patch new file mode 100644 index 000000000..947b0ddc8 --- /dev/null +++ b/patches/minecraft/net/minecraft/src/WorldProvider.java.patch @@ -0,0 +1,85 @@ +--- ../src_base/minecraft/net/minecraft/src/WorldProvider.java ++++ ../src_work/minecraft/net/minecraft/src/WorldProvider.java +@@ -177,7 +177,7 @@ + + public static WorldProvider getProviderForDimension(int par0) + { +- return (WorldProvider)(par0 == -1 ? new WorldProviderHell() : (par0 == 0 ? new WorldProviderSurface() : (par0 == 1 ? new WorldProviderEnd() : null))); ++ return DimensionManager.createProviderFor(par0); + } + + /** +@@ -232,4 +232,73 @@ + { + return false; + } ++ ++ /** ++ * Returns the sub-folder of the world folder that this WorldProvider saves to. ++ * EXA: DIM1, DIM-1 ++ * @return The sub-folder name to save this world's chunks to. ++ */ ++ public String getSaveFolder() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "DIM1"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "DIM-1"; ++ } ++ return null; ++ } ++ ++ /** ++ * A message to display to the user when they transfer to this dimension. ++ * ++ * @return The message to be displayed ++ */ ++ public String getWelcomeMessage() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "Entering the End"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "Entering the Nether"; ++ } ++ return null; ++ } ++ ++ /** ++ * A Message to display to the user when they transfer out of this dismension. ++ * ++ * @return The message to be displayed ++ */ ++ public String getDepartMessage() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "Leaving the End"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "Leaving the Nether"; ++ } ++ return null; ++ } ++ ++ /** ++ * The dimensions movement factor. Relative to normal overworld. ++ * It is applied to the players position when they transfer dimensions. ++ * Exa: Nether movement is 8.0 ++ * @return The movement factor ++ */ ++ public double getMovementFactor() ++ { ++ if (this instanceof WorldProviderHell) ++ { ++ return 8.0; ++ } ++ return 1.0; ++ } + } diff --git a/patches/minecraft_server/net/minecraft/src/Chunk.java.patch b/patches/minecraft_server/net/minecraft/src/Chunk.java.patch index 187a4fed7..5528fb3dd 100644 --- a/patches/minecraft_server/net/minecraft/src/Chunk.java.patch +++ b/patches/minecraft_server/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)); } /** diff --git a/patches/minecraft_server/net/minecraft/src/World.java.patch b/patches/minecraft_server/net/minecraft/src/World.java.patch index 319bb8321..12874be78 100644 --- a/patches/minecraft_server/net/minecraft/src/World.java.patch +++ b/patches/minecraft_server/net/minecraft/src/World.java.patch @@ -1,6 +1,24 @@ --- ../src_base/minecraft_server/net/minecraft/src/World.java +++ ../src_work/minecraft_server/net/minecraft/src/World.java -@@ -248,7 +248,8 @@ +@@ -8,8 +8,17 @@ + import java.util.Random; + import java.util.Set; + ++import net.minecraftforge.common.Orientation; ++ + public abstract class World implements IBlockAccess + { ++ /** ++ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. ++ * Modders should change this variable to a higher value if it is less then the radius ++ * of one of there entities. ++ */ ++ public static double MAX_ENTITY_RADIUS = 2.0D; ++ + /** + * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately + */ +@@ -248,7 +257,8 @@ public boolean blockHasTileEntity(int par1, int par2, int par3) { int var4 = this.getBlockId(par1, par2, par3); @@ -10,3 +28,69 @@ } /** +@@ -3515,4 +3525,65 @@ + var7.destroyBlockPartially(par1, par2, par3, par4, par5); + } + } ++ ++ /** ++ * Adds a single TileEntity to the world. ++ * @param entity The TileEntity to be added. ++ */ ++ public void addTileEntity(TileEntity entity) ++ { ++ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList; ++ if(entity.canUpdate()) ++ { ++ dest.add(entity); ++ } ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param X Block X Position ++ * @param Y Block Y Position ++ * @param Z Block Z Position ++ * @param side The Side in question ++ * @return True if the side is solid ++ */ ++ public boolean isBlockSolidOnSide(int X, int Y, int Z, Orientation side) ++ { ++ return isBlockSolidOnSide(X, Y, Z, side, false); ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param X Block X Position ++ * @param Y Block Y Position ++ * @param Z Block Z Position ++ * @param side The Side in question ++ * @param _default The defult to return if the block doesn't exist. ++ * @return True if the side is solid ++ */ ++ public boolean isBlockSolidOnSide(int X, int Y, int Z, Orientation side, boolean _default) ++ { ++ if (X < -30000000 || Z < -30000000 || X >= 30000000 || Z >= 30000000) ++ { ++ return _default; ++ } ++ ++ Chunk var5 = this.chunkProvider.provideChunk(X >> 4, Z >> 4); ++ if (var5 == null || var5.isEmpty()) ++ { ++ return _default; ++ } ++ ++ Block block = Block.blocksList[getBlockId(X, Y, Z)]; ++ if(block == null) ++ { ++ return false; ++ } ++ ++ return block.isBlockSolidOnSide(this, X, Y, Z, side); ++ } + }