From b4c07c2909b706559828acf4d2fedc01a384d732 Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Fri, 27 Mar 2015 07:31:29 +1100 Subject: [PATCH] RC 2. Hotfix for RC 1 --- Change Log.txt | 7 ++- VERSION.json | 4 +- build.gradle | 2 +- .../draconicevolution/common/CommonProxy.java | 1 + .../items/tools/baseclasses/MiningTool.java | 30 ---------- .../items/tools/baseclasses/ToolBase.java | 56 +++++++++++++++++-- .../common/lib/VersionHandler.java | 2 +- .../common/network/ToolModePacket.java | 45 +++++++++++++++ 8 files changed, 107 insertions(+), 40 deletions(-) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java diff --git a/Change Log.txt b/Change Log.txt index 2abb7206..026862d1 100644 --- a/Change Log.txt +++ b/Change Log.txt @@ -1,4 +1,7 @@ -######## 1.0.1-Snapshot(6) ######## +######## 1.0.1-Snapshot 7 (RC 2)######## +-hotfix for server crash in RC 1 related to changing tool modes + +######## 1.0.1-Snapshot 6 (RC 1)######## -fixed teleporting mobs with a dislocator on a server crashing the client. -added support for other mods to add recipes to the draconium chest. -fixed arrows bouncing off of dragons... oops. @@ -39,6 +42,8 @@ -added config to disable any blocks or items in the mod -removed old config to disable distortion flame and sun dial -added config option to limit player speed +-added Wireless Energy Transceiver +-added Advanced Wireless Energy Transceiver ######## 1.0.1-Snapshot(5) ######## -fixed tesseracts not accepting energy from pylons. diff --git a/VERSION.json b/VERSION.json index 2e0ee06f..17248de5 100644 --- a/VERSION.json +++ b/VERSION.json @@ -1,3 +1,3 @@ Version:1.0.1 -Snapshot:6 -ReleaseNote:This is the first release candidate for 1.0.1! +Snapshot:7 +ReleaseNote:Hotfix for server crash in RC 1! diff --git a/build.gradle b/build.gradle index 4177e1df..b464b3b8 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ repositories { apply plugin: 'forge' -version = "1.7.10-v1.0.1-release_candidate-1" //Version System A.B.CD A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) D=Bugfix version (a-z) +version = "1.7.10-v1.0.1-RC-2" //Version System A.B.CD A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) D=Bugfix version (a-z) group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Draconic-Evolution" diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index 6a1b7d3c..c1c64e88 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -118,6 +118,7 @@ public class CommonProxy { DraconicEvolution.network.registerMessage(BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER); DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER); DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT); + DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER); } public void registerTileEntities() { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java index 3845bb97..bb9a6eba 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java @@ -75,36 +75,6 @@ public abstract class MiningTool extends ToolBase {//todo add custom information @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { ToolHandler.updateGhostBlocks(player, world); - if (InfoHelper.isShiftKeyDown() && !InfoHelper.isCtrlKeyDown()) - { - List fields = getFields(stack, player.inventory.currentItem); - for (ItemConfigField field : fields) - { - if (field.name.equals(References.DIG_AOE)) - { - int aoe = (Integer) field.value; - aoe++; - if (aoe > (Integer) field.max) aoe = (Integer) field.min; - field.value = aoe; - DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name); - } - } - } - else if (InfoHelper.isCtrlKeyDown() && !InfoHelper.isShiftKeyDown()) - { - List fields = getFields(stack, player.inventory.currentItem); - for (ItemConfigField field : fields) - { - if (field.name.equals(References.DIG_DEPTH)) { - int aoe = (Integer) field.value; - aoe++; - if (aoe > (Integer) field.max) aoe = (Integer) field.min; - field.value = aoe; - DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name); - } - } - } - return super.onItemRightClick(stack, world, player); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java index 4f4e848f..5a643c78 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.keybinding.KeyBindings; import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.ToolModePacket; import com.brandon3055.draconicevolution.common.utills.*; import com.google.common.collect.Sets; import cpw.mods.fml.relauncher.Side; @@ -157,11 +158,57 @@ public class ToolBase extends RFItemBase { } @Override - public ItemStack onItemRightClick(ItemStack stack, World p_77659_2_, EntityPlayer player) { - - if (InfoHelper.isCtrlKeyDown() && InfoHelper.isShiftKeyDown()) + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if (!world.isRemote && !DraconicEvolution.proxy.isDedicatedServer()) { - List fields = getFields(stack, player.inventory.currentItem); + handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); + } + else if (world.isRemote && DraconicEvolution.proxy.getMCServer() == null) + { + handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); + DraconicEvolution.network.sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + } + + return super.onItemRightClick(stack, world, player); + } + + public static void handleModeChange(ItemStack stack, EntityPlayer player, boolean shift, boolean ctrl) + { + if (stack == null || !(stack.getItem() instanceof RFItemBase)) return; + RFItemBase item = (RFItemBase)stack.getItem(); + + if (shift && !ctrl) + { + List fields = item.getFields(stack, player.inventory.currentItem); + for (ItemConfigField field : fields) + { + if (field.name.equals(References.DIG_AOE)) + { + int aoe = (Integer) field.value; + aoe++; + if (aoe > (Integer) field.max) aoe = (Integer) field.min; + field.value = aoe; + DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name); + } + } + } + else if (ctrl && !shift) + { + List fields = item.getFields(stack, player.inventory.currentItem); + for (ItemConfigField field : fields) + { + if (field.name.equals(References.DIG_DEPTH)) { + int aoe = (Integer) field.value; + aoe++; + if (aoe > (Integer) field.max) aoe = (Integer) field.min; + field.value = aoe; + DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name); + } + } + } + else if (ctrl && shift) + { + List fields = item.getFields(stack, player.inventory.currentItem); for (ItemConfigField field : fields) { if (field.name.equals(References.ATTACK_AOE)) { @@ -173,7 +220,6 @@ public class ToolBase extends RFItemBase { } } } - return super.onItemRightClick(stack, p_77659_2_, player); } public ToolMaterial getToolMaterial() diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java index c435f256..8d08111b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java @@ -6,7 +6,7 @@ package com.brandon3055.draconicevolution.common.lib; public class VersionHandler { public static final String VERSION = "1.0.1"; - public static final int SNAPSHOT = 6; + public static final int SNAPSHOT = 7; public static final String MCVERSION = "1.7.10"; public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT: ""); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java new file mode 100644 index 00000000..ca2ed0f4 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java @@ -0,0 +1,45 @@ +package com.brandon3055.draconicevolution.common.network; + +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +/** + * Created by Brandon on 27/03/2015. + */ +public class ToolModePacket implements IMessage { + + public boolean shift; + public boolean ctrl; + + public ToolModePacket() { + } + + public ToolModePacket(boolean shift, boolean ctrl) { + this.shift = shift; + this.ctrl = ctrl; + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeBoolean(shift); + buf.writeBoolean(ctrl); + } + + @Override + public void fromBytes(ByteBuf buf) { + shift = buf.readBoolean(); + ctrl = buf.readBoolean(); + } + + public static class Handler implements IMessageHandler + { + @Override + public IMessage onMessage(ToolModePacket message, MessageContext ctx) { + ToolBase.handleModeChange(ctx.getServerHandler().playerEntity.getHeldItem(), ctx.getServerHandler().playerEntity, message.shift, message.ctrl); + return null; + } + } +} \ No newline at end of file