apply minecraft feature patches

This commit is contained in:
granny
2026-03-24 01:25:28 -07:00
parent 2b97f2764b
commit 465f4d86be
21 changed files with 1777 additions and 1782 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,216 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 23 May 2019 21:50:37 -0500
Subject: [PATCH] Barrels and enderchests 6 rows
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index c91b960c1cc087c424e6d17ad8f53a1f4cc354c3..9ed2866992573347548be47d1980a810e50dc653 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -888,6 +888,27 @@ public abstract class PlayerList {
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player);
} // Paper - Add sendOpLevel API
+
+ // Purpur start - Barrels and enderchests 6 rows
+ if (org.purpurmc.purpur.PurpurConfig.enderChestSixRows && org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkit = player.getBukkitEntity();
+ if (bukkit.hasPermission("purpur.enderchest.rows.six")) {
+ player.sixRowEnderchestSlotCount = 54;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.five")) {
+ player.sixRowEnderchestSlotCount = 45;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.four")) {
+ player.sixRowEnderchestSlotCount = 36;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.three")) {
+ player.sixRowEnderchestSlotCount = 27;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.two")) {
+ player.sixRowEnderchestSlotCount = 18;
+ } else if (bukkit.hasPermission("purpur.enderchest.rows.one")) {
+ player.sixRowEnderchestSlotCount = 9;
+ }
+ } else {
+ player.sixRowEnderchestSlotCount = -1;
+ }
+ // Purpur end - Barrels and enderchests 6 rows
}
// Paper start - whitelist verify event / login event
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index d4b7f1a861e67a00f7d8022b8198e04c1d279393..0f671feacee9827312cd04c158bf1e69c0f0273f 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -176,6 +176,7 @@ public abstract class Player extends Avatar implements ContainerUser {
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
public int burpDelay = 0; // Purpur - Burp delay
public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
+ public int sixRowEnderchestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows
// CraftBukkit start
public boolean fauxSleeping;
diff --git a/net/minecraft/world/inventory/ChestMenu.java b/net/minecraft/world/inventory/ChestMenu.java
index e77bfcd31cdcfd5836dc5db561e3fe2bc552a4b1..afa2ead0548766669201526d83f351c227c97e87 100644
--- a/net/minecraft/world/inventory/ChestMenu.java
+++ b/net/minecraft/world/inventory/ChestMenu.java
@@ -66,10 +66,30 @@ public class ChestMenu extends AbstractContainerMenu {
return new ChestMenu(MenuType.GENERIC_9x6, containerId, inventory, 6);
}
+ // Purpur start - Barrels and enderchests 6 rows
+ public static ChestMenu oneRow(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x1, syncId, playerInventory, inventory, 1);
+ }
+
+ public static ChestMenu twoRows(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x2, syncId, playerInventory, inventory, 2);
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
public static ChestMenu threeRows(final int containerId, final Inventory inventory, final Container container) {
return new ChestMenu(MenuType.GENERIC_9x3, containerId, inventory, container, 3);
}
+ // Purpur start - Barrels and enderchests 6 rows
+ public static ChestMenu fourRows(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x4, syncId, playerInventory, inventory, 4);
+ }
+
+ public static ChestMenu fiveRows(int syncId, Inventory playerInventory, Container inventory) {
+ return new ChestMenu(MenuType.GENERIC_9x5, syncId, playerInventory, inventory, 5);
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
public static ChestMenu sixRows(final int containerId, final Inventory inventory, final Container container) {
return new ChestMenu(MenuType.GENERIC_9x6, containerId, inventory, container, 6);
}
diff --git a/net/minecraft/world/inventory/PlayerEnderChestContainer.java b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
index 4df3a32faf85595372f4b250482d852c985ea3ab..8347150af55119d772b797e79be412f7e17a0f1f 100644
--- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java
+++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
@@ -26,11 +26,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
}
public PlayerEnderChestContainer(Player owner) {
- super(27);
+ super(org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? 54 : 27); // Purpur - Barrels and enderchests 6 rows
this.owner = owner;
// CraftBukkit end
}
+ // Purpur start - Barrels and enderchests 6 rows
+ @Override
+ public int getContainerSize() {
+ return owner == null || owner.sixRowEnderchestSlotCount < 0 ? super.getContainerSize() : owner.sixRowEnderchestSlotCount;
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
public void setActiveChest(final EnderChestBlockEntity activeChest) {
this.activeChest = activeChest;
}
diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java
index 24a2c411da0ebbb7f97d621bb76ff686621f9aae..7ba9e8f6414246b589ff423fac63f80505326505 100644
--- a/net/minecraft/world/level/block/EnderChestBlock.java
+++ b/net/minecraft/world/level/block/EnderChestBlock.java
@@ -88,7 +88,7 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
// Paper start - Fix InventoryOpenEvent cancellation - moved up;
container.setActiveChest(enderChest); // Needs to happen before ChestMenu.threeRows as it is required for opening animations
if (level instanceof ServerLevel serverLevel && player.openMenu(
- new SimpleMenuProvider((containerId, inventory, p) -> ChestMenu.threeRows(containerId, inventory, container), CONTAINER_TITLE)
+ new SimpleMenuProvider((containerId, inventory, p) -> org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? getEnderChestSixRows(containerId, inventory, player, container) : ChestMenu.threeRows(containerId, inventory, container), CONTAINER_TITLE) // Purpur - Barrels and enderchests 6 rows
).isPresent()) {
// Paper end - Fix InventoryOpenEvent cancellation - moved up;
player.awardStat(Stats.OPEN_ENDERCHEST);
@@ -102,6 +102,35 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
}
}
+ // Purpur start - Barrels and enderchests 6 rows
+ private ChestMenu getEnderChestSixRows(int syncId, net.minecraft.world.entity.player.Inventory inventory, Player player, PlayerEnderChestContainer playerEnderChestContainer) {
+ if (org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkitPlayer = player.getBukkitEntity();
+ if (bukkitPlayer.hasPermission("purpur.enderchest.rows.six")) {
+ player.sixRowEnderchestSlotCount = 54;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.five")) {
+ player.sixRowEnderchestSlotCount = 45;
+ return ChestMenu.fiveRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.four")) {
+ player.sixRowEnderchestSlotCount = 36;
+ return ChestMenu.fourRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.three")) {
+ player.sixRowEnderchestSlotCount = 27;
+ return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.two")) {
+ player.sixRowEnderchestSlotCount = 18;
+ return ChestMenu.twoRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.one")) {
+ player.sixRowEnderchestSlotCount = 9;
+ return ChestMenu.oneRow(syncId, inventory, playerEnderChestContainer);
+ }
+ }
+ player.sixRowEnderchestSlotCount = -1;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ }
+ // Purpur end - Barrels and enderchests 6 rows
+
@Override
public BlockEntity newBlockEntity(final BlockPos worldPosition, final BlockState blockState) {
return new EnderChestBlockEntity(worldPosition, blockState);
diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
index 9eb6cb86ff70f04863cae3def1006f82bcb4fa6b..79ca37b3e4ed98139b8adbdccd39d597315c7f99 100644
--- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
@@ -60,7 +60,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
}
// CraftBukkit end
private static final Component DEFAULT_NAME = Component.translatable("container.barrel");
- private NonNullList<ItemStack> items = NonNullList.withSize(27, ItemStack.EMPTY);
+ // Purpur start - Barrels and enderchests 6 rows
+ private NonNullList<ItemStack> items = NonNullList.withSize(switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
+ case 6 -> 54;
+ case 5 -> 45;
+ case 4 -> 36;
+ case 2 -> 18;
+ case 1 -> 9;
+ default -> 27;
+ }, ItemStack.EMPTY);
+ // Purpur end - Barrels and enderchests 6 rows
public final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() {
{
Objects.requireNonNull(BarrelBlockEntity.this);
@@ -116,7 +125,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override
public int getContainerSize() {
- return 27;
+ // Purpur start - Barrels and enderchests 6 rows
+ return switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
+ case 6 -> 54;
+ case 5 -> 45;
+ case 4 -> 36;
+ case 2 -> 18;
+ case 1 -> 9;
+ default -> 27;
+ };
+ // Purpur end - Barrels and enderchests 6 rows
}
@Override
@@ -136,7 +154,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override
protected AbstractContainerMenu createMenu(final int containerId, final Inventory inventory) {
- return ChestMenu.threeRows(containerId, inventory, this);
+ // Purpur start - Barrels and enderchests 6 rows
+ return switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
+ case 6 -> ChestMenu.sixRows(containerId, inventory, this);
+ case 5 -> ChestMenu.fiveRows(containerId, inventory, this);
+ case 4 -> ChestMenu.fourRows(containerId, inventory, this);
+ case 2 -> ChestMenu.twoRows(containerId, inventory, this);
+ case 1 -> ChestMenu.oneRow(containerId, inventory, this);
+ default -> ChestMenu.threeRows(containerId, inventory, this);
+ };
+ // Purpur end - Barrels and enderchests 6 rows
}
@Override

View File

@@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 12 May 2019 00:43:12 -0500
Subject: [PATCH] Giants AI settings
diff --git a/net/minecraft/world/entity/monster/Giant.java b/net/minecraft/world/entity/monster/Giant.java
index 7b6952f13e18548d0e71035d6cd6cfb24c03e6ee..c39031e8fdfb0dff7867d9525dbddde110242647 100644
--- a/net/minecraft/world/entity/monster/Giant.java
+++ b/net/minecraft/world/entity/monster/Giant.java
@@ -30,8 +30,25 @@ public class Giant extends Monster {
@Override
protected void registerGoals() {
- this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
- this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
+ // Purpur start - Giants AI settings
+ if (level().purpurConfig.giantHaveAI) {
+ this.goalSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.FloatGoal(this));
+ this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
+ this.goalSelector.addGoal(7, new net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal(this, 1.0D));
+ this.goalSelector.addGoal(8, new net.minecraft.world.entity.ai.goal.LookAtPlayerGoal(this, net.minecraft.world.entity.player.Player.class, 16.0F));
+ this.goalSelector.addGoal(8, new net.minecraft.world.entity.ai.goal.RandomLookAroundGoal(this));
+ this.goalSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal(this, 1.0D));
+ if (level().purpurConfig.giantHaveHostileAI) {
+ this.goalSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.0D, false));
+ this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
+ this.targetSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal(this).setAlertOthers(net.minecraft.world.entity.monster.zombie.ZombifiedPiglin.class));
+ this.targetSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.player.Player.class, true));
+ this.targetSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.npc.villager.Villager.class, false));
+ this.targetSelector.addGoal(4, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.golem.IronGolem.class, true));
+ this.targetSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.turtle.Turtle.class, true));
+ }
+ }
+ // Purpur end - Giants AI settings
}
// Purpur end - Ridables
@@ -53,8 +70,36 @@ public class Giant extends Monster {
.add(Attributes.CAMERA_DISTANCE, 16.0);
}
+ // Purpur - Giants AI settings
+ @Override
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
+ net.minecraft.world.entity.SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
+ if (groupData == null) {
+ populateDefaultEquipmentSlots(this.random, difficulty);
+ populateDefaultEquipmentEnchantments(world, this.random, difficulty);
+ }
+ return groupData;
+ }
+
+ @Override
+ protected void populateDefaultEquipmentSlots(net.minecraft.util.RandomSource random, net.minecraft.world.DifficultyInstance difficulty) {
+ super.populateDefaultEquipmentSlots(this.random, difficulty);
+ // TODO make configurable
+ if (random.nextFloat() < (level().getDifficulty() == net.minecraft.world.Difficulty.HARD ? 0.1F : 0.05F)) {
+ this.setItemSlot(net.minecraft.world.entity.EquipmentSlot.MAINHAND, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.IRON_SWORD));
+ }
+ }
+
+ @Override
+ public float getJumpPower() {
+ // make giants jump as high as everything else relative to their size
+ // 1.0 makes bottom of feet about as high as their waist when they jump
+ return level().purpurConfig.giantJumpHeight;
+ }
+ // Purpur end - Giants AI settings
+
@Override
public float getWalkTargetValue(final BlockPos pos, final LevelReader level) {
- return level.getPathfindingCostFromLightLevels(pos);
+ return super.getWalkTargetValue(pos, level); // Purpur - Giants AI settings - fix light requirements for natural spawns
}
}

View File

@@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 12 Apr 2020 13:19:34 -0500
Subject: [PATCH] Chickens can retaliate
diff --git a/net/minecraft/world/entity/animal/chicken/Chicken.java b/net/minecraft/world/entity/animal/chicken/Chicken.java
index 3e1e904d9401bef41271fe8d29a22b6cd944e766..0392c8a94801a1dee735ff610058fbb2180571fa 100644
--- a/net/minecraft/world/entity/animal/chicken/Chicken.java
+++ b/net/minecraft/world/entity/animal/chicken/Chicken.java
@@ -98,6 +98,11 @@ public class Chicken extends Animal {
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.chickenMaxHealth);
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.chickenScale);
+ // Purpur start - Chickens can retaliate
+ if (level().purpurConfig.chickenRetaliate) {
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(2.0D);
+ }
+ // Purpur end - Chickens can retaliate
}
// Purpur end - Configurable entity base attributes
@@ -105,13 +110,21 @@ public class Chicken extends Animal {
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
- this.goalSelector.addGoal(1, new PanicGoal(this, 1.4));
+ //this.goalSelector.addGoal(1, new PanicGoal(this, 1.4)); // Purpur - Chickens can retaliate - moved down
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0, i -> i.is(ItemTags.CHICKEN_FOOD), false));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
+ // Purpur start - Chickens can retaliate
+ if (level().purpurConfig.chickenRetaliate) {
+ this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.0D, false));
+ this.targetSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal(this));
+ } else {
+ this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
+ }
+ // Purpur end - Chickens can retaliate
}
public Holder<ChickenSoundVariant> getSoundVariant() {
@@ -132,7 +145,7 @@ public class Chicken extends Animal {
}
public static AttributeSupplier.Builder createAttributes() {
- return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.25);
+ return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.25).add(Attributes.ATTACK_DAMAGE, 0.0D); // Purpur - Chickens can retaliate
}
@Override

View File

