mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
SPIGOT-3696: Clearing custom name of some blocks does not work
This commit is contained in:
parent
04595908e5
commit
45c83860e1
@ -61,4 +61,13 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
|
||||
public void setCustomName(String name) {
|
||||
this.getSnapshot().setCustomName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(TileEntityBrewingStand brewingStand) {
|
||||
super.applyTo(brewingStand);
|
||||
|
||||
if (!this.getSnapshot().hasCustomName()) {
|
||||
brewingStand.setCustomName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,4 +25,13 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
|
||||
public void setCustomName(String name) {
|
||||
this.getSnapshot().setCustomName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(TileEntityEnchantTable enchantingTable) {
|
||||
super.applyTo(enchantingTable);
|
||||
|
||||
if (!this.getSnapshot().hasCustomName()) {
|
||||
enchantingTable.setCustomName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.TileEntityEndGateway;
|
||||
import org.bukkit.Location;
|
||||
@ -27,7 +28,7 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
|
||||
public void setExitLocation(Location location) {
|
||||
if (location == null) {
|
||||
this.getSnapshot().exitPortal = null;
|
||||
} else if (location.getWorld() != (this.isPlaced() ? this.getWorld() : null)) {
|
||||
} else if (!Objects.equals(location.getWorld(), this.isPlaced() ? this.getWorld() : null)) {
|
||||
throw new IllegalArgumentException("Cannot set exit location to different world");
|
||||
} else {
|
||||
this.getSnapshot().exitPortal = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
@ -43,4 +44,13 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
|
||||
public void setExactTeleport(boolean exact) {
|
||||
this.getSnapshot().exactTeleport = exact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(TileEntityEndGateway endGateway) {
|
||||
super.applyTo(endGateway);
|
||||
|
||||
if (this.getSnapshot().exitPortal == null) {
|
||||
endGateway.exitPortal = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,4 +61,13 @@ public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements F
|
||||
public void setCustomName(String name) {
|
||||
this.getSnapshot().setCustomName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(TileEntityFurnace furnace) {
|
||||
super.applyTo(furnace);
|
||||
|
||||
if (!this.getSnapshot().hasCustomName()) {
|
||||
furnace.setCustomName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,4 +25,13 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
|
||||
public void setCustomName(String name) {
|
||||
this.getSnapshot().setCustomName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(T lootable) {
|
||||
super.applyTo(lootable);
|
||||
|
||||
if (!this.getSnapshot().hasCustomName()) {
|
||||
lootable.setCustomName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user