use of net.minecraft.util.ChatComponentTranslation in project Armourers-Workshop by RiskyKen.
the class ItemLinkingTool method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return false;
}
if (!world.isRemote) {
if (!hasLinkLocation(stack)) {
Block block = world.getBlock(x, y, z);
if (!(block instanceof BlockSkinnable)) {
setLinkLocation(stack, new BlockLocation(x, y, z));
player.addChatMessage(new ChatComponentTranslation("chat.armourersworkshop:linkingTool.start", (Object) null));
return true;
} else {
player.addChatMessage(new ChatComponentTranslation("chat.armourersworkshop:linkingTool.linkedToSkinnable", (Object) null));
return true;
}
} else {
BlockLocation loc = getLinkLocation(stack);
Block block = world.getBlock(x, y, z);
if (block instanceof BlockSkinnable) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntitySkinnable) {
((TileEntitySkinnable) te).getParent().setLinkedBlock(loc);
player.addChatMessage(new ChatComponentTranslation("chat.armourersworkshop:linkingTool.finish", (Object) null));
removeLinkLocation(stack);
return true;
}
}
}
removeLinkLocation(stack);
player.addChatMessage(new ChatComponentTranslation("chat.armourersworkshop:linkingTool.fail", (Object) null));
}
return true;
}
use of net.minecraft.util.ChatComponentTranslation in project Armourers-Workshop by RiskyKen.
the class ItemSkinUnlock method onItemRightClick.
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (world.isRemote) {
return itemStack;
}
ISkinType skinType = getSkinTypeFormStack(itemStack);
ExPropsPlayerSkinData equipmentData = ExPropsPlayerSkinData.get(player);
int count = equipmentData.getEquipmentWardrobeData().getUnlockedSlotsForSkinType(skinType);
count++;
String localizedSkinName = SkinTypeRegistry.INSTANCE.getLocalizedSkinTypeName(skinType);
if (count <= ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE) {
equipmentData.setSkinColumnCount(skinType, count);
player.addChatComponentMessage(new ChatComponentTranslation("chat.armourersworkshop:slotUnlocked", localizedSkinName.toLowerCase(), Integer.toString(count)));
itemStack.stackSize--;
} else {
player.addChatComponentMessage(new ChatComponentTranslation("chat.armourersworkshop:slotUnlockedFailed", localizedSkinName));
}
return itemStack;
}
use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.
the class ItemAmadronTablet method onItemUse.
@Override
public boolean onItemUse(ItemStack tablet, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof IFluidHandler) {
if (!world.isRemote) {
setLiquidProvidingLocation(tablet, x, y, z, world.provider.dimensionId);
player.addChatComponentMessage(new ChatComponentTranslation("message.amadronTable.setLiquidProvidingLocation", x, y, z, world.provider.dimensionId, world.provider.getDimensionName()));
}
} else if (te instanceof IInventory) {
if (!world.isRemote) {
setItemProvidingLocation(tablet, x, y, z, world.provider.dimensionId);
player.addChatComponentMessage(new ChatComponentTranslation("message.amadronTable.setItemProvidingLocation", x, y, z, world.provider.dimensionId, world.provider.getDimensionName()));
}
} else {
return false;
}
return true;
}
use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.
the class ItemSeismicSensor method onItemUse.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
if (!world.isRemote) {
int testingY = y;
while (testingY > 0) {
testingY--;
if (world.getBlock(x, testingY, z) == FluidRegistry.getFluid(Fluids.oil.getName()).getBlock()) {
Set<ChunkPosition> oilPositions = new HashSet<ChunkPosition>();
Stack<ChunkPosition> pendingPositions = new Stack<ChunkPosition>();
pendingPositions.add(new ChunkPosition(x, testingY, z));
while (!pendingPositions.empty()) {
ChunkPosition checkingPos = pendingPositions.pop();
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
ChunkPosition newPos = new ChunkPosition(checkingPos.chunkPosX + d.offsetX, checkingPos.chunkPosY + d.offsetY, checkingPos.chunkPosZ + d.offsetZ);
if (world.getBlock(newPos.chunkPosX, newPos.chunkPosY, newPos.chunkPosZ) == Fluids.oil.getBlock() && world.getBlockMetadata(newPos.chunkPosX, newPos.chunkPosY, newPos.chunkPosZ) == 0 && oilPositions.add(newPos)) {
pendingPositions.add(newPos);
}
}
}
player.addChatComponentMessage(new ChatComponentTranslation("message.seismicSensor.foundOilDetails", EnumChatFormatting.GREEN.toString() + (y - testingY), EnumChatFormatting.GREEN.toString() + oilPositions.size() / 10 * 10));
return true;
}
}
player.addChatComponentMessage(new ChatComponentTranslation("message.seismicSensor.noOilFound"));
}
// we don't want to use the item.
return true;
}
use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.
the class ItemRemote method onItemUseFirst.
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
@Override
public boolean onItemUseFirst(ItemStack remote, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (!world.isRemote && !player.isSneaking() && isAllowedToEdit(player, remote)) {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof TileEntitySecurityStation) {
if (((TileEntitySecurityStation) te).doesAllowPlayer(player)) {
NBTTagCompound tag = remote.getTagCompound();
if (tag == null) {
tag = new NBTTagCompound();
remote.setTagCompound(tag);
}
tag.setInteger("securityX", x);
tag.setInteger("securityY", y);
tag.setInteger("securityZ", z);
tag.setInteger("securityDimension", world.provider.dimensionId);
player.addChatComponentMessage(new ChatComponentTranslation("gui.remote.boundSecurityStation", x, y, z));
return true;
} else {
player.addChatComponentMessage(new ChatComponentTranslation("gui.remote.cantBindSecurityStation"));
}
}
}
return false;
}
Aggregations