use of uk.co.wehavecookies56.kk.common.item.base.ItemKeychain in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class DriveForm method update.
public void update(EntityPlayer player) {
if (player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).activeSlot() == -1) {
player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).setActiveSlot(player.inventory.currentItem);
}
if (player.world.isRemote) {
GuiScreen currScreen = Minecraft.getMinecraft().currentScreen;
if (currScreen instanceof GuiContainer) {
Minecraft.getMinecraft().displayGuiScreen(null);
player.sendMessage(new TextComponentTranslation("Cannot open containers while drive form is active"));
}
}
if (player.inventory.currentItem != player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).activeSlot())
player.inventory.currentItem = player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).activeSlot();
if (ItemStack.areItemStacksEqual(player.inventory.getItemStack(), new ItemStack(((ItemKeychain) player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(0).getItem()).getKeyblade()))) {
player.inventory.setItemStack(ItemStack.EMPTY);
player.inventory.setInventorySlotContents(player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).activeSlot(), new ItemStack(((ItemKeychain) player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(0).getItem()).getKeyblade()));
}
if (hasOffHand() && ItemStack.areItemStacksEqual(player.inventory.getItemStack(), new ItemStack(((ItemKeychain) player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(getKeychainSlot()).getItem()).getKeyblade()))) {
player.inventory.setItemStack(ItemStack.EMPTY);
player.inventory.offHandInventory.set(0, new ItemStack(((ItemKeychain) player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(1).getItem()).getKeyblade()));
}
if (ItemStack.areItemStacksEqual(player.inventory.getStackInSlot(player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).activeSlot()), ItemStack.EMPTY)) {
player.inventory.setInventorySlotContents(player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).activeSlot(), new ItemStack(((ItemKeychain) player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(0).getItem()).getKeyblade()));
}
if (hasOffHand() && ItemStack.areItemStacksEqual(player.inventory.offHandInventory.get(0), ItemStack.EMPTY)) {
player.inventory.offHandInventory.set(0, new ItemStack(((ItemKeychain) player.getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(1).getItem()).getKeyblade()));
}
if (!player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode()) {
if (player.getCapability(ModCapabilities.DRIVE_STATE, null).getFP() > 0) {
player.getCapability(ModCapabilities.DRIVE_STATE, null).remFP(0.1);
if (player.getCapability(ModCapabilities.DRIVE_STATE, null).getFP() < 0) {
player.getCapability(ModCapabilities.DRIVE_STATE, null).setFP(0);
endDrive(player);
if (player.world.isRemote) {
PacketDispatcher.sendToServer(new DriveFormPacket(getName(), true));
}
}
} else {
endDrive(player);
if (player.world.isRemote) {
PacketDispatcher.sendToServer(new DriveFormPacket(getName(), true));
}
/*Utils.summonWeapon(player, EnumHand.MAIN_HAND, 0);
if(hasOffHand())
Utils.summonWeapon(player, EnumHand.OFF_HAND, getKeychainSlot());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
player.inventory.offHandInventory.set(0, ItemStack.EMPTY);*/
}
}
}
Aggregations