summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nms-patches/BlockShulkerBox.patch9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftChest.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java35
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java9
10 files changed, 86 insertions, 5 deletions
diff --git a/nms-patches/BlockShulkerBox.patch b/nms-patches/BlockShulkerBox.patch
index ef6b04cd..7799d7d9 100644
--- a/nms-patches/BlockShulkerBox.patch
+++ b/nms-patches/BlockShulkerBox.patch
@@ -1,5 +1,14 @@
--- a/net/minecraft/server/BlockShulkerBox.java
+++ b/net/minecraft/server/BlockShulkerBox.java
+@@ -3,7 +3,7 @@
+ public class BlockShulkerBox extends BlockTileEntity {
+
+ public static final BlockStateEnum<EnumDirection> a = BlockStateDirection.of("facing");
+- private final EnumColor b;
++ public final EnumColor b; // PAIL: public, rename
+
+ public BlockShulkerBox(EnumColor enumcolor) {
+ super(Material.STONE, MaterialMapColor.b);
@@ -89,7 +89,32 @@
tileentityshulkerbox.d(entityhuman);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
index 7dc2978e..049bae34 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
@@ -88,4 +88,14 @@ public class CraftBeacon extends CraftContainer implements Beacon {
public void setSecondaryEffect(PotionEffectType effect) {
beacon.secondaryEffect = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
}
+
+ @Override
+ public String getCustomName() {
+ return beacon.hasCustomName() ? beacon.getName() : null;
+ }
+
+ @Override
+ public void setCustomName(String name) {
+ beacon.a(name); // PAIL: setCustomName
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java
index fbebeab0..e8a66359 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java
@@ -59,4 +59,14 @@ public class CraftBrewingStand extends CraftContainer implements BrewingStand {
public void setFuelLevel(int level) {
brewingStand.setProperty(1, level);
}
+
+ @Override
+ public String getCustomName() {
+ return brewingStand.hasCustomName() ? brewingStand.getName() : null;
+ }
+
+ @Override
+ public void setCustomName(String name) {
+ brewingStand.a(name); // PAIL: setCustomName
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index f15c26bc..3de7e14d 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -11,7 +11,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest;
import org.bukkit.inventory.Inventory;
-public class CraftChest extends CraftContainer implements Chest {
+public class CraftChest extends CraftLootable implements Chest {
private final CraftWorld world;
private final TileEntityChest chest;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
index 003381a6..cc0d28f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
@@ -14,7 +14,7 @@ import org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource;
import org.bukkit.inventory.Inventory;
import org.bukkit.projectiles.BlockProjectileSource;
-public class CraftDispenser extends CraftContainer implements Dispenser {
+public class CraftDispenser extends CraftLootable implements Dispenser {
private final CraftWorld world;
private final TileEntityDispenser dispenser;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java
index a29eaf9a..8786d049 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java
@@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory;
-public class CraftDropper extends CraftContainer implements Dropper {
+public class CraftDropper extends CraftLootable implements Dropper {
private final CraftWorld world;
private final TileEntityDropper dropper;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index eb723c80..89b7a029 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -54,6 +54,16 @@ public class CraftFurnace extends CraftContainer implements Furnace {
}
@Override
+ public String getCustomName() {
+ return furnace.hasCustomName() ? furnace.getName() : null;
+ }
+
+ @Override
+ public void setCustomName(String name) {
+ furnace.a(name); // PAIL: setCustomName
+ }
+
+ @Override
public TileEntityFurnace getTileEntity() {
return furnace;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
index f155790d..b7a04bd8 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory;
-public class CraftHopper extends CraftContainer implements Hopper {
+public class CraftHopper extends CraftLootable implements Hopper {
private final TileEntityHopper hopper;
public CraftHopper(final Block block) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
new file mode 100644
index 00000000..6e5ed2da
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
@@ -0,0 +1,35 @@
+package org.bukkit.craftbukkit.block;
+
+import net.minecraft.server.TileEntity;
+import net.minecraft.server.TileEntityLootable;
+import org.bukkit.Material;
+import org.bukkit.Nameable;
+import org.bukkit.block.Block;
+import org.bukkit.craftbukkit.CraftWorld;
+
+public class CraftLootable extends CraftContainer implements Nameable {
+
+ private final TileEntityLootable te;
+
+ public CraftLootable(Block block) {
+ super(block);
+
+ te = (TileEntityLootable) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
+ }
+
+ public CraftLootable(Material material, TileEntity tileEntity) {
+ super(material, tileEntity);
+
+ te = (TileEntityLootable) tileEntity;
+ }
+
+ @Override
+ public String getCustomName() {
+ return te.hasCustomName() ? te.getName() : null;
+ }
+
+ @Override
+ public void setCustomName(String name) {
+ te.a(name); // PAIL: setCustomName
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
index 4ed31831..8a7ce92b 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
@@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.block;
+import net.minecraft.server.BlockShulkerBox;
import net.minecraft.server.TileEntity;
import net.minecraft.server.TileEntityShulkerBox;
+import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.ShulkerBox;
@@ -9,7 +11,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.Inventory;
-public class CraftShulkerBox extends CraftContainer implements ShulkerBox {
+public class CraftShulkerBox extends CraftLootable implements ShulkerBox {
private final CraftWorld world;
private final TileEntityShulkerBox box;
@@ -37,4 +39,9 @@ public class CraftShulkerBox extends CraftContainer implements ShulkerBox {
public Inventory getInventory() {
return new CraftInventory(box);
}
+
+ @Override
+ public DyeColor getColor() {
+ return DyeColor.getByWoolData((byte) ((BlockShulkerBox) box.getBlock()).b.getColorIndex());
+ }
}