Created
July 18, 2016 11:49
-
-
Save dazsim/efcf1c3dca01cb228e97da14b1924ceb to your computer and use it in GitHub Desktop.
this is the onBlockPlacedBy code
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
@Override | |
public void onBlockPlacedBy(World worldIn,BlockPos pos,IBlockState state,EntityLivingBase placer,ItemStack stack) | |
{ | |
//grab settings from itemstack | |
if (worldIn == null) | |
{ | |
System.out.println("EMPTY WORLD"); | |
return; | |
} | |
if (pos == null) | |
{ | |
System.out.println("EMPTY POS"); | |
return; | |
} | |
if (stack == null) | |
{ | |
System.out.println("EMPTY STACK"); | |
return; | |
} | |
Boolean c,f; | |
NBTTagCompound n = new NBTTagCompound(); | |
stack.readFromNBT(n); | |
c = n.getBoolean("comp"); | |
f = n.getBoolean("frame"); | |
TileEntityBarrel t; | |
TileEntity t1; | |
try { | |
t1 = (worldIn.getTileEntity(pos)); | |
} | |
catch (NullPointerException e) | |
{ | |
return; | |
} | |
if (t1!=null) | |
{ | |
t = (TileEntityBarrel)t1; | |
if (t!=null) | |
{ | |
t.init(c,f); | |
this.updateBarrel((TileEntityBarrel)worldIn.getTileEntity(pos)); | |
} | |
} | |
//worldIn.getTileEntity(pos).init(stack.nbt | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment