diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 7d573a15ee..64fa53ba40 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -6,6 +6,7 @@ import java.util.TreeSet; import javax.imageio.ImageIO; +import net.minecraftforge.client.event.MouseEvent; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; @@ -325,6 +326,10 @@ public class ForgeHooksClient } } + public static boolean postMouseEvent() { + return MinecraftForge.EVENT_BUS.post(new MouseEvent()); + } + /** * Initialization of Forge Renderers. */ diff --git a/client/net/minecraftforge/client/event/GuiOpenEvent.java b/client/net/minecraftforge/client/event/GuiOpenEvent.java new file mode 100644 index 0000000000..67fdb29e9c --- /dev/null +++ b/client/net/minecraftforge/client/event/GuiOpenEvent.java @@ -0,0 +1,22 @@ +package net.minecraftforge.client.event; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.event.Cancelable; +import net.minecraftforge.event.Event; + +/** + * This event is called before any Gui will open. + * If you don't want this to happen, cancel the event. + * If you want to override this Gui, simply set the gui variable to your own Gui. + * + * @author jk-5 + */ +@Cancelable +public class GuiOpenEvent extends Event +{ + public GuiScreen gui; + public GuiOpenEvent(GuiScreen gui) + { + this.gui = gui; + } +} diff --git a/client/net/minecraftforge/client/event/MouseEvent.java b/client/net/minecraftforge/client/event/MouseEvent.java new file mode 100644 index 0000000000..1c3a1df9fd --- /dev/null +++ b/client/net/minecraftforge/client/event/MouseEvent.java @@ -0,0 +1,32 @@ +package net.minecraftforge.client.event; + +import net.minecraftforge.event.Cancelable; +import net.minecraftforge.event.Event; +import org.lwjgl.input.Mouse; + +/** + * Author: MachineMuse (Claire Semple) + * Created: 2:46 PM, 9/4/13 + */ +@Cancelable +public class MouseEvent extends Event { + public final int x; + public final int y; + public final int dx; + public final int dy; + public final int dwheel; + public final int button; + public final boolean buttonstate; + public final long nanoseconds; + + public MouseEvent() { + this.x = Mouse.getEventX(); + this.y = Mouse.getEventY(); + this.dx = Mouse.getEventDX(); + this.dy = Mouse.getEventDY(); + this.dwheel = Mouse.getEventDWheel(); + this.button = Mouse.getEventButton(); + this.buttonstate = Mouse.getEventButtonState(); + this.nanoseconds = Mouse.getEventNanoseconds(); + } +} diff --git a/client/net/minecraftforge/client/model/IModelCustom.java b/client/net/minecraftforge/client/model/IModelCustom.java index 35b4c01eac..dce97e39e1 100644 --- a/client/net/minecraftforge/client/model/IModelCustom.java +++ b/client/net/minecraftforge/client/model/IModelCustom.java @@ -5,5 +5,7 @@ package net.minecraftforge.client.model; public interface IModelCustom { String getType(); void renderAll(); + void renderOnly(String... groupNames); void renderPart(String partName); + void renderAllExcept(String... excludedGroupNames); } diff --git a/client/net/minecraftforge/client/model/obj/WavefrontObject.java b/client/net/minecraftforge/client/model/obj/WavefrontObject.java index d80a1cff56..20f9045104 100644 --- a/client/net/minecraftforge/client/model/obj/WavefrontObject.java +++ b/client/net/minecraftforge/client/model/obj/WavefrontObject.java @@ -169,6 +169,7 @@ public class WavefrontObject implements IModelCustom } } + @Override public void renderAll() { Tessellator tessellator = Tessellator.instance; @@ -181,15 +182,20 @@ public class WavefrontObject implements IModelCustom { tessellator.startDrawing(GL11.GL_TRIANGLES); } - - for (GroupObject groupObject : groupObjects) - { - groupObject.render(tessellator); - } + tessellateAll(tessellator); tessellator.draw(); } + public void tessellateAll(Tessellator tessellator) + { + for (GroupObject groupObject : groupObjects) + { + groupObject.render(tessellator); + } + } + + @Override public void renderOnly(String... groupNames) { for (GroupObject groupObject : groupObjects) @@ -204,6 +210,20 @@ public class WavefrontObject implements IModelCustom } } + public void tessellateOnly(Tessellator tessellator, String... groupNames) { + for (GroupObject groupObject : groupObjects) + { + for (String groupName : groupNames) + { + if (groupName.equalsIgnoreCase(groupObject.name)) + { + groupObject.render(tessellator); + } + } + } + } + + @Override public void renderPart(String partName) { for (GroupObject groupObject : groupObjects) @@ -215,17 +235,52 @@ public class WavefrontObject implements IModelCustom } } + public void tessellatePart(Tessellator tessellator, String partName) { + for (GroupObject groupObject : groupObjects) + { + if (partName.equalsIgnoreCase(groupObject.name)) + { + groupObject.render(tessellator); + } + } + } + public void renderAllExcept(String... excludedGroupNames) { for (GroupObject groupObject : groupObjects) { + boolean skipPart=false; for (String excludedGroupName : excludedGroupNames) { - if (!excludedGroupName.equalsIgnoreCase(groupObject.name)) + if (excludedGroupName.equalsIgnoreCase(groupObject.name)) { - groupObject.render(); + skipPart=true; } } + if(!skipPart) + { + groupObject.render(); + } + } + } + + public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames) + { + boolean exclude; + for (GroupObject groupObject : groupObjects) + { + exclude=false; + for (String excludedGroupName : excludedGroupNames) + { + if (excludedGroupName.equalsIgnoreCase(groupObject.name)) + { + exclude=true; + } + } + if(!exclude) + { + groupObject.render(tessellator); + } } } @@ -359,7 +414,7 @@ public class WavefrontObject implements IModelCustom face.vertices = new Vertex[tokens.length]; face.textureCoordinates = new TextureCoordinate[tokens.length]; face.vertexNormals = new Vertex[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { subTokens = tokens[i].split("/"); @@ -376,7 +431,7 @@ public class WavefrontObject implements IModelCustom { face.vertices = new Vertex[tokens.length]; face.textureCoordinates = new TextureCoordinate[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { subTokens = tokens[i].split("/"); @@ -392,7 +447,7 @@ public class WavefrontObject implements IModelCustom { face.vertices = new Vertex[tokens.length]; face.vertexNormals = new Vertex[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { subTokens = tokens[i].split("//"); @@ -407,7 +462,7 @@ public class WavefrontObject implements IModelCustom else if (isValidFace_V_Line(line)) { face.vertices = new Vertex[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1); diff --git a/client/net/minecraftforge/client/model/techne/TechneModel.java b/client/net/minecraftforge/client/model/techne/TechneModel.java index 66a32aa9b3..d826ac65f3 100644 --- a/client/net/minecraftforge/client/model/techne/TechneModel.java +++ b/client/net/minecraftforge/client/model/techne/TechneModel.java @@ -37,6 +37,7 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.client.model.ModelFormatException; +import net.minecraftforge.client.model.obj.GroupObject; /** * Techne model importer, based on iChun's Hats importer @@ -298,4 +299,40 @@ public class TechneModel extends ModelBase implements IModelCustom { part.renderWithRotation(1.0F); } } + + @Override + public void renderOnly(String... groupNames) + { + bindTexture(); + for (ModelRenderer part : parts.values()) + { + for (String groupName : groupNames) + { + if (groupName.equalsIgnoreCase(part.boxName)) + { + part.render(1.0f); + } + } + } + } + + @Override + public void renderAllExcept(String... excludedGroupNames) + { + for (ModelRenderer part : parts.values()) + { + boolean skipPart=false; + for (String excludedGroupName : excludedGroupNames) + { + if (excludedGroupName.equalsIgnoreCase(part.boxName)) + { + skipPart=true; + } + } + if(!skipPart) + { + part.render(1.0f); + } + } + } } diff --git a/common/assets/forge/lang/fr_FR.lang b/common/assets/forge/lang/fr_FR.lang new file mode 100644 index 0000000000..bd01daa94a --- /dev/null +++ b/common/assets/forge/lang/fr_FR.lang @@ -0,0 +1,5 @@ +commands.forge.usage=Utilisez /forge . Les sous-commandes sont tps, track +commands.forge.usage.tracking=Utilisez /forge track . Les types valides sont te (Tile Entities). La durée doit être inférieur à 60. +commands.forge.tps.summary=%s : Duré de tick : %d ms. TPS moyen : %d + +commands.forge.tracking.te.enabled=Trackage des Tile Entity activé pour %d secondes. \ No newline at end of file diff --git a/common/net/minecraftforge/common/BiomeDictionary.java b/common/net/minecraftforge/common/BiomeDictionary.java index d02a09cc14..ace31c7b2e 100644 --- a/common/net/minecraftforge/common/BiomeDictionary.java +++ b/common/net/minecraftforge/common/BiomeDictionary.java @@ -1,7 +1,10 @@ package net.minecraftforge.common; import java.util.*; + +import cpw.mods.fml.common.FMLLog; import net.minecraft.world.biome.*; +import net.minecraftforge.event.terraingen.DeferredBiomeDecorator; import static net.minecraft.world.biome.BiomeGenBase.*; import static net.minecraftforge.common.BiomeDictionary.Type.*; @@ -185,19 +188,30 @@ public class BiomeDictionary return biomeList[biomeID] != null; } + public static void registerAllBiomes() + { + FMLLog.warning("Redundant call to BiomeDictionary.registerAllBiomes ignored"); + } /** * Loops through the biome list and automatically adds tags to any biome that does not have any - * This should be called in postInit to make sure all biomes have been registered + * This is called by Forge at postinit time. It will additionally dispatch any deferred decorator + * creation events. * * DO NOT call this during world generation */ - public static void registerAllBiomes() + public static void registerAllBiomesAndGenerateEvents() { for(int i = 0; i < BIOME_LIST_SIZE; i++) { - if(BiomeGenBase.biomeList[i] != null) + BiomeGenBase biome = BiomeGenBase.biomeList[i]; + if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator) { - checkRegistration(BiomeGenBase.biomeList[i]); + DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator; + decorator.fireCreateEventAndReplace(); + } + if(biome != null) + { + checkRegistration(biome); } } } diff --git a/common/net/minecraftforge/common/ForgeDummyContainer.java b/common/net/minecraftforge/common/ForgeDummyContainer.java index 93deec9b55..a8c2b273a5 100644 --- a/common/net/minecraftforge/common/ForgeDummyContainer.java +++ b/common/net/minecraftforge/common/ForgeDummyContainer.java @@ -148,7 +148,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces @Override public boolean registerBus(EventBus bus, LoadController controller) { - bus.register(this); + bus.register(this); return true; } @@ -176,7 +176,8 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces @Subscribe public void postInit(FMLPostInitializationEvent evt) { - ForgeChunkManager.loadConfiguration(); + BiomeDictionary.registerAllBiomesAndGenerateEvents(); + ForgeChunkManager.loadConfiguration(); } @Subscribe @@ -201,7 +202,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null); } } - + @Override public File getSource() { diff --git a/common/net/minecraftforge/event/ForgeEventFactory.java b/common/net/minecraftforge/event/ForgeEventFactory.java index d67cbeddeb..8158c59d96 100644 --- a/common/net/minecraftforge/event/ForgeEventFactory.java +++ b/common/net/minecraftforge/event/ForgeEventFactory.java @@ -75,4 +75,11 @@ public class ForgeEventFactory MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent); return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.maxPackSize : entity.getMaxSpawnedInChunk(); } + + public static String getPlayerDisplayName(EntityPlayer player, String username) + { + PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username); + MinecraftForge.EVENT_BUS.post(event); + return event.displayname; + } } diff --git a/common/net/minecraftforge/event/entity/player/PlayerEvent.java b/common/net/minecraftforge/event/entity/player/PlayerEvent.java index a63f074923..8100318de7 100644 --- a/common/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/common/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -45,4 +45,16 @@ public class PlayerEvent extends LivingEvent this.newSpeed = original; } } + + public static class NameFormat extends PlayerEvent + { + public final String username; + public String displayname; + + public NameFormat(EntityPlayer player, String username) { + super(player); + this.username = username; + this.displayname = username; + } + } } diff --git a/common/net/minecraftforge/event/terraingen/BiomeEvent.java b/common/net/minecraftforge/event/terraingen/BiomeEvent.java index 6bc3557a29..8f4917b9ee 100644 --- a/common/net/minecraftforge/event/terraingen/BiomeEvent.java +++ b/common/net/minecraftforge/event/terraingen/BiomeEvent.java @@ -1,5 +1,6 @@ package net.minecraftforge.event.terraingen; +import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.world.biome.BiomeDecorator; diff --git a/common/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java b/common/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java new file mode 100644 index 0000000000..219d3ca8a7 --- /dev/null +++ b/common/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java @@ -0,0 +1,47 @@ +package net.minecraftforge.event.terraingen; + +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeDecorator; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.MinecraftForge; + +public class DeferredBiomeDecorator extends BiomeDecorator { + private BiomeDecorator wrapped; + + public DeferredBiomeDecorator(BiomeGenBase biomeGenBase, BiomeDecorator wrappedOriginal) + { + super(biomeGenBase); + this.wrapped = wrappedOriginal; + } + + @Override + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + fireCreateEventAndReplace(); + // On first call to decorate, we fire and substitute ourselves, if we haven't already done so + biome.theBiomeDecorator.decorate(par1World, par2Random, par3, par4); + } + public void fireCreateEventAndReplace() + { + // Copy any configuration from us to the real instance. + wrapped.bigMushroomsPerChunk = bigMushroomsPerChunk; + wrapped.cactiPerChunk = cactiPerChunk; + wrapped.clayPerChunk = clayPerChunk; + wrapped.deadBushPerChunk = deadBushPerChunk; + wrapped.flowersPerChunk = flowersPerChunk; + wrapped.generateLakes = generateLakes; + wrapped.grassPerChunk = grassPerChunk; + wrapped.mushroomsPerChunk = mushroomsPerChunk; + wrapped.reedsPerChunk = reedsPerChunk; + wrapped.sandPerChunk = sandPerChunk; + wrapped.sandPerChunk2 = sandPerChunk2; + wrapped.treesPerChunk = treesPerChunk; + wrapped.waterlilyPerChunk = waterlilyPerChunk; + + BiomeEvent.CreateDecorator event = new BiomeEvent.CreateDecorator(biome, wrapped); + MinecraftForge.TERRAIN_GEN_BUS.post(event); + biome.theBiomeDecorator = event.newBiomeDecorator; + } +} diff --git a/common/net/minecraftforge/event/world/BlockEvent.java b/common/net/minecraftforge/event/world/BlockEvent.java new file mode 100644 index 0000000000..215e71e32c --- /dev/null +++ b/common/net/minecraftforge/event/world/BlockEvent.java @@ -0,0 +1,46 @@ +package net.minecraftforge.event.world; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.event.Event; + +public class BlockEvent extends Event { + public final int x; + public final int y; + public final int z; + public final World world; + public final Block block; + public final int blockMetadata; + public BlockEvent(int x, int y, int z, World world, Block block, int blockMetadata) + { + this.x = x; + this.y = y; + this.z = z; + this.world = world; + this.block = block; + this.blockMetadata = blockMetadata; + } + + public static class HarvestDropsEvent extends BlockEvent { + public final int fortuneLevel; + public final ArrayList drops; + public final boolean isSilkTouching; + public float dropChance; // Change to e.g. 1.0f, if you manipulate the list and want to guarantee it always drops + public final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines + + public HarvestDropsEvent(int x, int y, int z, World world, Block block, int blockMetadata, int fortuneLevel, float dropChance, ArrayList drops, EntityPlayer harvester, boolean isSilkTouching) + { + super(x, y, z, world, block, blockMetadata); + this.fortuneLevel = fortuneLevel; + this.dropChance = dropChance; + this.drops = drops; + this.isSilkTouching = isSilkTouching; + this.harvester = harvester; + } + } + +} diff --git a/common/net/minecraftforge/fluids/FluidRegistry.java b/common/net/minecraftforge/fluids/FluidRegistry.java index b55d215051..df4eaa174f 100644 --- a/common/net/minecraftforge/fluids/FluidRegistry.java +++ b/common/net/minecraftforge/fluids/FluidRegistry.java @@ -24,7 +24,8 @@ public abstract class FluidRegistry static HashMap fluids = new HashMap(); static BiMap fluidIDs = HashBiMap.create(); - + static BiMap fluidBlocks; + public static final Fluid WATER = new Fluid("water").setBlockID(Block.waterStill.blockID).setUnlocalizedName(Block.waterStill.getUnlocalizedName()); public static final Fluid LAVA = new Fluid("lava").setBlockID(Block.lavaStill.blockID).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300).setUnlocalizedName(Block.lavaStill.getUnlocalizedName()); @@ -128,6 +129,21 @@ public abstract class FluidRegistry return ImmutableMap.copyOf(fluidIDs); } + public static Fluid lookupFluidForBlock(Block block) + { + if (fluidBlocks == null) + { + for (Fluid fluid : fluids.values()) + { + if (fluid.canBePlacedInWorld() && Block.blocksList[fluid.getBlockID()] != null) + { + fluidBlocks.put(Block.blocksList[fluid.getBlockID()], fluid); + } + } + } + return fluidBlocks.get(block); + } + public static class FluidRegisterEvent extends Event { public final String fluidName; diff --git a/common/net/minecraftforge/fluids/ItemFluidContainer.java b/common/net/minecraftforge/fluids/ItemFluidContainer.java index e42703aa40..be615d3a10 100644 --- a/common/net/minecraftforge/fluids/ItemFluidContainer.java +++ b/common/net/minecraftforge/fluids/ItemFluidContainer.java @@ -106,7 +106,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem return 0; } - int filled = capacity - resource.amount; + int filled = capacity - stack.amount; if (resource.amount < filled) { stack.amount += resource.amount; diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index a8c9df8a47..3b14f8b78f 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -36,7 +36,7 @@ import net.minecraft.util.Icon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; -@@ -35,9 +44,19 @@ +@@ -35,9 +44,21 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -45,7 +45,9 @@ +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.IPlantable; ++import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.RotationHelper; ++import net.minecraftforge.event.world.BlockEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; @@ -56,7 +58,7 @@ /** * used as foreach item, if item.tab = current tab, display it on the screen */ -@@ -460,9 +479,10 @@ +@@ -460,9 +481,10 @@ return this.needsRandomTick; } @@ -68,7 +70,7 @@ } /** -@@ -485,7 +505,7 @@ +@@ -485,7 +507,7 @@ */ public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -77,7 +79,7 @@ } @SideOnly(Side.CLIENT) -@@ -495,7 +515,7 @@ +@@ -495,7 +517,7 @@ */ public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -86,7 +88,7 @@ } @SideOnly(Side.CLIENT) -@@ -648,7 +668,13 @@ +@@ -648,7 +670,13 @@ * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old * metadata */ @@ -101,7 +103,7 @@ /** * Returns the quantity of items to drop on block destruction. -@@ -673,7 +699,7 @@ +@@ -673,7 +701,7 @@ public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) { float f = this.getBlockHardness(par2World, par3, par4, par5); @@ -110,30 +112,41 @@ } /** -@@ -691,18 +717,13 @@ +@@ -681,7 +709,7 @@ + */ + public final void dropBlockAsItem(World par1World, int par2, int par3, int par4, int par5, int par6) { - if (!par1World.isRemote) - { +- this.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, 1.0F, par6); ++ dropBlockAsItem(par1World, par2, par3, par4, par5, par6, null); + } + + /** +@@ -689,23 +717,7 @@ + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { +- if (!par1World.isRemote) +- { - int j1 = this.quantityDroppedWithBonus(par7, par1World.rand); - - for (int k1 = 0; k1 < j1; ++k1) -+ ArrayList items = getBlockDropped(par1World, par2, par3, par4, par5, par7); -+ -+ for (ItemStack item : items) - { - if (par1World.rand.nextFloat() <= par6) - { +- { +- if (par1World.rand.nextFloat() <= par6) +- { - int l1 = this.idDropped(par5, par1World.rand, par7); - - if (l1 > 0) - { - this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(l1, 1, this.damageDropped(par5))); - } -+ this.dropBlockAsItem_do(par1World, par2, par3, par4, item); - } - } - } -@@ -935,7 +956,8 @@ +- } +- } +- } ++ dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7, null); + } + + /** +@@ -935,7 +947,8 @@ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { int l = par1World.getBlockId(par2, par3, par4); @@ -143,7 +156,7 @@ } /** -@@ -1095,7 +1117,7 @@ +@@ -1095,28 +1108,38 @@ par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addExhaustion(0.025F); @@ -151,11 +164,35 @@ + if (this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) { ItemStack itemstack = this.createStackedBlock(par6); - -@@ -1111,12 +1133,13 @@ +- +- if (itemstack != null) ++ ArrayList results = new ArrayList(); ++ if (itemstack!=null) + { +- this.dropBlockAsItem_do(par1World, par3, par4, par5, itemstack); ++ results.add(itemstack); + } ++ ++ MinecraftForge.EVENT_BUS.post(new BlockEvent.HarvestDropsEvent(par3, par4, par5, par1World, this, par6, 0, 1.0f, results, par2EntityPlayer, true)); ++ if (itemstack != null && !results.isEmpty()) ++ { ++ for (ItemStack is : results) ++ { ++ this.dropBlockAsItem_do(par1World, par3, par4, par5, is); ++ } ++ } } - } - + else + { + int i1 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer); +- this.dropBlockAsItem(par1World, par3, par4, par5, par6, i1); +- } +- } +- ++ this.dropBlockAsItem(par1World, par3, par4, par5, par6, i1, par2EntityPlayer); ++ } ++ } ++ + private int silk_check_meta = -1; //Dirty hack to stop us from needing to special case the silk check hook. /** * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. @@ -167,7 +204,7 @@ } /** -@@ -1457,4 +1480,979 @@ +@@ -1457,4 +1480,1000 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -536,6 +573,27 @@ + return ret; + } + ++ public final void dropBlockAsItem(World par1World, int par2, int par3, int par4, int par5, int par6, EntityPlayer player) ++ { ++ this.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, 1.0F, par6, player); ++ } ++ ++ public void dropBlockAsItemWithChance(World world, int x, int y, int z, int metadata, float dropChance, int fortune, EntityPlayer player) ++ { ++ if (!world.isRemote) ++ { ++ ArrayList items = getBlockDropped(world, x, y, z, metadata, fortune); ++ MinecraftForge.EVENT_BUS.post(new BlockEvent.HarvestDropsEvent(x, y, z, world, this, metadata, fortune, dropChance, items, player, false)); ++ for (ItemStack item : items) ++ { ++ if (world.rand.nextFloat() <= dropChance) ++ { ++ this.dropBlockAsItem_do(world, x, y, z, item); ++ } ++ } ++ } ++ } ++ + /** + * Determines if a specified mob type can spawn on this block, returning false will + * prevent any mob from spawning on the block. diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 5fd3e3401d..6580ca541a 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src_work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -2,6 +2,8 @@ +@@ -2,10 +2,13 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -9,12 +9,21 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; -@@ -201,7 +203,14 @@ + import net.minecraft.entity.EntityLivingBase; ++import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.item.Item; + import net.minecraft.item.ItemStack; + import net.minecraft.util.AxisAlignedBB; +@@ -199,9 +202,16 @@ + /** + * Drops the block items with a specified chance of dropping the specified items */ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) - { +- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) +- { - int j1 = func_72219_c(par5); -+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); ++ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7, EntityPlayer player) ++ { ++ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0, player); + } + + @Override @@ -25,7 +34,7 @@ byte b0 = 1; if (j1 >= 2) -@@ -211,8 +220,9 @@ +@@ -211,8 +221,9 @@ for (int k1 = 0; k1 < b0; ++k1) { @@ -37,7 +46,7 @@ } @SideOnly(Side.CLIENT) -@@ -248,4 +258,10 @@ +@@ -248,4 +259,10 @@ this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i); } } diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 66a57d1606..c72ff3ff6f 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockCrops.java +++ ../src_work/minecraft/net/minecraft/block/BlockCrops.java -@@ -2,6 +2,7 @@ +@@ -2,14 +2,17 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -8,7 +8,9 @@ import java.util.Random; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; -@@ -10,6 +11,7 @@ ++import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.item.Item; + import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -16,7 +18,7 @@ public class BlockCrops extends BlockFlower { -@@ -103,11 +105,11 @@ +@@ -103,11 +106,11 @@ int j3 = par1World.getBlockId(l2, par3 - 1, i3); float f1 = 0.0F; @@ -30,14 +32,20 @@ { f1 = 3.0F; } -@@ -175,22 +177,25 @@ - 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); +@@ -172,25 +175,28 @@ + /** + * Drops the block items with a specified chance of dropping the specified items + */ +- 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); - - if (!par1World.isRemote) - { - if (par5 >= 7) ++ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7, EntityPlayer player) ++ { ++ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0, player); + } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch new file mode 100644 index 0000000000..6280e811a6 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft/net/minecraft/block/BlockMobSpawner.java ++++ ../src_work/minecraft/net/minecraft/block/BlockMobSpawner.java +@@ -4,6 +4,7 @@ + import cpw.mods.fml.relauncher.SideOnly; + import java.util.Random; + import net.minecraft.block.material.Material; ++import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.tileentity.TileEntity; + import net.minecraft.tileentity.TileEntityMobSpawner; + import net.minecraft.world.World; +@@ -42,9 +43,9 @@ + /** + * Drops the block items with a specified chance of dropping the specified items + */ +- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) ++ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7, EntityPlayer player) + { +- super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); ++ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7, player); + int j1 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15); + this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1); + } diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch new file mode 100644 index 0000000000..14e092029c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -0,0 +1,22 @@ +--- ../src_base/minecraft/net/minecraft/block/BlockOre.java ++++ ../src_work/minecraft/net/minecraft/block/BlockOre.java +@@ -3,6 +3,7 @@ + import java.util.Random; + import net.minecraft.block.material.Material; + import net.minecraft.creativetab.CreativeTabs; ++import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.item.Item; + import net.minecraft.util.MathHelper; + import net.minecraft.world.World; +@@ -56,9 +57,9 @@ + /** + * Drops the block items with a specified chance of dropping the specified items + */ +- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) ++ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7, EntityPlayer player) + { +- super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); ++ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7, player); + + if (this.idDropped(par5, par1World.rand, par7) != this.blockID) + { diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 145728f34f..7376e9dc20 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,11 +1,12 @@ --- ../src_base/minecraft/net/minecraft/client/Minecraft.java +++ ../src_work/minecraft/net/minecraft/client/Minecraft.java -@@ -137,6 +137,14 @@ +@@ -137,6 +137,15 @@ import com.google.common.collect.MapDifference; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.GuiIngameForge; ++import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; @@ -15,7 +16,7 @@ @SideOnly(Side.CLIENT) public class Minecraft implements IPlayerUsage { -@@ -416,7 +424,7 @@ +@@ -416,7 +425,7 @@ try { @@ -24,7 +25,7 @@ } catch (LWJGLException lwjglexception) { -@@ -497,7 +505,7 @@ +@@ -497,7 +506,7 @@ this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); FMLClientHandler.instance().finishMinecraftLoading(); this.checkGLError("Post startup"); @@ -33,7 +34,47 @@ if (this.serverName != null) { -@@ -1300,7 +1308,7 @@ +@@ -679,21 +688,28 @@ + */ + public void displayGuiScreen(GuiScreen par1GuiScreen) + { +- if (this.currentScreen != null) ++ this.statFileWriter.syncStats(); ++ ++ if (par1GuiScreen == null && this.theWorld == null) ++ { ++ par1GuiScreen = new GuiMainMenu(); ++ } ++ else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F) ++ { ++ par1GuiScreen = new GuiGameOver(); ++ } ++ ++ GuiScreen old = this.currentScreen; ++ GuiOpenEvent event = new GuiOpenEvent(par1GuiScreen); ++ boolean canceled = MinecraftForge.EVENT_BUS.post(event); ++ ++ if (old != null && old != this.currentScreen) + { + this.currentScreen.onGuiClosed(); + } + +- this.statFileWriter.syncStats(); +- +- if (par1GuiScreen == null && this.theWorld == null) +- { +- par1GuiScreen = new GuiMainMenu(); +- } +- else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F) +- { +- par1GuiScreen = new GuiGameOver(); +- } ++ if (canceled) return; ++ par1GuiScreen = event.gui; + + if (par1GuiScreen instanceof GuiMainMenu) + { +@@ -1300,7 +1316,7 @@ if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l)) { @@ -42,7 +83,7 @@ this.thePlayer.swingItem(); } } -@@ -1366,7 +1374,8 @@ +@@ -1366,7 +1382,8 @@ { int j1 = itemstack != null ? itemstack.stackSize : 0; @@ -52,7 +93,7 @@ { flag = false; this.thePlayer.swingItem(); -@@ -1392,7 +1401,8 @@ +@@ -1392,7 +1409,8 @@ { ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); @@ -62,7 +103,16 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -@@ -2046,6 +2056,11 @@ +@@ -1574,6 +1592,8 @@ + + while (Mouse.next()) + { ++ if (ForgeHooksClient.postMouseEvent()) continue; ++ + i = Mouse.getEventButton(); + + if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) +@@ -2046,6 +2066,11 @@ { this.statFileWriter.syncStats(); @@ -74,7 +124,7 @@ if (par1WorldClient == null) { NetClientHandler netclienthandler = this.getNetHandler(); -@@ -2063,6 +2078,18 @@ +@@ -2063,6 +2088,18 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); @@ -93,7 +143,7 @@ } this.theIntegratedServer = null; -@@ -2236,107 +2263,12 @@ +@@ -2236,107 +2273,12 @@ if (this.objectMouseOver != null) { boolean flag = this.thePlayer.capabilities.isCreativeMode; @@ -205,7 +255,7 @@ if (flag) { -@@ -2419,11 +2351,18 @@ +@@ -2419,11 +2361,18 @@ par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); } @@ -224,7 +274,7 @@ for (int i = 16384; i > 0; i >>= 1) { GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -@@ -2431,6 +2370,7 @@ +@@ -2431,6 +2380,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch new file mode 100644 index 0000000000..4563e5cc29 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch @@ -0,0 +1,12 @@ +--- ../src_base/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java ++++ ../src_work/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java +@@ -170,7 +170,8 @@ + } + } + +- public float getEyeHeight() ++ @Override ++ public float getDefaultEyeHeight() + { + return 1.82F; + } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index eb71fca162..e401b0df70 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -9,7 +9,77 @@ @SideOnly(Side.CLIENT) public class EntityPlayerSP extends AbstractClientPlayer -@@ -685,6 +687,12 @@ +@@ -570,18 +572,63 @@ + */ + protected boolean pushOutOfBlocks(double par1, double par3, double par5) + { ++ if (this.noClip) { return false; } + int i = MathHelper.floor_double(par1); + int j = MathHelper.floor_double(par3); + int k = MathHelper.floor_double(par5); + double d3 = par1 - (double)i; + double d4 = par5 - (double)k; + +- if (this.isBlockTranslucent(i, j, k) || this.isBlockTranslucent(i, j + 1, k)) +- { +- boolean flag = !this.isBlockTranslucent(i - 1, j, k) && !this.isBlockTranslucent(i - 1, j + 1, k); +- boolean flag1 = !this.isBlockTranslucent(i + 1, j, k) && !this.isBlockTranslucent(i + 1, j + 1, k); +- boolean flag2 = !this.isBlockTranslucent(i, j, k - 1) && !this.isBlockTranslucent(i, j + 1, k - 1); +- boolean flag3 = !this.isBlockTranslucent(i, j, k + 1) && !this.isBlockTranslucent(i, j + 1, k + 1); ++ int entHeight = Math.max(Math.round(this.height), 1); ++ ++ boolean inTranslucentBlock = true; ++ ++ for (int i1 = 0; i1 < entHeight; i1++) ++ { ++ if (!this.isBlockTranslucent(i, j + i1, k)) ++ { ++ inTranslucentBlock = false; ++ } ++ } ++ ++ if (inTranslucentBlock) ++ { ++ boolean flag = true; ++ boolean flag1 = true; ++ boolean flag2 = true; ++ boolean flag3 = true; ++ for (int i1 = 0; i1 < entHeight; i1++) ++ { ++ if(this.isBlockTranslucent(i - 1, j + i1, k)) ++ { ++ flag = false; ++ break; ++ } ++ } ++ for (int i1 = 0; i1 < entHeight; i1++) ++ { ++ if(this.isBlockTranslucent(i + 1, j + i1, k)) ++ { ++ flag1 = false; ++ break; ++ } ++ } ++ for (int i1 = 0; i1 < entHeight; i1++) ++ { ++ if(this.isBlockTranslucent(i, j + i1, k - 1)) ++ { ++ flag2 = false; ++ break; ++ } ++ } ++ for (int i1 = 0; i1 < entHeight; i1++) ++ { ++ if(this.isBlockTranslucent(i, j + i1, k + 1)) ++ { ++ flag3 = false; ++ break; ++ } ++ } + byte b0 = -1; + double d5 = 9999.0D; + +@@ -685,6 +732,12 @@ public void playSound(String par1Str, float par2, float par3) { diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 3247597b2e..168d0194ae 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -48,7 +48,15 @@ /** Holds the coordinate of the player when enter a minecraft to ride. */ private ChunkCoordinates startMinecartRidingCoordinate; -@@ -267,6 +285,7 @@ +@@ -175,6 +193,7 @@ + this.setLocationAndAngles((double)chunkcoordinates.posX + 0.5D, (double)(chunkcoordinates.posY + 1), (double)chunkcoordinates.posZ + 0.5D, 0.0F, 0.0F); + this.field_70741_aB = 180.0F; + this.fireResistance = 20; ++ this.eyeHeight = this.getDefaultEyeHeight(); + } + + protected void applyEntityAttributes() +@@ -267,6 +286,7 @@ if (itemstack == this.itemInUse) { @@ -56,7 +64,7 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -429,7 +448,7 @@ +@@ -429,7 +449,7 @@ vec31.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); vec31.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); @@ -65,7 +73,7 @@ } this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); -@@ -537,11 +556,11 @@ +@@ -537,11 +557,11 @@ this.cameraYaw = 0.0F; this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); @@ -79,7 +87,7 @@ } } } -@@ -684,11 +703,15 @@ +@@ -684,11 +704,15 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -95,7 +103,7 @@ if (this.username.equals("Notch")) { this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); -@@ -697,6 +720,20 @@ +@@ -697,6 +721,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { this.inventory.dropAllItems(); @@ -116,7 +124,7 @@ } if (par1DamageSource != null) -@@ -747,7 +784,20 @@ +@@ -747,7 +785,20 @@ */ public EntityItem dropOneItem(boolean par1) { @@ -138,7 +146,7 @@ } /** -@@ -756,7 +806,7 @@ +@@ -756,7 +807,7 @@ */ public EntityItem dropPlayerItem(ItemStack par1ItemStack) { @@ -147,7 +155,7 @@ } /** -@@ -812,15 +862,28 @@ +@@ -812,15 +863,28 @@ */ public void joinEntityItemWithWorld(EntityItem par1EntityItem) { @@ -178,7 +186,7 @@ if (f > 1.0F) { -@@ -831,7 +894,9 @@ +@@ -831,7 +895,9 @@ { float f1 = (float)(i * i + 1); @@ -189,7 +197,7 @@ { f += f1 * 0.08F; } -@@ -862,7 +927,8 @@ +@@ -862,7 +928,8 @@ f /= 5.0F; } @@ -199,7 +207,7 @@ } /** -@@ -870,7 +936,7 @@ +@@ -870,7 +937,7 @@ */ public boolean canHarvestBlock(Block par1Block) { @@ -208,7 +216,7 @@ } /** -@@ -900,6 +966,14 @@ +@@ -900,6 +967,14 @@ this.spawnChunk = new ChunkCoordinates(par1NBTTagCompound.getInteger("SpawnX"), par1NBTTagCompound.getInteger("SpawnY"), par1NBTTagCompound.getInteger("SpawnZ")); this.spawnForced = par1NBTTagCompound.getBoolean("SpawnForced"); } @@ -223,7 +231,7 @@ this.foodStats.readNBT(par1NBTTagCompound); this.capabilities.readCapabilitiesFromNBT(par1NBTTagCompound); -@@ -933,6 +1007,21 @@ +@@ -933,6 +1008,21 @@ par1NBTTagCompound.setInteger("SpawnZ", this.spawnChunk.posZ); par1NBTTagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -245,7 +253,16 @@ this.foodStats.writeNBT(par1NBTTagCompound); this.capabilities.writeCapabilitiesToNBT(par1NBTTagCompound); -@@ -980,6 +1069,7 @@ +@@ -964,7 +1054,7 @@ + + public float getEyeHeight() + { +- return 0.12F; ++ return eyeHeight; + } + + /** +@@ -980,6 +1070,7 @@ */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { @@ -253,7 +270,7 @@ if (this.isEntityInvulnerable()) { return false; -@@ -1092,12 +1182,15 @@ +@@ -1092,12 +1183,15 @@ { if (!this.isEntityInvulnerable()) { @@ -270,7 +287,7 @@ par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); float f1 = par2; par2 = Math.max(par2 - this.getAbsorptionAmount(), 0.0F); -@@ -1147,6 +1240,7 @@ +@@ -1147,6 +1241,7 @@ public boolean interactWith(Entity par1Entity) { @@ -278,7 +295,7 @@ ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; -@@ -1203,7 +1297,9 @@ +@@ -1203,7 +1298,9 @@ */ public void destroyCurrentEquippedItem() { @@ -288,7 +305,7 @@ } /** -@@ -1220,6 +1316,15 @@ +@@ -1220,6 +1317,15 @@ */ public void attackTargetEntityWithCurrentItem(Entity par1Entity) { @@ -304,7 +321,7 @@ if (par1Entity.canAttackWithItem()) { if (!par1Entity.hitByEntity(this)) -@@ -1373,6 +1478,12 @@ +@@ -1373,6 +1479,12 @@ */ public EnumStatus sleepInBedAt(int par1, int par2, int par3) { @@ -317,7 +334,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1417,6 +1528,11 @@ +@@ -1417,6 +1529,11 @@ { int l = this.worldObj.getBlockMetadata(par1, par2, par3); int i1 = BlockBed.getDirection(l); @@ -329,7 +346,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1487,10 +1603,12 @@ +@@ -1487,10 +1604,12 @@ ChunkCoordinates chunkcoordinates = this.playerLocation; ChunkCoordinates chunkcoordinates1 = this.playerLocation; @@ -346,7 +363,7 @@ if (chunkcoordinates1 == null) { -@@ -1527,7 +1645,9 @@ +@@ -1527,7 +1646,9 @@ */ private boolean isInBed() { @@ -357,7 +374,7 @@ } /** -@@ -1542,9 +1662,12 @@ +@@ -1542,9 +1663,12 @@ ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); @@ -373,7 +390,7 @@ return chunkcoordinates1; } else -@@ -1566,10 +1689,13 @@ +@@ -1566,10 +1690,13 @@ { if (this.playerLocation != null) { @@ -391,7 +408,7 @@ { case 0: return 90.0F; -@@ -1635,14 +1761,40 @@ +@@ -1635,14 +1762,40 @@ /** * Returns the location of the bed the player will respawn at, or null if the player has not slept in a bed. */ @@ -436,7 +453,7 @@ } /** -@@ -1650,6 +1802,10 @@ +@@ -1650,6 +1803,10 @@ */ public void setSpawnChunk(ChunkCoordinates par1ChunkCoordinates, boolean par2) { @@ -447,7 +464,7 @@ if (par1ChunkCoordinates != null) { this.spawnChunk = new ChunkCoordinates(par1ChunkCoordinates); -@@ -1661,7 +1817,32 @@ +@@ -1661,7 +1818,32 @@ this.spawnForced = false; } } @@ -481,7 +498,7 @@ /** * Will trigger the specified trigger. */ -@@ -1843,6 +2024,10 @@ +@@ -1843,6 +2025,10 @@ super.fall(par1); } @@ -492,7 +509,7 @@ } /** -@@ -1884,7 +2069,7 @@ +@@ -1884,7 +2070,7 @@ { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { @@ -501,7 +518,7 @@ } if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) -@@ -1906,6 +2091,7 @@ +@@ -1906,6 +2092,7 @@ return Item.bow.getItemIconForUseDuration(0); } } @@ -509,7 +526,7 @@ } return icon; -@@ -2127,7 +2313,17 @@ +@@ -2127,7 +2314,17 @@ this.setScore(par1EntityPlayer.getScore()); } @@ -527,7 +544,7 @@ } /** -@@ -2191,7 +2387,14 @@ +@@ -2191,7 +2388,14 @@ */ public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { @@ -543,3 +560,52 @@ } @SideOnly(Side.CLIENT) +@@ -2245,7 +2449,7 @@ + */ + public String getTranslatedEntityName() + { +- return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.username); ++ return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayName()); + } + + public void setAbsorptionAmount(float par1) +@@ -2267,4 +2471,39 @@ + { + FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); + } ++ ++ /* ===================================== FORGE START =====================================*/ ++ ++ public float eyeHeight; ++ private String displayname; ++ ++ /** ++ * Returns the default eye height of the player ++ * @return player default eye height ++ */ ++ public float getDefaultEyeHeight() ++ { ++ return 0.12F; ++ } ++ ++ /** ++ * Get the currently computed display name, cached for efficiency. ++ * @return the current display name ++ */ ++ public String getDisplayName() ++ { ++ if(this.displayname == null) ++ { ++ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.username); ++ } ++ return this.displayname; ++ } ++ ++ /** ++ * Force the displayed name to refresh ++ */ ++ public void refreshDisplayName() ++ { ++ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.username); ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 577132e0ab..1e197c8ace 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -33,7 +33,19 @@ this.mcServer = par1MinecraftServer; this.stepHeight = 0.0F; -@@ -289,7 +287,10 @@ +@@ -239,11 +237,6 @@ + this.yOffset = 0.0F; + } + +- public float getEyeHeight() +- { +- return 1.62F; +- } +- + /** + * Called to update the entity's position/logic. + */ +@@ -289,7 +282,10 @@ if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4)) { arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos)); @@ -45,7 +57,7 @@ } } -@@ -310,6 +311,7 @@ +@@ -310,6 +306,7 @@ { Chunk chunk = (Chunk)iterator2.next(); this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); @@ -53,7 +65,7 @@ } } } -@@ -377,11 +379,25 @@ +@@ -377,11 +374,25 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -79,3 +91,20 @@ } Collection collection = this.worldObj.getScoreboard().func_96520_a(ScoreObjectiveCriteria.deathCount); +@@ -1043,4 +1054,16 @@ + { + return new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ)); + } ++ ++ /* ===================================== FORGE START =====================================*/ ++ ++ /** ++ * Returns the default eye height of the player ++ * @return player default eye height ++ */ ++ @Override ++ public float getDefaultEyeHeight() ++ { ++ return 1.62F; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index bfb3641585..a94a319703 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -30,7 +30,7 @@ } @SideOnly(Side.CLIENT) -@@ -384,6 +387,38 @@ +@@ -384,6 +387,36 @@ { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); @@ -40,9 +40,7 @@ + + public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) + { -+ BiomeEvent.CreateDecorator event = new BiomeEvent.CreateDecorator(this, original); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeDecorator; ++ return new DeferredBiomeDecorator(this, original); + } + + @SideOnly(Side.CLIENT)