added a method to get an Entities Class name

This commit is contained in:
Rseifert 2013-02-03 23:52:31 -05:00
parent 7faca8f8ae
commit 99f6b9b74f
3 changed files with 33 additions and 3 deletions

View file

@ -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)

View file

@ -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)
{

View file

@ -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;