Advertisement
Creepinson

code 1

Feb 25th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. package me.creepinson.blocks;
  2.  
  3. import javax.annotation.Nullable;
  4.  
  5. import me.creepinson.entities.TileEntityPedastal_Magic;
  6. import net.minecraft.block.material.Material;
  7. import net.minecraft.block.state.IBlockState;
  8. import net.minecraft.creativetab.CreativeTabs;
  9. import net.minecraft.entity.item.EntityItem;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.init.Items;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.tileentity.TileEntity;
  14. import net.minecraft.util.EnumFacing;
  15. import net.minecraft.util.EnumHand;
  16. import net.minecraft.util.EnumParticleTypes;
  17. import net.minecraft.util.math.BlockPos;
  18. import net.minecraft.util.text.TextComponentTranslation;
  19. import net.minecraft.util.text.TextFormatting;
  20. import net.minecraft.world.World;
  21.  
  22. public class BlockMagicalCore extends ModBlocks {
  23.  
  24. public BlockMagicalCore(Material mat, String name, CreativeTabs tab, float hardness, float resistance, int harvest, String tool) {
  25. super(mat, name, tab, hardness, resistance, harvest, tool);
  26. }
  27. @Override
  28. public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
  29. {
  30.  
  31. worldIn.spawnParticle(EnumParticleTypes.CLOUD, pos.getX(), pos.getY() + 1, pos.getZ(), 0.0D, 0.0D, 0.0D);
  32.  
  33.  
  34.  
  35. if(!worldIn.isRemote){
  36. BlockPos topRight = new BlockPos(hitX - 1, hitY, hitZ - 1);
  37. BlockPos topLeft = new BlockPos(hitX - 1, hitY, hitZ + 1);
  38. BlockPos bottomRight = new BlockPos(hitX + 1, hitY, hitZ - 1);
  39. BlockPos bottomLeft = new BlockPos(hitX + 1, hitY, hitZ + 1);
  40.  
  41. TileEntity te1 = worldIn.getTileEntity(topRight);
  42. TileEntity te2 = worldIn.getTileEntity(topLeft);
  43. TileEntity te3 = worldIn.getTileEntity(bottomRight);
  44. TileEntity te4 = worldIn.getTileEntity(bottomLeft);
  45.  
  46. if(te1 instanceof TileEntityPedastal_Magic && te2 instanceof TileEntityPedastal_Magic && te3 instanceof TileEntityPedastal_Magic && te4 instanceof TileEntityPedastal_Magic){
  47. if(((TileEntityPedastal_Magic) te1).getStack().getItem() == Items.BONE && ((TileEntityPedastal_Magic) te2).getStack().getItem() == Items.BONE && ((TileEntityPedastal_Magic) te3).getStack().getItem() == Items.BONE && ((TileEntityPedastal_Magic) te4).getStack().getItem() == Items.BONE){
  48. EntityItem itemResult1 = new EntityItem(worldIn, pos.getX(), pos.getY() + 2, pos.getZ(), new ItemStack(me.creepinson.handlers.ItemHandler.FireCore, 1));
  49. worldIn.spawnEntityInWorld(itemResult1);
  50.  
  51. }
  52. else{
  53. playerIn.addChatComponentMessage(new TextComponentTranslation(TextFormatting.RED + "Invalid Recipe!"));
  54. }
  55. playerIn.addChatComponentMessage(new TextComponentTranslation(TextFormatting.RED + "No Pedastals Found!"));
  56. }
  57. else{
  58. playerIn.addChatComponentMessage(new TextComponentTranslation(TextFormatting.RED + "World is NOT Remote!"));
  59. }
  60. }
  61.  
  62. return true;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement