geforkt von Mirrors/Paper
Fix some blockstate consistency issues.
Dieser Commit ist enthalten in:
Ursprung
1ac133ecc5
Commit
ac405c3cd4
@ -97,7 +97,7 @@ public class CraftBanner extends CraftBlockState implements Banner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean update(boolean force, boolean applyPhysics) {
|
public boolean update(boolean force, boolean applyPhysics) {
|
||||||
boolean result = (isPlaced()) ? super.update(force, applyPhysics) : true;
|
boolean result = super.update(force, applyPhysics);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
banner.color = EnumColor.fromInvColorIndex(base.getDyeData());
|
banner.color = EnumColor.fromInvColorIndex(base.getDyeData());
|
||||||
|
@ -151,7 +151,9 @@ public class CraftBlockState implements BlockState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(boolean force, boolean applyPhysics) {
|
public boolean update(boolean force, boolean applyPhysics) {
|
||||||
requirePlaced();
|
if (!isPlaced()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Block block = getBlock();
|
Block block = getBlock();
|
||||||
|
|
||||||
if (block.getType() != getType()) {
|
if (block.getType() != getType()) {
|
||||||
|
@ -44,7 +44,7 @@ public class CraftCommandBlock extends CraftBlockState implements CommandBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(boolean force, boolean applyPhysics) {
|
public boolean update(boolean force, boolean applyPhysics) {
|
||||||
boolean result = (isPlaced()) ? super.update(force, applyPhysics) : true;
|
boolean result = super.update(force, applyPhysics);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
commandBlock.getCommandBlock().setCommand(command);
|
commandBlock.getCommandBlock().setCommand(command);
|
||||||
|
@ -4,10 +4,9 @@ import net.minecraft.server.TileEntity;
|
|||||||
import net.minecraft.server.TileEntityComparator;
|
import net.minecraft.server.TileEntityComparator;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.EnderChest;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
|
||||||
public class CraftComparator extends CraftBlockState implements EnderChest {
|
public class CraftComparator extends CraftBlockState {
|
||||||
|
|
||||||
private final CraftWorld world;
|
private final CraftWorld world;
|
||||||
private final TileEntityComparator comparator;
|
private final TileEntityComparator comparator;
|
||||||
|
@ -4,10 +4,9 @@ import net.minecraft.server.TileEntity;
|
|||||||
import net.minecraft.server.TileEntityLightDetector;
|
import net.minecraft.server.TileEntityLightDetector;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.EnderChest;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
|
||||||
public class CraftDaylightDetector extends CraftBlockState implements EnderChest {
|
public class CraftDaylightDetector extends CraftBlockState {
|
||||||
|
|
||||||
private final CraftWorld world;
|
private final CraftWorld world;
|
||||||
private final TileEntityLightDetector detector;
|
private final TileEntityLightDetector detector;
|
||||||
|
@ -8,23 +8,25 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.FlowerPot;
|
import org.bukkit.block.FlowerPot;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
||||||
|
|
||||||
private final TileEntityFlowerPot pot;
|
private final TileEntityFlowerPot pot;
|
||||||
|
private MaterialData contents;
|
||||||
|
|
||||||
public CraftFlowerPot(Block block) {
|
public CraftFlowerPot(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
||||||
pot = (TileEntityFlowerPot) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
pot = (TileEntityFlowerPot) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ());
|
||||||
|
contents = (pot.getItem() == null) ? null : CraftItemStack.asBukkitCopy(pot.getContents()).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CraftFlowerPot(Material material, TileEntityFlowerPot pot) {
|
public CraftFlowerPot(Material material, TileEntityFlowerPot te) {
|
||||||
super(material);
|
super(material);
|
||||||
|
|
||||||
this.pot = pot;
|
pot = te;
|
||||||
|
contents = (pot.getItem() == null) ? null : CraftItemStack.asBukkitCopy(pot.getContents()).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,15 +36,23 @@ public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialData getContents() {
|
public MaterialData getContents() {
|
||||||
return (pot.d() == null) ? null : CraftMagicNumbers.getMaterial(pot.getItem()).getNewData((byte) pot.getData()); // PAIL: rename
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContents(MaterialData item) {
|
public void setContents(MaterialData item) {
|
||||||
if (item == null) {
|
contents = item;
|
||||||
pot.setContents(ItemStack.a);
|
|
||||||
} else {
|
|
||||||
pot.setContents(CraftItemStack.asNMSCopy(item.toItemStack()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean update(boolean force, boolean applyPhysics) {
|
||||||
|
boolean result = super.update(force, applyPhysics);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
pot.setContents(contents == null ? ItemStack.a : CraftItemStack.asNMSCopy(contents.toItemStack(1)));
|
||||||
|
pot.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren