@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.server.EnumColor;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.NBTTagList;
|
||||
import net.minecraft.server.TileEntityBanner;
|
||||
@@ -25,7 +26,7 @@ public class CraftBanner extends CraftBlockState implements Banner {
|
||||
CraftWorld world = (CraftWorld) block.getWorld();
|
||||
banner = (TileEntityBanner) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
|
||||
base = DyeColor.getByDyeData((byte) banner.color);
|
||||
base = DyeColor.getByDyeData((byte) banner.color.getColorIndex());
|
||||
|
||||
if (banner.patterns != null) {
|
||||
for (int i = 0; i < banner.patterns.size(); i++) {
|
||||
@@ -39,7 +40,7 @@ public class CraftBanner extends CraftBlockState implements Banner {
|
||||
super(material);
|
||||
banner = te;
|
||||
|
||||
base = DyeColor.getByDyeData((byte) banner.color);
|
||||
base = DyeColor.getByDyeData((byte) banner.color.getColorIndex());
|
||||
|
||||
if (banner.patterns != null) {
|
||||
for (int i = 0; i < banner.patterns.size(); i++) {
|
||||
@@ -99,7 +100,7 @@ public class CraftBanner extends CraftBlockState implements Banner {
|
||||
boolean result = (isPlaced()) ? super.update(force, applyPhysics) : true;
|
||||
|
||||
if (result) {
|
||||
banner.color = base.getDyeData();
|
||||
banner.color = EnumColor.fromColorIndex(base.getDyeData());
|
||||
|
||||
NBTTagList newPatterns = new NBTTagList();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CraftBeacon extends CraftContainer implements Beacon {
|
||||
|
||||
@Override
|
||||
public int getTier() {
|
||||
return beacon.k;
|
||||
return beacon.levels;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +76,7 @@ public class CraftBeacon extends CraftContainer implements Beacon {
|
||||
|
||||
@Override
|
||||
public void setPrimaryEffect(PotionEffectType effect) {
|
||||
beacon.l = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
beacon.primaryEffect = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,6 +86,6 @@ public class CraftBeacon extends CraftContainer implements Beacon {
|
||||
|
||||
@Override
|
||||
public void setSecondaryEffect(PotionEffectType effect) {
|
||||
beacon.m = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
beacon.secondaryEffect = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class CraftBlock implements Block {
|
||||
return chunk.getHandle().getWorld().setTypeAndData(position, blockData, 3);
|
||||
} else {
|
||||
IBlockData old = chunk.getHandle().getBlockData(position);
|
||||
boolean success = chunk.getHandle().getWorld().setTypeAndData(position, blockData, 2);
|
||||
boolean success = chunk.getHandle().getWorld().setTypeAndData(position, blockData, 18); // NOTIFY | NO_OBSERVER
|
||||
if (success) {
|
||||
chunk.getHandle().getWorld().notify(
|
||||
position,
|
||||
@@ -173,11 +173,11 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public byte getLightFromSky() {
|
||||
return (byte) chunk.getHandle().getWorld().b(EnumSkyBlock.SKY, new BlockPosition(this.x, this.y, this.z)); // PAIL: rename
|
||||
return (byte) chunk.getHandle().getWorld().getBrightness(EnumSkyBlock.SKY, new BlockPosition(this.x, this.y, this.z));
|
||||
}
|
||||
|
||||
public byte getLightFromBlocks() {
|
||||
return (byte) chunk.getHandle().getWorld().b(EnumSkyBlock.BLOCK, new BlockPosition(this.x, this.y, this.z)); // PAIL: rename
|
||||
return (byte) chunk.getHandle().getWorld().getBrightness(EnumSkyBlock.BLOCK, new BlockPosition(this.x, this.y, this.z));
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +306,23 @@ public class CraftBlock implements Block {
|
||||
return new CraftFlowerPot(this);
|
||||
case STRUCTURE_BLOCK:
|
||||
return new CraftStructureBlock(this);
|
||||
case WHITE_SHULKER_BOX:
|
||||
case ORANGE_SHULKER_BOX:
|
||||
case MAGENTA_SHULKER_BOX:
|
||||
case LIGHT_BLUE_SHULKER_BOX:
|
||||
case YELLOW_SHULKER_BOX:
|
||||
case LIME_SHULKER_BOX:
|
||||
case PINK_SHULKER_BOX:
|
||||
case GRAY_SHULKER_BOX:
|
||||
case SILVER_SHULKER_BOX:
|
||||
case CYAN_SHULKER_BOX:
|
||||
case PURPLE_SHULKER_BOX:
|
||||
case BLUE_SHULKER_BOX:
|
||||
case BROWN_SHULKER_BOX:
|
||||
case GREEN_SHULKER_BOX:
|
||||
case RED_SHULKER_BOX:
|
||||
case BLACK_SHULKER_BOX:
|
||||
return new CraftShulkerBox(this);
|
||||
default:
|
||||
return new CraftBlockState(this);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class CraftBlockState implements BlockState {
|
||||
|
||||
// Update levers etc
|
||||
if (applyPhysics && getData() instanceof Attachable) {
|
||||
world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
|
||||
world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock(), false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -26,12 +26,12 @@ public class CraftContainer extends CraftBlockState implements Lockable {
|
||||
|
||||
@Override
|
||||
public boolean isLocked() {
|
||||
return container.x_(); // PAIL: isLocked
|
||||
return container.isLocked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLock() {
|
||||
return container.y_().b(); // PAIL: getLock, getKey
|
||||
return container.getLock().b(); // PAIL: getKey
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.TileEntityMobSpawner;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
}
|
||||
|
||||
public EntityType getSpawnedType() {
|
||||
return EntityType.fromName(spawner.getSpawner().getMobName());
|
||||
return EntityType.fromName(spawner.getSpawner().getMobName().a());
|
||||
}
|
||||
|
||||
public void setSpawnedType(EntityType entityType) {
|
||||
@@ -31,21 +32,11 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!");
|
||||
}
|
||||
|
||||
spawner.getSpawner().setMobName(entityType.getName());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getCreatureTypeId() {
|
||||
return spawner.getSpawner().getMobName();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setCreatureTypeId(String creatureName) {
|
||||
setCreatureTypeByName(creatureName);
|
||||
spawner.getSpawner().setMobName(new MinecraftKey(entityType.getName()));
|
||||
}
|
||||
|
||||
public String getCreatureTypeName() {
|
||||
return spawner.getSpawner().getMobName();
|
||||
return spawner.getSpawner().getMobName().a();
|
||||
}
|
||||
|
||||
public void setCreatureTypeByName(String creatureType) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.ItemStack;
|
||||
import net.minecraft.server.TileEntityFlowerPot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.FlowerPot;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
@@ -32,9 +34,9 @@ public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
||||
@Override
|
||||
public void setContents(MaterialData item) {
|
||||
if (item == null) {
|
||||
pot.a(null, 0);
|
||||
pot.setContents(ItemStack.a);
|
||||
} else {
|
||||
pot.a(CraftMagicNumbers.getItem(item.getItemType()), item.getData()); // PAIL: rename
|
||||
pot.setContents(CraftItemStack.asNMSCopy(item.toItemStack()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import net.minecraft.server.TileEntityShulkerBox;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class CraftShulkerBox extends CraftContainer implements ShulkerBox {
|
||||
|
||||
private final CraftWorld world;
|
||||
private final TileEntityShulkerBox box;
|
||||
|
||||
public CraftShulkerBox(final Block block) {
|
||||
super(block);
|
||||
|
||||
world = (CraftWorld) block.getWorld();
|
||||
box = (TileEntityShulkerBox) world.getTileEntityAt(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public CraftShulkerBox(final Material material, final TileEntityShulkerBox te) {
|
||||
super(material, te);
|
||||
|
||||
box = te;
|
||||
world = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory(box);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user