From c0164f29cd8101eaa3cf295714ea93e61303365b Mon Sep 17 00:00:00 2001 From: Lomeli12 Date: Tue, 10 Sep 2013 14:08:29 -0700 Subject: [PATCH 01/19] Villager Trading GUI will not open if Player is sneaking. --- .../entity/passive/EntityVillager.java.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch new file mode 100644 index 0000000000..ab69a14ae5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/entity/passive/EntityVillager.java ++++ ../src_work/minecraft/net/minecraft/entity/passive/EntityVillager.java +@@ -205,7 +205,7 @@ + ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); + boolean flag = itemstack != null && itemstack.itemID == Item.monsterPlacer.itemID; + +- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) ++ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !par1EntityPlayer.isSneaking()) + { + if (!this.worldObj.isRemote) + { From f68bdb04938d96d44cadcf0a00b0a2c5171bf0bf Mon Sep 17 00:00:00 2001 From: James Clarke Date: Sat, 21 Sep 2013 01:43:12 +0100 Subject: [PATCH 02/19] Pass arguments to install.sh and install.cmd to install.py --- install/install.cmd | 2 +- install/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install/install.cmd b/install/install.cmd index 9f11ec0458..61436b21fc 100644 --- a/install/install.cmd +++ b/install/install.cmd @@ -1,3 +1,3 @@ @echo off -.\fml\python\python_fml install.py +.\fml\python\python_fml install.py %* pause \ No newline at end of file diff --git a/install/install.sh b/install/install.sh index 07e01fccec..fba8952b0c 100644 --- a/install/install.sh +++ b/install/install.sh @@ -1,2 +1,2 @@ #!/bin/bash -python install.py \ No newline at end of file +python install.py "$@" \ No newline at end of file From f40bdeca97ea6c92babb58d7b0ce996597975b1f Mon Sep 17 00:00:00 2001 From: Ben Blank Date: Sat, 28 Sep 2013 17:56:19 -0700 Subject: [PATCH 03/19] allow blocks to choose how they handle indirect power --- .../net/minecraft/block/Block.java.patch | 27 +++++++++-- .../net/minecraft/world/World.java.patch | 48 ++++++++++++++----- 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index dbbc6adbda..c388bd009f 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -145,7 +145,28 @@ } /** -@@ -1086,6 +1110,7 @@ +@@ -1036,6 +1060,20 @@ + public int getRenderColor(int par1) + { + return 16777215; ++ } ++ ++ /** ++ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. ++ * @param world The world ++ * @param x The x position of this block instance ++ * @param y The y position of this block instance ++ * @param z The z position of this block instance ++ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side ++ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power ++ */ ++ public boolean shouldCheckWeakPower(World world, int x, int y, int z, int side) ++ { ++ return !this.isNormalCube(world.getBlockId(x, y, z)); + } + + /** +@@ -1086,6 +1124,7 @@ */ public void setBlockBoundsForItemRender() {} @@ -153,7 +174,7 @@ /** * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the * block and l is the block's subtype/damage. -@@ -1095,28 +1120,37 @@ +@@ -1095,28 +1134,37 @@ par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addExhaustion(0.025F); @@ -198,7 +219,7 @@ } /** -@@ -1457,4 +1491,979 @@ +@@ -1457,4 +1505,979 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 26732593b1..33ed9901f0 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -748,7 +748,31 @@ { block = null; } -@@ -3914,7 +4083,7 @@ +@@ -3744,14 +3913,20 @@ + */ + public int getIndirectPowerLevelTo(int par1, int par2, int par3, int par4) + { +- if (this.isBlockNormalCube(par1, par2, par3)) ++ Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; ++ ++ if (block == null) ++ { ++ return 0; ++ } ++ ++ if (!block.shouldCheckWeakPower(this, par1, par2, par3, par4)) + { + return this.getBlockPowerInput(par1, par2, par3); + } + else + { +- int i1 = this.getBlockId(par1, par2, par3); +- return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingWeakPower(this, par1, par2, par3, par4); ++ return block.isProvidingWeakPower(this, par1, par2, par3, par4); + } + } + +@@ -3914,7 +4089,7 @@ */ public long getSeed() { @@ -757,7 +781,7 @@ } public long getTotalWorldTime() -@@ -3924,7 +4093,7 @@ +@@ -3924,7 +4099,7 @@ public long getWorldTime() { @@ -766,7 +790,7 @@ } /** -@@ -3932,7 +4101,7 @@ +@@ -3932,7 +4107,7 @@ */ public void setWorldTime(long par1) { @@ -775,7 +799,7 @@ } /** -@@ -3940,13 +4109,13 @@ +@@ -3940,13 +4115,13 @@ */ public ChunkCoordinates getSpawnPoint() { @@ -791,7 +815,7 @@ } @SideOnly(Side.CLIENT) -@@ -3970,7 +4139,10 @@ +@@ -3970,7 +4145,10 @@ if (!this.loadedEntityList.contains(par1Entity)) { @@ -803,7 +827,7 @@ } } -@@ -3978,6 +4150,11 @@ +@@ -3978,6 +4156,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -815,7 +839,7 @@ { return true; } -@@ -4098,8 +4275,7 @@ +@@ -4098,8 +4281,7 @@ */ public boolean isBlockHighHumidity(int par1, int par2, int par3) { @@ -825,7 +849,7 @@ } /** -@@ -4174,7 +4350,7 @@ +@@ -4174,7 +4356,7 @@ */ public int getHeight() { @@ -834,7 +858,7 @@ } /** -@@ -4182,7 +4358,7 @@ +@@ -4182,7 +4364,7 @@ */ public int getActualHeight() { @@ -843,7 +867,7 @@ } public IUpdatePlayerListBox getMinecartSoundUpdater(EntityMinecart par1EntityMinecart) -@@ -4225,7 +4401,7 @@ +@@ -4225,7 +4407,7 @@ */ public double getHorizon() { @@ -852,7 +876,7 @@ } /** -@@ -4294,30 +4470,28 @@ +@@ -4294,30 +4476,28 @@ public void func_96440_m(int par1, int par2, int par3, int par4) { @@ -904,7 +928,7 @@ } } } -@@ -4363,4 +4537,115 @@ +@@ -4363,4 +4543,115 @@ return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); } From 5f752fc967413fa44a3cd06c31ff29be1d4ca7e6 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Sat, 28 Sep 2013 19:48:50 -0700 Subject: [PATCH 04/19] MinecraftForge/FML@35ab9f52b02d84592e4c7607feb6009710b2f7d9 Fix md5s for new checksums.sha1 in scala libraries. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 9b55f1f48f..35ab9f52b0 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 9b55f1f48f89a5348ac1d58622b71946f310316a +Subproject commit 35ab9f52b02d84592e4c7607feb6009710b2f7d9 From 3805eddd3419066ebbb93e23742768152b621680 Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 29 Sep 2013 16:15:03 -0400 Subject: [PATCH 05/19] Updated FML: MinecraftForge/FML@5265e34a350adbb762264379f0134bfa40d33eaa Fix null killing the server --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 35ab9f52b0..5265e34a35 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 35ab9f52b02d84592e4c7607feb6009710b2f7d9 +Subproject commit 5265e34a350adbb762264379f0134bfa40d33eaa From 06e2f914c12b494fe5d0622ca32119210766ef70 Mon Sep 17 00:00:00 2001 From: HoBoS_TaCo Date: Mon, 23 Sep 2013 18:50:59 +1000 Subject: [PATCH 06/19] Added ItemTooltipEvent This event is fired at the end of ItemStack.getTooltip(EntityPlayer, boolean), which in turn is called from it's respective GUIContainer. It allows an itemstack's tooltip to be changed depending on the player, itemstack or whether the advanced information on item tooltips is being shown, toggled by F3+H. --- .../event/ForgeEventFactory.java | 8 +++++ .../event/entity/player/ItemTooltipEvent.java | 32 +++++++++++++++++++ .../net/minecraft/item/ItemStack.java.patch | 29 ++++++++++++----- 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 common/net/minecraftforge/event/entity/player/ItemTooltipEvent.java diff --git a/common/net/minecraftforge/event/ForgeEventFactory.java b/common/net/minecraftforge/event/ForgeEventFactory.java index 716a7e0674..852f8b7b92 100644 --- a/common/net/minecraftforge/event/ForgeEventFactory.java +++ b/common/net/minecraftforge/event/ForgeEventFactory.java @@ -15,6 +15,7 @@ import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.entity.living.LivingPackSizeEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -99,4 +100,11 @@ public class ForgeEventFactory MinecraftForge.EVENT_BUS.post(event); return event.dropChance; } + + public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List toolTip, boolean showAdvancedItemTooltips) + { + ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, toolTip, showAdvancedItemTooltips); + MinecraftForge.EVENT_BUS.post(event); + return event; + } } diff --git a/common/net/minecraftforge/event/entity/player/ItemTooltipEvent.java b/common/net/minecraftforge/event/entity/player/ItemTooltipEvent.java new file mode 100644 index 0000000000..7194abad51 --- /dev/null +++ b/common/net/minecraftforge/event/entity/player/ItemTooltipEvent.java @@ -0,0 +1,32 @@ +package net.minecraftforge.event.entity.player; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class ItemTooltipEvent extends PlayerEvent +{ + /** + * Whether the advanced information on item tooltips is being shown, toggled by F3+H. + */ + public final boolean showAdvancedItemTooltips; + /** + * The {@link ItemStack} with the tooltip. + */ + public final ItemStack itemStack; + /** + * The {@link ItemStack} tooltip. + */ + public final List toolTip; + + /** + * This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer. + */ + public ItemTooltipEvent(ItemStack itemStack, EntityPlayer entityPlayer, List toolTip, boolean showAdvancedItemTooltips) + { + super(entityPlayer); + this.itemStack = itemStack; + this.toolTip = toolTip; + this.showAdvancedItemTooltips = showAdvancedItemTooltips; + } +} \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 0a0f0f63f3..6f21cf117b 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,6 +1,14 @@ --- ../src_base/minecraft/net/minecraft/item/ItemStack.java +++ ../src_work/minecraft/net/minecraft/item/ItemStack.java -@@ -252,7 +252,9 @@ +@@ -29,6 +29,7 @@ + import net.minecraft.util.Icon; + import net.minecraft.util.StatCollector; + import net.minecraft.world.World; ++import net.minecraftforge.event.ForgeEventFactory; + + public final class ItemStack + { +@@ -252,7 +253,9 @@ */ public boolean isItemDamaged() { @@ -11,7 +19,7 @@ } /** -@@ -260,6 +262,10 @@ +@@ -260,6 +263,10 @@ */ public int getItemDamageForDisplay() { @@ -22,7 +30,7 @@ return this.itemDamage; } -@@ -268,6 +274,10 @@ +@@ -268,6 +275,10 @@ */ public int getItemDamage() { @@ -33,7 +41,7 @@ return this.itemDamage; } -@@ -276,6 +286,12 @@ +@@ -276,6 +287,12 @@ */ public void setItemDamage(int par1) { @@ -46,7 +54,7 @@ this.itemDamage = par1; if (this.itemDamage < 0) -@@ -289,7 +305,7 @@ +@@ -289,7 +306,7 @@ */ public int getMaxDamage() { @@ -55,7 +63,7 @@ } /** -@@ -327,8 +343,8 @@ +@@ -327,8 +344,8 @@ } } @@ -66,7 +74,7 @@ } } -@@ -396,7 +412,7 @@ +@@ -396,7 +413,7 @@ */ public boolean canHarvestBlock(Block par1Block) { @@ -75,7 +83,12 @@ } public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) -@@ -737,10 +753,16 @@ +@@ -733,14 +750,21 @@ + { + arraylist.add("Durability: " + (this.getMaxDamage() - this.getItemDamageForDisplay()) + " / " + this.getMaxDamage()); + } ++ ForgeEventFactory.onItemTooltip(this, par1EntityPlayer, arraylist, par2); + return arraylist; } From ca351b527db0eb56c38456261469ee50499485be Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 11:36:28 -0700 Subject: [PATCH 07/19] Update workspace to point at launchwrapper 1.8 --- eclipse-workspace-dev.zip | Bin 24494 -> 24494 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index b0bc358ead5bd7e6bf8003239c3bc1735df9ac15..a8b149e4d4eea5f415ec664a1c1535aece7624e5 100644 GIT binary patch delta 1995 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 Date: Mon, 30 Sep 2013 11:37:37 -0700 Subject: [PATCH 08/19] Vanilla hopper should obey the IInventory contract, TileEntityHopper now takes into account IInventory.getInventoryStackLimit() when inserting items Closes #597. --- .../tileentity/TileEntityHopper.java.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch new file mode 100644 index 0000000000..ef86ad0583 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -0,0 +1,38 @@ +--- ../src_base/minecraft/net/minecraft/tileentity/TileEntityHopper.java ++++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityHopper.java +@@ -453,17 +453,28 @@ + + if (itemstack1 == null) + { +- par0IInventory.setInventorySlotContents(par2, par1ItemStack); +- par1ItemStack = null; ++ int max = Math.min(par1ItemStack.getMaxStackSize(), par0IInventory.getInventoryStackLimit()); ++ if (max >= par1ItemStack.stackSize) ++ { ++ par0IInventory.setInventorySlotContents(par2, par1ItemStack); ++ par1ItemStack = null; ++ } ++ else ++ { ++ par0IInventory.setInventorySlotContents(par2, par1ItemStack.splitStack(max)); ++ } + flag = true; + } + else if (areItemStacksEqualItem(itemstack1, par1ItemStack)) + { +- int k = par1ItemStack.getMaxStackSize() - itemstack1.stackSize; +- int l = Math.min(par1ItemStack.stackSize, k); +- par1ItemStack.stackSize -= l; +- itemstack1.stackSize += l; +- flag = l > 0; ++ int max = Math.min(par1ItemStack.getMaxStackSize(), par0IInventory.getInventoryStackLimit()); ++ if (max > itemstack1.stackSize) ++ { ++ int l = Math.min(par1ItemStack.stackSize, max - itemstack1.stackSize); ++ par1ItemStack.stackSize -= l; ++ itemstack1.stackSize += l; ++ flag = l > 0; ++ } + } + + if (flag) From 8c54873afdb7c32652022e562c033d801289051f Mon Sep 17 00:00:00 2001 From: Ben Blank Date: Mon, 30 Sep 2013 11:54:03 -0700 Subject: [PATCH 09/19] move `shouldCheckWeakPower` to Forge section --- .../net/minecraft/block/Block.java.patch | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index c388bd009f..7c4d8bf208 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -145,28 +145,7 @@ } /** -@@ -1036,6 +1060,20 @@ - public int getRenderColor(int par1) - { - return 16777215; -+ } -+ -+ /** -+ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. -+ * @param world The world -+ * @param x The x position of this block instance -+ * @param y The y position of this block instance -+ * @param z The z position of this block instance -+ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side -+ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power -+ */ -+ public boolean shouldCheckWeakPower(World world, int x, int y, int z, int side) -+ { -+ return !this.isNormalCube(world.getBlockId(x, y, z)); - } - - /** -@@ -1086,6 +1124,7 @@ +@@ -1086,6 +1110,7 @@ */ public void setBlockBoundsForItemRender() {} @@ -174,7 +153,7 @@ /** * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the * block and l is the block's subtype/damage. -@@ -1095,28 +1134,37 @@ +@@ -1095,28 +1120,37 @@ par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addExhaustion(0.025F); @@ -219,7 +198,7 @@ } /** -@@ -1457,4 +1505,979 @@ +@@ -1457,4 +1491,993 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -1195,6 +1174,20 @@ + return false; + } + ++ /** ++ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. ++ * @param world The world ++ * @param x The x position of this block instance ++ * @param y The y position of this block instance ++ * @param z The z position of this block instance ++ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side ++ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power ++ */ ++ public boolean shouldCheckWeakPower(World world, int x, int y, int z, int side) ++ { ++ return !this.isNormalCube(world.getBlockId(x, y, z)); ++ } ++ + @Deprecated //Implemented here as we changed the IFluidBlock interface, and this allows us to do so without breaking exisitng mods. + // To be removed next MC version {1.6.3+} + public float getFilledPercentage(World world, int x, int y, int z){ return 1; } From b3c715c31255db602dfb46434685a3149f352d46 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 13:08:57 -0700 Subject: [PATCH 10/19] Add the ability to register chat commands that only execute on the client. Works with autocomplete. Client commands are gray when shown in the autocomplete list (when you press tab) Closes #640 --- .../client/ClientCommandHandler.java | 140 ++++++++++++++++++ .../net/minecraft/client/Minecraft.java.patch | 38 +++-- .../minecraft/client/gui/GuiChat.java.patch | 44 ++++++ 3 files changed, 208 insertions(+), 14 deletions(-) create mode 100644 client/net/minecraftforge/client/ClientCommandHandler.java create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch diff --git a/client/net/minecraftforge/client/ClientCommandHandler.java b/client/net/minecraftforge/client/ClientCommandHandler.java new file mode 100644 index 0000000000..b929e723e2 --- /dev/null +++ b/client/net/minecraftforge/client/ClientCommandHandler.java @@ -0,0 +1,140 @@ +package net.minecraftforge.client; + +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.command.CommandException; +import net.minecraft.command.CommandHandler; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.util.ChatMessageComponent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.CommandEvent; +import cpw.mods.fml.client.FMLClientHandler; +import static net.minecraft.util.EnumChatFormatting.*; + +/** + * The class that handles client-side chat commands. You should register any + * commands that you want handled on the client with this command handler. + * + * If there is a command with the same name registered both on the server and + * client, the client takes precedence! + * + */ +public class ClientCommandHandler extends CommandHandler +{ + public static final ClientCommandHandler instance = new ClientCommandHandler(); + + public String[] latestAutoComplete = null; + + /** + * @return 1 if successfully executed, 0 if wrong usage, it doesn't exist or + * it was canceled. + */ + @Override + public int executeCommand(ICommandSender sender, String message) + { + message = message.trim(); + + if (message.startsWith("/")) + { + message = message.substring(1); + } + + String[] args = message.split(" "); + String commandName = args[0]; + System.arraycopy(args, 1, args, 0, args.length - 1); + ICommand icommand = (ICommand) getCommands().get(commandName); + + try + { + if (icommand == null) + { + return 0; + } + + if (icommand.canCommandSenderUseCommand(sender)) + { + CommandEvent event = new CommandEvent(icommand, sender, args); + if (MinecraftForge.EVENT_BUS.post(event)) + { + if (event.exception != null) + { + throw event.exception; + } + return 0; + } + + icommand.processCommand(sender, args); + return 1; + } + else + { + sender.sendChatToPlayer(format("commands.generic.permission").setColor(RED)); + } + } + catch (WrongUsageException wue) + { + sender.sendChatToPlayer(format("commands.generic.usage", format(wue.getMessage(), wue.getErrorOjbects())).setColor(RED)); + } + catch (CommandException ce) + { + sender.sendChatToPlayer(format(ce.getMessage(), ce.getErrorOjbects()).setColor(RED)); + } + catch (Throwable t) + { + sender.sendChatToPlayer(format("commands.generic.exception").setColor(RED)); + t.printStackTrace(); + } + + return 0; + } + + //Couple of helpers because the mcp names are stupid and long... + private ChatMessageComponent format(String str, Object... args) + { + return ChatMessageComponent.createFromTranslationWithSubstitutions(str, args); + } + + private ChatMessageComponent format(String str) + { + return ChatMessageComponent.createFromTranslationKey(str); + } + + public void autoComplete(String leftOfCursor, String full) + { + latestAutoComplete = null; + + if (leftOfCursor.charAt(0) == '/') + { + leftOfCursor = leftOfCursor.substring(1); + + Minecraft mc = FMLClientHandler.instance().getClient(); + if (mc.currentScreen instanceof GuiChat) + { + List commands = getPossibleCommands(mc.thePlayer, leftOfCursor); + if (commands != null && !commands.isEmpty()) + { + if (leftOfCursor.indexOf(' ') == -1) + { + for (int i = 0; i < commands.size(); i++) + { + commands.set(i, GRAY + "/" + commands.get(i) + RESET); + } + } + else + { + for (int i = 0; i < commands.size(); i++) + { + commands.set(i, GRAY + commands.get(i) + RESET); + } + } + + latestAutoComplete = commands.toArray(new String[commands.size()]); + } + } + } + } +} \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 021d32ef9f..5e3cec260c 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,9 +1,10 @@ --- ../src_base/minecraft/net/minecraft/client/Minecraft.java +++ ../src_work/minecraft/net/minecraft/client/Minecraft.java -@@ -137,6 +137,15 @@ +@@ -137,6 +137,16 @@ import com.google.common.collect.MapDifference; ++import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.GuiIngameForge; +import net.minecraftforge.client.event.GuiOpenEvent; @@ -16,7 +17,7 @@ @SideOnly(Side.CLIENT) public class Minecraft implements IPlayerUsage { -@@ -416,7 +425,7 @@ +@@ -416,7 +426,7 @@ try { @@ -25,7 +26,7 @@ } catch (LWJGLException lwjglexception) { -@@ -497,7 +506,7 @@ +@@ -497,7 +507,7 @@ this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); FMLClientHandler.instance().finishMinecraftLoading(); this.checkGLError("Post startup"); @@ -34,7 +35,7 @@ if (this.serverName != null) { -@@ -679,11 +688,6 @@ +@@ -679,11 +689,6 @@ */ public void displayGuiScreen(GuiScreen par1GuiScreen) { @@ -46,7 +47,7 @@ this.statFileWriter.syncStats(); if (par1GuiScreen == null && this.theWorld == null) -@@ -693,6 +697,20 @@ +@@ -693,6 +698,20 @@ else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F) { par1GuiScreen = new GuiGameOver(); @@ -67,7 +68,7 @@ } if (par1GuiScreen instanceof GuiMainMenu) -@@ -1300,7 +1318,7 @@ +@@ -1300,7 +1319,7 @@ if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l)) { @@ -76,7 +77,7 @@ this.thePlayer.swingItem(); } } -@@ -1366,7 +1384,8 @@ +@@ -1366,7 +1385,8 @@ { int j1 = itemstack != null ? itemstack.stackSize : 0; @@ -86,7 +87,7 @@ { flag = false; this.thePlayer.swingItem(); -@@ -1392,7 +1411,8 @@ +@@ -1392,7 +1412,8 @@ { ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); @@ -96,7 +97,7 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -@@ -1574,6 +1594,8 @@ +@@ -1574,6 +1595,8 @@ while (Mouse.next()) { @@ -105,7 +106,7 @@ i = Mouse.getEventButton(); if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) -@@ -2046,6 +2068,11 @@ +@@ -2046,6 +2069,11 @@ { this.statFileWriter.syncStats(); @@ -117,7 +118,7 @@ if (par1WorldClient == null) { NetClientHandler netclienthandler = this.getNetHandler(); -@@ -2063,6 +2090,18 @@ +@@ -2063,6 +2091,18 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); @@ -136,7 +137,16 @@ } this.theIntegratedServer = null; -@@ -2236,107 +2275,12 @@ +@@ -2225,7 +2265,7 @@ + */ + public boolean handleClientCommand(String par1Str) + { +- return false; ++ return ClientCommandHandler.instance.executeCommand(thePlayer, par1Str) == 1; + } + + /** +@@ -2236,107 +2276,12 @@ if (this.objectMouseOver != null) { boolean flag = this.thePlayer.capabilities.isCreativeMode; @@ -248,7 +258,7 @@ if (flag) { -@@ -2419,11 +2363,18 @@ +@@ -2419,11 +2364,18 @@ par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); } @@ -267,7 +277,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 +2382,7 @@ +@@ -2431,6 +2383,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch new file mode 100644 index 0000000000..755d5e3119 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -0,0 +1,44 @@ +--- ../src_base/minecraft/net/minecraft/client/gui/GuiChat.java ++++ ../src_work/minecraft/net/minecraft/client/gui/GuiChat.java +@@ -7,8 +7,11 @@ + import java.util.Iterator; + import java.util.List; + import net.minecraft.network.packet.Packet203AutoComplete; ++import net.minecraft.util.EnumChatFormatting; ++import net.minecraftforge.client.ClientCommandHandler; + import org.lwjgl.input.Keyboard; + import org.lwjgl.input.Mouse; ++import com.google.common.collect.ObjectArrays; + + @SideOnly(Side.CLIENT) + public class GuiChat extends GuiScreen +@@ -278,13 +281,14 @@ + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(stringbuilder.toString(), 1); + } + +- this.inputField.writeText((String)this.field_73904_o.get(this.field_73903_n++)); ++ this.inputField.writeText(EnumChatFormatting.func_110646_a((String)this.field_73904_o.get(this.field_73903_n++))); + } + + private void func_73893_a(String par1Str, String par2Str) + { + if (par1Str.length() >= 1) + { ++ ClientCommandHandler.instance.autoComplete(par1Str, par2Str); + this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str)); + this.field_73905_m = true; + } +@@ -347,6 +351,13 @@ + String[] astring1 = par1ArrayOfStr; + int i = par1ArrayOfStr.length; + ++ String[] complete = ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ astring1 = ObjectArrays.concat(complete, astring1, String.class); ++ i = astring1.length; ++ } ++ + for (int j = 0; j < i; ++j) + { + String s = astring1[j]; From 81efd38feeba780365a0bc5f4160a70ff7d46ec4 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 13:52:17 -0700 Subject: [PATCH 11/19] Fix placement of snow cover over metadata 6. Closes #724 --- .../net/minecraft/block/BlockSnow.java.patch | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index 2057a746eb..c44d79bc47 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -53,7 +53,7 @@ par1World.setBlockToAir(par2, par3, par4); } } -@@ -177,4 +176,10 @@ +@@ -177,4 +176,27 @@ { return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); } @@ -62,5 +62,22 @@ + public int quantityDropped(int meta, int fortune, Random random) + { + return (meta & 7) + 1; ++ } ++ ++ /** ++ * 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 ++ */ ++ @Override ++ public boolean isBlockReplaceable(World world, int x, int y, int z) ++ { ++ int meta = world.getBlockMetadata(x, y, z); ++ return (meta >= 7 ? false : blockMaterial.isReplaceable()); + } } From 71ececdbb4231c4c95e4fd4b5289d31e1c8469d4 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 14:02:23 -0700 Subject: [PATCH 12/19] Set densityDir in BlockFluidBase's constructor, closes #737 --- common/net/minecraftforge/fluids/BlockFluidBase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 91716d0c4a..9cb87bf478 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -58,6 +58,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock this.temperature = fluid.temperature; this.maxScaledLight = fluid.luminosity; this.tickRate = fluid.viscosity / 200; + this.densityDir = fluid.density > 0 ? -1 : 1; fluid.setBlockID(id); displacementIds.putAll(defaultDisplacementIds); From 01cf29a202bac8b74498861f630485e6a331c939 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 14:32:12 -0700 Subject: [PATCH 13/19] Add pre and post event to rendering Chat, allowing for placement of the chat box. Closes #733 --- .../minecraftforge/client/GuiIngameForge.java | 13 ++++++++++--- .../client/event/RenderGameOverlayEvent.java | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/client/net/minecraftforge/client/GuiIngameForge.java b/client/net/minecraftforge/client/GuiIngameForge.java index 24ac8a8656..93eabfef99 100644 --- a/client/net/minecraftforge/client/GuiIngameForge.java +++ b/client/net/minecraftforge/client/GuiIngameForge.java @@ -723,12 +723,19 @@ public class GuiIngameForge extends GuiIngame protected void renderChat(int width, int height) { - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, (float)(height - 48), 0.0F); mc.mcProfiler.startSection("chat"); + + RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48); + if (MinecraftForge.EVENT_BUS.post(event)) return; + + GL11.glPushMatrix(); + GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F); persistantChatGUI.drawChat(updateCounter); - mc.mcProfiler.endSection(); GL11.glPopMatrix(); + + post(CHAT); + + mc.mcProfiler.endSection(); } protected void renderPlayerList(int width, int height) diff --git a/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java index 68ab5f73f7..0c7ca27588 100644 --- a/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -24,7 +24,8 @@ public class RenderGameOverlayEvent extends Event EXPERIENCE, TEXT, HEALTHMOUNT, - JUMPBAR + JUMPBAR, + CHAT } public final float partialTicks; @@ -79,4 +80,17 @@ public class RenderGameOverlayEvent extends Event this.right = right; } } + + public static class Chat extends Pre + { + public int posX; + public int posY; + + public Chat(RenderGameOverlayEvent parent, int posX, int posY) + { + super(parent, ElementType.CHAT); + this.posX = posX; + this.posY = posY; + } + } } From 73202259fafe09f3b020eec147ec3812fa4cfa2b Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 14:51:39 -0700 Subject: [PATCH 14/19] Direct canApplyAtEnchantingTable through canApply Closes #740 --- .../net/minecraft/enchantment/Enchantment.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 1bf46b0b62..9a531e19a9 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -15,14 +15,14 @@ } + /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #func_92037_a(ItemStack)} ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} + * applies for all possible enchantments. + * @param stack + * @return + */ + public boolean canApplyAtEnchantingTable(ItemStack stack) + { -+ return this.type.canEnchantItem(stack.getItem()); ++ return canApply(stack); + } + + /** From b74d977225dc512f91606b92dd579dd508936025 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 14:58:03 -0700 Subject: [PATCH 15/19] Added all the vanilla records to the ore dictionary. Closes #731 --- .../minecraftforge/oredict/OreDictionary.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/common/net/minecraftforge/oredict/OreDictionary.java b/common/net/minecraftforge/oredict/OreDictionary.java index 3557e16196..496f9109c1 100644 --- a/common/net/minecraftforge/oredict/OreDictionary.java +++ b/common/net/minecraftforge/oredict/OreDictionary.java @@ -49,15 +49,27 @@ public class OreDictionary registerOre("stickWood", Item.stick); registerOre("treeSapling", new ItemStack(Block.sapling, 1, WILDCARD_VALUE)); registerOre("treeLeaves", new ItemStack(Block.leaves, 1, WILDCARD_VALUE)); - registerOre("oreGold", Block.oreGold); - registerOre("oreIron", Block.oreIron); - registerOre("oreLapis", Block.oreLapis); - registerOre("oreDiamond", Block.oreDiamond); + registerOre("oreGold", Block.oreGold); + registerOre("oreIron", Block.oreIron); + registerOre("oreLapis", Block.oreLapis); + registerOre("oreDiamond", Block.oreDiamond); registerOre("oreRedstone", Block.oreRedstone); - registerOre("oreEmerald", Block.oreEmerald); - registerOre("oreQuartz", Block.oreNetherQuartz); - registerOre("stone", Block.stone); + registerOre("oreEmerald", Block.oreEmerald); + registerOre("oreQuartz", Block.oreNetherQuartz); + registerOre("stone", Block.stone); registerOre("cobblestone", Block.cobblestone); + registerOre("record", Item.record13); + registerOre("record", Item.recordCat); + registerOre("record", Item.recordBlocks); + registerOre("record", Item.recordChirp); + registerOre("record", Item.recordFar); + registerOre("record", Item.recordMall); + registerOre("record", Item.recordMellohi); + registerOre("record", Item.recordStal); + registerOre("record", Item.recordStrad); + registerOre("record", Item.recordWard); + registerOre("record", Item.record11); + registerOre("record", Item.recordWait); } // Build our list of items to replace with ore tags From 96b4fd1da14be8809344a1d7758be77d8b2aa0f7 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 16:21:40 -0700 Subject: [PATCH 16/19] Stack sensitive version of Item.getItemStackLimit. Closes #771 --- .../minecraftforge/common/ChestGenHooks.java | 2 +- .../net/minecraft/item/Item.java.patch | 37 +++++++++++++++++-- .../net/minecraft/item/ItemStack.java.patch | 9 +++++ 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/common/net/minecraftforge/common/ChestGenHooks.java b/common/net/minecraftforge/common/ChestGenHooks.java index 68c326c442..9713c014d7 100644 --- a/common/net/minecraftforge/common/ChestGenHooks.java +++ b/common/net/minecraftforge/common/ChestGenHooks.java @@ -108,7 +108,7 @@ public class ChestGenHooks { ret = new ItemStack[0]; } - else if (count > source.getItem().getItemStackLimit()) + else if (count > source.getMaxStackSize()) { ret = new ItemStack[count]; for (int x = 0; x < count; x++) diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index f54ebdeb5f..57afb05ec0 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -47,7 +47,15 @@ } itemsList[256 + par1] = this; -@@ -606,6 +616,7 @@ +@@ -334,6 +344,7 @@ + /** + * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?* + */ ++ @Deprecated + public int getItemStackLimit() + { + return this.maxStackSize; +@@ -606,6 +617,7 @@ } @SideOnly(Side.CLIENT) @@ -55,7 +63,16 @@ public boolean hasEffect(ItemStack par1ItemStack) { return par1ItemStack.isItemEnchanted(); -@@ -635,7 +646,7 @@ +@@ -626,7 +638,7 @@ + */ + public boolean isItemTool(ItemStack par1ItemStack) + { +- return this.getItemStackLimit() == 1 && this.isDamageable(); ++ return this.getItemStackLimit(par1ItemStack) == 1 && this.isDamageable(); + } + + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) +@@ -635,7 +647,7 @@ float f1 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * f; float f2 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * f; double d0 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)f; @@ -64,7 +81,7 @@ double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)f; Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); -@@ -645,6 +656,10 @@ +@@ -645,6 +657,10 @@ float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; @@ -75,7 +92,7 @@ Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -753,4 +768,534 @@ +@@ -753,4 +769,546 @@ { StatList.initStats(); } @@ -608,5 +625,17 @@ + public boolean hasEffect(ItemStack par1ItemStack, int pass) + { + return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID); ++ } ++ ++ /** ++ * Gets the maximum number of items that this stack should be able to hold. ++ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() ++ * ++ * @param stack The ItemStack ++ * @return THe maximum number this item can be stacked to ++ */ ++ public int getItemStackLimit(ItemStack stack) ++ { ++ return this.getItemStackLimit(); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 6f21cf117b..3e707ebc1b 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -8,6 +8,15 @@ public final class ItemStack { +@@ -223,7 +224,7 @@ + */ + public int getMaxStackSize() + { +- return this.getItem().getItemStackLimit(); ++ return this.getItem().getItemStackLimit(this); + } + + /** @@ -252,7 +253,9 @@ */ public boolean isItemDamaged() From 2e3d1a3c0928a86c0e82e2104a8df30488d98946 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 16:56:34 -0700 Subject: [PATCH 17/19] Add cancelable EntityStructByLightningEvent, Closes #789 --- .../entity/EntityStruckByLightningEvent.java | 17 ++++++++++++++ .../effect/EntityLightningBolt.java.patch | 23 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java create mode 100644 patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch diff --git a/common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java b/common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java new file mode 100644 index 0000000000..c55cc4fdb7 --- /dev/null +++ b/common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java @@ -0,0 +1,17 @@ +package net.minecraftforge.event.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraftforge.event.Cancelable; + +@Cancelable +public class EntityStruckByLightningEvent extends EntityEvent +{ + public final EntityLightningBolt lightning; + + public EntityStruckByLightningEvent(Entity entity, EntityLightningBolt lightning) + { + super(entity); + this.lightning = lightning; + } +} diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch new file mode 100644 index 0000000000..a0843132ea --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -0,0 +1,23 @@ +--- ../src_base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java ++++ ../src_work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +@@ -10,6 +10,8 @@ + import net.minecraft.util.MathHelper; + import net.minecraft.util.Vec3; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.EntityStruckByLightningEvent; + + public class EntityLightningBolt extends EntityWeatherEffect + { +@@ -116,7 +118,10 @@ + for (int l = 0; l < list.size(); ++l) + { + Entity entity = (Entity)list.get(l); +- entity.onStruckByLightning(this); ++ if (!MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, this))) ++ { ++ entity.onStruckByLightning(this); ++ } + } + } + } From 68669e267988a39f6663cc323df6390c4e736845 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 17:15:18 -0700 Subject: [PATCH 18/19] Make isItemStackDamageable() pass the stack to getMaxDamage() to use the Forge version of getMaxDamage(). Fixes display issues with mods using getMaxDamage(ItemStack) instead of the vanilla one. Closes #805 --- .../minecraft/net/minecraft/item/ItemStack.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 3e707ebc1b..7ccbc41396 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -17,6 +17,15 @@ } /** +@@ -239,7 +240,7 @@ + */ + public boolean isItemStackDamageable() + { +- return Item.itemsList[this.itemID].getMaxDamage() > 0; ++ return Item.itemsList[this.itemID].getMaxDamage(this) > 0; + } + + public boolean getHasSubtypes() @@ -252,7 +253,9 @@ */ public boolean isItemDamaged() From cba1de122aec07d62d2bf62d71b98296e53b9983 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 30 Sep 2013 17:17:35 -0700 Subject: [PATCH 19/19] Bump version number for todays changes. --- common/net/minecraftforge/common/ForgeVersion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/net/minecraftforge/common/ForgeVersion.java b/common/net/minecraftforge/common/ForgeVersion.java index e0356249af..1054c1d546 100644 --- a/common/net/minecraftforge/common/ForgeVersion.java +++ b/common/net/minecraftforge/common/ForgeVersion.java @@ -12,7 +12,7 @@ public class ForgeVersion //This number is incremented every minecraft release, never reset public static final int minorVersion = 11; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version - public static final int revisionVersion = 0; + public static final int revisionVersion = 1; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0;