use of uk.co.wehavecookies56.kk.common.network.packet.server.OpenSynthesis in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class BlockSynthesisTable method onBlockActivated.
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
world.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, ModSounds.kupo, SoundCategory.BLOCKS, 0.5F, 1.0F);
if (world.isRemote)
PacketDispatcher.sendToServer(new OpenSynthesis());
player.openGui(KingdomKeys.instance, GuiIDs.GUI_SYNTHESISTABLE, world, pos.getX(), pos.getY(), pos.getZ());
if (!world.isRemote) {
PacketDispatcher.sendTo(new SyncRecipeData(player.getCapability(ModCapabilities.SYNTHESIS_RECIPES, null)), (EntityPlayerMP) player);
PacketDispatcher.sendTo(new SyncFreeDevRecipeData(player.getCapability(ModCapabilities.SYNTHESIS_RECIPES, null)), (EntityPlayerMP) player);
PacketDispatcher.sendTo(new SyncMaterialData(player.getCapability(ModCapabilities.SYNTHESIS_MATERIALS, null)), (EntityPlayerMP) player);
}
return true;
}
use of uk.co.wehavecookies56.kk.common.network.packet.server.OpenSynthesis in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class GuiShop method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) throws IOException {
switch(button.id) {
case BUY:
submenu = BUY;
break;
case SELL:
submenu = SELL;
break;
case BACK:
submenu = HOME;
buySelected = -1;
sellSelected = -1;
break;
case BUYCONFIRM:
if (buySelected != -1) {
if (canAffordSelected()) {
ItemStack stack = GuiBuyList.itemsForSale.get(buySelected);
if (!quantity.getText().isEmpty())
stack.setCount(Integer.parseInt(quantity.getText()));
PacketDispatcher.sendToServer(new GiveBoughtItem(getPriceFromSelected(buySelected, false, Integer.parseInt(quantity.getText())), stack.getCount(), stack));
buySelected = -1;
quantity.setText("0");
}
}
break;
case SELLCONFIRM:
if (sellSelected != -1) {
int amount = 0;
if (!quantity.getText().isEmpty())
amount = Integer.parseInt(quantity.getText());
PacketDispatcher.sendToServer(new TakeSoldItem(getPriceFromSelected(sellSelected, true, Integer.parseInt(quantity.getText())) / 2, amount, GuiSellList.sellableItems.get(sellSelected)));
sellSelected = -1;
quantity.setText("0");
}
sellList.occupyList();
break;
case SYNTHESIS:
PacketDispatcher.sendToServer(new OpenSynthesis());
Minecraft.getMinecraft().displayGuiScreen(new GuiSynthesis(this));
break;
}
updateButtons();
}
Aggregations