@@ -96,6 +96,6 @@ public class CraftBeacon extends CraftContainer implements Beacon {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String name) {
|
||||
beacon.a(name); // PAIL: setCustomName
|
||||
beacon.setCustomName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.server.EnumColor;
|
||||
import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.TileEntityBed;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Bed;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
||||
public class CraftBed extends CraftBlockState implements Bed {
|
||||
|
||||
private final TileEntityBed bed;
|
||||
private DyeColor color;
|
||||
|
||||
public CraftBed(Block block) {
|
||||
super(block);
|
||||
|
||||
bed = (TileEntityBed) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||
color = DyeColor.getByWoolData((byte) bed.a().getColorIndex());
|
||||
}
|
||||
|
||||
public CraftBed(Material material, TileEntityBed te) {
|
||||
super(material);
|
||||
|
||||
bed = te;
|
||||
color = DyeColor.getByWoolData((byte) bed.a().getColorIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DyeColor getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(DyeColor color) {
|
||||
Preconditions.checkArgument(color != null, "color");
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean force, boolean applyPhysics) {
|
||||
boolean result = super.update(force, applyPhysics);
|
||||
|
||||
if (result) {
|
||||
bed.a(EnumColor.fromColorIndex(color.getWoolData()));
|
||||
bed.update();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -333,6 +333,8 @@ public class CraftBlock implements Block {
|
||||
case REDSTONE_COMPARATOR_OFF:
|
||||
case REDSTONE_COMPARATOR_ON:
|
||||
return new CraftComparator(this);
|
||||
case BED_BLOCK:
|
||||
return new CraftBed(this);
|
||||
default:
|
||||
return new CraftBlockState(this);
|
||||
}
|
||||
@@ -351,7 +353,7 @@ public class CraftBlock implements Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Biome.valueOf(BiomeBase.REGISTRY_ID.b(base).a().toUpperCase(java.util.Locale.ENGLISH));
|
||||
return Biome.valueOf(BiomeBase.REGISTRY_ID.b(base).getKey().toUpperCase(java.util.Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static BiomeBase biomeToBiomeBase(Biome bio) {
|
||||
|
||||
@@ -67,6 +67,6 @@ public class CraftBrewingStand extends CraftContainer implements BrewingStand {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String name) {
|
||||
brewingStand.a(name); // PAIL: setCustomName
|
||||
brewingStand.setCustomName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ public class CraftContainer extends CraftBlockState implements Lockable {
|
||||
|
||||
@Override
|
||||
public String getLock() {
|
||||
return container.getLock().b(); // PAIL: getKey
|
||||
return container.getLock().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLock(String key) {
|
||||
container.a(key == null ? ChestLock.a : new ChestLock(key)); // PAIL: setLock
|
||||
container.setLock(key == null ? ChestLock.a : new ChestLock(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
|
||||
public EntityType getSpawnedType() {
|
||||
MinecraftKey key = spawner.getSpawner().getMobName();
|
||||
return (key == null) ? EntityType.PIG : EntityType.fromName(key.a());
|
||||
return (key == null) ? EntityType.PIG : EntityType.fromName(key.getKey());
|
||||
}
|
||||
|
||||
public void setSpawnedType(EntityType entityType) {
|
||||
@@ -37,7 +37,7 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
|
||||
}
|
||||
|
||||
public String getCreatureTypeName() {
|
||||
return spawner.getSpawner().getMobName().a();
|
||||
return spawner.getSpawner().getMobName().getKey();
|
||||
}
|
||||
|
||||
public void setCreatureTypeByName(String creatureType) {
|
||||
|
||||
@@ -38,6 +38,6 @@ public class CraftEnchantingTable extends CraftBlockState implements EnchantingT
|
||||
|
||||
@Override
|
||||
public void setCustomName(String name) {
|
||||
enchant.a(name); // PAIL: setCustomName
|
||||
enchant.setCustomName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CraftFurnace extends CraftContainer implements Furnace {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String name) {
|
||||
furnace.a(name); // PAIL: setCustomName
|
||||
furnace.setCustomName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,6 @@ public class CraftLootable extends CraftContainer implements Nameable {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String name) {
|
||||
te.a(name); // PAIL: setCustomName
|
||||
te.setCustomName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,6 @@ public class CraftShulkerBox extends CraftLootable implements ShulkerBox {
|
||||
|
||||
@Override
|
||||
public DyeColor getColor() {
|
||||
return DyeColor.getByWoolData((byte) ((BlockShulkerBox) box.getBlock()).b.getColorIndex());
|
||||
return DyeColor.getByWoolData((byte) ((BlockShulkerBox) box.getBlock()).color.getColorIndex());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user