use of v1_8_9.net.minecraft.util.ChatComponentText in project Tale-of-Kingdoms by Ivasik78.
the class EntityHired method interact.
@Override
public boolean interact(EntityPlayer entityplayer) {
this.player = entityplayer;
if (!worldObj.isRemote) {
if (defaultHeldItem.getItem() == Item.getItemById(267)) {
defaultHeldItem = new ItemStack(Items.bow, 1);
this.player.addChatMessage(new ChatComponentText("Hunter: I shall use my bow."));
} else {
defaultHeldItem = new ItemStack(Items.iron_sword, 1);
this.player.addChatMessage(new ChatComponentText("Hunter: I shall use my sword."));
}
}
return true;
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Tale-of-Kingdoms by Ivasik78.
the class EntityHunterKeeper method interact.
@Override
public boolean interact(EntityPlayer player) {
if (this.canInteractWith(player)) {
if (!this.worldObj.isRemote) {
this.heal(100.0F);
player.addChatMessage(new ChatComponentText("Guild Master: Welcome to the order, hero."));
}
player.openGui(TaleOfKingdoms.instance, GUI_HUNTER, worldObj, 0, 0, 0);
}
return true;
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Tale-of-Kingdoms by Ivasik78.
the class EntityLoneTraveller method interact.
@Override
public boolean interact(EntityPlayer player) {
boolean flag1 = false;
List list = this.worldObj.getEntitiesWithinAABB(EntityCreature.class, AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX + 1.0D, this.posY + 1.0D, this.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) {
for (Object aList : list) {
Entity entity = (Entity) aList;
if (this.canEntityBeSeen(entity) && entity instanceof EntityLostVillager) {
entity.setDead();
PlayerProvider.get(player).addGlory(400);
flag1 = true;
}
}
}
if (flag1 && !this.worldObj.isRemote) {
player.addChatMessage(new ChatComponentText("Survivor: My king! Thank you for saving them! I will let the guild master know your efforts"));
} else if (!this.worldObj.isRemote) {
player.addChatMessage(new ChatComponentText("Survivor: I am gravely lost, my king. I survived the attack but many of our villages burned down. There are still survivors left, hurry and rescue them!"));
player.addChatMessage(new ChatComponentText("Guild Master: Your quest has started, find the village and save them!"));
}
PlayerProvider.get(player).burningVillages = 1;
return true;
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Tale-of-Kingdoms by Ivasik78.
the class EntityVillageMember method interact.
@Override
public boolean interact(EntityPlayer entityplayer) {
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if (itemstack != null && !this.hasAxe && (itemstack.getItem() == Items.wooden_axe || itemstack.getItem() == Items.stone_axe || itemstack.getItem() == Items.iron_axe)) {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null);
this.hasAxe = true;
}
if (itemstack != null && !this.hasPick && (itemstack.getItem() == Items.iron_pickaxe || itemstack.getItem() == Items.wooden_pickaxe || itemstack.getItem() == Items.stone_pickaxe)) {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null);
this.hasPick = true;
}
if (!this.hasPick && !this.hasAxe && !worldObj.isRemote) {
entityplayer.addChatMessage(new ChatComponentText("Villager: My king! Do you need a worker? Give me an axe and a pickaxe and I will work for you."));
}
if (!this.hasPick && this.hasAxe && !worldObj.isRemote) {
entityplayer.addChatMessage(new ChatComponentText("Villager: I still need a pickaxe sir."));
}
if (this.hasPick && !this.hasAxe && !worldObj.isRemote) {
entityplayer.addChatMessage(new ChatComponentText("Villager: I still need an axe sir."));
}
if (this.hasPick && this.hasAxe && !worldObj.isRemote) {
entityplayer.addChatMessage(new ChatComponentText("Worker: I am now a worker sir! Lead the way!"));
EntityLiving entityliving = (EntityLiving) UltimateHelper.INSTANCE.getEntity("WorkerMember", this.worldObj);
entityliving.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
worldObj.spawnEntityInWorld(entityliving);
this.setDead();
}
return true;
}
use of v1_8_9.net.minecraft.util.ChatComponentText in project Tale-of-Kingdoms by Ivasik78.
the class EntityWorkerMember method interact.
public boolean interact(EntityPlayer player) {
boolean flag = false;
List<Entity> entities = this.world.loadedEntityList;
entities.stream().filter(entity -> entity instanceof EntityMarkerKeeper).forEach(Entity::setDead);
this.freeze = false;
if (this.isMining) {
this.isMining = false;
}
int var10;
if (this.worktype == 1) {
var10 = (int) this.posY;
if (this.follow) {
for (int var11 = (int) this.posX - 5; (double) var11 < this.posX + 5.0D; ++var11) {
for (int l = 0; l < 10; ++l) {
for (int i1 = (int) this.posZ - 5; (double) i1 < this.posZ + 5.0D; ++i1) {
if (this.world.getBlock(var11, var10, i1) == Blocks.log && !flag) {
for (int entity2 = var11 - 5; entity2 <= var11 + 5; ++entity2) {
for (int k1 = var10 - 5; k1 <= var10 + 5; ++k1) {
for (int l1 = i1 - 5; l1 <= i1 + 5; ++l1) {
if (this.world.getBlock(entity2, k1, l1) == Block.getBlockById(18)) {
this.world.setBlock(entity2, k1, l1, Blocks.air);
}
}
}
}
Entity entity = UltimateHelper.INSTANCE.getEntity("Marker", this.world);
entity.setLocationAndAngles((double) var11, (double) var10, (double) i1, 0.0F, 0.0F);
if (!this.world.isRemote) {
this.world.spawnEntityInWorld(entity);
}
flag = true;
this.markerExist = true;
} else {
this.markerExist = false;
}
}
}
}
}
if (this.follow && flag && this.worktype == 1 && !this.world.isRemote) {
player.addChatMessage(new ChatComponentText("Worker: Chopping it down sir!"));
}
if (this.follow && !flag && this.worktype == 1 && !this.world.isRemote) {
player.addChatMessage(new ChatComponentText("Worker: Direct me to a tree and I will start cutting!"));
}
}
if (this.worktype == 2 && !this.isMining) {
if (this.posY < 50.0D && !this.world.isRemote) {
player.addChatMessage(new ChatComponentText("Worker: Mining the stone sir!"));
this.createMine();
this.isMining = true;
} else if (!this.world.isRemote) {
player.addChatMessage(new ChatComponentText("Worker: We must go further underground sir!"));
}
}
return true;
}
Aggregations