|
|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
|
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
|
|
|
|
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
|
|
|
|
@@ -55,6 +55,18 @@
|
|
|
|
|
@@ -54,6 +54,18 @@
|
|
|
|
|
import net.minecraft.world.level.block.Blocks;
|
|
|
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
|
|
|
|
|
|
|
|
@@ -19,7 +19,7 @@
|
|
|
|
|
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
|
|
|
|
|
|
|
|
|
|
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
|
|
|
|
@@ -75,6 +87,10 @@
|
|
|
|
|
@@ -73,6 +85,10 @@
|
|
|
|
|
public boolean cannotHunt;
|
|
|
|
|
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
|
|
|
|
|
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, 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.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, 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});
|
|
|
|
|
@@ -30,10 +30,10 @@
|
|
|
|
|
|
|
|
|
|
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
|
|
|
|
|
super(entitytypes, world);
|
|
|
|
|
@@ -93,6 +109,14 @@
|
|
|
|
|
@@ -91,6 +107,14 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.writeInventoryToTag(nbttagcompound);
|
|
|
|
|
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
|
|
|
|
|
+ // CraftBukkit start
|
|
|
|
|
+ NBTTagList barterList = new NBTTagList();
|
|
|
|
|
+ allowedBarterItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
|
|
|
|
|
@@ -45,10 +45,10 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -101,6 +125,10 @@
|
|
|
|
|
@@ -99,6 +123,10 @@
|
|
|
|
|
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
|
|
|
|
|
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
|
|
|
|
|
this.readInventoryFromTag(nbttagcompound);
|
|
|
|
|
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
|
|
|
|
|
+ // CraftBukkit start
|
|
|
|
|
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
|
|
|
|
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
|
|
|
|
@@ -56,7 +56,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@VisibleForDebug
|
|
|
|
|
@@ -220,7 +248,7 @@
|
|
|
|
|
@@ -216,7 +244,7 @@
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BehaviorController<EntityPiglin> getBrain() {
|
|
|
|
|
@@ -65,7 +65,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -360,7 +388,7 @@
|
|
|
|
|
@@ -349,7 +377,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void holdInOffHand(ItemStack itemstack) {
|
|
|
|
|
@@ -74,7 +74,7 @@
|
|
|
|
|
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
|
|
|
|
|
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
|
|
|
|
} else {
|
|
|
|
|
@@ -386,8 +414,8 @@
|
|
|
|
|
@@ -375,8 +403,8 @@
|
|
|
|
|
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -85,7 +85,7 @@
|
|
|
|
|
|
|
|
|
|
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
|
|
|
|
|
}
|
|
|
|
|
@@ -416,7 +444,7 @@
|
|
|
|
|
@@ -405,7 +433,7 @@
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected SoundEffect getAmbientSound() {
|
|
|
|
|
|