mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
RC 2. Hotfix for RC 1
This commit is contained in:
1 parent
21e98a5d1a
commit
b4c07c2909
8 files changed
+107
-40
No files matched your search
@@ -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() {
|
||||
|
||||
-30
@@ -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<ItemConfigField> 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<ItemConfigField> 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);
|
||||
}
|
||||
|
||||
|
||||
+51
-5
@@ -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<ItemConfigField> 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<ItemConfigField> 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<ItemConfigField> 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<ItemConfigField> 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()
|
||||
|
||||
@@ -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: "");
|
||||
|
||||
@@ -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<ToolModePacket, IMessage>
|
||||
{
|
||||
@Override
|
||||
public IMessage onMessage(ToolModePacket message, MessageContext ctx) {
|
||||
ToolBase.handleModeChange(ctx.getServerHandler().playerEntity.getHeldItem(), ctx.getServerHandler().playerEntity, message.shift, message.ctrl);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user