use of kingdoms.server.entities.EntityHired in project Tale-of-Kingdoms by Ivasik78.
the class GuiHunter method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
switch(button.id) {
case 1:
this.player.addChatMessage(!HunterHandler.INSTANCE.getHunter() ? new ChatComponentTranslation("gui.guildMaster.killMobs") : new ChatComponentTranslation("gui.guildMaster.discarded"));
this.player.addChatMessage(new ChatComponentTranslation("gui.guildMaster.await"));
this.initGui();
break;
case 2:
if (1500 <= playerProvider.getGoldTotal()) {
EntityLiving entityLiving = (EntityLiving) UltimateHelper.INSTANCE.getEntity("Hired", world);
entityLiving.setLocationAndAngles(this.player.posX, this.player.posY, this.player.posZ, 0.0F, 0.0F);
this.world.spawnEntityInWorld(entityLiving);
playerProvider.decreaseGold(1500);
} else {
this.goldchecker = true;
}
break;
case 3:
this.mc.displayGuiScreen(null);
this.goldchecker = false;
break;
case 4:
InventoryPlayer inventoryPlayer = this.player.inventory;
boolean entity = false;
if (inventoryPlayer.hasItem(Item.getItemFromBlock(Blocks.log))) {
for (ItemStack stack : inventoryPlayer.mainInventory) {
if (stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.log)) {
if (stack.stackSize == stack.getMaxStackSize() && !entity) {
inventoryPlayer.setItemStack(null);
entity = true;
}
}
}
}
if (!entity) {
if (!this.world.isRemote) {
this.player.addChatMessage(new ChatComponentTranslation("gui.guildMaster.needMore"));
}
} else if (!this.world.isRemote) {
this.player.addChatMessage(new ChatComponentTranslation("gui.guildMaster.fixed"));
}
break;
case 5:
IntStream.range(0, this.world.loadedEntityList.size()).mapToObj(var7 -> (Entity) this.world.loadedEntityList.get(var7)).filter(entity1 -> entity1 instanceof EntityHired).map(entity1 -> (EntityHired) entity1).forEach(var9 -> {
var9.setDead();
playerProvider.addGold(1000);
});
break;
}
}
Aggregations