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:
@@ -1,38 +0,0 @@
|
||||
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 789224c6285cde2009e000d98e190c36459f04e8..26ef372ddeb707ad0962297ce736c245f713d9f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -227,6 +227,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 0bf9306bb31e975101dccc3df4c776f16af84391..c9218a478d5955b5add90cf21e2d8df77a0c6e08 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1204,6 +1204,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;
|
||||
@@ -1230,6 +1231,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);
|
||||
@@ -1,34 +0,0 @@
|
||||
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 1891cfb8f7ebae5a95a55f706bb04f8206121d32..5d4c26ca9db5f36626f64ba4b0965a43823c81d3 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 c9218a478d5955b5add90cf21e2d8df77a0c6e08..27f37620f3eda28bc3a8834fd335aeeac38ccbf5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -442,6 +442,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() {
|
||||
@@ -1,430 +0,0 @@
|
||||
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 4308cf798c7f97532ee56369a11afe4dbf7a898f..d734addd622f6d429a79df08310bce562db3425e 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -201,6 +201,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 688a80485ae28361b993a4de4019ae9794989982..63476c39ca2f78e0e53729325220196be5932dde 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1142,6 +1142,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 a8f91d39819687284f09a10152ef9b4ed5029394..489c0a317e5c5711bf7de3e54d24c6d9f609f43e 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -359,6 +359,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 d6bea7c9e925bd211b2de4b596dab77fe10d12ac..7fd4daf0382d7a80ca6961dc55f67ba714114a60 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -260,6 +260,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
|
||||
@@ -481,6 +482,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -541,6 +543,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
|
||||
@@ -2548,5 +2551,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 5655282578018c00a60d7ddc3fb48393da9cc2ee..4baeaf922b8529e7fb4a44fff9428a77e2ea78de 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -483,6 +483,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());
|
||||
}
|
||||
@@ -593,6 +594,8 @@ public abstract class PlayerList {
|
||||
}
|
||||
public net.kyori.adventure.text.Component disconnect(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
|
||||
+ }
|
||||
+}
|
||||
@@ -1,49 +0,0 @@
|
||||
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 22ce93fd265d3fa9967e6467301e8128635f2391..762542252e59da20f284dde2545889da3340454e 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 27f37620f3eda28bc3a8834fd335aeeac38ccbf5..af48e54639b412feb8dee36705d0aa8980b7ea53 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1579,6 +1579,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);
|
||||
@@ -1589,6 +1590,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;
|
||||
@@ -1,31 +0,0 @@
|
||||
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 ba6a674c2b18108390c7b9d2bb313a603d9909b4..2b323d2b59853c738f482c7025b1a026e1f8e1d2 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1141,10 +1141,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;
|
||||
}
|
||||
@@ -1168,6 +1170,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;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
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 f991ed65d27d15a6eb32533f32da0bb9b69f331d..6423f422d4eca56cd8cbdd9c23925ce703b426f5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -359,6 +359,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 af48e54639b412feb8dee36705d0aa8980b7ea53..ae252c66d4319fa4a581f1da9ec926de646a5aa0 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;
|
||||
@@ -1,36 +0,0 @@
|
||||
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 593d6251c75ec337175d08b85000239ba7da1af2..c040c9ce886f9970a70867344fd0e0b226d3ff9f 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -235,6 +235,12 @@ public enum Direction implements StringRepresentable {
|
||||
return NORTH;
|
||||
case EAST:
|
||||
return SOUTH;
|
||||
+ // Purpur start
|
||||
+ case UP:
|
||||
+ return UP;
|
||||
+ case DOWN:
|
||||
+ return DOWN;
|
||||
+ // Purpur end
|
||||
default:
|
||||
throw new IllegalStateException("Unable to get Y-rotated facing of " + this);
|
||||
}
|
||||
@@ -314,6 +320,12 @@ public enum Direction implements StringRepresentable {
|
||||
return SOUTH;
|
||||
case EAST:
|
||||
return NORTH;
|
||||
+ // Purpur start
|
||||
+ case UP:
|
||||
+ return UP;
|
||||
+ case DOWN:
|
||||
+ return DOWN;
|
||||
+ // Purpur end
|
||||
default:
|
||||
throw new IllegalStateException("Unable to get CCW facing of " + this);
|
||||
}
|
||||
@@ -1,698 +0,0 @@
|
||||
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 f23b12206e762a52879ba800353638b536e3a2f1..2cb9c2f03139ba79014eed078967d74845fd0fb8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1682,7 +1682,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 48fae807359382fd178bad91fc9cab9bba858dec..aa962aa9a390eb22aaac684278d9a5cdec43e767 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -661,7 +661,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 8d6d47456ce6f9870f1a682665780a301b92fec5..b67b877e3fa9c00a0b88dbe3e8b0f0e9702537ed 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 0b745cdb751530794bf9d988c37aff17e2999114..044b2d63cbe95ac47dd1e2aa0786017dfbf3e831 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, 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.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 ac5779319081a6894373877067edf958da8a9cf5..24227a18ea1d0c06e2049542c8ca9c82ec7ce046 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 03e75add762b19170e95d1b280f92e79f2f8f9bf..091177ac2a5995b9f6f0b5245e8eabefd4ed86d6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -1346,7 +1346,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 e7adecb2324efaedd6aad3aa1213d53765b09b7e..74ee531befc67495e18d4b97a4e4b14e51830de5 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 3ea3085d9b4256c1a37c99e79550f9773e8c0f71..c931bf7ec3c58eae012bbadb9d3e9fef69b3fc79 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -125,7 +125,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 f637cd740ec3801ce1c387473b5c4ff6080e76ec..3247f3f3c9d53953f8268c8f9575275126cf33a3 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.a(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 ff71f78497681805246d7b3e4ac59288db9af997..4407c9f25e88a3685c6e9f8c7775d3011b38fff2 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
|
||||
@@ -375,7 +375,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.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect);
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
@@ -471,7 +471,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 96858c10ad219a47187d3008387355f1bcfdc789..aea8de335294320e3734bea4fbc4bab91d1de59a 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 9003af124953bf6fb12e8bff8e10d5aa0a7f9fc1..2aa05aa9e7a12eea582c05c141f08fc6e2b82053 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -476,7 +476,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(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(2000) == 0); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -524,7 +524,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(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(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 9e50cf5d5b48718b1f8ff74c4de891172970ac12..78b2350a09eef0537742af429cfa5f022fc92ad3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
@@ -316,7 +316,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 13f4b6d17312dd7379875eb56049c87c10deae88..1148cd343f9931848b5119d8bddc9b5218d67490 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
||||
@@ -184,7 +184,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 1c523c384668b483ba0211c413ade7b87c7ca16a..9caf164f1b68034dd36671e94c9b60e225bde691 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
||||
@@ -195,7 +195,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);
|
||||
@@ -232,7 +232,7 @@ public class Silverfish extends Monster {
|
||||
} else {
|
||||
Random random = this.mob.getRandom();
|
||||
|
||||
- if (this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && random.nextInt(10) == 0) {
|
||||
+ if ((this.mob.level.purpurConfig.silverfishBypassMobGriefing || this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && random.nextInt(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 89a72027efd11ce261d365db037fd1b856d08184..4be9326344893256cbc01fdb599f859aaf86a0a4 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
|
||||
@@ -407,7 +407,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 343f186136abba95cb36876969f9492b5994f802..50901b7a80c26b87be18d0a337d2a8ad95d4d7d5 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 a6d75f20d6b7679d53c3c081c6632e9c303e2d74..af130b70b073939ceef70fa1b72841c511203dfc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
@@ -25,7 +25,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 46b74271ce5f614f07754db14d2a552c36f73226..430aa10101d9f21561155941ff24441fd0c4103a 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 54b5cfa35e5fe9138d39a73f2085f594f1987cda..4efc0870fadc291260491b9cc4e048916633185f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -314,7 +314,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 6dda5eeca4e310eceb2598322803bfafc184e9c7..3c51e6d419a244b9270119590aa299527163c331 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 e0ef42c2613374bedc8eb114aef7dd2aaeebb7b7..e06a8a68ccb9c9a77df061264e58fd850cf1f794 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 1187a7382b8849524f99bbd8d12b43677f1053cd..ddce552c4374715e9652cfda3622b70d9be854f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
@@ -71,7 +71,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 e98fc3c235f9160f1928a8afb0d7991a6d3430cb..db35f756b7adb6b113659ae13b08ab8921944c21 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 ae252c66d4319fa4a581f1da9ec926de646a5aa0..c73c77a22317631da7f8f52037103744bf9b8024 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -381,9 +381,12 @@ 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 persistentTileEntityDisplayNames = false;
|
||||
public boolean persistentDroppableEntityDisplayNames = false;
|
||||
+ public boolean projectilesBypassMobGriefing = false;
|
||||
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
||||
public double voidDamageHeight = -64.0D;
|
||||
public double voidDamageDealt = 4.0D;
|
||||
@@ -395,9 +398,12 @@ 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);
|
||||
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
|
||||
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);
|
||||
@@ -467,9 +473,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);
|
||||
}
|
||||
@@ -508,6 +516,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;
|
||||
@@ -541,6 +554,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() {
|
||||
@@ -725,6 +743,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);
|
||||
@@ -736,6 +755,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;
|
||||
@@ -823,6 +843,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);
|
||||
@@ -838,6 +859,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;
|
||||
@@ -845,6 +867,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);
|
||||
@@ -856,6 +879,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;
|
||||
@@ -875,6 +899,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);
|
||||
@@ -884,6 +909,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;
|
||||
@@ -891,6 +917,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);
|
||||
@@ -902,6 +929,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;
|
||||
@@ -1297,6 +1325,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);
|
||||
@@ -1306,6 +1335,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;
|
||||
@@ -1325,6 +1355,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);
|
||||
@@ -1334,6 +1365,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;
|
||||
@@ -1375,6 +1407,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);
|
||||
@@ -1387,11 +1420,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);
|
||||
@@ -1401,6 +1436,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;
|
||||
@@ -1419,6 +1455,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);
|
||||
@@ -1429,6 +1466,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;
|
||||
@@ -1448,6 +1486,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);
|
||||
@@ -1457,6 +1496,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;
|
||||
@@ -1524,6 +1564,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);
|
||||
@@ -1540,6 +1581,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;
|
||||
@@ -1699,6 +1741,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);
|
||||
@@ -1725,6 +1768,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;
|
||||
@@ -1781,6 +1825,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);
|
||||
@@ -1797,6 +1842,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;
|
||||
@@ -1861,6 +1907,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);
|
||||
@@ -1875,6 +1922,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;
|
||||
@@ -1,43 +0,0 @@
|
||||
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 59ae3bb34678cdb5241f691915c96d6568363d3b..f6c0c9fca005f72c3764a4a4f8df05825796e950 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
@@ -62,7 +62,7 @@ public class NoteBlock extends Block {
|
||||
}
|
||||
|
||||
private void play(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 c73c77a22317631da7f8f52037103744bf9b8024..c70a804b8b7a30411f6cfa72bb2f36d411e0af30 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 persistentTileEntityDisplayNames = false;
|
||||
public boolean persistentDroppableEntityDisplayNames = false;
|
||||
public boolean projectilesBypassMobGriefing = false;
|
||||
@@ -401,6 +402,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);
|
||||
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
|
||||
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
|
||||
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
||||
@@ -1,129 +0,0 @@
|
||||
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 62c2f947a77570228dfdf4dae16c64eb97ee2f40..197482e1ace23c3de002242097a68c6cc297cd3f 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() == DimensionType.END_LOCATION ? 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 bc2f2c69d437e99cb965cede7dfd42228151b26c..fef1027829c44957e23c0a121033bfb7640d06f0 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 b2c098a02008b860b2fb17323831ab8af27751ae..1405083cb3e9e01d9dd99a9e42b2b56f3a104a60 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
|
||||
@@ -179,6 +179,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 c70a804b8b7a30411f6cfa72bb2f36d411e0af30..4432330c936e060b1bb5005ebe70cf575249e5d9 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 persistentTileEntityDisplayNames = false;
|
||||
@@ -401,6 +402,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);
|
||||
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index ac89af911596955ac87882069b7010b66ed05adf..b8fb34df77ffd1f4ef2db63717e3acf2ab592fb6 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 303de40046ac0e5802a0061a1118ee95897b6bfc..2fe84d9d7b0a829baefdb9fad7ba02d336ba5254 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1016,6 +1016,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;
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
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 fde436065aeeb47cd177656a7c9fe8dc34178e87..6a1cb38de5733e384546984a0eadd4bab53c0122 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -346,7 +346,14 @@ public abstract class ChunkGenerator {
|
||||
|
||||
if (structuresettingsfeature != null) {
|
||||
StructureStart<?> structurestart1 = feature.generate(registryManager, this, this.biomeSource, structureManager, worldSeed, chunkcoordintpair, biome, j, structuresettingsfeature, 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
|
||||
accessor.setStartForFeature(sectionposition, feature.feature, structurestart1, chunk);
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
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 e06a8a68ccb9c9a77df061264e58fd850cf1f794..010da2b44fa3a4f033e4f86e9a0917b5c94b6ab5 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 4432330c936e060b1bb5005ebe70cf575249e5d9..7a3b246cd6254b7806b54f4f4d23fd22a2cba8a8 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -480,10 +480,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;
|
||||
@@ -1,88 +0,0 @@
|
||||
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 cd4717041d74832b7517c303f58c8692d54f9588..56fefcfdecf3ed4b747e1bab8bc24e5275d71e2e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1595,7 +1595,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
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((Tag) 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 bb710e62477df3048d5219f1edfa9ffdefacb41d..aee5db3cdbc49de995780d0b0e219d0878a5f304 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -99,10 +99,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;
|
||||
@@ -996,4 +998,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 7a3b246cd6254b7806b54f4f4d23fd22a2cba8a8..7b0ec253d7ed4e6207d4f82e84b7c6383fae2821 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;
|
||||
@@ -1,58 +0,0 @@
|
||||
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 7fd4daf0382d7a80ca6961dc55f67ba714114a60..878654d5e65d4318aaad27b00a6df1662b5946de 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1142,6 +1142,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 56fefcfdecf3ed4b747e1bab8bc24e5275d71e2e..74df92f69454ec78036dc58ea9155b26ccd3db19 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2716,12 +2716,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
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 7b0ec253d7ed4e6207d4f82e84b7c6383fae2821..087bf58786d6a1e1f812319be615a53c02f6bfda 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;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,80 +0,0 @@
|
||||
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 fd0f5c255729b2c05ead5843ab58fe880971b3db..08bdebf99cdedfc6115405e5198346ee4e6e1dce 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 9c89ae4f5f0ff8841040d43315db9fcf6d32f89e..fbb8d43b39bc3a215f89078ff45887cf6a87800b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -479,7 +479,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 f2226bd6753a50c0d96e07a50cb8785b50cae1ca..67c72a5b9c786d3240ade51aa48e0e63f0d758cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -321,7 +321,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 1193f711442fc8d0d3631cbb7fe4a31bf7639f1b..c681cbcd4549d6bf2d88408b94fbb31c1d1406e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -514,7 +514,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 08709de2f81fb637cf951cb2d76dfd759fb429b5..4e3bf53c088ec64882cf87c5e3facdaeb034e02e 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;
|
||||
@@ -404,6 +405,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);
|
||||
@@ -1,93 +0,0 @@
|
||||
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 92e65f3fbc8f5d77bb8cc31e7a7780c2589f4227..0c46507ab0b904fb1f79bc5421c88c03e894c869 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
|
||||
@@ -130,6 +130,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
|
||||
@@ -175,15 +191,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 4e3bf53c088ec64882cf87c5e3facdaeb034e02e..3b75437f3e78d7d00ca0b41f85e18dc11bdc0f1c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -487,6 +487,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;
|
||||
@@ -1,66 +0,0 @@
|
||||
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 2f0654d4e8eba44880392d140ee52234b79e9503..75d1cf540dfe55c8b979219b14610c22a5d18c48 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 3de45a7a54643109fc6a8287879cf6dae87e72ec..2f9e10be559bbf685bbe8b4ac4b8a55a6a663821 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
|
||||
@@ -722,6 +722,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 3b75437f3e78d7d00ca0b41f85e18dc11bdc0f1c..cadde9d8772d61edd0e041b508e0abebbd076454 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -922,6 +922,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);
|
||||
@@ -939,6 +940,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;
|
||||
@@ -2006,6 +2008,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);
|
||||
@@ -2024,6 +2027,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