mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 02:25:28 +01:00
SPIGOT-5899: Hoglins API similar to Piglins
This commit is contained in:
parent
e09dbecab8
commit
2fe6b4a320
51
nms-patches/EntityHoglin.patch
Normal file
51
nms-patches/EntityHoglin.patch
Normal file
@ -0,0 +1,51 @@
|
||||
--- a/net/minecraft/server/EntityHoglin.java
|
||||
+++ b/net/minecraft/server/EntityHoglin.java
|
||||
@@ -10,10 +10,11 @@
|
||||
|
||||
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityHoglin.class, DataWatcherRegistry.i);
|
||||
private int by;
|
||||
- private int bz = 0;
|
||||
- private boolean bA = false;
|
||||
+ public int bz = 0; // PAIL
|
||||
+ public boolean bA = false; // PAIL
|
||||
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super EntityHoglin>>> bv = ImmutableList.of(SensorType.c, SensorType.d, SensorType.n, SensorType.m);
|
||||
- protected static final ImmutableList<? extends MemoryModuleType<?>> bw = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULY, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED});
|
||||
+ // CraftBukkit - decompile error
|
||||
+ protected static final ImmutableList<? extends MemoryModuleType<?>> bw = ImmutableList.<MemoryModuleType<?>>of(MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULY, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED});
|
||||
|
||||
public EntityHoglin(EntityTypes<? extends EntityHoglin> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -77,13 +78,13 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityHoglin> getBehaviorController() {
|
||||
- return super.getBehaviorController();
|
||||
+ return (BehaviorController<EntityHoglin>) super.getBehaviorController(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mobTick() {
|
||||
this.world.getMethodProfiler().enter("hoglinBrain");
|
||||
- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this);
|
||||
+ this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
|
||||
this.world.getMethodProfiler().exit();
|
||||
HoglinAI.a(this);
|
||||
if (this.eO()) {
|
||||
@@ -216,7 +217,7 @@
|
||||
this.getDataWatcher().set(EntityHoglin.bx, flag);
|
||||
}
|
||||
|
||||
- private boolean eW() {
|
||||
+ public boolean eW() { // PAIL
|
||||
return (Boolean) this.getDataWatcher().get(EntityHoglin.bx);
|
||||
}
|
||||
|
||||
@@ -256,7 +257,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundAmbient() {
|
||||
- return this.world.isClientSide ? null : (SoundEffect) HoglinAI.b(this).orElse((Object) null);
|
||||
+ return this.world.isClientSide ? null : (SoundEffect) HoglinAI.b(this).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.server.EntityHoglin;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -11,6 +12,47 @@ public class CraftHoglin extends CraftAnimals implements Hoglin {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImmuneToZombification() {
|
||||
return getHandle().eW();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setImmuneToZombification(boolean flag) {
|
||||
getHandle().t(flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbleToBeHunted() {
|
||||
return getHandle().bA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsAbleToBeHunted(boolean flag) {
|
||||
getHandle().bA = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConversionTime() {
|
||||
Preconditions.checkState(isConverting(), "Entity not converting");
|
||||
return getHandle().bz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConversionTime(int time) {
|
||||
if (time < 0) {
|
||||
getHandle().bz = -1;
|
||||
getHandle().t(false);
|
||||
} else {
|
||||
getHandle().bz = time;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConverting() {
|
||||
return getHandle().eO(); // PAIL rename isConverting()
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityHoglin getHandle() {
|
||||
return (EntityHoglin) entity;
|
||||
|
Loading…
Reference in New Issue
Block a user