Beispiel #1
0
 @Override
 public void onBlockPlacedBy(
     World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
   super.onBlockPlacedBy(world, x, y, z, player, stack);
   int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
   TileEnchanter te = (TileEnchanter) world.getTileEntity(x, y, z);
   switch (heading) {
     case 0:
       te.setFacing((short) 2);
       break;
     case 1:
       te.setFacing((short) 5);
       break;
     case 2:
       te.setFacing((short) 3);
       break;
     case 3:
       te.setFacing((short) 4);
       break;
     default:
       break;
   }
   if (world.isRemote) {
     return;
   }
   world.markBlockForUpdate(x, y, z);
 }
  @Override
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
    super.onBlockPlacedBy(world, x, y, z, player, stack);

    if (stack.stackTagCompound != null) {
      TileEntity te = world.getTileEntity(x, y, z);
      if (te instanceof TileWirelessCharger) {
        ((TileWirelessCharger) te).readCustomNBT(stack.stackTagCompound);
      }
    }
  }
Beispiel #3
0
 @Override
 protected void init() {
   super.init();
   EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_ENCHANTER, this);
 }
Beispiel #4
0
 public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_) {
   super.breakBlock(world, x, y, z, block, p_149749_6_);
   world.removeTileEntity(x, y, z);
 }