use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.
the class GuiFoodKeeper method actionPerformed.
@Override
public void actionPerformed(GuiButton button) {
switch(button.id) {
case 1:
if (this.freeBread) {
this.mc.displayGuiScreen(null);
NetworkHandler.INSTANCE.sendToServer(new SPacketAdd(new ItemStack(Items.bread), 1, "gui.farmer.take"));
this.freeBread = false;
} else if (!this.world.isRemote) {
this.player.addChatMessage(new ChatComponentTranslation("gui.farmer.have"));
}
break;
case 2:
this.mc.displayGuiScreen(null);
break;
}
}
use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.
the class GuiLumber method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
switch(button.id) {
case 1:
if (ResourcesHandler.INSTANCE.getWoodPool() >= 64) {
this.world.spawnEntityInWorld(new EntityItem(this.world, this.player.posX, this.player.posY, this.player.posZ, new ItemStack(Item.getItemFromBlock(Blocks.log), 64)));
this.goldchecker = false;
ResourcesHandler.INSTANCE.decreaseWoodPool(64);
} else {
this.player.addChatMessage(new ChatComponentTranslation("gui.foreman.notResources"));
}
break;
case 2:
if (playerProvider.getGoldTotal() >= 1500) {
if (WorkersHandler.INSTANCE.getLumberMembers() < 12) {
WorkersHandler.INSTANCE.addLumberMember((byte) 1);
playerProvider.decreaseGold(1500);
this.player.addChatMessage(new ChatComponentTranslation("gui.foreman.boughtWorker"));
} else {
this.player.addChatMessage(new ChatComponentTranslation("gui.foreman.limitWorkers"));
}
} else {
this.goldchecker = true;
}
break;
case 3:
this.mc.displayGuiScreen(null);
break;
}
}
use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.
the class GuiMageHall method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
switch(button.id) {
case 1:
ItemStack var9 = this.player.inventory.getCurrentItem();
if (500 <= playerProvider.getGoldTotal() && var9 != null) {
final Random random = new Random();
int[] ai = new int[3];
int k;
for (k = 0; k < 3; ++k) {
ai[k] = EnchantmentHelper.calcItemStackEnchantability(random, k, 30, var9);
}
k = random.nextInt(3);
List list1 = EnchantmentHelper.buildEnchantmentList(random, var9, ai[k]);
if (list1 != null) {
for (Object aList1 : list1) {
EnchantmentData enchantmentdata = (EnchantmentData) aList1;
var9.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
playerProvider.decreaseGold(500);
this.player.addChatMessage(new ChatComponentTranslation("gui.mage.enchanted", var9.getDisplayName()));
} else if (!this.world.isRemote) {
this.player.addChatMessage(new ChatComponentTranslation("gui.mage.dontEnchant"));
}
} else {
this.goldchecker = true;
}
break;
case 2:
if (2000 <= playerProvider.getGoldTotal()) {
// NetworkHandler.INSTANCE.sendToServer(new SPacketSpawnEntity("DefendMage"));
playerProvider.decreaseGold(2000);
} else {
this.goldchecker = true;
}
break;
case 3:
this.mc.displayGuiScreen(null);
this.goldchecker = false;
break;
}
}
use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.
the class EntityQuarry method interact.
@Override
public boolean interact(EntityPlayer player) {
if (this.canInteractWith(player)) {
if (!this.worldObj.isRemote) {
this.heal(100.0F);
player.addChatMessage(new ChatComponentTranslation("npc.foreman.dialog"));
}
player.openGui(TaleOfKingdoms.instance, GUI_QUARRY, worldObj, 0, 0, 0);
}
return true;
}
use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.
the class EntitySantaClaus method onDeath.
@Override
public void onDeath(DamageSource damageSource) {
if (!worldObj.isRemote) {
if (damageSource.getSourceOfDamage() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) damageSource.getEntity();
player.addChatMessage(new ChatComponentTranslation("npc.santa.badKid.dialog"));
player.dropItem(Items.coal, worldObj.rand.nextInt(32));
PlayerProvider.get(player).badKid = true;
IntStream.range(1, rand.nextInt(5)).mapToObj(i -> new EntitySnowman(worldObj)).forEach(golem -> {
golem.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
golem.setAttackTarget(player);
worldObj.spawnEntityInWorld(golem);
});
}
}
}
Aggregations