@@ -0,0 +1,152 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 29 Jun 2019 02:32:40 -0500
Subject: [PATCH] Minecart settings and WASD controls
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index e5d9c8e6999f3b7a40269fc5b06da4878a114046..b8ebcaca72ed6c92802fe289f8db1e0223d7470d 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1296,6 +1296,11 @@ public class ServerPlayer extends Player {
} else {
// Purpur start - Add boat fall damage config
if (source.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
+ // Purpur start - Minecart settings and WASD controls
+ if (getRootVehicle() instanceof AbstractMinecart && level().purpurConfig.minecartControllable && !level().purpurConfig.minecartControllableFallDamage) {
+ return false;
+ }
+ // Purpur end - Minecart settings and WASD controls
if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.boat.Boat && !level().purpurConfig.boatsDoFallDamage) {
return false;
}
diff --git a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java
index 9f72e7eeecf3037a498e7688f55cc029a49f388d..59cf0d4dcffc00313e06574987e4364f6ca21eb5 100644
--- a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java
+++ b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java
@@ -105,6 +105,10 @@ public abstract class AbstractMinecart extends VehicleEntity {
private double flyingY = 0.95;
private double flyingZ = 0.95;
public @Nullable Double maxSpeed;
+ // Purpur start - Minecart settings and WASD controls
+ public double storedMaxSpeed;
+ public boolean isNewBehavior;
+ // Purpur end - Minecart settings and WASD controls
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
// CraftBukkit end
@@ -113,8 +117,13 @@ public abstract class AbstractMinecart extends VehicleEntity {
this.blocksBuilding = true;
if (useExperimentalMovement(level)) {
this.behavior = new NewMinecartBehavior(this);
+ this.isNewBehavior = true; // Purpur - Minecart settings and WASD controls
} else {
this.behavior = new OldMinecartBehavior(this);
+ // Purpur start - Minecart settings and WASD controls
+ this.isNewBehavior = false;
+ maxSpeed = storedMaxSpeed = level.purpurConfig.minecartMaxSpeed;
+ // Purpur end - Minecart settings and WASD controls
}
}
@@ -289,6 +298,14 @@ public abstract class AbstractMinecart extends VehicleEntity {
@Override
public void tick() {
+ // Purpur start - Minecart settings and WASD controls
+ if (!this.isNewBehavior) {
+ if (storedMaxSpeed != level().purpurConfig.minecartMaxSpeed) {
+ maxSpeed = storedMaxSpeed = level().purpurConfig.minecartMaxSpeed;
+ }
+ }
+ // Purpur end - Minecart settings and WASD controls
+
// CraftBukkit start
double prevX = this.getX();
double prevY = this.getY();
@@ -405,15 +422,61 @@ public abstract class AbstractMinecart extends VehicleEntity {
this.behavior.moveAlongTrack(level);
}
+ // Purpur start - Minecart settings and WASD controls
+ private Double lastSpeed;
+
+ public double getControllableSpeed() {
+ BlockState blockState = level().getBlockState(this.blockPosition());
+ if (!blockState.isSolid()) {
+ blockState = level().getBlockState(this.blockPosition().relative(Direction.DOWN));
+ }
+ Double speed = level().purpurConfig.minecartControllableBlockSpeeds.get(blockState.getBlock());
+ if (!blockState.isSolid()) {
+ speed = lastSpeed;
+ }
+ if (speed == null) {
+ speed = level().purpurConfig.minecartControllableBaseSpeed;
+ }
+ return lastSpeed = speed;
+ }
+ // Purpur end - Minecart settings and WASD controls
+
protected void comeOffTrack(final ServerLevel level) {
double maxSpeed = this.getMaxSpeed(level);
Vec3 movement = this.getDeltaMovement();
this.setDeltaMovement(Mth.clamp(movement.x, -maxSpeed, maxSpeed), movement.y, Mth.clamp(movement.z, -maxSpeed, maxSpeed));
+
+ // Purpur start - Minecart settings and WASD controls
+ if (level().purpurConfig.minecartControllable && !isInWater() && !isInLava() && !passengers.isEmpty()) {
+ Entity passenger = passengers.get(0);
+ if (passenger instanceof net.minecraft.server.level.ServerPlayer player) {
+ net.minecraft.world.entity.player.Input lastClientInput = player.getLastClientInput();
+ float forward = (lastClientInput.forward() == lastClientInput.backward() ? 0.0F : lastClientInput.forward() ? 1.0F : -1.0F);
+ if (lastClientInput.jump() && this.onGround) {
+ setDeltaMovement(new Vec3(getDeltaMovement().x, level().purpurConfig.minecartControllableHopBoost, getDeltaMovement().z));
+ }
+ if (forward != 0.0F) {
+ org.bukkit.util.Vector velocity = player.getBukkitEntity().getEyeLocation().getDirection().normalize().multiply(getControllableSpeed());
+ if (forward < 0.0) {
+ velocity.multiply(-0.5);
+ }
+ setDeltaMovement(new Vec3(velocity.getX(), getDeltaMovement().y, velocity.getZ()));
+ }
+ this.setYRot(passenger.getYRot() - 90);
+ maxUpStep = level().purpurConfig.minecartControllableStepHeight;
+ } else {
+ maxUpStep = 0.0F;
+ }
+ } else {
+ maxUpStep = 0.0F;
+ }
+ // Purpur end - Minecart settings and WASD controls
if (this.onGround()) {
// CraftBukkit start - replace magic numbers with our variables
this.setDeltaMovement(new Vec3(this.getDeltaMovement().x * this.derailedX, this.getDeltaMovement().y * this.derailedY, this.getDeltaMovement().z * this.derailedZ));
// CraftBukkit end
}
+ else if (level().purpurConfig.minecartControllable) setDeltaMovement(new Vec3(getDeltaMovement().x * derailedX, getDeltaMovement().y, getDeltaMovement().z * derailedZ)); // Purpur - Minecart settings and WASD controls
this.move(MoverType.SELF, this.getDeltaMovement());
if (!this.onGround()) {
diff --git a/net/minecraft/world/item/MinecartItem.java b/net/minecraft/world/item/MinecartItem.java
index 7464dbde8cc3348748d2a3733624bd2274f9c735..91df0baebab1da9cd060cb93698c7f154c719669 100644
--- a/net/minecraft/world/item/MinecartItem.java
+++ b/net/minecraft/world/item/MinecartItem.java
@@ -30,8 +30,9 @@ public class MinecartItem extends Item {
BlockPos pos = context.getClickedPos();
BlockState blockState = level.getBlockState(pos);
if (!blockState.is(BlockTags.RAILS)) {
- return InteractionResult.FAIL;
- } else {
+ if (!level.purpurConfig.minecartPlaceAnywhere) return InteractionResult.FAIL; // Purpur - Minecart settings and WASD controls
+ if (blockState.isSolid()) pos = pos.relative(context.getClickedFace());
+ } // else { // Purpur - Minecart settings and WASD controls
ItemStack itemStack = context.getItemInHand();
RailShape shape = blockState.getBlock() instanceof BaseRailBlock
? blockState.getValue(((BaseRailBlock)blockState.getBlock()).getShapeProperty())
@@ -70,6 +71,6 @@ public class MinecartItem extends Item {
itemStack.shrink(1);
return InteractionResult.SUCCESS;
}
- }
+ // } // Purpur - Minecart settings and WASD controls
}
}

View File

@@ -0,0 +1,102 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 29 Nov 2019 22:10:12 -0600
Subject: [PATCH] Villagers follow emerald blocks
diff --git a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
index 6b78ddb4ec40d45634288796a98e34714e0deb68..34d2394006a006ea0773a52bb43b5cb3617470e5 100644
--- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
+++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
@@ -173,7 +173,7 @@ public class DefaultAttributes {
.put(EntityType.VILLAGER, Villager.createAttributes().build())
.put(EntityType.VINDICATOR, Vindicator.createAttributes().build())
.put(EntityType.WARDEN, Warden.createAttributes().build())
- .put(EntityType.WANDERING_TRADER, Mob.createMobAttributes().build())
+ .put(EntityType.WANDERING_TRADER, net.minecraft.world.entity.npc.wanderingtrader.WanderingTrader.createAttributes().build()) // Purpur - Villagers follow emerald blocks
.put(EntityType.WITCH, Witch.createAttributes().build())
.put(EntityType.WITHER, WitherBoss.createAttributes().build())
.put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build())
diff --git a/net/minecraft/world/entity/ai/goal/TemptGoal.java b/net/minecraft/world/entity/ai/goal/TemptGoal.java
index af2bd8a5cf760792a63dfb9c2370360f288beab6..016167a6ff90dfe5a2e66596eaab2c8f2775c016 100644
--- a/net/minecraft/world/entity/ai/goal/TemptGoal.java
+++ b/net/minecraft/world/entity/ai/goal/TemptGoal.java
@@ -70,7 +70,7 @@ public class TemptGoal extends Goal {
}
private boolean shouldFollow(final LivingEntity player) {
- return this.items.test(player.getMainHandItem()) || this.items.test(player.getOffhandItem());
+ return (this.items.test(player.getMainHandItem()) || this.items.test(player.getOffhandItem())) && (!(this.mob instanceof net.minecraft.world.entity.npc.villager.Villager villager) || !villager.isSleeping()); // Purpur - Villagers follow emerald blocks
}
@Override
diff --git a/net/minecraft/world/entity/npc/villager/AbstractVillager.java b/net/minecraft/world/entity/npc/villager/AbstractVillager.java
index f6ac52144958b48dad0b0f682634fad3d8e9557c..0825e06843c3613843cf7c15fa3fb3a1c0787781 100644
--- a/net/minecraft/world/entity/npc/villager/AbstractVillager.java
+++ b/net/minecraft/world/entity/npc/villager/AbstractVillager.java
@@ -52,6 +52,7 @@ import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
public abstract class AbstractVillager extends AgeableMob implements Npc, Merchant, InventoryCarrier {
+ public static final net.minecraft.world.item.crafting.Ingredient TEMPT_ITEMS = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.level.block.Blocks.EMERALD_BLOCK.asItem()); // Purpur - Villagers follow emerald blocks
private static final Logger LOGGER = LogUtils.getLogger();
private static final EntityDataAccessor<Integer> DATA_UNHAPPY_COUNTER = SynchedEntityData.defineId(AbstractVillager.class, EntityDataSerializers.INT);
private @Nullable Player tradingPlayer;
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
index ddbfcf8e16e17a3f482cb99de61ae8e40a383c18..6105aa39baf888dd625f4d345822a4058bf83ef4 100644
--- a/net/minecraft/world/entity/npc/villager/Villager.java
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
@@ -271,6 +271,7 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
+ if (level().purpurConfig.villagerFollowEmeraldBlock) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, TEMPT_ITEMS, false)); // Purpur - Villagers follow emerald blocks
}
// Purpur end - Ridables
@@ -279,6 +280,7 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.villagerMaxHealth);
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.villagerScale);
+ this.getAttribute(Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.villagerTemptRange); // Purpur - Villagers follow emerald blocks
}
// Purpur end - Configurable entity base attributes
@@ -320,7 +322,7 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
}
public static AttributeSupplier.Builder createAttributes() {
- return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5);
+ return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.TEMPT_RANGE, 10.0D); // Purpur - Villagers follow emerald blocks
}
public boolean assignProfessionWhenSpawned() {
diff --git a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
index 848aeba87bd220d7241c5adeba26fbd6591dbbae..ea74d8ac0b5de890124361e65aeb9a08ad09fa1b 100644
--- a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
+++ b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
@@ -89,9 +89,16 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
@Override
public void initAttributes() {
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.wanderingTraderMaxHealth);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.wanderingTraderTemptRange); // Purpur - Villagers follow emerald blocks
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Villagers follow emerald blocks
+ public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() {
+ return Mob.createMobAttributes().add(net.minecraft.world.entity.ai.attributes.Attributes.TEMPT_RANGE, 10.0D);
+ }
+ // Purpur end - Villagers follow emerald blocks
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
@@ -123,6 +130,7 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
this.goalSelector.addGoal(1, new PanicGoal(this, 0.5));
this.goalSelector.addGoal(1, new LookAtTradingPlayerGoal(this));
this.goalSelector.addGoal(2, new WanderingTrader.WanderToPositionGoal(this, 2.0, 0.35));
+ if (level().purpurConfig.wanderingTraderFollowEmeraldBlock) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, TEMPT_ITEMS, false)); // Purpur - Villagers follow emerald blocks
this.goalSelector.addGoal(4, new MoveTowardsRestrictionGoal(this, 0.35));
this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 0.35));
this.goalSelector.addGoal(9, new InteractGoal(this, Player.class, 3.0F, 1.0F));

View File

