Backstage Sigil of Holding (#785)

* Backstage Sigil of Holding
All Sigil of Holding features work, just need to add the aesthetics -> TehNut
Somebody might want to look at adding LP costs to the Sigil?
Also recipes need to be added
Added a keybinding system for future usage
Standardized some NBT tags

Compact classes

Fix lang stuff?

* Fancify Sigil of Holding GUI
Displays the selected sigil in the GUI now

Woops

* Quick fix

* Unused import

* Final commit I promise
This commit is contained in:
Arcaratus 2016-06-07 18:50:41 -04:00 committed by Nick Ignoffo
parent 9aa2f86c88
commit 8d66575530
19 changed files with 922 additions and 6 deletions

View file

@ -19,6 +19,8 @@ public class BloodMagicPacketHandler
INSTANCE.registerMessage(ItemRouterButtonPacketProcessor.class, ItemRouterButtonPacketProcessor.class, 1, Side.SERVER);
INSTANCE.registerMessage(PlayerVelocityPacketProcessor.class, PlayerVelocityPacketProcessor.class, 2, Side.CLIENT);
INSTANCE.registerMessage(PlayerFallDistancePacketProcessor.class, PlayerFallDistancePacketProcessor.class, 3, Side.SERVER);
INSTANCE.registerMessage(SigilHoldingPacketProcessor.class, SigilHoldingPacketProcessor.class, 4, Side.SERVER);
INSTANCE.registerMessage(KeyProcessor.class, KeyProcessor.class, 5, Side.SERVER);
}
public static void sendToAllAround(IMessage message, TileEntity te, int range)

View file

@ -0,0 +1,61 @@
package WayofTime.bloodmagic.network;
import WayofTime.bloodmagic.util.handler.BMKeyBinding;
import WayofTime.bloodmagic.util.handler.IKeybindable;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
public class KeyProcessor implements IMessage, IMessageHandler<KeyProcessor, IMessage>
{
public int keyId;
public boolean showInChat;
public KeyProcessor()
{
}
public KeyProcessor(BMKeyBinding.Key key, boolean showInChat)
{
this.keyId = key.ordinal();
this.showInChat = showInChat;
}
@Override
public void fromBytes(ByteBuf buf)
{
this.keyId = buf.readInt();
this.showInChat = buf.readBoolean();
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(this.keyId);
buf.writeBoolean(this.showInChat);
}
@Override
public IMessage onMessage(KeyProcessor msg, MessageContext ctx)
{
EntityPlayer entityPlayer = ctx.getServerHandler().playerEntity;
if (entityPlayer != null)
{
ItemStack heldStack = entityPlayer.getHeldItemMainhand();
if (heldStack.getItem() instanceof IKeybindable)
{
if (msg.keyId < 0 || msg.keyId >= BMKeyBinding.Key.values().length)
{
return null;
}
BMKeyBinding.Key key = BMKeyBinding.Key.values()[msg.keyId];
((IKeybindable) heldStack.getItem()).onKeyPressed(heldStack, entityPlayer, key, msg.showInChat);
}
}
return null;
}
}

View file

@ -0,0 +1,56 @@
package WayofTime.bloodmagic.network;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
public class SigilHoldingPacketProcessor implements IMessage, IMessageHandler<SigilHoldingPacketProcessor, IMessage>
{
private int slot;
private int mode;
public SigilHoldingPacketProcessor()
{
}
public SigilHoldingPacketProcessor(int slot, int mode)
{
this.slot = slot;
this.mode = mode;
}
@Override
public void toBytes(ByteBuf buffer)
{
buffer.writeInt(slot);
buffer.writeInt(mode);
}
@Override
public void fromBytes(ByteBuf buffer)
{
slot = buffer.readInt();
mode = buffer.readInt();
}
@Override
public IMessage onMessage(SigilHoldingPacketProcessor message, MessageContext ctx)
{
ItemStack itemStack = null;
if (message.slot > -1 && message.slot < 9)
{
itemStack = ctx.getServerHandler().playerEntity.inventory.getStackInSlot(message.slot);
}
if (itemStack != null)
{
ItemSigilHolding.cycleSigil(itemStack, message.mode);
}
return null;
}
}