From 99f6b9b74fb2136dd17d180145aa91eb84da5bc3 Mon Sep 17 00:00:00 2001 From: Rseifert Date: Sun, 3 Feb 2013 23:52:31 -0500 Subject: [PATCH] added a method to get an Entities Class name --- .../common/machine/command/CommandBreak.java | 17 +++++++++++++++-- .../common/machine/imprinter/ItemImprinter.java | 17 +++++++++++++++++ .../prefab/BlockMachine.java | 2 +- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/minecraft/assemblyline/common/machine/command/CommandBreak.java b/src/minecraft/assemblyline/common/machine/command/CommandBreak.java index 25576ae3..96115ed5 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandBreak.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandBreak.java @@ -52,7 +52,14 @@ public class CommandBreak extends Command */ return true; } - + /** + * Drops an item stack at the exact center of the coords given + * @param world + * @param x + * @param y + * @param z + * @param stack + */ protected void dropBlockAsItem_do(World world, int x, int y, int z, ItemStack stack) { if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) @@ -62,7 +69,13 @@ public class CommandBreak extends Command world.spawnEntityInWorld(entity); } } - + /** + * grabs all the items that the block can drop then pass them onto dropBlockAsItem_do + * @param world + * @param x + * @param y + * @param z + */ public void dropBlockAsItem(World world, int x, int y, int z) { if (!world.isRemote) diff --git a/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java index 1f6ce20c..98c2673d 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/ItemImprinter.java @@ -3,6 +3,9 @@ package assemblyline.common.machine.imprinter; import java.util.ArrayList; import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -21,6 +24,7 @@ public class ItemImprinter extends Item this.setCreativeTab(TabAssemblyLine.INSTANCE); this.setHasSubtypes(true); this.setTextureFile(AssemblyLine.ITEM_TEXTURE_PATH); + } @Override @@ -29,6 +33,19 @@ public class ItemImprinter extends Item return 1; } + @Override + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) + { + if (entity != null && !(entity instanceof IProjectile) && !(entity instanceof EntityPlayer)) + { + String stringName = EntityList.getEntityString(entity); + //TODO add to filter + player.sendChatToPlayer("Target: "+ stringName); + return true; + } + return false; + } + @Override public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4) { diff --git a/src/minecraft/universalelectricity/prefab/BlockMachine.java b/src/minecraft/universalelectricity/prefab/BlockMachine.java index 0134fb0f..b0c6cb51 100644 --- a/src/minecraft/universalelectricity/prefab/BlockMachine.java +++ b/src/minecraft/universalelectricity/prefab/BlockMachine.java @@ -205,7 +205,7 @@ public abstract class BlockMachine extends BlockContainer implements ISneakUseWr if (var7.hasTagCompound()) { - var12.func_92014_d().setTagCompound((NBTTagCompound) var7.getTagCompound().copy()); + var12.getEntityItem().setTagCompound((NBTTagCompound) var7.getTagCompound().copy()); } float var13 = 0.05F;