Search in sources :

Example 1 with KeyBindings

use of WayofTime.bloodmagic.client.key.KeyBindings in project BloodMagic by WayofTime.

the class KeyProcessor method onMessage.

@Override
public IMessage onMessage(KeyProcessor msg, MessageContext ctx) {
    EntityPlayer entityPlayer = ctx.getServerHandler().player;
    if (entityPlayer != null) {
        ItemStack heldStack = entityPlayer.getHeldItemMainhand();
        if (heldStack.getItem() instanceof IKeybindable) {
            if (msg.keyId < 0 || msg.keyId >= KeyBindings.values().length) {
                return null;
            }
            KeyBindings key = KeyBindings.values()[msg.keyId];
            ((IKeybindable) heldStack.getItem()).onKeyPressed(heldStack, entityPlayer, key, msg.showInChat);
        }
    }
    return null;
}
Also used : IKeybindable(WayofTime.bloodmagic.client.key.IKeybindable) KeyBindings(WayofTime.bloodmagic.client.key.KeyBindings) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

Example 2 with KeyBindings

use of WayofTime.bloodmagic.client.key.KeyBindings in project BloodMagic by WayofTime.

the class ClientProxy method preInit.

@Override
public void preInit() {
    super.preInit();
    OBJLoader.INSTANCE.addDomain(BloodMagic.MODID);
    ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR<TileInversionPillar>() {

        @Override
        public void handleEvents(TileInversionPillar chest, float time, Iterable<Event> pastEvents) {
            chest.handleEvents(time, pastEvents);
        }
    });
    ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemyArray.class, new RenderAlchemyArray());
    ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderAltar());
    ClientRegistry.bindTileEntitySpecialRenderer(TileRoutingNode.class, new RenderItemRoutingNode());
    ClientRegistry.bindTileEntitySpecialRenderer(TileDemonCrucible.class, new RenderDemonCrucible());
    ClientRegistry.bindTileEntitySpecialRenderer(TileMimic.class, new RenderMimic());
    ClientRegistry.bindTileEntitySpecialRenderer(TileBloodTank.class, new RenderBloodTank());
    // Initialize key-binds during startup so they load correctly
    for (KeyBindings key : KeyBindings.values()) key.getKey();
}
Also used : KeyBindings(WayofTime.bloodmagic.client.key.KeyBindings) Event(net.minecraftforge.common.animation.Event)

Aggregations

KeyBindings (WayofTime.bloodmagic.client.key.KeyBindings)2 IKeybindable (WayofTime.bloodmagic.client.key.IKeybindable)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 Event (net.minecraftforge.common.animation.Event)1