public static void saveBasicInfoNBT(INPC entity, NBTTagCompound nbttagcompound) { try { nbttagcompound.setBoolean("damageable", entity.isDamageable()); nbttagcompound.setBoolean("gravity", entity.isGravity()); nbttagcompound.setBoolean("freezing", entity.isFreezing()); } catch (Exception e) { e.printStackTrace(); } }
public static void restoreBasicInfoNBT(INPC entity, NBTTagCompound nbttagcompound) { try { entity.setDamageable(nbttagcompound.getBoolean("damageable")); entity.setGravity(nbttagcompound.getBoolean("gravity")); entity.setFreezing(nbttagcompound.getBoolean("freezing")); } catch (Exception e) { e.printStackTrace(); } }
void applyToItem(NBTTagCompound itemTag) { super.applyToItem(itemTag); if (hasEffect()) { itemTag.set(EXPLOSION.NBT, CraftMetaFirework.getExplosion(this.effect)); } }
CraftMetaCharge(NBTTagCompound tag) { super(tag); if (tag.hasKey(EXPLOSION.NBT)) { this.effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT)); } }
/** Sets the spawner to the mob passed */ public static boolean setSpawnerEntityData(Block block, String key, Object obj) { if (block.getType() != Material.MOB_SPAWNER) return false; if (getVersion() == -1) return false; int v = getVersion(); if (v == 0) { net.minecraft.server.v1_8_R1.TileEntity te = ((org.bukkit.craftbukkit.v1_8_R1.CraftWorld) block.getWorld()) .getHandle() .getTileEntity( new net.minecraft.server.v1_8_R1.BlockPosition( block.getX(), block.getY(), block.getZ())); if (te instanceof net.minecraft.server.v1_8_R1.TileEntityMobSpawner) { net.minecraft.server.v1_8_R1.TileEntityMobSpawner tems = (net.minecraft.server.v1_8_R1.TileEntityMobSpawner) te; net.minecraft.server.v1_8_R1.NBTTagCompound c2 = new net.minecraft.server.v1_8_R1.NBTTagCompound(); tems.b(c2); net.minecraft.server.v1_8_R1.NBTTagCompound c = c2.getCompound("SpawnData"); if (c == null) c = new net.minecraft.server.v1_8_R1.NBTTagCompound(); if (obj instanceof Boolean) c.setBoolean(key, (boolean) obj); else if (obj instanceof Integer) c.setInt(key, (int) obj); else if (obj instanceof String) c.setString(key, (String) obj); else if (obj instanceof Byte) c.setByte(key, (byte) obj); else if (obj instanceof Float) c.setFloat(key, (float) obj); c2.set("SpawnData", c); tems.a(c2); } } else if (v == 1) { net.minecraft.server.v1_8_R2.TileEntity te = ((org.bukkit.craftbukkit.v1_8_R2.CraftWorld) block.getWorld()) .getHandle() .getTileEntity( new net.minecraft.server.v1_8_R2.BlockPosition( block.getX(), block.getY(), block.getZ())); if (te instanceof net.minecraft.server.v1_8_R2.TileEntityMobSpawner) { net.minecraft.server.v1_8_R2.TileEntityMobSpawner tems = (net.minecraft.server.v1_8_R2.TileEntityMobSpawner) te; net.minecraft.server.v1_8_R2.NBTTagCompound c2 = new net.minecraft.server.v1_8_R2.NBTTagCompound(); tems.b(c2); net.minecraft.server.v1_8_R2.NBTTagCompound c = c2.getCompound("SpawnData"); if (c == null) c = new net.minecraft.server.v1_8_R2.NBTTagCompound(); if (obj instanceof Boolean) c.setBoolean(key, (boolean) obj); else if (obj instanceof Integer) c.setInt(key, (int) obj); else if (obj instanceof String) c.setString(key, (String) obj); else if (obj instanceof Byte) c.setByte(key, (byte) obj); else if (obj instanceof Float) c.setFloat(key, (float) obj); c2.set("SpawnData", c); tems.a(c2); } } else if (v == 2) { net.minecraft.server.v1_8_R3.TileEntity te = ((org.bukkit.craftbukkit.v1_8_R3.CraftWorld) block.getWorld()) .getHandle() .getTileEntity( new net.minecraft.server.v1_8_R3.BlockPosition( block.getX(), block.getY(), block.getZ())); if (te instanceof net.minecraft.server.v1_8_R3.TileEntityMobSpawner) { net.minecraft.server.v1_8_R3.TileEntityMobSpawner tems = (net.minecraft.server.v1_8_R3.TileEntityMobSpawner) te; net.minecraft.server.v1_8_R3.NBTTagCompound c2 = new net.minecraft.server.v1_8_R3.NBTTagCompound(); tems.b(c2); net.minecraft.server.v1_8_R3.NBTTagCompound c = c2.getCompound("SpawnData"); if (c == null) c = new net.minecraft.server.v1_8_R3.NBTTagCompound(); if (obj instanceof Boolean) c.setBoolean(key, (boolean) obj); else if (obj instanceof Integer) c.setInt(key, (int) obj); else if (obj instanceof String) c.setString(key, (String) obj); else if (obj instanceof Byte) c.setByte(key, (byte) obj); else if (obj instanceof Float) c.setFloat(key, (float) obj); c2.set("SpawnData", c); tems.a(c2); } } else if (v == 3) { net.minecraft.server.v1_9_R1.TileEntity te = ((org.bukkit.craftbukkit.v1_9_R1.CraftWorld) block.getWorld()) .getHandle() .getTileEntity( new net.minecraft.server.v1_9_R1.BlockPosition( block.getX(), block.getY(), block.getZ())); if (te instanceof net.minecraft.server.v1_9_R1.TileEntityMobSpawner) { net.minecraft.server.v1_9_R1.TileEntityMobSpawner tems = (net.minecraft.server.v1_9_R1.TileEntityMobSpawner) te; net.minecraft.server.v1_9_R1.NBTTagCompound c2 = new net.minecraft.server.v1_9_R1.NBTTagCompound(); tems.save(c2); net.minecraft.server.v1_9_R1.NBTTagCompound c = c2.getCompound("SpawnData"); if (c == null) c = new net.minecraft.server.v1_9_R1.NBTTagCompound(); if (obj instanceof Boolean) c.setBoolean(key, (boolean) obj); else if (obj instanceof Integer) c.setInt(key, (int) obj); else if (obj instanceof String) c.setString(key, (String) obj); else if (obj instanceof Byte) c.setByte(key, (byte) obj); else if (obj instanceof Float) c.setFloat(key, (float) obj); c2.set("SpawnData", c); tems.a(c2); } } else if (v == 4) { net.minecraft.server.v1_9_R2.TileEntity te = ((org.bukkit.craftbukkit.v1_9_R2.CraftWorld) block.getWorld()) .getHandle() .getTileEntity( new net.minecraft.server.v1_9_R2.BlockPosition( block.getX(), block.getY(), block.getZ())); if (te instanceof net.minecraft.server.v1_9_R2.TileEntityMobSpawner) { net.minecraft.server.v1_9_R2.TileEntityMobSpawner tems = (net.minecraft.server.v1_9_R2.TileEntityMobSpawner) te; net.minecraft.server.v1_9_R2.NBTTagCompound c2 = new net.minecraft.server.v1_9_R2.NBTTagCompound(); tems.save(c2); net.minecraft.server.v1_9_R2.NBTTagCompound c = c2.getCompound("SpawnData"); if (c == null) c = new net.minecraft.server.v1_9_R2.NBTTagCompound(); if (obj instanceof Boolean) c.setBoolean(key, (boolean) obj); else if (obj instanceof Integer) c.setInt(key, (int) obj); else if (obj instanceof String) c.setString(key, (String) obj); else if (obj instanceof Byte) c.setByte(key, (byte) obj); else if (obj instanceof Float) c.setFloat(key, (float) obj); c2.set("SpawnData", c); tems.a(c2); } } else if (v == 5) { net.minecraft.server.v1_10_R1.TileEntity te = ((org.bukkit.craftbukkit.v1_10_R1.CraftWorld) block.getWorld()) .getHandle() .getTileEntity( new net.minecraft.server.v1_10_R1.BlockPosition( block.getX(), block.getY(), block.getZ())); if (te instanceof net.minecraft.server.v1_10_R1.TileEntityMobSpawner) { net.minecraft.server.v1_10_R1.TileEntityMobSpawner tems = (net.minecraft.server.v1_10_R1.TileEntityMobSpawner) te; net.minecraft.server.v1_10_R1.NBTTagCompound c2 = new net.minecraft.server.v1_10_R1.NBTTagCompound(); tems.save(c2); net.minecraft.server.v1_10_R1.NBTTagCompound c = c2.getCompound("SpawnData"); if (c == null) c = new net.minecraft.server.v1_10_R1.NBTTagCompound(); if (obj instanceof Boolean) c.setBoolean(key, (boolean) obj); else if (obj instanceof Integer) c.setInt(key, (int) obj); else if (obj instanceof String) c.setString(key, (String) obj); else if (obj instanceof Byte) c.setByte(key, (byte) obj); else if (obj instanceof Float) c.setFloat(key, (float) obj); c2.set("SpawnData", c); tems.a(c2); } } else return false; return true; }