Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
@@ -54,6 +54,18 @@
@@ -56,6 +56,18 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -8,7 +8,7 @@
+import java.util.stream.Collectors;
+import java.util.HashSet;
+import java.util.Set;
+import net.minecraft.core.IRegistry;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.NBTTagString;
+import net.minecraft.nbt.NBTBase;
@@ -19,10 +19,10 @@
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
@@ -74,6 +86,10 @@
@@ -76,6 +88,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.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{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});
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});
+ // CraftBukkit start - Custom bartering and interest list
+ public Set<Item> allowedBarterItems = new HashSet<>();
+ public Set<Item> interestItems = new HashSet<>();
@@ -30,33 +30,33 @@
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
super(entitytypes, world);
@@ -92,6 +108,14 @@
@@ -94,6 +110,14 @@
}
nbttagcompound.put("Inventory", this.inventory.createTag());
this.writeInventoryToTag(nbttagcompound);
+ // CraftBukkit start
+ NBTTagList barterList = new NBTTagList();
+ allowedBarterItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
+ allowedBarterItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
+ nbttagcompound.put("Bukkit.BarterList", barterList);
+ NBTTagList interestList = new NBTTagList();
+ interestItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
+ interestItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
+ nbttagcompound.put("Bukkit.InterestList", interestList);
+ // CraftBukkit end
}
@Override
@@ -100,6 +124,10 @@
@@ -102,6 +126,10 @@
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
this.readInventoryFromTag(nbttagcompound);
+ // CraftBukkit start
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
+ 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));
+ // CraftBukkit end
}
@VisibleForDebug
@@ -206,7 +234,7 @@
@@ -223,7 +251,7 @@
@Override
public BehaviorController<EntityPiglin> getBrain() {
@@ -65,7 +65,7 @@
}
@Override
@@ -349,7 +377,7 @@
@@ -368,7 +396,7 @@
}
protected void holdInOffHand(ItemStack itemstack) {
@@ -74,7 +74,7 @@
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
} else {
@@ -375,8 +403,8 @@
@@ -394,8 +422,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)));
}
@@ -405,7 +433,7 @@
@@ -424,7 +452,7 @@
@Override
protected SoundEffect getAmbientSound() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
@@ -100,7 +100,7 @@
@@ -108,7 +108,7 @@
}
protected void finishConversion(WorldServer worldserver) {
@@ -9,7 +9,7 @@
if (entitypigzombie != null) {
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
@@ -117,7 +117,7 @@
@@ -125,7 +125,7 @@
@Nullable
@Override
public EntityLiving getTarget() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
@@ -71,6 +71,13 @@
@@ -74,6 +74,13 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.Vec3D;
@@ -14,7 +14,26 @@
public class PiglinAI {
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
@@ -186,13 +193,13 @@
@@ -164,7 +171,8 @@
}
private static void initRideHoglinActivity(BehaviorController<EntityPiglin> behaviorcontroller) {
- behaviorcontroller.addActivityAndRemoveMemoryWhenStopped(Activity.RIDE, 10, ImmutableList.of(BehaviorStartRiding.create(0.8F), BehaviorLookTarget.create(PiglinAI::isPlayerHoldingLovedItem, 8.0F), BehaviorBuilder.sequence(BehaviorBuilder.triggerIf(Entity::isPassenger), TriggerGate.triggerOneShuffled(ImmutableList.builder().addAll(createLookBehaviors()).add(Pair.of(BehaviorBuilder.triggerIf((entitypiglin) -> {
+ // CraftBukkit - decompile error
+ behaviorcontroller.addActivityAndRemoveMemoryWhenStopped(Activity.RIDE, 10, ImmutableList.of(BehaviorStartRiding.create(0.8F), BehaviorLookTarget.create(PiglinAI::isPlayerHoldingLovedItem, 8.0F), BehaviorBuilder.sequence(BehaviorBuilder.triggerIf(Entity::isPassenger), TriggerGate.triggerOneShuffled(ImmutableList.<Pair<? extends net.minecraft.world.entity.ai.behavior.declarative.Trigger<? super EntityLiving>, Integer>>builder().addAll(createLookBehaviors()).add(Pair.of(BehaviorBuilder.triggerIf((entitypiglin) -> {
return true;
}), 1)).build())), BehaviorStopRiding.create(8, PiglinAI::wantsToStopRiding)), MemoryModuleType.RIDE_TARGET);
}
@@ -174,7 +182,7 @@
}
private static BehaviorGateSingle<EntityLiving> createIdleLookBehaviors() {
- return new BehaviorGateSingle<>(ImmutableList.builder().addAll(createLookBehaviors()).add(Pair.of(new BehaviorNop(30, 60), 1)).build());
+ return new BehaviorGateSingle<>(ImmutableList.<Pair<? extends BehaviorControl<? super EntityLiving>, Integer>>builder().addAll(createLookBehaviors()).add(Pair.of(new BehaviorNop(30, 60), 1)).build()); // CraftBukkit - decompile error
}
private static BehaviorGateSingle<EntityPiglin> createIdleMovementBehaviors() {
@@ -195,13 +203,13 @@
protected static void updateActivity(EntityPiglin entitypiglin) {
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
@@ -31,7 +50,7 @@
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSoundEvent);
@@ -224,23 +231,27 @@
@@ -233,23 +241,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;
@@ -58,12 +77,12 @@
} else if (isFood(itemstack) && !hasEatenRecently(entitypiglin)) {
eat(entitypiglin);
} else {
- boolean flag = entitypiglin.equipItemIfPossible(itemstack);
+ boolean flag = entitypiglin.equipItemIfPossible(itemstack, entityitem); // CraftBukkit
- boolean flag = !entitypiglin.equipItemIfPossible(itemstack).equals(ItemStack.EMPTY);
+ boolean flag = !entitypiglin.equipItemIfPossible(itemstack, entityitem).equals(ItemStack.EMPTY); // CraftBukkit
if (!flag) {
putInInventory(entitypiglin, itemstack);
@@ -276,9 +287,14 @@
@@ -285,9 +297,14 @@
boolean flag1;
if (entitypiglin.isAdult()) {
@@ -78,9 +97,9 @@
+ }
+ // CraftBukkit end
} else if (!flag1) {
boolean flag2 = entitypiglin.equipItemIfPossible(itemstack);
boolean flag2 = !entitypiglin.equipItemIfPossible(itemstack).isEmpty();
@@ -291,7 +307,7 @@
@@ -300,7 +317,7 @@
if (!flag1) {
ItemStack itemstack1 = entitypiglin.getMainHandItem();
@@ -89,7 +108,7 @@
putInInventory(entitypiglin, itemstack1);
} else {
throwItems(entitypiglin, Collections.singletonList(itemstack1));
@@ -368,7 +384,7 @@
@@ -377,7 +394,7 @@
return false;
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
return false;
@@ -98,7 +117,7 @@
return isNotHoldingLovedItemInOffHand(entitypiglin);
} else {
boolean flag = entitypiglin.canAddToInventory(itemstack);
@@ -377,6 +393,12 @@
@@ -386,6 +403,12 @@
}
}
@@ -111,7 +130,7 @@
protected static boolean isLovedItem(ItemStack itemstack) {
return itemstack.is(TagsItem.PIGLIN_LOVED);
}
@@ -472,7 +494,7 @@
@@ -481,7 +504,7 @@
}
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
@@ -120,7 +139,7 @@
}
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
@@ -739,6 +761,12 @@
@@ -738,6 +761,12 @@
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
}
@@ -133,7 +152,7 @@
private static boolean isBarterCurrency(ItemStack itemstack) {
return itemstack.is(PiglinAI.BARTERING_ITEM);
}
@@ -776,7 +804,7 @@
@@ -775,7 +804,7 @@
}
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {