and thats all the patches \o/ now the real work begins

This commit is contained in:
William Blake Galbreath
2021-06-21 18:02:46 -05:00
parent 2e30575430
commit f24181b4e7
25 changed files with 964 additions and 986 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Breedable parrots
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
index 553b0aff0ccc5baf41d5faae1a2fd88249dd5a74..73a58ee1e11396a77d2ff44c5eb1f87225402380 100644
index 553b0aff0ccc5baf41d5faae1a2fd88249dd5a74..3da2b68fb03a80676d7a5eed271499f6c4612c61 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -210,6 +210,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@@ -24,15 +24,16 @@ index 553b0aff0ccc5baf41d5faae1a2fd88249dd5a74..73a58ee1e11396a77d2ff44c5eb1f872
return InteractionResult.sidedSuccess(this.level.isClientSide);
} else if (itemstack.is(Parrot.POISONOUS_FOOD)) {
if (!player.getAbilities().instabuild) {
@@ -350,6 +352,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@@ -349,7 +351,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@Override
public boolean isFood(ItemStack stack) {
return false;
- return false;
+ return this.level.purpurConfig.parrotBreedable && Parrot.TAME_FOOD.contains(stack.getItem()); // Purpur
}
public static boolean checkParrotSpawnRules(EntityType<Parrot> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
@@ -368,13 +371,13 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@@ -368,13 +370,13 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@Override
public boolean canMate(Animal other) {

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Callum Seabrook <callum.seabrook@prevarinite.com>
Date: Fri, 14 May 2021 21:22:57 +0100
Subject: [PATCH] Configurable powered rail boost modifier
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 1e3077a22d9d3d26356b865001dcce81c9c1d7e5..cc57ff699d159a0cc748e91b61d53965ac822ff4 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -715,7 +715,7 @@ public abstract class AbstractMinecart extends Entity {
if (d18 > 0.01D) {
double d20 = 0.06D;
- this.setDeltaMovement(vec3d4.add(vec3d4.x / d18 * 0.06D, 0.0D, vec3d4.z / d18 * 0.06D));
+ this.setDeltaMovement(vec3d4.add(vec3d4.x / d18 * this.level.purpurConfig.poweredRailBoostModifier, 0.0D, vec3d4.z / d18 * this.level.purpurConfig.poweredRailBoostModifier)); // Purpur
} else {
Vec3 vec3d5 = this.getDeltaMovement();
double d21 = vec3d5.x;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 4da142bbe5197c1c5e5d7cc8c6282a544368df1a..862ce1c1fa39d8ed68bc7fdabd2d092aa1f95719 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -213,6 +213,7 @@ public class PurpurWorldConfig {
public boolean minecartControllableFallDamage = true;
public double minecartControllableBaseSpeed = 0.1D;
public Map<Block, Double> minecartControllableBlockSpeeds = new HashMap<>();
+ public double poweredRailBoostModifier = 0.06;
private void minecartSettings() {
if (PurpurConfig.version < 12) {
boolean oldBool = getBoolean("gameplay-mechanics.controllable-minecarts.place-anywhere", minecartPlaceAnywhere);
@@ -265,6 +266,7 @@ public class PurpurWorldConfig {
set("gameplay-mechanics.minecart.controllable.block-speed.grass_block", 0.3D);
set("gameplay-mechanics.minecart.controllable.block-speed.stone", 0.5D);
}
+ poweredRailBoostModifier = getDouble("gameplay-mechanics.minecart.powered-rail.boost-modifier", poweredRailBoostModifier);
}
public boolean catSpawning;

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Mon, 17 May 2021 02:40:13 +0200
Subject: [PATCH] Add config change multiplier critical damage value
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index dc5ce9a61a20870f4321412ea1e78cc4aa340f97..18f198fb410b579390fc93c848fda34b407b39b4 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1254,7 +1254,7 @@ public abstract class Player extends LivingEntity {
flag2 = flag2 && !this.isSprinting();
if (flag2) {
this.isCritical = true; // Purpur
- f *= 1.5F;
+ f *= this.level.purpurConfig.playerCriticalDamageMultiplier; // Purpur
}
f += f1;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 862ce1c1fa39d8ed68bc7fdabd2d092aa1f95719..9198629e35b60e84f3c1382ee2e51e2d843c4465 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -311,6 +311,7 @@ public class PurpurWorldConfig {
public boolean creativeOnePunch = false;
public boolean playerSleepNearMonsters = false;
public boolean playersSkipNight = true;
+ public double playerCriticalDamageMultiplier = 1.5D;
private void playerSettings() {
idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
@@ -326,6 +327,7 @@ public class PurpurWorldConfig {
creativeOnePunch = getBoolean("gameplay-mechanics.player.one-punch-in-creative", creativeOnePunch);
playerSleepNearMonsters = getBoolean("gameplay-mechanics.player.sleep-ignore-nearby-mobs", playerSleepNearMonsters);
playersSkipNight = getBoolean("gameplay-mechanics.player.can-skip-night", playersSkipNight);
+ playerCriticalDamageMultiplier = getDouble("gameplay-mechanics.player.critical-damage-multiplier", playerCriticalDamageMultiplier);
}
public int snowballDamage = -1;

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 17 May 2021 04:46:23 -0500
Subject: [PATCH] Option to disable dragon egg teleporting
diff --git a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java
index 78f51f3dd0e7249af69228479da932e9aea982d6..d9d4421f7f316281487828739168cfd6febf2bf5 100644
--- a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java
@@ -41,6 +41,7 @@ public class DragonEggBlock extends FallingBlock {
}
private void teleport(BlockState state, Level world, BlockPos pos) {
+ if (!world.purpurConfig.dragonEggTeleport) return; // Purpur
for (int i = 0; i < 1000; ++i) {
BlockPos blockposition1 = pos.offset(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 9198629e35b60e84f3c1382ee2e51e2d843c4465..346eba732b7d4f26bc94e494d1576c32e9c6e2fd 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -534,6 +534,11 @@ public class PurpurWorldConfig {
});
}
+ public boolean dragonEggTeleport = true;
+ private void dragonEggSettings() {
+ dragonEggTeleport = getBoolean("blocks.dragon_egg.teleport", dragonEggTeleport);
+ }
+
public boolean baselessEndCrystalExplode = true;
public double baselessEndCrystalExplosionPower = 6.0D;
public boolean baselessEndCrystalExplosionFire = false;

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <me@notom3ga.me>
Date: Wed, 19 May 2021 15:33:43 -0400
Subject: [PATCH] Config for unverified username message
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 5d26417b5d4e182fdefdf1ef5c81a0b7d7f2d4c1..43090b05642d252fd5b3d4a65149beab2daf0ce9 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -304,7 +304,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
ServerLoginPacketListenerImpl.this.gameProfile = ServerLoginPacketListenerImpl.this.createFakeProfile(gameprofile);
ServerLoginPacketListenerImpl.this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
} else {
- ServerLoginPacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.unverified_username"));
+ ServerLoginPacketListenerImpl.this.disconnect(net.pl3x.purpur.PurpurConfig.unverifiedUsername.equals("default") ? new TranslatableComponent("multiplayer.disconnect.unverified_username") : PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(net.pl3x.purpur.PurpurConfig.unverifiedUsername))); // Purpur
ServerLoginPacketListenerImpl.LOGGER.error("Username '{}' tried to join with an invalid session", gameprofile.getName());
}
} catch (AuthenticationUnavailableException authenticationunavailableexception) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 377744474ad802e138892511adb56ee02bc4ce48..69ecf956d0c30bb7a718a5998fce569fce6718ee 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -139,6 +139,7 @@ public class PurpurConfig {
public static String creditsCommandOutput = "<green>%s has been shown the end credits";
public static String demoCommandOutput = "<green>%s has been shown the demo screen";
public static String pingCommandOutput = "<green>%s's ping is %sms";
+ public static String unverifiedUsername = "default";
private static void messages() {
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
@@ -148,6 +149,7 @@ public class PurpurConfig {
creditsCommandOutput = getString("settings.messages.credits-command-output", creditsCommandOutput);
demoCommandOutput = getString("settings.messages.demo-command-output", demoCommandOutput);
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
+ unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
}
public static boolean advancementOnlyBroadcastToAffectedPlayer = false;

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 12emin34 <macanovic.emin@gmail.com>
Date: Fri, 21 May 2021 16:58:45 +0200
Subject: [PATCH] Make anvil cumulative cost configurable
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 1d186f9e3c2b10420abf8b3334cbcc420fc51abb..fa49cd6180f1958a196ae4e8ed867771d0d6e960 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -342,7 +342,7 @@ public class AnvilMenu extends ItemCombinerMenu {
}
public static int calculateIncreasedRepairCost(int cost) {
- return cost * 2 + 1;
+ return net.pl3x.purpur.PurpurConfig.anvilCumulativeCost ? cost * 2 + 1 : 0;
}
public void setItemName(String newItemName) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 69ecf956d0c30bb7a718a5998fce569fce6718ee..ab291b32ecade7d86bcce2961dad46730c30ed9a 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -212,6 +212,7 @@ public class PurpurConfig {
public static boolean enderChestPermissionRows = false;
public static boolean cryingObsidianValidForPortalFrame = false;
public static int beeInsideBeeHive = 3;
+ public static boolean anvilCumulativeCost = true;
private static void blockSettings() {
if (version < 3) {
boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
@@ -228,6 +229,7 @@ public class PurpurConfig {
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
beeInsideBeeHive = getInt("settings.blocks.beehive.max-bees-inside", beeInsideBeeHive);
+ anvilCumulativeCost = getBoolean("settings.blocks.anvil.cumulative-cost", anvilCumulativeCost);
}
public static boolean allowInfinityMending = false;

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 27 May 2021 04:04:23 -0500
Subject: [PATCH] ShulkerBox allow oversized stacks
This fixes PaperMC/Paper#4748 where breaking a shulkerbox in survival mode
with oversized itemstacks would cause a "chunk ban". This fixes it by always
creating an itemstack using the TileEntity's NBT data (how it handles it for
creative players) instead of routing it through the LootableBuilder.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 591066f1762fcc6304fff6ad8122f8c05b3d6aa6..1fdeb70468a203e14c2dd3f980b78ea851b2a73a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -416,7 +416,7 @@ public class ServerPlayerGameMode {
block.destroy(this.level, pos, iblockdata);
}
- if (this.isCreative()) {
+ if (this.isCreative() || (this.level.purpurConfig.shulkerBoxAllowOversizedStacks && block instanceof net.minecraft.world.level.block.ShulkerBoxBlock)) { // Purpur
// return true; // CraftBukkit
} else {
ItemStack itemstack = this.player.getMainHandItem();
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
index b9c558060024d380e89116489c7fc12ad88db8ad..0a0a4be15bed899812fcd4af0e311f5fc40d5570 100644
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -122,7 +122,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ShulkerBoxBlockEntity) {
ShulkerBoxBlockEntity shulkerBoxBlockEntity = (ShulkerBoxBlockEntity)blockEntity;
- if (!world.isClientSide && player.isCreative() && !shulkerBoxBlockEntity.isEmpty()) {
+ if (world.purpurConfig.shulkerBoxAllowOversizedStacks || (player.isCreative() && !shulkerBoxBlockEntity.isEmpty())) { // Purpur
ItemStack itemStack = getColoredItemStack(this.getColor());
CompoundTag compoundTag = shulkerBoxBlockEntity.saveToTag(new CompoundTag());
if (!compoundTag.isEmpty()) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 346eba732b7d4f26bc94e494d1576c32e9c6e2fd..314115b429feaac518a8f35417b4f67638229588 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -646,6 +646,11 @@ public class PurpurWorldConfig {
}
}
+ public boolean shulkerBoxAllowOversizedStacks = false;
+ private void shulkerBoxSettings() {
+ shulkerBoxAllowOversizedStacks = getBoolean("blocks.shulker_box.allow-oversized-stacks", shulkerBoxAllowOversizedStacks);
+ }
+
public boolean signAllowColors = false;
public boolean signRightClickEdit = false;
private void signSettings() {

View File

@@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Thu, 27 May 2021 06:46:30 +0200
Subject: [PATCH] Bee can work when raining or at night
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index f9262c1fca1a1318fb5f6f607e8e71c1019c5c95..d4aa4a33f52b9dbc0756f7a6024105e0c2b9983f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -400,7 +400,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
boolean wantsToEnterHive() {
if (this.stayOutOfHiveCountdown <= 0 && !this.beePollinateGoal.isPollinating() && !this.hasStung() && this.getTarget() == null) {
- boolean flag = this.isTiredOfLookingForNectar() || this.level.isRaining() || this.level.isNight() || this.hasNectar();
+ boolean flag = this.isTiredOfLookingForNectar() || (this.level.isRaining() && !this.level.purpurConfig.beeCanWorkInRain) || (this.level.isNight() && !this.level.purpurConfig.beeCanWorkAtNight) || this.hasNectar(); // Purpur
return flag && !this.isHiveNearFire();
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index ffacc4b8cc3ab8285c4131aec58e48ffa9e1952e..e0e039e2f614f2df48d8d1b6e8bbbe7a72d96d6f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -197,7 +197,7 @@ public class BeehiveBlockEntity extends BlockEntity {
}
private static boolean releaseBee(Level world, BlockPos blockposition, BlockState iblockdata, BeehiveBlockEntity.BeeData tileentitybeehive_hivebee, @Nullable List<Entity> list, BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPos blockposition1, boolean force) {
- if (!force && (world.isNight() || world.isRaining()) && tileentitybeehive_releasestatus != BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY) {
+ if (!force && ((world.isNight() && !world.purpurConfig.beeCanWorkAtNight) || (world.isRaining() && !world.purpurConfig.beeCanWorkInRain)) && tileentitybeehive_releasestatus != BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY) { // Purpur
// CraftBukkit end
return false;
} else {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 314115b429feaac518a8f35417b4f67638229588..61612c15bf7aed791cef35f10104ecbbb70e80b1 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -750,6 +750,8 @@ public class PurpurWorldConfig {
public double beeMaxY = 256D;
public double beeMaxHealth = 10.0D;
public int beeBreedingTicks = 6000;
+ public boolean beeCanWorkAtNight = false;
+ public boolean beeCanWorkInRain = false;
private void beeSettings() {
beeRidable = getBoolean("mobs.bee.ridable", beeRidable);
beeRidableInWater = getBoolean("mobs.bee.ridable-in-water", beeRidableInWater);
@@ -761,6 +763,8 @@ public class PurpurWorldConfig {
}
beeMaxHealth = getDouble("mobs.bee.attributes.max_health", beeMaxHealth);
beeBreedingTicks = getInt("mobs.bee.breeding-delay-ticks", beeBreedingTicks);
+ beeCanWorkAtNight = getBoolean("mobs.bee.can-work-at-night", beeCanWorkAtNight);
+ beeCanWorkInRain = getBoolean("mobs.bee.can-work-in-rain", beeCanWorkInRain);
}
public boolean blazeRidable = false;

View File

@@ -0,0 +1,360 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <me@notom3ga.me>
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/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b79c2436c6a89a344ed17fd02d798a63a2972389..5f39278e5115a817cbd123ce625a84e4d9b4a771 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4079,5 +4079,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public boolean canSaveToDisk() {
return true;
}
+
+ // Purpur start - copied from Mob
+ public boolean isSunBurnTick() {
+ if (this.level.isDay()) {
+ float brightness = this.getBrightness();
+ BlockPos pos = new BlockPos(this.getX(), this.getEyeY(), this.getZ());
+ boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
+ if (brightness > 0.5F && this.random.nextFloat() * 30.0F < (brightness - 0.4F) * 2.0F && !flag && this.level.canSeeSky(pos)) {
+ return true;
+ }
+ }
+ return false;
+ }
// Purpur end
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c7cbdd7becb53767cbd652719ebe88646df21220..16540e1977aba599de8ac444df2e8be9256e251a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -265,6 +265,7 @@ public abstract class LivingEntity extends Entity {
public boolean bukkitPickUpLoot;
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur
@Override
public float getBukkitYaw() {
@@ -769,6 +770,7 @@ public abstract class LivingEntity extends Entity {
dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> {
nbt.put("Brain", nbtbase);
});
+ nbt.putBoolean("Purpur.ShouldBurnInDay", shouldBurnInDay); // Purpur
}
@Override
@@ -844,6 +846,11 @@ public abstract class LivingEntity extends Entity {
this.brain = this.makeBrain(new Dynamic(NbtOps.INSTANCE, nbt.get("Brain")));
}
+ // Purpur start
+ if (nbt.contains("Purpur.ShouldBurnInDay")) {
+ shouldBurnInDay = nbt.getBoolean("Purpur.ShouldBurnInDay");
+ }
+ // Purpur end
}
// CraftBukkit start
@@ -3298,6 +3305,27 @@ public abstract class LivingEntity extends Entity {
this.hurt(DamageSource.DROWN, 1.0F);
}
+ // Purpur start - copied from Zombie
+ if (this.isAlive()) {
+ boolean flag = this.isSunSensitive() && this.isSunBurnTick();
+ if (flag) {
+ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
+ if (!itemstack.isEmpty()) {
+ if (itemstack.isDamageableItem()) {
+ itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
+ if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
+ this.broadcastBreakEvent(EquipmentSlot.HEAD);
+ this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
+ }
+ }
+ flag = false;
+ }
+ if (flag) {
+ this.setSecondsOnFire(8);
+ }
+ }
+ }
+ // Purpur end
}
public boolean isSensitiveToWater() {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d92549e81160afaa1d109501806f3af96c475d7e..c5fa64b2d1559bf47b3dac8a2a10205e93e638dd 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1629,17 +1629,7 @@ public abstract class Mob extends LivingEntity {
}
public boolean isSunBurnTick() {
- if (this.level.isDay() && !this.level.isClientSide) {
- float f = this.getBrightness();
- BlockPos blockposition = new BlockPos(this.getX(), this.getEyeY(), this.getZ());
- boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
-
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && !flag && this.level.canSeeSky(blockposition)) {
- return true;
- }
- }
-
- return false;
+ return super.isSunBurnTick(); // Purpur - moved contents to Entity
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index af1a3c67c9e094fd5cc5d84600cc670aea055f69..64ea34d768fdcee86ab59c5a12f04ddc11b9d8f4 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -65,6 +65,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> type, Level world) {
super(type, world);
this.reassessWeaponGoal();
+ this.setShouldBurnInDay(true); // Purpur
}
@Override
@@ -100,35 +101,14 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
}
// Paper start
- private boolean shouldBurnInDay = true;
+ // private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
public boolean shouldBurnInDay() { return shouldBurnInDay; }
public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
// Paper end
@Override
public void aiStep() {
- boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - Configurable Burning
-
- if (flag) {
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
-
- if (!itemstack.isEmpty()) {
- if (itemstack.isDamageableItem()) {
- itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
- if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
- this.broadcastBreakEvent(EquipmentSlot.HEAD);
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
- }
- }
-
- flag = false;
- }
-
- if (flag) {
- this.setSecondsOnFire(8);
- }
- }
-
+ // Purpur start - implemented in LivingEntity
super.aiStep();
}
@@ -231,14 +211,14 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
this.reassessWeaponGoal();
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Paper
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Paper // Purpur - implemented in LivingEntity
}
// Paper start
@Override
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ // nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity
}
// Paper end
diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java
index 6c89eabddda16f9b72e6062c31bb4be6beae442d..2ff43cebc2e6471395e90a8a19828d94fe635e0b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Husk.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java
@@ -20,6 +20,7 @@ public class Husk extends Zombie {
public Husk(EntityType<? extends Husk> type, Level world) {
super(type, world);
+ this.setShouldBurnInDay(false); // Purpur
}
// Purpur start
@@ -65,7 +66,7 @@ public class Husk extends Zombie {
@Override
public boolean isSunSensitive() {
- return false;
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 3ea6f2d96245caa85f365c488b8cc019a8318009..0539be5997b3046db3720777b3722719b078bf15 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -61,6 +61,7 @@ public class Phantom extends FlyingMob implements Enemy {
this.xpReward = 5;
this.moveControl = new Phantom.PhantomMoveControl(this);
this.lookControl = new Phantom.PhantomLookControl(this);
+ this.setShouldBurnInDay(true); // Purpur
}
// Purpur start
@@ -232,7 +233,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
- if (this.isAlive() && getRider() == null && (((shouldBurnInDay || level.purpurConfig.phantomBurnInDaylight) && this.isSunBurnTick()) || (level.purpurConfig.phantomBurnInLight > 0 && level.getLightEmission(new BlockPos(this)) >= level.purpurConfig.phantomBurnInLight))) { // Paper - Configurable Burning // Purpur
+ if (this.isAlive() && getRider() == null && (((shouldBurnInDay() || level.purpurConfig.phantomBurnInDaylight) && this.isSunBurnTick()) || (level.purpurConfig.phantomBurnInLight > 0 && level.getLightEmission(new BlockPos(this)) >= level.purpurConfig.phantomBurnInLight))) { // Paper - Configurable Burning // Purpur
this.setSecondsOnFire(8);
}
@@ -263,7 +264,7 @@ public class Phantom extends FlyingMob implements Enemy {
if (nbt.hasUUID("Paper.SpawningEntity")) {
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
}
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity
// Paper end
}
@@ -278,7 +279,7 @@ public class Phantom extends FlyingMob implements Enemy {
if (this.spawningEntity != null) {
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
}
- nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
+ // nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Purpur - implemented in LivingEntity
// Paper end
}
@@ -339,7 +340,7 @@ public class Phantom extends FlyingMob implements Enemy {
}
public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
- private boolean shouldBurnInDay = true;
+ // private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
public boolean shouldBurnInDay() { return shouldBurnInDay; }
public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
// Paper end
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index b80f7c71cbf7b10bda6fac3cfe673ac7fe129923..5adef472e37b422c9b83ac00221be3fb8558d225 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -96,11 +96,12 @@ public class Zombie extends Monster {
private int inWaterTime;
public int conversionTime;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
- private boolean shouldBurnInDay = true; // Paper
+ // private boolean shouldBurnInDay = true; // Paper // Purpur - implemented in LivingEntity
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig.zombieBreakDoors)); // Paper
+ this.setShouldBurnInDay(true); // Purpur
}
public Zombie(Level world) {
@@ -282,30 +283,7 @@ public class Zombie extends Monster {
@Override
public void aiStep() {
- if (this.isAlive()) {
- boolean flag = this.isSunSensitive() && this.isSunBurnTick();
-
- if (flag) {
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
-
- if (!itemstack.isEmpty()) {
- if (itemstack.isDamageableItem()) {
- itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
- if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
- this.broadcastBreakEvent(EquipmentSlot.HEAD);
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
- }
- }
-
- flag = false;
- }
-
- if (flag) {
- this.setSecondsOnFire(8);
- }
- }
- }
-
+ // Purpur - implemented in LivingEntity
super.aiStep();
}
@@ -343,6 +321,7 @@ public class Zombie extends Monster {
}
+ public boolean shouldBurnInDay() { return isSunSensitive(); } // Purpur - for ABI compatibility
public boolean isSunSensitive() {
return this.shouldBurnInDay; // Paper - use api value instead
}
@@ -472,7 +451,7 @@ public class Zombie extends Monster {
nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper
+ // nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper // Purpur - implemented in LivingEntity
}
@Override
@@ -486,7 +465,7 @@ public class Zombie extends Monster {
}
// Paper start
if (nbt.contains("Paper.ShouldBurnInDay")) {
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity
}
// Paper end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index e2b1574af471699f93956130b50268647f24e0b9..c5733b0d9d4de696421a30b5d7266334af004c3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1240,5 +1240,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
return !entity.valid && entity.level.addEntity(entity, spawnReason);
}
+
+ @Override
+ public boolean isInDaylight() {
+ return getHandle().isSunBurnTick();
+ }
// Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 23c136ed6daf5111b97996053df18413480532e5..97d892edfed76df90c4e6294b0a3c2d43da06860 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -889,5 +889,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (slot == null) return;
getHandle().broadcastBreakEvent(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
}
+
+ @Override
+ public boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
// Purpur end
}

View File

@@ -0,0 +1,197 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 28 May 2021 12:24:45 -0500
Subject: [PATCH] Fix advancement triggers on entity death
This fixes PaperMC/Paper#3729 and PaperMC/Paper#4252
Paper changes logical order revolving around making the EntityDeathEvent
cancellable. Reordering this logic has ended up with entity equipment being
cleared _before_ advancement criteria can run, causing things like killing
raid captains not giving the voluntary exile advancement.
This fixes the issue by storing a copy of the equipment in a new field just
before doing the death event logic where the equipment is cleared and then
restoring it back to the entity just before the criterion triggers run and
then finally clearing the equipment again right after the criterion is done.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 16540e1977aba599de8ac444df2e8be9256e251a..eafc897c3b2e06b9bc5c90d4e096996eaab2b4a4 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1658,10 +1658,13 @@ public abstract class LivingEntity extends Entity {
}
// Paper start
+ List<List<ItemStack>> equipmentSnapshotBefore = this.cloneEquipment(); // Purpur
org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(source);
if (deathEvent == null || !deathEvent.isCancelled()) {
if (this.deathScore >= 0 && entityliving != null) {
+ this.restoreEquipment(equipmentSnapshotBefore); // Purpur
entityliving.awardKillScore(this, this.deathScore, source);
+ this.clearEquipment(); // Purpur
}
if (this.isSleeping()) {
@@ -2527,6 +2530,12 @@ public abstract class LivingEntity extends Entity {
@Override
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
+ // Purpur start
+ public abstract List<List<ItemStack>> cloneEquipment();
+ public abstract void restoreEquipment(List<List<ItemStack>> list);
+ public abstract void clearEquipment();
+ // Purpur end
+
protected void verifyEquippedItem(ItemStack stack) {
CompoundTag nbttagcompound = stack.getTag();
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index c5fa64b2d1559bf47b3dac8a2a10205e93e638dd..1209aafa118d7bf01eebade3b994678a7c200b0b 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1014,6 +1014,41 @@ public abstract class Mob extends LivingEntity {
}
+ // Purpur start
+ public List<List<ItemStack>> cloneEquipment() {
+ List<List<ItemStack>> list = new java.util.ArrayList<>();
+ List<ItemStack> handItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.handItems) {
+ handItems.add(item.copy());
+ }
+ list.add(handItems);
+ List<ItemStack> armorItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.armorItems) {
+ armorItems.add(item.copy());
+ }
+ list.add(armorItems);
+ return list;
+ }
+
+ public void restoreEquipment(List<List<ItemStack>> list) {
+ this.handItems.clear();
+ List<ItemStack> handItems = list.get(0);
+ for (int i = 0; i < handItems.size(); i++) {
+ this.handItems.set(i, handItems.get(1));
+ }
+ this.armorItems.clear();
+ List<ItemStack> armorItems = list.get(1);
+ for (int i = 0; i < armorItems.size(); i++) {
+ this.armorItems.set(i, armorItems.get(i));
+ }
+ }
+
+ public void clearEquipment() {
+ this.handItems.clear();
+ this.armorItems.clear();
+ }
+ // Purpur end
+
@Override
protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) {
super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index c9a44a4765f43b9c0247ed1005f4c13469bdee95..6d08c8c31a32ea38f06410fbaddf19b95bec7c6f 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -205,6 +205,41 @@ public class ArmorStand extends LivingEntity {
this.noTickEquipmentDirty = true; // Paper - Allow equipment to be updated even when tick disabled
}
+ // Purpur start
+ public List<List<ItemStack>> cloneEquipment() {
+ List<List<ItemStack>> list = new java.util.ArrayList<>();
+ List<ItemStack> handItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.handItems) {
+ handItems.add(item.copy());
+ }
+ list.add(handItems);
+ List<ItemStack> armorItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.armorItems) {
+ armorItems.add(item.copy());
+ }
+ list.add(armorItems);
+ return list;
+ }
+
+ public void restoreEquipment(List<List<ItemStack>> list) {
+ this.handItems.clear();
+ List<ItemStack> handItems = list.get(0);
+ for (int i = 0; i < handItems.size(); i++) {
+ this.handItems.set(i, handItems.get(1));
+ }
+ this.armorItems.clear();
+ List<ItemStack> armorItems = list.get(1);
+ for (int i = 0; i < armorItems.size(); i++) {
+ this.armorItems.set(i, armorItems.get(1));
+ }
+ }
+
+ public void clearEquipment() {
+ this.handItems.clear();
+ this.armorItems.clear();
+ }
+ // Purpur end
+
@Override
public boolean canTakeItem(ItemStack stack) {
net.minecraft.world.entity.EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(stack);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 18f198fb410b579390fc93c848fda34b407b39b4..d1b6ebf4b8df338b3ffcef2a55124636b3199fb3 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1990,6 +1990,52 @@ public abstract class Player extends LivingEntity {
}
+ // Purpur start
+ public List<List<ItemStack>> cloneEquipment() {
+ List<List<ItemStack>> list = new java.util.ArrayList<>();
+ List<ItemStack> invItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.inventory.items) {
+ invItems.add(item.copy());
+ }
+ list.add(invItems);
+ List<ItemStack> armorItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.inventory.armor) {
+ armorItems.add(item.copy());
+ }
+ list.add(armorItems);
+ List<ItemStack> offhandItems = new java.util.ArrayList<>();
+ for (ItemStack item : this.inventory.offhand) {
+ offhandItems.add(item.copy());
+ }
+ list.add(offhandItems);
+ return list;
+ }
+
+ public void restoreEquipment(List<List<ItemStack>> list) {
+ this.inventory.items.clear();
+ List<ItemStack> invItems = list.get(0);
+ for (int i = 0; i < invItems.size(); i++) {
+ this.inventory.items.set(i, invItems.get(1));
+ }
+ this.inventory.armor.clear();
+ List<ItemStack> armorItems = list.get(1);
+ for (int i = 0; i < armorItems.size(); i++) {
+ this.inventory.armor.set(i, armorItems.get(1));
+ }
+ this.inventory.offhand.clear();
+ List<ItemStack> offhandItems = list.get(2);
+ for (int i = 0; i < offhandItems.size(); i++) {
+ this.inventory.offhand.set(i, offhandItems.get(1));
+ }
+ }
+
+ public void clearEquipment() {
+ this.inventory.items.clear();
+ this.inventory.armor.clear();
+ this.inventory.offhand.clear();
+ }
+ // Purpur end
+
public boolean addItem(ItemStack stack) {
this.equipEventAndSound(stack);
return this.inventory.add(stack);

View File

@@ -0,0 +1,67 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Mon, 31 May 2021 11:06:54 +0200
Subject: [PATCH] Config MobEffect by world
diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java
index 79e036d79dec2ec4404baf02c23ba5ccad20cdce..6706d8e6d43cc5f3058f08fdfde77bed57f4c641 100644
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java
@@ -49,16 +49,16 @@ public class MobEffect {
public void applyEffectTick(LivingEntity entity, int amplifier) {
if (this == MobEffects.REGENERATION) {
if (entity.getHealth() < entity.getMaxHealth()) {
- entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
+ entity.heal(entity.level.purpurConfig.entityHealthRegenAmount, RegainReason.MAGIC_REGEN); // CraftBukkit // Purpur
}
} else if (this == MobEffects.POISON) {
- if (entity.getHealth() > 1.0F) {
- entity.hurt(CraftEventFactory.POISON, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
+ if (entity.getHealth() > entity.level.purpurConfig.entityMinimalHealthPoison) { // Purpur
+ entity.hurt(CraftEventFactory.POISON, entity.level.purpurConfig.entityPoisonDegenerationAmount); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON // Purpur
}
} else if (this == MobEffects.WITHER) {
- entity.hurt(DamageSource.WITHER, 1.0F);
+ entity.hurt(DamageSource.WITHER, entity.level.purpurConfig.entityWitherDegenerationAmount); // Purpur
} else if (this == MobEffects.HUNGER && entity instanceof Player) {
- ((Player) entity).applyExhaustion(0.005F * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
+ ((Player) entity).applyExhaustion(entity.level.purpurConfig.humanHungerExhaustionAmount * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent // Purpur
} else if (this == MobEffects.SATURATION && entity instanceof Player) {
if (!entity.level.isClientSide) {
// CraftBukkit start
@@ -68,7 +68,7 @@ public class MobEffect {
org.bukkit.event.entity.FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(entityhuman, amplifier + 1 + oldFoodLevel);
if (!event.isCancelled()) {
- entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F);
+ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, entity.level.purpurConfig.humanSaturationRegenAmount); // Purpur
}
((ServerPlayer) entityhuman).connection.send(new ClientboundSetHealthPacket(((ServerPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 61612c15bf7aed791cef35f10104ecbbb70e80b1..9666dec5addd0f633efe4beeca1e561af67104e3 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -269,6 +269,21 @@ public class PurpurWorldConfig {
poweredRailBoostModifier = getDouble("gameplay-mechanics.minecart.powered-rail.boost-modifier", poweredRailBoostModifier);
}
+ public float entityHealthRegenAmount = 1.0F;
+ public float entityMinimalHealthPoison = 1.0F;
+ public float entityPoisonDegenerationAmount = 1.0F;
+ public float entityWitherDegenerationAmount = 1.0F;
+ public float humanHungerExhaustionAmount = 0.005F;
+ public float humanSaturationRegenAmount = 1.0F;
+ private void mobEffectSettings() {
+ entityHealthRegenAmount = (float) getDouble("gameplay-mechanics.mob-effects.health-regen-amount", entityHealthRegenAmount);
+ entityMinimalHealthPoison = (float) getDouble("gameplay-mechanics.mob-effects.minimal-health-poison-amount", entityMinimalHealthPoison);
+ entityPoisonDegenerationAmount = (float) getDouble("gameplay-mechanics.mob-effects.poison-degeneration-amount", entityPoisonDegenerationAmount);
+ entityWitherDegenerationAmount = (float) getDouble("gameplay-mechanics.mob-effects.wither-degeneration-amount", entityWitherDegenerationAmount);
+ humanHungerExhaustionAmount = (float) getDouble("gameplay-mechanics.mob-effects.hunger-exhaustion-amount", humanHungerExhaustionAmount);
+ humanSaturationRegenAmount = (float) getDouble("gameplay-mechanics.mob-effects.saturation-regen-amount", humanSaturationRegenAmount);
+ }
+
public boolean catSpawning;
public boolean patrolSpawning;
public boolean phantomSpawning;

View File

@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Wed, 2 Jun 2021 02:45:47 +0200
Subject: [PATCH] Beacon Activation Range Configurable
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index c1a0b0d77b8783fd127b68449a209ec0e62e6005..4e7f7ac51a4777bbda4939c6ecc3edc9ce383837 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -85,6 +85,16 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
public double getEffectRange() {
if (this.effectRange < 0) {
+ // Purpur Start
+ if (this.level != null) {
+ switch (this.levels) {
+ case 1: return this.level.purpurConfig.beaconLevelOne;
+ case 2: return this.level.purpurConfig.beaconLevelTwo;
+ case 3: return this.level.purpurConfig.beaconLevelThree;
+ case 4: return this.level.purpurConfig.beaconLevelFour;
+ }
+ }
+ // Purpur End
return this.levels * 10 + 10;
} else {
return effectRange;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 9666dec5addd0f633efe4beeca1e561af67104e3..58fb881e1c07f14c1b5f155d15b424b6b8c0a1fe 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -506,6 +506,17 @@ public class PurpurWorldConfig {
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
}
+ public int beaconLevelOne = 20;
+ public int beaconLevelTwo = 30;
+ public int beaconLevelThree = 40;
+ public int beaconLevelFour = 50;
+ private void beaconSettings() {
+ beaconLevelOne = getInt("blocks.beacon.effect-range.level-1", beaconLevelOne);
+ beaconLevelTwo = getInt("blocks.beacon.effect-range.level-2", beaconLevelTwo);
+ beaconLevelThree = getInt("blocks.beacon.effect-range.level-3", beaconLevelThree);
+ beaconLevelFour = getInt("blocks.beacon.effect-range.level-4", beaconLevelFour);
+ }
+
public boolean bedExplode = true;
public double bedExplosionPower = 5.0D;
public boolean bedExplosionFire = true;

View File

@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 4 Jun 2021 09:13:54 -0500
Subject: [PATCH] Add toggle for sand duping fix
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 8336ea928faa92c6f58f8cdfb9faf1d8e26c9ccf..c765c182081fe83eb0f30dcbf97d812681236bc6 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -107,7 +107,7 @@ public class FallingBlockEntity extends Entity {
@Override
public void tick() {
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (this.level.purpurConfig.fixSandDuping && this.isRemoved()) { // Purpur
return;
}
// Paper end - fix sand duping
@@ -144,7 +144,7 @@ public class FallingBlockEntity extends Entity {
this.move(MoverType.SELF, this.getDeltaMovement());
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (this.level.purpurConfig.fixSandDuping && this.isRemoved()) { // Purpur
return;
}
// Paper end - fix sand duping
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 58fb881e1c07f14c1b5f155d15b424b6b8c0a1fe..d4340160f9431f1d2d00ff1b83b1d77ea460ef70 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -672,6 +672,11 @@ public class PurpurWorldConfig {
}
}
+ public boolean fixSandDuping = true;
+ private void sandSettings() {
+ fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping);
+ }
+
public boolean shulkerBoxAllowOversizedStacks = false;
private void shulkerBoxSettings() {
shulkerBoxAllowOversizedStacks = getBoolean("blocks.shulker_box.allow-oversized-stacks", shulkerBoxAllowOversizedStacks);

View File

@@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Wed, 9 Jun 2021 11:03:40 -0500
Subject: [PATCH] Add toggle for end portal safe teleporting
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5f39278e5115a817cbd123ce625a84e4d9b4a771..cab88e911866d28df7e8eeadc3262d97d775c637 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2557,7 +2557,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
this.processPortalCooldown();
- this.tickEndPortal(); // Paper - make end portalling safe
+ if (this.level.purpurConfig.endPortalSafeTeleporting) this.tickEndPortal(); // Paper - make end portalling safe // Purpur
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 197482e1ace23c3de002242097a68c6cc297cd3f..428875a6a99a619d337e2a7bbd2cb1828ca11d04 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -61,6 +61,22 @@ public class EndPortalBlock extends BaseEntityBlock {
// return; // CraftBukkit - always fire event in case plugins wish to change it
}
+ // Purpur start
+ if (!world.purpurConfig.endPortalSafeTeleporting) {
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (entity instanceof ServerPlayer) {
+ ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ return;
+ }
+ // CraftBukkit end
+ entity.changeDimension(worldserver);
+ return;
+ }
+ // Purpur end
+
// Paper start - move all of this logic into portal tick
entity.portalWorld = ((ServerLevel)world);
entity.portalBlock = pos.immutable();
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index d4340160f9431f1d2d00ff1b83b1d77ea460ef70..cf158b28a36ea29da08439f9a88fb77cd1605d8d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -614,6 +614,11 @@ public class PurpurWorldConfig {
furnaceInfiniteFuel = getBoolean("blocks.furnace.infinite-fuel", furnaceInfiniteFuel);
}
+ public boolean endPortalSafeTeleporting = true;
+ private void endPortalSettings() {
+ endPortalSafeTeleporting = getBoolean("blocks.end_portal.safe-teleporting", endPortalSafeTeleporting);
+ }
+
public boolean snowOnBlueIce = true;
public boolean mobsSpawnOnPackedIce = true;
public boolean mobsSpawnOnBlueIce = true;

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TreyRuffy <TreyRuffy@users.noreply.github.com>
Date: Wed, 9 Jun 2021 16:31:14 -0600
Subject: [PATCH] Flying Fall Damage API
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index d1b6ebf4b8df338b3ffcef2a55124636b3199fb3..5cb678bf56c8c18a778c801236c63fdae461ef2a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -183,6 +183,7 @@ public abstract class Player extends LivingEntity {
public boolean affectsSpawning = true;
// Paper end
public boolean isCritical = false; // Purpur
+ public boolean flyingFallDamage = false; // Purpur
// CraftBukkit start
public boolean fauxSleeping;
@@ -1729,7 +1730,7 @@ public abstract class Player extends LivingEntity {
@Override
public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
- if (this.abilities.mayfly) {
+ if (this.abilities.mayfly && !flyingFallDamage) { // Purpur
return false;
} else {
if (fallDistance >= 2.0F) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4da17c3dcf937304fb9dab675bccea816a2689ba..418d7833193df042edfcde6f54f3e2b1c2cde7f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2514,5 +2514,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSpawnInvulnerableTicks(int spawnInvulnerableTime) {
getHandle().spawnInvulnerableTime = spawnInvulnerableTime;
}
+
+ @Override
+ public void setFlyingFallDamage(boolean flyingFallDamage) {
+ getHandle().flyingFallDamage = flyingFallDamage;
+ }
+
+ @Override
+ public boolean hasFlyingFallDamage() {
+ return getHandle().flyingFallDamage;
+ }
// Purpur end
}