mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
i love doing more patches
This commit is contained in:
38
patches/server/0130-Phantom-flames-on-swoop.patch
Normal file
38
patches/server/0130-Phantom-flames-on-swoop.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 12 Dec 2020 09:10:59 -0600
|
||||
Subject: [PATCH] Phantom flames on swoop
|
||||
|
||||
|
||||
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 edb28f9424af0d1973231729785b6ec67b599dbd..c3fde22e1cf98881da66e70870ced65f0ce0abc3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -226,6 +226,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
this.level.addParticle(ParticleTypes.MYCELIUM, this.getX() - (double) f2, this.getY() + (double) f4, this.getZ() - (double) f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
+ if (level.purpurConfig.phantomFlamesOnSwoop && attackPhase == AttackPhase.SWOOP) shoot(); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index f690607739f7f040d633dc64632ecd514c5b601e..4f0ae9c4fa903b476e2a6c47632daf52bb0202f5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1180,6 +1180,7 @@ public class PurpurWorldConfig {
|
||||
public float phantomFlameDamage = 1.0F;
|
||||
public int phantomFlameFireTime = 8;
|
||||
public boolean phantomAllowGriefing = false;
|
||||
+ public boolean phantomFlamesOnSwoop = false;
|
||||
public double phantomMaxHealth = 20.0D;
|
||||
public double phantomAttackedByCrystalRadius = 0.0D;
|
||||
public float phantomAttackedByCrystalDamage = 1.0F;
|
||||
@@ -1206,6 +1207,7 @@ public class PurpurWorldConfig {
|
||||
phantomFlameDamage = (float) getDouble("mobs.phantom.flames.damage", phantomFlameDamage);
|
||||
phantomFlameFireTime = getInt("mobs.phantom.flames.fire-time", phantomFlameFireTime);
|
||||
phantomAllowGriefing = getBoolean("mobs.phantom.allow-griefing", phantomAllowGriefing);
|
||||
+ phantomFlamesOnSwoop = getBoolean("mobs.phantom.flames-on-swoop", phantomFlamesOnSwoop);
|
||||
if (PurpurConfig.version < 10) {
|
||||
double oldValue = getDouble("mobs.phantom.attributes.max-health", phantomMaxHealth);
|
||||
set("mobs.phantom.attributes.max-health", null);
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Sat, 12 Dec 2020 14:34:18 -0800
|
||||
Subject: [PATCH] Option for chests to open even with a solid block on top
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
index db726697b00afdee6078849fd224263483349912..c808664a67a9604e40ab388c6d0e6ac3c13f57ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -356,6 +356,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
}
|
||||
|
||||
private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
|
||||
+ if (world instanceof Level && ((Level) world).purpurConfig.chestOpenWithBlockOnTop) return false; // Purpur
|
||||
BlockPos blockposition1 = pos.above();
|
||||
|
||||
return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 4f0ae9c4fa903b476e2a6c47632daf52bb0202f5..d887e7db69a7d57ebfe8bfe79d032e83ab70259a 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -418,6 +418,11 @@ public class PurpurWorldConfig {
|
||||
caveVinesMaxGrowthAge = getInt("blocks.cave_vines.max-growth-age", caveVinesMaxGrowthAge);
|
||||
}
|
||||
|
||||
+ public boolean chestOpenWithBlockOnTop = false;
|
||||
+ private void chestSettings() {
|
||||
+ chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||
+ }
|
||||
+
|
||||
public boolean dispenserApplyCursedArmor = true;
|
||||
public boolean dispenserPlaceAnvils = false;
|
||||
private void dispenserSettings() {
|
||||
430
patches/server/0132-Implement-TPSBar.patch
Normal file
430
patches/server/0132-Implement-TPSBar.patch
Normal file
@@ -0,0 +1,430 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 12 Dec 2020 21:19:05 -0600
|
||||
Subject: [PATCH] Implement TPSBar
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index d054bee8c7c6f6bf608252f21b2f5192b59c086c..12f5e8b11fad04a1fec717b68fbbf80efa3705bc 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -208,6 +208,7 @@ public class Commands {
|
||||
net.pl3x.purpur.command.CreditsCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.DemoCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
+ net.pl3x.purpur.command.TPSBarCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
if (environment.includeIntegrated) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5c1d9e9af0efe1b83edf2c47574c67ae8d3c064e..e35b469133dc8bdac02e97f8d0792690e568e31c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1127,6 +1127,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.safeShutdown(flag, false);
|
||||
}
|
||||
public void safeShutdown(boolean flag, boolean isRestarting) {
|
||||
+ net.pl3x.purpur.task.BossBarTask.stopAll(); // Purpur
|
||||
this.isRestarting = isRestarting;
|
||||
this.hasLoggedStop = true; // Paper
|
||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index fe029ec70afad56bb7a7361f347e9b9aef5e00ba..2c37694a6055513803708c9fb40fb0c475da8e52 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -355,6 +355,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.info("JMX monitoring enabled");
|
||||
}
|
||||
|
||||
+ net.pl3x.purpur.task.BossBarTask.startAll(); // Purpur
|
||||
+
|
||||
return true;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 1025696b877d8cffae2d34b6036a362612e9d706..c02609448326d76f30a1add7d50980230dfa2f06 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -256,6 +256,7 @@ public class ServerPlayer extends Player {
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
public boolean purpurClient = false; // Purpur
|
||||
public boolean acceptingResourcePack = false; // Purpur
|
||||
+ private boolean tpsBar = false; // Purpur
|
||||
|
||||
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
@@ -477,6 +478,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,6 +539,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
|
||||
|
||||
+ nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
|
||||
}
|
||||
|
||||
// CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
@@ -2567,5 +2570,13 @@ public class ServerPlayer extends Player {
|
||||
this.server.getPlayerList().moveToWorld(this, toLevel, true, to, !toLevel.paperConfig.disableTeleportationSuffocationCheck);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public boolean tpsBar() {
|
||||
+ return this.tpsBar;
|
||||
+ }
|
||||
+
|
||||
+ public void tpsBar(boolean tpsBar) {
|
||||
+ this.tpsBar = tpsBar;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 122b6f4fd8334483d32dbe353c273dbec14086aa..e4e7049e9e9739b5f5035319640eb04642adcb05 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -482,6 +482,7 @@ public abstract class PlayerList {
|
||||
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
|
||||
}
|
||||
// Paper end
|
||||
+ net.pl3x.purpur.task.BossBarTask.addToAll(player); // Purpur
|
||||
// CraftBukkit - Moved from above, added world
|
||||
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
|
||||
}
|
||||
@@ -592,6 +593,8 @@ public abstract class PlayerList {
|
||||
}
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
||||
// Paper end
|
||||
+ net.pl3x.purpur.task.BossBarTask.removeFromAll(entityplayer.getBukkitEntity()); // Purpur
|
||||
+
|
||||
ServerLevel worldserver = entityplayer.getLevel();
|
||||
|
||||
entityplayer.awardStat(Stats.LEAVE_GAME);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index defd23f85fb0e67511ee93f7f9c00cfceb71c484..039c5e6d98228837f7818803641656d566e416f5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -209,6 +209,29 @@ public class PurpurConfig {
|
||||
disableGiveCommandDrops = getBoolean("settings.disable-give-dropping", disableGiveCommandDrops);
|
||||
}
|
||||
|
||||
+ public static String commandTPSBarTitle = "<gray>TPS<yellow>:</yellow> <tps> MSPT<yellow>:</yellow> <mspt> Ping<yellow>:</yellow> <ping>ms";
|
||||
+ public static BossBar.Overlay commandTPSBarProgressOverlay = BossBar.Overlay.NOTCHED_20;
|
||||
+ public static TPSBarTask.FillMode commandTPSBarProgressFillMode = TPSBarTask.FillMode.MSPT;
|
||||
+ public static BossBar.Color commandTPSBarProgressColorGood = BossBar.Color.GREEN;
|
||||
+ public static BossBar.Color commandTPSBarProgressColorMedium = BossBar.Color.YELLOW;
|
||||
+ public static BossBar.Color commandTPSBarProgressColorLow = BossBar.Color.RED;
|
||||
+ public static String commandTPSBarTextColorGood = "<gradient:#55ff55:#00aa00><text></gradient>";
|
||||
+ public static String commandTPSBarTextColorMedium = "<gradient:#ffff55:#ffaa00><text></gradient>";
|
||||
+ public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
|
||||
+ public static int commandTPSBarTickInterval = 20;
|
||||
+ private static void commandSettings() {
|
||||
+ commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
|
||||
+ commandTPSBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.tpsbar.overlay", commandTPSBarProgressOverlay.name()));
|
||||
+ commandTPSBarProgressFillMode = TPSBarTask.FillMode.valueOf(getString("settings.command.tpsbar.fill-mode", commandTPSBarProgressFillMode.name()));
|
||||
+ commandTPSBarProgressColorGood = BossBar.Color.valueOf(getString("settings.command.tpsbar.progress-color.good", commandTPSBarProgressColorGood.name()));
|
||||
+ commandTPSBarProgressColorMedium = BossBar.Color.valueOf(getString("settings.command.tpsbar.progress-color.medium", commandTPSBarProgressColorMedium.name()));
|
||||
+ commandTPSBarProgressColorLow = BossBar.Color.valueOf(getString("settings.command.tpsbar.progress-color.low", commandTPSBarProgressColorLow.name()));
|
||||
+ commandTPSBarTextColorGood = getString("settings.command.tpsbar.text-color.good", commandTPSBarTextColorGood);
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
public static int barrelRows = 3;
|
||||
public static boolean enderChestSixRows = false;
|
||||
public static boolean enderChestPermissionRows = false;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/TPSBarCommand.java b/src/main/java/net/pl3x/purpur/command/TPSBarCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2eca7b78907007be9683d87bf2346c87816ec3f0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/TPSBarCommand.java
|
||||
@@ -0,0 +1,21 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.pl3x.purpur.task.TPSBarTask;
|
||||
+
|
||||
+public class TPSBarCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("tpsbar")
|
||||
+ .requires(listener -> listener.hasPermission(2))
|
||||
+ .executes(context -> {
|
||||
+ ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
+ boolean result = TPSBarTask.instance().togglePlayer(player.getBukkitEntity());
|
||||
+ player.tpsBar(result);
|
||||
+ return 1;
|
||||
+ })
|
||||
+ ).setPermission("bukkit.command.tpsbar");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/task/BossBarTask.java b/src/main/java/net/pl3x/purpur/task/BossBarTask.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..89122d7bcfd037a22d277e562f5300f2f3eab2db
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/task/BossBarTask.java
|
||||
@@ -0,0 +1,109 @@
|
||||
+package net.pl3x.purpur.task;
|
||||
+
|
||||
+import net.kyori.adventure.bossbar.BossBar;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.scheduler.BukkitRunnable;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.Map;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+public abstract class BossBarTask extends BukkitRunnable {
|
||||
+ private final Map<UUID, BossBar> bossbars = new HashMap<>();
|
||||
+ private boolean started;
|
||||
+
|
||||
+ abstract BossBar createBossBar();
|
||||
+
|
||||
+ abstract void updateBossBar(BossBar bossbar, Player player);
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ Iterator<Map.Entry<UUID, BossBar>> iter = bossbars.entrySet().iterator();
|
||||
+ while (iter.hasNext()) {
|
||||
+ Map.Entry<UUID, BossBar> entry = iter.next();
|
||||
+ Player player = Bukkit.getPlayer(entry.getKey());
|
||||
+ if (player == null) {
|
||||
+ iter.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ updateBossBar(entry.getValue(), player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void cancel() {
|
||||
+ super.cancel();
|
||||
+ new HashSet<>(this.bossbars.keySet()).forEach(uuid -> {
|
||||
+ Player player = Bukkit.getPlayer(uuid);
|
||||
+ if (player != null) {
|
||||
+ removePlayer(player);
|
||||
+ }
|
||||
+ });
|
||||
+ this.bossbars.clear();
|
||||
+ }
|
||||
+
|
||||
+ public boolean removePlayer(Player player) {
|
||||
+ BossBar bossbar = this.bossbars.remove(player.getUniqueId());
|
||||
+ if (bossbar != null) {
|
||||
+ player.hideBossBar(bossbar);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public void addPlayer(Player player) {
|
||||
+ removePlayer(player);
|
||||
+ BossBar bossbar = createBossBar();
|
||||
+ this.bossbars.put(player.getUniqueId(), bossbar);
|
||||
+ this.updateBossBar(bossbar, player);
|
||||
+ player.showBossBar(bossbar);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasPlayer(UUID uuid) {
|
||||
+ return this.bossbars.containsKey(uuid);
|
||||
+ }
|
||||
+
|
||||
+ public boolean togglePlayer(Player player) {
|
||||
+ if (removePlayer(player)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ addPlayer(player);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public void start() {
|
||||
+ stop();
|
||||
+ this.runTaskTimerAsynchronously(new MinecraftInternalPlugin(), 1, 1);
|
||||
+ started = true;
|
||||
+ }
|
||||
+
|
||||
+ public void stop() {
|
||||
+ if (started) {
|
||||
+ cancel();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void startAll() {
|
||||
+ TPSBarTask.instance().start();
|
||||
+ }
|
||||
+
|
||||
+ public static void stopAll() {
|
||||
+ TPSBarTask.instance().stop();
|
||||
+ }
|
||||
+
|
||||
+ public static void addToAll(ServerPlayer player) {
|
||||
+ Player bukkit = player.getBukkitEntity();
|
||||
+ if (player.tpsBar()) {
|
||||
+ TPSBarTask.instance().addPlayer(bukkit);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void removeFromAll(Player player) {
|
||||
+ TPSBarTask.instance().removePlayer(player);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/task/TPSBarTask.java b/src/main/java/net/pl3x/purpur/task/TPSBarTask.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cafb140ff57e5697d7c3705ff9be6411c0ad82d9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/task/TPSBarTask.java
|
||||
@@ -0,0 +1,142 @@
|
||||
+package net.pl3x.purpur.task;
|
||||
+
|
||||
+import net.kyori.adventure.bossbar.BossBar;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.Template;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+public class TPSBarTask extends BossBarTask {
|
||||
+ private static TPSBarTask instance;
|
||||
+ private double tps = 20.0D;
|
||||
+ private double mspt = 0.0D;
|
||||
+ private int tick = 0;
|
||||
+
|
||||
+ public static TPSBarTask instance() {
|
||||
+ if (instance == null) {
|
||||
+ instance = new TPSBarTask();
|
||||
+ }
|
||||
+ return instance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ BossBar createBossBar() {
|
||||
+ return BossBar.bossBar(Component.text(""), 0.0F, instance().getBossBarColor(), PurpurConfig.commandTPSBarProgressOverlay);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ void updateBossBar(BossBar bossbar, Player player) {
|
||||
+ bossbar.progress(getBossBarProgress());
|
||||
+ bossbar.color(getBossBarColor());
|
||||
+ bossbar.name(MiniMessage.get().parse(PurpurConfig.commandTPSBarTitle,
|
||||
+ Template.of("tps", getTPSColor()),
|
||||
+ Template.of("mspt", getMSPTColor()),
|
||||
+ Template.of("ping", getPingColor(player.getPing()))
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ if (++tick < PurpurConfig.commandTPSBarTickInterval) {
|
||||
+ return;
|
||||
+ }
|
||||
+ tick = 0;
|
||||
+
|
||||
+ this.tps = Math.max(Math.min(Bukkit.getTPS()[0], 20.0D), 0.0D);
|
||||
+ this.mspt = Bukkit.getAverageTickTime();
|
||||
+
|
||||
+ super.run();
|
||||
+ }
|
||||
+
|
||||
+ private float getBossBarProgress() {
|
||||
+ if (PurpurConfig.commandTPSBarProgressFillMode == FillMode.MSPT) {
|
||||
+ return Math.max(Math.min((float) mspt / 50.0F, 1.0F), 0.0F);
|
||||
+ } else {
|
||||
+ return Math.max(Math.min((float) tps / 20.0F, 1.0F), 0.0F);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private BossBar.Color getBossBarColor() {
|
||||
+ if (isGood(PurpurConfig.commandTPSBarProgressFillMode)) {
|
||||
+ return PurpurConfig.commandTPSBarProgressColorGood;
|
||||
+ } else if (isMedium(PurpurConfig.commandTPSBarProgressFillMode)) {
|
||||
+ return PurpurConfig.commandTPSBarProgressColorMedium;
|
||||
+ } else {
|
||||
+ return PurpurConfig.commandTPSBarProgressColorLow;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private boolean isGood(FillMode mode) {
|
||||
+ return isGood(mode, 0);
|
||||
+ }
|
||||
+
|
||||
+ private boolean isGood(FillMode mode, int ping) {
|
||||
+ if (mode == FillMode.MSPT) {
|
||||
+ return mspt < 40;
|
||||
+ } else if (mode == FillMode.TPS) {
|
||||
+ return tps >= 19;
|
||||
+ } else if (mode == FillMode.PING) {
|
||||
+ return ping < 100;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private boolean isMedium(FillMode mode) {
|
||||
+ return isMedium(mode, 0);
|
||||
+ }
|
||||
+
|
||||
+ private boolean isMedium(FillMode mode, int ping) {
|
||||
+ if (mode == FillMode.MSPT) {
|
||||
+ return mspt < 50;
|
||||
+ } else if (mode == FillMode.TPS) {
|
||||
+ return tps >= 15;
|
||||
+ } else if (mode == FillMode.PING) {
|
||||
+ return ping < 200;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private Component getTPSColor() {
|
||||
+ String color;
|
||||
+ if (isGood(FillMode.TPS)) {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorGood;
|
||||
+ } else if (isMedium(FillMode.TPS)) {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorMedium;
|
||||
+ } else {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorLow;
|
||||
+ }
|
||||
+ return MiniMessage.get().parse(color, Template.of("text", String.format("%.2f", tps)));
|
||||
+ }
|
||||
+
|
||||
+ private Component getMSPTColor() {
|
||||
+ String color;
|
||||
+ if (isGood(FillMode.MSPT)) {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorGood;
|
||||
+ } else if (isMedium(FillMode.MSPT)) {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorMedium;
|
||||
+ } else {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorLow;
|
||||
+ }
|
||||
+ return MiniMessage.get().parse(color, Template.of("text", String.format("%.2f", mspt)));
|
||||
+ }
|
||||
+
|
||||
+ private Component getPingColor(int ping) {
|
||||
+ String color;
|
||||
+ if (isGood(FillMode.PING, ping)) {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorGood;
|
||||
+ } else if (isMedium(FillMode.PING, ping)) {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorMedium;
|
||||
+ } else {
|
||||
+ color = PurpurConfig.commandTPSBarTextColorLow;
|
||||
+ }
|
||||
+ return MiniMessage.get().parse(color, Template.of("text", String.format("%s", ping)));
|
||||
+ }
|
||||
+
|
||||
+ public enum FillMode {
|
||||
+ TPS, MSPT, PING
|
||||
+ }
|
||||
+}
|
||||
49
patches/server/0133-Striders-give-saddle-back.patch
Normal file
49
patches/server/0133-Striders-give-saddle-back.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Sun, 13 Dec 2020 20:40:57 -0500
|
||||
Subject: [PATCH] Striders give saddle back
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
index 672801ab77a10917147f12b2117a3390885b39b0..b4f7d6f4b7e6f6d5fe9e472f1723430c3301378b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -451,6 +451,18 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||
|
||||
if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) {
|
||||
if (!this.level.isClientSide) {
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.striderGiveSaddleBack && player.isCrouching()) {
|
||||
+ this.steering.setSaddle(false);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ ItemStack saddle = new ItemStack(Items.SADDLE);
|
||||
+ if (!player.getInventory().add(saddle)) {
|
||||
+ player.drop(saddle, false);
|
||||
+ }
|
||||
+ }
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
player.startRiding(this);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index d887e7db69a7d57ebfe8bfe79d032e83ab70259a..cd850ceadc6fa6c9fd1747925ecedebf1c482067 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1555,6 +1555,7 @@ public class PurpurWorldConfig {
|
||||
public boolean striderRidableInWater = false;
|
||||
public double striderMaxHealth = 20.0D;
|
||||
public int striderBreedingTicks = 6000;
|
||||
+ public boolean striderGiveSaddleBack = false;
|
||||
private void striderSettings() {
|
||||
striderRidable = getBoolean("mobs.strider.ridable", striderRidable);
|
||||
striderRidableInWater = getBoolean("mobs.strider.ridable-in-water", striderRidableInWater);
|
||||
@@ -1565,6 +1566,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
striderMaxHealth = getDouble("mobs.strider.attributes.max_health", striderMaxHealth);
|
||||
striderBreedingTicks = getInt("mobs.strider.breeding-delay-ticks", striderBreedingTicks);
|
||||
+ striderGiveSaddleBack = getBoolean("mobs.strider.give-saddle-back", striderGiveSaddleBack);
|
||||
}
|
||||
|
||||
public boolean traderLlamaRidable = false;
|
||||
31
patches/server/0134-PlayerBookTooLargeEvent.patch
Normal file
31
patches/server/0134-PlayerBookTooLargeEvent.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Wed, 23 Dec 2020 00:43:59 -0600
|
||||
Subject: [PATCH] PlayerBookTooLargeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 3e5bb0075766c826995807b4b16cf12f3b06a755..def90885f40df7a7d3487dc7bca18de951875cba 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1107,10 +1107,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize;
|
||||
double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier));
|
||||
long byteAllowed = maxBookPageSize;
|
||||
+ ItemStack itemstack = this.player.getInventory().getItem(packet.getSlot()); // Purpur
|
||||
for (String testString : pageList) {
|
||||
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||
if (byteLength > 256 * 4) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
|
||||
+ net.pl3x.purpur.event.player.PlayerBookTooLargeEvent event = new net.pl3x.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), itemstack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
|
||||
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
@@ -1134,6 +1136,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
if (byteTotal > byteAllowed) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
|
||||
+ net.pl3x.purpur.event.player.PlayerBookTooLargeEvent event = new net.pl3x.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), itemstack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
|
||||
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 24 Dec 2020 11:00:15 -0600
|
||||
Subject: [PATCH] Full netherite armor grants fire resistance
|
||||
|
||||
|
||||
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 42becbb21eee4e1b0a14e2fc3e226f0de26c96b1..0a8c8a24af17262be3e656042dc5c8bce9364e8a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -357,6 +357,16 @@ public abstract class Player extends LivingEntity {
|
||||
this.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TURTLE_HELMET); // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (this.level.purpurConfig.playerNetheriteFireResistanceDuration > 0 && this.level.getGameTime() % 20 == 0) {
|
||||
+ if (itemstack.is(Items.NETHERITE_HELMET)
|
||||
+ && this.getItemBySlot(EquipmentSlot.CHEST).is(Items.NETHERITE_CHESTPLATE)
|
||||
+ && this.getItemBySlot(EquipmentSlot.LEGS).is(Items.NETHERITE_LEGGINGS)
|
||||
+ && this.getItemBySlot(EquipmentSlot.FEET).is(Items.NETHERITE_BOOTS)) {
|
||||
+ this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, this.level.purpurConfig.playerNetheriteFireResistanceDuration, this.level.purpurConfig.playerNetheriteFireResistanceAmplifier, this.level.purpurConfig.playerNetheriteFireResistanceAmbient, this.level.purpurConfig.playerNetheriteFireResistanceShowParticles, this.level.purpurConfig.playerNetheriteFireResistanceShowIcon), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.NETHERITE_ARMOR);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
protected ItemCooldowns createItemCooldowns() {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index cd850ceadc6fa6c9fd1747925ecedebf1c482067..6b5c8fd51c4fd991362c4f97e42e1370b146786c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -267,6 +267,19 @@ public class PurpurWorldConfig {
|
||||
villageSiegeSpawning = getBoolean("gameplay-mechanics.mob-spawning.village-sieges", predicate);
|
||||
}
|
||||
|
||||
+ public int playerNetheriteFireResistanceDuration = 0;
|
||||
+ public int playerNetheriteFireResistanceAmplifier = 0;
|
||||
+ public boolean playerNetheriteFireResistanceAmbient = false;
|
||||
+ public boolean playerNetheriteFireResistanceShowParticles = false;
|
||||
+ public boolean playerNetheriteFireResistanceShowIcon = true;
|
||||
+ private void playerNetheriteFireResistance() {
|
||||
+ playerNetheriteFireResistanceDuration = getInt("gameplay-mechanics.player.netherite-fire-resistance.duration", playerNetheriteFireResistanceDuration);
|
||||
+ playerNetheriteFireResistanceAmplifier = getInt("gameplay-mechanics.player.netherite-fire-resistance.amplifier", playerNetheriteFireResistanceAmplifier);
|
||||
+ playerNetheriteFireResistanceAmbient = getBoolean("gameplay-mechanics.player.netherite-fire-resistance.ambient", playerNetheriteFireResistanceAmbient);
|
||||
+ playerNetheriteFireResistanceShowParticles = getBoolean("gameplay-mechanics.player.netherite-fire-resistance.show-particles", playerNetheriteFireResistanceShowParticles);
|
||||
+ playerNetheriteFireResistanceShowIcon = getBoolean("gameplay-mechanics.player.netherite-fire-resistance.show-icon", playerNetheriteFireResistanceShowIcon);
|
||||
+ }
|
||||
+
|
||||
public boolean idleTimeoutKick = true;
|
||||
public boolean idleTimeoutTickNearbyEntities = true;
|
||||
public boolean idleTimeoutCountAsSleeping = false;
|
||||
36
patches/server/0136-Fix-rotating-UP-DOWN-CW-and-CCW.patch
Normal file
36
patches/server/0136-Fix-rotating-UP-DOWN-CW-and-CCW.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Wed, 6 Jan 2021 02:19:29 -0600
|
||||
Subject: [PATCH] Fix rotating UP/DOWN CW and CCW
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index 6d883db5c04cbcf454952c0f361029ecbfe4f037..8aeec2132138bf4b19a9042340c8784df4afda65 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -247,6 +247,12 @@ public enum Direction implements StringRepresentable {
|
||||
case EAST:
|
||||
var10000 = SOUTH;
|
||||
break;
|
||||
+ // Purpur start
|
||||
+ case UP:
|
||||
+ return UP;
|
||||
+ case DOWN:
|
||||
+ return DOWN;
|
||||
+ // Purpur end
|
||||
default:
|
||||
throw new IllegalStateException("Unable to get Y-rotated facing of " + this);
|
||||
}
|
||||
@@ -359,6 +365,12 @@ public enum Direction implements StringRepresentable {
|
||||
case EAST:
|
||||
var10000 = NORTH;
|
||||
break;
|
||||
+ // Purpur start
|
||||
+ case UP:
|
||||
+ return UP;
|
||||
+ case DOWN:
|
||||
+ return DOWN;
|
||||
+ // Purpur end
|
||||
default:
|
||||
throw new IllegalStateException("Unable to get CCW facing of " + this);
|
||||
}
|
||||
@@ -0,0 +1,696 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 5 Jan 2021 22:21:56 -0500
|
||||
Subject: [PATCH] Add mobGriefing bypass to everything affected
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 4904abec73580eee50c12a8edcb6e743805b018e..e0c5947610ab711024c0ef6346f2ca9a87701139 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1677,7 +1677,7 @@ public abstract class LivingEntity extends Entity {
|
||||
boolean flag = false;
|
||||
|
||||
if (this.dead && adversary instanceof WitherBoss) { // Paper
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (this.level.purpurConfig.witherBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
BlockPos blockposition = this.blockPosition();
|
||||
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 6a8347ceefd663066de5887fef8ebc82b30a1b93..95c765ce622da83cfdff655ca746468fce37a491 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -664,7 +664,7 @@ public abstract class Mob extends LivingEntity {
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
this.level.getProfiler().push("looting");
|
||||
- if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && (this.level.purpurConfig.entitiesPickUpLootBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) {
|
||||
List<ItemEntity> list = this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(1.0D, 0.0D, 1.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
index 7d4457da2fe82ebe91b99cf91ae5e70b491d34e7..f4c1b7ad19cb7c9c81ab9f277751024c21bcb573 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
@@ -41,7 +41,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
}
|
||||
|
||||
protected boolean checkExtraStartConditions(ServerLevel world, Villager entity) {
|
||||
- if (!world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!world.purpurConfig.villagerBypassMobGriefing && !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
return false;
|
||||
} else if (entity.getVillagerData().getProfession() != VillagerProfession.FARMER && !(world.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().getProfession() == VillagerProfession.CLERIC)) { // Purpur
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
index fe045f8e35fe2aac51032a67ce52b27a53a8eff0..56d2849276b322436544512521e3b4ea0c679bcc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
@@ -33,7 +33,7 @@ public class BreakDoorGoal extends DoorInteractGoal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- return !super.canUse() ? false : (!this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.isValidDifficulty(this.mob.level.getDifficulty()) && !this.isOpen());
|
||||
+ return !super.canUse() ? false : ((!this.mob.level.purpurConfig.zombieBypassMobGriefing && !this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) ? false : this.isValidDifficulty(this.mob.level.getDifficulty()) && !this.isOpen()); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
index 14ed3f0524773e22a792efb8b41a9217bad50f27..8a4080a77bd5b73ac812e3ae67c6f21dcd270215 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
@@ -70,7 +70,7 @@ public class EatBlockGoal extends Goal {
|
||||
|
||||
if (EatBlockGoal.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) {
|
||||
// CraftBukkit
|
||||
- if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !this.level.purpurConfig.sheepBypassMobGriefing && !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // Purpur
|
||||
this.level.destroyBlock(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class EatBlockGoal extends Goal {
|
||||
|
||||
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {
|
||||
// CraftBukkit
|
||||
- if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.purpurConfig.sheepBypassMobGriefing && !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // Purpur
|
||||
this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
|
||||
this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
index a618b50ac8448528ac6ac64b400fa3d0882dbaf9..7ca4e20ec53408573921bed07dd81849abd62227 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
@@ -40,7 +40,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- if (!this.removerMob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!this.removerMob.level.purpurConfig.zombieBypassMobGriefing && !this.removerMob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
return false;
|
||||
} else if (this.nextStartTick > 0) {
|
||||
--this.nextStartTick;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
index 856e348b45fcaf8fc1710cd7382eb6ac10424fb8..1daccbc51b6ec635130932995350eb0de8abe0a3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -1356,7 +1356,7 @@ public class Fox extends Animal {
|
||||
}
|
||||
|
||||
protected void onReachedTarget() {
|
||||
- if (Fox.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (Fox.this.level.purpurConfig.foxBypassMobGriefing || Fox.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
BlockState iblockdata = Fox.this.level.getBlockState(this.blockPos);
|
||||
|
||||
if (iblockdata.is(Blocks.SWEET_BERRY_BUSH)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
|
||||
index b4314eb2b69dd56176bb33972181fe75c03b90bd..d7fbe9322ae22274c37e8b36500d993eab5bf397 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -611,7 +611,7 @@ public class Rabbit extends Animal {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
if (this.nextStartTick <= 0) {
|
||||
- if (!this.rabbit.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!this.rabbit.level.purpurConfig.rabbitBypassMobGriefing && !this.rabbit.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
return false;
|
||||
}
|
||||
|
||||
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 093211be0d86cc114cbb109d7ba01f491d7954b1..af4db007807d94888fa945d9d43785b74bee2b67 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -128,7 +128,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
- if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!this.level.purpurConfig.snowGolemBypassMobGriefing && !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index e29fe6939d59a58093ddfbdf9b274469c5e25756..6ba83c938456dc79c8cd948ae981c6f2e93702ae 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -560,7 +560,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
|
||||
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is((Tag) BlockTags.DRAGON_IMMUNE)) {
|
||||
+ if ((this.level.purpurConfig.enderDragonBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && !iblockdata.is((Tag) BlockTags.DRAGON_IMMUNE)) { // Purpur
|
||||
// CraftBukkit start - Add blocks to list rather than destroying them
|
||||
// flag1 = this.level.removeBlock(blockposition, false) || flag1;
|
||||
flag1 = true;
|
||||
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 10883671cb28e579445f17c7ed729a0edb987bac..c935177150c8270329dbf7cc43da31c603555c52 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
|
||||
@@ -386,7 +386,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
- Explosion.BlockInteraction explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE;
|
||||
+ Explosion.BlockInteraction explosion_effect = (this.level.purpurConfig.witherBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; // Purpur
|
||||
// CraftBukkit start
|
||||
// this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
@@ -482,7 +482,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
|
||||
if (this.destroyBlocksTick > 0) {
|
||||
--this.destroyBlocksTick;
|
||||
- if (this.destroyBlocksTick == 0 && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (this.destroyBlocksTick == 0 && (this.level.purpurConfig.witherBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur
|
||||
i = Mth.floor(this.getY());
|
||||
j = Mth.floor(this.getX());
|
||||
int i1 = Mth.floor(this.getZ());
|
||||
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 f7b1d2cb0ba544aa4aec7d87d21335e9fcca6127..d06bba26db491950588d8b7ef356156663972e4f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -344,7 +344,7 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
|
||||
public void explodeCreeper() {
|
||||
if (!this.level.isClientSide) {
|
||||
- Explosion.BlockInteraction explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && level.purpurConfig.creeperAllowGriefing ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; // Purpur
|
||||
+ Explosion.BlockInteraction explosion_effect = (this.level.purpurConfig.creeperBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && level.purpurConfig.creeperAllowGriefing ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; // Purpur
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
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 28d2ccc6b29b17a99a2828d044259adafa10922c..be620f9f305aad756bb5b932764aaf24baebda55 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -501,7 +501,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
if (!enderman.level.purpurConfig.endermanAllowGriefing) return false; // Purpur
|
||||
- return this.enderman.getCarriedBlock() == null ? false : (!this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0);
|
||||
+ return this.enderman.getCarriedBlock() != null ? false : (!this.enderman.level.purpurConfig.endermanBypassMobGriefing && !this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -549,7 +549,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
if (!enderman.level.purpurConfig.endermanAllowGriefing) return false; // Purpur
|
||||
- return this.enderman.getCarriedBlock() != null ? false : (!this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0);
|
||||
+ return this.enderman.getCarriedBlock() == null ? false : (!this.enderman.level.purpurConfig.endermanBypassMobGriefing && !this.enderman.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Evoker.java b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
index f879bfa65b266728b570725e1ff9403f1732244d..e55cc17687247de4817939cd2d73ef667d946ca3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
@@ -317,7 +317,7 @@ public class Evoker extends SpellcasterIllager {
|
||||
return false;
|
||||
} else if (Evoker.this.tickCount < this.nextAttackTickCount) {
|
||||
return false;
|
||||
- } else if (!Evoker.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ } else if (!Evoker.this.level.purpurConfig.evokerBypassMobGriefing && !Evoker.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
return false;
|
||||
} else {
|
||||
List<Sheep> list = Evoker.this.level.getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0D, 4.0D, 16.0D));
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
||||
index c1eea7e71aa364789a544e6491b2201bcb6a37c8..5eb9e19531c5c996dd669f6e430b0dfb3d94928a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
||||
@@ -185,7 +185,7 @@ public class Ravager extends Raider {
|
||||
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1D, d1, d0));
|
||||
}
|
||||
|
||||
- if (this.horizontalCollision && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (this.horizontalCollision && (this.level.purpurConfig.ravagerBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur
|
||||
boolean flag = false;
|
||||
AABB axisalignedbb = this.getBoundingBox().inflate(0.2D);
|
||||
Iterator iterator = BlockPos.betweenClosed(Mth.floor(axisalignedbb.minX), Mth.floor(axisalignedbb.minY), Mth.floor(axisalignedbb.minZ), Mth.floor(axisalignedbb.maxX), Mth.floor(axisalignedbb.maxY), Mth.floor(axisalignedbb.maxZ)).iterator();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
||||
index 3481a2e178e5c101b6038e6506933d50861c3f9d..d215d8eff468c8bab9db160ea2b3fa1e6749d1a3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
||||
@@ -197,7 +197,7 @@ public class Silverfish extends Monster {
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (world.purpurConfig.silverfishBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur
|
||||
world.destroyBlock(blockposition1, true, this.silverfish);
|
||||
} else {
|
||||
world.setBlock(blockposition1, ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)), 3);
|
||||
@@ -235,7 +235,7 @@ public class Silverfish extends Monster {
|
||||
} else {
|
||||
Random random = this.mob.getRandom();
|
||||
|
||||
- if (this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) {
|
||||
+ if ((this.mob.level.purpurConfig.silverfishBypassMobGriefing || this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && random.nextInt(reducedTickDelay(10)) == 0) { // Purpur
|
||||
this.selectedDirection = Direction.getRandom(random);
|
||||
BlockPos blockposition = (new BlockPos(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ())).relative(this.selectedDirection);
|
||||
BlockState iblockdata = this.mob.level.getBlockState(blockposition);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
index 86a9800276648c094c688d6dbedd51657e642df5..6beb798df62223fe653afa0f34e4a43d6cff11b7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
@@ -406,7 +406,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
||||
|
||||
@Override
|
||||
public boolean wantsToPickUp(ItemStack stack) {
|
||||
- return this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack);
|
||||
+ return (this.level.purpurConfig.piglinBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack);
|
||||
}
|
||||
|
||||
protected boolean canReplaceCurrentItem(ItemStack stack) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java b/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
index e69213b43c8aa5a7c04add7a87482d531fbf52d2..f51ea103238b4a50439f5162a248cd9aa7f1a19b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
@@ -18,20 +18,20 @@ public class LargeFireball extends Fireball {
|
||||
|
||||
public LargeFireball(EntityType<? extends LargeFireball> type, Level world) {
|
||||
super(type, world);
|
||||
- isIncendiary = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
+ isIncendiary = this.level.purpurConfig.fireballsBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit // Purpur
|
||||
}
|
||||
|
||||
public LargeFireball(Level world, LivingEntity owner, double velocityX, double velocityY, double velocityZ, int explosionPower) {
|
||||
super(EntityType.FIREBALL, owner, velocityX, velocityY, velocityZ, world);
|
||||
this.explosionPower = explosionPower;
|
||||
- isIncendiary = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
+ isIncendiary = this.level.purpurConfig.fireballsBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level.isClientSide) {
|
||||
- boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ boolean flag = this.level.purpurConfig.fireballsBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur
|
||||
|
||||
// CraftBukkit start - fire ExplosionPrimeEvent
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index edc4fc597d60e6125d44023085e993db2e96c4ef..2771e600d46195e8170b2bde57c523c2bcbadf5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -290,6 +290,6 @@ public abstract class Projectile extends Entity {
|
||||
public boolean mayInteract(Level world, BlockPos pos) {
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
- return entity instanceof Player ? entity.mayInteract(world, pos) : entity == null || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ return entity instanceof Player ? entity.mayInteract(world, pos) : entity == null || world.purpurConfig.projectilesBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
index 226b33921c90ca3904a7397a68dc8169948f8faa..e2a652277f2a63e0f0501db4137d7813e2d603c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
@@ -24,7 +24,7 @@ public class SmallFireball extends Fireball {
|
||||
super(EntityType.SMALL_FIREBALL, owner, velocityX, velocityY, velocityZ, world);
|
||||
// CraftBukkit start
|
||||
if (this.getOwner() != null && this.getOwner() instanceof Mob) {
|
||||
- isIncendiary = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ isIncendiary = this.level.purpurConfig.fireballsBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
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 8613008090a9d7cf5cd7c2a598f2c725b5b0cdc6..a66e9826b8283366cec5adb54f79efee47d9df22 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
@@ -93,7 +93,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level.isClientSide) {
|
||||
- Explosion.BlockInteraction explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE;
|
||||
+ Explosion.BlockInteraction explosion_effect = (this.level.purpurConfig.witherBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; // Purpur
|
||||
|
||||
// CraftBukkit start
|
||||
// this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
index 039544609aa4fd2f5ab5075792a2e51ef315dc37..eeeef593d0dc075ded76d7d30b76fcfc8ffcb294 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -313,7 +313,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- if (!this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
||||
+ if ((!this.mob.level.purpurConfig.pillagerBypassMobGriefing && !this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur
|
||||
Raid raid = this.mob.getCurrentRaid();
|
||||
|
||||
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
index b4fd9af8805f451c87a91f319c15fa132b91faf7..e9087a46e401bc99b73c2cf2731fdac3e68719f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -164,7 +164,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
@Override
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
|
||||
- if (entity instanceof Ravager && !CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // CraftBukkit
|
||||
+ if (entity instanceof Ravager && !CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), (!world.purpurConfig.ravagerBypassMobGriefing && !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))).isCancelled()) { // CraftBukkit // Purpur
|
||||
world.destroyBlock(pos, true, entity);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index 56233465693943e0fdb998e44a34f8029e3928cb..caf40e3df0896492be959f9e0bcfb1fad0bfa2ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -99,7 +99,7 @@ public class FarmBlock extends Block {
|
||||
@Override
|
||||
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
|
||||
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
- if (!world.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
|
||||
+ if (!world.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.purpurConfig.farmlandBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof Player) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
index 5e22a1cd1a0902d63f091bbfb8ae518b12c66f09..8fad9dfd25794c4f202e2104e4ae32b0c436f438 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
@@ -72,7 +72,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
|
||||
if (!world.isClientSide) {
|
||||
// CraftBukkit start
|
||||
if (entity.isOnFire() && entity.mayInteract(world, pos)) {
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !(world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !((world.purpurConfig.powderSnowBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) || entity instanceof Player)).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
index b942e7c85e6c8f9a7664d9e5bf93bcd79e0651f1..5b29f3fced5435e172dd69f6f4eb265e760b6454 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
@@ -205,7 +205,7 @@ public class TurtleEggBlock extends Block {
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof LivingEntity && !(entity instanceof Player)) {
|
||||
- return world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ return world.purpurConfig.turtleEggsBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
}
|
||||
return true;
|
||||
// Purpur end
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 6b5c8fd51c4fd991362c4f97e42e1370b146786c..f38b05448019805fd07f462e910c805cdffed219 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -381,8 +381,11 @@ public class PurpurWorldConfig {
|
||||
public boolean boatsDoFallDamage = true;
|
||||
public boolean disableDropsOnCrammingDeath = false;
|
||||
public boolean entitiesCanUsePortals = true;
|
||||
+ public boolean entitiesPickUpLootBypassMobGriefing = false;
|
||||
+ public boolean fireballsBypassMobGriefing = false;
|
||||
public boolean milkCuresBadOmen = true;
|
||||
public boolean persistentDroppableEntityDisplayNames = false;
|
||||
+ public boolean projectilesBypassMobGriefing = false;
|
||||
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
||||
public double voidDamageHeight = -64.0D;
|
||||
public double voidDamageDealt = 4.0D;
|
||||
@@ -394,8 +397,11 @@ public class PurpurWorldConfig {
|
||||
boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage);
|
||||
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
|
||||
entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals);
|
||||
+ entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
|
||||
+ fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
|
||||
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
||||
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
|
||||
+ projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
||||
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);
|
||||
@@ -443,9 +449,11 @@ public class PurpurWorldConfig {
|
||||
dispenserPlaceAnvils = getBoolean("blocks.dispenser.place-anvils", dispenserPlaceAnvils);
|
||||
}
|
||||
|
||||
+ public boolean farmlandBypassMobGriefing = false;
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
public boolean farmlandAlpha = false;
|
||||
private void farmlandSettings() {
|
||||
+ farmlandBypassMobGriefing = getBoolean("blocks.farmland.bypass-mob-griefing", farmlandBypassMobGriefing);
|
||||
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
farmlandAlpha = getBoolean("blocks.farmland.use-alpha-farmland", farmlandAlpha);
|
||||
}
|
||||
@@ -484,6 +492,11 @@ public class PurpurWorldConfig {
|
||||
kelpMaxGrowthAge = getInt("blocks.kelp.max-growth-age", kelpMaxGrowthAge);
|
||||
}
|
||||
|
||||
+ public boolean powderSnowBypassMobGriefing = false;
|
||||
+ private void powderSnowSettings() {
|
||||
+ powderSnowBypassMobGriefing = getBoolean("blocks.powder_snow.bypass-mob-griefing", powderSnowBypassMobGriefing);
|
||||
+ }
|
||||
+
|
||||
public boolean respawnAnchorExplode = true;
|
||||
public double respawnAnchorExplosionPower = 5.0D;
|
||||
public boolean respawnAnchorExplosionFire = true;
|
||||
@@ -517,6 +530,11 @@ public class PurpurWorldConfig {
|
||||
stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage);
|
||||
}
|
||||
|
||||
+ public boolean turtleEggsBypassMobGriefing = false;
|
||||
+ private void turtleSettings() {
|
||||
+ turtleEggsBypassMobGriefing = getBoolean("blocks.turtle_egg.bypass-mob-griefing", turtleEggsBypassMobGriefing);
|
||||
+ }
|
||||
+
|
||||
public double twistingVinesGrowthModifier = 0.10D;
|
||||
public int twistingVinesMaxGrowthAge = 25;
|
||||
private void twistingVinesSettings() {
|
||||
@@ -701,6 +719,7 @@ public class PurpurWorldConfig {
|
||||
public double creeperMaxHealth = 20.0D;
|
||||
public double creeperChargedChance = 0.0D;
|
||||
public boolean creeperAllowGriefing = true;
|
||||
+ public boolean creeperBypassMobGriefing = false;
|
||||
private void creeperSettings() {
|
||||
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
|
||||
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
|
||||
@@ -712,6 +731,7 @@ public class PurpurWorldConfig {
|
||||
creeperMaxHealth = getDouble("mobs.creeper.attributes.max_health", creeperMaxHealth);
|
||||
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
|
||||
creeperAllowGriefing = getBoolean("mobs.creeper.allow-griefing", creeperAllowGriefing);
|
||||
+ creeperBypassMobGriefing = getBoolean("mobs.creeper.bypass-mob-griefing", creeperBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean dolphinRidable = false;
|
||||
@@ -799,6 +819,7 @@ public class PurpurWorldConfig {
|
||||
public double enderDragonMaxY = 256D;
|
||||
public double enderDragonMaxHealth = 200.0D;
|
||||
public boolean enderDragonAlwaysDropsFullExp = false;
|
||||
+ public boolean enderDragonBypassMobGriefing = false;
|
||||
private void enderDragonSettings() {
|
||||
enderDragonRidable = getBoolean("mobs.ender_dragon.ridable", enderDragonRidable);
|
||||
enderDragonRidableInWater = getBoolean("mobs.ender_dragon.ridable-in-water", enderDragonRidableInWater);
|
||||
@@ -814,6 +835,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
enderDragonMaxHealth = getDouble("mobs.ender_dragon.attributes.max_health", enderDragonMaxHealth);
|
||||
enderDragonAlwaysDropsFullExp = getBoolean("mobs.ender_dragon.always-drop-full-exp", enderDragonAlwaysDropsFullExp);
|
||||
+ enderDragonBypassMobGriefing = getBoolean("mobs.ender_dragon.bypass-mob-griefing", enderDragonBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean endermanRidable = false;
|
||||
@@ -821,6 +843,7 @@ public class PurpurWorldConfig {
|
||||
public double endermanMaxHealth = 40.0D;
|
||||
public boolean endermanAllowGriefing = true;
|
||||
public boolean endermanDespawnEvenWithBlock = false;
|
||||
+ public boolean endermanBypassMobGriefing = false;
|
||||
private void endermanSettings() {
|
||||
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
|
||||
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
|
||||
@@ -832,6 +855,7 @@ public class PurpurWorldConfig {
|
||||
endermanMaxHealth = getDouble("mobs.enderman.attributes.max_health", endermanMaxHealth);
|
||||
endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
|
||||
endermanDespawnEvenWithBlock = getBoolean("mobs.enderman.can-despawn-with-held-block", endermanDespawnEvenWithBlock);
|
||||
+ endermanBypassMobGriefing = getBoolean("mobs.enderman.bypass-mob-griefing", endermanBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean endermiteRidable = false;
|
||||
@@ -851,6 +875,7 @@ public class PurpurWorldConfig {
|
||||
public boolean evokerRidable = false;
|
||||
public boolean evokerRidableInWater = false;
|
||||
public double evokerMaxHealth = 24.0D;
|
||||
+ public boolean evokerBypassMobGriefing = false;
|
||||
private void evokerSettings() {
|
||||
evokerRidable = getBoolean("mobs.evoker.ridable", evokerRidable);
|
||||
evokerRidableInWater = getBoolean("mobs.evoker.ridable-in-water", evokerRidableInWater);
|
||||
@@ -860,6 +885,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.evoker.attributes.max_health", oldValue);
|
||||
}
|
||||
evokerMaxHealth = getDouble("mobs.evoker.attributes.max_health", evokerMaxHealth);
|
||||
+ evokerBypassMobGriefing = getBoolean("mobs.evoker.bypass-mob-griefing", evokerBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean foxRidable = false;
|
||||
@@ -867,6 +893,7 @@ public class PurpurWorldConfig {
|
||||
public double foxMaxHealth = 10.0D;
|
||||
public boolean foxTypeChangesWithTulips = false;
|
||||
public int foxBreedingTicks = 6000;
|
||||
+ public boolean foxBypassMobGriefing = false;
|
||||
private void foxSettings() {
|
||||
foxRidable = getBoolean("mobs.fox.ridable", foxRidable);
|
||||
foxRidableInWater = getBoolean("mobs.fox.ridable-in-water", foxRidableInWater);
|
||||
@@ -878,6 +905,7 @@ public class PurpurWorldConfig {
|
||||
foxMaxHealth = getDouble("mobs.fox.attributes.max_health", foxMaxHealth);
|
||||
foxTypeChangesWithTulips = getBoolean("mobs.fox.tulips-change-type", foxTypeChangesWithTulips);
|
||||
foxBreedingTicks = getInt("mobs.fox.breeding-delay-ticks", foxBreedingTicks);
|
||||
+ foxBypassMobGriefing = getBoolean("mobs.fox.bypass-mob-griefing", foxBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean ghastRidable = false;
|
||||
@@ -1273,6 +1301,7 @@ public class PurpurWorldConfig {
|
||||
public boolean piglinRidable = false;
|
||||
public boolean piglinRidableInWater = false;
|
||||
public double piglinMaxHealth = 16.0D;
|
||||
+ public boolean piglinBypassMobGriefing = false;
|
||||
private void piglinSettings() {
|
||||
piglinRidable = getBoolean("mobs.piglin.ridable", piglinRidable);
|
||||
piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater);
|
||||
@@ -1282,6 +1311,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.piglin.attributes.max_health", oldValue);
|
||||
}
|
||||
piglinMaxHealth = getDouble("mobs.piglin.attributes.max_health", piglinMaxHealth);
|
||||
+ piglinBypassMobGriefing = getBoolean("mobs.piglin.bypass-mob-griefing", piglinBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean piglinBruteRidable = false;
|
||||
@@ -1301,6 +1331,7 @@ public class PurpurWorldConfig {
|
||||
public boolean pillagerRidable = false;
|
||||
public boolean pillagerRidableInWater = false;
|
||||
public double pillagerMaxHealth = 24.0D;
|
||||
+ public boolean pillagerBypassMobGriefing = false;
|
||||
private void pillagerSettings() {
|
||||
pillagerRidable = getBoolean("mobs.pillager.ridable", pillagerRidable);
|
||||
pillagerRidableInWater = getBoolean("mobs.pillager.ridable-in-water", pillagerRidableInWater);
|
||||
@@ -1310,6 +1341,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.pillager.attributes.max_health", oldValue);
|
||||
}
|
||||
pillagerMaxHealth = getDouble("mobs.pillager.attributes.max_health", pillagerMaxHealth);
|
||||
+ pillagerBypassMobGriefing = getBoolean("mobs.pillager.bypass-mob-griefing", pillagerBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean polarBearRidable = false;
|
||||
@@ -1351,6 +1383,7 @@ public class PurpurWorldConfig {
|
||||
public double rabbitNaturalToast = 0.0D;
|
||||
public double rabbitNaturalKiller = 0.0D;
|
||||
public int rabbitBreedingTicks = 6000;
|
||||
+ public boolean rabbitBypassMobGriefing = false;
|
||||
private void rabbitSettings() {
|
||||
rabbitRidable = getBoolean("mobs.rabbit.ridable", rabbitRidable);
|
||||
rabbitRidableInWater = getBoolean("mobs.rabbit.ridable-in-water", rabbitRidableInWater);
|
||||
@@ -1363,11 +1396,13 @@ public class PurpurWorldConfig {
|
||||
rabbitNaturalToast = getDouble("mobs.rabbit.spawn-toast-chance", rabbitNaturalToast);
|
||||
rabbitNaturalKiller = getDouble("mobs.rabbit.spawn-killer-rabbit-chance", rabbitNaturalKiller);
|
||||
rabbitBreedingTicks = getInt("mobs.rabbit.breeding-delay-ticks", rabbitBreedingTicks);
|
||||
+ rabbitBypassMobGriefing = getBoolean("mobs.rabbit.bypass-mob-griefing", rabbitBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean ravagerRidable = false;
|
||||
public boolean ravagerRidableInWater = false;
|
||||
public double ravagerMaxHealth = 100.0D;
|
||||
+ public boolean ravagerBypassMobGriefing = false;
|
||||
private void ravagerSettings() {
|
||||
ravagerRidable = getBoolean("mobs.ravager.ridable", ravagerRidable);
|
||||
ravagerRidableInWater = getBoolean("mobs.ravager.ridable-in-water", ravagerRidableInWater);
|
||||
@@ -1377,6 +1412,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.ravager.attributes.max_health", oldValue);
|
||||
}
|
||||
ravagerMaxHealth = getDouble("mobs.ravager.attributes.max_health", ravagerMaxHealth);
|
||||
+ ravagerBypassMobGriefing = getBoolean("mobs.ravager.bypass-mob-griefing", ravagerBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean salmonRidable = false;
|
||||
@@ -1395,6 +1431,7 @@ public class PurpurWorldConfig {
|
||||
public boolean sheepRidableInWater = false;
|
||||
public double sheepMaxHealth = 8.0D;
|
||||
public int sheepBreedingTicks = 6000;
|
||||
+ public boolean sheepBypassMobGriefing = false;
|
||||
private void sheepSettings() {
|
||||
sheepRidable = getBoolean("mobs.sheep.ridable", sheepRidable);
|
||||
sheepRidableInWater = getBoolean("mobs.sheep.ridable-in-water", sheepRidableInWater);
|
||||
@@ -1405,6 +1442,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
sheepMaxHealth = getDouble("mobs.sheep.attributes.max_health", sheepMaxHealth);
|
||||
sheepBreedingTicks = getInt("mobs.sheep.breeding-delay-ticks", sheepBreedingTicks);
|
||||
+ sheepBypassMobGriefing = getBoolean("mobs.sheep.bypass-mob-griefing", sheepBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean shulkerRidable = false;
|
||||
@@ -1424,6 +1462,7 @@ public class PurpurWorldConfig {
|
||||
public boolean silverfishRidable = false;
|
||||
public boolean silverfishRidableInWater = false;
|
||||
public double silverfishMaxHealth = 8.0D;
|
||||
+ public boolean silverfishBypassMobGriefing = false;
|
||||
private void silverfishSettings() {
|
||||
silverfishRidable = getBoolean("mobs.silverfish.ridable", silverfishRidable);
|
||||
silverfishRidableInWater = getBoolean("mobs.silverfish.ridable-in-water", silverfishRidableInWater);
|
||||
@@ -1433,6 +1472,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.silverfish.attributes.max_health", oldValue);
|
||||
}
|
||||
silverfishMaxHealth = getDouble("mobs.silverfish.attributes.max_health", silverfishMaxHealth);
|
||||
+ silverfishBypassMobGriefing = getBoolean("mobs.silverfish.bypass-mob-griefing", silverfishBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean skeletonRidable = false;
|
||||
@@ -1500,6 +1540,7 @@ public class PurpurWorldConfig {
|
||||
public int snowGolemSnowBallMax = 20;
|
||||
public float snowGolemSnowBallModifier = 10.0F;
|
||||
public double snowGolemAttackDistance = 1.25D;
|
||||
+ public boolean snowGolemBypassMobGriefing = false;
|
||||
private void snowGolemSettings() {
|
||||
snowGolemRidable = getBoolean("mobs.snow_golem.ridable", snowGolemRidable);
|
||||
snowGolemRidableInWater = getBoolean("mobs.snow_golem.ridable-in-water", snowGolemRidableInWater);
|
||||
@@ -1516,6 +1557,7 @@ public class PurpurWorldConfig {
|
||||
snowGolemSnowBallMax = getInt("mobs.snow_golem.max-shoot-interval-ticks", snowGolemSnowBallMax);
|
||||
snowGolemSnowBallModifier = (float) getDouble("mobs.snow_golem.snow-ball-modifier", snowGolemSnowBallModifier);
|
||||
snowGolemAttackDistance = getDouble("mobs.snow_golem.attack-distance", snowGolemAttackDistance);
|
||||
+ snowGolemBypassMobGriefing = getBoolean("mobs.snow_golem.bypass-mob-griefing", snowGolemBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean squidRidable = false;
|
||||
@@ -1675,6 +1717,7 @@ public class PurpurWorldConfig {
|
||||
public int villagerLobotomizeCheck = 60;
|
||||
public boolean villagerClericsFarmWarts = false;
|
||||
public boolean villagerClericFarmersThrowWarts = true;
|
||||
+ public boolean villagerBypassMobGriefing = false;
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
@@ -1701,6 +1744,7 @@ public class PurpurWorldConfig {
|
||||
villagerLobotomizeCheck = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheck);
|
||||
villagerClericsFarmWarts = getBoolean("mobs.villager.clerics-farm-warts", villagerClericsFarmWarts);
|
||||
villagerClericFarmersThrowWarts = getBoolean("mobs.villager.cleric-wart-farmers-throw-warts-at-villagers", villagerClericFarmersThrowWarts);
|
||||
+ villagerBypassMobGriefing = getBoolean("mobs.villager.bypass-mob-griefing", villagerBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean vindicatorRidable = false;
|
||||
@@ -1757,6 +1801,7 @@ public class PurpurWorldConfig {
|
||||
public double witherMaxHealth = 300.0D;
|
||||
public float witherHealthRegenAmount = 1.0f;
|
||||
public int witherHealthRegenDelay = 20;
|
||||
+ public boolean witherBypassMobGriefing = false;
|
||||
private void witherSettings() {
|
||||
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
|
||||
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
|
||||
@@ -1773,6 +1818,7 @@ public class PurpurWorldConfig {
|
||||
witherMaxHealth = getDouble("mobs.wither.attributes.max_health", witherMaxHealth);
|
||||
witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount);
|
||||
witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
|
||||
+ witherBypassMobGriefing = getBoolean("mobs.wither.bypass-mob-griefing", witherBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean witherSkeletonRidable = false;
|
||||
@@ -1837,6 +1883,7 @@ public class PurpurWorldConfig {
|
||||
public double zombieJockeyChance = 0.05D;
|
||||
public boolean zombieJockeyTryExistingChickens = true;
|
||||
public boolean zombieAggressiveTowardsVillagerWhenLagging = true;
|
||||
+ public boolean zombieBypassMobGriefing = false;
|
||||
private void zombieSettings() {
|
||||
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
|
||||
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
|
||||
@@ -1851,6 +1898,7 @@ public class PurpurWorldConfig {
|
||||
zombieJockeyChance = getDouble("mobs.zombie.jockey.chance", zombieJockeyChance);
|
||||
zombieJockeyTryExistingChickens = getBoolean("mobs.zombie.jockey.try-existing-chickens", zombieJockeyTryExistingChickens);
|
||||
zombieAggressiveTowardsVillagerWhenLagging = getBoolean("mobs.zombie.aggressive-towards-villager-when-lagging", zombieAggressiveTowardsVillagerWhenLagging);
|
||||
+ zombieBypassMobGriefing = getBoolean("mobs.zombie.bypass-mob-griefing", zombieBypassMobGriefing);
|
||||
}
|
||||
|
||||
public boolean zombieHorseRidableInWater = false;
|
||||
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Fri, 8 Jan 2021 16:07:32 -0500
|
||||
Subject: [PATCH] Config to allow Note Block sounds when blocked
|
||||
|
||||
Allows for Note Blocks to ignore whether or not there's air above them to play.
|
||||
|
||||
Normally, the sounds will only play when the block directly above is air.
|
||||
With this patch enabled, players can place any block above the Note Block and it will still work.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
index 0512b3701a3bf33891ab6281355c07af6be5b9c1..d79cf8df4be544c4402a2419cd9238bde6620fbb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
@@ -61,7 +61,7 @@ public class NoteBlock extends Block {
|
||||
}
|
||||
|
||||
private void playNote(Level world, BlockPos blockposition, BlockState data) { // CraftBukkit
|
||||
- if (world.getBlockState(blockposition.above()).isAir()) {
|
||||
+ if (world.purpurConfig.noteBlockIgnoreAbove || world.getBlockState(blockposition.above()).isAir()) { // Purpur
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(NoteBlock.INSTRUMENT), data.getValue(NoteBlock.NOTE));
|
||||
if (!event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index f38b05448019805fd07f462e910c805cdffed219..4b885756730850fd7b5db52f74eb2e3d0be749f6 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -384,6 +384,7 @@ public class PurpurWorldConfig {
|
||||
public boolean entitiesPickUpLootBypassMobGriefing = false;
|
||||
public boolean fireballsBypassMobGriefing = false;
|
||||
public boolean milkCuresBadOmen = true;
|
||||
+ public boolean noteBlockIgnoreAbove = false;
|
||||
public boolean persistentDroppableEntityDisplayNames = false;
|
||||
public boolean projectilesBypassMobGriefing = false;
|
||||
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
||||
@@ -400,6 +401,7 @@ public class PurpurWorldConfig {
|
||||
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
|
||||
fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
|
||||
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
||||
+ noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
|
||||
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
|
||||
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
||||
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
||||
129
patches/server/0139-Add-EntityTeleportHinderedEvent.patch
Normal file
129
patches/server/0139-Add-EntityTeleportHinderedEvent.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 9 Jan 2021 15:27:46 +0100
|
||||
Subject: [PATCH] Add EntityTeleportHinderedEvent
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
index 19892cb3cb290add4f094dc87bb22106e4f07a24..46fdaf744080ac01498ca693068616659a79b9ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
@@ -45,7 +45,15 @@ public class EndPortalBlock extends BaseEntityBlock {
|
||||
@Override
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
|
||||
- if (world instanceof ServerLevel && !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
|
||||
+ // Purpur start
|
||||
+ if (world instanceof ServerLevel && /*!entity.isPassenger() && !entity.isVehicle() &&*/ entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
|
||||
+ if (entity.isPassenger() || entity.isVehicle()) {
|
||||
+ if (new net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, PlayerTeleportEvent.TeleportCause.END_PORTAL).callEvent()) {
|
||||
+ this.entityInside(state, world, pos, entity);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey);
|
||||
|
||||
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 82c132bc90381aab6a29d50319ff40e7383eb7f2..b99a9f76d6e400a053c57a96c9586fe09a4a5a26 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -86,7 +86,15 @@ public class NetherPortalBlock extends Block {
|
||||
@Override
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
|
||||
- if (!entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions()) {
|
||||
+ // Purpur start
|
||||
+ if (/*!entity.isPassenger() && !entity.isVehicle() &&*/ entity.canChangeDimensions()) {
|
||||
+ if (entity.isPassenger() || entity.isVehicle()) {
|
||||
+ if (new net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.NETHER_PORTAL).callEvent()) {
|
||||
+ this.entityInside(state, world, pos, entity);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
// CraftBukkit start - Entity in portal
|
||||
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||
world.getCraftServer().getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
index 500a4013ce525c0474fe3991457d4c2a50ceb7ed..e0beee6bd772792fbd3bc6a856230311e9ed6c42 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
@@ -177,6 +177,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
public static void teleportEntity(Level world, BlockPos pos, BlockState state, Entity entity, TheEndGatewayBlockEntity blockEntity) {
|
||||
if (world instanceof ServerLevel && !blockEntity.isCoolingDown()) {
|
||||
if (!entity.canChangeDimensions()) return; // Purpur
|
||||
+ // Purpur start
|
||||
+ if (world.purpurConfig.imposeTeleportRestrictionsOnGateways && (entity.isVehicle() || entity.isPassenger())) {
|
||||
+ if (new net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, PlayerTeleportEvent.TeleportCause.END_GATEWAY).callEvent()) {
|
||||
+ teleportEntity(world, pos, state, entity, blockEntity);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
|
||||
blockEntity.teleportCooldown = 100;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 4b885756730850fd7b5db52f74eb2e3d0be749f6..079cf41c91cd75c0f720af1e208e0c8ec40a1691 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -383,6 +383,7 @@ public class PurpurWorldConfig {
|
||||
public boolean entitiesCanUsePortals = true;
|
||||
public boolean entitiesPickUpLootBypassMobGriefing = false;
|
||||
public boolean fireballsBypassMobGriefing = false;
|
||||
+ public boolean imposeTeleportRestrictionsOnGateways = false;
|
||||
public boolean milkCuresBadOmen = true;
|
||||
public boolean noteBlockIgnoreAbove = false;
|
||||
public boolean persistentDroppableEntityDisplayNames = false;
|
||||
@@ -400,6 +401,7 @@ public class PurpurWorldConfig {
|
||||
entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals);
|
||||
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
|
||||
fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
|
||||
+ imposeTeleportRestrictionsOnGateways = getBoolean("gameplay-mechanics.impose-teleport-restrictions-on-gateways", imposeTeleportRestrictionsOnGateways);
|
||||
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
||||
noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
|
||||
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 1ba59900ddf403453aeb4f82b097feaab3dae3ff..30302c1cfdff65a5f1d0adde4c831f0a74f15851 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -562,6 +562,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
location.checkFinite();
|
||||
|
||||
if (this.entity.isVehicle() || this.entity.isRemoved()) {
|
||||
+ // Purpur start
|
||||
+ if (!entity.isRemoved() && new net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, cause).callEvent())
|
||||
+ return teleport(location, cause);
|
||||
+ // Purpur end
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 2fc276e0fc43d21ce9dd590991b564c65f6b249b..b3e1e8d225282216df0fb88335415cdf9ffa781d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -965,6 +965,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
if (entity.isVehicle()) {
|
||||
+ // Purpur start
|
||||
+ if (new net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), net.pl3x.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, cause).callEvent())
|
||||
+ return teleport(location, cause);
|
||||
+ // Purpur end
|
||||
return false;
|
||||
}
|
||||
|
||||
40
patches/server/0140-Add-StructureGenerateEvent.patch
Normal file
40
patches/server/0140-Add-StructureGenerateEvent.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nahuel <nahueldolores@hotmail.com>
|
||||
Date: Sat, 9 Jan 2021 15:36:59 +0100
|
||||
Subject: [PATCH] Add StructureGenerateEvent
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index e2b7da265e9616ac47e6be72cc6e6d2c75cfec44..1ba06b5835dbf57168444c92a5317bd32a86bdff 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -446,7 +446,14 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
||||
|
||||
if (structuresettingsfeature != null) {
|
||||
StructureStart<?> structurestart = structureAccessor.getStartForFeature(sectionposition, StructureFeature.STRONGHOLD, chunk);
|
||||
-
|
||||
+ // Purpur start
|
||||
+ if (new net.pl3x.purpur.event.world.StructureGenerateEvent(
|
||||
+ accessor.getWorld().getWorld(),
|
||||
+ org.bukkit.StructureType.getStructureTypes().get(feature.feature.getFeatureName().toLowerCase()),
|
||||
+ chunkcoordintpair.x,
|
||||
+ chunkcoordintpair.z
|
||||
+ ).callEvent())
|
||||
+ // Purpur end
|
||||
if (structurestart == null || !structurestart.isValid()) {
|
||||
StructureStart<?> structurestart1 = StructureFeatures.STRONGHOLD.generate(registryManager, this, this.biomeSource, structureManager, worldSeed, chunkcoordintpair, ChunkGenerator.fetchReferences(structureAccessor, chunk, sectionposition, StructureFeature.STRONGHOLD), structuresettingsfeature, chunk, ChunkGenerator::validStrongholdBiome);
|
||||
|
||||
59
patches/server/0141-Farmland-trampling-changes.patch
Normal file
59
patches/server/0141-Farmland-trampling-changes.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 9 Jan 2021 16:06:40 +0100
|
||||
Subject: [PATCH] Farmland trampling changes
|
||||
|
||||
This lets us choose if farmland trampling is fully disabled or only
|
||||
players may trample farmland.
|
||||
|
||||
This lets us choose if entities can stop trampling if they fall a
|
||||
distance equal to their feather falling level, plus the extra block
|
||||
necessary to trample in the first place. Feather Falling 1 requires
|
||||
you to fall over 3+ blocks to trample. FF 2 requires 4+, etc.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index caf40e3df0896492be959f9e0bcfb1fad0bfa2ef..10f1e3d9c35ee80587865cf0035416aed6155c0e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -114,12 +114,20 @@ public class FarmBlock extends Block {
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
+ if (world.purpurConfig.farmlandTramplingDisabled) return;
|
||||
+ if (world.purpurConfig.farmlandTramplingOnlyPlayers && !(entity instanceof Player)) return;
|
||||
if (world.purpurConfig.farmlandAlpha) {
|
||||
Block block = world.getBlockState(pos.below()).getBlock();
|
||||
if (block instanceof FenceBlock || block instanceof WallBlock) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
+ if (world.purpurConfig.farmlandTramplingFeatherFalling) {
|
||||
+ Iterator<net.minecraft.world.item.ItemStack> armor = entity.getArmorSlots().iterator();
|
||||
+ if (armor.hasNext() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FALL_PROTECTION, armor.next()) >= (int) entity.fallDistance) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
// Purpur end
|
||||
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 079cf41c91cd75c0f720af1e208e0c8ec40a1691..76d5e8932e583d84469353468b158f77738d315c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -456,10 +456,16 @@ public class PurpurWorldConfig {
|
||||
public boolean farmlandBypassMobGriefing = false;
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
public boolean farmlandAlpha = false;
|
||||
+ public boolean farmlandTramplingDisabled = false;
|
||||
+ public boolean farmlandTramplingOnlyPlayers = false;
|
||||
+ public boolean farmlandTramplingFeatherFalling = false;
|
||||
private void farmlandSettings() {
|
||||
farmlandBypassMobGriefing = getBoolean("blocks.farmland.bypass-mob-griefing", farmlandBypassMobGriefing);
|
||||
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
farmlandAlpha = getBoolean("blocks.farmland.use-alpha-farmland", farmlandAlpha);
|
||||
+ farmlandTramplingDisabled = getBoolean("blocks.farmland.disable-trampling", farmlandTramplingDisabled);
|
||||
+ farmlandTramplingOnlyPlayers = getBoolean("blocks.farmland.only-players-trample", farmlandTramplingOnlyPlayers);
|
||||
+ farmlandTramplingFeatherFalling = getBoolean("blocks.farmland.feather-fall-distance-affects-trampling", farmlandTramplingFeatherFalling);
|
||||
}
|
||||
|
||||
public boolean furnaceUseLavaFromUnderneath = false;
|
||||
88
patches/server/0142-Movement-options-for-armor-stands.patch
Normal file
88
patches/server/0142-Movement-options-for-armor-stands.patch
Normal file
@@ -0,0 +1,88 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 9 Jan 2021 22:22:59 +0100
|
||||
Subject: [PATCH] Movement options for armor stands
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 8766be89f7bc2f3ce427d4ec428d1fa65a10d995..47067ff24923002f9083022cbec4a90896ce3012 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1502,7 +1502,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
return this.isInWater() || flag;
|
||||
}
|
||||
|
||||
- void updateInWaterStateAndDoWaterCurrentPushing() {
|
||||
+ public void updateInWaterStateAndDoWaterCurrentPushing() { // Purpur - package-private -> public
|
||||
if (this.getVehicle() instanceof Boat) {
|
||||
this.wasTouchingWater = false;
|
||||
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014D)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index 50370dc8697569a4e5cf8ec3714d227a59357d64..e9e24435057cff9c0af758ca2aa822c3b1c3593d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -98,10 +98,12 @@ public class ArmorStand extends LivingEntity {
|
||||
private boolean noTickPoseDirty = false;
|
||||
private boolean noTickEquipmentDirty = false;
|
||||
// Paper end
|
||||
+ public boolean canMovementTick = true; // Purpur
|
||||
|
||||
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
|
||||
super(type, world);
|
||||
if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking
|
||||
+ if (world != null) this.canMovementTick = world.purpurConfig.armorstandMovement; // Purpur
|
||||
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY);
|
||||
this.headPose = ArmorStand.DEFAULT_HEAD_POSE;
|
||||
@@ -995,4 +997,18 @@ public class ArmorStand extends LivingEntity {
|
||||
}
|
||||
// Paper end
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void updateInWaterStateAndDoWaterCurrentPushing() {
|
||||
+ if (this.level.purpurConfig.armorstandWaterMovement &&
|
||||
+ (this.level.purpurConfig.armorstandWaterFence || !(level.getBlockState(blockPosition().below()).getBlock() instanceof net.minecraft.world.level.block.FenceBlock)))
|
||||
+ super.updateInWaterStateAndDoWaterCurrentPushing();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void aiStep() {
|
||||
+ if (this.canMovementTick && this.canMove) super.aiStep();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 76d5e8932e583d84469353468b158f77738d315c..1924f81335d239ffd60af0211038cb23ff9caf6c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -103,10 +103,16 @@ public class PurpurWorldConfig {
|
||||
public float armorstandStepHeight = 0.0F;
|
||||
public boolean armorstandSetNameVisible = false;
|
||||
public boolean armorstandFixNametags = false;
|
||||
+ public boolean armorstandMovement = true;
|
||||
+ public boolean armorstandWaterMovement = true;
|
||||
+ public boolean armorstandWaterFence = true;
|
||||
private void armorstandSettings() {
|
||||
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
||||
armorstandSetNameVisible = getBoolean("gameplay-mechanics.armorstand.set-name-visible-when-placing-with-custom-name", armorstandSetNameVisible);
|
||||
armorstandFixNametags = getBoolean("gameplay-mechanics.armorstand.fix-nametags", armorstandFixNametags);
|
||||
+ armorstandMovement = getBoolean("gameplay-mechanics.armorstand.can-movement-tick", armorstandMovement);
|
||||
+ armorstandWaterMovement = getBoolean("gameplay-mechanics.armorstand.can-move-in-water", armorstandWaterMovement);
|
||||
+ armorstandWaterFence = getBoolean("gameplay-mechanics.armorstand.can-move-in-water-over-fence", armorstandWaterFence);
|
||||
}
|
||||
|
||||
public int daytimeTicks = 12000;
|
||||
58
patches/server/0143-Fix-stuck-in-portals.patch
Normal file
58
patches/server/0143-Fix-stuck-in-portals.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 14 Jan 2021 16:48:10 -0600
|
||||
Subject: [PATCH] Fix stuck in portals
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c02609448326d76f30a1add7d50980230dfa2f06..3032157924962e2c5fa5c696fdc3de4bad74d538 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1171,6 +1171,7 @@ public class ServerPlayer extends Player {
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
+ this.portalPos = net.minecraft.server.MCUtil.toBlockPosition(exit); // Purpur
|
||||
|
||||
// CraftBukkit end
|
||||
this.setLevel(worldserver);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 47067ff24923002f9083022cbec4a90896ce3012..a3420d0a30fbb3f837c863ef559f66ddaa6dc6bd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2626,12 +2626,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
return Vec3.directionFromRotation(this.getRotationVector());
|
||||
}
|
||||
|
||||
+ public BlockPos portalPos = BlockPos.ZERO; // Purpur
|
||||
public void handleInsidePortal(BlockPos pos) {
|
||||
if (this.isOnPortalCooldown()) {
|
||||
+ if (!(level.purpurConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(portalPos))) // Purpur
|
||||
this.setPortalCooldown();
|
||||
} else if (level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur
|
||||
if (!this.level.isClientSide && !pos.equals(this.portalEntrancePos)) {
|
||||
this.portalEntrancePos = pos.immutable();
|
||||
+ portalPos = BlockPos.ZERO; // Purpur
|
||||
}
|
||||
|
||||
this.isInsidePortal = true;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 1924f81335d239ffd60af0211038cb23ff9caf6c..724bce388bf69f9ca7e8e2bf01c17b86f7814b36 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -297,6 +297,7 @@ public class PurpurWorldConfig {
|
||||
public int playerDeathExpDropMax = 100;
|
||||
public boolean teleportIfOutsideBorder = false;
|
||||
public boolean totemOfUndyingWorksInInventory = false;
|
||||
+ public boolean playerFixStuckPortal = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -314,6 +315,7 @@ public class PurpurWorldConfig {
|
||||
playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
|
||||
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
|
||||
totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
|
||||
+ playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
2282
patches/server/0144-Toggle-for-water-sensitive-mob-damage.patch
Normal file
2282
patches/server/0144-Toggle-for-water-sensitive-mob-damage.patch
Normal file
File diff suppressed because it is too large
Load Diff
80
patches/server/0145-Config-to-always-tame-in-Creative.patch
Normal file
80
patches/server/0145-Config-to-always-tame-in-Creative.patch
Normal file
@@ -0,0 +1,80 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 9 Feb 2021 21:23:37 -0500
|
||||
Subject: [PATCH] Config to always tame in Creative
|
||||
|
||||
Adds a configuration option that ensures a player in Creative always tames a tameable entity.
|
||||
This essentially allows Creative mode players to tame animals on their first try.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
index 5c64905e90ccca6e0b347241ddf9cc3f71058b8e..3bd7521b131b2b40f807bdc7ab95e64cf9bcdadc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
@@ -63,7 +63,7 @@ public class RunAroundLikeCrazyGoal extends Goal {
|
||||
int j = this.horse.getMaxTemper();
|
||||
|
||||
// CraftBukkit - fire EntityTameEvent
|
||||
- if (j > 0 && this.horse.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) {
|
||||
+ if ((this.horse.level.purpurConfig.alwaysTameInCreative && ((Player) entity).getAbilities().instabuild) || (j > 0 && this.horse.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled())) { // Purpur
|
||||
this.horse.tameWithName((Player) entity);
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
index d6f50d524cd00fb54dd987cc9a9c560766a12553..e9954c99fdb089d57b32ddd754fee33fd642fece 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -480,7 +480,7 @@ public class Cat extends TamableAnimal {
|
||||
}
|
||||
} else if (this.isFood(itemstack)) {
|
||||
this.usePlayerItem(player, hand, itemstack);
|
||||
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit
|
||||
+ if ((this.level.purpurConfig.alwaysTameInCreative && player.getAbilities().instabuild) || (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled())) { // CraftBukkit // Purpur
|
||||
this.tame(player);
|
||||
this.setOrderedToSit(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
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 5064673a78a6bc5cb8b8973d451946239cd995a0..953db16af175e14e1a47487659a0346216d8cdbc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -326,7 +326,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
- if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit
|
||||
+ if ((this.level.purpurConfig.alwaysTameInCreative && player.getAbilities().instabuild) || (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled())) { // CraftBukkit // Purpur
|
||||
this.tame(player);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
index b039cbbcc33a6b1925d1cf4339018219ceb6c2ad..57e8ef6f7c20d74fdc25d9ab2a9c35b1de1dc49b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -519,7 +519,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
}
|
||||
|
||||
// CraftBukkit - added event call and isCancelled check.
|
||||
- if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) {
|
||||
+ if ((this.level.purpurConfig.alwaysTameInCreative && player.getAbilities().instabuild) || (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, player).isCancelled())) { // Purpur
|
||||
this.tame(player);
|
||||
this.navigation.stop();
|
||||
this.setTarget((LivingEntity) null);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index b7982c468d03f969d4809b66c34ed63ba35c48ef..ce35bce48c3fc5e4365416e19a194e6821a3f5bb 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -385,6 +385,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean useBetterMending = false;
|
||||
+ public boolean alwaysTameInCreative = false;
|
||||
public boolean boatEjectPlayersOnLand = false;
|
||||
public boolean boatsDoFallDamage = true;
|
||||
public boolean disableDropsOnCrammingDeath = false;
|
||||
@@ -403,6 +404,7 @@ public class PurpurWorldConfig {
|
||||
public int animalBreedingCooldownSeconds = 0;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
+ alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
|
||||
boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage);
|
||||
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
|
||||
93
patches/server/0146-End-crystal-explosion-options.patch
Normal file
93
patches/server/0146-End-crystal-explosion-options.patch
Normal file
@@ -0,0 +1,93 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Sat, 13 Feb 2021 09:28:56 -0500
|
||||
Subject: [PATCH] End crystal explosion options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
index f8863cabad1bd0c3c2c62b8e17612d9559237d68..06c6addfa2a8dab1ad52a3588e9aeba5208eb997 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -129,6 +129,22 @@ public class EndCrystal extends Entity {
|
||||
phantomDamageCooldown = 0;
|
||||
idleCooldown = 60;
|
||||
}
|
||||
+
|
||||
+ public boolean shouldExplode() {
|
||||
+ return showsBottom() ? level.purpurConfig.basedEndCrystalExplode : level.purpurConfig.baselessEndCrystalExplode;
|
||||
+ }
|
||||
+
|
||||
+ public float getExplosionPower() {
|
||||
+ return (float) (showsBottom() ? level.purpurConfig.basedEndCrystalExplosionPower : level.purpurConfig.baselessEndCrystalExplosionPower);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasExplosionFire() {
|
||||
+ return showsBottom() ? level.purpurConfig.basedEndCrystalExplosionFire : level.purpurConfig.baselessEndCrystalExplosionFire;
|
||||
+ }
|
||||
+
|
||||
+ public Explosion.BlockInteraction getExplosionEffect() {
|
||||
+ return showsBottom() ? level.purpurConfig.basedEndCrystalExplosionEffect : level.purpurConfig.baselessEndCrystalExplosionEffect;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -174,15 +190,17 @@ public class EndCrystal extends Entity {
|
||||
// CraftBukkit end
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
if (!source.isExplosion()) {
|
||||
+ if (shouldExplode()) { // Purpur
|
||||
// CraftBukkit start
|
||||
- ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), getExplosionPower(), hasExplosionFire()); // Purpur
|
||||
this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
this.unsetRemoved();
|
||||
return false;
|
||||
}
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.BlockInteraction.DESTROY);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), getExplosionEffect()); // Purpur
|
||||
// CraftBukkit end
|
||||
+ } else this.unsetRemoved(); // Purpur
|
||||
}
|
||||
|
||||
this.onDestroyedBy(source);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index ce35bce48c3fc5e4365416e19a194e6821a3f5bb..99f106fb3e3c2220f0c97a8cafd22d5546e101e5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -463,6 +463,35 @@ public class PurpurWorldConfig {
|
||||
dispenserPlaceAnvils = getBoolean("blocks.dispenser.place-anvils", dispenserPlaceAnvils);
|
||||
}
|
||||
|
||||
+ public boolean baselessEndCrystalExplode = true;
|
||||
+ public double baselessEndCrystalExplosionPower = 6.0D;
|
||||
+ public boolean baselessEndCrystalExplosionFire = false;
|
||||
+ public Explosion.BlockInteraction baselessEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ public boolean basedEndCrystalExplode = true;
|
||||
+ public double basedEndCrystalExplosionPower = 6.0D;
|
||||
+ public boolean basedEndCrystalExplosionFire = false;
|
||||
+ public Explosion.BlockInteraction basedEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ private void endCrystalSettings() {
|
||||
+ baselessEndCrystalExplode = getBoolean("blocks.end-crystal.baseless.explode", baselessEndCrystalExplode);
|
||||
+ baselessEndCrystalExplosionPower = getDouble("blocks.end-crystal.baseless.explosion-power", baselessEndCrystalExplosionPower);
|
||||
+ baselessEndCrystalExplosionFire = getBoolean("blocks.end-crystal.baseless.explosion-fire", baselessEndCrystalExplosionFire);
|
||||
+ try {
|
||||
+ baselessEndCrystalExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.end-crystal.baseless.explosion-effect", baselessEndCrystalExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.end-crystal.baseless.explosion-effect`! Using default of `DESTROY`");
|
||||
+ baselessEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ basedEndCrystalExplode = getBoolean("blocks.end-crystal.base.explode", basedEndCrystalExplode);
|
||||
+ basedEndCrystalExplosionPower = getDouble("blocks.end-crystal.base.explosion-power", basedEndCrystalExplosionPower);
|
||||
+ basedEndCrystalExplosionFire = getBoolean("blocks.end-crystal.base.explosion-fire", basedEndCrystalExplosionFire);
|
||||
+ try {
|
||||
+ basedEndCrystalExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.end-crystal.base.explosion-effect", basedEndCrystalExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.end-crystal.base.explosion-effect`! Using default of `DESTROY`");
|
||||
+ basedEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean farmlandBypassMobGriefing = false;
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
public boolean farmlandAlpha = false;
|
||||
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Sat, 20 Feb 2021 14:47:08 -0800
|
||||
Subject: [PATCH] Configs for if Wither/Ender Dragon can ride vehicles
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index ed1c473ef80202b3aa4996b5acb9728857eaec8c..ea5e71b2264c73888d9355f31177a50ccdb50110 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -1114,6 +1114,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
|
||||
@Override
|
||||
protected boolean canRide(Entity entity) {
|
||||
+ if (this.level.purpurConfig.enderDragonCanRideVehicles) return this.boardingCooldown <= 0; // Purpur
|
||||
return false;
|
||||
}
|
||||
|
||||
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 580af65dd27616cd6c17f3b8e39abbb1c4549ef4..edd9c27c21bd3c377ecb9f14541140b73642c694 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
|
||||
@@ -733,6 +733,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
|
||||
@Override
|
||||
protected boolean canRide(Entity entity) {
|
||||
+ if (this.level.purpurConfig.witherCanRideVehicles) return this.boardingCooldown <= 0; // Purpur
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 99f106fb3e3c2220f0c97a8cafd22d5546e101e5..19e2027934810c7f384e33acb946ee51786eeae8 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -898,6 +898,7 @@ public class PurpurWorldConfig {
|
||||
public boolean enderDragonAlwaysDropsFullExp = false;
|
||||
public boolean enderDragonBypassMobGriefing = false;
|
||||
public boolean enderDragonTakeDamageFromWater = false;
|
||||
+ public boolean enderDragonCanRideVehicles = false;
|
||||
private void enderDragonSettings() {
|
||||
enderDragonRidable = getBoolean("mobs.ender_dragon.ridable", enderDragonRidable);
|
||||
enderDragonRidableInWater = getBoolean("mobs.ender_dragon.ridable-in-water", enderDragonRidableInWater);
|
||||
@@ -915,6 +916,7 @@ public class PurpurWorldConfig {
|
||||
enderDragonAlwaysDropsFullExp = getBoolean("mobs.ender_dragon.always-drop-full-exp", enderDragonAlwaysDropsFullExp);
|
||||
enderDragonBypassMobGriefing = getBoolean("mobs.ender_dragon.bypass-mob-griefing", enderDragonBypassMobGriefing);
|
||||
enderDragonTakeDamageFromWater = getBoolean("mobs.ender_dragon.takes-damage-from-water", enderDragonTakeDamageFromWater);
|
||||
+ enderDragonCanRideVehicles = getBoolean("mobs.ender_dragon.can-ride-vehicles", enderDragonCanRideVehicles);
|
||||
}
|
||||
|
||||
public boolean endermanRidable = false;
|
||||
@@ -1982,6 +1984,7 @@ public class PurpurWorldConfig {
|
||||
public int witherHealthRegenDelay = 20;
|
||||
public boolean witherBypassMobGriefing = false;
|
||||
public boolean witherTakeDamageFromWater = false;
|
||||
+ public boolean witherCanRideVehicles = false;
|
||||
private void witherSettings() {
|
||||
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
|
||||
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
|
||||
@@ -2000,6 +2003,7 @@ public class PurpurWorldConfig {
|
||||
witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean witherSkeletonRidable = false;
|
||||
Reference in New Issue
Block a user