@@ -0,0 +1,90 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 25 Jul 2019 18:07:37 -0500
Subject: [PATCH] Implement elytra settings
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 7119a83b5b9811ab3ef2622f91c966741818e48f..2e7e5c4c42bcdb6135a088ffe0a7a8f4558dc12c 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3945,7 +3945,16 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (freeFallInterval % 2 == 0) {
List<EquipmentSlot> slotsWithGliders = EquipmentSlot.VALUES.stream().filter(slot -> canGlideUsing(this.getItemBySlot(slot), slot)).toList();
EquipmentSlot slotToDamage = Util.getRandom(slotsWithGliders, this.random);
- this.getItemBySlot(slotToDamage).hurtAndBreak(1, this, slotToDamage);
+ // Purpur start - Implement elytra settings
+ int damage = level().purpurConfig.elytraDamagePerSecond;
+ if (level().purpurConfig.elytraDamageMultiplyBySpeed > 0) {
+ double speed = getDeltaMovement().lengthSqr();
+ if (speed > level().purpurConfig.elytraDamageMultiplyBySpeed) {
+ damage *= (int) speed;
+ }
+ }
+ this.getItemBySlot(slotToDamage).hurtAndBreak(damage, this, slotToDamage);
+ // Purpur end - Implement elytra settings
}
this.gameEvent(GameEvent.ELYTRA_GLIDE);
diff --git a/net/minecraft/world/item/FireworkRocketItem.java b/net/minecraft/world/item/FireworkRocketItem.java
index c17607cb1fd5403f17a64b4218571e669b840a2e..6545145e1f83b333fd1d05ab714c9869c5d2d7fe 100644
--- a/net/minecraft/world/item/FireworkRocketItem.java
+++ b/net/minecraft/world/item/FireworkRocketItem.java
@@ -73,6 +73,17 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
if (player.dropAllLeashConnections(null)) {
level.playSound(null, player, SoundEvents.LEAD_BREAK, SoundSource.NEUTRAL, 1.0F, 1.0F);
}
+ // Purpur start - Implement elytra settings
+ if (level.purpurConfig.elytraDamagePerFireworkBoost > 0) {
+ java.util.List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> net.minecraft.world.entity.LivingEntity.canGlideUsing(player.getItemBySlot(enumitemslot), enumitemslot)).toList();
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.util.Util.getRandom(list, player.random);
+
+ ItemStack glideItem = player.getItemBySlot(enumitemslot);
+ if (player.canGlide()) {
+ glideItem.hurtAndBreak(level.purpurConfig.elytraDamagePerFireworkBoost, player, enumitemslot);
+ }
+ }
+ // Purpur end - Implement elytra settings
if (event.shouldConsume() && !player.hasInfiniteMaterials()) {
itemStack.shrink(1); // Moved up from below
} else {
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
index 842bc5b3b7a31a8cc3b5651fb69092402d83606c..70a45aab9ac93973a3dde08140a4acf4813987f3 100644
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -695,6 +695,14 @@ public final class ItemStack implements DataComponentHolder, ItemInstance {
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
}
// CraftBukkit end
+
+ // Purpur start - Implement elytra settings
+ if (this.has(DataComponents.GLIDER)) {
+ setDamageValue(this.getMaxDamage() - 1);
+ return;
+ }
+ // Purpur end - Implement elytra settings
+
this.shrink(1);
onBreak.accept(item);
}
diff --git a/net/minecraft/world/item/TridentItem.java b/net/minecraft/world/item/TridentItem.java
index 710b8711184ea6e1cf0dfd338b897923ed2b79fb..82995f60dbb62325b46bc8a87cd2087461715c4f 100644
--- a/net/minecraft/world/item/TridentItem.java
+++ b/net/minecraft/world/item/TridentItem.java
@@ -125,6 +125,16 @@ public class TridentItem extends Item implements ProjectileItem {
yd *= riptideStrength / dist;
zd *= riptideStrength / dist;
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(player, itemStack, xd, yd, zd)) return false; // Paper - Add player riptide event
+ // Purpur start - Implement elytra settings
+ List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entity.getItemBySlot(enumitemslot), enumitemslot)).toList();
+ if (!list.isEmpty()) {
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.util.Util.getRandom(list, entity.random);
+ ItemStack glideItem = entity.getItemBySlot(enumitemslot);
+ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && level.purpurConfig.elytraDamagePerTridentBoost > 0) {
+ glideItem.hurtAndBreak(level.purpurConfig.elytraDamagePerTridentBoost, entity, enumitemslot);
+ }
+ }
+ // Purpur end - Implement elytra settings
player.push(xd, yd, zd);
player.startAutoSpinAttack(20, 8.0F, itemStack);
if (player.onGround()) {

View File

@@ -0,0 +1,177 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 26 Mar 2020 21:39:32 -0500
Subject: [PATCH] Configurable jockey options
diff --git a/net/minecraft/world/entity/monster/zombie/Drowned.java b/net/minecraft/world/entity/monster/zombie/Drowned.java
index 573abf9eae9f5492e4231d663814352f7e046fe2..0f64fe7e15655c63f996106d504ab4d18dac4a1c 100644
--- a/net/minecraft/world/entity/monster/zombie/Drowned.java
+++ b/net/minecraft/world/entity/monster/zombie/Drowned.java
@@ -116,6 +116,23 @@ public class Drowned extends Zombie implements RangedAttackMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.drownedJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.drownedJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.drownedJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void addBehaviourGoals() {
this.goalSelector.addGoal(1, new Drowned.DrownedGoToWaterGoal(this, 1.0));
diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java
index 1c985585a2da43e59bb5b9ebd742e1e31b2cda29..c3f2d9ab49eb501f26939387624f326227908b81 100644
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
@@ -66,6 +66,23 @@ public class Husk extends Zombie {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.huskJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.huskJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.huskJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
public boolean isSunSensitive() {
return false;
diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java
index 900c768b0118153ea2c74dea0960aef3217da441..5bf9970b93e27004dd832c8465dc95a681583ef6 100644
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
@@ -138,6 +138,20 @@ public class Zombie extends Monster {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.zombieJockeyOnlyBaby;
+ }
+
+ public double jockeyChance() {
+ return level().purpurConfig.zombieJockeyChance;
+ }
+
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.zombieJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
@@ -550,19 +564,18 @@ public class Zombie extends Monster {
}
if (groupData instanceof Zombie.ZombieGroupData zombieData) {
- if (zombieData.isBaby) {
- this.setBaby(true);
+ if (!jockeyOnlyBaby() || zombieData.isBaby) { // Purpur - Configurable jockey options
+ this.setBaby(zombieData.isBaby); // Purpur - Configurable jockey options
if (zombieData.canSpawnJockey) {
- if (random.nextFloat() < 0.05) {
- List<Chicken> chickens = level.getEntitiesOfClass(
+ if (random.nextFloat() < jockeyChance()) { // Purpur - Configurable jockey options
+ List<Chicken> chickens = jockeyTryExistingChickens() ? level.getEntitiesOfClass( // Purpur - Configurable jockey options
Chicken.class, this.getBoundingBox().inflate(5.0, 3.0, 5.0), EntitySelector.ENTITY_NOT_BEING_RIDDEN
- );
+ ) : java.util.Collections.emptyList(); // Purpur - Configurable jockey options
if (!chickens.isEmpty()) {
Chicken chicken = chickens.get(0);
chicken.setChickenJockey(true);
this.startRiding(chicken, false, false);
- }
- } else if (random.nextFloat() < 0.05) {
+ } else { // Purpur - Configurable jockey options
Chicken chicken = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.JOCKEY);
if (chicken != null) {
chicken.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
@@ -571,6 +584,7 @@ public class Zombie extends Monster {
this.startRiding(chicken, false, false);
level.addFreshEntity(chicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
}
+ } // Purpur - Configurable jockey options
}
}
}
diff --git a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
index 02cc4228bfc1ee27ffceb39d6406fce89f6d8312..8a5634d2204b9abae560d34a7b0616b3ebdc68ab 100644
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
@@ -114,6 +114,23 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.zombieVillagerJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.zombieVillagerJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.zombieVillagerJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
index b6c14d7c5fbe7f37d4d5b865aae60d4a05af081b..d1edf1f44de1fc6d23bcd8044f8bf4165821790e 100644
--- a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
@@ -93,6 +93,23 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.zombifiedPiglinJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.zombifiedPiglinJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.zombifiedPiglinJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void addBehaviourGoals() {
this.goalSelector.addGoal(1, new SpearUseGoal<>(this, 1.0, 1.0, 10.0F, 2.0F));

View File

@@ -0,0 +1,255 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 9 May 2019 18:26:06 -0500
Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index 0bfb8cd53e87d986679d4e26ebf77c52e58c1c10..fd901b84bc105a2ccf59eef687a20d53b84e1906 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -27,6 +27,12 @@ public class EndCrystal extends Entity {
private static final boolean DEFAULT_SHOW_BOTTOM = true;
public int time;
public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ private net.minecraft.world.entity.monster.Phantom targetPhantom;
+ private int phantomBeamTicks = 0;
+ private int phantomDamageCooldown = 0;
+ private int idleCooldown = 0;
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
public EndCrystal(final EntityType<? extends EndCrystal> type, final Level level) {
super(type, level);
@@ -95,6 +101,49 @@ public class EndCrystal extends Entity {
// Paper end - Fix invulnerable end crystals
if (this.level().purpurConfig.endCrystalCramming > 0 && this.level().getEntitiesOfClass(EndCrystal.class, getBoundingBox()).size() > this.level().purpurConfig.endCrystalCramming) this.hurt(this.damageSources().cramming(), 6.0F); // Purpur - End Crystal Cramming
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ if (level().purpurConfig.phantomAttackedByCrystalRadius <= 0 || --idleCooldown > 0) {
+ return; // on cooldown
+ }
+
+ if (targetPhantom == null) {
+ for (net.minecraft.world.entity.monster.Phantom phantom : level().getEntitiesOfClass(net.minecraft.world.entity.monster.Phantom.class, getBoundingBox().inflate(level().purpurConfig.phantomAttackedByCrystalRadius))) {
+ if (phantom.hasLineOfSight(this)) {
+ attackPhantom(phantom);
+ break;
+ }
+ }
+ } else {
+ setBeamTarget(new BlockPos(targetPhantom).offset(0, -2, 0));
+ if (--phantomBeamTicks > 0 && targetPhantom.isAlive()) {
+ phantomDamageCooldown--;
+ if (targetPhantom.hasLineOfSight(this)) {
+ if (phantomDamageCooldown <= 0) {
+ phantomDamageCooldown = 20;
+ targetPhantom.hurt(targetPhantom.damageSources().indirectMagic(this, this), level().purpurConfig.phantomAttackedByCrystalDamage);
+ }
+ } else {
+ forgetPhantom(); // no longer in sight
+ }
+ } else {
+ forgetPhantom(); // attacked long enough
+ }
+ }
+ }
+
+ private void attackPhantom(net.minecraft.world.entity.monster.Phantom phantom) {
+ phantomDamageCooldown = 0;
+ phantomBeamTicks = 60;
+ targetPhantom = phantom;
+ }
+
+ private void forgetPhantom() {
+ targetPhantom = null;
+ setBeamTarget(null);
+ phantomBeamTicks = 0;
+ phantomDamageCooldown = 0;
+ idleCooldown = 60;
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
}
@Override
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index b45eb26fa78a4bafa247c3cf8f20fb2f076646c5..c33910433eae54df4d1d4b918c28b361bd510577 100644
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -50,6 +50,7 @@ public class Phantom extends Mob implements Enemy {
private Vec3 moveTargetPoint = Vec3.ZERO;
public @Nullable BlockPos anchorPoint;
private Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
+ Vec3 crystalPosition; // Purpur - Phantoms attracted to crystals and crystals shoot phantoms
// Paper start
public java.util.@Nullable UUID spawningEntity;
public boolean shouldBurnInDay = true;
@@ -108,6 +109,25 @@ public class Phantom extends Mob implements Enemy {
}
// Purpur end - Ridables
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ @Override
+ protected void dropFromLootTable(ServerLevel world, DamageSource damageSource, boolean causedByPlayer) {
+ boolean dropped = false;
+ if (lastHurtByPlayer == null && damageSource.getEntity() instanceof net.minecraft.world.entity.boss.enderdragon.EndCrystal) {
+ if (random.nextInt(5) < 1) {
+ dropped = spawnAtLocation(world, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.PHANTOM_MEMBRANE)) != null;
+ }
+ }
+ if (!dropped) {
+ super.dropFromLootTable(world, damageSource, causedByPlayer);
+ }
+ }
+
+ public boolean isCirclingCrystal() {
+ return crystalPosition != null;
+ }
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
+
@Override
public boolean isFlapping() {
return (this.getUniqueFlapTickOffset() + this.tickCount) % TICKS_PER_FLAP == 0;
@@ -121,9 +141,15 @@ public class Phantom extends Mob implements Enemy {
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
- this.goalSelector.addGoal(1, new Phantom.PhantomAttackStrategyGoal());
- this.goalSelector.addGoal(2, new Phantom.PhantomSweepAttackGoal());
- this.goalSelector.addGoal(3, new Phantom.PhantomCircleAroundAnchorGoal());
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ if (level().purpurConfig.phantomOrbitCrystalRadius > 0) {
+ this.goalSelector.addGoal(1, new PhantomFindCrystalGoal(this));
+ this.goalSelector.addGoal(2, new PhantomOrbitCrystalGoal(this));
+ }
+ this.goalSelector.addGoal(3, new Phantom.PhantomAttackStrategyGoal());
+ this.goalSelector.addGoal(4, new Phantom.PhantomSweepAttackGoal());
+ this.goalSelector.addGoal(5, new Phantom.PhantomCircleAroundAnchorGoal());
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
this.targetSelector.addGoal(1, new Phantom.PhantomAttackPlayerTargetGoal());
}
@@ -513,6 +539,124 @@ public class Phantom extends Mob implements Enemy {
}
}
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
+ class PhantomFindCrystalGoal extends Goal {
+ private final Phantom phantom;
+ private net.minecraft.world.entity.boss.enderdragon.EndCrystal crystal;
+ private Comparator<net.minecraft.world.entity.boss.enderdragon.EndCrystal> comparator;
+
+ PhantomFindCrystalGoal(Phantom phantom) {
+ this.phantom = phantom;
+ this.comparator = Comparator.comparingDouble(phantom::distanceToSqr);
+ this.setFlags(EnumSet.of(Flag.LOOK));
+ }
+
+ @Override
+ public boolean canUse() {
+ double range = maxTargetRange();
+ List<net.minecraft.world.entity.boss.enderdragon.EndCrystal> crystals = level().getEntitiesOfClass(net.minecraft.world.entity.boss.enderdragon.EndCrystal.class, phantom.getBoundingBox().inflate(range));
+ if (crystals.isEmpty()) {
+ return false;
+ }
+ crystals.sort(comparator);
+ crystal = crystals.get(0);
+ if (phantom.distanceToSqr(crystal) > range * range) {
+ crystal = null;
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canContinueToUse() {
+ if (crystal == null || !crystal.isAlive()) {
+ return false;
+ }
+ double range = maxTargetRange();
+ return phantom.distanceToSqr(crystal) <= (range * range) * 2;
+ }
+
+ @Override
+ public void start() {
+ phantom.crystalPosition = new Vec3(crystal.getX(), crystal.getY() + (phantom.random.nextInt(10) + 10), crystal.getZ());
+ }
+
+ @Override
+ public void stop() {
+ crystal = null;
+ phantom.crystalPosition = null;
+ super.stop();
+ }
+
+ private double maxTargetRange() {
+ return phantom.level().purpurConfig.phantomOrbitCrystalRadius;
+ }
+ }
+
+ class PhantomOrbitCrystalGoal extends Goal {
+ private final Phantom phantom;
+ private float offset;
+ private float radius;
+ private float verticalChange;
+ private float direction;
+
+ PhantomOrbitCrystalGoal(Phantom phantom) {
+ this.phantom = phantom;
+ this.setFlags(EnumSet.of(Flag.MOVE));
+ }
+
+ @Override
+ public boolean canUse() {
+ return phantom.isCirclingCrystal();
+ }
+
+ @Override
+ public void start() {
+ this.radius = 5.0F + phantom.random.nextFloat() * 10.0F;
+ this.verticalChange = -4.0F + phantom.random.nextFloat() * 9.0F;
+ this.direction = phantom.random.nextBoolean() ? 1.0F : -1.0F;
+ updateOffset();
+ }
+
+ @Override
+ public void tick() {
+ if (phantom.random.nextInt(350) == 0) {
+ this.verticalChange = -4.0F + phantom.random.nextFloat() * 9.0F;
+ }
+ if (phantom.random.nextInt(250) == 0) {
+ ++this.radius;
+ if (this.radius > 15.0F) {
+ this.radius = 5.0F;
+ this.direction = -this.direction;
+ }
+ }
+ if (phantom.random.nextInt(450) == 0) {
+ this.offset = phantom.random.nextFloat() * 2.0F * 3.1415927F;
+ updateOffset();
+ }
+ if (phantom.moveTargetPoint.distanceToSqr(phantom.getX(), phantom.getY(), phantom.getZ()) < 4.0D) {
+ updateOffset();
+ }
+ if (phantom.moveTargetPoint.y < phantom.getY() && !phantom.level().isEmptyBlock(new BlockPos(phantom).below(1))) {
+ this.verticalChange = Math.max(1.0F, this.verticalChange);
+ updateOffset();
+ }
+ if (phantom.moveTargetPoint.y > phantom.getY() && !phantom.level().isEmptyBlock(new BlockPos(phantom).above(1))) {
+ this.verticalChange = Math.min(-1.0F, this.verticalChange);
+ updateOffset();
+ }
+ }
+
+ private void updateOffset() {
+ this.offset += this.direction * 15.0F * 0.017453292F;
+ phantom.moveTargetPoint = phantom.crystalPosition.add(
+ this.radius * Mth.cos(this.offset),
+ -4.0F + this.verticalChange,
+ this.radius * Mth.sin(this.offset));
+ }
+ }
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
+
private class PhantomMoveControl extends org.purpurmc.purpur.controller.FlyingMoveControllerWASD { // Purpur - Ridables
private float speed;

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: draycia <lonelyyordle@gmail.com>
Date: Sun, 12 Apr 2020 20:41:59 -0700
Subject: [PATCH] Phantoms burn in light
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index c33910433eae54df4d1d4b918c28b361bd510577..da014eae20abb320ecb897517810e4ab53783a89 100644
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -55,6 +55,7 @@ public class Phantom extends Mob implements Enemy {
public java.util.@Nullable UUID spawningEntity;
public boolean shouldBurnInDay = true;
// Paper end
+ private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur - Phantoms burn in light
public Phantom(final EntityType<? extends Phantom> type, final Level level) {
super(type, level);
@@ -239,7 +240,11 @@ public class Phantom extends Mob implements Enemy {
// Paper start
@Override
public boolean isSunBurnTick() {
- return this.shouldBurnInDay && super.isSunBurnTick();
+ // Purpur start - API for any mob to burn daylight
+ boolean burnFromDaylight = this.shouldBurnInDay && super.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
+ return burnFromDaylight || burnFromLightSource;
+ // Purpur end - API for any mob to burn daylight
}
// Paper end
@@ -362,6 +367,7 @@ public class Phantom extends Mob implements Enemy {
this.nextScanTick = reducedTickDelay(60);
ServerLevel level = getServerLevel(Phantom.this.level());
List<Player> players = level.getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0, 64.0, 16.0));
+ if (level().purpurConfig.phantomIgnorePlayersWithTorch) players.removeIf(human -> TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND))); // Purpur - Phantoms burn in light
if (!players.isEmpty()) {
players.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed());
@@ -752,6 +758,12 @@ public class Phantom extends Mob implements Enemy {
return false;
} else if (!target.isAlive()) {
return false;
+ // Purpur start - Phantoms burn in light
+ } else if (level().purpurConfig.phantomBurnInLight > 0 && level().getLightEmission(new BlockPos(Phantom.this)) >= level().purpurConfig.phantomBurnInLight) {
+ return false;
+ } else if (level().purpurConfig.phantomIgnorePlayersWithTorch && (TORCH.test(target.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(target.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND)))) {
+ return false;
+ // Purpur end - Phantoms burn in light
} else if (target instanceof Player player && (target.isSpectator() || player.isCreative())) {
return false;
} else if (!this.canUse()) {

View File

@@ -0,0 +1,668 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sun, 15 Nov 2020 02:18:15 -0800
Subject: [PATCH] Make entity breeding times configurable
diff --git a/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java b/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java
index 5e448f83d2426fb09785b2899e1bf5950ced6608..4f04eebef9ecd84137ac067c5adcbe977c21a617 100644
--- a/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java
+++ b/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java
@@ -117,8 +117,10 @@ public class VillagerMakeLove extends Behavior<Villager> {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(child, source, target, null, null, 0).isCancelled()) {
return Optional.empty();
}
- source.setAge(6000);
- target.setAge(6000);
+ // Purpur start - Make entity breeding times configurable
+ source.setAge(level.purpurConfig.villagerBreedingTicks);
+ target.setAge(level.purpurConfig.villagerBreedingTicks);
+ // Purpur end - Make entity breeding times configurable
level.addFreshEntityWithPassengers(child, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING);
// CraftBukkit end - call EntityBreedEvent
level.broadcastEntityEvent(child, EntityEvent.LOVE_HEARTS);
diff --git a/net/minecraft/world/entity/animal/Animal.java b/net/minecraft/world/entity/animal/Animal.java
index 774210ebe09af15f85a919512dfd2f98e7bdee6e..407ffe0e6b5893c3abf0b1ff60fd0a27ec965e0c 100644
--- a/net/minecraft/world/entity/animal/Animal.java
+++ b/net/minecraft/world/entity/animal/Animal.java
@@ -46,6 +46,7 @@ public abstract class Animal extends AgeableMob {
public int inLove = 0;
public @Nullable EntityReference<ServerPlayer> loveCause;
public @Nullable ItemStack breedItem; // CraftBukkit - Add breedItem variable
+ public abstract int getPurpurBreedTime(); // Purpur - Make entity breeding times configurable
protected Animal(final EntityType<? extends Animal> type, final Level level) {
super(type, level);
@@ -271,8 +272,10 @@ public abstract class Animal extends AgeableMob {
player.awardStat(Stats.ANIMALS_BRED);
CriteriaTriggers.BRED_ANIMALS.trigger(player, this, partner, offspring);
} // Paper - Call EntityBreedEvent
- this.setAge(6000);
- partner.setAge(6000);
+ // Purpur start - Make entity breeding times configurable
+ this.setAge(this.getPurpurBreedTime());
+ partner.setAge(partner.getPurpurBreedTime());
+ // Purpur end - Make entity breeding times configurable
this.resetLove();
partner.resetLove();
level.broadcastEntityEvent(this, EntityEvent.IN_LOVE_HEARTS);
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index 7c2c71a57b9278aea428e314462cebc08e168b50..83688ac732758ee0613fc2e187838b4607b8edc9 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -115,6 +115,13 @@ public class Armadillo extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.armadilloBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index c10b06f8adcd59869d043e48cfe3fdb60051c3db..d4178d85b74a41a0d2808681008f1686578db98d 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -143,6 +143,13 @@ public class Axolotl extends Animal implements Bucketable {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.axolotlBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public float getWalkTargetValue(final BlockPos pos, final LevelReader level) {
return 0.0F;
diff --git a/net/minecraft/world/entity/animal/bee/Bee.java b/net/minecraft/world/entity/animal/bee/Bee.java
index f31b67e2bd4b0279f52bd7c2ee0e63c49fbcec17..36c5c555faa9a29ec742c97ea8a6fcf720e6d9a1 100644
--- a/net/minecraft/world/entity/animal/bee/Bee.java
+++ b/net/minecraft/world/entity/animal/bee/Bee.java
@@ -488,6 +488,13 @@ public class Bee extends Animal implements FlyingAnimal, NeutralMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.beeBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public long getPersistentAngerEndTime() {
return this.entityData.get(DATA_ANGER_END_TIME);
diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java
index aeb8c71596a2393ac1fc67768052ce319fc25d6d..f2e87ebef0d52b2009658aae522398180a15cb92 100644
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -103,6 +103,13 @@ public class Camel extends AbstractHorse {
}
// Purpur end - Ridables
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.camelBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void addAdditionalSaveData(final ValueOutput output) {
super.addAdditionalSaveData(output);
diff --git a/net/minecraft/world/entity/animal/chicken/Chicken.java b/net/minecraft/world/entity/animal/chicken/Chicken.java
index 0392c8a94801a1dee735ff610058fbb2180571fa..ccf7c4630e08d9be54a4634c642a4cd1cd542a82 100644
--- a/net/minecraft/world/entity/animal/chicken/Chicken.java
+++ b/net/minecraft/world/entity/animal/chicken/Chicken.java
@@ -106,6 +106,13 @@ public class Chicken extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.chickenBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
diff --git a/net/minecraft/world/entity/animal/cow/Cow.java b/net/minecraft/world/entity/animal/cow/Cow.java
index 33c0b8f2c43065ea89b3f9c6a519dde27620ed07..7981f60f10c44ab2459933cb15ee961103922364 100644
--- a/net/minecraft/world/entity/animal/cow/Cow.java
+++ b/net/minecraft/world/entity/animal/cow/Cow.java
@@ -59,6 +59,13 @@ public class Cow extends AbstractCow {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.cowBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/animal/cow/MushroomCow.java b/net/minecraft/world/entity/animal/cow/MushroomCow.java
index d6ec397a14753526dd34ab3a7e69ae4be36c04a6..68a4edef68c9db6b2b0716fc6283e2c7345d4cda 100644
--- a/net/minecraft/world/entity/animal/cow/MushroomCow.java
+++ b/net/minecraft/world/entity/animal/cow/MushroomCow.java
@@ -85,6 +85,13 @@ public class MushroomCow extends AbstractCow implements Shearable {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.mooshroomBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public float getWalkTargetValue(final BlockPos pos, final LevelReader level) {
return level.getBlockState(pos.below()).is(Blocks.MYCELIUM) ? 10.0F : level.getPathfindingCostFromLightLevels(pos);
diff --git a/net/minecraft/world/entity/animal/equine/Donkey.java b/net/minecraft/world/entity/animal/equine/Donkey.java
index 1a130fc107315b40b4e34a97beb53f7fe0ced14f..8c3d3f0f24e6f5a9b8aa9bf58f3c8b679896017d 100644
--- a/net/minecraft/world/entity/animal/equine/Donkey.java
+++ b/net/minecraft/world/entity/animal/equine/Donkey.java
@@ -40,6 +40,13 @@ public class Donkey extends AbstractChestedHorse {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.donkeyBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public SoundEvent getAmbientSound() {
return SoundEvents.DONKEY_AMBIENT;
diff --git a/net/minecraft/world/entity/animal/equine/Horse.java b/net/minecraft/world/entity/animal/equine/Horse.java
index 8ba8430f41ce74736f405bfac2ef5de6fffe7d49..dbb586058f38b6c4f81e2f6567b7ae8ebbaff5a2 100644
--- a/net/minecraft/world/entity/animal/equine/Horse.java
+++ b/net/minecraft/world/entity/animal/equine/Horse.java
@@ -72,6 +72,13 @@ public class Horse extends AbstractHorse {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.horseBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void randomizeAttributes(final RandomSource random) {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(generateMaxHealth(random::nextInt));
diff --git a/net/minecraft/world/entity/animal/equine/Llama.java b/net/minecraft/world/entity/animal/equine/Llama.java
index 12abeae3623b49819ab6f852c88ee86ed8c69948..b3c8ccbb3f79043427dcb6f383c4b02d35124689 100644
--- a/net/minecraft/world/entity/animal/equine/Llama.java
+++ b/net/minecraft/world/entity/animal/equine/Llama.java
@@ -151,6 +151,13 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.llamaBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public boolean isTraderLlama() {
return false;
}
diff --git a/net/minecraft/world/entity/animal/equine/Mule.java b/net/minecraft/world/entity/animal/equine/Mule.java
index a866b93312391142b030605e2108fe522d3d8ddd..cf0f3c9d5f8ff348e6fb76db823da4cadce4fc5b 100644
--- a/net/minecraft/world/entity/animal/equine/Mule.java
+++ b/net/minecraft/world/entity/animal/equine/Mule.java
@@ -39,6 +39,13 @@ public class Mule extends AbstractChestedHorse {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.muleBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public SoundEvent getAmbientSound() {
return SoundEvents.MULE_AMBIENT;
diff --git a/net/minecraft/world/entity/animal/equine/SkeletonHorse.java b/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
index fcc9b9f884aed489ab6016d1de3dfd861781d8e5..a4a878791be034140a50b901d5daf2533d299756 100644
--- a/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
+++ b/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
@@ -67,6 +67,13 @@ public class SkeletonHorse extends AbstractHorse {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return 6000;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public static AttributeSupplier.Builder createAttributes() {
return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0).add(Attributes.MOVEMENT_SPEED, 0.2F);
}
diff --git a/net/minecraft/world/entity/animal/equine/TraderLlama.java b/net/minecraft/world/entity/animal/equine/TraderLlama.java
index bfae12b0a2b094dcd5953058f4d6245077a04fd7..7c41aecd2699725211babbac0350cb241f31ca41 100644
--- a/net/minecraft/world/entity/animal/equine/TraderLlama.java
+++ b/net/minecraft/world/entity/animal/equine/TraderLlama.java
@@ -70,6 +70,13 @@ public class TraderLlama extends Llama {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.traderLlamaBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public boolean isTraderLlama() {
return true;
diff --git a/net/minecraft/world/entity/animal/equine/ZombieHorse.java b/net/minecraft/world/entity/animal/equine/ZombieHorse.java
index ae429aec9be39d9af7da4671db15a4506da135d9..4be11663154a870a21832ddba05764a897ce90bd 100644
--- a/net/minecraft/world/entity/animal/equine/ZombieHorse.java
+++ b/net/minecraft/world/entity/animal/equine/ZombieHorse.java
@@ -78,6 +78,13 @@ public class ZombieHorse extends AbstractHorse {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return 6000;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public static AttributeSupplier.Builder createAttributes() {
return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 25.0);
}
diff --git a/net/minecraft/world/entity/animal/feline/Cat.java b/net/minecraft/world/entity/animal/feline/Cat.java
index 4ae9c5e823fefbf5bc7efdfbab27ccd166a70b8b..5c235149eca10c216f0f8d6e645a439d7dbcfbc3 100644
--- a/net/minecraft/world/entity/animal/feline/Cat.java
+++ b/net/minecraft/world/entity/animal/feline/Cat.java
@@ -128,6 +128,13 @@ public class Cat extends TamableAnimal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.catBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void registerGoals() {
this.temptGoal = new Cat.CatTemptGoal(this, 0.6, i -> i.is(ItemTags.CAT_FOOD), true);
diff --git a/net/minecraft/world/entity/animal/feline/Ocelot.java b/net/minecraft/world/entity/animal/feline/Ocelot.java
index 4bf42db19d0f58338f32af1ab7c802c274a8581c..2accf49e8dd907c8a482e5317d07b28fc5492a1e 100644
--- a/net/minecraft/world/entity/animal/feline/Ocelot.java
+++ b/net/minecraft/world/entity/animal/feline/Ocelot.java
@@ -91,6 +91,13 @@ public class Ocelot extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.ocelotBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public boolean isTrusting() {
return this.entityData.get(DATA_TRUSTING);
}
diff --git a/net/minecraft/world/entity/animal/fox/Fox.java b/net/minecraft/world/entity/animal/fox/Fox.java
index 51b6e7ea13b03e0d64ec70f37ae6394be64bf247..9c049b34c062113a2241fdda2eaae808c0e8e0b1 100644
--- a/net/minecraft/world/entity/animal/fox/Fox.java
+++ b/net/minecraft/world/entity/animal/fox/Fox.java
@@ -201,6 +201,13 @@ public class Fox extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.foxBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
@@ -1016,8 +1023,10 @@ public class Fox extends Animal {
CriteriaTriggers.BRED_ANIMALS.trigger(loveCause, this.animal, this.partner, offspring);
}
- this.animal.setAge(6000);
- this.partner.setAge(6000);
+ // Purpur start - Make entity breeding times configurable
+ this.animal.setAge(this.animal.getPurpurBreedTime());
+ this.partner.setAge(this.partner.getPurpurBreedTime());
+ // Purpur end - Make entity breeding times configurable
this.animal.resetLove();
this.partner.resetLove();
this.level.addFreshEntityWithPassengers(offspring, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
index 977ee6a71e0c52f115a221b09248596db2534739..3d2f06b4e686345632a2493366177e9002cae554 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -141,6 +141,13 @@ public class Frog extends Animal {
}
// Purpur end - Ridables
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.frogBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected Brain<Frog> makeBrain(final Brain.Packed packedBrain) {
return BRAIN_PROVIDER.makeBrain(this, packedBrain);
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
index 82c27c0e6e9f72eceb5a498af4aad6a7bd766513..da763ba40fdc52d6f6fec97e5e288fbef343ead6 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -117,6 +117,13 @@ public class Goat extends Animal {
}
// Purpur end - Ridables
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.goatBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected Brain<Goat> makeBrain(final Brain.Packed packedBrain) {
return BRAIN_PROVIDER.makeBrain(this, packedBrain);
diff --git a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
index a8e242fcf7a52fb51bd686f257f7e3d5380e38d5..75a32b65da7080391d0c37622db9cb98c5e092b6 100644
--- a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
@@ -154,6 +154,13 @@ public class HappyGhast extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return 6000;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void ageBoundaryReached() {
if (this.isBaby()) {
diff --git a/net/minecraft/world/entity/animal/nautilus/Nautilus.java b/net/minecraft/world/entity/animal/nautilus/Nautilus.java
index cc38312d0a59529e7b8f799ffec2f917c9aa0e9b..e89c0638f7b6d1a463a895dbab5994c15aa4add3 100644
--- a/net/minecraft/world/entity/animal/nautilus/Nautilus.java
+++ b/net/minecraft/world/entity/animal/nautilus/Nautilus.java
@@ -39,6 +39,13 @@ public class Nautilus extends AbstractNautilus {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.nautilusBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected Brain<Nautilus> makeBrain(final Brain.Packed packedBrain) {
return BRAIN_PROVIDER.makeBrain(this, packedBrain);
diff --git a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
index 087e768c35c2c2af191c75648b278154ce5e593c..18bfb321e3728d3fa0596da0b86e4b76ced2178a 100644
--- a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
+++ b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
@@ -59,6 +59,13 @@ public class ZombieNautilus extends AbstractNautilus {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return 6000;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public static AttributeSupplier.Builder createAttributes() {
return AbstractNautilus.createAttributes().add(Attributes.MOVEMENT_SPEED, 1.1F);
}
diff --git a/net/minecraft/world/entity/animal/panda/Panda.java b/net/minecraft/world/entity/animal/panda/Panda.java
index 8844c9279dcdc2d81a63f665d96e9d60f0ab125b..02d5949fb91bbee84fa067dac14d20f53f4a029b 100644
--- a/net/minecraft/world/entity/animal/panda/Panda.java
+++ b/net/minecraft/world/entity/animal/panda/Panda.java
@@ -146,6 +146,13 @@ public class Panda extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.pandaBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected boolean canDispenserEquipIntoSlot(final EquipmentSlot slot) {
return slot == EquipmentSlot.MAINHAND && this.canPickUpLoot();
diff --git a/net/minecraft/world/entity/animal/parrot/Parrot.java b/net/minecraft/world/entity/animal/parrot/Parrot.java
index d3b9a3ac77f03e3b6b580a678283f85a19cb660e..af3d3b90f2e4d433b3b842dbc37d8c507a73dc1f 100644
--- a/net/minecraft/world/entity/animal/parrot/Parrot.java
+++ b/net/minecraft/world/entity/animal/parrot/Parrot.java
@@ -207,6 +207,13 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return 6000;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public @Nullable SpawnGroupData finalizeSpawn(
final ServerLevelAccessor level, final DifficultyInstance difficulty, final EntitySpawnReason spawnReason, @Nullable SpawnGroupData groupData
diff --git a/net/minecraft/world/entity/animal/pig/Pig.java b/net/minecraft/world/entity/animal/pig/Pig.java
index 02ed5052bd06844ec6811c4249398ba8ba8c4ea6..514f13a6965b5f53890ddd2e47ea89e0c1a515c1 100644
--- a/net/minecraft/world/entity/animal/pig/Pig.java
+++ b/net/minecraft/world/entity/animal/pig/Pig.java
@@ -93,6 +93,13 @@ public class Pig extends Animal implements ItemSteerable {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.pigBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
diff --git a/net/minecraft/world/entity/animal/polarbear/PolarBear.java b/net/minecraft/world/entity/animal/polarbear/PolarBear.java
index e50c934e2c9959f843aae2b2dd05a682ca5f59fc..6d4713663c94e91da7d809e65fa205aff2782f38 100644
--- a/net/minecraft/world/entity/animal/polarbear/PolarBear.java
+++ b/net/minecraft/world/entity/animal/polarbear/PolarBear.java
@@ -127,6 +127,13 @@ public class PolarBear extends Animal implements NeutralMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.polarBearBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public @Nullable AgeableMob getBreedOffspring(final ServerLevel level, final AgeableMob partner) {
return EntityType.POLAR_BEAR.create(level, EntitySpawnReason.BREEDING);
diff --git a/net/minecraft/world/entity/animal/rabbit/Rabbit.java b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
index bf643b9e6929890f061ac2c44b196460234095c4..3aefbdc3e537bc53bba296c7876dee93c95a77ca 100644
--- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java
+++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
@@ -170,6 +170,13 @@ public class Rabbit extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.rabbitBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
public void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
diff --git a/net/minecraft/world/entity/animal/sheep/Sheep.java b/net/minecraft/world/entity/animal/sheep/Sheep.java
index 8d2b5a60ff267452a9724159db8df956a3fc576c..9cc59891521963204399b7f67d94bb78c7e75fb6 100644
--- a/net/minecraft/world/entity/animal/sheep/Sheep.java
+++ b/net/minecraft/world/entity/animal/sheep/Sheep.java
@@ -88,6 +88,13 @@ public class Sheep extends Animal implements Shearable {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.sheepBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void registerGoals() {
this.eatBlockGoal = new EatBlockGoal(this);
diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 7335e46f249b9a88ca0401493636f6e06c0e196d..f169d075cdaa1426c152a8f2682dbaba23de4ccc 100644
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -119,6 +119,13 @@ public class Sniffer extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.snifferBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/animal/turtle/Turtle.java b/net/minecraft/world/entity/animal/turtle/Turtle.java
index 2dfcf0c9f8eb762d1683d2841a05219c497fddfc..62d9fce83cc44165c5356049a12bf6081c925857 100644
--- a/net/minecraft/world/entity/animal/turtle/Turtle.java
+++ b/net/minecraft/world/entity/animal/turtle/Turtle.java
@@ -112,6 +112,13 @@ public class Turtle extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.turtleBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public void setHomePos(final BlockPos pos) {
this.homePos = pos;
}
@@ -343,8 +350,10 @@ public class Turtle extends Animal {
}
this.turtle.setHasEgg(true);
- this.animal.setAge(6000);
- this.partner.setAge(6000);
+ // Purpur start - Make entity breeding times configurable
+ this.animal.setAge(this.animal.getPurpurBreedTime());
+ this.partner.setAge(this.partner.getPurpurBreedTime());
+ // Purpur end - Make entity breeding times configurable
this.animal.resetLove();
this.partner.resetLove();
RandomSource random = this.animal.getRandom();
diff --git a/net/minecraft/world/entity/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
index 5605c3ecb8ffaace4b21e3bd5bd3d7714b7ea83c..0561b38982c205edc848b1650152491698a80e29 100644
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -213,6 +213,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.wolfBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java
index f8134a362a2faa49beccb840ea8a899aa4681638..38a17c219bce1a8a8a67b136e0eaf5cf15ec94fd 100644
--- a/net/minecraft/world/entity/monster/Strider.java
+++ b/net/minecraft/world/entity/monster/Strider.java
@@ -118,6 +118,13 @@ public class Strider extends Animal implements ItemSteerable {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.striderBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
public static boolean checkStriderSpawnRules(
final EntityType<Strider> ignoredType,
final LevelAccessor level,
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 352139672f2cf1a7d624db4cc5bdef3ab0c9b942..d158807f22a0a08614b2d7054663ef2782a519e3 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -98,6 +98,13 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override
+ public int getPurpurBreedTime() {
+ return this.level().purpurConfig.hoglinBreedingTicks;
+ }
+ // Purpur end - Make entity breeding times configurable
+
@VisibleForTesting
public void setTimeInOverworld(final int timeInOverworld) {
this.timeInOverworld = timeInOverworld;

View File

@@ -0,0 +1,112 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 17 Nov 2020 03:23:48 -0800
Subject: [PATCH] Apply display names from item forms of entities to entities
and vice versa
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
index 6490da07840f811fdbbd3c5dfefe4494fe7e7494..0fd3cad21382d3078d15f74c5616b0b70ddd8383 100644
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -452,6 +452,7 @@ public class ArmorStand extends LivingEntity {
private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(final ServerLevel level, final DamageSource source) { // Paper
ItemStack result = new ItemStack(Items.ARMOR_STAND);
+ if (level.purpurConfig.persistentDroppableEntityDisplayNames) // Purpur - Apply display names from item forms of entities to entities and vice versa
result.set(DataComponents.CUSTOM_NAME, this.getCustomName());
this.drops.add(new DefaultDrop(result, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior
return this.brokenByAnything(level, source); // Paper
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
index 898f64de427b84cbf9b0e5198098f8e2e9040928..bc12a7a96d8db8eb6ad2bcfccaa69464c1e2170d 100644
--- a/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -246,7 +246,11 @@ public class ItemFrame extends HangingEntity {
this.removeFramedMap(itemStack);
} else {
if (withFrame) {
- this.spawnAtLocation(level, this.getFrameItemStack());
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
+ final ItemStack itemFrame = this.getFrameItemStack();
+ if (!level.purpurConfig.persistentDroppableEntityDisplayNames) itemFrame.set(DataComponents.CUSTOM_NAME, null);
+ this.spawnAtLocation(level, itemFrame);
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
}
if (!itemStack.isEmpty()) {
diff --git a/net/minecraft/world/entity/decoration/painting/Painting.java b/net/minecraft/world/entity/decoration/painting/Painting.java
index 7195082470ca411caf9c071e970edddae93cb127..9740bb9ec78cad900b9fa7d8ed6fca6a4016de03 100644
--- a/net/minecraft/world/entity/decoration/painting/Painting.java
+++ b/net/minecraft/world/entity/decoration/painting/Painting.java
@@ -182,7 +182,11 @@ public class Painting extends HangingEntity {
if (level.getGameRules().get(GameRules.ENTITY_DROPS)) {
this.playSound(SoundEvents.PAINTING_BREAK, 1.0F, 1.0F);
if (!(causedBy instanceof Player player && player.hasInfiniteMaterials())) {
- this.spawnAtLocation(level, Items.PAINTING);
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
+ final ItemStack painting = new ItemStack(Items.PAINTING);
+ if (!this.level().purpurConfig.persistentDroppableEntityDisplayNames) painting.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, null);
+ this.spawnAtLocation(level, painting);
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
}
}
}
diff --git a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
index 390f0ec98e9e76239d67dd40d0b183d287bcf1d1..725f2c90fb0b12553441fd91a94ce5c890e1f2b1 100644
--- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
+++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
@@ -818,7 +818,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {
@Override
public final ItemStack getPickResult() {
- return new ItemStack(this.dropItem.get());
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
+ final ItemStack boat = new ItemStack(this.dropItem.get());
+ if (!this.level().purpurConfig.persistentDroppableEntityDisplayNames) {
+ boat.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, null);
+ }
+ return boat;
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
}
@Override
diff --git a/net/minecraft/world/item/ArmorStandItem.java b/net/minecraft/world/item/ArmorStandItem.java
index 4b4cc75640cc567a74c99ec8653436b2f2a50df6..47d1e104d910addcf8322976061ef38d8c791ea8 100644
--- a/net/minecraft/world/item/ArmorStandItem.java
+++ b/net/minecraft/world/item/ArmorStandItem.java
@@ -51,6 +51,10 @@ public class ArmorStandItem extends Item {
return InteractionResult.FAIL;
}
// CraftBukkit end
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
+ if (!serverLevel.purpurConfig.persistentDroppableEntityDisplayNames) entity.setCustomName(null);
+ if (serverLevel.purpurConfig.armorstandSetNameVisible && entity.getCustomName() != null) entity.setCustomNameVisible(true);
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
serverLevel.addFreshEntityWithPassengers(entity);
level.playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.ARMOR_STAND_PLACE, SoundSource.BLOCKS, 0.75F, 0.8F);
entity.gameEvent(GameEvent.ENTITY_PLACE, context.getPlayer());
diff --git a/net/minecraft/world/item/BoatItem.java b/net/minecraft/world/item/BoatItem.java
index cd7f38ab2553062dcd003bd6f758e4aba77051ea..2b90dec5d564f05f350637a9645d76d4ab7d6126 100644
--- a/net/minecraft/world/item/BoatItem.java
+++ b/net/minecraft/world/item/BoatItem.java
@@ -63,6 +63,7 @@ public class BoatItem extends Item {
return InteractionResult.FAIL;
} else {
boat.setYRot(player.getYRot());
+ if (!level.purpurConfig.persistentDroppableEntityDisplayNames) boat.setCustomName(null); // Purpur - Apply display names from item forms of entities to entities and vice versa
if (!level.noCollision(boat, boat.getBoundingBox())) {
return InteractionResult.FAIL;
} else {
diff --git a/net/minecraft/world/item/HangingEntityItem.java b/net/minecraft/world/item/HangingEntityItem.java
index 1e30fe428914c8ae4f6caf3cb5a05ced4e183393..c07b334eb05fd277925b684256591d505e5fd46a 100644
--- a/net/minecraft/world/item/HangingEntityItem.java
+++ b/net/minecraft/world/item/HangingEntityItem.java
@@ -59,7 +59,7 @@ public class HangingEntityItem extends Item {
entity = new GlowItemFrame(level, blockPos, clickedFace);
}
- EntityType.<HangingEntity>createDefaultStackConfig(level, itemInHand, player).accept(entity);
+ EntityType.<HangingEntity>appendDefaultStackConfig(entity1 -> {if (!level.purpurConfig.persistentDroppableEntityDisplayNames) entity1.setCustomName(null);}, level, itemInHand, player).accept(entity); // Purpur - Apply display names from item forms of entities to entities and vice versa
if (entity.survives()) {
if (!level.isClientSide()) {
// CraftBukkit start - fire HangingPlaceEvent

View File

@@ -0,0 +1,171 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sat, 5 Dec 2020 01:20:16 -0800
Subject: [PATCH] Option for Villager Clerics to farm Nether Wart
Adds an option so that Villagers with the Cleric profession are able to
farm Nether Wart. Reimplemented based on a feature of the carpet-extra
mod.
diff --git a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
index c49f72d3554c5cf49cbbc57897288da876b4e5f5..9318b27ca960ee00774892b3fd244b0fca1f6e35 100644
--- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
+++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
@@ -31,6 +31,7 @@ public class HarvestFarmland extends Behavior<Villager> {
private long nextOkStartTime;
private int timeWorkedSoFar;
private final List<BlockPos> validFarmlandAroundVillager = Lists.newArrayList();
+ private boolean clericWartFarmer = false; // Purpur - Option for Villager Clerics to farm Nether Wart
public HarvestFarmland() {
super(
@@ -49,9 +50,10 @@ public class HarvestFarmland extends Behavior<Villager> {
protected boolean checkExtraStartConditions(final ServerLevel level, final Villager body) {
if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) {
return false;
- } else if (!body.getVillagerData().profession().is(VillagerProfession.FARMER)) {
+ } else if (!body.getVillagerData().profession().is(VillagerProfession.FARMER) && !(level.purpurConfig.villagerClericsFarmWarts && body.getVillagerData().profession().is(VillagerProfession.CLERIC))) { // Purpur - Option for Villager Clerics to farm Nether Wart
return false;
} else {
+ if (!this.clericWartFarmer && body.getVillagerData().profession().is(VillagerProfession.CLERIC)) this.clericWartFarmer = true; // Purpur - Option for Villager Clerics to farm Nether Wart
BlockPos.MutableBlockPos mutPos = body.blockPosition().mutable();
this.validFarmlandAroundVillager.clear();
@@ -81,6 +83,7 @@ public class HarvestFarmland extends Behavior<Villager> {
BlockState state = level.getBlockState(blockPos);
Block block = state.getBlock();
Block blockBelow = level.getBlockState(blockPos.below()).getBlock();
+ if (this.clericWartFarmer) return block == net.minecraft.world.level.block.Blocks.NETHER_WART && state.getValue(net.minecraft.world.level.block.NetherWartBlock.AGE) == 3 || state.isAir() && block == net.minecraft.world.level.block.Blocks.SOUL_SAND; // Purpur - Option for Villager Clerics to farm Nether Wart
return block instanceof CropBlock && ((CropBlock)block).isMaxAge(state) || state.isAir() && blockBelow instanceof FarmlandBlock;
}
@@ -107,19 +110,19 @@ public class HarvestFarmland extends Behavior<Villager> {
BlockState blockState = level.getBlockState(this.aboveFarmlandPos);
Block block = blockState.getBlock();
Block blockBelow = level.getBlockState(this.aboveFarmlandPos.below()).getBlock();
- if (block instanceof CropBlock && ((CropBlock)block).isMaxAge(blockState)) {
+ if (block instanceof CropBlock && ((CropBlock)block).isMaxAge(blockState) && !this.clericWartFarmer || this.clericWartFarmer && block == net.minecraft.world.level.block.Blocks.NETHER_WART && blockState.getValue(net.minecraft.world.level.block.NetherWartBlock.AGE) == 3) { // Purpur - Option for Villager Clerics to farm Nether Wart
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(body, this.aboveFarmlandPos, blockState.getFluidState().createLegacyBlock())) { // CraftBukkit // Paper - fix wrong block state
level.destroyBlock(this.aboveFarmlandPos, true, body);
} // CraftBukkit
}
- if (blockState.isAir() && blockBelow instanceof FarmlandBlock && body.hasFarmSeeds()) {
+ if (blockState.isAir() && blockBelow instanceof FarmlandBlock && !this.clericWartFarmer || this.clericWartFarmer && blockBelow == net.minecraft.world.level.block.Blocks.SOUL_SAND && body.hasFarmSeeds()) { // Purpur - Option for Villager Clerics to farm Nether Wart
SimpleContainer inventory = body.getInventory();
for (int i = 0; i < inventory.getContainerSize(); i++) {
ItemStack itemStack = inventory.getItem(i);
boolean ok = false;
- if (!itemStack.isEmpty() && itemStack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS) && itemStack.getItem() instanceof BlockItem blockItem) {
+ if (!itemStack.isEmpty() && (itemStack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS) || this.clericWartFarmer && itemStack.getItem() == net.minecraft.world.item.Items.NETHER_WART) && itemStack.getItem() instanceof BlockItem blockItem) { // Purpur - Option for Villager Clerics to farm Nether Wart
BlockState place = blockItem.getBlock().defaultBlockState();
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(body, this.aboveFarmlandPos, place)) { // CraftBukkit
level.setBlockAndUpdate(this.aboveFarmlandPos, place);
@@ -134,7 +137,7 @@ public class HarvestFarmland extends Behavior<Villager> {
this.aboveFarmlandPos.getX(),
this.aboveFarmlandPos.getY(),
this.aboveFarmlandPos.getZ(),
- SoundEvents.CROP_PLANTED,
+ this.clericWartFarmer ? SoundEvents.NETHER_WART_PLANTED : SoundEvents.CROP_PLANTED, // Purpur - Option for Villager Clerics to farm Nether Wart
SoundSource.BLOCKS,
1.0F,
1.0F
diff --git a/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java b/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
index 1d405a77c4cf70bd818a4f59163e5b319808d5f3..6a7b51acfc2cd157ce81c3a92d2633375cb1a6a7 100644
--- a/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
+++ b/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
@@ -59,6 +59,12 @@ public class TradeWithVillager extends Behavior<Villager> {
throwHalfStack(body, ImmutableSet.of(Items.WHEAT), target);
}
+ // Purpur start - Option for Villager Clerics to farm Nether Wart
+ if (level.purpurConfig.villagerClericsFarmWarts && level.purpurConfig.villagerClericFarmersThrowWarts && body.getVillagerData().profession().is(VillagerProfession.CLERIC) && body.getInventory().countItem(Items.NETHER_WART) > Items.NETHER_WART.getDefaultMaxStackSize() / 2) {
+ throwHalfStack(body, ImmutableSet.of(Items.NETHER_WART), target);
+ }
+ // Purpur end - Option for Villager Clerics to farm Nether Wart
+
if (!this.trades.isEmpty() && body.getInventory().hasAnyOf(this.trades)) {
throwHalfStack(body, this.trades, target);
}
diff --git a/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java b/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java
index a5d1b66b07002545381dfc449a2eda26546b904c..0e5039e07c3df288e4b1377225ac52cc96675b66 100644
--- a/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java
+++ b/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java
@@ -74,8 +74,13 @@ public class VillagerGoalPackages {
public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getWorkPackage(
final Holder<VillagerProfession> profession, final float speedModifier
) {
+ // Purpur start - Option for Villager Clerics to farm Nether Wart
+ return getWorkPackage(profession, speedModifier, false);
+ }
+ public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getWorkPackage(Holder<VillagerProfession> profession, float speedModifier, boolean clericsFarmWarts) {
+ // Purpur end - Option for Villager Clerics to farm Nether Wart
WorkAtPoi workAtPoi;
- if (profession.is(VillagerProfession.FARMER)) {
+ if (profession.is(VillagerProfession.FARMER) || (clericsFarmWarts && profession.is(VillagerProfession.CLERIC))) { // Purpur - Option for Villager Clerics to farm Nether Wart
workAtPoi = new WorkAtComposter();
} else {
workAtPoi = new WorkAtPoi();
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
index ec12508c112b1e7748a5d197b73a0d540bed10fc..f2daabad51d565cae11e8bfce8b1bf40a7e56a78 100644
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
@@ -22,6 +22,13 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
@Override
protected void doTick(final ServerLevel level, final Villager body) {
+ // Purpur start - Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off
+ Brain<?> brain = body.getBrain();
+ if (!level.purpurConfig.villagerClericsFarmWarts && body.getVillagerData().profession().is(net.minecraft.world.entity.npc.villager.VillagerProfession.CLERIC)) {
+ brain.eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
+ return;
+ }
+ // Purpur end - Option for Villager Clerics to farm Nether Wart
ResourceKey<Level> dimensionType = level.dimension();
BlockPos center = body.blockPosition();
List<GlobalPos> jobSites = Lists.newArrayList();
@@ -38,7 +45,7 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
}
}
- Brain<?> brain = body.getBrain();
+ //Brain<?> brain = body.getBrain(); // Purpur - Option for Villager Clerics to farm Nether Wart - moved up
if (!jobSites.isEmpty()) {
brain.setMemory(MemoryModuleType.SECONDARY_JOB_SITE, jobSites);
} else {
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
index 6105aa39baf888dd625f4d345822a4058bf83ef4..fffc71d2f0cd0d4c4f5d8fad38130208cdbe5e67 100644
--- a/net/minecraft/world/entity/npc/villager/Villager.java
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
@@ -148,7 +148,7 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
activities.add(
ActivityData.create(
Activity.WORK,
- VillagerGoalPackages.getWorkPackage(profession, 0.5F),
+ VillagerGoalPackages.getWorkPackage(profession, 0.5F, body.level().purpurConfig.villagerClericsFarmWarts), // Purpur - Option for Villager Clerics to farm Nether Wart
ImmutableSet.of(Pair.of(MemoryModuleType.JOB_SITE, MemoryStatus.VALUE_PRESENT))
)
);
@@ -945,7 +945,7 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
}
public boolean hasFarmSeeds() {
- return this.getInventory().hasAnyMatching(item -> item.is(ItemTags.VILLAGER_PLANTABLE_SEEDS));
+ return this.getInventory().hasAnyMatching(item -> this.level().purpurConfig.villagerClericsFarmWarts && this.getVillagerData().profession().is(VillagerProfession.CLERIC) ? item.is(Items.NETHER_WART) : item.is(ItemTags.VILLAGER_PLANTABLE_SEEDS));
}
@Override
diff --git a/net/minecraft/world/entity/npc/villager/VillagerProfession.java b/net/minecraft/world/entity/npc/villager/VillagerProfession.java
index 1d779d7a51437581fa3d8da38449916362b25ce9..9d71db9db42e38338afe10b24699dae9cc90fcfa 100644
--- a/net/minecraft/world/entity/npc/villager/VillagerProfession.java
+++ b/net/minecraft/world/entity/npc/villager/VillagerProfession.java
@@ -165,6 +165,8 @@ public record VillagerProfession(
registry,
CLERIC,
PoiTypes.CLERIC,
+ ImmutableSet.of(Items.NETHER_WART), // Purpur - Option for Villager Clerics to farm Nether Wart
+ ImmutableSet.of(Blocks.SOUL_SAND), // Purpur - Option for Villager Clerics to farm Nether Wart
SoundEvents.VILLAGER_WORK_CLERIC,
Int2ObjectMap.ofEntries(
Int2ObjectMap.entry(1, TradeSets.CLERIC_LEVEL_1),

View File

@@ -0,0 +1,378 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 5 Jan 2021 22:21:56 -0500
Subject: [PATCH] Add mobGriefing override to everything affected
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 2e7e5c4c42bcdb6135a088ffe0a7a8f4558dc12c..7146381e06ed1b946ce43dca293f52da05b46314 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1950,7 +1950,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (this.level() instanceof ServerLevel serverLevel) {
boolean var6 = false;
if (this.dead && killer instanceof WitherBoss) { // Paper
- if (serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.witherMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
BlockPos pos = this.blockPosition();
BlockState state = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level().getBlockState(pos).isAir() && state.canSurvive(this.level(), pos)) {
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index be578b5d4430e934342d3e80b70a1ea56b020a5c..43f1a9287d2a3010d35a88d58df3e950f1011eec 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -560,7 +560,7 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
&& this.canPickUpLoot()
&& this.isAlive()
&& !this.dead
- && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.entitiesPickUpLootMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
Vec3i pickupReach = this.getPickupReach();
for (ItemEntity entity : this.level()
diff --git a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
index 9318b27ca960ee00774892b3fd244b0fca1f6e35..573eb81c0328b9b6bd9256d67e533b6cc73f738f 100644
--- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
+++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
@@ -48,7 +48,7 @@ public class HarvestFarmland extends Behavior<Villager> {
@Override
protected boolean checkExtraStartConditions(final ServerLevel level, final Villager body) {
- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (!level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.villagerMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
return false;
} else if (!body.getVillagerData().profession().is(VillagerProfession.FARMER) && !(level.purpurConfig.villagerClericsFarmWarts && body.getVillagerData().profession().is(VillagerProfession.CLERIC))) { // Purpur - Option for Villager Clerics to farm Nether Wart
return false;
diff --git a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
index e33598c3ea748f81c7efcaa06d9d0597624a852b..80a42d030969e264a93108ca3f2c296dd295ad1d 100644
--- a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
+++ b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
@@ -31,7 +31,7 @@ public class BreakDoorGoal extends DoorInteractGoal {
@Override
public boolean canUse() {
return super.canUse()
- && getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING)
+ && getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.zombieMobGriefingOverride) // Purpur - Add mobGriefing override to everything affected
&& this.isValidDifficulty(this.mob.level().getDifficulty())
&& !this.isOpen();
}
diff --git a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
index 0f52b048c33f3dbafd5734dc724bcd74db43884a..a40284d4f3812a169e94593ec14192e079133bd4 100644
--- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
+++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
@@ -64,7 +64,7 @@ public class EatBlockGoal extends Goal {
BlockPos pos = this.mob.blockPosition();
final BlockState blockState = this.level.getBlockState(pos); // Paper - fix wrong block state
if (IS_EDIBLE.test(blockState)) { // Paper - fix wrong block state
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, pos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING))) { // CraftBukkit // Paper - fix wrong block state
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, pos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.level).purpurConfig.sheepMobGriefingOverride))) { // CraftBukkit // Paper - fix wrong block state // Purpur - Add mobGriefing override to everything affected
this.level.destroyBlock(pos, false);
}
@@ -72,7 +72,7 @@ public class EatBlockGoal extends Goal {
} else {
BlockPos below = pos.below();
if (this.level.getBlockState(below).is(Blocks.GRASS_BLOCK)) {
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, below, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING))) { // CraftBukkit // Paper - Fix wrong block state
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, below, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.level).purpurConfig.sheepMobGriefingOverride))) { // CraftBukkit // Paper - Fix wrong block state // Purpur - Add mobGriefing override to everything affected
this.level.levelEvent(LevelEvent.PARTICLES_DESTROY_BLOCK, below, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
this.level.setBlock(below, Blocks.DIRT.defaultBlockState(), Block.UPDATE_CLIENTS);
}
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
index ca91cadd8d52c09a735e6447664bed4753f3cdd3..3277777cb8672d29a0d49ef03f9cf35cc5df3838 100644
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
@@ -34,7 +34,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@Override
public boolean canUse() {
- if (!getServerLevel(this.removerMob).getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (!getServerLevel(this.removerMob).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.removerMob).purpurConfig.zombieMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
return false;
} else if (this.nextStartTick > 0) {
this.nextStartTick--;
diff --git a/net/minecraft/world/entity/animal/fox/Fox.java b/net/minecraft/world/entity/animal/fox/Fox.java
index 9c049b34c062113a2241fdda2eaae808c0e8e0b1..f781d02d10317bf7cf9b5fe50706bbefb62820d3 100644
--- a/net/minecraft/world/entity/animal/fox/Fox.java
+++ b/net/minecraft/world/entity/animal/fox/Fox.java
@@ -1082,7 +1082,7 @@ public class Fox extends Animal {
}
protected void onReachedTarget() {
- if (getServerLevel(Fox.this.level()).getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (getServerLevel(Fox.this.level()).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(Fox.this.level()).purpurConfig.foxMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
BlockState state = Fox.this.level().getBlockState(this.blockPos);
if (state.is(Blocks.SWEET_BERRY_BUSH)) {
this.pickSweetBerries(state);
diff --git a/net/minecraft/world/entity/animal/golem/SnowGolem.java b/net/minecraft/world/entity/animal/golem/SnowGolem.java
index bd594838ae25f16e6e16335e06c4d981c5ecdc2a..7091f5bc2ecb9d4b86162fe364447df65d8e9348 100644
--- a/net/minecraft/world/entity/animal/golem/SnowGolem.java
+++ b/net/minecraft/world/entity/animal/golem/SnowGolem.java
@@ -135,7 +135,7 @@ public class SnowGolem extends AbstractGolem implements RangedAttackMob, Shearab
this.hurtServer(serverLevel, this.damageSources().onFire().knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.MELTING), 1.0F); // CraftBukkit
}
- if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.snowGolemMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
return;
}
diff --git a/net/minecraft/world/entity/animal/rabbit/Rabbit.java b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
index 3aefbdc3e537bc53bba296c7876dee93c95a77ca..4d79ce89c21ba0b973bbda01bf53665e3b7a1902 100644
--- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java
+++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
@@ -696,7 +696,7 @@ public class Rabbit extends Animal {
@Override
public boolean canUse() {
if (this.nextStartTick <= 0) {
- if (!getServerLevel(this.rabbit).getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (!getServerLevel(this.rabbit).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.rabbit).purpurConfig.rabbitMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
return false;
}
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 7e39604a02561880a10d4bcebcd76135f9c1a122..51ca6a3fa75f3aef715d786a21327452390dde94 100644
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -541,7 +541,7 @@ public class EnderDragon extends Mob implements Enemy {
BlockPos blockPos = new BlockPos(x, y, z);
BlockState state = level.getBlockState(blockPos);
if (!state.isAir() && !state.is(BlockTags.DRAGON_TRANSPARENT)) {
- if (level.getGameRules().get(GameRules.MOB_GRIEFING) && !state.is(BlockTags.DRAGON_IMMUNE)) {
+ if (level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.enderDragonMobGriefingOverride) && !state.is(BlockTags.DRAGON_IMMUNE)) { // Purpur - Add mobGriefing override to everything affected
// CraftBukkit start - Add blocks to list rather than destroying them
//flag1 = level.removeBlock(blockPos, false) || flag1;
destroyedBlock = true;
diff --git a/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
index 141b64eb1f320d2bc773e99826fc97cc10f39bcd..3e934aee6f651843d861cc87cc1f01a87742edf3 100644
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -493,7 +493,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
if (this.destroyBlocksTick > 0) {
this.destroyBlocksTick--;
- if (this.destroyBlocksTick == 0 && level.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (this.destroyBlocksTick == 0 && level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.witherMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
boolean destroyed = false;
int width = Mth.floor(this.getBbWidth() / 2.0F + 1.0F);
int height = Mth.floor(this.getBbHeight());
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
index 30450300bdf9e4b5ef4293e9c371484ba6aabebc..46a60e17837411e46a543d6f0254d7280d30a94c 100644
--- a/net/minecraft/world/entity/monster/EnderMan.java
+++ b/net/minecraft/world/entity/monster/EnderMan.java
@@ -505,7 +505,7 @@ public class EnderMan extends Monster implements NeutralMob {
public boolean canUse() {
if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
return this.enderman.getCarriedBlock() != null
- && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING)
+ && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING, this.enderman.level().purpurConfig.endermanMobGriefingOverride) // Purpur - Add mobGriefing override to everything affected
&& this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0;
}
@@ -649,7 +649,7 @@ public class EnderMan extends Monster implements NeutralMob {
public boolean canUse() {
if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
return this.enderman.getCarriedBlock() == null
- && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING)
+ && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING, this.enderman.level().purpurConfig.endermanMobGriefingOverride) // Purpur - Add mobGriefing override to everything affected
&& this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0;
}
diff --git a/net/minecraft/world/entity/monster/Ravager.java b/net/minecraft/world/entity/monster/Ravager.java
index 878fee0c45a34c334d30239711231f2ef990e926..e0ffded3500b221d5c65cff9377120e8c6c7d8c6 100644
--- a/net/minecraft/world/entity/monster/Ravager.java
+++ b/net/minecraft/world/entity/monster/Ravager.java
@@ -177,7 +177,7 @@ public class Ravager extends Raider {
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, baseValue, maxSpeed));
}
- if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.ravagerMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
boolean destroyedBlock = false;
AABB bb = this.getBoundingBox().inflate(0.2);
diff --git a/net/minecraft/world/entity/monster/Silverfish.java b/net/minecraft/world/entity/monster/Silverfish.java
index 355475b12c6f3fcc9fe88ca63ab88cabac9d6fb1..e5a0a199685366f082904eb5e7550f0160f9c706 100644
--- a/net/minecraft/world/entity/monster/Silverfish.java
+++ b/net/minecraft/world/entity/monster/Silverfish.java
@@ -168,7 +168,7 @@ public class Silverfish extends Monster {
return false;
} else {
RandomSource random = this.mob.getRandom();
- if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) {
+ if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.mob).purpurConfig.silverfishMobGriefingOverride) && random.nextInt(reducedTickDelay(10)) == 0) { // Purpur - Add mobGriefing override to everything affected
this.selectedDirection = Direction.getRandom(random);
BlockPos pos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection);
BlockState blockState = this.mob.level().getBlockState(pos);
@@ -245,7 +245,7 @@ public class Silverfish extends Monster {
Block block = blockState.getBlock();
if (block instanceof InfestedBlock) {
// CraftBukkit start
- BlockState afterState = getServerLevel(level).getGameRules().get(GameRules.MOB_GRIEFING) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(testPos)); // Paper - fix wrong block state
+ BlockState afterState = getServerLevel(level).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(level).purpurConfig.silverfishMobGriefingOverride) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(testPos)); // Paper - fix wrong block state // Purpur - Add mobGriefing override to everything affected
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, testPos, afterState)) { // Paper - fix wrong block state
continue;
}
diff --git a/net/minecraft/world/entity/monster/illager/Evoker.java b/net/minecraft/world/entity/monster/illager/Evoker.java
index 4de0c340b1fb8baa9ed379ea010ca6d314530268..d091a12ed1df31f945a04f50af1cbb89a16ca0cd 100644
--- a/net/minecraft/world/entity/monster/illager/Evoker.java
+++ b/net/minecraft/world/entity/monster/illager/Evoker.java
@@ -334,7 +334,7 @@ public class Evoker extends SpellcasterIllager {
return false;
} else {
ServerLevel level = getServerLevel(Evoker.this.level());
- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) {
+ if (!level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.evokerMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
return false;
} else {
List<Sheep> entities = level.getNearbyEntities(
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index 0d0a86b5c485a60d0e85b3acc6f0cc01ce6c0bfe..356fc7507b58cc38cdf5ee11618ad3551fb3c6a2 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -416,7 +416,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
public boolean wantsToPickUp(final ServerLevel level, final ItemStack itemStack) {
- return level.getGameRules().get(GameRules.MOB_GRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack);
+ return level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.piglinMobGriefingOverride) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack); // Purpur - Add mobGriefing override to everything affected
}
protected boolean canReplaceCurrentItem(final ItemStack newItemStack) {
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
index 289fe996f5663f82c488d1c861389b83da787ff9..34df1e7ec42ecfb9ec4ef87e9f6a619298668d35 100644
--- a/net/minecraft/world/entity/projectile/Projectile.java
+++ b/net/minecraft/world/entity/projectile/Projectile.java
@@ -473,7 +473,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@Override
public boolean mayInteract(final ServerLevel level, final BlockPos pos) {
Entity owner = this.getOwner();
- return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.getGameRules().get(GameRules.MOB_GRIEFING);
+ return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.projectilesMobGriefingOverride); // Purpur - Add mobGriefing override to everything affected
}
public boolean mayBreak(final ServerLevel level) {
diff --git a/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java b/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java
index 711b97aa9e49b7edee34c91d77b1005be4fa96bd..bcda871c7db7a13f85e04e8fb91be13da15992bc 100644
--- a/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java
+++ b/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java
@@ -20,20 +20,20 @@ public class LargeFireball extends Fireball {
public LargeFireball(final EntityType<? extends LargeFireball> type, final Level level) {
super(type, level);
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); // CraftBukkit
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // CraftBukkit // Purpur - Add mobGriefing override to everything affected
}
public LargeFireball(final Level level, final LivingEntity mob, final Vec3 direction, final int explosionPower) {
super(EntityType.FIREBALL, mob, direction, level);
this.explosionPower = explosionPower;
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); // CraftBukkit
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // CraftBukkit // Purpur - Add mobGriefing override to everything affected
}
@Override
protected void onHit(final HitResult hitResult) {
super.onHit(hitResult);
if (this.level() instanceof ServerLevel serverLevel) {
- // boolean grief = serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); // CraftBukkit - baked into fields (see constructor)
+ // boolean grief = serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // CraftBukkit - baked into fields (see constructor) // Purpur - Add mobGriefing override to everything affected
// CraftBukkit start - fire ExplosionPrimeEvent
org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
if (event.callEvent()) {
diff --git a/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java b/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java
index 55000ce5010321323bf79007ef8de637a492657f..b7f5f434b8b3abbaab7f65fc591ddf18308b5a2f 100644
--- a/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java
+++ b/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java
@@ -25,7 +25,7 @@ public class SmallFireball extends Fireball {
super(EntityType.SMALL_FIREBALL, mob, direction, level);
// CraftBukkit start
if (this.getOwner() != null && this.getOwner() instanceof Mob) {
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING);
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // Purpur - Add mobGriefing override to everything affected
}
// CraftBukkit end
}
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
index d09855134cef0651258db34ea29c443388fd5183..d0a9088a18e6717209f037ae48ce54db13702234 100644
--- a/net/minecraft/world/entity/raid/Raider.java
+++ b/net/minecraft/world/entity/raid/Raider.java
@@ -399,7 +399,7 @@ public abstract class Raider extends PatrollingMonster {
}
private boolean cannotPickUpBanner() {
- if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING)) return true; // Paper - respect game and entity rules for picking up items
+ if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.pillagerMobGriefingOverride)) return true; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing override to everything affected
if (!this.mob.hasActiveRaid()) {
return true;
} else if (this.mob.getCurrentRaid().isOver()) {
diff --git a/net/minecraft/world/level/block/CropBlock.java b/net/minecraft/world/level/block/CropBlock.java
index a47e5e38ef5c13da3827174121c1ec4b9ffbbce2..0dfb632b339b24564744b1f5c0d52d7fed66d265 100644
--- a/net/minecraft/world/level/block/CropBlock.java
+++ b/net/minecraft/world/level/block/CropBlock.java
@@ -177,7 +177,7 @@ public class CropBlock extends VegetationBlock implements BonemealableBlock {
final boolean isPrecise
) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().get(GameRules.MOB_GRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list
+ if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.ravagerMobGriefingOverride))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list // Purpur - Add mobGriefing override to everything affected
serverLevel.destroyBlock(pos, true, entity);
}
diff --git a/net/minecraft/world/level/block/FarmlandBlock.java b/net/minecraft/world/level/block/FarmlandBlock.java
index 8bc58baa1542443235b57633d1e563f3487a2421..b51bb36da00bdfd25724579c0a4fb572abeefd81 100644
--- a/net/minecraft/world/level/block/FarmlandBlock.java
+++ b/net/minecraft/world/level/block/FarmlandBlock.java
@@ -113,7 +113,7 @@ public class FarmlandBlock extends Block {
if (level instanceof ServerLevel serverLevel
&& (serverLevel.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= serverLevel.purpurConfig.farmlandTrampleHeight : level.getRandom().nextFloat() < fallDistance - 0.5) // Purpur - Configurable farmland trample height
&& entity instanceof LivingEntity
- && (entity instanceof Player || serverLevel.getGameRules().get(GameRules.MOB_GRIEFING))
+ && (entity instanceof Player || serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.farmlandMobGriefingOverride)) // Purpur - Add mobGriefing override to everything affected
&& entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
// CraftBukkit start - Interact soil
org.bukkit.event.Cancellable cancellable;
diff --git a/net/minecraft/world/level/block/PowderSnowBlock.java b/net/minecraft/world/level/block/PowderSnowBlock.java
index 648262547aadff8e0615a93a9834ca654e581b3a..022daf760a649720c46e6e31591f2c1ad8a8f3ea 100644
--- a/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -103,7 +103,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
// CraftBukkit - move down
&& e.mayInteract(serverLevel, position)) {
// CraftBukkit start
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(e, pos, Blocks.AIR.defaultBlockState(), !(serverLevel.getGameRules().get(GameRules.MOB_GRIEFING) || e instanceof Player))) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(e, pos, Blocks.AIR.defaultBlockState(), !(serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.powderSnowMobGriefingOverride) || e instanceof Player))) { // Purpur - Add mobGriefing override to everything affected
return;
}
// CraftBukkit end
diff --git a/net/minecraft/world/level/block/TurtleEggBlock.java b/net/minecraft/world/level/block/TurtleEggBlock.java
index 9293faf988be7013dbeddc9f98beb69a2dac9928..4f1e08c0e3f8ea89a55e02e8f0197fe4336ae0e2 100644
--- a/net/minecraft/world/level/block/TurtleEggBlock.java
+++ b/net/minecraft/world/level/block/TurtleEggBlock.java
@@ -221,7 +221,7 @@ public class TurtleEggBlock extends Block {
// Purpur end - Option to disable turtle egg trampling with feather falling
if (entity instanceof Player) return true;
- return level.getGameRules().get(GameRules.MOB_GRIEFING);
+ return level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.turtleEggsMobGriefingOverride); // Purpur - Add mobGriefing override to everything affected
// Purpur end - Add turtle egg block options
}
}
diff --git a/net/minecraft/world/level/gamerules/GameRules.java b/net/minecraft/world/level/gamerules/GameRules.java
index 0d0a4008a84defbf1ea962b4e2f73776878956ec..e2fc5dc10c6ab84cb28e2adff2f87c24c8801309 100644
--- a/net/minecraft/world/level/gamerules/GameRules.java
+++ b/net/minecraft/world/level/gamerules/GameRules.java
@@ -128,6 +128,13 @@ public class GameRules {
return this.rules.keySet().stream();
}
+ public <T> boolean get(GameRule<T> rule, Boolean gameRuleOverride) {
+ if (gameRuleOverride != null) {
+ return gameRuleOverride;
+ }
+ return (Boolean) this.get(rule);
+ }
+
public <T> T get(final GameRule<T> gameRule) {
T value = this.rules.get(gameRule);
if (value == null) {

View File

@@ -0,0 +1,310 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <ben@omega24.dev>
Date: Tue, 25 May 2021 16:31:09 -0400
Subject: [PATCH] API for any mob to burn daylight
Co-authored by: Encode42 <me@encode42.dev>
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index afcdf4aa479e27c858afab01191344e14a1f4ecc..5d581af745468f61048448c8a845990538662e3f 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -452,6 +452,21 @@ public abstract class Entity
}
// Purpur end - Add canSaveToDisk to Entity
+ // Purpur start - copied from Mob - API for any mob to burn daylight
+ public boolean isSunBurnTick() {
+ if (!this.level().isClientSide() && this.level().environmentAttributes().getValue(EnvironmentAttributes.MONSTERS_BURN, this.position())) {
+ float br = this.getLightLevelDependentMagicValue();
+ BlockPos roundedPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
+ boolean isInNonBurnableBlock = this.isInWaterOrRain() || this.isInPowderSnow || this.wasInPowderSnow;
+ if (br > 0.5F && this.random.nextFloat() * 30.0F < (br - 0.4F) * 2.0F && !isInNonBurnableBlock && this.level().canSeeSky(roundedPos)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ // Purpur end - copied from Mob - API for any mob to burn daylight
+
public Entity(final EntityType<?> type, final Level level) {
this.type = type;
this.level = level;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 7146381e06ed1b946ce43dca293f52da05b46314..08324c0a0e87eb0ed8ea111389a3a9111031e034 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -291,6 +291,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
public int invulnerableDuration = LivingEntity.INVULNERABLE_DURATION; // Paper - configurable invulnerable duration
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight
// CraftBukkit end
protected LivingEntity(final EntityType<? extends LivingEntity> type, final Level level) {
@@ -788,6 +789,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
output.putBoolean("FallFlying", this.isFallFlying());
this.getSleepingPos().ifPresent(sleepingPos -> output.store("sleeping_pos", BlockPos.CODEC, sleepingPos));
output.store("Brain", Brain.Packed.CODEC, this.brain.pack());
+ output.putBoolean("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
if (this.lastHurtByPlayer != null) {
this.lastHurtByPlayer.store(output, "last_hurt_by_player");
output.putInt("last_hurt_by_player_memory_time", this.lastHurtByPlayerMemoryTime);
@@ -912,6 +914,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
} // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong
}, this::clearSleepingPos);
input.read("Brain", Brain.Packed.CODEC).ifPresent(packedBrain -> this.brain = this.makeBrain(packedBrain));
+ this.shouldBurnInDay = input.getBooleanOr("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
this.lastHurtByPlayer = EntityReference.read(input, "last_hurt_by_player");
this.lastHurtByPlayerMemoryTime = input.getIntOr("last_hurt_by_player_memory_time", 0);
this.lastHurtByMob = EntityReference.read(input, "last_hurt_by_mob");
@@ -3915,6 +3918,37 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) {
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
}
+
+ // Purpur start - copied from Mob - API for any mob to burn daylight
+ if (this.isAlive()) {
+ boolean flag = this.shouldBurnInDay() && this.isSunBurnTick(); // Paper - shouldBurnInDay API // Purpur - use shouldBurnInDay() method to handle Phantoms properly - API for any mob to burn daylight
+ if (flag) {
+ EquipmentSlot equipmentSlot = this.sunProtectionSlot();
+ ItemStack itemBySlot = this.getItemBySlot(equipmentSlot);
+ if (!itemBySlot.isEmpty()) {
+ if (itemBySlot.isDamageableItem()) {
+ Item item = itemBySlot.getItem();
+ itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
+ if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
+ this.onEquippedItemBroken(item, equipmentSlot);
+ this.setItemSlot(equipmentSlot, ItemStack.EMPTY);
+ }
+ }
+
+ flag = false;
+ }
+
+ if (flag) {
+ if (getRider() == null || !this.isControllable()) // Purpur - ignore mobs which are uncontrollable or without rider - API for any mob to burn daylight
+ this.igniteForSeconds(8.0F);
+ }
+ }
+ }
+ }
+
+ protected EquipmentSlot sunProtectionSlot() {
+ return net.minecraft.world.entity.EquipmentSlot.HEAD;
+ // Purpur end - copied from Mob - API for any mob to burn daylight
}
protected void applyInput() {
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index 43f1a9287d2a3010d35a88d58df3e950f1011eec..44e3e723d6a796917e73012dbd03d4b36cb11a0e 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -550,9 +550,9 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
@Override
public void aiStep() {
super.aiStep();
- if (this.is(EntityTypeTags.BURN_IN_DAYLIGHT)) {
+ /*if (this.is(EntityTypeTags.BURN_IN_DAYLIGHT)) { // Purpur start - implemented in LivingEntity - API for any mob to burn daylight
this.burnUndead();
- }
+ }*/ // Purpur end - implemented in LivingEntity - API for any mob to burn daylight
ProfilerFiller profiler = Profiler.get();
profiler.push("looting");
@@ -604,16 +604,8 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
}
public boolean isSunBurnTick() {
- if (!this.level().isClientSide() && this.level().environmentAttributes().getValue(EnvironmentAttributes.MONSTERS_BURN, this.position())) {
- float br = this.getLightLevelDependentMagicValue();
- BlockPos roundedPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
- boolean isInNonBurnableBlock = this.isInWaterOrRain() || this.isInPowderSnow || this.wasInPowderSnow;
- if (br > 0.5F && this.random.nextFloat() * 30.0F < (br - 0.4F) * 2.0F && !isInNonBurnableBlock && this.level().canSeeSky(roundedPos)) {
- return true;
- }
- }
-
- return false;
+ // Purpur - implemented in Entity - API for any mob to burn daylight
+ return super.isSunBurnTick();
}
protected Vec3i getPickupReach() {
diff --git a/net/minecraft/world/entity/animal/equine/ZombieHorse.java b/net/minecraft/world/entity/animal/equine/ZombieHorse.java
index 586151b916a5e21c36578aa04cab9d71994dcf43..426b468ee821a7441d15dae3634032535cb60725 100644
--- a/net/minecraft/world/entity/animal/equine/ZombieHorse.java
+++ b/net/minecraft/world/entity/animal/equine/ZombieHorse.java
@@ -47,6 +47,7 @@ public class ZombieHorse extends AbstractHorse {
public ZombieHorse(final EntityType<? extends ZombieHorse> type, final Level level) {
super(type, level);
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
}
// Purpur start - Ridables
diff --git a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
index 18bfb321e3728d3fa0596da0b86e4b76ced2178a..ab97449bfa5e8b5615e0f2b6b16be2fe7e4233fd 100644
--- a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
+++ b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
@@ -46,6 +46,7 @@ public class ZombieNautilus extends AbstractNautilus {
public ZombieNautilus(final EntityType<? extends ZombieNautilus> type, final Level level) {
super(type, level);
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
}
// Purpur start - Configurable entity base attributes
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index 20096d8305bbfc29195834b87245c94096986ec8..6b6eed1c636f2ca65d0cbcd71e96bdd1b2063267 100644
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -53,7 +53,7 @@ public class Phantom extends Mob implements Enemy {
Vec3 crystalPosition; // Purpur - Phantoms attracted to crystals and crystals shoot phantoms
// Paper start
public java.util.@Nullable UUID spawningEntity;
- public boolean shouldBurnInDay = true;
+ //public boolean shouldBurnInDay = true; // Purpur - API for any mob to burn daylight
// Paper end
private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur - Phantoms burn in light
@@ -62,6 +62,7 @@ public class Phantom extends Mob implements Enemy {
this.xpReward = 5;
this.moveControl = new Phantom.PhantomMoveControl(this);
this.lookControl = new Phantom.PhantomLookControl(this);
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
}
// Purpur start - Ridables
@@ -298,7 +299,7 @@ public class Phantom extends Mob implements Enemy {
this.setPhantomSize(input.getIntOr("size", 0));
// Paper start
this.spawningEntity = input.read("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
- this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true);
+ //this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
// Paper end
}
@@ -309,7 +310,7 @@ public class Phantom extends Mob implements Enemy {
output.putInt("size", this.getPhantomSize());
// Paper start
output.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
// Paper end
}
diff --git a/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java b/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java
index 32da5212c85c829eeedc9d0f7904bbcaa3ce5ed3..062c7f20e73b882ef0550d90e3da47ac39a1b3a7 100644
--- a/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java
+++ b/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java
@@ -71,11 +71,12 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
AbstractSkeleton.this.setAggressive(true);
}
};
- private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API
+ //private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
protected AbstractSkeleton(final EntityType<? extends AbstractSkeleton> type, final Level level) {
super(type, level);
this.reassessWeaponGoal();
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
}
@Override
@@ -228,7 +229,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
protected void readAdditionalSaveData(final ValueInput input) {
super.readAdditionalSaveData(input);
this.reassessWeaponGoal();
- this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
+ //this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
// Paper start - silent equipping
@@ -254,7 +255,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@Override
protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output) {
super.addAdditionalSaveData(output);
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
// Paper end - shouldBurnInDay API
}
diff --git a/net/minecraft/world/entity/monster/skeleton/Parched.java b/net/minecraft/world/entity/monster/skeleton/Parched.java
index 36348e59c278e8842330e685340820c2ac9205eb..b14ea9e0f3de832fb73ae51728607486e399120b 100644
--- a/net/minecraft/world/entity/monster/skeleton/Parched.java
+++ b/net/minecraft/world/entity/monster/skeleton/Parched.java
@@ -17,6 +17,7 @@ import org.jspecify.annotations.Nullable;
public class Parched extends AbstractSkeleton {
public Parched(final EntityType<? extends AbstractSkeleton> type, final Level level) {
super(type, level);
+ this.setShouldBurnInDay(false); // Purpur - API for any mob to burn daylight
}
@Override
diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java
index 8d6262e99fb3ad98d3142ee069f07d2370ca0778..02e935edd7a6cabbf2e6fcc6c96a9601bee71acc 100644
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
@@ -35,6 +35,7 @@ public class Husk extends Zombie {
public Husk(final EntityType<? extends Husk> type, final Level level) {
super(type, level);
+ this.setShouldBurnInDay(false); // Purpur - API for any mob to burn daylight
}
// Purpur start - Ridables
@@ -92,7 +93,7 @@ public class Husk extends Zombie {
@Override
public boolean isSunSensitive() {
- return false;
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
}
@Override
diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java
index 0777e4e0c3aa932699f124c83a571ce913327740..dffb152543d06380618c36cf89374b7d11336039 100644
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
@@ -102,11 +102,12 @@ public class Zombie extends Monster {
private boolean canBreakDoors = false;
private int inWaterTime = 0;
public int conversionTime;
- private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
+ //private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
public Zombie(final EntityType<? extends Zombie> type, final Level level) {
super(type, level);
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(level.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, level.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
}
public Zombie(final Level level) {
@@ -364,6 +365,7 @@ public class Zombie extends Monster {
// CraftBukkit end
}
+ public boolean shouldBurnInDay() { return this.isSunSensitive(); } // Purpur - for ABI compatibility - API for any mob to burn daylight
public boolean isSunSensitive() {
return this.shouldBurnInDay; // Paper - Add more Zombie API
}
@@ -505,7 +507,7 @@ public class Zombie extends Monster {
output.putBoolean("CanBreakDoors", this.canBreakDoors());
output.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
output.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
+ //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
@Override
@@ -520,7 +522,7 @@ public class Zombie extends Monster {
} else {
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false);
}
- this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API
+ //this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
}
@Override

View File

@@ -0,0 +1,79 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Mon, 30 Aug 2021 22:49:53 -0500
Subject: [PATCH] Cows naturally aggressive to players chance
diff --git a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
index 34d2394006a006ea0773a52bb43b5cb3617470e5..7cd25e2b5e2e50b50fff00ca9e5c3a48ee2a3375 100644
--- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
+++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
@@ -135,7 +135,7 @@ public class DefaultAttributes {
.put(EntityType.LLAMA, Llama.createAttributes().build())
.put(EntityType.MAGMA_CUBE, MagmaCube.createAttributes().build())
.put(EntityType.MANNEQUIN, LivingEntity.createLivingAttributes().build())
- .put(EntityType.MOOSHROOM, Cow.createAttributes().build())
+ .put(EntityType.MOOSHROOM, net.minecraft.world.entity.animal.cow.AbstractCow.createAttributes().build()) // Purpur - Cows naturally aggressive to players chance
.put(EntityType.MULE, AbstractChestedHorse.createBaseChestedHorseAttributes().build())
.put(EntityType.NAUTILUS, Nautilus.createAttributes().build())
.put(EntityType.OCELOT, Ocelot.createAttributes().build())
diff --git a/net/minecraft/world/entity/animal/cow/Cow.java b/net/minecraft/world/entity/animal/cow/Cow.java
index 7d3853d693a87e5225a16285631e0e2057685c1b..cdd404f64e196629dd61035675aac984619f1e1c 100644
--- a/net/minecraft/world/entity/animal/cow/Cow.java
+++ b/net/minecraft/world/entity/animal/cow/Cow.java
@@ -25,6 +25,8 @@ import net.minecraft.world.level.storage.ValueOutput;
import org.jspecify.annotations.Nullable;
public class Cow extends AbstractCow {
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Cows naturally aggressive to players chance
+
private static final EntityDataAccessor<Holder<CowVariant>> DATA_VARIANT_ID = SynchedEntityData.defineId(Cow.class, EntityDataSerializers.COW_VARIANT);
private static final EntityDataAccessor<Holder<CowSoundVariant>> DATA_SOUND_VARIANT_ID = SynchedEntityData.defineId(
Cow.class, EntityDataSerializers.COW_SOUND_VARIANT
@@ -54,8 +56,9 @@ public class Cow extends AbstractCow {
// Purpur start - Configurable entity base attributes
@Override
public void initAttributes() {
- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
- this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur - Cows naturally aggressive to players chance
}
// Purpur end - Configurable entity base attributes
@@ -73,6 +76,13 @@ public class Cow extends AbstractCow {
}
// Purpur end - Toggle for water sensitive mob damage
+ @Override
+ protected void registerGoals() {
+ super.registerGoals();
+ this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur - Cows naturally aggressive to players chance
+ this.targetSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.player.Player.class, 10, true, false, (ignored, ignored2) -> isNaturallyAggressiveToPlayers)); // Purpur - Cows naturally aggressive to players chance
+ }
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
@@ -93,6 +103,12 @@ public class Cow extends AbstractCow {
);
}
+ // Purpur start - Cows naturally aggressive to players chance
+ public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() {
+ return AbstractCow.createAttributes().add(net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE, 0.0D);
+ }
+ // Purpur end - Cows naturally aggressive to players chance
+
@Override
protected void readAdditionalSaveData(final ValueInput input) {
super.readAdditionalSaveData(input);
@@ -116,6 +132,7 @@ public class Cow extends AbstractCow {
public SpawnGroupData finalizeSpawn(
final ServerLevelAccessor level, final DifficultyInstance difficulty, final EntitySpawnReason spawnReason, final @Nullable SpawnGroupData groupData
) {
+ this.isNaturallyAggressiveToPlayers = level.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance; // Purpur - Cows naturally aggressive to players chance
VariantUtils.selectVariantToSpawn(SpawnContext.create(level, this.blockPosition()), Registries.COW_VARIANT).ifPresent(this::setVariant);
this.setSoundVariant(CowSoundVariants.pickRandomSoundVariant(this.registryAccess(), level.getRandom()));
return super.finalizeSpawn(level, difficulty, spawnReason, groupData);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <contact@granny.dev>
Date: Mon, 8 Dec 2025 17:02:40 -0800
Subject: [PATCH] Setting to reintroduce end void rings
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 0d5558444e9b775c015148d79eb4b04355671cf9..ffc75fc2b04088573877b95c948f457ee2458bd7 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1205,6 +1205,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Purpur end - config for startup commands
+ // Purpur start - Migrate Setting to reintroduce end void rings
+ if (org.purpurmc.purpur.configuration.transformation.FarEndTerrainGenerationMigration.HAS_BEEN_REGISTERED) {
+ try {
+ org.purpurmc.purpur.PurpurConfig.config.save((java.io.File) this.options.valueOf("purpur-settings"));
+ } catch (IOException ex) {
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Could not save " + this.options.valueOf("purpur-settings"), ex);
+ }
+ }
+ // Purpur end - Migrate Setting to reintroduce end void rings
while (this.running) {
final long tickStart = System.nanoTime(); // Paper - improve tick loop
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index f27135d85936cae01823d8ae00134c4f8c6230d6..67a4038be124192eb70122e657d090bba7ec5bba 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -279,6 +279,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
+ // Purpur start - Migrate Setting to reintroduce end void rings
+ try {
+ org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
+ } catch (Exception e) {
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
+ return false;
+ }
+ org.purpurmc.purpur.PurpurConfig.registerCommands();
+ // Purpur end - Migrate Setting to reintroduce end void rings
// Paper start - initialize global and world-defaults configuration
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
@@ -295,7 +304,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
- // Purpur start - Purpur config files
+ /*// Purpur start - Purpur config files // Purpur start - Migrate Setting to reintroduce end void rings
try {
org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
} catch (Exception e) {
@@ -303,7 +312,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return false;
}
org.purpurmc.purpur.PurpurConfig.registerCommands();
- // Purpur end - Purpur config files
+ */// Purpur end - Purpur config files // Purpur end - Migrate Setting to reintroduce end void rings
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
// this.worldData.setGameType(properties.gameMode.get()); // CraftBukkit - moved to world loading

View File

@@ -0,0 +1,342 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peashooter101 <Peashooter101@yahoo.com>
Date: Sat, 13 Dec 2025 13:59:23 -0600
Subject: [PATCH] Per mob mob_griefing loot pickup override
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index 44e3e723d6a796917e73012dbd03d4b36cb11a0e..34ce53202f0b1baaaaf2e5ae1bb9aede9f70aa62 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -560,7 +560,7 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
&& this.canPickUpLoot()
&& this.isAlive()
&& !this.dead
- && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.entitiesPickUpLootMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
+ && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, checkEntityPickUpLootOverride())) { // Purpur - Check mobGriefing Overrides
Vec3i pickupReach = this.getPickupReach();
for (ItemEntity entity : this.level()
@@ -579,6 +579,12 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
profiler.pop();
}
+ // Purpur start - Check mobGriefing Overrides
+ protected @Nullable Boolean checkEntityPickUpLootOverride() {
+ return null;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
protected EquipmentSlot sunProtectionSlot() {
return EquipmentSlot.HEAD;
}
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index 3a78175273efa24a6bf98ee44fe24a4df71e63ed..86129786c9927fc5aa941207971e28ff4b20023f 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -162,6 +162,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.allayCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected Brain<Allay> makeBrain(final Brain.Packed packedBrain) {
return BRAIN_PROVIDER.makeBrain(this, packedBrain);
diff --git a/net/minecraft/world/entity/animal/fox/Fox.java b/net/minecraft/world/entity/animal/fox/Fox.java
index 335da522a9b96ebc852b4ed5f22f9fd71aec23a8..ba48b114282939c806523052b2ad82e5041f5d45 100644
--- a/net/minecraft/world/entity/animal/fox/Fox.java
+++ b/net/minecraft/world/entity/animal/fox/Fox.java
@@ -815,6 +815,13 @@ public class Fox extends Animal {
}
// Purpur end - Tulips change fox type
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.foxCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
// Paper start - Cancellable death event
protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(final ServerLevel level, final DamageSource source) {
diff --git a/net/minecraft/world/entity/monster/illager/Pillager.java b/net/minecraft/world/entity/monster/illager/Pillager.java
index e69514bf39e2acfc909cb55b1704ca3f56f704e2..20c0b12b56416bc532de4de827c88850bfd1f0f3 100644
--- a/net/minecraft/world/entity/monster/illager/Pillager.java
+++ b/net/minecraft/world/entity/monster/illager/Pillager.java
@@ -104,6 +104,13 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.pillagerCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void registerGoals() {
super.registerGoals();
diff --git a/net/minecraft/world/entity/monster/illager/Vindicator.java b/net/minecraft/world/entity/monster/illager/Vindicator.java
index c29a1aea5c09ade40e36f4cb00a677b31ad91069..d4e298ecf79ff7ebdea71b710e6df7ba72f9a0f5 100644
--- a/net/minecraft/world/entity/monster/illager/Vindicator.java
+++ b/net/minecraft/world/entity/monster/illager/Vindicator.java
@@ -96,6 +96,13 @@ public class Vindicator extends AbstractIllager {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.vindicatorCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void registerGoals() {
super.registerGoals();
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index 47bcb895bf4c6f438bb0bb82f84331487fd28c0c..93c5fa7b63548c6b1d24847f1f363c7c9e0ea0ec 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -147,6 +147,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.piglinCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void addAdditionalSaveData(final ValueOutput output) {
super.addAdditionalSaveData(output);
@@ -430,7 +437,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
public boolean wantsToPickUp(final ServerLevel level, final ItemStack itemStack) {
- return level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.piglinMobGriefingOverride) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack); // Purpur - Add mobGriefing override to everything affected
+ return level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.piglinCanPickUpLoot) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, itemStack); // Purpur - Check mobGriefing Overrides
}
protected boolean canReplaceCurrentItem(final ItemStack newItemStack) {
diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
index 0755e3ed3b940609f0211d123c0c664905af56b5..3a33976a667d9d9b446b6b27b5938aff8f5d9ab6 100644
--- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -89,6 +89,13 @@ public class PiglinBrute extends AbstractPiglin {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.piglinBruteCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
public static AttributeSupplier.Builder createAttributes() {
return Monster.createMonsterAttributes()
.add(Attributes.MAX_HEALTH, 50.0)
diff --git a/net/minecraft/world/entity/monster/skeleton/Bogged.java b/net/minecraft/world/entity/monster/skeleton/Bogged.java
index 50dd01a2092f87fd9015c982f728f14965be5b81..410c5f8e1571970e8043eb5d976cd6d8b95689eb 100644
--- a/net/minecraft/world/entity/monster/skeleton/Bogged.java
+++ b/net/minecraft/world/entity/monster/skeleton/Bogged.java
@@ -66,6 +66,13 @@ public class Bogged extends AbstractSkeleton implements Shearable {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.boggedCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/monster/skeleton/Skeleton.java b/net/minecraft/world/entity/monster/skeleton/Skeleton.java
index 7d0c6fe7290e8ad44c451b431778e1b7fe37c6e5..c5b261f36f6042a395b8e1a7d54b20339e81b4b8 100644
--- a/net/minecraft/world/entity/monster/skeleton/Skeleton.java
+++ b/net/minecraft/world/entity/monster/skeleton/Skeleton.java
@@ -64,6 +64,13 @@ public class Skeleton extends AbstractSkeleton {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.skeletonCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/monster/skeleton/Stray.java b/net/minecraft/world/entity/monster/skeleton/Stray.java
index 76f28568aecf019ce7432ff89593b2ed4eaff8a2..e761c97212e380b6978e5fbd1d808f4ddbb89bb5 100644
--- a/net/minecraft/world/entity/monster/skeleton/Stray.java
+++ b/net/minecraft/world/entity/monster/skeleton/Stray.java
@@ -61,6 +61,13 @@ public class Stray extends AbstractSkeleton {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.strayCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
public static boolean checkStraySpawnRules(
final EntityType<Stray> type, final ServerLevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
) {
diff --git a/net/minecraft/world/entity/monster/skeleton/WitherSkeleton.java b/net/minecraft/world/entity/monster/skeleton/WitherSkeleton.java
index 3c3c53de82856033aab31c6b03e90ba647223fa7..afc6272905cf6ab464cca03b37b5e6c868094796 100644
--- a/net/minecraft/world/entity/monster/skeleton/WitherSkeleton.java
+++ b/net/minecraft/world/entity/monster/skeleton/WitherSkeleton.java
@@ -73,6 +73,13 @@ public class WitherSkeleton extends AbstractSkeleton {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.witherSkeletonCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void registerGoals() {
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractPiglin.class, true));
diff --git a/net/minecraft/world/entity/monster/zombie/Drowned.java b/net/minecraft/world/entity/monster/zombie/Drowned.java
index 07242b2e6ab055122360035f058c39d54dbb8dc7..3a1152e07b2cc0ee4cf84651ada3c987dc704e91 100644
--- a/net/minecraft/world/entity/monster/zombie/Drowned.java
+++ b/net/minecraft/world/entity/monster/zombie/Drowned.java
@@ -147,6 +147,13 @@ public class Drowned extends Zombie implements RangedAttackMob {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.drownedCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void addBehaviourGoals() {
this.goalSelector.addGoal(1, new Drowned.DrownedGoToWaterGoal(this, 1.0));
diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java
index 5d60b230eeaec9d37e286019b8d4276cfa85a9ea..55b2bd676f2e9633fc8250bcd984424e8c37e2ee 100644
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
@@ -98,6 +98,13 @@ public class Husk extends Zombie {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.huskCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
public boolean isSunSensitive() {
return this.shouldBurnInDay; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java
index 68070943966aac17e1878f6730781cf2b603be7a..88552e60c0b6b4bd68c3b82e84f2a7493803e6ec 100644
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
@@ -167,6 +167,13 @@ public class Zombie extends Monster {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.zombieCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
diff --git a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
index 3e96d18ed2fb67c08e77b17ec7f6418fbb5caf8f..e5eb30d3620937af3cd294bdd6b985fbb61df534 100644
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
@@ -145,6 +145,13 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.zombieVillagerCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void defineSynchedData(final SynchedEntityData.Builder entityData) {
super.defineSynchedData(entityData);
diff --git a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
index 9e893c0c033dcc2273275b92048d9b1a941d93f2..54ba4d2e8305e2d9ba0c9e71bae67bfd7b7d34b9 100644
--- a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
@@ -124,6 +124,13 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.zombifiedPiglinCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
protected void addBehaviourGoals() {
this.goalSelector.addGoal(1, new SpearUseGoal<>(this, 1.0, 1.0, 10.0F, 2.0F));
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
index 297eba0bcf340f83c5d12ced343ccbfc738d4d35..dab982eed3c702486c1daaa480d795723102e164 100644
--- a/net/minecraft/world/entity/npc/villager/Villager.java
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
@@ -298,6 +298,13 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
}
// Purpur end - Mobs always drop experience
+ // Purpur start - Check mobGriefing Overrides
+ @Override
+ protected Boolean checkEntityPickUpLootOverride() {
+ return this.level().purpurConfig.villagerCanPickUpLoot;
+ }
+ // Purpur end - Check mobGriefing Overrides
+
@Override
public Brain<Villager> getBrain() {
return (Brain<Villager>) super.getBrain();
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
index d0a9088a18e6717209f037ae48ce54db13702234..5e5c5a8362537c6ff205eed7223a3bbdbf05da4a 100644
--- a/net/minecraft/world/entity/raid/Raider.java
+++ b/net/minecraft/world/entity/raid/Raider.java
@@ -399,7 +399,7 @@ public abstract class Raider extends PatrollingMonster {
}
private boolean cannotPickUpBanner() {
- if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.pillagerMobGriefingOverride)) return true; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing override to everything affected
+ if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.pillagerCanPickUpLoot)) return true; // Paper - respect game and entity rules for picking up items // Purpur - Check mobGriefing Overrides
if (!this.mob.hasActiveRaid()) {
return true;
} else if (this.mob.getCurrentRaid().isOver()) {