Search in sources :

Example 1 with ItemSystemLinker

use of ValkyrienWarfareControl.Item.ItemSystemLinker in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class BlockHovercraftController method onBlockActivated.

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
    PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldIn, pos);
    if (heldItem != null && heldItem.getItem() instanceof ItemSystemLinker) {
        return false;
    }
    if (wrapper != null) {
        if (!worldIn.isRemote) {
            if (playerIn instanceof EntityPlayerMP) {
                EntityPlayerMP player = (EntityPlayerMP) playerIn;
                int realWindowId = player.currentWindowId;
                // TODO: Fix this, I have to reset the window Id's because there is no container on client side, resulting in the client never changing its window id
                player.currentWindowId = player.inventoryContainer.windowId - 1;
                player.openGui(ValkyrienWarfareControlMod.instance, ControlGUIEnum.HoverCraftController.ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
                player.currentWindowId = realWindowId;
            // player.openContainer = playerIn.inventoryContainer;
            }
        // ModContainer mc = FMLCommonHandler.instance().findContainerFor(ValkyrienWarfareControlMod.instance);
        // if (playerIn instanceof EntityPlayerMP && !(playerIn instanceof FakePlayer))
        // {
        // EntityPlayerMP entityPlayerMP = (EntityPlayerMP) playerIn;
        // Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, ControlGUIEnum.HoverCraftController.ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
        // if (remoteGuiContainer != null)
        // {
        // entityPlayerMP.getNextWindowId();
        // entityPlayerMP.closeContainer();
        // int windowId = entityPlayerMP.currentWindowId;
        // entityPlayerMP.openContainer = remoteGuiContainer;
        // entityPlayerMP.openContainer = entityPlayerMP.inventoryContainer;
        //// entityPlayerMP.openContainer.windowId = windowId;
        //// entityPlayerMP.openContainer.addListener(entityPlayerMP);
        // net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(playerIn, playerIn.openContainer));
        // }
        // }
        }
        return true;
    }
    return false;
}
Also used : ItemSystemLinker(ValkyrienWarfareControl.Item.ItemSystemLinker) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 2 with ItemSystemLinker

use of ValkyrienWarfareControl.Item.ItemSystemLinker in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class ValkyrienWarfareControlMod method registerItems.

private void registerItems(FMLStateEvent event) {
    systemLinker = new ItemSystemLinker().setUnlocalizedName("systemlinker").setRegistryName(MODID, "systemlinker").setCreativeTab(CreativeTabs.TRANSPORTATION).setMaxStackSize(1);
    airshipStealer = new ItemShipStealer().setUnlocalizedName("airshipStealer").setRegistryName(MODID, "airshipStealer").setCreativeTab(CreativeTabs.TOOLS).setMaxStackSize(1);
    relayWire = new ItemRelayWire().setUnlocalizedName("relaywire").setRegistryName(MODID, "relaywire").setCreativeTab(CreativeTabs.TRANSPORTATION).setMaxStackSize(1);
    GameRegistry.register(systemLinker);
    GameRegistry.register(airshipStealer);
    GameRegistry.register(relayWire);
}
Also used : ItemSystemLinker(ValkyrienWarfareControl.Item.ItemSystemLinker) ItemRelayWire(ValkyrienWarfareControl.Item.ItemRelayWire) ItemShipStealer(ValkyrienWarfareControl.Item.ItemShipStealer)

Aggregations

ItemSystemLinker (ValkyrienWarfareControl.Item.ItemSystemLinker)2 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 ItemRelayWire (ValkyrienWarfareControl.Item.ItemRelayWire)1 ItemShipStealer (ValkyrienWarfareControl.Item.ItemShipStealer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1