Advertisement
Creepinson

tile entity

Jul 26th, 2017
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. package me.creepinson.meepar.tileentity;
  2.  
  3. import me.creepinson.meepar.block.ModBlocks;
  4. import net.minecraft.block.state.IBlockState;
  5. import net.minecraft.entity.item.EntityMinecartChest;
  6. import net.minecraft.init.Blocks;
  7. import net.minecraft.tileentity.TileEntity;
  8.  
  9. /**
  10. * Created by theo on 7/26/17.
  11. */
  12. public class TileEntityTurret extends TileEntity {
  13.  
  14. public boolean isMultiblockMade(){
  15. IBlockState turretStand = getWorld().getBlockState(pos.up(1));
  16. IBlockState turretTop = getWorld().getBlockState(pos.up(2));
  17.  
  18. if(turretStand == ModBlocks.turretStand.getDefaultState() && turretTop == Blocks.DISPENSER.getDefaultState()) {
  19. return true;
  20. }
  21.  
  22. else {
  23. return false;
  24. }
  25.  
  26. }
  27.  
  28. public void checkMultiBlock(){
  29.  
  30. if(isMultiblockMade()){
  31. getWorld().destroyBlock(pos, false);
  32. getWorld().destroyBlock(pos.up(1), false);
  33. getWorld().destroyBlock(pos.up(2), false);
  34.  
  35. EntityMinecartChest entityTurret = new EntityMinecartChest(getWorld(), pos.getX(), pos.getY(), pos.getZ());
  36.  
  37. getWorld().spawnEntity(entityTurret);
  38.  
  39. }
  40.  
  41. }
  42.  
  43.  
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement