Make invertShift a client-side setting.

This commit is contained in:
Justin Aquadro committed 2015-04-30 11:42:45 -04:00
1 parent 2078e2834c
commit e0b4658a95
5 files changed
+12 -7

No files matched your search

+1
View File
@@ -16,3 +16,4 @@ out/
*.iws
*.iml
*.ipr
runtime-1.8/
+1 -1
View File
@@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-1.4.0-alpha2"
version = "1.7.10-1.4.0"
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StorageDrawers"
@@ -294,7 +294,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
float hitY = (float)(posn.hitVec.yCoord - posn.blockY);
float hitZ = (float)(posn.hitVec.zCoord - posn.blockZ);
StorageDrawers.network.sendToServer(new BlockClickMessage(x, y, z, posn.sideHit, hitX, hitY, hitZ));
StorageDrawers.network.sendToServer(new BlockClickMessage(x, y, z, posn.sideHit, hitX, hitY, hitZ, StorageDrawers.config.cache.invertShift));
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "BlockDrawers.onBlockClicked with " + posn.toString());
@@ -302,7 +302,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
}
@Override
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ, boolean invertShift) {
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "IExtendedBlockClickHandler.onBlockClicked");
@@ -321,7 +321,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
ItemStack item = null;
// if invertSHift is true this will happen when the player is not shifting
if (player.isSneaking() != StorageDrawers.config.cache.invertShift)
if (player.isSneaking() != invertShift)
item = tileDrawers.takeItemsFromSlot(slot, drawer.getStoredItemStackSize());
else
item = tileDrawers.takeItemsFromSlot(slot, 1);
@@ -5,5 +5,5 @@ import net.minecraft.world.World;
public interface IExtendedBlockClickHandler
{
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ);
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ, boolean invertShift);
}
@@ -18,10 +18,11 @@ public class BlockClickMessage implements IMessage
private float hitX;
private float hitY;
private float hitZ;
private boolean invertShift;
public BlockClickMessage () { }
public BlockClickMessage (int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
public BlockClickMessage (int x, int y, int z, int side, float hitX, float hitY, float hitZ, boolean invertShift) {
this.x = x;
this.y = y;
this.z = z;
@@ -29,6 +30,7 @@ public class BlockClickMessage implements IMessage
this.hitX = hitX;
this.hitY = hitY;
this.hitZ = hitZ;
this.invertShift = invertShift;
}
@Override
@@ -40,6 +42,7 @@ public class BlockClickMessage implements IMessage
hitX = buf.readByte() / 16f;
hitY = buf.readByte() / 16f;
hitZ = buf.readByte() / 16f;
invertShift = buf.readBoolean();
}
@Override
@@ -51,6 +54,7 @@ public class BlockClickMessage implements IMessage
buf.writeByte((int)(hitX * 16));
buf.writeByte((int)(hitY * 16));
buf.writeByte((int)(hitZ * 16));
buf.writeBoolean(invertShift);
}
public static class Handler implements IMessageHandler<BlockClickMessage, IMessage>
@@ -61,7 +65,7 @@ public class BlockClickMessage implements IMessage
World world = ctx.getServerHandler().playerEntity.getEntityWorld();
Block block = world.getBlock(message.x, message.y, message.z);
if (block instanceof IExtendedBlockClickHandler)
((IExtendedBlockClickHandler) block).onBlockClicked(world, message.x, message.y, message.z, ctx.getServerHandler().playerEntity, message.side, message.hitX, message.hitY, message.hitZ);
((IExtendedBlockClickHandler) block).onBlockClicked(world, message.x, message.y, message.z, ctx.getServerHandler().playerEntity, message.side, message.hitX, message.hitY, message.hitZ, message.invertShift);
}
return null;