From e184f72fb22db8859f771c8b8c9b2c4dc6d939b6 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 20 Jul 2015 06:39:52 +0200 Subject: [PATCH] Changed Connectivity Displaying to work properly --- .../actuallyadditions/blocks/BlockPhantomface.java | 4 ++-- .../actuallyadditions/blocks/InitBlocks.java | 2 +- .../items/ItemPhantomConnector.java | 1 + .../ellpeck/actuallyadditions/util/WorldPos.java | 14 ++++++++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java index c5365a707..5f450b7c4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java @@ -63,7 +63,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range)); if(phantom.hasBoundTile()){ int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ())); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getBlock().getLocalizedName(), phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance))); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getItemBlock().getItemStackDisplayName(new ItemStack(phantom.boundPosition.getBlock(), 1, phantom.boundPosition.getMetadata())), phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance))); if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"))); else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"))); @@ -77,7 +77,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range)); if(phantom.hasBoundPosition()){ int distance = (int)Vec3.createVectorHelper(x, y, z).distanceTo(Vec3.createVectorHelper(phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ())); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getBlock().getLocalizedName(), phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance))); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", phantom.boundPosition.getItemBlock().getItemStackDisplayName(new ItemStack(phantom.boundPosition.getBlock(), 1, phantom.boundPosition.getMetadata())), phantom.boundPosition.getX(), phantom.boundPosition.getY(), phantom.boundPosition.getZ(), distance))); if(phantom.isBoundPositionInRange()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"))); else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"))); diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 85047f33e..d76e8afe3 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -277,6 +277,6 @@ public class InitBlocks{ } public static void errorAlreadyRegistered(String str){ - ModUtil.LOGGER.log(Level.WARN, str + " from Actually Additions is not getting used as it has already been registered by another Mod! If this causes Issues (which it shouldn't!), you can turn this off in the Config File!"); + ModUtil.LOGGER.log(Level.WARN, str + " from "+ModUtil.NAME+" is not getting used as it has already been registered by another Mod! If this causes Issues (which it shouldn't!), you can turn this off in the Config File!"); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java index 6a73ba009..14d00d721 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java @@ -131,6 +131,7 @@ public class ItemPhantomConnector extends Item implements INameableItem{ World world = coords.getWorld(); if(world != null){ list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.boundTo.desc")+":"); + list.add(coords.getItemBlock().getItemStackDisplayName(new ItemStack(coords.getBlock(), 1, coords.getMetadata()))); list.add("X: "+coords.getX()); list.add("Y: "+coords.getY()); list.add("Z: "+coords.getZ()); diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java b/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java index 1a6622b26..a7b47de6b 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java @@ -1,6 +1,8 @@ package ellpeck.actuallyadditions.util; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -42,6 +44,18 @@ public class WorldPos{ return this.world != null ? this.world.getTileEntity(this.x, this.y, this.z) : null; } + public Material getMaterial(){ + return this.world != null ? this.world.getBlock(this.x, this.y, this.z).getMaterial() : null; + } + + public Item getItemBlock(){ + return this.world != null ? Item.getItemFromBlock(this.world.getBlock(this.x, this.y, this.z)) : null; + } + + public int getMetadata(){ + return this.world != null ? this.world.getBlockMetadata(this.x, this.y, this.z) : 0; + } + public boolean isEqual(WorldPos pos){ return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.world == pos.getWorld(); }