Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Implement EndGateway#getExitLocation and EndGateway#setExitLocation(Location)
Dieser Commit ist enthalten in:
Ursprung
da444904c2
Commit
205982588f
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/server/TileEntityEndGateway.java
|
--- a/net/minecraft/server/TileEntityEndGateway.java
|
||||||
+++ b/net/minecraft/server/TileEntityEndGateway.java
|
+++ b/net/minecraft/server/TileEntityEndGateway.java
|
||||||
@@ -5,6 +5,10 @@
|
@@ -5,13 +5,17 @@
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -11,6 +11,14 @@
|
|||||||
|
|
||||||
public class TileEntityEndGateway extends TileEntity implements ITickable {
|
public class TileEntityEndGateway extends TileEntity implements ITickable {
|
||||||
|
|
||||||
|
private static final Logger a = LogManager.getLogger();
|
||||||
|
private long f = 0L;
|
||||||
|
private int g = 0;
|
||||||
|
- private BlockPosition h;
|
||||||
|
+ public BlockPosition h; // PAIL private to public
|
||||||
|
private boolean i;
|
||||||
|
|
||||||
|
public TileEntityEndGateway() {}
|
||||||
@@ -103,6 +107,26 @@
|
@@ -103,6 +107,26 @@
|
||||||
if (this.h != null) {
|
if (this.h != null) {
|
||||||
BlockPosition blockposition = this.i ? this.h : this.j();
|
BlockPosition blockposition = this.i ? this.h : this.j();
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.bukkit.craftbukkit.block;
|
package org.bukkit.craftbukkit.block;
|
||||||
|
|
||||||
|
import net.minecraft.server.BlockPosition;
|
||||||
import net.minecraft.server.TileEntityEndGateway;
|
import net.minecraft.server.TileEntityEndGateway;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.EndGateway;
|
import org.bukkit.block.EndGateway;
|
||||||
@ -8,20 +10,39 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|||||||
|
|
||||||
public class CraftEndGateway extends CraftBlockState implements EndGateway {
|
public class CraftEndGateway extends CraftBlockState implements EndGateway {
|
||||||
|
|
||||||
private TileEntityEndGateway gateway;
|
private final CraftWorld world;
|
||||||
|
private final TileEntityEndGateway gateway;
|
||||||
|
|
||||||
public CraftEndGateway(Block block) {
|
public CraftEndGateway(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
||||||
CraftWorld world = (CraftWorld) block.getWorld();
|
world = (CraftWorld) block.getWorld();
|
||||||
gateway = (TileEntityEndGateway) world.getTileEntityAt(getX(), getY(), getZ());
|
gateway = (TileEntityEndGateway) world.getTileEntityAt(getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CraftEndGateway(final Material material, TileEntityEndGateway te) {
|
public CraftEndGateway(final Material material, TileEntityEndGateway te) {
|
||||||
super(material);
|
super(material);
|
||||||
|
world = null;
|
||||||
this.gateway = te;
|
this.gateway = te;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getExitLocation() {
|
||||||
|
BlockPosition pos = gateway.h; // PAIL: Rename exitLocation
|
||||||
|
return pos == null ? null : new Location(world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setExitLocation(Location location) {
|
||||||
|
if (location == null) {
|
||||||
|
gateway.h = null;
|
||||||
|
} else if (location.getWorld() != world) {
|
||||||
|
throw new IllegalArgumentException("Cannot set exit location to different world");
|
||||||
|
} else {
|
||||||
|
gateway.h = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean update(boolean force, boolean applyPhysics) {
|
public boolean update(boolean force, boolean applyPhysics) {
|
||||||
boolean result = super.update(force, applyPhysics);
|
boolean result = super.update(force, applyPhysics);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren