Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
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
|
||||
public boolean update(boolean force, boolean applyPhysics) {
|
||||
boolean result = (isPlaced()) ? super.update(force, applyPhysics) : true;
|
||||
boolean result = super.update(force, applyPhysics);
|
||||
|
||||
if (result) {
|
||||
banner.color = EnumColor.fromInvColorIndex(base.getDyeData());
|
||||
|
@ -151,7 +151,9 @@ public class CraftBlockState implements BlockState {
|
||||
}
|
||||
|
||||
public boolean update(boolean force, boolean applyPhysics) {
|
||||
requirePlaced();
|
||||
if (!isPlaced()) {
|
||||
return true;
|
||||
}
|
||||
Block block = getBlock();
|
||||
|
||||
if (block.getType() != getType()) {
|
||||
|
@ -44,7 +44,7 @@ public class CraftCommandBlock extends CraftBlockState implements CommandBlock {
|
||||
}
|
||||
|
||||
public boolean update(boolean force, boolean applyPhysics) {
|
||||
boolean result = (isPlaced()) ? super.update(force, applyPhysics) : true;
|
||||
boolean result = super.update(force, applyPhysics);
|
||||
|
||||
if (result) {
|
||||
commandBlock.getCommandBlock().setCommand(command);
|
||||
|
@ -4,10 +4,9 @@ import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.TileEntityComparator;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.EnderChest;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
||||
public class CraftComparator extends CraftBlockState implements EnderChest {
|
||||
public class CraftComparator extends CraftBlockState {
|
||||
|
||||
private final CraftWorld world;
|
||||
private final TileEntityComparator comparator;
|
||||
|
@ -4,10 +4,9 @@ import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.TileEntityLightDetector;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.EnderChest;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
||||
public class CraftDaylightDetector extends CraftBlockState implements EnderChest {
|
||||
public class CraftDaylightDetector extends CraftBlockState {
|
||||
|
||||
private final CraftWorld world;
|
||||
private final TileEntityLightDetector detector;
|
||||
|
@ -8,23 +8,25 @@ 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;
|
||||
|
||||
public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
||||
|
||||
private final TileEntityFlowerPot pot;
|
||||
private MaterialData contents;
|
||||
|
||||
public CraftFlowerPot(Block block) {
|
||||
super(block);
|
||||
|
||||
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);
|
||||
|
||||
this.pot = pot;
|
||||
pot = te;
|
||||
contents = (pot.getItem() == null) ? null : CraftItemStack.asBukkitCopy(pot.getContents()).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,15 +36,23 @@ public class CraftFlowerPot extends CraftBlockState implements FlowerPot {
|
||||
|
||||
@Override
|
||||
public MaterialData getContents() {
|
||||
return (pot.d() == null) ? null : CraftMagicNumbers.getMaterial(pot.getItem()).getNewData((byte) pot.getData()); // PAIL: rename
|
||||
return contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContents(MaterialData item) {
|
||||
if (item == null) {
|
||||
pot.setContents(ItemStack.a);
|
||||
} else {
|
||||
pot.setContents(CraftItemStack.asNMSCopy(item.toItemStack()));
|
||||
contents = item;
|
||||
}
|
||||
|
||||
@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