geforkt von Mirrors/Paper
SPIGOT-6992: Add LimitedLife/LifeTicks/Bound APIs to Vex
By: Doc <nachito94@msn.com>
Dieser Commit ist enthalten in:
Ursprung
94eb19b9fc
Commit
ed0354be30
@ -1,5 +1,16 @@
|
|||||||
--- a/net/minecraft/world/entity/monster/EntityVex.java
|
--- a/net/minecraft/world/entity/monster/EntityVex.java
|
||||||
+++ b/net/minecraft/world/entity/monster/EntityVex.java
|
+++ b/net/minecraft/world/entity/monster/EntityVex.java
|
||||||
|
@@ -49,8 +49,8 @@
|
||||||
|
EntityInsentient owner;
|
||||||
|
@Nullable
|
||||||
|
private BlockPosition boundOrigin;
|
||||||
|
- private boolean hasLimitedLife;
|
||||||
|
- private int limitedLifeTicks;
|
||||||
|
+ public boolean hasLimitedLife; // CraftBukkit - PAIL, private -> public
|
||||||
|
+ public int limitedLifeTicks; // CraftBukkit - PAIL, private -> public
|
||||||
|
|
||||||
|
public EntityVex(EntityTypes<? extends EntityVex> entitytypes, World world) {
|
||||||
|
super(entitytypes, world);
|
||||||
@@ -368,7 +368,7 @@
|
@@ -368,7 +368,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import net.minecraft.core.BlockPosition;
|
||||||
import net.minecraft.world.entity.monster.EntityVex;
|
import net.minecraft.world.entity.monster.EntityVex;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Vex;
|
import org.bukkit.entity.Vex;
|
||||||
@ -35,4 +38,38 @@ public class CraftVex extends CraftMonster implements Vex {
|
|||||||
public void setCharging(boolean charging) {
|
public void setCharging(boolean charging) {
|
||||||
getHandle().setIsCharging(charging);
|
getHandle().setIsCharging(charging);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getBound() {
|
||||||
|
BlockPosition blockPosition = getHandle().getBoundOrigin();
|
||||||
|
return (blockPosition == null) ? null : new Location(getWorld(), blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBound(Location location) {
|
||||||
|
if (location == null) {
|
||||||
|
getHandle().setBoundOrigin(null);
|
||||||
|
} else {
|
||||||
|
Preconditions.checkArgument(getWorld().equals(location.getWorld()), "The bound world cannot be different to the entity's world.");
|
||||||
|
getHandle().setBoundOrigin(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLifeTicks() {
|
||||||
|
return getHandle().limitedLifeTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLifeTicks(int lifeTicks) {
|
||||||
|
getHandle().setLimitedLife(lifeTicks);
|
||||||
|
if (lifeTicks < 0) {
|
||||||
|
getHandle().hasLimitedLife = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasLimitedLife() {
|
||||||
|
return getHandle().hasLimitedLife;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren