mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
200 patches \o/
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Thu, 25 Mar 2021 18:10:03 -0400
|
||||
Subject: [PATCH] Config for powered rail activation distance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
index 9603d8c84ff483030dc08e82d3579b89e5c1f6e9..8fc65c32a3c6e6842a76b36f45e1b1c23abbc480 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
@@ -30,7 +30,7 @@ public class PoweredRailBlock extends BaseRailBlock {
|
||||
}
|
||||
|
||||
protected boolean findPoweredRailSignal(Level world, BlockPos pos, BlockState state, boolean flag, int distance) {
|
||||
- if (distance >= 8) {
|
||||
+ if (distance >= world.purpurConfig.railActivationRange) { // Purpur
|
||||
return false;
|
||||
} else {
|
||||
int j = pos.getX();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index ebc3615b395e9f9ff9a6dd5ac65eec6b530edad4..948fcb804e6ca46f2af1de41472c70c88711c47f 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -599,6 +599,11 @@ public class PurpurWorldConfig {
|
||||
powderSnowBypassMobGriefing = getBoolean("blocks.powder_snow.bypass-mob-griefing", powderSnowBypassMobGriefing);
|
||||
}
|
||||
|
||||
+ public int railActivationRange = 8;
|
||||
+ private void railSettings() {
|
||||
+ railActivationRange = getInt("blocks.powered-rail.activation-range", railActivationRange);
|
||||
+ }
|
||||
+
|
||||
public boolean respawnAnchorExplode = true;
|
||||
public double respawnAnchorExplosionPower = 5.0D;
|
||||
public boolean respawnAnchorExplosionFire = true;
|
||||
52
patches/server/0144-Piglin-portal-spawn-modifier.patch
Normal file
52
patches/server/0144-Piglin-portal-spawn-modifier.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Tue, 13 Apr 2021 11:19:35 -0500
|
||||
Subject: [PATCH] Piglin portal spawn modifier
|
||||
|
||||
Allows changing the modifier for the piglin spawn chance from a portal block
|
||||
based on the world difficulty.
|
||||
|
||||
For example, with the default vanilla value of 2000 there is a 2 out of 2000 chance
|
||||
for a piglin to spawn in a portal block each tick in normal mode.
|
||||
|
||||
Equation: random.nextInt(modifier) < difficulty
|
||||
|
||||
Difficulties:
|
||||
0 - peaceful
|
||||
1 - easy
|
||||
2 - normal
|
||||
3 - hard
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
index caa22afb0781671b901c23ebcc89e5bb0d2bd615..259f7e162968714e2959b199c7b1ab847dd624ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -77,7 +77,7 @@ public class NetherPortalBlock extends Block implements Portal {
|
||||
|
||||
@Override
|
||||
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
- if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(2000) < world.getDifficulty().getId()) { // Spigot
|
||||
+ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(world.purpurConfig.piglinPortalSpawnModifier) < world.getDifficulty().getId()) { // Spigot // Purpur
|
||||
while (world.getBlockState(pos).is((Block) this)) {
|
||||
pos = pos.below();
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 948fcb804e6ca46f2af1de41472c70c88711c47f..fdd84855671d21a4ecc5743b5ae72a645fc46443 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1655,6 +1655,7 @@ public class PurpurWorldConfig {
|
||||
public double piglinMaxHealth = 16.0D;
|
||||
public boolean piglinBypassMobGriefing = false;
|
||||
public boolean piglinTakeDamageFromWater = false;
|
||||
+ public int piglinPortalSpawnModifier = 2000;
|
||||
private void piglinSettings() {
|
||||
piglinRidable = getBoolean("mobs.piglin.ridable", piglinRidable);
|
||||
piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater);
|
||||
@@ -1667,6 +1668,7 @@ public class PurpurWorldConfig {
|
||||
piglinMaxHealth = getDouble("mobs.piglin.attributes.max_health", piglinMaxHealth);
|
||||
piglinBypassMobGriefing = getBoolean("mobs.piglin.bypass-mob-griefing", piglinBypassMobGriefing);
|
||||
piglinTakeDamageFromWater = getBoolean("mobs.piglin.takes-damage-from-water", piglinTakeDamageFromWater);
|
||||
+ piglinPortalSpawnModifier = getInt("mobs.piglin.portal-spawn-modifier", piglinPortalSpawnModifier);
|
||||
}
|
||||
|
||||
public boolean piglinBruteRidable = false;
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Thu, 29 Apr 2021 19:37:48 +0200
|
||||
Subject: [PATCH] Config to change max number of bees
|
||||
|
||||
|
||||
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 7b263fab4f0014400b3b8e7e33db32f9a125f6ba..f52823146944d333f2d050e90261b570ba66f5dd 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
|
||||
@@ -59,7 +59,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
private final List<BeehiveBlockEntity.BeeData> stored = Lists.newArrayList();
|
||||
@Nullable
|
||||
public BlockPos savedFlowerPos;
|
||||
- public int maxBees = 3; // CraftBukkit - allow setting max amount of bees a hive can hold
|
||||
+ public int maxBees = org.purpurmc.purpur.PurpurConfig.beeInsideBeeHive; // CraftBukkit - allow setting max amount of bees a hive can hold // Purpur
|
||||
|
||||
public BeehiveBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.BEEHIVE, pos, state);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 01f192f911dfd4c4afcd942196fce62e35cdbacf..d1dcaaec7731e24cad3e3566fd5bb4dbe0b7336d 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -250,6 +250,7 @@ public class PurpurConfig {
|
||||
public static boolean enderChestSixRows = false;
|
||||
public static boolean enderChestPermissionRows = false;
|
||||
public static boolean cryingObsidianValidForPortalFrame = false;
|
||||
+ public static int beeInsideBeeHive = 3;
|
||||
private static void blockSettings() {
|
||||
if (version < 3) {
|
||||
boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
|
||||
@@ -281,6 +282,7 @@ public class PurpurConfig {
|
||||
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean allowUnsafeEnchants = false;
|
||||
39
patches/server/0146-Config-for-wither-explosion-radius.patch
Normal file
39
patches/server/0146-Config-for-wither-explosion-radius.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Thu, 29 Apr 2021 14:39:07 -0400
|
||||
Subject: [PATCH] Config for wither explosion radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
index e472df057d087fe46bd40b798c050ed6e38a283c..999453409c19abf7f5b5c2dc399699856e57329e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
@@ -103,7 +103,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
||||
if (!this.level().isClientSide) {
|
||||
// CraftBukkit start
|
||||
// this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
||||
- ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.level().purpurConfig.witherExplosionRadius, false); // Purpur
|
||||
this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index fdd84855671d21a4ecc5743b5ae72a645fc46443..b4bffe75d0462c44eada1a1412afea69732fdf6e 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2294,6 +2294,7 @@ public class PurpurWorldConfig {
|
||||
public boolean witherBypassMobGriefing = false;
|
||||
public boolean witherTakeDamageFromWater = false;
|
||||
public boolean witherCanRideVehicles = false;
|
||||
+ public float witherExplosionRadius = 1.0F;
|
||||
private void witherSettings() {
|
||||
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
|
||||
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
|
||||
@@ -2314,6 +2315,7 @@ public class PurpurWorldConfig {
|
||||
witherBypassMobGriefing = getBoolean("mobs.wither.bypass-mob-griefing", witherBypassMobGriefing);
|
||||
witherTakeDamageFromWater = getBoolean("mobs.wither.takes-damage-from-water", witherTakeDamageFromWater);
|
||||
witherCanRideVehicles = getBoolean("mobs.wither.can-ride-vehicles", witherCanRideVehicles);
|
||||
+ witherExplosionRadius = (float) getDouble("mobs.wither.explosion-radius", witherExplosionRadius);
|
||||
}
|
||||
|
||||
public boolean witherSkeletonRidable = false;
|
||||
94
patches/server/0147-Gamemode-extra-permissions.patch
Normal file
94
patches/server/0147-Gamemode-extra-permissions.patch
Normal file
@@ -0,0 +1,94 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 30 Apr 2021 13:39:39 -0500
|
||||
Subject: [PATCH] Gamemode extra permissions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
index c98247a6ccc015f1da2c11995fb392b24197e888..dea4dd6f0fbb1fc79132c249b9f72edba1366efd 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -209,6 +209,19 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Purpur start
|
||||
+ public boolean testPermission(int i, String bukkitPermission) {
|
||||
+ if (hasPermission(i, bukkitPermission)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ net.kyori.adventure.text.Component permissionMessage = getLevel().getServer().server.permissionMessage();
|
||||
+ if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) {
|
||||
+ sendFailure(io.papermc.paper.adventure.PaperAdventure.asVanilla(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("<permission>").replacement(bukkitPermission).build())));
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public Vec3 getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java
|
||||
index d1da3600dc07107309b20ebe6e7c0c4da0e8de76..244b4719c689f153fa36381a60acc280bb0bd9b3 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java
|
||||
@@ -57,6 +57,18 @@ public class GameModeCommand {
|
||||
}
|
||||
|
||||
private static int setMode(CommandContext<CommandSourceStack> context, Collection<ServerPlayer> targets, GameType gameMode) {
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
||||
+ String gamemode = gameMode.getName();
|
||||
+ CommandSourceStack sender = context.getSource();
|
||||
+ if (!sender.testPermission(2, "minecraft.command.gamemode." + gamemode)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (sender.getEntity() instanceof ServerPlayer player && (targets.size() > 1 || !targets.contains(player)) && !sender.testPermission(2, "minecraft.command.gamemode." + gamemode + ".other")) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
int i = 0;
|
||||
|
||||
for (ServerPlayer serverPlayer : targets) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
index 52649f82351ab4f675c3cc3cd6640956b0f76b91..eb51c88c7a0658190d3a8bfd5d18dca79d85fba0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
@@ -23,7 +23,15 @@ public final class CommandPermissions {
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
|
||||
- DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
|
||||
+ // Purpur start
|
||||
+ Permission gamemodeVanilla = DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode", PermissionDefault.OP, commands);
|
||||
+ for (net.minecraft.world.level.GameType gametype : net.minecraft.world.level.GameType.values()) {
|
||||
+ Permission gamemodeSelf = DefaultPermissions.registerPermission(PREFIX + "gamemode." + gametype.getName(), "Allows the user to set " + gametype.getName() + " gamemode for self", PermissionDefault.OP);
|
||||
+ Permission gamemodeOther = DefaultPermissions.registerPermission(PREFIX + "gamemode." + gametype.getName() + ".other", "Allows the user to set " + gametype.getName() + " gamemode for other players", PermissionDefault.OP);
|
||||
+ gamemodeSelf.addParent(gamemodeOther, true);
|
||||
+ gamemodeVanilla.addParent(gamemodeSelf, true);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "experience", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands); // Paper - wrong permission; redirects are de-redirected and the root literal name is used, so xp -> experience
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index d1dcaaec7731e24cad3e3566fd5bb4dbe0b7336d..62b375aee2703d573b728872d6b2f9d35e9c1f24 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -233,6 +233,7 @@ public class PurpurConfig {
|
||||
public static String commandTPSBarTextColorMedium = "<gradient:#ffff55:#ffaa00><text></gradient>";
|
||||
public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
|
||||
public static int commandTPSBarTickInterval = 20;
|
||||
+ public static boolean commandGamemodeRequiresPermission = false;
|
||||
private static void commandSettings() {
|
||||
commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
|
||||
commandTPSBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.tpsbar.overlay", commandTPSBarProgressOverlay.name()));
|
||||
@@ -244,6 +245,7 @@ public class PurpurConfig {
|
||||
commandTPSBarTextColorMedium = getString("settings.command.tpsbar.text-color.medium", commandTPSBarTextColorMedium);
|
||||
commandTPSBarTextColorLow = getString("settings.command.tpsbar.text-color.low", commandTPSBarTextColorLow);
|
||||
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);
|
||||
+ commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
||||
}
|
||||
|
||||
public static int barrelRows = 3;
|
||||
53
patches/server/0148-Configurable-piston-push-limit.patch
Normal file
53
patches/server/0148-Configurable-piston-push-limit.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Sun, 2 May 2021 23:14:54 +0200
|
||||
Subject: [PATCH] Configurable piston push limit
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java b/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java
|
||||
index 205e223c356634bd6bc6bd58c6f0b7fda61a6f5f..bea05cb928d540a2f19b51bb7352d032b2dd69cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java
|
||||
@@ -81,7 +81,7 @@ public class PistonStructureResolver {
|
||||
return true;
|
||||
} else {
|
||||
int i = 1;
|
||||
- if (i + this.toPush.size() > 12) {
|
||||
+ if (i + this.toPush.size() > this.level.purpurConfig.pistonBlockPushLimit) { // Purpur
|
||||
return false;
|
||||
} else {
|
||||
while (isSticky(blockState)) {
|
||||
@@ -95,7 +95,7 @@ public class PistonStructureResolver {
|
||||
break;
|
||||
}
|
||||
|
||||
- if (++i + this.toPush.size() > 12) {
|
||||
+ if (++i + this.toPush.size() > this.level.purpurConfig.pistonBlockPushLimit) { // Purpur
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class PistonStructureResolver {
|
||||
return true;
|
||||
}
|
||||
|
||||
- if (this.toPush.size() >= 12) {
|
||||
+ if (this.toPush.size() >= this.level.purpurConfig.pistonBlockPushLimit) { // Purpur
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index b4bffe75d0462c44eada1a1412afea69732fdf6e..0cb69b395cdcee60cf4a6b8d209011bbe731b969 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -594,6 +594,11 @@ public class PurpurWorldConfig {
|
||||
lavaSpeedNotNether = getInt("blocks.lava.speed.not-nether", lavaSpeedNotNether);
|
||||
}
|
||||
|
||||
+ public int pistonBlockPushLimit = 12;
|
||||
+ private void pistonSettings() {
|
||||
+ pistonBlockPushLimit = getInt("blocks.piston.block-push-limit", pistonBlockPushLimit);
|
||||
+ }
|
||||
+
|
||||
public boolean powderSnowBypassMobGriefing = false;
|
||||
private void powderSnowSettings() {
|
||||
powderSnowBypassMobGriefing = getBoolean("blocks.powder_snow.bypass-mob-griefing", powderSnowBypassMobGriefing);
|
||||
53
patches/server/0149-Configurable-broadcast-settings.patch
Normal file
53
patches/server/0149-Configurable-broadcast-settings.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 3 May 2021 01:33:14 +0200
|
||||
Subject: [PATCH] Configurable broadcast settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index b286b157bba78021efa18f01bc91b067b0bd5874..fc87e3cfff1221a6cbaf3463ce972870f17c776a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -250,6 +250,7 @@ public class PlayerAdvancements {
|
||||
advancement.value().display().ifPresent((advancementdisplay) -> {
|
||||
// Paper start - Add Adventure message to PlayerAdvancementDoneEvent
|
||||
if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.advancementOnlyBroadcastToAffectedPlayer) this.player.sendMessage(message); else // Purpur
|
||||
this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 03fe9f169ac76ca346e798571eaeaf6aea63f775..5b3ffa3aa96dffba149c0fa8d7fb62cc36f8a4a0 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1046,6 +1046,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
}));
|
||||
PlayerTeam scoreboardteam = this.getTeam();
|
||||
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.deathMessageOnlyBroadcastToAffectedPlayer) this.sendSystemMessage(ichatbasecomponent); else // Purpur
|
||||
if (scoreboardteam != null && scoreboardteam.getDeathMessageVisibility() != Team.Visibility.ALWAYS) {
|
||||
if (scoreboardteam.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
|
||||
this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 62b375aee2703d573b728872d6b2f9d35e9c1f24..8c7295297830cdcab87ac8bb1f1e04987a5f0f25 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -203,6 +203,18 @@ public class PurpurConfig {
|
||||
deathMsgRunWithScissors = getString("settings.messages.death-message.run-with-scissors", deathMsgRunWithScissors);
|
||||
}
|
||||
|
||||
+ public static boolean advancementOnlyBroadcastToAffectedPlayer = false;
|
||||
+ public static boolean deathMessageOnlyBroadcastToAffectedPlayer = false;
|
||||
+ private static void broadcastSettings() {
|
||||
+ if (version < 13) {
|
||||
+ boolean oldValue = getBoolean("settings.advancement.only-broadcast-to-affected-player", false);
|
||||
+ set("settings.broadcasts.advancement.only-broadcast-to-affected-player", oldValue);
|
||||
+ set("settings.advancement.only-broadcast-to-affected-player", null);
|
||||
+ }
|
||||
+ advancementOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.advancement.only-broadcast-to-affected-player", advancementOnlyBroadcastToAffectedPlayer);
|
||||
+ deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
|
||||
+ }
|
||||
+
|
||||
public static String serverModName = io.papermc.paper.ServerBuildInfo.buildInfo().brandName();
|
||||
private static void serverModName() {
|
||||
serverModName = getString("settings.server-mod-name", serverModName);
|
||||
49
patches/server/0150-Configurable-mob-blindness.patch
Normal file
49
patches/server/0150-Configurable-mob-blindness.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 11 May 2021 21:00:53 -0400
|
||||
Subject: [PATCH] Configurable mob blindness
|
||||
|
||||
Ported from https://github.com/raltsmc/mobblindness
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index e2152edecce79c9bb5bbf25103efc05dce06c692..42f2749f78af7de468c07b49c7e61063e74ce0de 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1042,6 +1042,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
|
||||
d0 *= 0.5D;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ if (entity instanceof LivingEntity entityliving) {
|
||||
+ if (entityliving.hasEffect(MobEffects.BLINDNESS)) {
|
||||
+ int amplifier = entityliving.getEffect(MobEffects.BLINDNESS).getAmplifier();
|
||||
+ for (int i = 0; i < amplifier; i++) {
|
||||
+ d0 *= this.level().purpurConfig.mobsBlindnessMultiplier;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
return d0;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0cb69b395cdcee60cf4a6b8d209011bbe731b969..0d6d256aeb07f7681d7ea0815fe7c8f6279b2d3b 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -130,6 +130,7 @@ public class PurpurWorldConfig {
|
||||
public boolean persistentDroppableEntityDisplayNames = true;
|
||||
public boolean projectilesBypassMobGriefing = false;
|
||||
public boolean tickFluids = true;
|
||||
+ public double mobsBlindnessMultiplier = 1;
|
||||
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
||||
public double voidDamageHeight = -64.0D;
|
||||
public double voidDamageDealt = 4.0D;
|
||||
@@ -148,6 +149,7 @@ public class PurpurWorldConfig {
|
||||
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
|
||||
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
||||
tickFluids = getBoolean("gameplay-mechanics.tick-fluids", tickFluids);
|
||||
+ mobsBlindnessMultiplier = getDouble("gameplay-mechanics.entity-blindness-multiplier", mobsBlindnessMultiplier);
|
||||
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
||||
voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight);
|
||||
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
||||
@@ -0,0 +1,80 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 13 May 2021 16:18:29 -0500
|
||||
Subject: [PATCH] Hide hidden players from entity selector
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
index c8d39e6e1c570c9219f6066da273dc0130920519..b455c7e9d18bac3654daa8510f85cc21202e254b 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -198,10 +198,10 @@ public class EntitySelector {
|
||||
|
||||
if (this.playerName != null) {
|
||||
entityplayer = source.getServer().getPlayerList().getPlayerByName(this.playerName);
|
||||
- return entityplayer == null ? List.of() : List.of(entityplayer);
|
||||
+ return entityplayer == null || !canSee(source, entityplayer) ? List.of() : List.of(entityplayer); // Purpur
|
||||
} else if (this.entityUUID != null) {
|
||||
entityplayer = source.getServer().getPlayerList().getPlayer(this.entityUUID);
|
||||
- return entityplayer == null ? List.of() : List.of(entityplayer);
|
||||
+ return entityplayer == null || !canSee(source, entityplayer) ? List.of() : List.of(entityplayer); // Purpur
|
||||
} else {
|
||||
Vec3 vec3d = (Vec3) this.position.apply(source.getPosition());
|
||||
AABB axisalignedbb = this.getAbsoluteAabb(vec3d);
|
||||
@@ -214,7 +214,7 @@ public class EntitySelector {
|
||||
ServerPlayer entityplayer1 = (ServerPlayer) entity;
|
||||
|
||||
if (predicate.test(entityplayer1)) {
|
||||
- return List.of(entityplayer1);
|
||||
+ return !canSee(source, entityplayer1) ? List.of() : List.of(entityplayer1); // Purpur
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,7 @@ public class EntitySelector {
|
||||
|
||||
if (this.isWorldLimited()) {
|
||||
object = source.getLevel().getPlayers(predicate, i);
|
||||
+ ((List) object).removeIf(entityplayer3 -> !canSee(source, (ServerPlayer) entityplayer3)); // Purpur
|
||||
} else {
|
||||
object = new ObjectArrayList();
|
||||
Iterator iterator = source.getServer().getPlayerList().getPlayers().iterator();
|
||||
@@ -232,7 +233,7 @@ public class EntitySelector {
|
||||
while (iterator.hasNext()) {
|
||||
ServerPlayer entityplayer2 = (ServerPlayer) iterator.next();
|
||||
|
||||
- if (predicate.test(entityplayer2)) {
|
||||
+ if (predicate.test(entityplayer2) && canSee(source, entityplayer2)) { // Purpur
|
||||
((List) object).add(entityplayer2);
|
||||
if (((List) object).size() >= i) {
|
||||
return (List) object;
|
||||
@@ -299,4 +300,10 @@ public class EntitySelector {
|
||||
public static Component joinNames(List<? extends Entity> entities) {
|
||||
return ComponentUtils.formatList(entities, Entity::getDisplayName);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ private boolean canSee(CommandSourceStack sender, ServerPlayer target) {
|
||||
+ return !org.purpurmc.purpur.PurpurConfig.hideHiddenPlayersFromEntitySelector || !(sender.getEntity() instanceof ServerPlayer player) || player.getBukkitEntity().canSee(target.getBukkitEntity());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 8c7295297830cdcab87ac8bb1f1e04987a5f0f25..e55db78a18a79a5de7320d8902ea2b9e3f6e9880 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -246,6 +246,7 @@ public class PurpurConfig {
|
||||
public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
|
||||
public static int commandTPSBarTickInterval = 20;
|
||||
public static boolean commandGamemodeRequiresPermission = false;
|
||||
+ public static boolean hideHiddenPlayersFromEntitySelector = false;
|
||||
private static void commandSettings() {
|
||||
commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
|
||||
commandTPSBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.tpsbar.overlay", commandTPSBarProgressOverlay.name()));
|
||||
@@ -258,6 +259,7 @@ public class PurpurConfig {
|
||||
commandTPSBarTextColorLow = getString("settings.command.tpsbar.text-color.low", commandTPSBarTextColorLow);
|
||||
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);
|
||||
commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
||||
+ hideHiddenPlayersFromEntitySelector = getBoolean("settings.command.hide-hidden-players-from-entity-selector", hideHiddenPlayersFromEntitySelector);
|
||||
}
|
||||
|
||||
public static int barrelRows = 3;
|
||||
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Thu, 29 Apr 2021 20:28:18 -0400
|
||||
Subject: [PATCH] Config for health to impact Creeper explosion radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
index a194cc234e24094da0cbee8c6c4fe123c9b100be..904c3af4809877165a0981f76572d7f0dd0662e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -370,9 +370,10 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
this.exploding = true; // Purpur
|
||||
if (!this.level().isClientSide) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
+ float multiplier = this.level().purpurConfig.creeperHealthRadius ? this.getHealth() / this.getMaxHealth() : 1; // Purpur
|
||||
|
||||
// CraftBukkit start
|
||||
- ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, this.explosionRadius * f, false);
|
||||
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, (this.explosionRadius * f) * multiplier, false); // Purpur
|
||||
if (!event.isCancelled()) {
|
||||
// CraftBukkit end
|
||||
this.dead = true;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0d6d256aeb07f7681d7ea0815fe7c8f6279b2d3b..148b07122ab6e16152916fcbc19aad862b5afb58 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -936,6 +936,7 @@ public class PurpurWorldConfig {
|
||||
public boolean creeperBypassMobGriefing = false;
|
||||
public boolean creeperTakeDamageFromWater = false;
|
||||
public boolean creeperExplodeWhenKilled = false;
|
||||
+ public boolean creeperHealthRadius = false;
|
||||
private void creeperSettings() {
|
||||
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
|
||||
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
|
||||
@@ -951,6 +952,7 @@ public class PurpurWorldConfig {
|
||||
creeperBypassMobGriefing = getBoolean("mobs.creeper.bypass-mob-griefing", creeperBypassMobGriefing);
|
||||
creeperTakeDamageFromWater = getBoolean("mobs.creeper.takes-damage-from-water", creeperTakeDamageFromWater);
|
||||
creeperExplodeWhenKilled = getBoolean("mobs.creeper.explode-when-killed", creeperExplodeWhenKilled);
|
||||
+ creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius);
|
||||
}
|
||||
|
||||
public boolean dolphinRidable = false;
|
||||
145
patches/server/0153-Iron-golem-calm-anger-options.patch
Normal file
145
patches/server/0153-Iron-golem-calm-anger-options.patch
Normal file
@@ -0,0 +1,145 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 13 May 2021 21:22:51 -0500
|
||||
Subject: [PATCH] Iron golem calm anger options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
index 65232a2cb23eb4757abdc8741d55e0faccf4c0bb..a820bbbe89dee9e6de2e7d5f72f43d1d5114cedf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
@@ -92,6 +92,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
if (level().purpurConfig.ironGolemCanSwim) this.goalSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.FloatGoal(this)); // Purpur
|
||||
+ if (this.level().purpurConfig.ironGolemPoppyCalm) this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.ReceiveFlower(this)); // Purpur
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true));
|
||||
this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 0.9D, 32.0F));
|
||||
@@ -315,6 +316,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
|
||||
this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, f1);
|
||||
itemstack.consume(1, player);
|
||||
+ if (this.level().purpurConfig.ironGolemHealCalm && isAngry() && getHealth() == getMaxHealth()) stopBeingAngry(); // Purpur
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 148b07122ab6e16152916fcbc19aad862b5afb58..1f52afb311629bceac13bbedda0f2ec7d1b7bb46 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1394,6 +1394,8 @@ public class PurpurWorldConfig {
|
||||
public boolean ironGolemCanSwim = false;
|
||||
public double ironGolemMaxHealth = 100.0D;
|
||||
public boolean ironGolemTakeDamageFromWater = false;
|
||||
+ public boolean ironGolemPoppyCalm = false;
|
||||
+ public boolean ironGolemHealCalm = false;
|
||||
private void ironGolemSettings() {
|
||||
ironGolemRidable = getBoolean("mobs.iron_golem.ridable", ironGolemRidable);
|
||||
ironGolemRidableInWater = getBoolean("mobs.iron_golem.ridable-in-water", ironGolemRidableInWater);
|
||||
@@ -1406,6 +1408,8 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
ironGolemMaxHealth = getDouble("mobs.iron_golem.attributes.max_health", ironGolemMaxHealth);
|
||||
ironGolemTakeDamageFromWater = getBoolean("mobs.iron_golem.takes-damage-from-water", ironGolemTakeDamageFromWater);
|
||||
+ ironGolemPoppyCalm = getBoolean("mobs.iron_golem.poppy-calms-anger", ironGolemPoppyCalm);
|
||||
+ ironGolemHealCalm = getBoolean("mobs.iron_golem.healing-calms-anger", ironGolemHealCalm);
|
||||
}
|
||||
|
||||
public boolean llamaRidable = false;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/entity/ai/ReceiveFlower.java b/src/main/java/org/purpurmc/purpur/entity/ai/ReceiveFlower.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9660716f4162a4441c6e1b0baddef8f5086566c5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/entity/ai/ReceiveFlower.java
|
||||
@@ -0,0 +1,91 @@
|
||||
+package org.purpurmc.purpur.entity.ai;
|
||||
+
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.InteractionHand;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.ai.goal.Goal;
|
||||
+import net.minecraft.world.entity.animal.IronGolem;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+
|
||||
+import java.util.EnumSet;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+public class ReceiveFlower extends Goal {
|
||||
+ private final IronGolem irongolem;
|
||||
+ private ServerPlayer target;
|
||||
+ private int cooldown;
|
||||
+
|
||||
+ public ReceiveFlower(IronGolem entity) {
|
||||
+ this.irongolem = entity;
|
||||
+ setFlags(EnumSet.of(Flag.MOVE, Flag.LOOK));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canUse() {
|
||||
+ if (this.irongolem.getOfferFlowerTick() > 0) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!this.irongolem.isAngry()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ UUID uuid = this.irongolem.getPersistentAngerTarget();
|
||||
+ if (uuid == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ Entity target = ((ServerLevel) this.irongolem.level()).getEntity(uuid);
|
||||
+ if (!(target instanceof ServerPlayer player)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ InteractionHand hand = getPoppyHand(player);
|
||||
+ if (hand == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ removeFlower(player, hand);
|
||||
+ this.target = player;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canContinueToUse() {
|
||||
+ return this.cooldown > 0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void start() {
|
||||
+ this.cooldown = 100;
|
||||
+ this.irongolem.stopBeingAngry();
|
||||
+ this.irongolem.offerFlower(true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void stop() {
|
||||
+ this.irongolem.offerFlower(false);
|
||||
+ this.target = null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void tick() {
|
||||
+ this.irongolem.getLookControl().setLookAt(this.target, 30.0F, 30.0F);
|
||||
+ --this.cooldown;
|
||||
+ }
|
||||
+
|
||||
+ private InteractionHand getPoppyHand(ServerPlayer player) {
|
||||
+ if (isPoppy(player.getMainHandItem())) {
|
||||
+ return InteractionHand.MAIN_HAND;
|
||||
+ }
|
||||
+ if (isPoppy(player.getOffhandItem())) {
|
||||
+ return InteractionHand.OFF_HAND;
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ private void removeFlower(ServerPlayer player, InteractionHand hand) {
|
||||
+ player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
+ }
|
||||
+
|
||||
+ private boolean isPoppy(ItemStack item) {
|
||||
+ return item.getItem() == Blocks.POPPY.asItem();
|
||||
+ }
|
||||
+}
|
||||
71
patches/server/0154-Breedable-parrots.patch
Normal file
71
patches/server/0154-Breedable-parrots.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 13 May 2021 22:17:50 -0500
|
||||
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 c4aa5b254ad2a1b82f8f738ebf64a5a985857b36..e486b3a73277582bc9c63b6f8ed4dfd995e34cb9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -221,6 +221,7 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
||||
protected void registerGoals() {
|
||||
//this.goalSelector.addGoal(0, new TamableAnimal.TamableAnimalPanicGoal(1.25D)); // Purpur - move down
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
+ if (this.level().purpurConfig.parrotBreedable) this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.BreedGoal(this, 1.0D)); // Purpur
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D)); // Purpur
|
||||
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F));
|
||||
@@ -329,6 +330,7 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
||||
}
|
||||
}
|
||||
|
||||
+ if (this.level().purpurConfig.parrotBreedable) return super.mobInteract(player, hand); // Purpur
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
} else if (!itemstack.is(ItemTags.PARROT_POISONOUS_FOOD)) {
|
||||
if (!this.isFlying() && this.isTame() && this.isOwnedBy(player)) {
|
||||
@@ -353,7 +355,7 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
||||
|
||||
@Override
|
||||
public boolean isFood(ItemStack stack) {
|
||||
- return false;
|
||||
+ return this.level().purpurConfig.parrotBreedable && stack.is(ItemTags.PARROT_FOOD); // Purpur
|
||||
}
|
||||
|
||||
public static boolean checkParrotSpawnRules(EntityType<Parrot> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
|
||||
@@ -365,13 +367,13 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
||||
|
||||
@Override
|
||||
public boolean canMate(Animal other) {
|
||||
- return false;
|
||||
+ return super.canMate(other); // Purpur
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
|
||||
- return null;
|
||||
+ return world.purpurConfig.parrotBreedable ? EntityType.PARROT.create(world) : null; // Purpur
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 1f52afb311629bceac13bbedda0f2ec7d1b7bb46..a2f1d862655e3df73367c66f71b85b96778a2fb8 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1564,6 +1564,7 @@ public class PurpurWorldConfig {
|
||||
public double parrotMaxY = 320D;
|
||||
public double parrotMaxHealth = 6.0D;
|
||||
public boolean parrotTakeDamageFromWater = false;
|
||||
+ public boolean parrotBreedable = false;
|
||||
private void parrotSettings() {
|
||||
parrotRidable = getBoolean("mobs.parrot.ridable", parrotRidable);
|
||||
parrotRidableInWater = getBoolean("mobs.parrot.ridable-in-water", parrotRidableInWater);
|
||||
@@ -1576,6 +1577,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
parrotMaxHealth = getDouble("mobs.parrot.attributes.max_health", parrotMaxHealth);
|
||||
parrotTakeDamageFromWater = getBoolean("mobs.parrot.takes-damage-from-water", parrotTakeDamageFromWater);
|
||||
+ parrotBreedable = getBoolean("mobs.parrot.can-breed", parrotBreedable);
|
||||
}
|
||||
|
||||
public boolean phantomRidable = false;
|
||||
@@ -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 9ad276a73cba04edbe48f828031a15727d768a5b..337bd2011c471361653c317004f8380c9fddfc47 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -673,7 +673,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a2f1d862655e3df73367c66f71b85b96778a2fb8..6f3e36d2fc1e1a163dbdf647a4f8bdda4ccb5626 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -260,6 +260,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);
|
||||
@@ -312,6 +313,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;
|
||||
@@ -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 2578bfa9d31e04506d0e91da22913d3948f9656d..6716e8cc5eff93f019fe49f88faa724d8849f128 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1339,7 +1339,7 @@ public abstract class Player extends LivingEntity {
|
||||
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
if (flag2) {
|
||||
damagesource = damagesource.critical(true); // Paper start - critical damage API
|
||||
- f *= 1.5F;
|
||||
+ f *= this.level().purpurConfig.playerCriticalDamageMultiplier; // Purpur
|
||||
}
|
||||
|
||||
float f3 = f + f1;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 6f3e36d2fc1e1a163dbdf647a4f8bdda4ccb5626..550b73358bb6595ed0d0070322ec188f4ef01027 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -356,6 +356,7 @@ public class PurpurWorldConfig {
|
||||
public boolean creativeOnePunch = false;
|
||||
public boolean playerSleepNearMonsters = false;
|
||||
public boolean playersSkipNight = true;
|
||||
+ public double playerCriticalDamageMultiplier = 1.5D;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -374,6 +375,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 boolean silkTouchEnabled = false;
|
||||
@@ -0,0 +1,36 @@
|
||||
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 fbe15cdd5b9bca2ab4b1e871abbbdbff49ade8a4..23d113842bf774bdc74e0dffcc97b642bc8684f1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java
|
||||
@@ -48,8 +48,8 @@ public class DragonEggBlock extends FallingBlock {
|
||||
}
|
||||
|
||||
private void teleport(BlockState state, Level world, BlockPos pos) {
|
||||
+ if (!world.purpurConfig.dragonEggTeleport) return; // Purpur
|
||||
WorldBorder worldborder = world.getWorldBorder();
|
||||
-
|
||||
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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 550b73358bb6595ed0d0070322ec188f4ef01027..46d64697324cde8c2115e3fc1f93402bd6169f8a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -521,6 +521,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;
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
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 0fc30ce511f449d2a3ddab28c86f7e388223ece1..0055a9c5446a2d6b8aa9c6903092e4f82af5ee32 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -315,7 +315,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!");
|
||||
ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot
|
||||
} else {
|
||||
- ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.unverified_username"));
|
||||
+ ServerLoginPacketListenerImpl.this.disconnect(org.purpurmc.purpur.PurpurConfig.unverifiedUsername.equals("default") ? Component.translatable("multiplayer.disconnect.unverified_username") : io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.unverifiedUsername))); // Purpur
|
||||
ServerLoginPacketListenerImpl.LOGGER.error("Username '{}' tried to join with an invalid session", s1);
|
||||
}
|
||||
} catch (AuthenticationUnavailableException authenticationunavailableexception) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index e55db78a18a79a5de7320d8902ea2b9e3f6e9880..e6eabe37e65caec92df3ab446f2872875d198f96 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -184,6 +184,7 @@ public class PurpurConfig {
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
public static String tpsbarCommandOutput = "<green>Tpsbar toggled <onoff> for <target>";
|
||||
public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
+ 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);
|
||||
@@ -196,6 +197,7 @@ public class PurpurConfig {
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
tpsbarCommandOutput = getString("settings.messages.tpsbar-command-output", tpsbarCommandOutput);
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
+ unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
|
||||
}
|
||||
|
||||
public static String deathMsgRunWithScissors = "<player> slipped and fell on their shears";
|
||||
@@ -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 26951cc5fb64a8d6c99d450dbe236f28b56e44a7..b57f3c2eb0c23798ee3026b4576401fa83e4352c 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
@@ -391,7 +391,7 @@ public class AnvilMenu extends ItemCombinerMenu {
|
||||
}
|
||||
|
||||
public static int calculateIncreasedRepairCost(int cost) {
|
||||
- return (int) Math.min((long) cost * 2L + 1L, 2147483647L);
|
||||
+ return org.purpurmc.purpur.PurpurConfig.anvilCumulativeCost ? (int) Math.min((long) cost * 2L + 1L, 2147483647L) : 0;
|
||||
}
|
||||
|
||||
public boolean setItemName(String newItemName) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index e6eabe37e65caec92df3ab446f2872875d198f96..04be61a14d33dad94d7193c13ccefdd05a4620d0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -269,6 +269,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);
|
||||
@@ -301,6 +302,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 allowUnsafeEnchants = false;
|
||||
@@ -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 af49371612b56f6e191c580cd54a80e5e77989a3..26c2473f9cbcaaeefd5e1a60a62bd6e77faf6709 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -406,7 +406,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 f52823146944d333f2d050e90261b570ba66f5dd..d8efb00c325448d566c59418fe22268c6eb4cfce 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
|
||||
@@ -212,7 +212,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
private static boolean releaseOccupant(Level world, BlockPos blockposition, BlockState iblockdata, BeehiveBlockEntity.Occupant tileentitybeehive_c, @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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 46d64697324cde8c2115e3fc1f93402bd6169f8a..c7cbb28870e3640f88c5b2b33f89212580f1c652 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -761,6 +761,8 @@ public class PurpurWorldConfig {
|
||||
public double beeMaxHealth = 10.0D;
|
||||
public int beeBreedingTicks = 6000;
|
||||
public boolean beeTakeDamageFromWater = false;
|
||||
+ 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);
|
||||
@@ -774,6 +776,8 @@ public class PurpurWorldConfig {
|
||||
beeMaxHealth = getDouble("mobs.bee.attributes.max_health", beeMaxHealth);
|
||||
beeBreedingTicks = getInt("mobs.bee.breeding-delay-ticks", beeBreedingTicks);
|
||||
beeTakeDamageFromWater = getBoolean("mobs.bee.takes-damage-from-water", beeTakeDamageFromWater);
|
||||
+ beeCanWorkAtNight = getBoolean("mobs.bee.can-work-at-night", beeCanWorkAtNight);
|
||||
+ beeCanWorkInRain = getBoolean("mobs.bee.can-work-in-rain", beeCanWorkInRain);
|
||||
}
|
||||
|
||||
public boolean blazeRidable = false;
|
||||
397
patches/server/0161-API-for-any-mob-to-burn-daylight.patch
Normal file
397
patches/server/0161-API-for-any-mob-to-burn-daylight.patch
Normal file
@@ -0,0 +1,397 @@
|
||||
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/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index def6b00d9ce89120c8ad99516c733a895eba9473..3ba86e5b66ff4d3d4c8675f9b084b91ab034eeb4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -461,6 +461,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public boolean canSaveToDisk() {
|
||||
return true;
|
||||
}
|
||||
+ // copied from Mob
|
||||
+ public boolean isSunBurnTick() {
|
||||
+ if (this.level().isDay() && !this.level().isClientSide) {
|
||||
+ float f = this.getLightLevelDependentMagicValue();
|
||||
+ BlockPos blockposition = BlockPos.containing(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;
|
||||
+ }
|
||||
+
|
||||
// Purpur end
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 42f2749f78af7de468c07b49c7e61063e74ce0de..25b3fe2eb700a4a957957fa0be711d2a27b76597 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -286,6 +286,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
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
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur
|
||||
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -816,6 +817,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> {
|
||||
nbt.put("Brain", nbtbase);
|
||||
});
|
||||
+ nbt.putBoolean("Purpur.ShouldBurnInDay", shouldBurnInDay); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -904,6 +906,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
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
|
||||
@@ -3580,6 +3587,33 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.hurt(this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
|
||||
+ // Purpur start - copied from Zombie
|
||||
+ if (this.isAlive()) {
|
||||
+ boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
|
||||
+
|
||||
+ if (flag) {
|
||||
+ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
+
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ if (itemstack.isDamageableItem()) {
|
||||
+ Item item = itemstack.getItem();
|
||||
+
|
||||
+ itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
|
||||
+ if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
|
||||
+ this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
||||
+ this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ flag = false;
|
||||
+ }
|
||||
+
|
||||
+ if (flag) {
|
||||
+ this.igniteForSeconds(8.0F);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // 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 7535f28c2e181363a7bd4874a14244f9cb0a06fe..495476f4ba65db707af017679fd183acf2ee9499 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1773,17 +1773,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
protected void playAttackSound() {}
|
||||
|
||||
public boolean isSunBurnTick() {
|
||||
- if (this.level().isDay() && !this.level().isClientSide) {
|
||||
- float f = this.getLightLevelDependentMagicValue();
|
||||
- BlockPos blockposition = BlockPos.containing(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();
|
||||
}
|
||||
|
||||
@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 5c1aa5859ac411098054be9f52bac0860ee667a5..f56580bdae043fa4e5e195481ae3d344fc725621 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -66,6 +66,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
|
||||
@@ -96,37 +97,14 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
abstract SoundEvent getStepSound();
|
||||
|
||||
// Paper start - shouldBurnInDay API
|
||||
- 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 - shouldBurnInDay API
|
||||
|
||||
@Override
|
||||
public void aiStep() {
|
||||
- boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
|
||||
-
|
||||
- if (flag) {
|
||||
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
-
|
||||
- if (!itemstack.isEmpty()) {
|
||||
- if (itemstack.isDamageableItem()) {
|
||||
- Item item = itemstack.getItem();
|
||||
-
|
||||
- itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
|
||||
- if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
|
||||
- this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
||||
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- flag = false;
|
||||
- }
|
||||
-
|
||||
- if (flag) {
|
||||
- this.igniteForSeconds(8.0F);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Purpur start - implemented in LivingEntity
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -242,7 +220,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
this.reassessWeaponGoal();
|
||||
// Paper start - shouldBurnInDay API
|
||||
if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity
|
||||
}
|
||||
// Paper end - shouldBurnInDay API
|
||||
}
|
||||
@@ -251,7 +229,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@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 - shouldBurnInDay API
|
||||
|
||||
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 cb96bd5769159e6c25968673ea07cd6d107cff46..440c90feeae3a55c98e2011ecb27c28d58f11e6e 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
|
||||
@@ -75,7 +76,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 554e01cf4fb3b15549c8c381274014c4735e08c6..df85753709271a6ad1f802da63f189200ead9a3a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -59,6 +59,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
this.xpReward = 5;
|
||||
this.moveControl = new Phantom.PhantomMoveControl(this);
|
||||
this.lookControl = new Phantom.PhantomLookControl(this, this);
|
||||
+ this.setShouldBurnInDay(true); // Purpur
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
@@ -247,15 +248,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
@Override
|
||||
public void aiStep() {
|
||||
- // Purpur start
|
||||
- boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
- boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
||||
- if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
|
||||
- // Purpur end
|
||||
- if (getRider() == null || !this.isControllable()) // Purpur
|
||||
- this.igniteForSeconds(8.0F);
|
||||
- }
|
||||
-
|
||||
+ // Purpur - moved down to shouldBurnInDay()
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -283,7 +276,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
if (nbt.hasUUID("Paper.SpawningEntity")) {
|
||||
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
|
||||
}
|
||||
- if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && nbt.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity
|
||||
this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end
|
||||
@@ -300,7 +293,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
|
||||
}
|
||||
|
||||
@@ -356,8 +349,20 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
return this.spawningEntity;
|
||||
}
|
||||
public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
|
||||
- private boolean shouldBurnInDay = true;
|
||||
- public boolean shouldBurnInDay() { return shouldBurnInDay; }
|
||||
+
|
||||
+ // private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
|
||||
+ // Purpur start
|
||||
+ public boolean shouldBurnInDay() {
|
||||
+ // Purpur start
|
||||
+ boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
||||
+ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
|
||||
+ // Purpur end
|
||||
+ if (getRider() == null || !this.isControllable()) // Purpur
|
||||
+ this.igniteForSeconds(8.0F);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur End
|
||||
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 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..c8a664447f19e437eb7c615563add92715be9650 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -97,11 +97,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 - Add more Zombie API
|
||||
+ // private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // 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().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
|
||||
+ this.setShouldBurnInDay(true); // Purpur
|
||||
}
|
||||
|
||||
public Zombie(Level world) {
|
||||
@@ -297,32 +298,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()) {
|
||||
- Item item = itemstack.getItem();
|
||||
-
|
||||
- itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
|
||||
- if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
|
||||
- this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
||||
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- flag = false;
|
||||
- }
|
||||
-
|
||||
- if (flag) {
|
||||
- this.igniteForSeconds(8.0F);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Purpur - implemented in LivingEntity
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -360,6 +336,7 @@ public class Zombie extends Monster {
|
||||
|
||||
}
|
||||
|
||||
+ public boolean shouldBurnInDay() { return isSunSensitive(); } // Purpur - for ABI compatibility
|
||||
public boolean isSunSensitive() {
|
||||
return this.shouldBurnInDay; // Paper - Add more Zombie API
|
||||
}
|
||||
@@ -488,7 +465,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 - Add more Zombie API
|
||||
+ // nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -502,7 +479,7 @@ public class Zombie extends Monster {
|
||||
}
|
||||
// Paper start - Add more Zombie API
|
||||
if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity
|
||||
}
|
||||
// Paper end - Add more Zombie API
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 3629a6f99e99ca686446a23eea0329771c4d11cc..4c1303c5b9f631efd9497cf893a6ca0348157f2c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -86,6 +86,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean isInDaylight() {
|
||||
+ return getHandle().isSunBurnTick();
|
||||
+ }
|
||||
+
|
||||
public static <T extends Entity> CraftEntity getEntity(CraftServer server, T entity) {
|
||||
Preconditions.checkArgument(entity != null, "Unknown entity");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 386647f6000c71c59ab8d7875219eefdc5a3d7ef..88be8ebe619f2e42bdffab534da4f269b802cf41 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1188,5 +1188,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
|
||||
}
|
||||
99
patches/server/0162-Config-MobEffect-by-world.patch
Normal file
99
patches/server/0162-Config-MobEffect-by-world.patch
Normal file
@@ -0,0 +1,99 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Sat, 23 Sep 2023 03:59:15 -0700
|
||||
Subject: [PATCH] Config MobEffect by world
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/HungerMobEffect.java b/src/main/java/net/minecraft/world/effect/HungerMobEffect.java
|
||||
index a476b56ed98d0a1afc6a396ce29424df78f24ada..5119ff3414fbd9a1ae0a8db0fd15bd3c57c8e148 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/HungerMobEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/HungerMobEffect.java
|
||||
@@ -12,7 +12,7 @@ class HungerMobEffect extends MobEffect {
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if (entity instanceof Player entityhuman) {
|
||||
- entityhuman.causeFoodExhaustion(0.005F * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
+ entityhuman.causeFoodExhaustion(entity.level().purpurConfig.humanHungerExhaustionAmount * (float) (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent // Purpur
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/PoisonMobEffect.java b/src/main/java/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
index 3e7a703632251e0a5234259e3702b58b332e5ef0..f2cc43fbccb5d2ba012b350268065c2cfe014faf 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
@@ -10,8 +10,8 @@ class PoisonMobEffect extends MobEffect {
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
- if (entity.getHealth() > 1.0F) {
|
||||
- entity.hurt(entity.damageSources().poison(), 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
|
||||
+ if (entity.getHealth() > entity.level().purpurConfig.entityMinimalHealthPoison) { // Purpur
|
||||
+ entity.hurt(entity.damageSources().poison(), entity.level().purpurConfig.entityPoisonDegenerationAmount); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON // Purpur
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/RegenerationMobEffect.java b/src/main/java/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
index 4dba3e813e054951cbfbe0b323c1f5d973469cc0..426f61d55b9692cf085368df4e4df6f6997aa420 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
@@ -11,7 +11,7 @@ class RegenerationMobEffect extends MobEffect {
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if (entity.getHealth() < entity.getMaxHealth()) {
|
||||
- entity.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit
|
||||
+ entity.heal(entity.level().purpurConfig.entityHealthRegenAmount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit // Purpur
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/SaturationMobEffect.java b/src/main/java/net/minecraft/world/effect/SaturationMobEffect.java
|
||||
index 7b415dca88f50dc472fe4be96e5ef0996f117913..2bb872f29350d15db46b32c686aef78fc1b6fa29 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/SaturationMobEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/SaturationMobEffect.java
|
||||
@@ -20,7 +20,7 @@ class SaturationMobEffect extends InstantenousMobEffect {
|
||||
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
|
||||
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
|
||||
}
|
||||
|
||||
((CraftPlayer) entityhuman.getBukkitEntity()).sendHealthUpdate();
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/WitherMobEffect.java b/src/main/java/net/minecraft/world/effect/WitherMobEffect.java
|
||||
index f43bf280999ff3860cc702def50cc62b131eb1bd..66d9e99a351f5fc6cf58be3bee4397d92c932d64 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/WitherMobEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/WitherMobEffect.java
|
||||
@@ -9,7 +9,7 @@ class WitherMobEffect extends MobEffect {
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
- entity.hurt(entity.damageSources().wither(), 1.0F);
|
||||
+ entity.hurt(entity.damageSources().wither(), entity.level().purpurConfig.entityWitherDegenerationAmount); // Purpur
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index c7cbb28870e3640f88c5b2b33f89212580f1c652..58a92d771b8ea5562c10d2149e694a3e84aae6b1 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -316,6 +316,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;
|
||||
@@ -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 814e70f558d7a6186233da0ff86c94c95d390e09..d1fb77d83d48183a9a37dbeec7bb0fda623d7e9b 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
|
||||
@@ -92,6 +92,16 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
|
||||
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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 58a92d771b8ea5562c10d2149e694a3e84aae6b1..8e30b0bec3ffb54328110cdc726234a48f28f175 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -488,6 +488,17 @@ public class PurpurWorldConfig {
|
||||
anvilColorsUseMiniMessage = getBoolean("blocks.anvil.use-mini-message", anvilColorsUseMiniMessage);
|
||||
}
|
||||
|
||||
+ 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;
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 13:36:20 +0200
|
||||
Subject: [PATCH] Make lightning rod range configurable
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 04719932fc9291d09b20c285c5516c06cfbc6693..6ee3292a5ca8421226be0afef73cbb1484b4311f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -806,7 +806,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return holder.is(PoiTypes.LIGHTNING_ROD);
|
||||
}, (blockposition1) -> {
|
||||
return blockposition1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1;
|
||||
- }, pos, 128, PoiManager.Occupancy.ANY);
|
||||
+ }, pos, org.purpurmc.purpur.PurpurConfig.lightningRodRange, PoiManager.Occupancy.ANY);
|
||||
|
||||
return optional.map((blockposition1) -> {
|
||||
return blockposition1.above(1);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 04be61a14d33dad94d7193c13ccefdd05a4620d0..2e886467a77857bcbc156443068ef4b19815e8df 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -270,6 +270,7 @@ public class PurpurConfig {
|
||||
public static boolean cryingObsidianValidForPortalFrame = false;
|
||||
public static int beeInsideBeeHive = 3;
|
||||
public static boolean anvilCumulativeCost = true;
|
||||
+ public static int lightningRodRange = 128;
|
||||
private static void blockSettings() {
|
||||
if (version < 3) {
|
||||
boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
|
||||
@@ -303,6 +304,7 @@ public class PurpurConfig {
|
||||
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);
|
||||
+ lightningRodRange = getInt("settings.blocks.lightning_rod.range", lightningRodRange);
|
||||
}
|
||||
|
||||
public static boolean allowUnsafeEnchants = false;
|
||||
@@ -0,0 +1,77 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 24 Jun 2021 21:19:30 -0500
|
||||
Subject: [PATCH] Burp delay, burp after eating food fills hunger bar
|
||||
completely
|
||||
|
||||
|
||||
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 6716e8cc5eff93f019fe49f88faa724d8849f128..4a5a18443db0f7c69b61db2ded63355ef4d72d9a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -197,6 +197,7 @@ public abstract class Player extends LivingEntity {
|
||||
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
public int sixRowEnderchestSlotCount = -1; // Purpur
|
||||
+ public int burpDelay = 0; // Purpur
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
@@ -272,6 +273,12 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ // Purpur start
|
||||
+ if (this.burpDelay > 0 && --this.burpDelay == 0) {
|
||||
+ this.level().playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level().random.nextFloat() * 0.1F + 0.9F);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
this.noPhysics = this.isSpectator();
|
||||
if (this.isSpectator()) {
|
||||
this.setOnGround(false);
|
||||
@@ -2369,7 +2376,7 @@ public abstract class Player extends LivingEntity {
|
||||
public ItemStack eat(Level world, ItemStack stack, FoodProperties foodComponent) {
|
||||
this.getFoodData().eat(stack, foodComponent); // CraftBukkit
|
||||
this.awardStat(Stats.ITEM_USED.get(stack.getItem()));
|
||||
- world.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
+ // world.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Purpur - moved to tick()
|
||||
if (this instanceof ServerPlayer) {
|
||||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) this, stack);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index bd3f78e6453cfe18aa3da38176b04d734d83bb4b..515dd3b769917c4aa60ce180ef24f38ca12e6848 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -39,7 +39,9 @@ public class FoodData {
|
||||
}
|
||||
|
||||
public void eat(int food, float saturationModifier) {
|
||||
+ int oldValue = this.foodLevel; // Purpur
|
||||
this.add(food, FoodConstants.saturationByModifier(food, saturationModifier));
|
||||
+ if (this.entityhuman.level().purpurConfig.playerBurpWhenFull && this.foodLevel == 20 && oldValue < 20) this.entityhuman.burpDelay = this.entityhuman.level().purpurConfig.playerBurpDelay; // Purpur
|
||||
}
|
||||
|
||||
public void eat(FoodProperties foodComponent) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 8e30b0bec3ffb54328110cdc726234a48f28f175..c4ce94b55e561cd99b680afd753393fc6bda8348 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -372,6 +372,8 @@ public class PurpurWorldConfig {
|
||||
public boolean playerSleepNearMonsters = false;
|
||||
public boolean playersSkipNight = true;
|
||||
public double playerCriticalDamageMultiplier = 1.5D;
|
||||
+ public int playerBurpDelay = 10;
|
||||
+ public boolean playerBurpWhenFull = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -391,6 +393,8 @@ public class PurpurWorldConfig {
|
||||
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);
|
||||
+ playerBurpDelay = getInt("gameplay-mechanics.player.burp-delay", playerBurpDelay);
|
||||
+ playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull);
|
||||
}
|
||||
|
||||
public boolean silkTouchEnabled = false;
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Thu, 24 Jun 2021 02:28:32 +0200
|
||||
Subject: [PATCH] Allow player join full server by permission
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index b6289dbad3d2a840dfef9505127a343f032f1da5..4c639d3ea0ed99592fcd04381a314ead19ed4ab4 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -747,7 +747,7 @@ public abstract class PlayerList {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
|
||||
} else {
|
||||
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;
|
||||
- if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) {
|
||||
+ if (this.players.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
||||
}
|
||||
}
|
||||
97
patches/server/0167-Shulker-spawn-from-bullet-options.patch
Normal file
97
patches/server/0167-Shulker-spawn-from-bullet-options.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 25 Jun 2021 19:48:21 -0500
|
||||
Subject: [PATCH] Shulker spawn from bullet options
|
||||
|
||||
(0 - 1) / 5.0 = -0.2 (can never happen because self is included in count)
|
||||
(1 - 1) / 5.0 = 0.0 1.0 - 0.0 = 1.0 100% (just self)
|
||||
(2 - 1) / 5.0 = 0.2 1.0 - 0.2 = 0.8 80% (1 other shulker)
|
||||
(3 - 1) / 5.0 = 0.4 1.0 - 0.4 = 0.6 60% (2 other shulkers)
|
||||
(4 - 1) / 5.0 = 0.6 1.0 - 0.6 = 0.4 40% (3 other shulkers)
|
||||
(5 - 1) / 5.0 = 0.8 1.0 - 0.8 = 0.2 20% (4 other shulkers)
|
||||
(6 - 1) / 5.0 = 1.0 1.0 - 1.0 = 0.0 0% (5 other shulkers)
|
||||
(7 - 1) / 5.0 = 1.2 1.0 - 1.2 = -0.2 0% (6 other shulkers)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
index ff6a91caa9bd7fa90d71a2014354c67570d4fccb..fde6bae8a5d9eba7ec87c73047a6e3f91629828e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -510,12 +510,21 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
|
||||
Vec3 vec3d = this.position();
|
||||
AABB axisalignedbb = this.getBoundingBox();
|
||||
|
||||
- if (!this.isClosed() && this.teleportSomewhere()) {
|
||||
- int i = this.level().getEntities((EntityTypeTest) EntityType.SHULKER, axisalignedbb.inflate(8.0D), Entity::isAlive).size();
|
||||
- float f = (float) (i - 1) / 5.0F;
|
||||
-
|
||||
- if (this.level().random.nextFloat() >= f) {
|
||||
+ if ((!this.level().purpurConfig.shulkerSpawnFromBulletRequireOpenLid || !this.isClosed()) && this.teleportSomewhere()) {
|
||||
+ // Purpur start
|
||||
+ float chance = this.level().purpurConfig.shulkerSpawnFromBulletBaseChance;
|
||||
+ if (!this.level().purpurConfig.shulkerSpawnFromBulletNearbyEquation.isBlank()) {
|
||||
+ int nearby = this.level().getEntities((EntityTypeTest) EntityType.SHULKER, axisalignedbb.inflate(this.level().purpurConfig.shulkerSpawnFromBulletNearbyRange), Entity::isAlive).size();
|
||||
+ try {
|
||||
+ chance -= ((Number) scriptEngine.eval("let nearby = " + nearby + "; " + this.level().purpurConfig.shulkerSpawnFromBulletNearbyEquation)).floatValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ chance -= (nearby - 1) / 5.0F;
|
||||
+ }
|
||||
+ }
|
||||
+ if (this.level().random.nextFloat() <= chance) {
|
||||
Shulker entityshulker = (Shulker) EntityType.SHULKER.create(this.level());
|
||||
+ // Purpur end
|
||||
|
||||
if (entityshulker != null) {
|
||||
entityshulker.setVariant(this.getVariant());
|
||||
@@ -627,7 +636,7 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
|
||||
|
||||
@Override
|
||||
public Optional<DyeColor> getVariant() {
|
||||
- return Optional.ofNullable(this.getColor());
|
||||
+ return Optional.ofNullable(this.level().purpurConfig.shulkerSpawnFromBulletRandomColor ? DyeColor.random(this.level().random) : this.getColor()); // Purpur
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/item/DyeColor.java b/src/main/java/net/minecraft/world/item/DyeColor.java
|
||||
index 0d04a0107bd1a8a2b9aeb4be55025cd554e8fb79..a050d76233e179a1456b83ccc02bb9a55d1cec84 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/DyeColor.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/DyeColor.java
|
||||
@@ -103,4 +103,10 @@ public enum DyeColor implements StringRepresentable {
|
||||
public String getSerializedName() {
|
||||
return this.name;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public static DyeColor random(net.minecraft.util.RandomSource random) {
|
||||
+ return values()[random.nextInt(values().length)];
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index c4ce94b55e561cd99b680afd753393fc6bda8348..7029a053ac83ee579cb570ccc215aec07e22b25b 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1915,6 +1915,11 @@ public class PurpurWorldConfig {
|
||||
public boolean shulkerControllable = true;
|
||||
public double shulkerMaxHealth = 30.0D;
|
||||
public boolean shulkerTakeDamageFromWater = false;
|
||||
+ public float shulkerSpawnFromBulletBaseChance = 1.0F;
|
||||
+ public boolean shulkerSpawnFromBulletRequireOpenLid = true;
|
||||
+ public double shulkerSpawnFromBulletNearbyRange = 8.0D;
|
||||
+ public String shulkerSpawnFromBulletNearbyEquation = "(nearby - 1) / 5.0";
|
||||
+ public boolean shulkerSpawnFromBulletRandomColor = false;
|
||||
private void shulkerSettings() {
|
||||
shulkerRidable = getBoolean("mobs.shulker.ridable", shulkerRidable);
|
||||
shulkerRidableInWater = getBoolean("mobs.shulker.ridable-in-water", shulkerRidableInWater);
|
||||
@@ -1926,6 +1931,11 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
shulkerMaxHealth = getDouble("mobs.shulker.attributes.max_health", shulkerMaxHealth);
|
||||
shulkerTakeDamageFromWater = getBoolean("mobs.shulker.takes-damage-from-water", shulkerTakeDamageFromWater);
|
||||
+ shulkerSpawnFromBulletBaseChance = (float) getDouble("mobs.shulker.spawn-from-bullet.base-chance", shulkerSpawnFromBulletBaseChance);
|
||||
+ shulkerSpawnFromBulletRequireOpenLid = getBoolean("mobs.shulker.spawn-from-bullet.require-open-lid", shulkerSpawnFromBulletRequireOpenLid);
|
||||
+ shulkerSpawnFromBulletNearbyRange = getDouble("mobs.shulker.spawn-from-bullet.nearby-range", shulkerSpawnFromBulletNearbyRange);
|
||||
+ shulkerSpawnFromBulletNearbyEquation = getString("mobs.shulker.spawn-from-bullet.nearby-equation", shulkerSpawnFromBulletNearbyEquation);
|
||||
+ shulkerSpawnFromBulletRandomColor = getBoolean("mobs.shulker.spawn-from-bullet.random-color", shulkerSpawnFromBulletRandomColor);
|
||||
}
|
||||
|
||||
public boolean silverfishRidable = false;
|
||||
@@ -0,0 +1,71 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 28 Jun 2021 14:07:35 -0500
|
||||
Subject: [PATCH] Eating glow berries adds glow effect
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
|
||||
index 4eef61323ba54f513e6f251ef7c804b2c91ff477..6b2235281dca67a80cb651e9f8e9bf2556979276 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/Items.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/Items.java
|
||||
@@ -1919,7 +1919,7 @@ public class Items {
|
||||
"sweet_berries", new ItemNameBlockItem(Blocks.SWEET_BERRY_BUSH, new Item.Properties().food(Foods.SWEET_BERRIES))
|
||||
);
|
||||
public static final Item GLOW_BERRIES = registerItem(
|
||||
- "glow_berries", new ItemNameBlockItem(Blocks.CAVE_VINES, new Item.Properties().food(Foods.GLOW_BERRIES))
|
||||
+ "glow_berries", new org.purpurmc.purpur.item.GlowBerryItem(Blocks.CAVE_VINES, new Item.Properties().food(Foods.GLOW_BERRIES)) // Purpur
|
||||
);
|
||||
public static final Item CAMPFIRE = registerBlock(Blocks.CAMPFIRE, settings -> settings.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY));
|
||||
public static final Item SOUL_CAMPFIRE = registerBlock(
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 7029a053ac83ee579cb570ccc215aec07e22b25b..e9fd469cad81b04a74dfa03ec9f5cca7b78ddd5c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -205,6 +205,7 @@ public class PurpurWorldConfig {
|
||||
public int enderPearlCooldown = 20;
|
||||
public int enderPearlCooldownCreative = 20;
|
||||
public float enderPearlEndermiteChance = 0.05F;
|
||||
+ public int glowBerriesEatGlowDuration = 0;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -250,6 +251,7 @@ public class PurpurWorldConfig {
|
||||
enderPearlCooldown = getInt("gameplay-mechanics.item.ender-pearl.cooldown", enderPearlCooldown);
|
||||
enderPearlCooldownCreative = getInt("gameplay-mechanics.item.ender-pearl.creative-cooldown", enderPearlCooldownCreative);
|
||||
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||
+ glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/item/GlowBerryItem.java b/src/main/java/org/purpurmc/purpur/item/GlowBerryItem.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7f526883495b3222746de3d0442e9e4fb5107036
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/item/GlowBerryItem.java
|
||||
@@ -0,0 +1,26 @@
|
||||
+package org.purpurmc.purpur.item;
|
||||
+
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.effect.MobEffectInstance;
|
||||
+import net.minecraft.world.effect.MobEffects;
|
||||
+import net.minecraft.world.entity.LivingEntity;
|
||||
+import net.minecraft.world.item.ItemNameBlockItem;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
+
|
||||
+public class GlowBerryItem extends ItemNameBlockItem {
|
||||
+ public GlowBerryItem(Block block, Properties settings) {
|
||||
+ super(block, settings);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) {
|
||||
+ ItemStack result = super.finishUsingItem(stack, world, user);
|
||||
+ if (world.purpurConfig.glowBerriesEatGlowDuration > 0 && user instanceof ServerPlayer player) {
|
||||
+ player.addEffect(new MobEffectInstance(MobEffects.GLOWING, world.purpurConfig.glowBerriesEatGlowDuration), EntityPotionEffectEvent.Cause.FOOD);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+}
|
||||
47
patches/server/0169-Option-to-make-drowned-break-doors.patch
Normal file
47
patches/server/0169-Option-to-make-drowned-break-doors.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Fri, 25 Jun 2021 13:56:15 +0200
|
||||
Subject: [PATCH] Option to make drowned break doors
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
index f037d50f26f7532f11a71790448de7a71644b6ca..b3a79dc4357ad4392101353fbc99aac1b068c172 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -125,6 +125,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
this.goalSelector.addGoal(2, new Drowned.DrownedAttackGoal(this, 1.0D, false));
|
||||
this.goalSelector.addGoal(5, new Drowned.DrownedGoToBeachGoal(this, 1.0D));
|
||||
this.goalSelector.addGoal(6, new Drowned.DrownedSwimUpGoal(this, 1.0D, this.level().getSeaLevel()));
|
||||
+ if (level().purpurConfig.drownedBreakDoors) this.goalSelector.addGoal(6, new net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal(this, 1.0D, true, 4, this::canBreakDoors));
|
||||
this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0D));
|
||||
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));
|
||||
@@ -174,7 +175,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
|
||||
@Override
|
||||
public boolean supportsBreakDoorGoal() {
|
||||
- return false;
|
||||
+ return level().purpurConfig.drownedBreakDoors ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index e9fd469cad81b04a74dfa03ec9f5cca7b78ddd5c..3eb73f0817ccdfdfc88ff819b5338e0fc8391f92 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1061,6 +1061,7 @@ public class PurpurWorldConfig {
|
||||
public double drownedJockeyChance = 0.05D;
|
||||
public boolean drownedJockeyTryExistingChickens = true;
|
||||
public boolean drownedTakeDamageFromWater = false;
|
||||
+ public boolean drownedBreakDoors = false;
|
||||
private void drownedSettings() {
|
||||
drownedRidable = getBoolean("mobs.drowned.ridable", drownedRidable);
|
||||
drownedRidableInWater = getBoolean("mobs.drowned.ridable-in-water", drownedRidableInWater);
|
||||
@@ -1076,6 +1077,7 @@ public class PurpurWorldConfig {
|
||||
drownedJockeyChance = getDouble("mobs.drowned.jockey.chance", drownedJockeyChance);
|
||||
drownedJockeyTryExistingChickens = getBoolean("mobs.drowned.jockey.try-existing-chickens", drownedJockeyTryExistingChickens);
|
||||
drownedTakeDamageFromWater = getBoolean("mobs.drowned.takes-damage-from-water", drownedTakeDamageFromWater);
|
||||
+ drownedBreakDoors = getBoolean("mobs.drowned.can-break-doors", drownedBreakDoors);
|
||||
}
|
||||
|
||||
public boolean elderGuardianRidable = false;
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 29 Jun 2021 23:44:36 -0400
|
||||
Subject: [PATCH] Configurable hunger starvation damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index 515dd3b769917c4aa60ce180ef24f38ca12e6848..c7ad716f607afe382436d088a2b2e622e02a0671 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -107,7 +107,7 @@ public class FoodData {
|
||||
++this.tickTimer;
|
||||
if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
|
||||
if (player.getHealth() > 10.0F || enumdifficulty == Difficulty.HARD || player.getHealth() > 1.0F && enumdifficulty == Difficulty.NORMAL) {
|
||||
- player.hurt(player.damageSources().starve(), 1.0F);
|
||||
+ player.hurt(player.damageSources().starve(), player.level().purpurConfig.hungerStarvationDamage); // Purpur
|
||||
}
|
||||
|
||||
this.tickTimer = 0;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 3eb73f0817ccdfdfc88ff819b5338e0fc8391f92..7eac431d91eea903106f39c4d6210b5dde01b9a8 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2570,4 +2570,9 @@ public class PurpurWorldConfig {
|
||||
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
|
||||
zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater);
|
||||
}
|
||||
+
|
||||
+ public float hungerStarvationDamage = 1.0F;
|
||||
+ private void hungerSettings() {
|
||||
+ hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
|
||||
+ }
|
||||
}
|
||||
22
patches/server/0171-Enhance-SysoutCatcher.patch
Normal file
22
patches/server/0171-Enhance-SysoutCatcher.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 28 Jun 2021 13:33:12 -0500
|
||||
Subject: [PATCH] Enhance SysoutCatcher
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/logging/SysoutCatcher.java b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
|
||||
index a8e813ca89b033f061e695288b3383bdcf128531..1ab65af9359d19530bba7f985a604d2a430ee234 100644
|
||||
--- a/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
|
||||
+++ b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
|
||||
@@ -54,9 +54,9 @@ public final class SysoutCatcher {
|
||||
final JavaPlugin plugin = JavaPlugin.getProvidingPlugin(clazz);
|
||||
|
||||
// Instead of just printing the message, send it to the plugin's logger
|
||||
- plugin.getLogger().log(this.level, this.prefix + line);
|
||||
+ plugin.getLogger().log(this.level, /*this.prefix +*/ line); // Purpur - prefix not needed
|
||||
|
||||
- if (SysoutCatcher.SUPPRESS_NAGS) {
|
||||
+ if (true || SysoutCatcher.SUPPRESS_NAGS) { // Purpur - nagging is annoying
|
||||
return;
|
||||
}
|
||||
if (SysoutCatcher.NAG_INTERVAL > 0 || SysoutCatcher.NAG_TIMEOUT > 0) {
|
||||
143
patches/server/0172-Add-uptime-command.patch
Normal file
143
patches/server/0172-Add-uptime-command.patch
Normal file
@@ -0,0 +1,143 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 1 Jul 2021 15:48:02 -0500
|
||||
Subject: [PATCH] Add uptime command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 023f936a71c657c152fc38c262d59bb3cd5292d6..a9180b1ce021f6d4d60e43bc04e863be99daf9d3 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -253,6 +253,7 @@ public class Commands {
|
||||
org.purpurmc.purpur.command.CreditsCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.DemoCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
+ org.purpurmc.purpur.command.UptimeCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.TPSBarCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 2c64b5f4a357974554c7f33ccc212cfde197f208..fa6bf262da81837c7ff7b115a0a7b4a7f266037a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -304,6 +304,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public OptionSet options;
|
||||
public org.bukkit.command.ConsoleCommandSender console;
|
||||
public static int currentTick; // Paper - improve tick loop
|
||||
+ public static final long startTimeMillis = System.currentTimeMillis();
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
// Paper - don't store the vanilla dispatcher
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 2e886467a77857bcbc156443068ef4b19815e8df..c77691aeb9d0c35fe042a6e375e12d042091d17a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -184,6 +184,7 @@ public class PurpurConfig {
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
public static String tpsbarCommandOutput = "<green>Tpsbar toggled <onoff> for <target>";
|
||||
public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
+ public static String uptimeCommandOutput = "<green>Server uptime is <uptime>";
|
||||
public static String unverifiedUsername = "default";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
@@ -197,6 +198,7 @@ public class PurpurConfig {
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
tpsbarCommandOutput = getString("settings.messages.tpsbar-command-output", tpsbarCommandOutput);
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
+ uptimeCommandOutput = getString("settings.messages.uptime-command-output", uptimeCommandOutput);
|
||||
unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
|
||||
}
|
||||
|
||||
@@ -249,6 +251,15 @@ public class PurpurConfig {
|
||||
public static int commandTPSBarTickInterval = 20;
|
||||
public static boolean commandGamemodeRequiresPermission = false;
|
||||
public static boolean hideHiddenPlayersFromEntitySelector = false;
|
||||
+ public static String uptimeFormat = "<days><hours><minutes><seconds>";
|
||||
+ public static String uptimeDay = "%02d day, ";
|
||||
+ public static String uptimeDays = "%02d days, ";
|
||||
+ public static String uptimeHour = "%02d hour, ";
|
||||
+ public static String uptimeHours = "%02d hours, ";
|
||||
+ public static String uptimeMinute = "%02d minute, and ";
|
||||
+ public static String uptimeMinutes = "%02d minutes, and ";
|
||||
+ public static String uptimeSecond = "%02d second";
|
||||
+ public static String uptimeSeconds = "%02d seconds";
|
||||
private static void commandSettings() {
|
||||
commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
|
||||
commandTPSBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.tpsbar.overlay", commandTPSBarProgressOverlay.name()));
|
||||
@@ -262,6 +273,15 @@ public class PurpurConfig {
|
||||
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);
|
||||
commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
||||
hideHiddenPlayersFromEntitySelector = getBoolean("settings.command.hide-hidden-players-from-entity-selector", hideHiddenPlayersFromEntitySelector);
|
||||
+ uptimeFormat = getString("settings.command.uptime.format", uptimeFormat);
|
||||
+ uptimeDay = getString("settings.command.uptime.day", uptimeDay);
|
||||
+ uptimeDays = getString("settings.command.uptime.days", uptimeDays);
|
||||
+ uptimeHour = getString("settings.command.uptime.hour", uptimeHour);
|
||||
+ uptimeHours = getString("settings.command.uptime.hours", uptimeHours);
|
||||
+ uptimeMinute = getString("settings.command.uptime.minute", uptimeMinute);
|
||||
+ uptimeMinutes = getString("settings.command.uptime.minutes", uptimeMinutes);
|
||||
+ uptimeSecond = getString("settings.command.uptime.second", uptimeSecond);
|
||||
+ uptimeSeconds = getString("settings.command.uptime.seconds", uptimeSeconds);
|
||||
}
|
||||
|
||||
public static int barrelRows = 3;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/command/UptimeCommand.java b/src/main/java/org/purpurmc/purpur/command/UptimeCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4bb475099bcf8f05d5f1474e7fbf29c57c2c40cd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/command/UptimeCommand.java
|
||||
@@ -0,0 +1,55 @@
|
||||
+package org.purpurmc.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.purpurmc.purpur.PurpurConfig;
|
||||
+
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+public class UptimeCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("uptime")
|
||||
+ .requires((listener) -> listener.hasPermission(2, "bukkit.command.uptime"))
|
||||
+ .executes((context) -> execute(context.getSource()))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static int execute(CommandSourceStack sender) {
|
||||
+ Data data = new Data();
|
||||
+
|
||||
+ data.format = PurpurConfig.uptimeFormat;
|
||||
+ data.hide = true;
|
||||
+ data.millis = System.currentTimeMillis() - MinecraftServer.startTimeMillis;
|
||||
+
|
||||
+ process(data, "<days>", PurpurConfig.uptimeDay, PurpurConfig.uptimeDays, TimeUnit.DAYS, TimeUnit.MILLISECONDS::toDays);
|
||||
+ process(data, "<hours>", PurpurConfig.uptimeHour, PurpurConfig.uptimeHours, TimeUnit.HOURS, TimeUnit.MILLISECONDS::toHours);
|
||||
+ process(data, "<minutes>", PurpurConfig.uptimeMinute, PurpurConfig.uptimeMinutes, TimeUnit.MINUTES, TimeUnit.MILLISECONDS::toMinutes);
|
||||
+ data.hide = false; // never hide seconds
|
||||
+ process(data, "<seconds>", PurpurConfig.uptimeSecond, PurpurConfig.uptimeSeconds, TimeUnit.SECONDS, TimeUnit.MILLISECONDS::toSeconds);
|
||||
+
|
||||
+ Component output = MiniMessage.miniMessage().deserialize(PurpurConfig.uptimeCommandOutput, Placeholder.unparsed("uptime", data.format));
|
||||
+ sender.sendSuccess(output, false);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ private static void process(Data data, String replace, String singular, String plural, TimeUnit unit, Function<Long, Long> func) {
|
||||
+ if (data.format.contains(replace)) {
|
||||
+ long val = func.apply(data.millis);
|
||||
+ if (data.hide) data.hide = val == 0;
|
||||
+ if (!data.hide) data.millis -= unit.toMillis(val);
|
||||
+ data.format = data.format.replace(replace, data.hide ? "" : String.format(val == 1 ? singular : plural, val));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class Data {
|
||||
+ String format;
|
||||
+ boolean hide;
|
||||
+ long millis;
|
||||
+ }
|
||||
+}
|
||||
601
patches/server/0173-Tool-actionable-options.patch
Normal file
601
patches/server/0173-Tool-actionable-options.patch
Normal file
@@ -0,0 +1,601 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 2 Jul 2021 20:54:29 -0500
|
||||
Subject: [PATCH] Tool actionable options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
index f005ea92449cf5e249ff64f4791c3bc6b8635528..ade1a0dac14bb3adc26bb103fc0ce9629fe973c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
@@ -60,13 +60,15 @@ public class AxeItem extends DiggerItem {
|
||||
if (playerHasShieldUseIntent(context)) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
- Optional<BlockState> optional = this.evaluateNewBlockState(level, blockPos, player, level.getBlockState(blockPos));
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional = this.evaluateActionable(level, blockPos, player, level.getBlockState(blockPos)); // Purpur
|
||||
if (optional.isEmpty()) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
+ org.purpurmc.purpur.tool.Actionable actionable = optional.get(); // Purpur
|
||||
+ BlockState state = actionable.into().withPropertiesOf(level.getBlockState(blockPos)); // Purpur
|
||||
ItemStack itemStack = context.getItemInHand();
|
||||
// Paper start - EntityChangeBlockEvent
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, optional.get())) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, state)) { // Purpur
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
// Paper end
|
||||
@@ -74,13 +76,20 @@ public class AxeItem extends DiggerItem {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
|
||||
}
|
||||
|
||||
- level.setBlock(blockPos, optional.get(), 11);
|
||||
- level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, optional.get()));
|
||||
+ // Purpur start
|
||||
+ level.setBlock(blockPos, state, 11);
|
||||
+ actionable.drops().forEach((drop, chance) -> {
|
||||
+ if (level.random.nextDouble() < chance) {
|
||||
+ Block.popResourceFromFace(level, blockPos, context.getClickedFace(), new ItemStack(drop));
|
||||
+ }
|
||||
+ });
|
||||
+ level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, state));
|
||||
+ // Purpur end
|
||||
if (player != null) {
|
||||
itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
|
||||
}
|
||||
|
||||
- return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
+ return InteractionResult.SUCCESS; // Purpur - force arm swing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,22 +99,24 @@ public class AxeItem extends DiggerItem {
|
||||
return context.getHand().equals(InteractionHand.MAIN_HAND) && player.getOffhandItem().is(Items.SHIELD) && !player.isSecondaryUseActive();
|
||||
}
|
||||
|
||||
- private Optional<BlockState> evaluateNewBlockState(Level world, BlockPos pos, @Nullable Player player, BlockState state) {
|
||||
- Optional<BlockState> optional = this.getStripped(state);
|
||||
+ private Optional<org.purpurmc.purpur.tool.Actionable> evaluateActionable(Level world, BlockPos pos, @Nullable Player player, BlockState state) { // Purpur
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional = Optional.ofNullable(world.purpurConfig.axeStrippables.get(state.getBlock())); // Purpur
|
||||
if (optional.isPresent()) {
|
||||
- world.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ world.playSound(STRIPPABLES.containsKey(state.getBlock()) ? player : null, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
return optional;
|
||||
} else {
|
||||
- Optional<BlockState> optional2 = WeatheringCopper.getPrevious(state);
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional2 = Optional.ofNullable(world.purpurConfig.axeWeatherables.get(state.getBlock())); // Purpur
|
||||
if (optional2.isPresent()) {
|
||||
- world.playSound(player, pos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ world.playSound(WeatheringCopper.getPrevious(state).isPresent() ? player : null, pos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
world.levelEvent(player, 3005, pos, 0);
|
||||
return optional2;
|
||||
} else {
|
||||
- Optional<BlockState> optional3 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(state.getBlock()))
|
||||
- .map(block -> block.withPropertiesOf(state));
|
||||
+ // Purpur start
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional3 = Optional.ofNullable(world.purpurConfig.axeWaxables.get(state.getBlock()));
|
||||
+ // .map(block -> block.withPropertiesOf(state));
|
||||
+ // Purpur end
|
||||
if (optional3.isPresent()) {
|
||||
- world.playSound(player, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ world.playSound(HoneycombItem.WAX_OFF_BY_BLOCK.get().containsKey(state.getBlock()) ? player : null, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
world.levelEvent(player, 3004, pos, 0);
|
||||
return optional3;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/HoeItem.java b/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
index 06497b5141e611cc7a1b6030a7b9c54b5c4eda06..28df1b3230762e52b5458ac93a85c9a5d41eb6a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
@@ -46,15 +46,23 @@ public class HoeItem extends DiggerItem {
|
||||
public InteractionResult useOn(UseOnContext context) {
|
||||
Level level = context.getLevel();
|
||||
BlockPos blockPos = context.getClickedPos();
|
||||
- Pair<Predicate<UseOnContext>, Consumer<UseOnContext>> pair = TILLABLES.get(level.getBlockState(blockPos).getBlock());
|
||||
- if (pair == null) {
|
||||
- return InteractionResult.PASS;
|
||||
- } else {
|
||||
- Predicate<UseOnContext> predicate = pair.getFirst();
|
||||
- Consumer<UseOnContext> consumer = pair.getSecond();
|
||||
+ // Purpur start
|
||||
+ Block clickedBlock = level.getBlockState(blockPos).getBlock();
|
||||
+ var tillable = level.purpurConfig.hoeTillables.get(clickedBlock);
|
||||
+ if (tillable == null) { return InteractionResult.PASS; } else {
|
||||
+ Predicate<UseOnContext> predicate = tillable.condition().predicate();
|
||||
+ Consumer<UseOnContext> consumer = (ctx) -> {
|
||||
+ level.setBlock(blockPos, tillable.into().defaultBlockState(), 11);
|
||||
+ tillable.drops().forEach((drop, chance) -> {
|
||||
+ if (level.random.nextDouble() < chance) {
|
||||
+ Block.popResourceFromFace(level, blockPos, ctx.getClickedFace(), new ItemStack(drop));
|
||||
+ }
|
||||
+ });
|
||||
+ };
|
||||
+ // Purpur end
|
||||
if (predicate.test(context)) {
|
||||
Player player = context.getPlayer();
|
||||
- level.playSound(player, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ if (!TILLABLES.containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
if (!level.isClientSide) {
|
||||
consumer.accept(context);
|
||||
if (player != null) {
|
||||
@@ -62,7 +70,7 @@ public class HoeItem extends DiggerItem {
|
||||
}
|
||||
}
|
||||
|
||||
- return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
+ return InteractionResult.SUCCESS; // Purpur - force arm swing
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..6b7dbb570f8a698c87c6bce992d84d87b55176e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
@@ -47,9 +47,12 @@ public class ShovelItem extends DiggerItem {
|
||||
BlockState blockState2 = FLATTENABLES.get(blockState.getBlock());
|
||||
BlockState blockState3 = null;
|
||||
Runnable afterAction = null; // Paper
|
||||
- if (blockState2 != null && level.getBlockState(blockPos.above()).isAir()) {
|
||||
- afterAction = () -> level.playSound(player, blockPos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); // Paper
|
||||
- blockState3 = blockState2;
|
||||
+ // Purpur start
|
||||
+ var flattenable = level.purpurConfig.shovelFlattenables.get(blockState.getBlock());
|
||||
+ if (flattenable != null && level.getBlockState(blockPos.above()).isAir()) {
|
||||
+ afterAction = () -> {if (!FLATTENABLES.containsKey(blockState.getBlock())) level.playSound(null, blockPos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);}; // Paper
|
||||
+ blockState3 = flattenable.into().defaultBlockState();
|
||||
+ // Purpur end
|
||||
} else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) {
|
||||
afterAction = () -> { // Paper
|
||||
if (!level.isClientSide()) {
|
||||
@@ -76,7 +79,7 @@ public class ShovelItem extends DiggerItem {
|
||||
}
|
||||
}
|
||||
|
||||
- return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
+ return InteractionResult.SUCCESS; // Purpur - force arm swing
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 7eac431d91eea903106f39c4d6210b5dde01b9a8..f4bc09f96a1f203e9c7a5989e285c87dc3802bff 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -487,6 +487,280 @@ public class PurpurWorldConfig {
|
||||
snowballDamage = getInt("gameplay-mechanics.projectile-damage.snowball", snowballDamage);
|
||||
}
|
||||
|
||||
+ public Map<Block, Strippable> axeStrippables = new HashMap<>();
|
||||
+ public Map<Block, Waxable> axeWaxables = new HashMap<>();
|
||||
+ public Map<Block, Weatherable> axeWeatherables = new HashMap<>();
|
||||
+ public Map<Block, Tillable> hoeTillables = new HashMap<>();
|
||||
+ public Map<Block, Flattenable> shovelFlattenables = new HashMap<>();
|
||||
+ private void toolSettings() {
|
||||
+ axeStrippables.clear();
|
||||
+ axeWaxables.clear();
|
||||
+ axeWeatherables.clear();
|
||||
+ hoeTillables.clear();
|
||||
+ shovelFlattenables.clear();
|
||||
+ if (PurpurConfig.version < 18) {
|
||||
+ ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + ".tools.hoe.tilling");
|
||||
+ if (section != null) {
|
||||
+ PurpurConfig.config.set("world-settings." + worldName + ".tools.hoe.tillables", section);
|
||||
+ PurpurConfig.config.set("world-settings." + worldName + ".tools.hoe.tilling", null);
|
||||
+ }
|
||||
+ section = PurpurConfig.config.getConfigurationSection("world-settings.default.tools.hoe.tilling");
|
||||
+ if (section != null) {
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.hoe.tillables", section);
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.hoe.tilling", null);
|
||||
+ }
|
||||
+ }
|
||||
+ if (PurpurConfig.version < 29) {
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.strippables.minecraft:mangrove_log", Map.of("into", "minecraft:stripped_mangrove_log", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.strippables.minecraft:mangrove_wood", Map.of("into", "minecraft:stripped_mangrove_wood", "drops", new HashMap<String, Double>()));
|
||||
+ }
|
||||
+ if (PurpurConfig.version < 32) {
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.strippables.minecraft:cherry_log", Map.of("into", "minecraft:stripped_cherry_log", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.strippables.minecraft:cherry_wood", Map.of("into", "minecraft:stripped_cherry_wood", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.strippables.minecraft:bamboo_block", Map.of("into", "minecraft:stripped_bamboo_block", "drops", new HashMap<String, Double>()));
|
||||
+ }
|
||||
+ if (PurpurConfig.version < 33) {
|
||||
+ getList("gameplay-mechanics.shovel-turns-block-to-grass-path", new ArrayList<String>(){{
|
||||
+ add("minecraft:coarse_dirt");
|
||||
+ add("minecraft:dirt");
|
||||
+ add("minecraft:grass_block");
|
||||
+ add("minecraft:mycelium");
|
||||
+ add("minecraft:podzol");
|
||||
+ add("minecraft:rooted_dirt");
|
||||
+ }}).forEach(key -> {
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.shovel.flattenables." + key.toString(), Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>()));
|
||||
+ });
|
||||
+ set("gameplay-mechanics.shovel-turns-block-to-grass-path", null);
|
||||
+ }
|
||||
+ if (PurpurConfig.version < 34) {
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_chiseled_copper", Map.of("into", "minecraft:chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_exposed_chiseled_copper", Map.of("into", "minecraft:exposed_chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_weathered_chiseled_copper", Map.of("into", "minecraft:weathered_chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_oxidized_chiseled_copper", Map.of("into", "minecraft:oxidized_chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_copper_door", Map.of("into", "minecraft:copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_exposed_copper_door", Map.of("into", "minecraft:exposed_copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_weathered_copper_door", Map.of("into", "minecraft:weathered_copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_oxidized_copper_door", Map.of("into", "minecraft:oxidized_copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_copper_trapdoor", Map.of("into", "minecraft:copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_exposed_copper_trapdoor", Map.of("into", "minecraft:exposed_copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_weathered_copper_trapdoor", Map.of("into", "minecraft:weathered_copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_oxidized_copper_trapdoor", Map.of("into", "minecraft:oxidized_copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_copper_grate", Map.of("into", "minecraft:copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_exposed_copper_grate", Map.of("into", "minecraft:exposed_copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_weathered_copper_grate", Map.of("into", "minecraft:weathered_copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_oxidized_copper_grate", Map.of("into", "minecraft:oxidized_copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_copper_bulb", Map.of("into", "minecraft:copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_exposed_copper_bulb", Map.of("into", "minecraft:exposed_copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_weathered_copper_bulb", Map.of("into", "minecraft:weathered_copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.waxables.minecraft:waxed_oxidized_copper_bulb", Map.of("into", "minecraft:oxidized_copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:exposed_chiseled_copper", Map.of("into", "minecraft:chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:weathered_chiseled_copper", Map.of("into", "minecraft:exposed_chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:oxidized_chiseled_copper", Map.of("into", "minecraft:weathered_chiseled_copper", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:oxidized_cut_copper_stairs", Map.of("into", "minecraft:weathered_cut_copper_stairs", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:exposed_copper_door", Map.of("into", "minecraft:copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:weathered_copper_door", Map.of("into", "minecraft:exposed_copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:oxidized_copper_door", Map.of("into", "minecraft:weathered_copper_door", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:exposed_copper_trapdoor", Map.of("into", "minecraft:copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:weathered_copper_trapdoor", Map.of("into", "minecraft:exposed_copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:oxidized_copper_trapdoor", Map.of("into", "minecraft:weathered_copper_trapdoor", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:exposed_copper_grate", Map.of("into", "minecraft:copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:weathered_copper_grate", Map.of("into", "minecraft:exposed_copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:oxidized_copper_grate", Map.of("into", "minecraft:weathered_copper_grate", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:exposed_copper_bulb", Map.of("into", "minecraft:copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:weathered_copper_bulb", Map.of("into", "minecraft:exposed_copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.axe.weatherables.minecraft:oxidized_copper_bulb", Map.of("into", "minecraft:weathered_copper_bulb", "drops", new HashMap<String, Double>()));
|
||||
+ }
|
||||
+ getMap("tools.axe.strippables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:oak_wood", Map.of("into", "minecraft:stripped_oak_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oak_log", Map.of("into", "minecraft:stripped_oak_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dark_oak_wood", Map.of("into", "minecraft:stripped_dark_oak_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dark_oak_log", Map.of("into", "minecraft:stripped_dark_oak_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:acacia_wood", Map.of("into", "minecraft:stripped_acacia_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:acacia_log", Map.of("into", "minecraft:stripped_acacia_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:birch_wood", Map.of("into", "minecraft:stripped_birch_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:birch_log", Map.of("into", "minecraft:stripped_birch_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:jungle_wood", Map.of("into", "minecraft:stripped_jungle_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:jungle_log", Map.of("into", "minecraft:stripped_jungle_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:spruce_wood", Map.of("into", "minecraft:stripped_spruce_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:spruce_log", Map.of("into", "minecraft:stripped_spruce_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:mangrove_wood", Map.of("into", "minecraft:stripped_mangrove_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:mangrove_log", Map.of("into", "minecraft:stripped_mangrove_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:cherry_log", Map.of("into", "minecraft:stripped_cherry_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:cherry_wood", Map.of("into", "minecraft:stripped_cherry_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:bamboo_block", Map.of("into", "minecraft:stripped_bamboo_block", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:warped_stem", Map.of("into", "minecraft:stripped_warped_stem", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:warped_hyphae", Map.of("into", "minecraft:stripped_warped_hyphae", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:crimson_stem", Map.of("into", "minecraft:stripped_crimson_stem", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:crimson_hyphae", Map.of("into", "minecraft:stripped_crimson_hyphae", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.strippables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ axeStrippables.put(block, new Strippable(into, drops));
|
||||
+ });
|
||||
+ getMap("tools.axe.waxables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:waxed_copper_block", Map.of("into", "minecraft:copper_block", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_copper", Map.of("into", "minecraft:exposed_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_copper", Map.of("into", "minecraft:weathered_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_copper", Map.of("into", "minecraft:oxidized_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_cut_copper", Map.of("into", "minecraft:cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_cut_copper", Map.of("into", "minecraft:exposed_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_cut_copper", Map.of("into", "minecraft:weathered_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_cut_copper", Map.of("into", "minecraft:oxidized_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_cut_copper_slab", Map.of("into", "minecraft:cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_cut_copper_slab", Map.of("into", "minecraft:exposed_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_cut_copper_slab", Map.of("into", "minecraft:weathered_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_cut_copper_slab", Map.of("into", "minecraft:oxidized_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_cut_copper_stairs", Map.of("into", "minecraft:cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_cut_copper_stairs", Map.of("into", "minecraft:exposed_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_cut_copper_stairs", Map.of("into", "minecraft:weathered_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_cut_copper_stairs", Map.of("into", "minecraft:oxidized_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_chiseled_copper", Map.of("into", "minecraft:chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_chiseled_copper", Map.of("into", "minecraft:exposed_chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_chiseled_copper", Map.of("into", "minecraft:weathered_chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_chiseled_copper", Map.of("into", "minecraft:oxidized_chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_copper_door", Map.of("into", "minecraft:copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_copper_door", Map.of("into", "minecraft:exposed_copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_copper_door", Map.of("into", "minecraft:weathered_copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_copper_door", Map.of("into", "minecraft:oxidized_copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_copper_trapdoor", Map.of("into", "minecraft:copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_copper_trapdoor", Map.of("into", "minecraft:exposed_copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_copper_trapdoor", Map.of("into", "minecraft:weathered_copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_copper_trapdoor", Map.of("into", "minecraft:oxidized_copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_copper_grate", Map.of("into", "minecraft:copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_copper_grate", Map.of("into", "minecraft:exposed_copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_copper_grate", Map.of("into", "minecraft:weathered_copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_copper_grate", Map.of("into", "minecraft:oxidized_copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_copper_bulb", Map.of("into", "minecraft:copper_bulb", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_copper_bulb", Map.of("into", "minecraft:exposed_copper_bulb", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_copper_bulb", Map.of("into", "minecraft:weathered_copper_bulb", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_copper_bulb", Map.of("into", "minecraft:oxidized_copper_bulb", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.waxables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ axeWaxables.put(block, new Waxable(into, drops));
|
||||
+ });
|
||||
+ getMap("tools.axe.weatherables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:exposed_copper", Map.of("into", "minecraft:copper_block", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_copper", Map.of("into", "minecraft:exposed_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_copper", Map.of("into", "minecraft:weathered_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_cut_copper", Map.of("into", "minecraft:cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_cut_copper", Map.of("into", "minecraft:exposed_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_cut_copper", Map.of("into", "minecraft:weathered_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_chiseled_copper", Map.of("into", "minecraft:chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_chiseled_copper", Map.of("into", "minecraft:exposed_chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_chiseled_copper", Map.of("into", "minecraft:weathered_chiseled_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_cut_copper_slab", Map.of("into", "minecraft:cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_cut_copper_slab", Map.of("into", "minecraft:exposed_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_cut_copper_slab", Map.of("into", "minecraft:weathered_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_cut_copper_stairs", Map.of("into", "minecraft:cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_cut_copper_stairs", Map.of("into", "minecraft:exposed_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_cut_copper_stairs", Map.of("into", "minecraft:weathered_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_copper_door", Map.of("into", "minecraft:copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_copper_door", Map.of("into", "minecraft:exposed_copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_copper_door", Map.of("into", "minecraft:weathered_copper_door", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_copper_trapdoor", Map.of("into", "minecraft:copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_copper_trapdoor", Map.of("into", "minecraft:exposed_copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_copper_trapdoor", Map.of("into", "minecraft:weathered_copper_trapdoor", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_copper_grate", Map.of("into", "minecraft:copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_copper_grate", Map.of("into", "minecraft:exposed_copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_copper_grate", Map.of("into", "minecraft:weathered_copper_grate", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_copper_bulb", Map.of("into", "minecraft:copper_bulb", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_copper_bulb", Map.of("into", "minecraft:exposed_copper_bulb", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_copper_bulb", Map.of("into", "minecraft:weathered_copper_bulb", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.weatherables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ axeWeatherables.put(block, new Weatherable(into, drops));
|
||||
+ });
|
||||
+ getMap("tools.hoe.tillables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:grass_block", Map.of("condition", "air_above", "into", "minecraft:farmland", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dirt_path", Map.of("condition", "air_above", "into", "minecraft:farmland", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dirt", Map.of("condition", "air_above", "into", "minecraft:farmland", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:coarse_dirt", Map.of("condition", "air_above", "into", "minecraft:dirt", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:rooted_dirt", Map.of("condition", "always", "into", "minecraft:dirt", "drops", Map.of("minecraft:hanging_roots", 1.0D))))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + "`"); return; }
|
||||
+ String conditionId = (String) map.get("condition");
|
||||
+ Tillable.Condition condition = Tillable.Condition.get(conditionId);
|
||||
+ if (condition == null) { PurpurConfig.log(Level.SEVERE, "Invalid condition for `tools.hoe.tillables." + blockId + ".condition`: " + conditionId); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.hoe.tillables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ hoeTillables.put(block, new Tillable(condition, into, drops));
|
||||
+ });
|
||||
+ getMap("tools.shovel.flattenables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:grass_block", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dirt", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:podzol", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:coarse_dirt", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:mycelium", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:rooted_dirt", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = BuiltInRegistries.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.shovel.flattenables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ shovelFlattenables.put(block, new Flattenable(into, drops));
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
public boolean anvilAllowColors = false;
|
||||
public boolean anvilColorsUseMiniMessage;
|
||||
private void anvilSettings() {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/tool/Actionable.java b/src/main/java/org/purpurmc/purpur/tool/Actionable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e18c37f06730da9d3055d5215e813b1477c1e70e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/tool/Actionable.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package org.purpurmc.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public abstract class Actionable {
|
||||
+ private final Block into;
|
||||
+ private final Map<Item, Double> drops;
|
||||
+
|
||||
+ public Actionable(Block into, Map<Item, Double> drops) {
|
||||
+ this.into = into;
|
||||
+ this.drops = drops;
|
||||
+ }
|
||||
+
|
||||
+ public Block into() {
|
||||
+ return into;
|
||||
+ }
|
||||
+
|
||||
+ public Map<Item, Double> drops() {
|
||||
+ return drops;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/tool/Flattenable.java b/src/main/java/org/purpurmc/purpur/tool/Flattenable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..345d4ee4ff0b78bd1050959711a4f5d16a5e8aee
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/tool/Flattenable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package org.purpurmc.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Flattenable extends Actionable {
|
||||
+ public Flattenable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/tool/Strippable.java b/src/main/java/org/purpurmc/purpur/tool/Strippable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bf5402214f41af9c09bd6c5c4f45d330516d742e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/tool/Strippable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package org.purpurmc.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Strippable extends Actionable {
|
||||
+ public Strippable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/tool/Tillable.java b/src/main/java/org/purpurmc/purpur/tool/Tillable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..715f6dd44480347eebced43c11bc364e05727498
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/tool/Tillable.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package org.purpurmc.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.HoeItem;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.item.context.UseOnContext;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
+public class Tillable extends Actionable {
|
||||
+ private final Condition condition;
|
||||
+
|
||||
+ public Tillable(Condition condition, Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ this.condition = condition;
|
||||
+ }
|
||||
+
|
||||
+ public Condition condition() {
|
||||
+ return condition;
|
||||
+ }
|
||||
+
|
||||
+ public enum Condition {
|
||||
+ AIR_ABOVE(HoeItem::onlyIfAirAbove),
|
||||
+ ALWAYS((useOnContext) -> true);
|
||||
+
|
||||
+ private final Predicate<UseOnContext> predicate;
|
||||
+
|
||||
+ Condition(Predicate<UseOnContext> predicate) {
|
||||
+ this.predicate = predicate;
|
||||
+ }
|
||||
+
|
||||
+ public Predicate<UseOnContext> predicate() {
|
||||
+ return predicate;
|
||||
+ }
|
||||
+
|
||||
+ private static final Map<String, Condition> BY_NAME = new HashMap<>();
|
||||
+
|
||||
+ static {
|
||||
+ for (Condition condition : values()) {
|
||||
+ BY_NAME.put(condition.name(), condition);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static Condition get(String name) {
|
||||
+ return BY_NAME.get(name.toUpperCase(java.util.Locale.ROOT));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/tool/Waxable.java b/src/main/java/org/purpurmc/purpur/tool/Waxable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..64adb13b29b6757dcf227a55588da70ecabe083f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/tool/Waxable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package org.purpurmc.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Waxable extends Actionable {
|
||||
+ public Waxable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/tool/Weatherable.java b/src/main/java/org/purpurmc/purpur/tool/Weatherable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b7586f494528f30eb0da82420d3bcf5b83a1a902
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/tool/Weatherable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package org.purpurmc.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Weatherable extends Actionable {
|
||||
+ public Weatherable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
49
patches/server/0174-Store-placer-on-Block-when-placed.patch
Normal file
49
patches/server/0174-Store-placer-on-Block-when-placed.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 18:40:32 -0500
|
||||
Subject: [PATCH] Store placer on Block when placed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 29ff737c0dd267710f852e50ac64a0eea7f8738b..f738558904389a4a5948cc936680907e5ebec749 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -497,6 +497,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
world.isBlockPlaceCancelled = true; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||
for (BlockState blockstate : blocks) {
|
||||
blockstate.update(true, false);
|
||||
+ ((CraftBlock) blockstate.getBlock()).getNMS().getBlock().forgetPlacer(); // Purpur
|
||||
}
|
||||
world.isBlockPlaceCancelled = false; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||
world.preventPoiUpdated = false;
|
||||
@@ -529,6 +530,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
||||
block.onPlace(world, newblockposition, oldBlock, true, context); // Paper - pass context
|
||||
}
|
||||
+ block.getBlock().forgetPlacer(); // Purpur
|
||||
|
||||
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 45704653310efe9cb755a644674b54b8722c2c84..1ef3b68d71c33ffb248a4b88fcfdc98a0360c4aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -437,7 +437,17 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
} // Paper - fix drops not preventing stats/food exhaustion
|
||||
}
|
||||
|
||||
- public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {}
|
||||
+ // Purpur start
|
||||
+ @Nullable protected LivingEntity placer = null;
|
||||
+
|
||||
+ public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
||||
+ this.placer = placer;
|
||||
+ }
|
||||
+
|
||||
+ public void forgetPlacer() {
|
||||
+ this.placer = null;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
public boolean isPossibleToRespawnInThis(BlockState state) {
|
||||
return !state.isSolid() && !state.liquid();
|
||||
255
patches/server/0175-Summoner-API.patch
Normal file
255
patches/server/0175-Summoner-API.patch
Normal file
@@ -0,0 +1,255 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 18:40:58 -0500
|
||||
Subject: [PATCH] Summoner API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
index a820bbbe89dee9e6de2e7d5f72f43d1d5114cedf..08bdfdecf5c1ecff823ece44c0bef9d09286459a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
@@ -57,6 +57,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
private int remainingPersistentAngerTime;
|
||||
@Nullable
|
||||
private UUID persistentAngerTarget;
|
||||
+ @Nullable private UUID summoner; // Purpur
|
||||
|
||||
public IronGolem(EntityType<? extends IronGolem> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -89,6 +90,15 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
return this.level().purpurConfig.ironGolemTakeDamageFromWater;
|
||||
}
|
||||
|
||||
+ @Nullable
|
||||
+ public UUID getSummoner() {
|
||||
+ return summoner;
|
||||
+ }
|
||||
+
|
||||
+ public void setSummoner(@Nullable UUID summoner) {
|
||||
+ this.summoner = summoner;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
if (level().purpurConfig.ironGolemCanSwim) this.goalSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.FloatGoal(this)); // Purpur
|
||||
@@ -166,6 +176,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putBoolean("PlayerCreated", this.isPlayerCreated());
|
||||
+ if (getSummoner() != null) nbt.putUUID("Purpur.Summoner", getSummoner()); // Purpur
|
||||
this.addPersistentAngerSaveData(nbt);
|
||||
}
|
||||
|
||||
@@ -173,6 +184,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
this.setPlayerCreated(nbt.getBoolean("PlayerCreated"));
|
||||
+ if (nbt.contains("Purpur.Summoner")) setSummoner(nbt.getUUID("Purpur.Summoner")); // Purpur
|
||||
this.readPersistentAngerSaveData(this.level(), nbt);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
index 9f20eae7449c670b913cc3bbe1a89254a1d8cde2..8f2348a7fe830a85985ce2b19cb2a9159bca711f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -47,6 +47,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
|
||||
private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE);
|
||||
private static final byte PUMPKIN_FLAG = 16;
|
||||
+ @Nullable private java.util.UUID summoner; // Purpur
|
||||
|
||||
public SnowGolem(EntityType<? extends SnowGolem> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -74,6 +75,15 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.snowGolemMaxHealth);
|
||||
}
|
||||
|
||||
+ @Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return summoner;
|
||||
+ }
|
||||
+
|
||||
+ public void setSummoner(@Nullable java.util.UUID summoner) {
|
||||
+ this.summoner = summoner;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
@@ -101,6 +111,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putBoolean("Pumpkin", this.hasPumpkin());
|
||||
+ if (getSummoner() != null) nbt.putUUID("Purpur.Summoner", getSummoner()); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,6 +120,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
if (nbt.contains("Pumpkin")) {
|
||||
this.setPumpkin(nbt.getBoolean("Pumpkin"));
|
||||
}
|
||||
+ if (nbt.contains("Purpur.Summoner")) setSummoner(nbt.getUUID("Purpur.Summoner")); // Purpur
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 962ab1025f42734c11e3ce4c792d17958b14bdfe..0a8466fa93d4955c3d9a1d5a57eeb0751d20a8d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -88,6 +88,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
return !entityliving.getType().is(EntityTypeTags.WITHER_FRIENDS) && entityliving.attackable();
|
||||
};
|
||||
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
|
||||
+ @Nullable private java.util.UUID summoner; // Purpur
|
||||
private int shootCooldown = 0; // Purpur
|
||||
// Paper start
|
||||
private boolean canPortal = false;
|
||||
@@ -126,6 +127,15 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
return this.level().purpurConfig.witherTakeDamageFromWater;
|
||||
}
|
||||
|
||||
+ @Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return summoner;
|
||||
+ }
|
||||
+
|
||||
+ public void setSummoner(@Nullable java.util.UUID summoner) {
|
||||
+ this.summoner = summoner;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
FlyingPathNavigation navigationflying = new FlyingPathNavigation(this, world);
|
||||
@@ -260,6 +270,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putInt("Invul", this.getInvulnerableTicks());
|
||||
+ if (getSummoner() != null) nbt.putUUID("Purpur.Summoner", getSummoner()); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,6 +280,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
if (this.hasCustomName()) {
|
||||
this.bossEvent.setName(this.getDisplayName());
|
||||
}
|
||||
+ if (nbt.contains("Purpur.Summoner")) setSummoner(nbt.getUUID("Purpur.Summoner")); // Purpur
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
index 655f51902e5d24643d41c4ec981743543c0890a5..e6a299eeda5d18274fa3b1fb542b217a074c1d83 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
@@ -71,7 +71,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock {
|
||||
SnowGolem entitysnowman = (SnowGolem) EntityType.SNOW_GOLEM.create(world);
|
||||
|
||||
if (entitysnowman != null) {
|
||||
- CarvedPumpkinBlock.spawnGolemInWorld(world, shapedetector_shapedetectorcollection, entitysnowman, shapedetector_shapedetectorcollection.getBlock(0, 2, 0).getPos());
|
||||
+ CarvedPumpkinBlock.spawnGolemInWorld(world, shapedetector_shapedetectorcollection, entitysnowman, shapedetector_shapedetectorcollection.getBlock(0, 2, 0).getPos(), this.placer); // Purpur
|
||||
}
|
||||
} else {
|
||||
BlockPattern.BlockPatternMatch shapedetector_shapedetectorcollection1 = this.getOrCreateIronGolemFull().find(world, pos);
|
||||
@@ -81,7 +81,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock {
|
||||
|
||||
if (entityirongolem != null) {
|
||||
entityirongolem.setPlayerCreated(true);
|
||||
- CarvedPumpkinBlock.spawnGolemInWorld(world, shapedetector_shapedetectorcollection1, entityirongolem, shapedetector_shapedetectorcollection1.getBlock(1, 2, 0).getPos());
|
||||
+ CarvedPumpkinBlock.spawnGolemInWorld(world, shapedetector_shapedetectorcollection1, entityirongolem, shapedetector_shapedetectorcollection1.getBlock(1, 2, 0).getPos(), this.placer); // Purpur
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,16 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock {
|
||||
}
|
||||
|
||||
private static void spawnGolemInWorld(Level world, BlockPattern.BlockPatternMatch patternResult, Entity entity, BlockPos pos) {
|
||||
+ // Purpur start
|
||||
+ spawnGolemInWorld(world, patternResult, entity, pos, null);
|
||||
+ }
|
||||
+ private static void spawnGolemInWorld(Level world, BlockPattern.BlockPatternMatch patternResult, Entity entity, BlockPos pos, net.minecraft.world.entity.LivingEntity placer) {
|
||||
+ if (entity instanceof SnowGolem snowGolem) {
|
||||
+ snowGolem.setSummoner(placer == null ? null : placer.getUUID());
|
||||
+ } else if (entity instanceof IronGolem ironGolem) {
|
||||
+ ironGolem.setSummoner(placer == null ? null : placer.getUUID());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
// clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - moved down
|
||||
entity.moveTo((double) pos.getX() + 0.5D, (double) pos.getY() + 0.05D, (double) pos.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
index bbf59b2577812e74ffd45f694b83a42e043273c0..5cb06959aeaceeb98cfee34b1df804e6642f305f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
@@ -79,6 +79,7 @@ public class WitherSkullBlock extends SkullBlock {
|
||||
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F, 0.0F);
|
||||
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F;
|
||||
entitywither.makeInvulnerable();
|
||||
+ entitywither.setSummoner(iblockdata.getBlock().placer == null ? null : iblockdata.getBlock().placer.getUUID()); // Purpur
|
||||
// CraftBukkit start
|
||||
if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
return;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
|
||||
index 63cae1a2e95d8da17c45c4404a8dd0ca6a413c39..966587c2788b5c93be83259ddc962a89cde7cbaa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
|
||||
@@ -27,4 +27,17 @@ public class CraftIronGolem extends CraftGolem implements IronGolem {
|
||||
public void setPlayerCreated(boolean playerCreated) {
|
||||
this.getHandle().setPlayerCreated(playerCreated);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return getHandle().getSummoner();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner) {
|
||||
+ getHandle().setSummoner(summoner);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
index 4ce2373ff71c3c1b8951646e057587a3ab09e145..4f7f6cf6ca24406570d2d29dc63dc89401119961 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
@@ -28,4 +28,17 @@ public class CraftSnowman extends CraftGolem implements Snowman, com.destroystok
|
||||
public String toString() {
|
||||
return "CraftSnowman";
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return getHandle().getSummoner();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner) {
|
||||
+ getHandle().setSummoner(summoner);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
index 955948f6ec096304671a98f7241930fa91565711..14ffecadeeebd65207799f1dcc189e5ac0261c2a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
@@ -99,4 +99,17 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
|
||||
this.getHandle().makeInvulnerable();
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return getHandle().getSummoner();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner) {
|
||||
+ getHandle().setSummoner(summoner);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 21:52:15 -0500
|
||||
Subject: [PATCH] Customizable sleeping actionbar messages
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 6ee3292a5ca8421226be0afef73cbb1484b4311f..d54a242fbfce347f652d03f8eeac2f990168b809 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -855,11 +855,27 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (this.canSleepThroughNights()) {
|
||||
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
|
||||
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
- MutableComponent ichatmutablecomponent;
|
||||
+ Component ichatmutablecomponent;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i)) {
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) {
|
||||
+ ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight));
|
||||
+ } else
|
||||
ichatmutablecomponent = Component.translatable("sleep.skipping_night");
|
||||
} else {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 5b3ffa3aa96dffba149c0fa8d7fb62cc36f8a4a0..598af66601624687f000b74307863e18a56faa27 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1534,7 +1534,19 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
});
|
||||
|
||||
if (!this.serverLevel().canSleepThroughNights()) {
|
||||
- this.displayClientMessage(Component.translatable("sleep.not_possible"), true);
|
||||
+ // Purpur start
|
||||
+ Component clientMessage;
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepNotPossible.isBlank()) {
|
||||
+ clientMessage = null;
|
||||
+ } else if (!org.purpurmc.purpur.PurpurConfig.sleepNotPossible.equalsIgnoreCase("default")) {
|
||||
+ clientMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepNotPossible));
|
||||
+ } else {
|
||||
+ clientMessage = Component.translatable("sleep.not_possible");
|
||||
+ }
|
||||
+ if (clientMessage != null) {
|
||||
+ this.displayClientMessage(clientMessage, true);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
((ServerLevel) this.level()).updateSleepingPlayerList();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index c77691aeb9d0c35fe042a6e375e12d042091d17a..74b1153454ae75653706913c993781c462d95689 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -186,6 +186,9 @@ public class PurpurConfig {
|
||||
public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
public static String uptimeCommandOutput = "<green>Server uptime is <uptime>";
|
||||
public static String unverifiedUsername = "default";
|
||||
+ public static String sleepSkippingNight = "default";
|
||||
+ public static String sleepingPlayersPercent = "default";
|
||||
+ public static String sleepNotPossible = "default";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
|
||||
@@ -200,6 +203,9 @@ public class PurpurConfig {
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
uptimeCommandOutput = getString("settings.messages.uptime-command-output", uptimeCommandOutput);
|
||||
unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
|
||||
+ sleepSkippingNight = getString("settings.messages.sleep-skipping-night", sleepSkippingNight);
|
||||
+ sleepingPlayersPercent = getString("settings.messages.sleeping-players-percent", sleepingPlayersPercent);
|
||||
+ sleepNotPossible = getString("settings.messages.sleep-not-possible", sleepNotPossible);
|
||||
}
|
||||
|
||||
public static String deathMsgRunWithScissors = "<player> slipped and fell on their shears";
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 5 Jul 2021 20:23:08 -0500
|
||||
Subject: [PATCH] option to disable shulker box items from dropping contents
|
||||
when destroyed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 3253361d91e2a2e68d354eaf3dd3e3cd486e191d..2649188930653610b8aaaeb18797c80879cd572a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -260,6 +260,7 @@ public class BlockItem extends Item {
|
||||
ItemContainerContents itemcontainercontents = (ItemContainerContents) entity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY);
|
||||
|
||||
if (itemcontainercontents != null) {
|
||||
+ if (entity.level().purpurConfig.shulkerBoxItemDropContentsWhenDestroyed && entity.getItem().is(Items.SHULKER_BOX)) // Purpur
|
||||
ItemUtils.onContainerDestroyed(entity, itemcontainercontents.nonEmptyItemsCopy());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index f4bc09f96a1f203e9c7a5989e285c87dc3802bff..7f4f2f4812d1b2c2ee6875de38954de5faeea530 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -206,6 +206,7 @@ public class PurpurWorldConfig {
|
||||
public int enderPearlCooldownCreative = 20;
|
||||
public float enderPearlEndermiteChance = 0.05F;
|
||||
public int glowBerriesEatGlowDuration = 0;
|
||||
+ public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -252,6 +253,7 @@ public class PurpurWorldConfig {
|
||||
enderPearlCooldownCreative = getInt("gameplay-mechanics.item.ender-pearl.creative-cooldown", enderPearlCooldownCreative);
|
||||
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
||||
+ shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
52
patches/server/0178-Big-dripleaf-tilt-delay.patch
Normal file
52
patches/server/0178-Big-dripleaf-tilt-delay.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 16 Jul 2021 22:47:29 -0500
|
||||
Subject: [PATCH] Big dripleaf tilt delay
|
||||
|
||||
Makes the tilt delays configurable. There are only 3 types of tilts used by this setting. When an entity steps on a
|
||||
big_dripleaf with no tilt it will immediately change to an UNSTABLE tilt. Each change after that is on a tick timer:
|
||||
|
||||
UNSTABLE: big_dripleaf with UNSTABLE tilt will change to PARTIAL tilt after 10 ticks
|
||||
PARTIAL: big_dripleaf with PARTIAL tilt will change to FULL tilt after 10 ticks
|
||||
UNSTABLE: big_dripleaf with FULL tilt will change back to no tilt after 100 ticks
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
index 8240c32d676a88aa23dcd052ee0136767e54fb0d..372c4ab9d390d5afd98947f21c79aae06b15064d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
@@ -244,7 +244,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
|
||||
BigDripleafBlock.playTiltSound(world, blockposition, soundeffect);
|
||||
}
|
||||
|
||||
- int i = BigDripleafBlock.DELAY_UNTIL_NEXT_TILT_STATE.getInt(tilt);
|
||||
+ int i = world.purpurConfig.bigDripleafTiltDelay.getOrDefault(tilt, -1); // Purpur
|
||||
|
||||
if (i != -1) {
|
||||
world.scheduleTick(blockposition, (Block) this, i);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 7f4f2f4812d1b2c2ee6875de38954de5faeea530..9ebc34a3ec7eaa4210c10186db6939ae744bc628 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -802,6 +802,22 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public Map<Tilt, Integer> bigDripleafTiltDelay = new HashMap<>();
|
||||
+ private void bigDripleafSettings() {
|
||||
+ bigDripleafTiltDelay.clear();
|
||||
+ getMap("blocks.big_dripleaf.tilt-delay", Map.ofEntries(
|
||||
+ Map.entry("UNSTABLE", 10),
|
||||
+ Map.entry("PARTIAL", 10),
|
||||
+ Map.entry("FULL", 100))
|
||||
+ ).forEach((tilt, delay) -> {
|
||||
+ try {
|
||||
+ bigDripleafTiltDelay.put(Tilt.valueOf(tilt), (int) delay);
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "Invalid big_dripleaf tilt key: " + tilt);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
public boolean chestOpenWithBlockOnTop = false;
|
||||
private void chestSettings() {
|
||||
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||
44
patches/server/0179-Player-ridable-in-water-option.patch
Normal file
44
patches/server/0179-Player-ridable-in-water-option.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 17 Jul 2021 15:55:14 -0500
|
||||
Subject: [PATCH] Player ridable in water option
|
||||
|
||||
|
||||
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 4a5a18443db0f7c69b61db2ded63355ef4d72d9a..5a9abf3cb9448f922c7d87a48fa50337e35c2c34 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2079,6 +2079,13 @@ public abstract class Player extends LivingEntity {
|
||||
return slot != EquipmentSlot.BODY;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public boolean dismountsUnderwater() {
|
||||
+ return !level().purpurConfig.playerRidableInWater;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public boolean setEntityOnShoulder(CompoundTag entityNbt) {
|
||||
if (!this.isPassenger() && this.onGround() && !this.isInWater() && !this.isInPowderSnow) {
|
||||
if (this.getShoulderEntityLeft().isEmpty()) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 9ebc34a3ec7eaa4210c10186db6939ae744bc628..04b68b2dfb67e312352b7d27719116c27ada56bf 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -378,6 +378,7 @@ public class PurpurWorldConfig {
|
||||
public double playerCriticalDamageMultiplier = 1.5D;
|
||||
public int playerBurpDelay = 10;
|
||||
public boolean playerBurpWhenFull = false;
|
||||
+ public boolean playerRidableInWater = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -399,6 +400,7 @@ public class PurpurWorldConfig {
|
||||
playerCriticalDamageMultiplier = getDouble("gameplay-mechanics.player.critical-damage-multiplier", playerCriticalDamageMultiplier);
|
||||
playerBurpDelay = getInt("gameplay-mechanics.player.burp-delay", playerBurpDelay);
|
||||
playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull);
|
||||
+ playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater);
|
||||
}
|
||||
|
||||
public boolean silkTouchEnabled = false;
|
||||
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Mon, 19 Jul 2021 19:28:17 -0400
|
||||
Subject: [PATCH] Config to disable Enderman teleport on projectile hit
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index f2e21c9d3cefb635c4eb583ac9355b46675c94e7..2855efc4670c58219ca1e78770ac289ab1421801 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -436,6 +436,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
} else {
|
||||
flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount);
|
||||
|
||||
+ if (!flag1 && this.level().purpurConfig.endermanIgnoreProjectiles) return super.hurt(source, amount); // Purpur
|
||||
if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (this.teleport()) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 04b68b2dfb67e312352b7d27719116c27ada56bf..43ff6a697d60e66f9ec9b0cee302436bcaa87b90 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1432,6 +1432,7 @@ public class PurpurWorldConfig {
|
||||
public boolean endermanAggroEndermitesOnlyIfPlayerSpawned = false;
|
||||
public boolean endermanIgnorePlayerDragonHead = false;
|
||||
public boolean endermanDisableStareAggro = false;
|
||||
+ public boolean endermanIgnoreProjectiles = false;
|
||||
private void endermanSettings() {
|
||||
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
|
||||
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
|
||||
@@ -1454,6 +1455,7 @@ public class PurpurWorldConfig {
|
||||
endermanAggroEndermitesOnlyIfPlayerSpawned = getBoolean("mobs.enderman.aggressive-towards-endermites-only-spawned-by-player-thrown-ender-pearls", endermanAggroEndermitesOnlyIfPlayerSpawned);
|
||||
endermanIgnorePlayerDragonHead = getBoolean("mobs.enderman.ignore-players-wearing-dragon-head", endermanIgnorePlayerDragonHead);
|
||||
endermanDisableStareAggro = getBoolean("mobs.enderman.disable-player-stare-aggression", endermanDisableStareAggro);
|
||||
+ endermanIgnoreProjectiles = getBoolean("mobs.enderman.ignore-projectiles", endermanIgnoreProjectiles);
|
||||
}
|
||||
|
||||
public boolean endermiteRidable = false;
|
||||
248
patches/server/0181-Add-compass-command.patch
Normal file
248
patches/server/0181-Add-compass-command.patch
Normal file
@@ -0,0 +1,248 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 24 Jul 2021 00:07:31 -0500
|
||||
Subject: [PATCH] Add compass command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index a9180b1ce021f6d4d60e43bc04e863be99daf9d3..89cfef3a5c466a8f508cce1aa37ec6b01432eb35 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -255,6 +255,7 @@ public class Commands {
|
||||
org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.UptimeCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.TPSBarCommand.register(this.dispatcher); // Purpur
|
||||
+ org.purpurmc.purpur.command.CompassCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
if (environment.includeIntegrated) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 598af66601624687f000b74307863e18a56faa27..3dff1bb3a847cf121155b815cd9b6491b50029c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -298,6 +298,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
public boolean purpurClient = false; // Purpur
|
||||
private boolean tpsBar = false; // Purpur
|
||||
+ private boolean compassBar = false; // Purpur
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
@@ -568,6 +569,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
}
|
||||
|
||||
if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
|
||||
+ if (nbt.contains("Purpur.CompassBar")) { this.compassBar = nbt.getBoolean("Purpur.CompassBar"); } // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -645,6 +647,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
}
|
||||
|
||||
nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
|
||||
+ nbt.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur
|
||||
}
|
||||
|
||||
// CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
@@ -3046,5 +3049,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
public void tpsBar(boolean tpsBar) {
|
||||
this.tpsBar = tpsBar;
|
||||
}
|
||||
+
|
||||
+ public boolean compassBar() {
|
||||
+ return this.compassBar;
|
||||
+ }
|
||||
+
|
||||
+ public void compassBar(boolean compassBar) {
|
||||
+ this.compassBar = compassBar;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 74b1153454ae75653706913c993781c462d95689..c1e7dc324237eea16e88a1fc636d5bcdf49a2b0c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -255,6 +255,11 @@ public class PurpurConfig {
|
||||
public static String commandTPSBarTextColorMedium = "<gradient:#ffff55:#ffaa00><text></gradient>";
|
||||
public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
|
||||
public static int commandTPSBarTickInterval = 20;
|
||||
+ public static String commandCompassBarTitle = "S \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 W \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 N \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 E \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 S \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 W \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 N \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 E \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 ";
|
||||
+ public static BossBar.Overlay commandCompassBarProgressOverlay = BossBar.Overlay.PROGRESS;
|
||||
+ public static BossBar.Color commandCompassBarProgressColor = BossBar.Color.BLUE;
|
||||
+ public static float commandCompassBarProgressPercent = 1.0F;
|
||||
+ public static int commandCompassBarTickInterval = 5;
|
||||
public static boolean commandGamemodeRequiresPermission = false;
|
||||
public static boolean hideHiddenPlayersFromEntitySelector = false;
|
||||
public static String uptimeFormat = "<days><hours><minutes><seconds>";
|
||||
@@ -277,6 +282,13 @@ public class PurpurConfig {
|
||||
commandTPSBarTextColorMedium = getString("settings.command.tpsbar.text-color.medium", commandTPSBarTextColorMedium);
|
||||
commandTPSBarTextColorLow = getString("settings.command.tpsbar.text-color.low", commandTPSBarTextColorLow);
|
||||
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);
|
||||
+
|
||||
+ commandCompassBarTitle = getString("settings.command.compass.title", commandCompassBarTitle);
|
||||
+ commandCompassBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.compass.overlay", commandCompassBarProgressOverlay.name()));
|
||||
+ commandCompassBarProgressColor = BossBar.Color.valueOf(getString("settings.command.compass.progress-color", commandCompassBarProgressColor.name()));
|
||||
+ commandCompassBarProgressPercent = (float) getDouble("settings.command.compass.percent", commandCompassBarProgressPercent);
|
||||
+ commandCompassBarTickInterval = getInt("settings.command.compass.tick-interval", commandCompassBarTickInterval);
|
||||
+
|
||||
commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
||||
hideHiddenPlayersFromEntitySelector = getBoolean("settings.command.hide-hidden-players-from-entity-selector", hideHiddenPlayersFromEntitySelector);
|
||||
uptimeFormat = getString("settings.command.uptime.format", uptimeFormat);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 43ff6a697d60e66f9ec9b0cee302436bcaa87b90..016dc535a8b50a77be3b2cdef39d3130cba1b601 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -207,6 +207,7 @@ public class PurpurWorldConfig {
|
||||
public float enderPearlEndermiteChance = 0.05F;
|
||||
public int glowBerriesEatGlowDuration = 0;
|
||||
public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
|
||||
+ public boolean compassItemShowsBossBar = false;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -254,6 +255,7 @@ public class PurpurWorldConfig {
|
||||
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
||||
shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
|
||||
+ compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/command/CompassCommand.java b/src/main/java/org/purpurmc/purpur/command/CompassCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..79b8490832d2a0cc7846ddcb091cb6bcac74ea45
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/command/CompassCommand.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package org.purpurmc.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.purpurmc.purpur.task.CompassTask;
|
||||
+
|
||||
+public class CompassCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("compass")
|
||||
+ .requires(listener -> listener.hasPermission(2, "bukkit.command.compass"))
|
||||
+ .executes(context -> {
|
||||
+ ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
+ CompassTask task = CompassTask.instance();
|
||||
+ if (player.compassBar()) {
|
||||
+ task.removePlayer(player.getBukkitEntity());
|
||||
+ player.compassBar(false);
|
||||
+ } else {
|
||||
+ task.addPlayer(player.getBukkitEntity());
|
||||
+ player.compassBar(true);
|
||||
+ }
|
||||
+ return 1;
|
||||
+ })
|
||||
+ );
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/task/BossBarTask.java b/src/main/java/org/purpurmc/purpur/task/BossBarTask.java
|
||||
index d38b3c4a722396cc3b61a9a8ed7e39cea4ae65cb..d333334f323049ca97e756324cff0b23eddacd2a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/task/BossBarTask.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/task/BossBarTask.java
|
||||
@@ -90,10 +90,12 @@ public abstract class BossBarTask extends BukkitRunnable {
|
||||
|
||||
public static void startAll() {
|
||||
TPSBarTask.instance().start();
|
||||
+ CompassTask.instance().start();
|
||||
}
|
||||
|
||||
public static void stopAll() {
|
||||
TPSBarTask.instance().stop();
|
||||
+ CompassTask.instance().stop();
|
||||
}
|
||||
|
||||
public static void addToAll(ServerPlayer player) {
|
||||
@@ -101,9 +103,13 @@ public abstract class BossBarTask extends BukkitRunnable {
|
||||
if (player.tpsBar()) {
|
||||
TPSBarTask.instance().addPlayer(bukkit);
|
||||
}
|
||||
+ if (player.compassBar()) {
|
||||
+ CompassTask.instance().addPlayer(bukkit);
|
||||
+ }
|
||||
}
|
||||
|
||||
public static void removeFromAll(Player player) {
|
||||
TPSBarTask.instance().removePlayer(player);
|
||||
+ CompassTask.instance().removePlayer(player);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/task/CompassTask.java b/src/main/java/org/purpurmc/purpur/task/CompassTask.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bece7eefc8ba8822b433835526251d2fb916c025
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/task/CompassTask.java
|
||||
@@ -0,0 +1,68 @@
|
||||
+package org.purpurmc.purpur.task;
|
||||
+
|
||||
+import net.kyori.adventure.bossbar.BossBar;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.item.Items;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.purpurmc.purpur.PurpurConfig;
|
||||
+
|
||||
+public class CompassTask extends BossBarTask {
|
||||
+ private static CompassTask instance;
|
||||
+
|
||||
+ private int tick = 0;
|
||||
+
|
||||
+ public static CompassTask instance() {
|
||||
+ if (instance == null) {
|
||||
+ instance = new CompassTask();
|
||||
+ }
|
||||
+ return instance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ if (++tick < PurpurConfig.commandCompassBarTickInterval) {
|
||||
+ return;
|
||||
+ }
|
||||
+ tick = 0;
|
||||
+
|
||||
+ MinecraftServer.getServer().getAllLevels().forEach((level) -> {
|
||||
+ if (level.purpurConfig.compassItemShowsBossBar) {
|
||||
+ level.players().forEach(player -> {
|
||||
+ if (!player.compassBar()) {
|
||||
+ if (player.getMainHandItem().getItem() != Items.COMPASS && player.getOffhandItem().getItem() != Items.COMPASS) {
|
||||
+ removePlayer(player.getBukkitEntity());
|
||||
+ } else if (!hasPlayer(player.getUUID())) {
|
||||
+ addPlayer(player.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ super.run();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ BossBar createBossBar() {
|
||||
+ return BossBar.bossBar(Component.text(""), PurpurConfig.commandCompassBarProgressPercent, PurpurConfig.commandCompassBarProgressColor, PurpurConfig.commandCompassBarProgressOverlay);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ void updateBossBar(BossBar bossbar, Player player) {
|
||||
+ float yaw = player.getLocation().getYaw();
|
||||
+ int length = PurpurConfig.commandCompassBarTitle.length();
|
||||
+ int pos = (int) ((normalize(yaw) * (length / 720F)) + (length / 2F));
|
||||
+ bossbar.name(Component.text(PurpurConfig.commandCompassBarTitle.substring(pos - 25, pos + 25)));
|
||||
+ }
|
||||
+
|
||||
+ private float normalize(float yaw) {
|
||||
+ while (yaw < -180.0F) {
|
||||
+ yaw += 360.0F;
|
||||
+ }
|
||||
+ while (yaw > 180.0F) {
|
||||
+ yaw -= 360.0F;
|
||||
+ }
|
||||
+ return yaw;
|
||||
+ }
|
||||
+}
|
||||
37
patches/server/0182-Toggle-for-kinetic-damage.patch
Normal file
37
patches/server/0182-Toggle-for-kinetic-damage.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Wed, 4 Aug 2021 11:44:26 +0200
|
||||
Subject: [PATCH] Toggle for kinetic damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 25b3fe2eb700a4a957957fa0be711d2a27b76597..b08851827656f644a560b084aed10087665153db 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2983,6 +2983,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
if (f3 > 0.0F) {
|
||||
this.playSound(this.getFallDamageSound((int) f3), 1.0F, 1.0F);
|
||||
+ if (level().purpurConfig.elytraKineticDamage) // Purpur
|
||||
this.hurt(this.damageSources().flyIntoWall(), f3);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 016dc535a8b50a77be3b2cdef39d3130cba1b601..6d85f73fdd1545fe15de1c201999a5cb6b3112aa 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -178,12 +178,14 @@ public class PurpurWorldConfig {
|
||||
public boolean elytraIgnoreUnbreaking = false;
|
||||
public int elytraDamagePerFireworkBoost = 0;
|
||||
public int elytraDamagePerTridentBoost = 0;
|
||||
+ public boolean elytraKineticDamage = true;
|
||||
private void elytraSettings() {
|
||||
elytraDamagePerSecond = getInt("gameplay-mechanics.elytra.damage-per-second", elytraDamagePerSecond);
|
||||
elytraDamageMultiplyBySpeed = getDouble("gameplay-mechanics.elytra.damage-multiplied-by-speed", elytraDamageMultiplyBySpeed);
|
||||
elytraIgnoreUnbreaking = getBoolean("gameplay-mechanics.elytra.ignore-unbreaking", elytraIgnoreUnbreaking);
|
||||
elytraDamagePerFireworkBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.firework", elytraDamagePerFireworkBoost);
|
||||
elytraDamagePerTridentBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.trident", elytraDamagePerTridentBoost);
|
||||
+ elytraKineticDamage = getBoolean("gameplay-mechanics.elytra.kinetic-damage", elytraKineticDamage);
|
||||
}
|
||||
|
||||
public int entityLifeSpan = 0;
|
||||
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 5 Jul 2021 06:00:17 +0200
|
||||
Subject: [PATCH] Add Option for disable observer clocks
|
||||
|
||||
Allow to disable observer clocks: https://www.spigotmc.org/attachments/observerclock-gif.365936/
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ObserverBlock.java b/src/main/java/net/minecraft/world/level/block/ObserverBlock.java
|
||||
index b38fbe5121f293f425d7673a6ce49b11d0ced0d9..2a74f42672b92393b52a61c27c5b8af77c8c6070 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ObserverBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ObserverBlock.java
|
||||
@@ -71,6 +71,7 @@ public class ObserverBlock extends DirectionalBlock {
|
||||
@Override
|
||||
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (state.getValue(ObserverBlock.FACING) == direction && !(Boolean) state.getValue(ObserverBlock.POWERED)) {
|
||||
+ if (!world.getMinecraftWorld().purpurConfig.disableObserverClocks || !(neighborState.getBlock() instanceof ObserverBlock) || neighborState.getValue(ObserverBlock.FACING).getOpposite() != direction) // Purpur
|
||||
this.startSignal(world, pos);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 6d85f73fdd1545fe15de1c201999a5cb6b3112aa..c630b50ce74c3226929ec1ca6ca61bda66439861 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -354,6 +354,11 @@ public class PurpurWorldConfig {
|
||||
villageSiegeSpawning = getBoolean("gameplay-mechanics.mob-spawning.village-sieges", predicate);
|
||||
}
|
||||
|
||||
+ public boolean disableObserverClocks = false;
|
||||
+ private void observerSettings() {
|
||||
+ disableObserverClocks = getBoolean("blocks.observer.disable-clock", disableObserverClocks);
|
||||
+ }
|
||||
+
|
||||
public int playerNetheriteFireResistanceDuration = 0;
|
||||
public int playerNetheriteFireResistanceAmplifier = 0;
|
||||
public boolean playerNetheriteFireResistanceAmbient = false;
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Fri, 6 Aug 2021 22:30:10 +0200
|
||||
Subject: [PATCH] Customizeable Zombie Villager curing times
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index 3c4cff3f095cdf2dd74df7bf4bb8f3d5600b342d..9bb75b49ea2d0bd8aafbe537b65f86eb04f6cfe2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -225,7 +225,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
if (this.hasEffect(MobEffects.WEAKNESS)) {
|
||||
itemstack.consume(1, player);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.startConverting(player.getUUID(), this.random.nextInt(2401) + 3600);
|
||||
+ this.startConverting(player.getUUID(), this.random.nextInt(level().purpurConfig.zombieVillagerCuringTimeMax - level().purpurConfig.zombieVillagerCuringTimeMin + 1) + level().purpurConfig.zombieVillagerCuringTimeMin); // Purpur
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index c630b50ce74c3226929ec1ca6ca61bda66439861..a72707d512434e90f1ce076ba86946cbf6915a2d 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2831,6 +2831,8 @@ public class PurpurWorldConfig {
|
||||
public double zombieVillagerJockeyChance = 0.05D;
|
||||
public boolean zombieVillagerJockeyTryExistingChickens = true;
|
||||
public boolean zombieVillagerTakeDamageFromWater = false;
|
||||
+ public int zombieVillagerCuringTimeMin = 3600;
|
||||
+ public int zombieVillagerCuringTimeMax = 6000;
|
||||
private void zombieVillagerSettings() {
|
||||
zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable);
|
||||
zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater);
|
||||
@@ -2846,6 +2848,8 @@ public class PurpurWorldConfig {
|
||||
zombieVillagerJockeyChance = getDouble("mobs.zombie_villager.jockey.chance", zombieVillagerJockeyChance);
|
||||
zombieVillagerJockeyTryExistingChickens = getBoolean("mobs.zombie_villager.jockey.try-existing-chickens", zombieVillagerJockeyTryExistingChickens);
|
||||
zombieVillagerTakeDamageFromWater = getBoolean("mobs.zombie_villager.takes-damage-from-water", zombieVillagerTakeDamageFromWater);
|
||||
+ zombieVillagerCuringTimeMin = getInt("mobs.zombie_villager.curing_time.min", zombieVillagerCuringTimeMin);
|
||||
+ zombieVillagerCuringTimeMax = getInt("mobs.zombie_villager.curing_time.max", zombieVillagerCuringTimeMax);
|
||||
}
|
||||
|
||||
public boolean zombifiedPiglinRidable = false;
|
||||
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 20:23:31 +0200
|
||||
Subject: [PATCH] Option for sponges to work on lava and mud
|
||||
|
||||
Co-authored by: granny <granny@purpurmc.org>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
index a676ccfa6b02e8986df6f6a2e04cbb06b3edd0ff..6fe44572e34ad3e3a1851e73138bd8b778eb7849 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -77,7 +77,7 @@ public class SpongeBlock extends Block {
|
||||
FluidState fluid = blockList.getFluidState(blockposition1);
|
||||
// CraftBukkit end
|
||||
|
||||
- if (!fluid.is(FluidTags.WATER)) {
|
||||
+ if (!fluid.is(FluidTags.WATER) && (!world.purpurConfig.spongeAbsorbsLava || !fluid.is(FluidTags.LAVA)) && (!world.purpurConfig.spongeAbsorbsWaterFromMud || !iblockdata.is(Blocks.MUD))) { // Purpur
|
||||
return false;
|
||||
} else {
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -92,6 +92,10 @@ public class SpongeBlock extends Block {
|
||||
|
||||
if (iblockdata.getBlock() instanceof LiquidBlock) {
|
||||
blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
|
||||
+ // Purpur start
|
||||
+ } else if (iblockdata.is(Blocks.MUD)) {
|
||||
+ blockList.setBlock(blockposition1, Blocks.CLAY.defaultBlockState(), 3);
|
||||
+ // Purpur end
|
||||
} else {
|
||||
if (!iblockdata.is(Blocks.KELP) && !iblockdata.is(Blocks.KELP_PLANT) && !iblockdata.is(Blocks.SEAGRASS) && !iblockdata.is(Blocks.TALL_SEAGRASS)) {
|
||||
return false;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a72707d512434e90f1ce076ba86946cbf6915a2d..1585bf88785f132df354540caf3fa7901d2d7985 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -988,9 +988,13 @@ public class PurpurWorldConfig {
|
||||
|
||||
public int spongeAbsorptionArea = 65;
|
||||
public int spongeAbsorptionRadius = 6;
|
||||
+ public boolean spongeAbsorbsLava = false;
|
||||
+ public boolean spongeAbsorbsWaterFromMud = false;
|
||||
private void spongeSettings() {
|
||||
spongeAbsorptionArea = getInt("blocks.sponge.absorption.area", spongeAbsorptionArea);
|
||||
spongeAbsorptionRadius = getInt("blocks.sponge.absorption.radius", spongeAbsorptionRadius);
|
||||
+ spongeAbsorbsLava = getBoolean("blocks.sponge.absorbs-lava", spongeAbsorbsLava);
|
||||
+ spongeAbsorbsWaterFromMud = getBoolean("blocks.sponge.absorbs-water-from-mud", spongeAbsorbsWaterFromMud);
|
||||
}
|
||||
|
||||
public boolean turtleEggsBreakFromExpOrbs = false;
|
||||
39
patches/server/0186-Toggle-for-Wither-s-spawn-sound.patch
Normal file
39
patches/server/0186-Toggle-for-Wither-s-spawn-sound.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 21:27:56 +0200
|
||||
Subject: [PATCH] Toggle for Wither's spawn sound
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 0a8466fa93d4955c3d9a1d5a57eeb0751d20a8d4..adfadd75f29a82f606824f7d98f3abec8e8591c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -425,7 +425,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
- if (!this.isSilent()) {
|
||||
+ if (!this.isSilent() && level().purpurConfig.witherPlaySpawnSound) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.level().globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 1585bf88785f132df354540caf3fa7901d2d7985..a4f69c7695c41ed23b230ee9592d28c3c42a50ef 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2676,6 +2676,7 @@ public class PurpurWorldConfig {
|
||||
public boolean witherTakeDamageFromWater = false;
|
||||
public boolean witherCanRideVehicles = false;
|
||||
public float witherExplosionRadius = 1.0F;
|
||||
+ public boolean witherPlaySpawnSound = true;
|
||||
private void witherSettings() {
|
||||
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
|
||||
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
|
||||
@@ -2697,6 +2698,7 @@ public class PurpurWorldConfig {
|
||||
witherTakeDamageFromWater = getBoolean("mobs.wither.takes-damage-from-water", witherTakeDamageFromWater);
|
||||
witherCanRideVehicles = getBoolean("mobs.wither.can-ride-vehicles", witherCanRideVehicles);
|
||||
witherExplosionRadius = (float) getDouble("mobs.wither.explosion-radius", witherExplosionRadius);
|
||||
+ witherPlaySpawnSound = getBoolean("mobs.wither.play-spawn-sound", witherPlaySpawnSound);
|
||||
}
|
||||
|
||||
public boolean witherSkeletonRidable = false;
|
||||
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 03:37:56 -0500
|
||||
Subject: [PATCH] Cactus breaks from solid neighbors config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
index ff4dda48116a2969704b355ff96407ba869b466e..9200d75b05ce535f7b7f5c1572cd8f6261c6955b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
@@ -114,7 +114,7 @@ public class CactusBlock extends Block {
|
||||
|
||||
enumdirection = (Direction) iterator.next();
|
||||
iblockdata1 = world.getBlockState(pos.relative(enumdirection));
|
||||
- } while (!iblockdata1.isSolid() && !world.getFluidState(pos.relative(enumdirection)).is(FluidTags.LAVA));
|
||||
+ } while ((!world.getWorldBorder().world.purpurConfig.cactusBreaksFromSolidNeighbors || !iblockdata1.isSolid()) && !world.getFluidState(pos.relative(enumdirection)).is(FluidTags.LAVA)); // Purpur
|
||||
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a4f69c7695c41ed23b230ee9592d28c3c42a50ef..f68542446cdfc9b0f7741abe4b901b8f0ac9f259 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -829,6 +829,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean cactusBreaksFromSolidNeighbors = true;
|
||||
+ private void cactusSettings() {
|
||||
+ cactusBreaksFromSolidNeighbors = getBoolean("blocks.cactus.breaks-from-solid-neighbors", cactusBreaksFromSolidNeighbors);
|
||||
+ }
|
||||
+
|
||||
public boolean chestOpenWithBlockOnTop = false;
|
||||
private void chestSettings() {
|
||||
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||
130
patches/server/0188-Conduit-behavior-configuration.patch
Normal file
130
patches/server/0188-Conduit-behavior-configuration.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 18:14:31 -0400
|
||||
Subject: [PATCH] Conduit behavior configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
||||
index 73e532dc998e5701c1a73da846da3d3a79871b81..ff6fea842ca80c2ba51693fe62e5b74f9affdc19 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
||||
@@ -168,7 +168,7 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
if ((l > 1 || i1 > 1 || j1 > 1) && (i == 0 && (i1 == 2 || j1 == 2) || j == 0 && (l == 2 || j1 == 2) || k == 0 && (l == 2 || i1 == 2))) {
|
||||
BlockPos blockposition2 = pos.offset(i, j, k);
|
||||
BlockState iblockdata = world.getBlockState(blockposition2);
|
||||
- Block[] ablock = ConduitBlockEntity.VALID_BLOCKS;
|
||||
+ Block[] ablock = world.purpurConfig.conduitBlocks; // Purpur
|
||||
int k1 = ablock.length;
|
||||
|
||||
for (int l1 = 0; l1 < k1; ++l1) {
|
||||
@@ -188,13 +188,13 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
|
||||
private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) {
|
||||
// CraftBukkit start
|
||||
- ConduitBlockEntity.applyEffects(world, pos, ConduitBlockEntity.getRange(activatingBlocks));
|
||||
+ ConduitBlockEntity.applyEffects(world, pos, ConduitBlockEntity.getRange(activatingBlocks, world)); // Purpur
|
||||
}
|
||||
|
||||
- public static int getRange(List<BlockPos> list) {
|
||||
+ public static int getRange(List<BlockPos> list, Level world) { // Purpur
|
||||
// CraftBukkit end
|
||||
int i = list.size();
|
||||
- int j = i / 7 * 16;
|
||||
+ int j = i / 7 * world.purpurConfig.conduitDistance; // Purpur
|
||||
// CraftBukkit start
|
||||
return j;
|
||||
}
|
||||
@@ -237,20 +237,20 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
tileentityconduit.destroyTarget = ConduitBlockEntity.findDestroyTarget(world, blockposition, tileentityconduit.destroyTargetUUID);
|
||||
tileentityconduit.destroyTargetUUID = null;
|
||||
} else if (tileentityconduit.destroyTarget == null) {
|
||||
- List<LivingEntity> list1 = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(blockposition), (entityliving1) -> {
|
||||
+ List<LivingEntity> list1 = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(blockposition, world), (entityliving1) -> { // Purpur
|
||||
return entityliving1 instanceof Enemy && entityliving1.isInWaterOrRain();
|
||||
});
|
||||
|
||||
if (!list1.isEmpty()) {
|
||||
tileentityconduit.destroyTarget = (LivingEntity) list1.get(world.random.nextInt(list1.size()));
|
||||
}
|
||||
- } else if (!tileentityconduit.destroyTarget.isAlive() || !blockposition.closerThan(tileentityconduit.destroyTarget.blockPosition(), 8.0D)) {
|
||||
+ } else if (!tileentityconduit.destroyTarget.isAlive() || !blockposition.closerThan(tileentityconduit.destroyTarget.blockPosition(), world.purpurConfig.conduitDamageDistance)) { // Purpur
|
||||
tileentityconduit.destroyTarget = null;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (damageTarget && tileentityconduit.destroyTarget != null) {
|
||||
- if (tileentityconduit.destroyTarget.hurt(world.damageSources().magic().directBlock(world, blockposition), 4.0F)) {
|
||||
+ if (tileentityconduit.destroyTarget.hurt(world.damageSources().magic().directBlock(world, blockposition), world.purpurConfig.conduitDamageAmount)) { // Purpur
|
||||
world.playSound(null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEvents.CONDUIT_ATTACK_TARGET, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -275,16 +275,22 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public static AABB getDestroyRangeAABB(BlockPos pos) {
|
||||
+ // Purpur start
|
||||
+ return getDestroyRangeAABB(pos, null);
|
||||
+ }
|
||||
+
|
||||
+ private static AABB getDestroyRangeAABB(BlockPos pos, Level level) {
|
||||
+ // Purpur end
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
|
||||
- return (new AABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1))).inflate(8.0D);
|
||||
+ return (new AABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1))).inflate(level == null ? 8.0D : level.purpurConfig.conduitDamageDistance); // Purpur
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LivingEntity findDestroyTarget(Level world, BlockPos pos, UUID uuid) {
|
||||
- List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(pos), (entityliving) -> {
|
||||
+ List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, ConduitBlockEntity.getDestroyRangeAABB(pos, world), (entityliving) -> { // Purpur
|
||||
return entityliving.getUUID().equals(uuid);
|
||||
});
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
|
||||
index c1759aeb3e6ad0e4eb66cba3da1b120dd1dce812..1a91bc2e422db0eba65694ac046f1b362c6b0cd6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
|
||||
@@ -73,7 +73,7 @@ public class CraftConduit extends CraftBlockEntityState<ConduitBlockEntity> impl
|
||||
public int getRange() {
|
||||
this.ensureNoWorldGeneration();
|
||||
ConduitBlockEntity conduit = (ConduitBlockEntity) this.getTileEntityFromWorld();
|
||||
- return (conduit != null) ? ConduitBlockEntity.getRange(conduit.effectBlocks) : 0;
|
||||
+ return (conduit != null) ? ConduitBlockEntity.getRange(conduit.effectBlocks, this.world.getHandle()) : 0; // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index f68542446cdfc9b0f7741abe4b901b8f0ac9f259..f9fed1bc4251b286b7a0638362ec15549335a6aa 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2895,4 +2895,27 @@ public class PurpurWorldConfig {
|
||||
private void hungerSettings() {
|
||||
hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
|
||||
}
|
||||
+
|
||||
+ public int conduitDistance = 16;
|
||||
+ public double conduitDamageDistance = 8;
|
||||
+ public float conduitDamageAmount = 4;
|
||||
+ public Block[] conduitBlocks;
|
||||
+ private void conduitSettings() {
|
||||
+ conduitDistance = getInt("blocks.conduit.effect-distance", conduitDistance);
|
||||
+ conduitDamageDistance = getDouble("blocks.conduit.mob-damage.distance", conduitDamageDistance);
|
||||
+ conduitDamageAmount = (float) getDouble("blocks.conduit.mob-damage.damage-amount", conduitDamageAmount);
|
||||
+ List<Block> conduitBlockList = new ArrayList<>();
|
||||
+ getList("blocks.conduit.valid-ring-blocks", new ArrayList<String>(){{
|
||||
+ add("minecraft:prismarine");
|
||||
+ add("minecraft:prismarine_bricks");
|
||||
+ add("minecraft:sea_lantern");
|
||||
+ add("minecraft:dark_prismarine");
|
||||
+ }}).forEach(key -> {
|
||||
+ Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation(key.toString()));
|
||||
+ if (!block.defaultBlockState().isAir()) {
|
||||
+ conduitBlockList.add(block);
|
||||
+ }
|
||||
+ });
|
||||
+ conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
||||
+ }
|
||||
}
|
||||
68
patches/server/0189-Cauldron-fill-chances.patch
Normal file
68
patches/server/0189-Cauldron-fill-chances.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 18:38:44 -0400
|
||||
Subject: [PATCH] Cauldron fill chances
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
||||
index c9968934f4ecaa8d81e545f279b3001c7b1ce545..03e4fce6f8226451365fc2831b5bf1e5e6091730 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
||||
@@ -37,7 +37,7 @@ public class CauldronBlock extends AbstractCauldronBlock {
|
||||
}
|
||||
|
||||
protected static boolean shouldHandlePrecipitation(Level world, Biome.Precipitation precipitation) {
|
||||
- return precipitation == Biome.Precipitation.RAIN ? world.getRandom().nextFloat() < 0.05F : (precipitation == Biome.Precipitation.SNOW ? world.getRandom().nextFloat() < 0.1F : false);
|
||||
+ return precipitation == Biome.Precipitation.RAIN ? world.getRandom().nextFloat() < world.purpurConfig.cauldronRainChance : (precipitation == Biome.Precipitation.SNOW ? world.getRandom().nextFloat() < world.purpurConfig.cauldronPowderSnowChance : false); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
index a2bd54dae4b0460d200f6d5300194a7ef5a28830..bf189a171530abfc9bba5db5a305feb391f2cbee 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
@@ -190,7 +190,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate
|
||||
|
||||
@VisibleForTesting
|
||||
public static void maybeTransferFluid(BlockState state, ServerLevel world, BlockPos pos, float dripChance) {
|
||||
- if (dripChance <= 0.17578125F || dripChance <= 0.05859375F) {
|
||||
+ if (dripChance <= world.purpurConfig.cauldronDripstoneWaterFillChance || dripChance <= world.purpurConfig.cauldronDripstoneLavaFillChance) { // Purpur
|
||||
if (PointedDripstoneBlock.isStalactiteStartPos(state, world, pos)) {
|
||||
Optional<PointedDripstoneBlock.FluidInfo> optional = PointedDripstoneBlock.getFluidAboveStalactite(world, pos, state);
|
||||
|
||||
@@ -199,13 +199,13 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate
|
||||
float f1;
|
||||
|
||||
if (fluidtype == Fluids.WATER) {
|
||||
- f1 = 0.17578125F;
|
||||
+ f1 = world.purpurConfig.cauldronDripstoneWaterFillChance; // Purpur
|
||||
} else {
|
||||
if (fluidtype != Fluids.LAVA) {
|
||||
return;
|
||||
}
|
||||
|
||||
- f1 = 0.05859375F;
|
||||
+ f1 = world.purpurConfig.cauldronDripstoneLavaFillChance; // Purpur
|
||||
}
|
||||
|
||||
if (dripChance < f1) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index f9fed1bc4251b286b7a0638362ec15549335a6aa..7a48f6a49caace49c7759839c128764028afeba3 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2918,4 +2918,15 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
||||
}
|
||||
+
|
||||
+ public float cauldronRainChance = 0.05F;
|
||||
+ public float cauldronPowderSnowChance = 0.1F;
|
||||
+ public float cauldronDripstoneWaterFillChance = 0.17578125F;
|
||||
+ public float cauldronDripstoneLavaFillChance = 0.05859375F;
|
||||
+ private void cauldronSettings() {
|
||||
+ cauldronRainChance = (float) getDouble("blocks.cauldron.fill-chances.rain", cauldronRainChance);
|
||||
+ cauldronPowderSnowChance = (float) getDouble("blocks.cauldron.fill-chances.powder-snow", cauldronPowderSnowChance);
|
||||
+ cauldronDripstoneWaterFillChance = (float) getDouble("blocks.cauldron.fill-chances.dripstone-water", cauldronDripstoneWaterFillChance);
|
||||
+ cauldronDripstoneLavaFillChance = (float) getDouble("blocks.cauldron.fill-chances.dripstone-lava", cauldronDripstoneLavaFillChance);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 22:50:23 -0400
|
||||
Subject: [PATCH] Config to allow mobs to pathfind over rails
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index d5004290e40a1ff5e0fcfe75f8da34ae15962359..31ae0f466ae522d767907ec5066b26695f327b96 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
@@ -240,7 +240,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
if ((node == null || node.costMalus < 0.0F)
|
||||
&& maxYStep > 0
|
||||
&& (pathType != PathType.FENCE || this.canWalkOverFences())
|
||||
- && pathType != PathType.UNPASSABLE_RAIL
|
||||
+ && (this.mob.level().purpurConfig.mobsIgnoreRails || pathType != PathType.UNPASSABLE_RAIL) // Purpur
|
||||
&& pathType != PathType.TRAPDOOR
|
||||
&& pathType != PathType.POWDER_SNOW) {
|
||||
node = this.tryJumpOn(x, y, z, maxYStep, prevFeetY, direction, nodeType, mutableBlockPos);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 7a48f6a49caace49c7759839c128764028afeba3..27c618b482d379277a88222c3e4a0c330fde5cfe 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -136,6 +136,7 @@ public class PurpurWorldConfig {
|
||||
public double voidDamageDealt = 4.0D;
|
||||
public int raidCooldownSeconds = 0;
|
||||
public int animalBreedingCooldownSeconds = 0;
|
||||
+ public boolean mobsIgnoreRails = false;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
@@ -155,6 +156,7 @@ public class PurpurWorldConfig {
|
||||
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
||||
raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds);
|
||||
animalBreedingCooldownSeconds = getInt("gameplay-mechanics.animal-breeding-cooldown-seconds", animalBreedingCooldownSeconds);
|
||||
+ mobsIgnoreRails = getBoolean("gameplay-mechanics.mobs-ignore-rails", mobsIgnoreRails);
|
||||
}
|
||||
|
||||
public int daytimeTicks = 12000;
|
||||
Reference in New Issue
Block a user