13
0
geforkt von Mirrors/Paper

SPIGOT-5803: Implement the missing methods for the Piglin API.

Dieser Commit ist enthalten in:
ceezuns 2020-06-29 09:58:04 +10:00 committet von md_5
Ursprung cf01fd9d7d
Commit 44109b726b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11
2 geänderte Dateien mit 101 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,59 @@
--- a/net/minecraft/server/EntityPiglin.java
+++ b/net/minecraft/server/EntityPiglin.java
@@ -16,9 +16,9 @@
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityPiglin.class, DataWatcherRegistry.i);
private static final UUID by = UUID.fromString("766bfa64-11f3-11ea-8d71-362b9e155667");
private static final AttributeModifier bz = new AttributeModifier(EntityPiglin.by, "Baby speed boost", 0.20000000298023224D, AttributeModifier.Operation.MULTIPLY_BASE);
- private int bA = 0;
+ public int bA = 0; // PAIL private -> public, rename conversionTicks
private final InventorySubcontainer bB = new InventorySubcontainer(8);
- private boolean bC = false;
+ public boolean bC = false; // PAIL private -> public, rename cannotHunt
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> b = ImmutableList.of(SensorType.c, SensorType.d, SensorType.b, SensorType.g, SensorType.e, SensorType.l);
protected static final ImmutableList<MemoryModuleType<?>> c = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTABLE_DOORS, MemoryModuleType.OPENED_DOORS, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEAREST_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_BABY_PIGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMSIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
@@ -157,7 +157,7 @@
@Override
public BehaviorController<EntityPiglin> getBehaviorController() {
- return super.getBehaviorController();
+ return (BehaviorController<EntityPiglin>) super.getBehaviorController(); // CraftBukkit - decompile error
}
@Override
@@ -217,7 +217,7 @@
this.getDataWatcher().set(EntityPiglin.bv, flag);
}
- private boolean eT() {
+ public boolean eT() { // PAIL private -> public, rename isImmuneToZombification
return (Boolean) this.getDataWatcher().get(EntityPiglin.bv);
}
@@ -236,7 +236,7 @@
@Override
protected void mobTick() {
this.world.getMethodProfiler().enter("piglinBrain");
- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this);
+ this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
this.world.getMethodProfiler().exit();
PiglinAI.b(this);
if (this.eO()) {
@@ -268,7 +268,7 @@
@Nullable
@Override
public EntityLiving getGoalTarget() {
- return (EntityLiving) this.bn.getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.bn.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
private ItemStack eU() {
@@ -396,7 +396,7 @@
@Override
protected SoundEffect getSoundAmbient() {
- return this.world.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse((Object) null);
+ return this.world.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse(null); // CraftBukkit - decompile error
}
@Override

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.server.EntityPiglin;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
@ -11,6 +12,47 @@ public class CraftPiglin extends CraftMonster implements Piglin {
super(server, entity);
}
@Override
public boolean isImmuneToZombification() {
return getHandle().eT();
}
@Override
public void setImmuneToZombification(boolean flag) {
getHandle().t(flag);
}
@Override
public boolean isAbleToHunt() {
return getHandle().bC;
}
@Override
public void setIsAbleToHunt(boolean flag) {
getHandle().bC = flag;
}
@Override
public int getConversionTime() {
Preconditions.checkState(isConverting(), "Entity not converting");
return getHandle().bA;
}
@Override
public void setConversionTime(int time) {
if (time < 0) {
getHandle().bA = -1;
getHandle().t(false);
} else {
getHandle().bA = time;
}
}
@Override
public boolean isConverting() {
return getHandle().eO(); // PAIL rename isConverting()
}
@Override
public boolean isBaby() {
return getHandle().isBaby();