Created
May 10, 2015 05:00
-
-
Save unascribed/f200f64bb169271d07d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @author Aesen Vismea **/ | |
@Override | |
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { | |
EnumFacing face = EnumFacing.values()[side]; | |
int xO = x+face.getFrontOffsetX(); | |
int yO = y+face.getFrontOffsetY(); | |
int zO = z+face.getFrontOffsetZ(); | |
world.setBlock(xO, yO, zO, Blocks.mob_spawner); | |
TileEntityMobSpawner te = new TileEntityMobSpawner(); | |
te.readFromNBT(itemstack.getTagCompound()); | |
world.setTileEntity(xO, yO, zO, te); | |
return true; | |
} | |
// Example code to create an item for a Wither spawner | |
{ | |
ItemStack stack = new ItemStack(MyMod.MY_ITEM); | |
NBTTagCompound tag = new NBTTagCompound(); | |
tag.setInteger("EntityId", 64); | |
stack.setTagCompound(tag); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment