mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
apply the minecraft source files that we can rn
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/CrashReport.java b/net/minecraft/CrashReport.java
|
||||
index 3e0e88afcf010d9a3d46e48bca5cbdf98fe97544..394443d00e661715439be1e56dddc129947699a4 100644
|
||||
--- a/net/minecraft/CrashReport.java
|
||||
+++ b/net/minecraft/CrashReport.java
|
||||
@@ -30,6 +30,7 @@ public class CrashReport {
|
||||
private boolean trackingStackTrace = true;
|
||||
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
|
||||
private final SystemReport systemReport = new SystemReport();
|
||||
+ private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!", ""); // Purpur - Rebrand
|
||||
|
||||
public CrashReport(String title, Throwable exception) {
|
||||
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper
|
||||
@@ -130,7 +131,7 @@ public class CrashReport {
|
||||
}
|
||||
|
||||
public String getFriendlyReport(ReportType type) {
|
||||
- return this.getFriendlyReport(type, List.of());
|
||||
+ return this.getFriendlyReport(type, extraInfo); // Purpur - Rebrand
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -161,7 +162,7 @@ public class CrashReport {
|
||||
}
|
||||
|
||||
public boolean saveToFile(Path path, ReportType type) {
|
||||
- return this.saveToFile(path, type, List.of());
|
||||
+ return this.saveToFile(path, type, extraInfo); // Purpur - Rebrand
|
||||
}
|
||||
|
||||
public SystemReport getSystemReport() {
|
||||
@@ -1,53 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/arguments/selector/EntitySelector.java b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
index 514f8fbdeb776087608665c35de95294aadf5cf0..b305ba9bab617bf4e52d0e6ddf160bacc5751a94 100644
|
||||
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -192,26 +192,27 @@ public class EntitySelector {
|
||||
this.checkPermissions(source);
|
||||
if (this.playerName != null) {
|
||||
ServerPlayer playerByName = source.getServer().getPlayerList().getPlayerByName(this.playerName);
|
||||
- return playerByName == null ? List.of() : List.of(playerByName);
|
||||
+ return playerByName == null || !canSee(source, playerByName) ? List.of() : List.of(playerByName); // Purpur - Hide hidden players from entity selector
|
||||
} else if (this.entityUUID != null) {
|
||||
ServerPlayer playerByName = source.getServer().getPlayerList().getPlayer(this.entityUUID);
|
||||
- return playerByName == null ? List.of() : List.of(playerByName);
|
||||
+ return playerByName == null || !canSee(source, playerByName) ? List.of() : List.of(playerByName); // Purpur - Hide hidden players from entity selector
|
||||
} else {
|
||||
Vec3 vec3 = this.position.apply(source.getPosition());
|
||||
AABB absoluteAabb = this.getAbsoluteAabb(vec3);
|
||||
Predicate<Entity> predicate = this.getPredicate(vec3, absoluteAabb, null);
|
||||
if (this.currentEntity) {
|
||||
- return source.getEntity() instanceof ServerPlayer serverPlayer && predicate.test(serverPlayer) ? List.of(serverPlayer) : List.of();
|
||||
+ return source.getEntity() instanceof ServerPlayer serverPlayer && predicate.test(serverPlayer) && canSee(source, serverPlayer) ? List.of(serverPlayer) : List.of(); // Purpur - Hide hidden players from entity selector
|
||||
} else {
|
||||
int resultLimit = this.getResultLimit();
|
||||
List<ServerPlayer> players;
|
||||
if (this.isWorldLimited()) {
|
||||
players = source.getLevel().getPlayers(predicate, resultLimit);
|
||||
+ players.removeIf(entityplayer3 -> !canSee(source, entityplayer3)); // Purpur - Hide hidden players from entity selector
|
||||
} else {
|
||||
players = new ObjectArrayList<>();
|
||||
|
||||
for (ServerPlayer serverPlayer1 : source.getServer().getPlayerList().getPlayers()) {
|
||||
- if (predicate.test(serverPlayer1)) {
|
||||
+ if (predicate.test(serverPlayer1) && canSee(source, serverPlayer1)) { // Purpur - Hide hidden players from entity selector
|
||||
players.add(serverPlayer1);
|
||||
if (players.size() >= resultLimit) {
|
||||
return players;
|
||||
@@ -270,4 +271,10 @@ public class EntitySelector {
|
||||
public static Component joinNames(List<? extends Entity> names) {
|
||||
return ComponentUtils.formatList(names, Entity::getDisplayName);
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Hide hidden players from entity selector
|
||||
+ private boolean canSee(CommandSourceStack sender, ServerPlayer target) {
|
||||
+ return !org.purpurmc.purpur.PurpurConfig.hideHiddenPlayersFromEntitySelector || !(sender.getEntity() instanceof ServerPlayer player) || player.getBukkitEntity().canSee(target.getBukkitEntity());
|
||||
+ }
|
||||
+ // Purpur end - Hide hidden players from entity selector
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/core/BlockPos.java b/net/minecraft/core/BlockPos.java
|
||||
index a81694a22e94cca6f7110f7d5b205d1303f4e071..6518d3fff6daf331b24a7bf5b39fa1920b73711d 100644
|
||||
--- a/net/minecraft/core/BlockPos.java
|
||||
+++ b/net/minecraft/core/BlockPos.java
|
||||
@@ -63,6 +63,12 @@ public class BlockPos extends Vec3i {
|
||||
public static final int MAX_HORIZONTAL_COORDINATE = 33554431;
|
||||
// Paper end - Optimize Bit Operations by inlining
|
||||
|
||||
+ // Purpur start - Ridables
|
||||
+ public BlockPos(net.minecraft.world.entity.Entity entity) {
|
||||
+ super(entity.getBlockX(), entity.getBlockY(), entity.getBlockZ());
|
||||
+ }
|
||||
+ // Purpur end - Ridables
|
||||
+
|
||||
public BlockPos(int x, int y, int z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index ca02c4c71a0a5a1a0ae8bbb40f0b1b7eac64e6fd..582e012222123e5001c34153f2ee1ab1d08935fd 100644
|
||||
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -735,5 +735,22 @@ public interface DispenseItemBehavior {
|
||||
DispenserBlock.registerBehavior(Items.TNT_MINECART, new MinecartDispenseItemBehavior(EntityType.TNT_MINECART));
|
||||
DispenserBlock.registerBehavior(Items.HOPPER_MINECART, new MinecartDispenseItemBehavior(EntityType.HOPPER_MINECART));
|
||||
DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, new MinecartDispenseItemBehavior(EntityType.COMMAND_BLOCK_MINECART));
|
||||
+ // Purpur start - Dispensers place anvils option
|
||||
+ DispenserBlock.registerBehavior(Items.ANVIL, (new OptionalDispenseItemBehavior() {
|
||||
+ @Override
|
||||
+ public ItemStack execute(BlockSource dispenser, ItemStack stack) {
|
||||
+ net.minecraft.world.level.Level level = dispenser.level();
|
||||
+ if (!level.purpurConfig.dispenserPlaceAnvils) return super.execute(dispenser, stack);
|
||||
+ Direction facing = dispenser.blockEntity().getBlockState().getValue(DispenserBlock.FACING);
|
||||
+ BlockPos pos = dispenser.pos().relative(facing);
|
||||
+ BlockState state = level.getBlockState(pos);
|
||||
+ if (state.isAir()) {
|
||||
+ level.setBlockAndUpdate(pos, Blocks.ANVIL.defaultBlockState().setValue(net.minecraft.world.level.block.AnvilBlock.FACING, facing.getAxis() == Direction.Axis.Y ? Direction.NORTH : facing.getClockWise()));
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
+ return stack;
|
||||
+ }
|
||||
+ }));
|
||||
+ // Purpur end - Dispensers place anvils option
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
index e2d169b45f1dba6559ca337b07a110f79d3db504..727d04a442053f6d0c4df3e744554e2866fa38cd 100644
|
||||
--- a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
@@ -32,7 +32,7 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior {
|
||||
return false;
|
||||
} else {
|
||||
LivingEntity livingEntity = entitiesOfClass.getFirst();
|
||||
- EquipmentSlot equipmentSlotForItem = livingEntity.getEquipmentSlotForItem(item);
|
||||
+ EquipmentSlot equipmentSlotForItem = blockSource.level().purpurConfig.dispenserApplyCursedArmor ? livingEntity.getEquipmentSlotForItem(item) : livingEntity.getEquipmentSlotForDispenserItem(item); if (equipmentSlotForItem == null) return false; // Purpur - Dispenser curse of binding protection
|
||||
ItemStack itemStack = item.copyWithCount(1); // Paper - shrink below and single item in event
|
||||
// CraftBukkit start
|
||||
net.minecraft.world.level.Level world = blockSource.level();
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/gametest/framework/GameTestHelper.java b/net/minecraft/gametest/framework/GameTestHelper.java
|
||||
index fafbc8a9229432c4fb290a54cf453cd0c0c7b3b6..fa7a2a85adf7758a753c54a7cf75cc667922d3d7 100644
|
||||
--- a/net/minecraft/gametest/framework/GameTestHelper.java
|
||||
+++ b/net/minecraft/gametest/framework/GameTestHelper.java
|
||||
@@ -292,6 +292,8 @@ public class GameTestHelper {
|
||||
return gameType;
|
||||
}
|
||||
|
||||
+ public void setAfk(final boolean afk) {} // Purpur - AFK API
|
||||
+
|
||||
@Override
|
||||
public boolean isClientAuthoritative() {
|
||||
return false;
|
||||
@@ -1,31 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
|
||||
index 4ed9611994c5c8da01fede690197527c5b3a5731..00a82873d226f113278632a53c0faca420dd67d4 100644
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
+++ b/net/minecraft/network/Connection.java
|
||||
@@ -588,11 +588,20 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
|
||||
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
|
||||
private static int currTick; // Paper - Buffer joins to world
|
||||
+ private static int tickSecond; // Purpur - Max joins per second
|
||||
public void tick() {
|
||||
this.flushQueue();
|
||||
// Paper start - Buffer joins to world
|
||||
if (Connection.currTick != net.minecraft.server.MinecraftServer.currentTick) {
|
||||
Connection.currTick = net.minecraft.server.MinecraftServer.currentTick;
|
||||
+ // Purpur start - Max joins per second
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.maxJoinsPerSecond) {
|
||||
+ if (++Connection.tickSecond > 20) {
|
||||
+ Connection.tickSecond = 0;
|
||||
+ Connection.joinAttemptsThisTick = 0;
|
||||
+ }
|
||||
+ } else
|
||||
+ // Purpur end - Max joins per second
|
||||
Connection.joinAttemptsThisTick = 0;
|
||||
}
|
||||
// Paper end - Buffer joins to world
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/network/chat/SignedMessageChain.java b/net/minecraft/network/chat/SignedMessageChain.java
|
||||
index f6eed34b2fd72ab74cc9dc4b99ca184d512c0a66..a3e211edd348c0936757de33a74b9456248b3bd2 100644
|
||||
--- a/net/minecraft/network/chat/SignedMessageChain.java
|
||||
+++ b/net/minecraft/network/chat/SignedMessageChain.java
|
||||
@@ -45,7 +45,7 @@ public class SignedMessageChain {
|
||||
SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink;
|
||||
if (signedMessageLink == null) {
|
||||
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
|
||||
- } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) {
|
||||
+ } else if (org.purpurmc.purpur.PurpurConfig.kickForOutOfOrderChat && body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) { // Purpur - Option to disable kick for out of order chat
|
||||
this.setChainBroken();
|
||||
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
|
||||
} else {
|
||||
@@ -1,140 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index f1373fd5fdebb9f4600ba7f32a5df6188de3a0e9..924dc9a32cd78f37078ff47cde54e61844572f47 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -283,6 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public joptsimple.OptionSet options;
|
||||
public org.bukkit.command.ConsoleCommandSender console;
|
||||
public static int currentTick; // Paper - improve tick loop
|
||||
+ public static final long startTimeMillis = System.currentTimeMillis(); // Purpur - Add uptime command
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
// Paper - don't store the vanilla dispatcher
|
||||
@@ -293,7 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
|
||||
private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
- public final double[] recentTps = new double[3];
|
||||
+ public final double[] recentTps = new double[4]; // Purpur - Add 5 second tps average in /tps
|
||||
// Spigot end
|
||||
public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
|
||||
public volatile boolean abnormalExit; // Paper - Improved watchdog support
|
||||
@@ -302,6 +303,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
+ public boolean lagging = false; // Purpur - Lagging threshold
|
||||
+ protected boolean upnp = false; // Purpur - UPnP Port Forwarding
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
|
||||
AtomicReference<S> atomicReference = new AtomicReference<>();
|
||||
@@ -993,6 +996,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
+ // Purpur start - UPnP Port Forwarding
|
||||
+ if (upnp) {
|
||||
+ if (dev.omega24.upnp4j.UPnP4J.close(this.getPort(), dev.omega24.upnp4j.util.Protocol.TCP)) {
|
||||
+ LOGGER.info("[UPnP] Port {} closed", this.getPort());
|
||||
+ } else {
|
||||
+ LOGGER.error("[UPnP] Failed to close port {}", this.getPort());
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - UPnP Port Forwarding
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.spark.disable(); // Paper - spark
|
||||
@@ -1091,6 +1103,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.safeShutdown(waitForServer, false);
|
||||
}
|
||||
public void safeShutdown(boolean waitForServer, boolean isRestarting) {
|
||||
+ org.purpurmc.purpur.task.BossBarTask.stopAll(); // Purpur - Implement TPSBar
|
||||
+ org.purpurmc.purpur.task.BeehiveTask.instance().unregister(); // Purpur - Give bee counts in beehives to Purpur clients
|
||||
this.isRestarting = isRestarting;
|
||||
this.hasLoggedStop = true; // Paper - Debugging
|
||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||
@@ -1110,6 +1124,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
|
||||
private long lastTick = 0;
|
||||
private long catchupTime = 0;
|
||||
+ public final RollingAverage tps5s = new RollingAverage(5); // Purpur - Add 5 second tps average in /tps
|
||||
public final RollingAverage tps1 = new RollingAverage(60);
|
||||
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
||||
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
||||
@@ -1195,6 +1210,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// Paper end - Add onboarding message for initial server start
|
||||
|
||||
+ // Purpur start - config for startup commands
|
||||
+ if (!Boolean.getBoolean("Purpur.IReallyDontWantStartupCommands") && !org.purpurmc.purpur.PurpurConfig.startupCommands.isEmpty()) {
|
||||
+ LOGGER.info("Purpur: Running startup commands specified in purpur.yml.");
|
||||
+ for (final String startupCommand : org.purpurmc.purpur.PurpurConfig.startupCommands) {
|
||||
+ LOGGER.info("Purpur: Running the following command: \"{}\"", startupCommand);
|
||||
+ ((net.minecraft.server.dedicated.DedicatedServer) this).handleConsoleInput(startupCommand, this.createCommandSourceStack());
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - config for startup commands
|
||||
+
|
||||
while (this.running) {
|
||||
long l;
|
||||
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
|
||||
@@ -1219,14 +1244,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
|
||||
final long diff = currentTime - tickSection;
|
||||
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
+ tps5s.add(currentTps, diff); // Purpur - Add 5 second tps average in /tps
|
||||
tps1.add(currentTps, diff);
|
||||
tps5.add(currentTps, diff);
|
||||
tps15.add(currentTps, diff);
|
||||
|
||||
// Backwards compat with bad plugins
|
||||
- this.recentTps[0] = tps1.getAverage();
|
||||
- this.recentTps[1] = tps5.getAverage();
|
||||
- this.recentTps[2] = tps15.getAverage();
|
||||
+ // Purpur start - Add 5 second tps average in /tps
|
||||
+ this.recentTps[0] = tps5s.getAverage();
|
||||
+ this.recentTps[1] = tps1.getAverage();
|
||||
+ this.recentTps[2] = tps5.getAverage();
|
||||
+ this.recentTps[3] = tps15.getAverage();
|
||||
+ // Purpur end - Add 5 second tps average in /tps
|
||||
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
|
||||
tickSection = currentTime;
|
||||
}
|
||||
// Paper end - further improve server tick loop
|
||||
@@ -1258,6 +1288,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
profilerFiller.popPush("nextTickWait");
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
|
||||
+ // Purpur start - Configurable TPS Catchup
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup /*|| !gg.pufferfish.pufferfish.PufferfishConfig.tpsCatchup*/) { // Purpur - Configurable TPS Catchup
|
||||
+ this.nextTickTimeNanos = currentTime + l;
|
||||
+ this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos;
|
||||
+ }
|
||||
+ // Purpur end - Configurable TPS Catchup
|
||||
this.startMeasuringTaskExecutionTime();
|
||||
this.waitUntilNextTick();
|
||||
this.finishMeasuringTaskExecutionTime();
|
||||
@@ -1688,7 +1724,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long worldTime = level.getGameTime();
|
||||
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
||||
for (Player entityhuman : level.players()) {
|
||||
- if (!(entityhuman instanceof ServerPlayer) || (tickCount + entityhuman.getId()) % 20 != 0) {
|
||||
+ if (!(entityhuman instanceof ServerPlayer) || (!level.isForceTime() && (tickCount + entityhuman.getId()) % 20 != 0)) { // Purpur - Configurable daylight cycle
|
||||
continue;
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||
@@ -1853,7 +1889,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return io.papermc.paper.ServerBuildInfo.buildInfo().brandName(); // Paper
|
||||
+ return org.purpurmc.purpur.PurpurConfig.serverModName; // Paper // Purpur - Configurable server mod name
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport systemReport) {
|
||||
@@ -1,28 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/commands/EnchantCommand.java b/net/minecraft/server/commands/EnchantCommand.java
|
||||
index 709690044ec506c50a73197f5ba43e89f3403a5e..60baf9a5dc4a583d08007acb68bbed61768270d5 100644
|
||||
--- a/net/minecraft/server/commands/EnchantCommand.java
|
||||
+++ b/net/minecraft/server/commands/EnchantCommand.java
|
||||
@@ -70,7 +70,7 @@ public class EnchantCommand {
|
||||
|
||||
private static int enchant(CommandSourceStack source, Collection<? extends Entity> targets, Holder<Enchantment> enchantment, int level) throws CommandSyntaxException {
|
||||
Enchantment enchantment1 = enchantment.value();
|
||||
- if (level > enchantment1.getMaxLevel()) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchantCommand && level > enchantment1.getMaxLevel()) { // Purpur - Config to allow unsafe enchants
|
||||
throw ERROR_LEVEL_TOO_HIGH.create(level, enchantment1.getMaxLevel());
|
||||
} else {
|
||||
int i = 0;
|
||||
@@ -80,7 +80,7 @@ public class EnchantCommand {
|
||||
ItemStack mainHandItem = livingEntity.getMainHandItem();
|
||||
if (!mainHandItem.isEmpty()) {
|
||||
if (enchantment1.canEnchant(mainHandItem)
|
||||
- && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantmentsForCrafting(mainHandItem).keySet(), enchantment)) {
|
||||
+ && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantmentsForCrafting(mainHandItem).keySet(), enchantment) || (org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchantCommand && !mainHandItem.hasEnchantment(enchantment))) { // Purpur - Config to allow unsafe enchants
|
||||
mainHandItem.enchant(enchantment, level);
|
||||
i++;
|
||||
} else if (targets.size() == 1) {
|
||||
@@ -1,29 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/commands/GameModeCommand.java b/net/minecraft/server/commands/GameModeCommand.java
|
||||
index c44cdbbdc06b25bd20a208386545a10af9b96df8..a88b8f999b181071ebb492bc1afa2d72fff3748e 100644
|
||||
--- a/net/minecraft/server/commands/GameModeCommand.java
|
||||
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
||||
@@ -51,6 +51,18 @@ public class GameModeCommand {
|
||||
}
|
||||
|
||||
private static int setMode(CommandContext<CommandSourceStack> source, Collection<ServerPlayer> players, GameType gameType) {
|
||||
+ // Purpur start - Gamemode extra permissions
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
||||
+ String gamemode = gameType.getName();
|
||||
+ CommandSourceStack sender = source.getSource();
|
||||
+ if (!sender.testPermission(2, "minecraft.command.gamemode." + gamemode)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(2, "minecraft.command.gamemode." + gamemode + ".other")) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Gamemode extra permissions
|
||||
int i = 0;
|
||||
|
||||
for (ServerPlayer serverPlayer : players) {
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/commands/GiveCommand.java b/net/minecraft/server/commands/GiveCommand.java
|
||||
index b81f98738ef166336e4cc3092b6ba63f385b68e3..ca4bad763602f202423409ffb16f797f91a5dadc 100644
|
||||
--- a/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -66,6 +66,7 @@ public class GiveCommand {
|
||||
i1 -= min;
|
||||
ItemStack itemStack1 = item.createItemStack(min, false);
|
||||
boolean flag = serverPlayer.getInventory().add(itemStack1);
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping
|
||||
if (flag && itemStack1.isEmpty()) {
|
||||
ItemEntity itemEntity = serverPlayer.drop(itemStack, false);
|
||||
if (itemEntity != null) {
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServerProperties.java b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index f6518e29f805018c72222f5aaa7b662071665b65..5748658abf0b90812005ae9d426df92daf5532f0 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -49,6 +49,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
public final boolean onlineMode = this.get("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.get("server-ip", "");
|
||||
+ public final String serverName = this.get("server-name", "Unknown Server"); // Purpur - Bring back server name
|
||||
public final boolean pvp = this.get("pvp", true);
|
||||
public final boolean allowFlight = this.get("allow-flight", false);
|
||||
public final String motd = this.get("motd", "A Minecraft Server");
|
||||
@@ -1,144 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/gui/MinecraftServerGui.java b/net/minecraft/server/gui/MinecraftServerGui.java
|
||||
index f262a7c5ae4e7d56f16f5c0f4f145a2e428abbe4..614c7d9f673c926562acc8fa3b3788623900db41 100644
|
||||
--- a/net/minecraft/server/gui/MinecraftServerGui.java
|
||||
+++ b/net/minecraft/server/gui/MinecraftServerGui.java
|
||||
@@ -39,6 +39,11 @@ public class MinecraftServerGui extends JComponent {
|
||||
private Thread logAppenderThread;
|
||||
private final Collection<Runnable> finalizers = Lists.newArrayList();
|
||||
final AtomicBoolean isClosing = new AtomicBoolean();
|
||||
+ // Purpur start - GUI Improvements
|
||||
+ private final CommandHistory history = new CommandHistory();
|
||||
+ private String currentCommand = "";
|
||||
+ private int historyIndex = 0;
|
||||
+ // Purpur end - GUI Improvements
|
||||
|
||||
public static MinecraftServerGui showFrameFor(final DedicatedServer server) {
|
||||
try {
|
||||
@@ -46,7 +51,7 @@ public class MinecraftServerGui extends JComponent {
|
||||
} catch (Exception var3) {
|
||||
}
|
||||
|
||||
- final JFrame jFrame = new JFrame("Minecraft server");
|
||||
+ final JFrame jFrame = new JFrame("Purpur Minecraft server"); // Purpur - Improve GUI
|
||||
final MinecraftServerGui minecraftServerGui = new MinecraftServerGui(server);
|
||||
jFrame.setDefaultCloseOperation(2);
|
||||
jFrame.add(minecraftServerGui);
|
||||
@@ -54,7 +59,7 @@ public class MinecraftServerGui extends JComponent {
|
||||
jFrame.setLocationRelativeTo(null);
|
||||
jFrame.setVisible(true);
|
||||
// Paper start - Improve ServerGUI
|
||||
- jFrame.setName("Minecraft server");
|
||||
+ jFrame.setName("Purpur Minecraft server"); // Purpur - Improve GUI
|
||||
try {
|
||||
jFrame.setIconImage(javax.imageio.ImageIO.read(java.util.Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png"))));
|
||||
} catch (java.io.IOException ignore) {
|
||||
@@ -64,7 +69,7 @@ public class MinecraftServerGui extends JComponent {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent event) {
|
||||
if (!minecraftServerGui.isClosing.getAndSet(true)) {
|
||||
- jFrame.setTitle("Minecraft server - shutting down!");
|
||||
+ jFrame.setTitle("Purpur Minecraft server - shutting down!"); // Purpur - Improve GUI
|
||||
server.halt(true);
|
||||
minecraftServerGui.runFinalizers();
|
||||
}
|
||||
@@ -112,7 +117,7 @@ public class MinecraftServerGui extends JComponent {
|
||||
|
||||
private JComponent buildChatPanel() {
|
||||
JPanel jPanel = new JPanel(new BorderLayout());
|
||||
- JTextArea jTextArea = new JTextArea();
|
||||
+ org.purpurmc.purpur.gui.JColorTextPane jTextArea = new org.purpurmc.purpur.gui.JColorTextPane(); // Purpur - GUI Improvements
|
||||
JScrollPane jScrollPane = new JScrollPane(jTextArea, 22, 30);
|
||||
jTextArea.setEditable(false);
|
||||
jTextArea.setFont(MONOSPACED);
|
||||
@@ -121,10 +126,43 @@ public class MinecraftServerGui extends JComponent {
|
||||
String trimmed = jTextField.getText().trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
this.server.handleConsoleInput(trimmed, this.server.createCommandSourceStack());
|
||||
+ // Purpur start - GUI Improvements
|
||||
+ history.add(trimmed);
|
||||
+ historyIndex = -1;
|
||||
+ // Purpur end - GUI Improvements
|
||||
}
|
||||
|
||||
jTextField.setText("");
|
||||
});
|
||||
+ // Purpur start - GUI Improvements
|
||||
+ jTextField.getInputMap().put(javax.swing.KeyStroke.getKeyStroke("UP"), "up");
|
||||
+ jTextField.getInputMap().put(javax.swing.KeyStroke.getKeyStroke("DOWN"), "down");
|
||||
+ jTextField.getActionMap().put("up", new javax.swing.AbstractAction() {
|
||||
+ @Override
|
||||
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
|
||||
+ if (historyIndex < 0) {
|
||||
+ currentCommand = jTextField.getText();
|
||||
+ }
|
||||
+ if (historyIndex < history.size() - 1) {
|
||||
+ jTextField.setText(history.get(++historyIndex));
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ jTextField.getActionMap().put("down", new javax.swing.AbstractAction() {
|
||||
+ @Override
|
||||
+ public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
|
||||
+ if (historyIndex >= 0) {
|
||||
+ if (historyIndex == 0) {
|
||||
+ --historyIndex;
|
||||
+ jTextField.setText(currentCommand);
|
||||
+ } else {
|
||||
+ --historyIndex;
|
||||
+ jTextField.setText(history.get(historyIndex));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ // Purpur end - GUI Improvements
|
||||
jTextArea.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent event) {
|
||||
@@ -159,7 +197,7 @@ public class MinecraftServerGui extends JComponent {
|
||||
}
|
||||
|
||||
private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\e\\[[\\d;]*[^\\d;]"); // CraftBukkit // Paper
|
||||
- public void print(JTextArea textArea, JScrollPane scrollPane, String line) {
|
||||
+ public void print(org.purpurmc.purpur.gui.JColorTextPane textArea, JScrollPane scrollPane, String line) { // Purpur - GUI Improvements
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
SwingUtilities.invokeLater(() -> this.print(textArea, scrollPane, line));
|
||||
} else {
|
||||
@@ -170,10 +208,11 @@ public class MinecraftServerGui extends JComponent {
|
||||
flag = verticalScrollBar.getValue() + verticalScrollBar.getSize().getHeight() + MONOSPACED.getSize() * 4 > verticalScrollBar.getMaximum();
|
||||
}
|
||||
|
||||
- try {
|
||||
+ /*try { // Purpur - GUI Improvements
|
||||
document.insertString(document.getLength(), MinecraftServerGui.ANSI.matcher(line).replaceAll(""), null); // CraftBukkit
|
||||
} catch (BadLocationException var8) {
|
||||
- }
|
||||
+ }*/ // Purpur - GUI Improvements
|
||||
+ textArea.append(line); // Purpur - GUI Improvements
|
||||
|
||||
if (flag) {
|
||||
verticalScrollBar.setValue(Integer.MAX_VALUE);
|
||||
@@ -181,6 +220,18 @@ public class MinecraftServerGui extends JComponent {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - GUI Improvements
|
||||
+ public static class CommandHistory extends java.util.LinkedList<String> {
|
||||
+ @Override
|
||||
+ public boolean add(String command) {
|
||||
+ if (size() > 1000) {
|
||||
+ remove();
|
||||
+ }
|
||||
+ return super.offerFirst(command);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - GUI Improvements
|
||||
+
|
||||
// Paper start - Add onboarding message for initial server start
|
||||
private JComponent buildOnboardingPanel() {
|
||||
String onboardingLink = "https://docs.papermc.io/paper/next-steps";
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/gui/StatsComponent.java b/net/minecraft/server/gui/StatsComponent.java
|
||||
index 35fd539eb2bfe60ad17ab1e558a01273666acc54..103ff139dae918c991413ce9df61da3e22ee458a 100644
|
||||
--- a/net/minecraft/server/gui/StatsComponent.java
|
||||
+++ b/net/minecraft/server/gui/StatsComponent.java
|
||||
@@ -43,7 +43,7 @@ public class StatsComponent extends JComponent {
|
||||
}
|
||||
this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
|
||||
this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms";
|
||||
- this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg);
|
||||
+ this.msgs[2] = "TPS from last 5s, 1m, 5m, 15m: " + String.join(", ", tpsAvg); // Purpur - Add 5 second tps average in /tps
|
||||
// Paper end - Improve ServerGUI
|
||||
this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
|
||||
this.repaint();
|
||||
@@ -1,54 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index b604cba2490a747661d6819251bc3b9a1d35c7d4..3a596650feb96123c5684bb5065e20c5b005c0b9 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -348,6 +348,7 @@ public class ServerPlayerGameMode {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
+ if (this.player.level().purpurConfig.slabHalfBreak && this.player.isShiftKeyDown() && blockState.getBlock() instanceof net.minecraft.world.level.block.SlabBlock && ((net.minecraft.world.level.block.SlabBlock) blockState.getBlock()).halfBreak(blockState, pos, this.player)) return true; // Purpur - Break individual slabs when sneaking
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -461,6 +462,7 @@ public class ServerPlayerGameMode {
|
||||
public InteractionHand interactHand;
|
||||
public ItemStack interactItemStack;
|
||||
public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) {
|
||||
+ if (shiftClickMended(stack)) return InteractionResult.SUCCESS; // Purpur - Shift right click to use exp for mending
|
||||
BlockPos blockPos = hitResult.getBlockPos();
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
boolean cancelledBlock = false;
|
||||
@@ -503,7 +505,7 @@ public class ServerPlayerGameMode {
|
||||
boolean flag = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
|
||||
boolean flag1 = player.isSecondaryUseActive() && flag;
|
||||
ItemStack itemStack = stack.copy();
|
||||
- if (!flag1) {
|
||||
+ if (!flag1 || (player.level().purpurConfig.composterBulkProcess && blockState.is(net.minecraft.world.level.block.Blocks.COMPOSTER))) { // Purpur - Sneak to bulk process composter
|
||||
InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
|
||||
if (interactionResult.consumesAction()) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack);
|
||||
@@ -549,4 +551,18 @@ public class ServerPlayerGameMode {
|
||||
public void setLevel(ServerLevel serverLevel) {
|
||||
this.level = serverLevel;
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Shift right click to use exp for mending
|
||||
+ public boolean shiftClickMended(ItemStack itemstack) {
|
||||
+ if (this.player.level().purpurConfig.shiftRightClickRepairsMendingPoints > 0 && this.player.isShiftKeyDown() && this.player.getBukkitEntity().hasPermission("purpur.mending_shift_click")) {
|
||||
+ int points = Math.min(this.player.totalExperience, this.player.level().purpurConfig.shiftRightClickRepairsMendingPoints);
|
||||
+ if (points > 0 && itemstack.isDamaged() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.MENDING, itemstack) > 0) {
|
||||
+ this.player.giveExperiencePoints(itemstack.getDamageValue() == 1 ? -2 : -points);
|
||||
+ this.player.level().addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(this.player.level(), this.player.getX(), this.player.getY(), this.player.getZ(), points, org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN, this.player, this.player));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Shift right click to use exp for mending
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/WorldGenRegion.java b/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 11fed81a4696ba18440e755c3b8a5ca39ed8a6b1..18367ee56288c4cc60b66555583a8900e7a47daf 100644
|
||||
--- a/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -314,6 +314,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
return true;
|
||||
} else {
|
||||
// Paper start - Buffer OOB setBlock calls
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressSetBlockFarChunk) // Purpur - Logger settings (suppressing pointless logs)
|
||||
if (!hasSetFarWarned) {
|
||||
Util.logAndPauseIfInIde(
|
||||
"Detected setBlock in a far chunk ["
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 7950f4f88d8a83ed5610b7af4e134557d32da3f0..637b2eb7104cb0bc7f314ad6eea11a432e899861 100644
|
||||
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -306,7 +306,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!");
|
||||
ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(string1)); // Spigot
|
||||
} else {
|
||||
- ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.unverified_username"));
|
||||
+ ServerLoginPacketListenerImpl.this.disconnect(org.purpurmc.purpur.PurpurConfig.unverifiedUsername.equals("default") ? Component.translatable("multiplayer.disconnect.unverified_username") : io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.unverifiedUsername))); // Purpur - Config for unverified username message
|
||||
ServerLoginPacketListenerImpl.LOGGER.error("Username '{}' tried to join with an invalid session", string1);
|
||||
}
|
||||
} catch (AuthenticationUnavailableException var4) {
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
index 465559113071a47e706f77a5b0996597ee986b3d..1b966dc52b067cd9d1fa9f500b692e3f75f1cc90 100644
|
||||
--- a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
@@ -37,6 +37,7 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
// this.connection.send(new ClientboundStatusResponsePacket(this.status)); // Paper
|
||||
+ if (net.minecraft.server.MinecraftServer.getServer().getStatus().version().isEmpty()) return; // Purpur - Fix 'outdated server' showing in ping before server fully boots - do not respond to pings before we know the protocol version
|
||||
com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(net.minecraft.server.MinecraftServer.getServer(), this.connection); // Paper - handle status request
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/players/SleepStatus.java b/net/minecraft/server/players/SleepStatus.java
|
||||
index 2a7ae521654ad5c9f392baa5562e64bb71b13097..3a3e6992563236141db687084aeec9684437a7db 100644
|
||||
--- a/net/minecraft/server/players/SleepStatus.java
|
||||
+++ b/net/minecraft/server/players/SleepStatus.java
|
||||
@@ -15,7 +15,7 @@ public class SleepStatus {
|
||||
|
||||
public boolean areEnoughDeepSleeping(int requiredSleepPercentage, List<ServerPlayer> sleepingPlayers) {
|
||||
// CraftBukkit start
|
||||
- int i = (int) sleepingPlayers.stream().filter(player -> player.isSleepingLongEnough() || player.fauxSleeping).count();
|
||||
+ int i = (int) sleepingPlayers.stream().filter(player -> player.isSleepingLongEnough() || player.fauxSleeping || (player.level().purpurConfig.idleTimeoutCountAsSleeping && player.isAfk())).count(); // Purpur - AFK API
|
||||
boolean anyDeepSleep = sleepingPlayers.stream().anyMatch(Player::isSleepingLongEnough);
|
||||
return anyDeepSleep && i >= this.sleepersNeeded(requiredSleepPercentage);
|
||||
// CraftBukkit end
|
||||
@@ -43,7 +43,7 @@ public class SleepStatus {
|
||||
for (ServerPlayer serverPlayer : players) {
|
||||
if (!serverPlayer.isSpectator()) {
|
||||
this.activePlayers++;
|
||||
- if (serverPlayer.isSleeping() || serverPlayer.fauxSleeping) { // CraftBukkit
|
||||
+ if (serverPlayer.isSleeping() || serverPlayer.fauxSleeping || (serverPlayer.level().purpurConfig.idleTimeoutCountAsSleeping && serverPlayer.isAfk())) { // CraftBukkit // Purpur - AFK API
|
||||
this.sleepingPlayers++;
|
||||
}
|
||||
// CraftBukkit start
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/stats/ServerRecipeBook.java b/net/minecraft/stats/ServerRecipeBook.java
|
||||
index 2158b20458de63897131db3d425d1efcc358cace..7bd35dba7c7536e5451603759e004e1e31a9b614 100644
|
||||
--- a/net/minecraft/stats/ServerRecipeBook.java
|
||||
+++ b/net/minecraft/stats/ServerRecipeBook.java
|
||||
@@ -133,6 +133,7 @@ public class ServerRecipeBook extends RecipeBook {
|
||||
private void loadRecipes(List<ResourceKey<Recipe<?>>> recipes, Consumer<ResourceKey<Recipe<?>>> output, Predicate<ResourceKey<Recipe<?>>> isRecognized) {
|
||||
for (ResourceKey<Recipe<?>> resourceKey : recipes) {
|
||||
if (!isRecognized.test(resourceKey)) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur - Logger settings (suppressing pointless logs)
|
||||
LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey);
|
||||
} else {
|
||||
output.accept(resourceKey);
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/util/StringUtil.java b/net/minecraft/util/StringUtil.java
|
||||
index 77947e6915facee44588943fcd3e5b513de37e77..c3a99fe7b49858bc0ca9a7f800b0db40465f6901 100644
|
||||
--- a/net/minecraft/util/StringUtil.java
|
||||
+++ b/net/minecraft/util/StringUtil.java
|
||||
@@ -87,6 +87,7 @@ public class StringUtil {
|
||||
|
||||
// Paper start - Username validation
|
||||
public static boolean isReasonablePlayerName(final String name) {
|
||||
+ if (true) return org.purpurmc.purpur.PurpurConfig.usernameValidCharactersPattern.matcher(name).matches(); // Purpur - Configurable valid characters for usernames
|
||||
if (name.isEmpty() || name.length() > 16) {
|
||||
return false;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/damagesource/CombatRules.java b/net/minecraft/world/damagesource/CombatRules.java
|
||||
index d5524038314591a10c9f08a68e2ac91f6079a897..bf82de45bf98e8605a1fdb69803f75f471c4af43 100644
|
||||
--- a/net/minecraft/world/damagesource/CombatRules.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatRules.java
|
||||
@@ -15,7 +15,7 @@ public class CombatRules {
|
||||
|
||||
public static float getDamageAfterAbsorb(LivingEntity entity, float damage, DamageSource damageSource, float armorValue, float armorToughness) {
|
||||
float f = 2.0F + armorToughness / 4.0F;
|
||||
- float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, 20.0F);
|
||||
+ float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
float f2 = f1 / 25.0F;
|
||||
ItemStack weaponItem = damageSource.getWeaponItem();
|
||||
float f3;
|
||||
@@ -30,7 +30,7 @@ public class CombatRules {
|
||||
}
|
||||
|
||||
public static float getDamageAfterMagicAbsorb(float damage, float enchantModifiers) {
|
||||
- float f = Mth.clamp(enchantModifiers, 0.0F, 20.0F);
|
||||
+ float f = Mth.clamp(enchantModifiers, 0.0F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
return damage * (1.0F - f / 25.0F);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/damagesource/CombatTracker.java b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
index 4cec197634fac341cca1ed108f1ecb0561f72461..aa6213ca382e4901363317df1e30332c5166f271 100644
|
||||
--- a/net/minecraft/world/damagesource/CombatTracker.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
@@ -64,7 +64,7 @@ public class CombatTracker {
|
||||
|
||||
private Component getMessageForAssistedFall(Entity entity, Component entityDisplayName, String hasWeaponTranslationKey, String noWeaponTranslationKey) {
|
||||
ItemStack itemStack = entity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY;
|
||||
- return !itemStack.isEmpty() && itemStack.has(DataComponents.CUSTOM_NAME)
|
||||
+ return !itemStack.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || itemStack.has(DataComponents.CUSTOM_NAME)) // Purpur - always show item in player death messages
|
||||
? Component.translatable(hasWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName, itemStack.getDisplayName())
|
||||
: Component.translatable(noWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName);
|
||||
}
|
||||
@@ -108,6 +108,15 @@ public class CombatTracker {
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
|
||||
return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
|
||||
} else {
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (damageSource.isScissors()) {
|
||||
+ return damageSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgRunWithScissors, this.mob);
|
||||
+ // Purpur start - Stonecutter damage
|
||||
+ } else if (damageSource.isStonecutter()) {
|
||||
+ return damageSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgStonecutter, this.mob);
|
||||
+ // Purpur end - Stonecutter damage
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
return damageSource.getLocalizedDeathMessage(this.mob);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/damagesource/DamageSource.java b/net/minecraft/world/damagesource/DamageSource.java
|
||||
index bb021fc9de91f8c4f79e6a753d57fa157efbbda7..5fa92eef9c6b88cf96d3fe427e4d4f16953e8094 100644
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -30,6 +30,8 @@ public class DamageSource {
|
||||
@Nullable
|
||||
private org.bukkit.block.BlockState fromBlockSnapshot; // Captured block snapshot when the eventBlockDamager is not relevant (e.g. for bad respawn point explosions the block is already removed)
|
||||
private boolean critical; // Supports arrows and sweeping damage
|
||||
+ private boolean scissors = false; // Purpur - Dont run with scissors!
|
||||
+ private boolean stonecutter = false; // Purpur - Stonecutter damage
|
||||
|
||||
public DamageSource knownCause(final org.bukkit.event.entity.EntityDamageEvent.DamageCause cause) {
|
||||
final DamageSource damageSource = this.copy();
|
||||
@@ -42,6 +44,30 @@ public class DamageSource {
|
||||
return this.knownCause;
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ this.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.SUICIDE);
|
||||
+ this.scissors = true;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isScissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
+ // Purpur start - - Stonecutter damage
|
||||
+ public DamageSource stonecutter() {
|
||||
+ this.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.CONTACT);
|
||||
+ this.stonecutter = true;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isStonecutter() {
|
||||
+ return this.stonecutter;
|
||||
+ }
|
||||
+ // Purpur end - Stonecutter damage
|
||||
+
|
||||
@Nullable
|
||||
public Entity eventEntityDamager() {
|
||||
return this.eventEntityDamager;
|
||||
@@ -103,6 +129,8 @@ public class DamageSource {
|
||||
damageSource.eventBlockDamager = this.eventBlockDamager;
|
||||
damageSource.fromBlockSnapshot = this.fromBlockSnapshot;
|
||||
damageSource.critical = this.critical;
|
||||
+ damageSource.scissors = this.isScissors(); // Purpur - Dont run with scissors!
|
||||
+ damageSource.stonecutter = this.isStonecutter(); // Purpur - Stonecutter damage
|
||||
return damageSource;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -169,12 +197,21 @@ public class DamageSource {
|
||||
} else {
|
||||
Component component = this.causingEntity == null ? this.directEntity.getDisplayName() : this.causingEntity.getDisplayName();
|
||||
ItemStack itemStack = this.causingEntity instanceof LivingEntity livingEntity1 ? livingEntity1.getMainHandItem() : ItemStack.EMPTY;
|
||||
- return !itemStack.isEmpty() && itemStack.has(DataComponents.CUSTOM_NAME)
|
||||
+ return !itemStack.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || itemStack.has(DataComponents.CUSTOM_NAME)) // Purpur - always show item in player death messages
|
||||
? Component.translatable(string + ".item", livingEntity.getDisplayName(), component, itemStack.getDisplayName())
|
||||
: Component.translatable(string, livingEntity.getDisplayName(), component);
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Component related conveniences
|
||||
+ public Component getLocalizedDeathMessage(String str, LivingEntity entity) {
|
||||
+ net.kyori.adventure.text.Component name = io.papermc.paper.adventure.PaperAdventure.asAdventure(entity.getDisplayName());
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.TagResolver template = net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("player", name);
|
||||
+ net.kyori.adventure.text.Component component = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(str, template);
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asVanilla(component);
|
||||
+ }
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
public String getMsgId() {
|
||||
return this.type().msgId();
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/damagesource/DamageSources.java b/net/minecraft/world/damagesource/DamageSources.java
|
||||
index cc206ecff2d95f0398ca424c178a336ad80cc396..7afad362801082e5f2e3aceda864ad2a7d4e5ebb 100644
|
||||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -42,6 +42,8 @@ public class DamageSources {
|
||||
private final DamageSource stalagmite;
|
||||
private final DamageSource outsideBorder;
|
||||
private final DamageSource genericKill;
|
||||
+ private final DamageSource scissors; // Purpur - Dont run with scissors!
|
||||
+ private final DamageSource stonecutter; // Purpur - Stonecutter damage
|
||||
|
||||
public DamageSources(RegistryAccess registry) {
|
||||
this.damageTypes = registry.lookupOrThrow(Registries.DAMAGE_TYPE);
|
||||
@@ -70,6 +72,8 @@ public class DamageSources {
|
||||
this.stalagmite = this.source(DamageTypes.STALAGMITE);
|
||||
this.outsideBorder = this.source(DamageTypes.OUTSIDE_BORDER);
|
||||
this.genericKill = this.source(DamageTypes.GENERIC_KILL);
|
||||
+ this.scissors = this.source(DamageTypes.MAGIC).scissors(); // Purpur - Dont run with scissors!
|
||||
+ this.stonecutter = this.source(DamageTypes.MAGIC).stonecutter(); // Purpur - Stonecutter damage
|
||||
}
|
||||
|
||||
private DamageSource source(ResourceKey<DamageType> damageTypeKey) {
|
||||
@@ -84,6 +88,18 @@ public class DamageSources {
|
||||
return new DamageSource(this.damageTypes.getOrThrow(damageTypeKey), causingEntity, directEntity);
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissor
|
||||
+ public DamageSource scissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
+ // Purpur start - Stonecutter damage
|
||||
+ public DamageSource stonecutter() {
|
||||
+ return this.stonecutter;
|
||||
+ }
|
||||
+ // Purpur end - Stonecutter damage
|
||||
+
|
||||
public DamageSource inFire() {
|
||||
return this.inFire;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/effect/HungerMobEffect.java b/net/minecraft/world/effect/HungerMobEffect.java
|
||||
index 0890694ae96b6cd60079c34066e7a6e288f038e8..6c0e6bd2a171edc57dec71af178764454de73313 100644
|
||||
--- a/net/minecraft/world/effect/HungerMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/HungerMobEffect.java
|
||||
@@ -12,7 +12,7 @@ class HungerMobEffect extends MobEffect {
|
||||
@Override
|
||||
public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) {
|
||||
if (entity instanceof Player player) {
|
||||
- player.causeFoodExhaustion(0.005F * (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
+ player.causeFoodExhaustion(entity.level().purpurConfig.humanHungerExhaustionAmount * (amplifier + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent // Purpur - Config MobEffect by world
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1,21 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/effect/PoisonMobEffect.java b/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
index 75327fd96858fd508ea63a6983e5cbc655a8800f..73cfc61ac3f8e33e6b9f4fd08a292266c0adb535 100644
|
||||
--- a/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
@@ -12,8 +12,8 @@ public class PoisonMobEffect extends MobEffect {
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) {
|
||||
- if (entity.getHealth() > 1.0F) {
|
||||
- entity.hurtServer(level, entity.damageSources().magic().knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.POISON), 1.0F); // CraftBukkit
|
||||
+ if (entity.getHealth() > entity.level().purpurConfig.entityMinimalHealthPoison) { // Purpur
|
||||
+ entity.hurtServer(level, entity.damageSources().magic().knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.POISON), entity.level().purpurConfig.entityPoisonDegenerationAmount); // CraftBukkit // Purpur - Config MobEffect by world
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/effect/RegenerationMobEffect.java b/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
index 76cffa4d4d18d6c04749d941dbdf5eb60aed4095..81481267a1577721dcc405f39a4c350bd59ac9a2 100644
|
||||
--- a/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
@@ -11,7 +11,7 @@ class RegenerationMobEffect extends MobEffect {
|
||||
@Override
|
||||
public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) {
|
||||
if (entity.getHealth() < entity.getMaxHealth()) {
|
||||
- entity.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit
|
||||
+ entity.heal(entity.level().purpurConfig.entityHealthRegenAmount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit // Purpur - Config MobEffect by world
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1,20 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/effect/SaturationMobEffect.java b/net/minecraft/world/effect/SaturationMobEffect.java
|
||||
index c192165910f6b139df6f604d0bce989061efa9cb..622c23f4570d07de8bee9623bf900aabb3331ded 100644
|
||||
--- a/net/minecraft/world/effect/SaturationMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/SaturationMobEffect.java
|
||||
@@ -16,7 +16,8 @@ class SaturationMobEffect extends InstantenousMobEffect {
|
||||
int oldFoodLevel = player.getFoodData().foodLevel;
|
||||
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(player, amplifier + 1 + oldFoodLevel);
|
||||
if (!event.isCancelled()) {
|
||||
- player.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F);
|
||||
+ if (player.level().purpurConfig.playerBurpWhenFull && event.getFoodLevel() == 20 && oldFoodLevel < 20) player.burpDelay = player.level().purpurConfig.playerBurpDelay; // Purpur - Burp delay
|
||||
+ player.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, entity.level().purpurConfig.humanSaturationRegenAmount); // Purpur - Config MobEffect by world
|
||||
}
|
||||
|
||||
((org.bukkit.craftbukkit.entity.CraftPlayer) player.getBukkitEntity()).sendHealthUpdate();
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/effect/WitherMobEffect.java b/net/minecraft/world/effect/WitherMobEffect.java
|
||||
index 1fc9e1ad541c46124183a401b2a7d99aea69cecf..881271f0bc77a8a8a7d31daad9a8188bebaca67b 100644
|
||||
--- a/net/minecraft/world/effect/WitherMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/WitherMobEffect.java
|
||||
@@ -12,7 +12,7 @@ public class WitherMobEffect extends MobEffect {
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) {
|
||||
- entity.hurtServer(level, entity.damageSources().wither(), 1.0F);
|
||||
+ entity.hurtServer(level, entity.damageSources().wither(), entity.level().purpurConfig.entityWitherDegenerationAmount); // Purpur - Config MobEffect by world
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/EntitySelector.java b/net/minecraft/world/entity/EntitySelector.java
|
||||
index bfd58eb04eee606ac0a8071de9bf75f46c35decb..0c1953754220ff72e18f0396134507d93ba7b1b8 100644
|
||||
--- a/net/minecraft/world/entity/EntitySelector.java
|
||||
+++ b/net/minecraft/world/entity/EntitySelector.java
|
||||
@@ -28,6 +28,8 @@ public final class EntitySelector {
|
||||
return net.minecraft.util.Mth.clamp(serverPlayer.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= playerInsomniaTicks;
|
||||
};
|
||||
// Paper end - Ability to control player's insomnia and phantoms
|
||||
+ public static Predicate<Player> notAfk = (player) -> !player.isAfk(); // Purpur - AFK API
|
||||
+
|
||||
// Paper start - Affects Spawning API
|
||||
public static final Predicate<Entity> PLAYER_AFFECTS_SPAWNING = (entity) -> {
|
||||
return !entity.isSpectator() && entity.isAlive() && entity instanceof Player player && player.affectsSpawning;
|
||||
@@ -1,24 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/GlowSquid.java b/net/minecraft/world/entity/GlowSquid.java
|
||||
index 3f351fdb3cb76612d88bde713a2639d4319a7c6d..bda521cca91f070139f5e9bdef6a50e1497f53ff 100644
|
||||
--- a/net/minecraft/world/entity/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/GlowSquid.java
|
||||
@@ -26,6 +26,13 @@ public class GlowSquid extends Squid {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Flying squids! Oh my!
|
||||
+ @Override
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.glowSquidsCanFly;
|
||||
+ }
|
||||
+ // Purpur end - Flying squids! Oh my!
|
||||
+
|
||||
@Override
|
||||
protected ParticleOptions getInkParticle() {
|
||||
return ParticleTypes.GLOW_SQUID_INK;
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/attributes/RangedAttribute.java b/net/minecraft/world/entity/ai/attributes/RangedAttribute.java
|
||||
index a87accd5fe14102e7a2938f991a8ed0b9accd1bb..c7515f7f24e39d6931dcf18574cb47d754983903 100644
|
||||
--- a/net/minecraft/world/entity/ai/attributes/RangedAttribute.java
|
||||
+++ b/net/minecraft/world/entity/ai/attributes/RangedAttribute.java
|
||||
@@ -29,6 +29,7 @@ public class RangedAttribute extends Attribute {
|
||||
|
||||
@Override
|
||||
public double sanitizeValue(double value) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.clampAttributes) return Double.isNaN(value) ? this.minValue : value; // Purpur - Add attribute clamping and armor limit config
|
||||
return Double.isNaN(value) ? this.minValue : Mth.clamp(value, this.minValue, this.maxValue);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java b/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java
|
||||
index 296ecffbbce931b42c67ea523373a61cea23acf4..b2eec24be3635f2c19da9b147211fe6cb454c780 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java
|
||||
@@ -55,7 +55,7 @@ public class InteractWithDoor {
|
||||
Node nextNode = path.getNextNode();
|
||||
BlockPos blockPos = previousNode.asBlockPos();
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
- if (blockState.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)) {
|
||||
+ if (blockState.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)&& !DoorBlock.requiresRedstone(entity.level(), blockState, blockPos)) { // Purpur - Option to make doors require redstone
|
||||
DoorBlock doorBlock = (DoorBlock)blockState.getBlock();
|
||||
if (!doorBlock.isOpen(blockState)) {
|
||||
// CraftBukkit start - entities opening doors
|
||||
@@ -72,7 +72,7 @@ public class InteractWithDoor {
|
||||
|
||||
BlockPos blockPos1 = nextNode.asBlockPos();
|
||||
BlockState blockState1 = level.getBlockState(blockPos1);
|
||||
- if (blockState1.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)) {
|
||||
+ if (blockState1.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock) && !DoorBlock.requiresRedstone(entity.level(), blockState1, blockPos1)) { // Purpur - Option to make doors require redstone
|
||||
DoorBlock doorBlock1 = (DoorBlock)blockState1.getBlock();
|
||||
if (!doorBlock1.isOpen(blockState1)) {
|
||||
// CraftBukkit start - entities opening doors
|
||||
@@ -118,7 +118,7 @@ public class InteractWithDoor {
|
||||
iterator.remove();
|
||||
} else {
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
- if (!blockState.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)) {
|
||||
+ if (!blockState.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock) || DoorBlock.requiresRedstone(entity.level(), blockState, blockPos)) { // Purpur - Option to make doors require redstone
|
||||
iterator.remove();
|
||||
} else {
|
||||
DoorBlock doorBlock = (DoorBlock)blockState.getBlock();
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java b/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java
|
||||
index 400e6d49144b3e5803901938dcd2ac4e52e9c131..45c45afeffcfba3558bdf46cbe39ff60004ffc01 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java
|
||||
@@ -46,6 +46,7 @@ public class ShowTradesToPlayer extends Behavior<Villager> {
|
||||
|
||||
@Override
|
||||
public boolean canStillUse(ServerLevel level, Villager entity, long gameTime) {
|
||||
+ if (!entity.level().purpurConfig.villagerDisplayTradeItem) return false; // Purpur - Option for villager display trade item
|
||||
return this.checkExtraStartConditions(level, entity)
|
||||
&& this.lookTime > 0
|
||||
&& entity.getBrain().getMemory(MemoryModuleType.INTERACTION_TARGET).isPresent();
|
||||
@@ -1,26 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java b/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java
|
||||
index 6eaf0bd944349cd0c6084462ac385fa2caafe933..be59d0c27a83b329ec3f97c029cfb9c114e22472 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java
|
||||
@@ -22,6 +22,7 @@ public class LlamaFollowCaravanGoal extends Goal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
+ if (!this.llama.level().purpurConfig.llamaJoinCaravans || !this.llama.shouldJoinCaravan) return false; // Purpur - Llama API // Purpur - Config to disable Llama caravans
|
||||
if (!this.llama.isLeashed() && !this.llama.inCaravan()) {
|
||||
List<Entity> entities = this.llama.level().getEntities(this.llama, this.llama.getBoundingBox().inflate(9.0, 4.0, 9.0), entity1 -> {
|
||||
EntityType<?> type = entity1.getType();
|
||||
@@ -71,6 +72,7 @@ public class LlamaFollowCaravanGoal extends Goal {
|
||||
|
||||
@Override
|
||||
public boolean canContinueToUse() {
|
||||
+ if (!this.llama.shouldJoinCaravan) return false; // Purpur - Llama API
|
||||
if (this.llama.inCaravan() && this.llama.getCaravanHead().isAlive() && this.firstIsLeashed(this.llama, 0)) {
|
||||
double d = this.llama.distanceToSqr(this.llama.getCaravanHead());
|
||||
if (d > 676.0) {
|
||||
@@ -1,22 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java
|
||||
index 722f378bb3726200b6fe88948bf1e1d3514a7b5c..e337e22c2cf82b0c1cab3fe0a9ff894c0c718716 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java
|
||||
@@ -116,9 +116,9 @@ public class RangedBowAttackGoal<T extends Monster & RangedAttackMob> extends Go
|
||||
}
|
||||
|
||||
this.mob.lookAt(target, 30.0F, 30.0F);
|
||||
- } else {
|
||||
+ } //else { // Purpur - MC-121706 - Fix mobs not looking up and down when strafing
|
||||
this.mob.getLookControl().setLookAt(target, 30.0F, 30.0F);
|
||||
- }
|
||||
+ //} // Purpur - MC-121706 - Fix mobs not looking up and down when strafing
|
||||
|
||||
if (this.mob.isUsingItem()) {
|
||||
if (!hasLineOfSight && this.seeTime < -60) {
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java b/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
index 878d7813b3f2f52bef336c6d855d738bc2f83491..d0f94f065d2ecf6ca6b47ac49422ffa656a18f55 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
@@ -58,7 +58,7 @@ public class RunAroundLikeCrazyGoal extends Goal {
|
||||
if (firstPassenger instanceof Player player) {
|
||||
int temper = this.horse.getTemper();
|
||||
int maxTemper = this.horse.getMaxTemper();
|
||||
- if (maxTemper > 0 && this.horse.getRandom().nextInt(maxTemper) < temper && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) { // CraftBukkit - fire EntityTameEvent
|
||||
+ if (((this.horse.level().purpurConfig.alwaysTameInCreative && player.hasInfiniteMaterials()) || (maxTemper > 0 && this.horse.getRandom().nextInt(maxTemper) < temper)) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) { // CraftBukkit - fire EntityTameEvent // Purpur - Config to always tame in Creative
|
||||
this.horse.tameWithName(player);
|
||||
return;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/SwellGoal.java b/net/minecraft/world/entity/ai/goal/SwellGoal.java
|
||||
index 243a552f6f0c8c2bd25c0209c95e3bca08734711..38fd0196a0f5a90e39fa4eb8592f89bf6b88ccf5 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/SwellGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/SwellGoal.java
|
||||
@@ -55,6 +55,14 @@ public class SwellGoal extends Goal {
|
||||
this.creeper.setSwellDir(-1);
|
||||
} else {
|
||||
this.creeper.setSwellDir(1);
|
||||
+ // Purpur start - option to allow creeper to encircle target when fusing
|
||||
+ if (this.creeper.level().purpurConfig.creeperEncircleTarget) {
|
||||
+ net.minecraft.world.phys.Vec3 relative = this.creeper.position().subtract(this.target.position());
|
||||
+ relative = relative.yRot((float) Math.PI / 3).normalize().multiply(2, 2, 2);
|
||||
+ net.minecraft.world.phys.Vec3 destination = this.target.position().add(relative);
|
||||
+ this.creeper.getNavigation().moveTo(destination.x, destination.y, destination.z, 1);
|
||||
+ }
|
||||
+ // Purpur end - option to allow creeper to encircle target when fusing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
index 2f8920d8ee765d057a22d76f24f7d7dc1b0b17ca..6f0fcaeaba2fec2ad944d63550f0c3e29bd9133c 100644
|
||||
--- a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
+++ b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
@@ -64,6 +64,10 @@ public class TargetingConditions {
|
||||
return false;
|
||||
} else if (this.selector != null && !this.selector.test(target, level)) {
|
||||
return false;
|
||||
+ // Purpur start - AFK API
|
||||
+ } else if (!level.purpurConfig.idleTimeoutTargetPlayer && target instanceof net.minecraft.server.level.ServerPlayer player && player.isAfk()) {
|
||||
+ return false;
|
||||
+ // Purpur end - AFK API
|
||||
} else {
|
||||
if (entity == null) {
|
||||
if (this.isCombat && (!target.canBeSeenAsEnemy() || level.getDifficulty() == Difficulty.PEACEFUL)) {
|
||||
@@ -1,31 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ambient/Bat.java b/net/minecraft/world/entity/ambient/Bat.java
|
||||
index eb9fb57440f498079182030a46034008d3f6b5e8..ed8920bb6d29ce49626bc716aa2c2ce938f6d92b 100644
|
||||
--- a/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -232,7 +232,7 @@ public class Bat extends AmbientCreature {
|
||||
} else {
|
||||
int maxLocalRawBrightness = level.getMaxLocalRawBrightness(pos);
|
||||
int i = 4;
|
||||
- if (isHalloween()) {
|
||||
+ if (Bat.isHalloweenSeason(level.getMinecraftWorld())) { // Purpur - Halloween options and optimizations
|
||||
i = 7;
|
||||
} else if (randomSource.nextBoolean()) {
|
||||
return false;
|
||||
@@ -244,6 +244,11 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Pufferfish start - only check for spooky season once an hour
|
||||
+ //private static boolean isSpookySeason = false;
|
||||
+ //private static final int ONE_HOUR = 20 * 60 * 60;
|
||||
+ //private static int lastSpookyCheck = -ONE_HOUR;
|
||||
+ public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur - Halloween options and optimizations
|
||||
private static boolean isHalloween() {
|
||||
LocalDate localDate = LocalDate.now();
|
||||
int i = localDate.get(ChronoField.DAY_OF_MONTH);
|
||||
@@ -1,98 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/AbstractCow.java b/net/minecraft/world/entity/animal/AbstractCow.java
|
||||
index dd8ea03ba823996a5c97562e357650ab34d0e32e..4e81bc7215c845b316bcd46ce29f49af7f986088 100644
|
||||
--- a/net/minecraft/world/entity/animal/AbstractCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/AbstractCow.java
|
||||
@@ -39,7 +39,7 @@ public abstract class AbstractCow extends Animal {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0));
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
|
||||
- this.goalSelector.addGoal(3, new TemptGoal(this, 1.25, itemStack -> itemStack.is(ItemTags.COW_FOOD), false));
|
||||
+ this.goalSelector.addGoal(3, new TemptGoal(this, 1.25, itemStack -> level().purpurConfig.cowFeedMushrooms > 0 && (itemStack.is(net.minecraft.world.level.block.Blocks.RED_MUSHROOM.asItem()) || itemStack.is(net.minecraft.world.level.block.Blocks.BROWN_MUSHROOM.asItem())) || itemStack.is(ItemTags.COW_FOOD), false)); // Purpur - Cows eat mushrooms
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
@@ -95,6 +95,10 @@ public abstract class AbstractCow extends Animal {
|
||||
ItemStack itemStack = ItemUtils.createFilledResult(itemInHand, player, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
player.setItemInHand(hand, itemStack);
|
||||
return InteractionResult.SUCCESS;
|
||||
+ // Purpur start - Cows eat mushrooms - feed mushroom to change to mooshroom
|
||||
+ } else if (level().purpurConfig.cowFeedMushrooms > 0 && this.getType() != EntityType.MOOSHROOM && isMushroom(itemInHand)) {
|
||||
+ return this.feedMushroom(player, itemInHand);
|
||||
+ // Purpur end - Cows eat mushrooms
|
||||
} else {
|
||||
return super.mobInteract(player, hand);
|
||||
}
|
||||
@@ -104,4 +108,67 @@ public abstract class AbstractCow extends Animal {
|
||||
public EntityDimensions getDefaultDimensions(Pose pose) {
|
||||
return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose);
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Cows eat mushrooms - feed mushroom to change to mooshroom
|
||||
+ private int redMushroomsFed = 0;
|
||||
+ private int brownMushroomsFed = 0;
|
||||
+
|
||||
+ private boolean isMushroom(ItemStack stack) {
|
||||
+ return stack.getItem() == net.minecraft.world.level.block.Blocks.RED_MUSHROOM.asItem() || stack.getItem() == net.minecraft.world.level.block.Blocks.BROWN_MUSHROOM.asItem();
|
||||
+ }
|
||||
+
|
||||
+ private int incrementFeedCount(ItemStack stack) {
|
||||
+ if (stack.getItem() == net.minecraft.world.level.block.Blocks.RED_MUSHROOM.asItem()) {
|
||||
+ return ++redMushroomsFed;
|
||||
+ } else {
|
||||
+ return ++brownMushroomsFed;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private InteractionResult feedMushroom(Player player, ItemStack stack) {
|
||||
+ level().broadcastEntityEvent(this, (byte) 18); // hearts
|
||||
+ playSound(SoundEvents.COW_MILK, 1.0F, 1.0F);
|
||||
+ if (incrementFeedCount(stack) < level().purpurConfig.cowFeedMushrooms) {
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
+ return InteractionResult.CONSUME; // require 5 mushrooms to transform (prevents mushroom duping)
|
||||
+ }
|
||||
+ MushroomCow mooshroom = EntityType.MOOSHROOM.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
|
||||
+ if (mooshroom == null) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ if (stack.getItem() == net.minecraft.world.level.block.Blocks.BROWN_MUSHROOM.asItem()) {
|
||||
+ mooshroom.setVariant(MushroomCow.Variant.BROWN);
|
||||
+ } else {
|
||||
+ mooshroom.setVariant(MushroomCow.Variant.RED);
|
||||
+ }
|
||||
+ mooshroom.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
+ mooshroom.setHealth(this.getHealth());
|
||||
+ mooshroom.setAge(getAge());
|
||||
+ mooshroom.copyPosition(this);
|
||||
+ mooshroom.setYBodyRot(this.yBodyRot);
|
||||
+ mooshroom.setYHeadRot(this.getYHeadRot());
|
||||
+ mooshroom.yRotO = this.yRotO;
|
||||
+ mooshroom.xRotO = this.xRotO;
|
||||
+ if (this.hasCustomName()) {
|
||||
+ mooshroom.setCustomName(this.getCustomName());
|
||||
+ }
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, mooshroom, org.bukkit.event.entity.EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ this.level().addFreshEntity(mooshroom);
|
||||
+ this.remove(RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
+ for (int i = 0; i < 15; ++i) {
|
||||
+ ((net.minecraft.server.level.ServerLevel) level()).sendParticlesSource(((net.minecraft.server.level.ServerLevel) level()).players(), null, net.minecraft.core.particles.ParticleTypes.HAPPY_VILLAGER,
|
||||
+ false, true,
|
||||
+ getX() + random.nextFloat(), getY() + (random.nextFloat() * 2), getZ() + random.nextFloat(), 1,
|
||||
+ random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, 0);
|
||||
+ }
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end - Cows eat mushrooms
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java
|
||||
index edca2fa21e600fa1e7ef91af673adaae7d4c86c4..585131365c40136cf8a8a715b077982091ee38d5 100644
|
||||
--- a/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -167,7 +167,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
// Paper end - Fix MC-167279
|
||||
this.lookControl = new Bee.BeeLookControl(this);
|
||||
this.setPathfindingMalus(PathType.DANGER_FIRE, -1.0F);
|
||||
- this.setPathfindingMalus(PathType.WATER, -1.0F);
|
||||
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning) this.setPathfindingMalus(PathType.WATER, -1.0F); // Purpur - bee can instantly start drowning in water option
|
||||
this.setPathfindingMalus(PathType.WATER_BORDER, 16.0F);
|
||||
this.setPathfindingMalus(PathType.COCOA, -1.0F);
|
||||
this.setPathfindingMalus(PathType.FENCE, -1.0F);
|
||||
@@ -365,7 +365,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
|
||||
public static boolean isNightOrRaining(Level level) {
|
||||
- return level.dimensionType().hasSkyLight() && (level.isDarkOutside() || level.isRaining());
|
||||
+ return level.dimensionType().hasSkyLight() && (level.isDarkOutside() && !level.purpurConfig.beeCanWorkAtNight || level.isRaining() && !level.purpurConfig.beeCanWorkInRain); // Purpur - Bee can work when raining or at night
|
||||
}
|
||||
|
||||
public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) {
|
||||
@@ -388,7 +388,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@Override
|
||||
protected void customServerAiStep(ServerLevel level) {
|
||||
boolean hasStung = this.hasStung();
|
||||
- if (this.isInWater()) {
|
||||
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning && this.isInWater()) { // Purpur - bee can instantly start drowning in water option
|
||||
this.underWaterTicks++;
|
||||
} else {
|
||||
this.underWaterTicks = 0;
|
||||
@@ -398,6 +398,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
this.hurtServer(level, this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
|
||||
+ if (hasStung && !this.level().purpurConfig.beeDiesAfterSting) setHasStung(false); else // Purpur - Stop bees from dying after stinging
|
||||
if (hasStung) {
|
||||
this.timeSinceSting++;
|
||||
if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, 1, 1200)) == 0) {
|
||||
@@ -1135,6 +1136,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
Bee.this.savedFlowerPos = optional.get();
|
||||
Bee.this.navigation
|
||||
.moveTo(Bee.this.savedFlowerPos.getX() + 0.5, Bee.this.savedFlowerPos.getY() + 0.5, Bee.this.savedFlowerPos.getZ() + 0.5, 1.2F);
|
||||
+ new org.purpurmc.purpur.event.entity.BeeFoundFlowerEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level())).callEvent(); // Purpur - Bee API
|
||||
return true;
|
||||
} else {
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(Bee.this.random, 20, 60);
|
||||
@@ -1181,6 +1183,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
this.pollinating = false;
|
||||
Bee.this.navigation.stop();
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;
|
||||
+ new org.purpurmc.purpur.event.entity.BeeStopPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), Bee.this.savedFlowerPos == null ? null : org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level()), Bee.this.hasNectar()).callEvent(); // Purpur - Bee API
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1227,6 +1230,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
this.setWantedPos();
|
||||
}
|
||||
|
||||
+ if (this.successfulPollinatingTicks == 0) new org.purpurmc.purpur.event.entity.BeeStartedPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level())).callEvent(); // Purpur - Bee API
|
||||
this.successfulPollinatingTicks++;
|
||||
if (Bee.this.random.nextFloat() < 0.05F && this.successfulPollinatingTicks > this.lastSoundPlayedTick + 60) {
|
||||
this.lastSoundPlayedTick = this.successfulPollinatingTicks;
|
||||
@@ -1,34 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Cat.java b/net/minecraft/world/entity/animal/Cat.java
|
||||
index 9c60140ef1ae9973ce39643c5253ddb0eac1c97b..7894db23663c4647742f543195b610bd7e1f3360 100644
|
||||
--- a/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -353,6 +353,14 @@ public class Cat extends TamableAnimal {
|
||||
return this.isTame() && otherAnimal instanceof Cat cat && cat.isTame() && super.canMate(otherAnimal);
|
||||
}
|
||||
|
||||
+ // Purpur start - Configurable default collar color
|
||||
+ @Override
|
||||
+ public void tame(Player player) {
|
||||
+ setCollarColor(level().purpurConfig.catDefaultCollarColor);
|
||||
+ super.tame(player);
|
||||
+ }
|
||||
+ // Purpur end - Configurable default collar color
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public SpawnGroupData finalizeSpawn(
|
||||
@@ -451,7 +459,7 @@ public class Cat extends TamableAnimal {
|
||||
}
|
||||
|
||||
private void tryToTame(Player player) {
|
||||
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit
|
||||
+ if (((this.level().purpurConfig.alwaysTameInCreative && player.hasInfiniteMaterials()) || this.random.nextInt(3) == 0) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit // Purpur - Config to always tame in Creative
|
||||
this.tame(player);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte)7);
|
||||
@@ -1,55 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Dolphin.java b/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 8f2af65c58da50be2776a21b10db5eb9cb5f3076..bca2e4659f4afdd7106f77e32af1943e4d276f5e 100644
|
||||
--- a/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -73,6 +73,7 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
private static final boolean DEFAULT_GOT_FISH = false;
|
||||
@Nullable
|
||||
public BlockPos treasurePos;
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Dolphins naturally aggressive to players chance
|
||||
|
||||
public Dolphin(EntityType<? extends Dolphin> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -89,6 +90,7 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
this.setAirSupply(this.getMaxAirSupply());
|
||||
this.setXRot(0.0F);
|
||||
SpawnGroupData spawnGroupData1 = Objects.requireNonNullElseGet(spawnGroupData, () -> new AgeableMob.AgeableMobGroupData(0.1F));
|
||||
+ this.isNaturallyAggressiveToPlayers = level.getLevel().purpurConfig.dolphinNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.dolphinNaturallyAggressiveToPlayersChance; // Purpur - Dolphins naturally aggressive to players chance
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData1);
|
||||
}
|
||||
|
||||
@@ -155,17 +157,19 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
||||
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
||||
+ this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur - Dolphins naturally aggressive to players chance
|
||||
this.goalSelector.addGoal(1, new Dolphin.DolphinSwimToTreasureGoal(this));
|
||||
this.goalSelector.addGoal(2, new Dolphin.DolphinSwimWithPlayerGoal(this, 4.0));
|
||||
this.goalSelector.addGoal(4, new RandomSwimmingGoal(this, 1.0, 10));
|
||||
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
|
||||
this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
this.goalSelector.addGoal(5, new DolphinJumpGoal(this, 10));
|
||||
- this.goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.2F, true));
|
||||
+ //this.goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.2F, true)); // Purpur - moved up - Dolphins naturally aggressive to players chance
|
||||
this.goalSelector.addGoal(8, new Dolphin.PlayWithItemsGoal());
|
||||
this.goalSelector.addGoal(8, new FollowBoatGoal(this));
|
||||
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, Guardian.class, 8.0F, 1.0, 1.0));
|
||||
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Guardian.class).setAlertOthers());
|
||||
+ this.targetSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, (ignored, ignored2) -> isNaturallyAggressiveToPlayers)); // Purpur - Dolphins naturally aggressive to players chance
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
@@ -398,6 +402,7 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
+ if (this.dolphin.level().purpurConfig.dolphinDisableTreasureSearching) return false; // Purpur - Add option to disable dolphin treasure searching
|
||||
return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100;
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Fox.java b/net/minecraft/world/entity/animal/Fox.java
|
||||
index 5c7572b75afcfa9965fcda5965f6ae2e59babb46..4aae42396bd3abb131efe336d7b774384897671d 100644
|
||||
--- a/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -345,6 +345,11 @@ public class Fox extends Animal {
|
||||
}
|
||||
|
||||
private void setTargetGoals() {
|
||||
+ // Purpur start - Tulips change fox type - do not add duplicate goals
|
||||
+ this.targetSelector.removeGoal(this.landTargetGoal);
|
||||
+ this.targetSelector.removeGoal(this.turtleEggTargetGoal);
|
||||
+ this.targetSelector.removeGoal(this.fishTargetGoal);
|
||||
+ // Purpur end - Tulips change fox type
|
||||
if (this.getVariant() == Fox.Variant.RED) {
|
||||
this.targetSelector.addGoal(4, this.landTargetGoal);
|
||||
this.targetSelector.addGoal(4, this.turtleEggTargetGoal);
|
||||
@@ -372,6 +377,7 @@ public class Fox extends Animal {
|
||||
|
||||
public void setVariant(Fox.Variant variant) {
|
||||
this.entityData.set(DATA_TYPE_ID, variant.getId());
|
||||
+ this.setTargetGoals(); // Purpur - Tulips change fox type - fix API bug not updating pathfinders on type change
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -706,6 +712,29 @@ public class Fox extends Animal {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Purpur start - Tulips change fox type
|
||||
+ @Override
|
||||
+ public net.minecraft.world.InteractionResult mobInteract(Player player, net.minecraft.world.InteractionHand hand) {
|
||||
+ if (level().purpurConfig.foxTypeChangesWithTulips) {
|
||||
+ ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ if (getVariant() == Variant.RED && itemstack.getItem() == Items.WHITE_TULIP) {
|
||||
+ setVariant(Variant.SNOW);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ } else if (getVariant() == Variant.SNOW && itemstack.getItem() == Items.ORANGE_TULIP) {
|
||||
+ setVariant(Variant.RED);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+ return super.mobInteract(player, hand);
|
||||
+ }
|
||||
+ // Purpur end - Tulips change fox type
|
||||
+
|
||||
@Override
|
||||
// Paper start - Cancellable death event
|
||||
protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel level, DamageSource damageSource) {
|
||||
@@ -1,24 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/MushroomCow.java b/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
index cc2fd681d2383e62191e7b380322f2e176d79f1e..0931bab3f52ccc4e405be22559323df90bcc065e 100644
|
||||
--- a/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -198,6 +198,13 @@ public class MushroomCow extends AbstractCow implements Shearable {
|
||||
level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F);
|
||||
this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), cow -> {
|
||||
level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0);
|
||||
+ // Purpur start - Fix cow rotation when shearing mooshroom
|
||||
+ cow.copyPosition(this);
|
||||
+ cow.yBodyRot = this.yBodyRot;
|
||||
+ cow.setYHeadRot(this.getYHeadRot());
|
||||
+ cow.yRotO = this.yRotO;
|
||||
+ cow.xRotO = this.xRotO;
|
||||
+ // Purpur end - Fix cow rotation when shearing mooshroom
|
||||
// Paper start - custom shear drops; moved drop generation to separate method
|
||||
drops.forEach(drop -> {
|
||||
this.spawnAtLocation(level, new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), drop));
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Ocelot.java b/net/minecraft/world/entity/animal/Ocelot.java
|
||||
index 9e86a42f04d06c3dcd241f16ab876b0c8422fd81..48c8fdfea8687f37187b6092c285275c12963ea0 100644
|
||||
--- a/net/minecraft/world/entity/animal/Ocelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Ocelot.java
|
||||
@@ -233,7 +233,7 @@ public class Ocelot extends Animal {
|
||||
public boolean checkSpawnObstruction(LevelReader level) {
|
||||
if (level.isUnobstructed(this) && !level.containsAnyLiquid(this.getBoundingBox())) {
|
||||
BlockPos blockPos = this.blockPosition();
|
||||
- if (blockPos.getY() < level.getSeaLevel()) {
|
||||
+ if (!level().purpurConfig.ocelotSpawnUnderSeaLevel && blockPos.getY() < level.getSeaLevel()) { // Purpur - Option Ocelot Spawn Under Sea Level
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Parrot.java b/net/minecraft/world/entity/animal/Parrot.java
|
||||
index cff10bb74a216238288280399910ab1fa85cb1a5..ca661c215d2eb719392a30c7b917bd622524c4dc 100644
|
||||
--- a/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -157,6 +157,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new TamableAnimal.TamableAnimalPanicGoal(1.25));
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
+ if (this.level().purpurConfig.parrotBreedable) this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.BreedGoal(this, 1.0D)); // Purpur - Breedable parrots
|
||||
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F));
|
||||
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
|
||||
this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0, 5.0F, 1.0F));
|
||||
@@ -262,7 +263,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.hasInfiniteMaterials()) || this.random.nextInt(10) == 0) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit // Purpur - Config to always tame in Creative
|
||||
this.tame(player);
|
||||
this.level().broadcastEntityEvent(this, (byte)7);
|
||||
} else {
|
||||
@@ -270,6 +271,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (this.level().purpurConfig.parrotBreedable) return super.mobInteract(player, hand); // Purpur - Breedable parrots
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (!itemInHand.is(ItemTags.PARROT_POISONOUS_FOOD)) {
|
||||
if (!this.isFlying() && this.isTame() && this.isOwnedBy(player)) {
|
||||
@@ -294,7 +296,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
|
||||
@Override
|
||||
public boolean isFood(ItemStack stack) {
|
||||
- return false;
|
||||
+ return this.level().purpurConfig.parrotBreedable && stack.is(ItemTags.PARROT_FOOD); // Purpur - Breedable parrots
|
||||
}
|
||||
|
||||
public static boolean checkParrotSpawnRules(
|
||||
@@ -309,13 +311,13 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
|
||||
@Override
|
||||
public boolean canMate(Animal otherAnimal) {
|
||||
- return false;
|
||||
+ return super.canMate(otherAnimal); // Purpur - Breedable parrots
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
|
||||
- return null;
|
||||
+ return level.purpurConfig.parrotBreedable ? EntityType.PARROT.create(level, EntitySpawnReason.BREEDING) : null; // Purpur - Breedable parrots
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1,30 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Pig.java b/net/minecraft/world/entity/animal/Pig.java
|
||||
index ec2074741b52cf8f1ac3c0276bcfc9b8806b71bf..027d47b89d306bf6bc3d5457a163041f6aa7ab49 100644
|
||||
--- a/net/minecraft/world/entity/animal/Pig.java
|
||||
+++ b/net/minecraft/world/entity/animal/Pig.java
|
||||
@@ -141,6 +141,19 @@ public class Pig extends Animal implements ItemSteerable {
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
boolean isFood = this.isFood(player.getItemInHand(hand));
|
||||
+ // Purpur start - Pigs give saddle back
|
||||
+ if (level().purpurConfig.pigGiveSaddleBack && player.isSecondaryUseActive() && !isFood && isSaddled() && !isVehicle()) {
|
||||
+ this.setItemSlot(EquipmentSlot.SADDLE, ItemStack.EMPTY);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ ItemStack saddle = new ItemStack(Items.SADDLE);
|
||||
+ if (!player.getInventory().add(saddle)) {
|
||||
+ player.drop(saddle, false);
|
||||
+ }
|
||||
+ }
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end - Pigs give saddle back
|
||||
+
|
||||
if (!isFood && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) {
|
||||
if (!this.level().isClientSide) {
|
||||
player.startRiding(this);
|
||||
@@ -1,62 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/PolarBear.java b/net/minecraft/world/entity/animal/PolarBear.java
|
||||
index fcdaaed31c38acb55e66599cd3314606d223cd67..d018b1a967557cfae0d3227d8f43d281a78a22bc 100644
|
||||
--- a/net/minecraft/world/entity/animal/PolarBear.java
|
||||
+++ b/net/minecraft/world/entity/animal/PolarBear.java
|
||||
@@ -64,6 +64,29 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Breedable Polar Bears
|
||||
+ public boolean canMate(Animal other) {
|
||||
+ if (other == this) {
|
||||
+ return false;
|
||||
+ } else if (this.isStanding()) {
|
||||
+ return false;
|
||||
+ } else if (this.getTarget() != null) {
|
||||
+ return false;
|
||||
+ } else if (!(other instanceof PolarBear)) {
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ PolarBear bear = (PolarBear) other;
|
||||
+ if (bear.isStanding()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (bear.getTarget() != null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return this.isInLove() && bear.isInLove();
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Breedable Polar Bears
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
|
||||
@@ -72,7 +95,7 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean isFood(ItemStack stack) {
|
||||
- return false;
|
||||
+ return level().purpurConfig.polarBearBreedableItem != null && stack.getItem() == level().purpurConfig.polarBearBreedableItem; // Purpur - Breedable Polar Bears
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,6 +104,12 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new PolarBear.PolarBearMeleeAttackGoal());
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0, mob -> mob.isBaby() ? DamageTypeTags.PANIC_CAUSES : DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES));
|
||||
+ // Purpur start - Breedable Polar Bears
|
||||
+ if (level().purpurConfig.polarBearBreedableItem != null) {
|
||||
+ this.goalSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.BreedGoal(this, 1.0D));
|
||||
+ this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, net.minecraft.world.item.crafting.Ingredient.of(level().purpurConfig.polarBearBreedableItem), false));
|
||||
+ }
|
||||
+ // Purpur end - Breedable Polar Bears
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
|
||||
this.goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
@@ -1,34 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Rabbit.java b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
index cc7d990f271af1371aa62e8a2ee2ee1bfffb621a..e9445749c5264bd0ce7c426845cb342d34dea713 100644
|
||||
--- a/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -403,10 +403,23 @@ public class Rabbit extends Animal {
|
||||
}
|
||||
|
||||
this.setVariant(randomRabbitVariant);
|
||||
+
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ if (randomRabbitVariant != Variant.EVIL && level.getLevel().purpurConfig.rabbitNaturalToast > 0D && random.nextDouble() <= level.getLevel().purpurConfig.rabbitNaturalToast) {
|
||||
+ setCustomName(Component.translatable("Toast"));
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
+
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
|
||||
}
|
||||
|
||||
private static Rabbit.Variant getRandomRabbitVariant(LevelAccessor level, BlockPos pos) {
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ Level world = level.getMinecraftWorld();
|
||||
+ if (world.purpurConfig.rabbitNaturalKiller > 0D && world.getRandom().nextDouble() <= world.purpurConfig.rabbitNaturalKiller) {
|
||||
+ return Rabbit.Variant.EVIL;
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
Holder<Biome> biome = level.getBiome(pos);
|
||||
int randomInt = level.getRandom().nextInt(100);
|
||||
if (biome.is(BiomeTags.SPAWNS_WHITE_RABBITS)) {
|
||||
@@ -1,58 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Squid.java b/net/minecraft/world/entity/animal/Squid.java
|
||||
index 58e1bc90cbc32669fa6c66d214119f0c459ff38c..2e51e64991d326fc055520b6fefc76e80f7c2d97 100644
|
||||
--- a/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -46,10 +46,29 @@ public class Squid extends AgeableWaterCreature {
|
||||
|
||||
public Squid(EntityType<? extends Squid> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
- //this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random
|
||||
+ if (!level.purpurConfig.entitySharedRandom) this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random // Purpur - Add toggle for RNG manipulation
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
+ // Purpur start - Stop squids floating on top of water
|
||||
+ @Override
|
||||
+ public net.minecraft.world.phys.AABB getAxisForFluidCheck() {
|
||||
+ // Stops squids from floating just over the water
|
||||
+ return super.getAxisForFluidCheck().offsetY(level().purpurConfig.squidOffsetWaterCheck);
|
||||
+ }
|
||||
+ // Purpur end - Stop squids floating on top of water
|
||||
+
|
||||
+ // Purpur start - Flying squids! Oh my!
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.squidsCanFly;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isInWater() {
|
||||
+ return this.wasTouchingWater || canFly();
|
||||
+ }
|
||||
+ // Purpur end - Flying squids! Oh my!
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new Squid.SquidRandomMovementGoal(this));
|
||||
@@ -127,6 +146,7 @@ public class Squid extends AgeableWaterCreature {
|
||||
}
|
||||
|
||||
if (this.isInWater()) {
|
||||
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - Flying squids! Oh my!
|
||||
if (this.tentacleMovement < (float) Math.PI) {
|
||||
float f = this.tentacleMovement / (float) Math.PI;
|
||||
this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F;
|
||||
@@ -308,7 +328,7 @@ public class Squid extends AgeableWaterCreature {
|
||||
int noActionTime = this.squid.getNoActionTime();
|
||||
if (noActionTime > 100) {
|
||||
this.squid.movementVector = Vec3.ZERO;
|
||||
- } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) {
|
||||
+ } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur - Flying squids! Oh my!
|
||||
float f = this.squid.getRandom().nextFloat() * (float) (Math.PI * 2);
|
||||
this.squid.movementVector = new Vec3(Mth.cos(f) * 0.2F, -0.1F + this.squid.getRandom().nextFloat() * 0.2F, Mth.sin(f) * 0.2F);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/WaterAnimal.java b/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||
index 2b5e091b6ebe17e30d8d0e73999e19eed49e9a9f..6ff9ca735eba1c3376f3bc4916d5ab76af782de1 100644
|
||||
--- a/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||
+++ b/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||
@@ -76,8 +76,7 @@ public abstract class WaterAnimal extends PathfinderMob {
|
||||
seaLevel = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(seaLevel);
|
||||
i = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(i);
|
||||
// Paper end - Make water animal spawn height configurable
|
||||
- return pos.getY() >= i
|
||||
- && pos.getY() <= seaLevel
|
||||
+ return ((spawnReason == EntitySpawnReason.SPAWNER && level.getMinecraftWorld().purpurConfig.spawnerFixMC238526) || (pos.getY() >= i && pos.getY() <= seaLevel)) // Purpur - MC-238526 - Fix spawner not spawning water animals correctly
|
||||
&& level.getFluidState(pos.below()).is(FluidTags.WATER)
|
||||
&& level.getBlockState(pos.above()).is(Blocks.WATER);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index b22321ead9d66cb089b67276743624b3cca52fc1..c399192687e01bd4a05e4a85d71493d4c3c3e9a8 100644
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -395,6 +395,7 @@ public class Goat extends Animal {
|
||||
|
||||
// Paper start - Goat ram API
|
||||
public void ram(net.minecraft.world.entity.LivingEntity entity) {
|
||||
+ if(!new org.purpurmc.purpur.event.entity.GoatRamEntityEvent((org.bukkit.entity.Goat) getBukkitEntity(), entity.getBukkitLivingEntity()).callEvent()) return; // Purpur - Added goat ram event
|
||||
Brain<Goat> brain = this.getBrain();
|
||||
brain.setMemory(MemoryModuleType.RAM_TARGET, entity.position());
|
||||
brain.eraseMemory(MemoryModuleType.RAM_COOLDOWN_TICKS);
|
||||
@@ -1,64 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
index d813427cf20117014bc42af0eb7cdee037fbcd9c..57f9f705c62706902efe9a7873f0e3866820f7d9 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -38,6 +38,24 @@ public class EndCrystal extends Entity {
|
||||
this.setPos(x, y, z);
|
||||
}
|
||||
|
||||
+ // Purpur start - End crystal explosion options
|
||||
+ 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 Level.ExplosionInteraction getExplosionEffect() {
|
||||
+ return showsBottom() ? level().purpurConfig.basedEndCrystalExplosionEffect : level().purpurConfig.baselessEndCrystalExplosionEffect;
|
||||
+ }
|
||||
+ // Purpur end - End crystal explosion options
|
||||
+
|
||||
@Override
|
||||
protected Entity.MovementEmission getMovementEmission() {
|
||||
return Entity.MovementEmission.NONE;
|
||||
@@ -74,6 +92,8 @@ public class EndCrystal extends Entity {
|
||||
}
|
||||
}
|
||||
// Paper end - Fix invulnerable end crystals
|
||||
+ if (this.level().purpurConfig.endCrystalCramming > 0 && this.level().getEntitiesOfClass(EndCrystal.class, getBoundingBox()).size() > this.level().purpurConfig.endCrystalCramming) this.hurt(this.damageSources().cramming(), 6.0F); // Purpur - End Crystal Cramming
|
||||
+
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,15 +134,17 @@ public class EndCrystal extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (!damageSource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
+ if (shouldExplode()) {// Purpur - End crystal explosion options
|
||||
DamageSource damageSource1 = damageSource.getEntity() != null ? this.damageSources().explosion(this, damageSource.getEntity()) : null;
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.ExplosionPrimeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExplosionPrimeEvent(this, 6.0F, false);
|
||||
+ org.bukkit.event.entity.ExplosionPrimeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExplosionPrimeEvent(this, getExplosionPower(), hasExplosionFire()); // Purpur - End crystal explosion options
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.remove(Entity.RemovalReason.KILLED, org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // Paper - add Bukkit remove cause
|
||||
- level.explode(this, damageSource1, null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.BLOCK);
|
||||
+ level.explode(this, damageSource1, null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), getExplosionEffect()); // Purpur - End crystal explosion options
|
||||
+ } else this.unsetRemoved(); // Purpur - End crystal explosion options
|
||||
} else {
|
||||
this.remove(Entity.RemovalReason.KILLED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DEATH); // Paper - add Bukkit remove cause
|
||||
// CraftBukkit end
|
||||
@@ -1,27 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index 0f3c88601357399d3b8efd2f0e3a531482bc1f3d..ea9d27a3205b3699b9577f42bb04254bd76e700e 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -960,6 +960,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
|
||||
@Override
|
||||
protected boolean canRide(Entity entity) {
|
||||
+ if (this.level().purpurConfig.enderDragonCanRideVehicles) return this.boardingCooldown <= 0; // Purpur - Configs for if Wither/Ender Dragon can ride vehicles
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -995,7 +996,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
boolean flag = level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
int i = 500;
|
||||
|
||||
- if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
|
||||
+ if (this.dragonFight != null && (level().purpurConfig.enderDragonAlwaysDropsFullExp || !this.dragonFight.hasPreviouslyKilledDragon())) { // Purpur - Ender dragon always drop full exp
|
||||
i = 12000;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 5d23d8754b304d5e2fd54400cc81c7fe5c14a804..9a00aead39e194de076ee651d2f75b29673cad1e 100644
|
||||
--- a/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -253,4 +253,32 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
|
||||
}
|
||||
// Paper end - Option to prevent TNT from moving in water
|
||||
+
|
||||
+ // Purpur start - Shears can defuse TNT
|
||||
+ @Override
|
||||
+ public net.minecraft.world.InteractionResult interact(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) {
|
||||
+ Level world = this.level();
|
||||
+
|
||||
+ if (world instanceof ServerLevel serverWorld && level().purpurConfig.shearsCanDefuseTnt) {
|
||||
+ final net.minecraft.world.item.ItemStack inHand = player.getItemInHand(hand);
|
||||
+
|
||||
+ if (!inHand.is(net.minecraft.world.item.Items.SHEARS) || !player.getBukkitEntity().hasPermission("purpur.tnt.defuse") ||
|
||||
+ serverWorld.random.nextFloat() > serverWorld.purpurConfig.shearsCanDefuseTntChance) return net.minecraft.world.InteractionResult.PASS;
|
||||
+
|
||||
+ net.minecraft.world.entity.item.ItemEntity tntItem = new net.minecraft.world.entity.item.ItemEntity(serverWorld, getX(), getY(), getZ(),
|
||||
+ new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.TNT));
|
||||
+ tntItem.setPickUpDelay(10);
|
||||
+
|
||||
+ inHand.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand));
|
||||
+ serverWorld.addFreshEntity(tntItem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM);
|
||||
+
|
||||
+ this.playSound(net.minecraft.sounds.SoundEvents.SHEEP_SHEAR);
|
||||
+
|
||||
+ this.kill(serverWorld);
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ return super.interact(player, hand);
|
||||
+ }
|
||||
+ // Purpur end - Shears can defuse TNT
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/AbstractSkeleton.java b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 22d5ccb271fc19255e99afa5d1ff10549a20dc31..025b74f7fe2094110a9fd293911588f361785d0a 100644
|
||||
--- a/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -158,10 +158,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
this.reassessWeaponGoal();
|
||||
this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot
|
||||
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
|
||||
- LocalDate localDate = LocalDate.now();
|
||||
- int i = localDate.get(ChronoField.DAY_OF_MONTH);
|
||||
- int i1 = localDate.get(ChronoField.MONTH_OF_YEAR);
|
||||
- if (i1 == 10 && i == 31 && random.nextFloat() < 0.25F) {
|
||||
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(level.getMinecraftWorld()) && this.random.nextFloat() < this.level().purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur - Halloween options and optimizations
|
||||
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.setDropChance(EquipmentSlot.HEAD, 0.0F);
|
||||
}
|
||||
@@ -217,7 +214,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
if (event.getProjectile() == arrow.getBukkitEntity()) {
|
||||
// CraftBukkit end
|
||||
Projectile.spawnProjectileUsingShoot(
|
||||
- arrow, serverLevel, projectile, d, d1 + squareRoot * 0.2F, d2, 1.6F, 14 - serverLevel.getDifficulty().getId() * 4
|
||||
+ arrow, serverLevel, projectile, d, d1 + squareRoot * 0.2F, d2, 1.6F, serverLevel.purpurConfig.skeletonBowAccuracyMap.getOrDefault(serverLevel.getDifficulty().getId(), (float) (14 - serverLevel.getDifficulty().getId() * 4)) // Purpur - skeleton bow accuracy option
|
||||
);
|
||||
} // CraftBukkit
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Creeper.java b/net/minecraft/world/entity/monster/Creeper.java
|
||||
index 3f5e1e98802e5dd1cfc9075559e1102046605a04..c2327306f093c834da9574f9466236fbec572aec 100644
|
||||
--- a/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -54,6 +54,7 @@ public class Creeper extends Monster {
|
||||
public int explosionRadius = 3;
|
||||
private int droppedSkulls;
|
||||
public @Nullable Entity entityIgniter; // CraftBukkit
|
||||
+ private boolean exploding = false; // Purpur - Config to make Creepers explode on death
|
||||
|
||||
public Creeper(EntityType<? extends Creeper> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -157,6 +158,27 @@ public class Creeper extends Monster {
|
||||
return false; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ @Override
|
||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
|
||||
+ double chance = world.getLevel().purpurConfig.creeperChargedChance;
|
||||
+ if (chance > 0D && random.nextDouble() <= chance) {
|
||||
+ setPowered(true);
|
||||
+ }
|
||||
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
+
|
||||
+ // Purpur start - Config to make Creepers explode on death
|
||||
+ @Override
|
||||
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
|
||||
+ if (!this.exploding && this.level().purpurConfig.creeperExplodeWhenKilled && damageSource.getEntity() instanceof net.minecraft.server.level.ServerPlayer) {
|
||||
+ this.explodeCreeper();
|
||||
+ }
|
||||
+ return super.dropAllDeathLoot(world, damageSource);
|
||||
+ }
|
||||
+ // Purpur end - Config to make Creepers explode on death
|
||||
+
|
||||
@Override
|
||||
public SoundEvent getHurtSound(DamageSource damageSource) {
|
||||
return SoundEvents.CREEPER_HURT;
|
||||
@@ -239,14 +261,16 @@ public class Creeper extends Monster {
|
||||
}
|
||||
|
||||
public void explodeCreeper() {
|
||||
+ this.exploding = true; // Purpur - Config to make Creepers explode on death
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
+ float multiplier = serverLevel.purpurConfig.creeperHealthRadius ? this.getHealth() / this.getMaxHealth() : 1; // Purpur - Config for health to impact Creeper explosion radius
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.ExplosionPrimeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExplosionPrimeEvent(this, this.explosionRadius * f, false);
|
||||
+ org.bukkit.event.entity.ExplosionPrimeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExplosionPrimeEvent(this, (this.explosionRadius * f) * multiplier, false); // Purpur - Config for health to impact Creeper explosion radius
|
||||
if (!event.isCancelled()) {
|
||||
// CraftBukkit end
|
||||
this.dead = true;
|
||||
- serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
|
||||
+ serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) && level().purpurConfig.creeperAllowGriefing ? Level.ExplosionInteraction.MOB : Level.ExplosionInteraction.NONE); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this) // Purpur - Add enderman and creeper griefing controls
|
||||
this.spawnLingeringCloud();
|
||||
this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED);
|
||||
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
@@ -257,6 +281,7 @@ public class Creeper extends Monster {
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
+ this.exploding = false; // Purpur - Config to make Creepers explode on death
|
||||
}
|
||||
|
||||
private void spawnLingeringCloud() {
|
||||
@@ -1,35 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java
|
||||
index 4978cd2a7a84130fc0de1cc481b39d61f388c812..c0afb6f85cecf26bb1a08669ac3fcec8fea6cbfc 100644
|
||||
--- a/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -82,10 +82,23 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
this.goalSelector.addGoal(2, new Drowned.DrownedAttackGoal(this, 1.0, false));
|
||||
this.goalSelector.addGoal(5, new Drowned.DrownedGoToBeachGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new Drowned.DrownedSwimUpGoal(this, 1.0, this.level().getSeaLevel()));
|
||||
+ if (level().purpurConfig.drownedBreakDoors) this.goalSelector.addGoal(6, new net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal(this, 1.0D, true, 4, this::canBreakDoors)); // Purpur - Option to make drowned break doors
|
||||
this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0));
|
||||
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Drowned.class).setAlertOthers(ZombifiedPiglin.class));
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, (entity, level) -> this.okTarget(entity)));
|
||||
- if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper - Check drowned for villager aggression config
|
||||
+ // Purpur start - Add option to disable zombie aggressiveness towards villagers
|
||||
+ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false) { // Paper - Check drowned for villager aggression config
|
||||
+ @Override
|
||||
+ public boolean canUse() {
|
||||
+ return (level().purpurConfig.zombieAggressiveTowardsVillagerWhenLagging || !level().getServer().server.isLagging()) && super.canUse();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canContinueToUse() {
|
||||
+ return (level().purpurConfig.zombieAggressiveTowardsVillagerWhenLagging || !level().getServer().server.isLagging()) && super.canContinueToUse();
|
||||
+ }
|
||||
+ });
|
||||
+ // Purpur end - Add option to disable zombie aggressiveness towards villagers
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false));
|
||||
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
|
||||
@@ -1,69 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 5ae08be75ca01924fc78bdd8d6bb6747ddc21aea..ed322ed572cac147acf26ba18a7803685557e0d7 100644
|
||||
--- a/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -103,7 +103,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
this.goalSelector.addGoal(11, new EnderMan.EndermanTakeBlockGoal(this));
|
||||
this.targetSelector.addGoal(1, new EnderMan.EndermanLookForPlayerGoal(this, this::isAngryAt));
|
||||
this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
|
||||
- this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Endermite.class, true, false));
|
||||
+ this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Endermite.class, 10, true, false, (entityliving, ignored) -> entityliving.level().purpurConfig.endermanAggroEndermites && entityliving instanceof Endermite endermite && (!entityliving.level().purpurConfig.endermanAggroEndermitesOnlyIfPlayerSpawned || endermite.isPlayerSpawned()))); // Purpur
|
||||
this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false));
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
|
||||
boolean isBeingStaredBy(Player player) {
|
||||
// Paper start - EndermanAttackPlayerEvent
|
||||
- final boolean shouldAttack = this.isBeingStaredBy0(player);
|
||||
+ final boolean shouldAttack = !this.level().purpurConfig.endermanDisableStareAggro && this.isBeingStaredBy0(player); // Purpur - Config to ignore Dragon Head wearers and stare aggro
|
||||
final com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity());
|
||||
event.setCancelled(!shouldAttack);
|
||||
return event.callEvent();
|
||||
@@ -376,6 +376,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) {
|
||||
if (this.isInvulnerableTo(level, damageSource)) {
|
||||
return false;
|
||||
+ } else if (org.purpurmc.purpur.PurpurConfig.endermanShortHeight && damageSource.is(net.minecraft.world.damagesource.DamageTypes.IN_WALL)) { return false; // Purpur - no suffocation damage if short height - Short enderman height
|
||||
} else {
|
||||
AbstractThrownPotion abstractThrownPotion1 = damageSource.getDirectEntity() instanceof AbstractThrownPotion abstractThrownPotion
|
||||
? abstractThrownPotion
|
||||
@@ -392,6 +393,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
} else {
|
||||
boolean flag = abstractThrownPotion1 != null && this.hurtWithCleanWater(level, damageSource, abstractThrownPotion1, amount);
|
||||
|
||||
+ if (!flag && level.purpurConfig.endermanIgnoreProjectiles) return super.hurtServer(level, damageSource, amount); // Purpur - Config to disable Enderman teleport on projectile hit
|
||||
if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if (this.teleport()) {
|
||||
@@ -435,7 +437,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean requiresCustomPersistence() {
|
||||
- return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
|
||||
+ return super.requiresCustomPersistence() || (!this.level().purpurConfig.endermanDespawnEvenWithBlock && this.getCarriedBlock() != null); // Purpur - Add config for allowing Endermen to despawn even while holding a block
|
||||
}
|
||||
|
||||
static class EndermanFreezeWhenLookedAt extends Goal {
|
||||
@@ -479,6 +481,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
+ if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
|
||||
return this.enderman.getCarriedBlock() != null
|
||||
&& getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
|
||||
&& this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0;
|
||||
@@ -628,6 +631,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
+ if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
|
||||
return this.enderman.getCarriedBlock() == null
|
||||
&& getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
|
||||
&& this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0;
|
||||
@@ -1,25 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Monster.java b/net/minecraft/world/entity/monster/Monster.java
|
||||
index 5ef9566b16a4d0300ee45a993c46e734db156416..04d5910d736dee2a88a2602f4a98495459277157 100644
|
||||
--- a/net/minecraft/world/entity/monster/Monster.java
|
||||
+++ b/net/minecraft/world/entity/monster/Monster.java
|
||||
@@ -88,6 +88,14 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
||||
}
|
||||
|
||||
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor level, BlockPos pos, RandomSource random) {
|
||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||
+ if (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce || !level.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce) {
|
||||
+ net.minecraft.world.level.block.state.BlockState spawnBlock = level.getBlockState(pos.below());
|
||||
+ if ((!level.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.BLUE_ICE))) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||
if (level.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -1,23 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 483b0499f1f70b3aa8862e6cd8e512748492bee0..73edb1a4e5daee16fa518c05de24e413847ab65d 100644
|
||||
--- a/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -159,7 +159,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData spawnGroupData
|
||||
) {
|
||||
this.anchorPoint = this.blockPosition().above(5);
|
||||
- this.setPhantomSize(0);
|
||||
+ // Purpur start - Configurable phantom size
|
||||
+ int min = level.getLevel().purpurConfig.phantomMinSize;
|
||||
+ int max = level.getLevel().purpurConfig.phantomMaxSize;
|
||||
+ this.setPhantomSize(min == max ? min : level.getRandom().nextInt(max + 1 - min) + min);
|
||||
+ // Purpur end - Configurable phantom size
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Ravager.java b/net/minecraft/world/entity/monster/Ravager.java
|
||||
index ca1856b18878b94ebfb566395e5eee13cf3c1cd5..85018a01b5d803a91228e2fa02717c2c518a3004 100644
|
||||
--- a/net/minecraft/world/entity/monster/Ravager.java
|
||||
+++ b/net/minecraft/world/entity/monster/Ravager.java
|
||||
@@ -73,6 +73,7 @@ public class Ravager extends Raider {
|
||||
protected void registerGoals() {
|
||||
super.registerGoals();
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
+ if (level().purpurConfig.ravagerAvoidRabbits) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.AvoidEntityGoal<>(this, net.minecraft.world.entity.animal.Rabbit.class, 6.0F, 1.0D, 1.2D)); // Purpur - option to make ravagers afraid of rabbits
|
||||
this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, true));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
@@ -153,7 +154,7 @@ public class Ravager extends Raider {
|
||||
)) {
|
||||
BlockState blockState = serverLevel.getBlockState(blockPos);
|
||||
Block block = blockState.getBlock();
|
||||
- if (block instanceof LeavesBlock) {
|
||||
+ if (this.level().purpurConfig.ravagerGriefableBlocks.contains(block)) { // Purpur - Configurable ravager griefable blocks list
|
||||
// CraftBukkit start
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockPos, blockState.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state
|
||||
continue;
|
||||
@@ -1,75 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Shulker.java b/net/minecraft/world/entity/monster/Shulker.java
|
||||
index 1b8a4c548c1376d9cdd16a10d434da070c85f41d..a8c5c2ad80afd03b3fc53127b519b5c2b73bff85 100644
|
||||
--- a/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -53,6 +53,7 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.entity.EntityTypeTest;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -93,6 +94,21 @@ public class Shulker extends AbstractGolem implements Enemy {
|
||||
this.lookControl = new Shulker.ShulkerLookControl(this);
|
||||
}
|
||||
|
||||
+ // Purpur start - Shulker change color with dye
|
||||
+ @Override
|
||||
+ protected net.minecraft.world.InteractionResult mobInteract(Player player, net.minecraft.world.InteractionHand hand) {
|
||||
+ net.minecraft.world.item.ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ if (player.level().purpurConfig.shulkerChangeColorWithDye && itemstack.getItem() instanceof net.minecraft.world.item.DyeItem dye && dye.getDyeColor() != this.getColor()) {
|
||||
+ this.setVariant(Optional.of(dye.getDyeColor()));
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ return super.mobInteract(player, hand);
|
||||
+ }
|
||||
+ // Purpur end - Shulker change color with dye
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F, 0.02F, true));
|
||||
@@ -460,11 +476,21 @@ public class Shulker extends AbstractGolem implements Enemy {
|
||||
private void hitByShulkerBullet() {
|
||||
Vec3 vec3 = this.position();
|
||||
AABB boundingBox = this.getBoundingBox();
|
||||
- if (!this.isClosed() && this.teleportSomewhere()) {
|
||||
- int size = this.level().getEntities(EntityType.SHULKER, boundingBox.inflate(8.0), Entity::isAlive).size();
|
||||
- float f = (size - 1) / 5.0F;
|
||||
- if (!(this.level().random.nextFloat() < f)) {
|
||||
+ // Purpur start - Shulker spawn from bullet options
|
||||
+ if ((!this.level().purpurConfig.shulkerSpawnFromBulletRequireOpenLid || !this.isClosed()) && this.teleportSomewhere()) {
|
||||
+ float chance = this.level().purpurConfig.shulkerSpawnFromBulletBaseChance;
|
||||
+ if (!this.level().purpurConfig.shulkerSpawnFromBulletNearbyEquation.isBlank()) {
|
||||
+ int nearby = this.level().getEntities((EntityTypeTest) EntityType.SHULKER, boundingBox.inflate(this.level().purpurConfig.shulkerSpawnFromBulletNearbyRange), Entity::isAlive).size();
|
||||
+ try {
|
||||
+ chance -= ((Number) scriptEngine.eval("let nearby = " + nearby + "; " + this.level().purpurConfig.shulkerSpawnFromBulletNearbyEquation)).floatValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ chance -= (nearby - 1) / 5.0F;
|
||||
+ }
|
||||
+ }
|
||||
+ if (this.level().random.nextFloat() <= chance) {
|
||||
Shulker shulker = EntityType.SHULKER.create(this.level(), EntitySpawnReason.BREEDING);
|
||||
+ // Purpur end - Shulker spawn from bullet options
|
||||
if (shulker != null) {
|
||||
shulker.setVariant(this.getVariant());
|
||||
shulker.snapTo(vec3);
|
||||
@@ -572,7 +598,7 @@ public class Shulker extends AbstractGolem implements Enemy {
|
||||
}
|
||||
|
||||
public Optional<DyeColor> getVariant() {
|
||||
- return Optional.ofNullable(this.getColor());
|
||||
+ return Optional.ofNullable(this.level().purpurConfig.shulkerSpawnFromBulletRandomColor ? DyeColor.random(this.level().random) : this.getColor()); // Purpur - Shulker spawn from bullet options
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1,75 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Skeleton.java b/net/minecraft/world/entity/monster/Skeleton.java
|
||||
index 48f26ed693b43e3f65f1559ba69b3d7249664f71..1f35105f6ddd33fc9558d19590a5696479d2de83 100644
|
||||
--- a/net/minecraft/world/entity/monster/Skeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/Skeleton.java
|
||||
@@ -139,4 +139,64 @@ public class Skeleton extends AbstractSkeleton {
|
||||
this.spawnAtLocation(level, Items.SKELETON_SKULL);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Skeletons eat wither roses
|
||||
+ private int witherRosesFed = 0;
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.InteractionResult mobInteract(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) {
|
||||
+ net.minecraft.world.item.ItemStack stack = player.getItemInHand(hand);
|
||||
+
|
||||
+ if (level().purpurConfig.skeletonFeedWitherRoses > 0 && this.getType() != EntityType.WITHER_SKELETON && stack.getItem() == net.minecraft.world.level.block.Blocks.WITHER_ROSE.asItem()) {
|
||||
+ return this.feedWitherRose(player, stack);
|
||||
+ }
|
||||
+
|
||||
+ return super.mobInteract(player, hand);
|
||||
+ }
|
||||
+
|
||||
+ private net.minecraft.world.InteractionResult feedWitherRose(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) {
|
||||
+ if (++witherRosesFed < level().purpurConfig.skeletonFeedWitherRoses) {
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.CONSUME;
|
||||
+ }
|
||||
+
|
||||
+ WitherSkeleton skeleton = EntityType.WITHER_SKELETON.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
|
||||
+ if (skeleton == null) {
|
||||
+ return net.minecraft.world.InteractionResult.PASS;
|
||||
+ }
|
||||
+
|
||||
+ skeleton.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
+ skeleton.setHealth(this.getHealth());
|
||||
+ skeleton.setAggressive(this.isAggressive());
|
||||
+ skeleton.copyPosition(this);
|
||||
+ skeleton.setYBodyRot(this.yBodyRot);
|
||||
+ skeleton.setYHeadRot(this.getYHeadRot());
|
||||
+ skeleton.yRotO = this.yRotO;
|
||||
+ skeleton.xRotO = this.xRotO;
|
||||
+
|
||||
+ if (this.hasCustomName()) {
|
||||
+ skeleton.setCustomName(this.getCustomName());
|
||||
+ }
|
||||
+
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, skeleton, org.bukkit.event.entity.EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
|
||||
+ return net.minecraft.world.InteractionResult.PASS;
|
||||
+ }
|
||||
+
|
||||
+ this.level().addFreshEntity(skeleton);
|
||||
+ this.remove(RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < 15; ++i) {
|
||||
+ ((ServerLevel) level()).sendParticlesSource(((ServerLevel) level()).players(), null, net.minecraft.core.particles.ParticleTypes.HAPPY_VILLAGER,
|
||||
+ false, true,
|
||||
+ getX() + random.nextFloat(), getY() + (random.nextFloat() * 2), getZ() + random.nextFloat(), 1,
|
||||
+ random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, 0);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end - Skeletons eat wither roses
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java
|
||||
index afa584e2aba6bebfb2dd343215b043c983281853..4b9e60d930bc3a4bfe9aad2e81391e57cfc45d40 100644
|
||||
--- a/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -392,6 +392,19 @@ public class Strider extends Animal implements ItemSteerable {
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
boolean isFood = this.isFood(player.getItemInHand(hand));
|
||||
+ // Purpur start
|
||||
+ if (level().purpurConfig.striderGiveSaddleBack && player.isSecondaryUseActive() && !isFood && isSaddled() && !isVehicle()) {
|
||||
+ this.setItemSlot(EquipmentSlot.SADDLE, ItemStack.EMPTY);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ ItemStack saddle = new ItemStack(Items.SADDLE);
|
||||
+ if (!player.getInventory().add(saddle)) {
|
||||
+ player.drop(saddle, false);
|
||||
+ }
|
||||
+ }
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
if (!isFood && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) {
|
||||
if (!this.level().isClientSide) {
|
||||
player.startRiding(this);
|
||||
@@ -1,22 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Vindicator.java b/net/minecraft/world/entity/monster/Vindicator.java
|
||||
index d02b4bfc3834cdfae37983ec616ee3cbcd9f0988..79c2248b0dce457fed6d61d4b38eeb92bbc3927e 100644
|
||||
--- a/net/minecraft/world/entity/monster/Vindicator.java
|
||||
+++ b/net/minecraft/world/entity/monster/Vindicator.java
|
||||
@@ -131,6 +131,11 @@ public class Vindicator extends AbstractIllager {
|
||||
RandomSource random = level.getRandom();
|
||||
this.populateDefaultEquipmentSlots(random, difficulty);
|
||||
this.populateDefaultEquipmentEnchantments(level, random, difficulty);
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ if (level().purpurConfig.vindicatorJohnnySpawnChance > 0D && random.nextDouble() <= level().purpurConfig.vindicatorJohnnySpawnChance) {
|
||||
+ setCustomName(Component.translatable("Johnny"));
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
return spawnGroupData1;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 39b65970a48568c95ff482b9636e7391f300ffa8..e15df574282e0f5ba5791435020bc6ac96860d15 100644
|
||||
--- a/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -118,7 +118,19 @@ public class Zombie extends Monster {
|
||||
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
|
||||
- if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Spigot
|
||||
+ // Purpur start - Add option to disable zombie aggressiveness towards villagers
|
||||
+ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false) { // Spigot
|
||||
+ @Override
|
||||
+ public boolean canUse() {
|
||||
+ return (level().purpurConfig.zombieAggressiveTowardsVillagerWhenLagging || !level().getServer().server.isLagging()) && super.canUse();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canContinueToUse() {
|
||||
+ return (level().purpurConfig.zombieAggressiveTowardsVillagerWhenLagging || !level().getServer().server.isLagging()) && super.canContinueToUse();
|
||||
+ }
|
||||
+ });
|
||||
+ // Purpur end - Add option to disable zombie aggressiveness towards villagers
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
|
||||
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
|
||||
}
|
||||
@@ -552,10 +564,7 @@ public class Zombie extends Monster {
|
||||
}
|
||||
|
||||
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
|
||||
- LocalDate localDate = LocalDate.now();
|
||||
- int i = localDate.get(ChronoField.DAY_OF_MONTH);
|
||||
- int i1 = localDate.get(ChronoField.MONTH_OF_YEAR);
|
||||
- if (i1 == 10 && i == 31 && random.nextFloat() < 0.25F) {
|
||||
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(level.getMinecraftWorld()) && this.random.nextFloat() < this.level().purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur - Halloween options and optimizations
|
||||
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.setDropChance(EquipmentSlot.HEAD, 0.0F);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index a8cd7103e636b57be1270d0f3549c709330b5536..6b0bbcf99941d768d235b9f96c3e112a4dfea2fc 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -130,10 +130,10 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (itemInHand.is(Items.GOLDEN_APPLE)) {
|
||||
- if (this.hasEffect(MobEffects.WEAKNESS)) {
|
||||
+ if (this.hasEffect(MobEffects.WEAKNESS) && level().purpurConfig.zombieVillagerCureEnabled) { // Purpur - Add option to disable zombie villagers cure
|
||||
itemInHand.consume(1, player);
|
||||
if (!this.level().isClientSide) {
|
||||
- this.startConverting(player.getUUID(), this.random.nextInt(2401) + 3600);
|
||||
+ this.startConverting(player.getUUID(), this.random.nextInt(level().purpurConfig.zombieVillagerCuringTimeMax - level().purpurConfig.zombieVillagerCuringTimeMin + 1) + level().purpurConfig.zombieVillagerCuringTimeMin); // Purpur - Customizable Zombie Villager curing times
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
@@ -1,36 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
index 05de183ce7b0be9b41f005b2ca36807a109fc634..eff0dec6efe043ad0cb0126061583bc5b67ba0e2 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
@@ -112,6 +112,12 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
||||
this.maybeAlertOthers();
|
||||
}
|
||||
|
||||
+ // Purpur start - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||
+ if (this.isAngry() && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) {
|
||||
+ this.lastHurtByPlayerMemoryTime = this.tickCount;
|
||||
+ }
|
||||
+ // Purpur end - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||
+
|
||||
super.customServerAiStep(level);
|
||||
}
|
||||
|
||||
@@ -159,6 +165,12 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
||||
this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
|
||||
}
|
||||
|
||||
+ // Purpur start - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||
+ if (livingEntity instanceof Player player && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) {
|
||||
+ this.setLastHurtByPlayer(player, this.tickCount);
|
||||
+ }
|
||||
+ // Purpur end - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||
+
|
||||
return super.setTarget(livingEntity, reason); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
index 4b1a3772f9e6b9e4efcf11e14b0fb882512ec86d..df1ef03f584fcaa31bd8cfd2c7301c784e4270d8 100644
|
||||
--- a/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
@@ -661,7 +661,10 @@ public class PiglinAi {
|
||||
|
||||
public static boolean isWearingSafeArmor(LivingEntity entity) {
|
||||
for (EquipmentSlot equipmentSlot : EquipmentSlotGroup.ARMOR) {
|
||||
- if (entity.getItemBySlot(equipmentSlot).is(ItemTags.PIGLIN_SAFE_ARMOR)) {
|
||||
+ // Purpur start - piglins ignore gold-trimmed armor
|
||||
+ net.minecraft.world.item.ItemStack itemStack = entity.getItemBySlot(equipmentSlot);
|
||||
+ if (itemStack.is(ItemTags.PIGLIN_SAFE_ARMOR) || (entity.level().purpurConfig.piglinIgnoresArmorWithGoldTrim && isWearingGoldTrim(itemStack.getItem()))) {
|
||||
+ // Purpur end - piglins ignore gold-trimmed armor
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -669,6 +672,13 @@ public class PiglinAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // Purpur start - piglins ignore gold-trimmed armor
|
||||
+ private static boolean isWearingGoldTrim(Item itemstack) {
|
||||
+ net.minecraft.world.item.equipment.trim.ArmorTrim armorTrim = itemstack.components().get(net.minecraft.core.component.DataComponents.TRIM);
|
||||
+ return armorTrim != null && armorTrim.material().is(net.minecraft.world.item.equipment.trim.TrimMaterials.GOLD);
|
||||
+ }
|
||||
+ // Purpur end - piglins ignore gold-trimmed armor
|
||||
+
|
||||
private static void stopWalking(Piglin piglin) {
|
||||
piglin.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
piglin.getNavigation().stop();
|
||||
@@ -1,49 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/CatSpawner.java b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
index e282b6ab6d0d1c11ee40f5f436bd50fa90ddc88b..d6ae13c19481ce33bfa0b6c9db63283009339d8c 100644
|
||||
--- a/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
+++ b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
@@ -25,7 +25,7 @@ public class CatSpawner implements CustomSpawner {
|
||||
if (spawnFriendlies && level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
this.nextTick--;
|
||||
if (this.nextTick <= 0) {
|
||||
- this.nextTick = 1200;
|
||||
+ this.nextTick = level.purpurConfig.catSpawnDelay; // Purpur - Cat spawning options
|
||||
Player randomPlayer = level.getRandomPlayer();
|
||||
if (randomPlayer != null) {
|
||||
RandomSource randomSource = level.random;
|
||||
@@ -48,9 +48,12 @@ public class CatSpawner implements CustomSpawner {
|
||||
}
|
||||
|
||||
private void spawnInVillage(ServerLevel level, BlockPos pos) {
|
||||
- int i = 48;
|
||||
- if (level.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
- List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(48.0, 8.0, 48.0));
|
||||
+ // Purpur start - Cat spawning options
|
||||
+ int range = level.purpurConfig.catSpawnVillageScanRange;
|
||||
+ if (range <= 0) return;
|
||||
+ if (level.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
+ List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
|
||||
+ // Purpur end - Cat spawning options
|
||||
if (entitiesOfClass.size() < 5) {
|
||||
this.spawnCat(pos, level, false);
|
||||
}
|
||||
@@ -58,8 +61,11 @@ public class CatSpawner implements CustomSpawner {
|
||||
}
|
||||
|
||||
private void spawnInHut(ServerLevel level, BlockPos pos) {
|
||||
- int i = 16;
|
||||
- List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(16.0, 8.0, 16.0));
|
||||
+ // Purpur start - Cat spawning options
|
||||
+ int range = level.purpurConfig.catSpawnSwampHutScanRange;
|
||||
+ if (range <= 0) return;
|
||||
+ List<Cat> entitiesOfClass = level.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
|
||||
+ // Purpur end - Cat spawning options
|
||||
if (entitiesOfClass.isEmpty()) {
|
||||
this.spawnCat(pos, level, true);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/WanderingTrader.java b/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
index 70cc20483905d3877e2ffb51afb4902bd59f0cd0..b0eec451b68a6a2697b1620410f07b25c4d2fda7 100644
|
||||
--- a/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
+++ b/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
@@ -59,6 +59,13 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Allow leashing villagers
|
||||
+ @Override
|
||||
+ public boolean canBeLeashed() {
|
||||
+ return level().purpurConfig.wanderingTraderCanBeLeashed;
|
||||
+ }
|
||||
+ // Purpur end - Allow leashing villagers
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
@@ -79,7 +86,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
this,
|
||||
new ItemStack(Items.MILK_BUCKET),
|
||||
SoundEvents.WANDERING_TRADER_REAPPEARED,
|
||||
- wanderingTrader -> this.canDrinkMilk && this.level().isBrightOutside() && wanderingTrader.isInvisible() // Paper - Add more WanderingTrader API
|
||||
+ wanderingTrader -> level().purpurConfig.milkClearsBeneficialEffects && this.canDrinkMilk && this.level().isBrightOutside() && wanderingTrader.isInvisible() // Paper - Add more WanderingTrader API // // Purpur - Milk Keeps Beneficial Effects
|
||||
)
|
||||
);
|
||||
this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this));
|
||||
@@ -123,8 +130,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
+ if (this.level().purpurConfig.wanderingTraderAllowTrading) { // Purpur - Add config for villager trading
|
||||
this.setTradingPlayer(player);
|
||||
this.openTradingScreen(player, this.getDisplayName(), 1);
|
||||
+ } // Purpur - Add config for villager trading
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -1,29 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
index 9d9ec2bf16027b479bbc4339ad4e9dcfc2077d40..d4527765262818099dfb695d6a84b56d33888e34 100644
|
||||
--- a/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
+++ b/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
@@ -137,7 +137,17 @@ public class WanderingTraderSpawner implements CustomSpawner {
|
||||
int i1 = pos.getX() + this.random.nextInt(maxDistance * 2) - maxDistance;
|
||||
int i2 = pos.getZ() + this.random.nextInt(maxDistance * 2) - maxDistance;
|
||||
int height = level.getHeight(Heightmap.Types.WORLD_SURFACE, i1, i2);
|
||||
- BlockPos blockPos1 = new BlockPos(i1, height, i2);
|
||||
+ // Purpur start - Allow toggling special MobSpawners per world - allow traders to spawn below nether roof
|
||||
+ BlockPos.MutableBlockPos blockPos1 = new BlockPos.MutableBlockPos(i1, height, i2);
|
||||
+ if (level.dimensionType().hasCeiling()) {
|
||||
+ do {
|
||||
+ blockPos1.relative(net.minecraft.core.Direction.DOWN);
|
||||
+ } while (!level.getBlockState(blockPos1).isAir());
|
||||
+ do {
|
||||
+ blockPos1.relative(net.minecraft.core.Direction.DOWN);
|
||||
+ } while (level.getBlockState(blockPos1).isAir() && blockPos1.getY() > 0);
|
||||
+ }
|
||||
+ // Purpur end - Allow toggling special MobSpawners per world
|
||||
if (placementType.isSpawnPositionOk(level, blockPos1, EntityType.WANDERING_TRADER)) {
|
||||
blockPos = blockPos1;
|
||||
break;
|
||||
@@ -1,40 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/AbstractArrow.java b/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 595cdb7d013eb0b9282b133a22f51ee865d18623..b00e5b523a07bd3f65c6d7eee96430266e5661c9 100644
|
||||
--- a/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -79,6 +79,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
public ItemStack pickupItemStack = this.getDefaultPickupItem();
|
||||
@Nullable
|
||||
public ItemStack firedFromWeapon = null;
|
||||
+ public net.minecraft.world.item.enchantment.ItemEnchantments actualEnchantments = net.minecraft.world.item.enchantment.ItemEnchantments.EMPTY; // Purpur - Add an option to fix MC-3304 projectile looting
|
||||
|
||||
protected AbstractArrow(EntityType<? extends AbstractArrow> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -352,7 +353,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
this.setInGround(false);
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
this.setDeltaMovement(deltaMovement.multiply(this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F));
|
||||
- this.life = 0;
|
||||
+ if (this.level().purpurConfig.arrowMovementResetsDespawnCounter) this.life = 0; // Purpur - Arrows should not reset despawn counter
|
||||
}
|
||||
|
||||
public boolean isInGround() {
|
||||
@@ -576,6 +577,12 @@ public abstract class AbstractArrow extends Projectile {
|
||||
return this.firedFromWeapon;
|
||||
}
|
||||
|
||||
+ // Purpur start - Add an option to fix MC-3304 projectile looting
|
||||
+ public void setActualEnchantments(net.minecraft.world.item.enchantment.ItemEnchantments actualEnchantments) {
|
||||
+ this.actualEnchantments = actualEnchantments;
|
||||
+ }
|
||||
+ // Purpur end - Add an option to fix MC-3304 projectile looting
|
||||
+
|
||||
protected SoundEvent getDefaultHitGroundSoundEvent() {
|
||||
return SoundEvents.ARROW_HIT;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java
|
||||
index 677b4b681f9c2c09a8ae3cfdec72102265547a7b..d8f9fb603fd2e3e5c1dfc05face7f42b4844daf4 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Snowball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Snowball.java
|
||||
@@ -52,10 +52,40 @@ public class Snowball extends ThrowableItemProjectile {
|
||||
protected void onHitEntity(EntityHitResult result) {
|
||||
super.onHitEntity(result);
|
||||
Entity entity = result.getEntity();
|
||||
- int i = entity instanceof Blaze ? 3 : 0;
|
||||
+ int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur - Add configurable snowball damage
|
||||
entity.hurt(this.damageSources().thrown(this, this.getOwner()), i);
|
||||
}
|
||||
|
||||
+ // Purpur start - options to extinguish fire blocks with snowballs - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire
|
||||
+ @Override
|
||||
+ protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) {
|
||||
+ super.onHitBlock(blockHitResult);
|
||||
+
|
||||
+ if (!this.level().isClientSide) {
|
||||
+ net.minecraft.core.BlockPos pos = blockHitResult.getBlockPos();
|
||||
+ net.minecraft.core.BlockPos relativePos = pos.relative(blockHitResult.getDirection());
|
||||
+
|
||||
+ net.minecraft.world.level.block.state.BlockState blockState = this.level().getBlockState(pos);
|
||||
+
|
||||
+ if (this.level().purpurConfig.snowballExtinguishesFire && this.level().getBlockState(relativePos).is(net.minecraft.world.level.block.Blocks.FIRE)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, relativePos, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
|
||||
+ this.level().removeBlock(relativePos, false);
|
||||
+ }
|
||||
+ } else if (this.level().purpurConfig.snowballExtinguishesCandles && net.minecraft.world.level.block.AbstractCandleBlock.isLit(blockState)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, pos, blockState.setValue(net.minecraft.world.level.block.AbstractCandleBlock.LIT, false))) {
|
||||
+ net.minecraft.world.level.block.AbstractCandleBlock.extinguish(null, blockState, this.level(), pos);
|
||||
+ }
|
||||
+ } else if (this.level().purpurConfig.snowballExtinguishesCampfires && net.minecraft.world.level.block.CampfireBlock.isLitCampfire(blockState)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, pos, blockState.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false))) {
|
||||
+ this.level().levelEvent(null, 1009, pos, 0);
|
||||
+ net.minecraft.world.level.block.CampfireBlock.dowse(this.getOwner(), this.level(), pos, blockState);
|
||||
+ this.level().setBlockAndUpdate(pos, blockState.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - options to extinguish fire blocks with snowballs
|
||||
+
|
||||
@Override
|
||||
protected void onHit(HitResult result) {
|
||||
super.onHit(result);
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/ThrownTrident.java b/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
index 00f805667ea48fd8699f3cea05781739e376cedd..e814daaa10c138b1497dffbdf9224d34cd9c9926 100644
|
||||
--- a/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
@@ -65,7 +65,7 @@ public class ThrownTrident extends AbstractArrow {
|
||||
|
||||
Entity owner = this.getOwner();
|
||||
int i = this.entityData.get(ID_LOYALTY);
|
||||
- if (i > 0 && (this.dealtDamage || this.isNoPhysics()) && owner != null) {
|
||||
+ if (i > 0 && (this.dealtDamage || this.isNoPhysics() || (level().purpurConfig.tridentLoyaltyVoidReturnHeight < 0.0D && getY() < level().purpurConfig.tridentLoyaltyVoidReturnHeight)) && owner != null) { // Purpur - Add option to allow loyalty on tridents to work in the void
|
||||
if (!this.isAcceptibleReturnOwner()) {
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.pickup == AbstractArrow.Pickup.ALLOWED) {
|
||||
this.spawnAtLocation(serverLevel, this.getPickupItem(), 0.1F);
|
||||
@@ -1,33 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/WitherSkull.java b/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
index a2fdc87bedd1a63064cb8c7a7615978483268fdc..c96dc62b9f890335892a8075ed9b1285f98c9e8a 100644
|
||||
--- a/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
+++ b/net/minecraft/world/entity/projectile/WitherSkull.java
|
||||
@@ -93,7 +93,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
||||
super.onHit(result);
|
||||
if (!this.level().isClientSide) {
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
|
||||
+ org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent(this.getBukkitEntity(), this.level().purpurConfig.witherExplosionRadius, false); // Purpur - Config for wither explosion radius
|
||||
if (event.callEvent()) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB);
|
||||
}
|
||||
@@ -102,6 +102,13 @@ public class WitherSkull extends AbstractHurtingProjectile {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Add canSaveToDisk to Entity
|
||||
+ @Override
|
||||
+ public boolean canSaveToDisk() {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Add canSaveToDisk to Entity
|
||||
+
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
builder.define(DATA_DANGEROUS, false);
|
||||
@@ -1,50 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/raid/Raids.java b/net/minecraft/world/entity/raid/Raids.java
|
||||
index 693eef486f1a3b4ea7e5fd5ecf2d25d85f424d97..5837d976abf663bd46a64f46348613db9284254d 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raids.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raids.java
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class Raids extends SavedData {
|
||||
private static final String RAID_FILE_ID = "raids";
|
||||
+ public final java.util.Map<java.util.UUID, Integer> playerCooldowns = com.google.common.collect.Maps.newHashMap(); // Purpur - Raid cooldown setting
|
||||
public static final Codec<Raids> CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
Raids.RaidWithId.CODEC
|
||||
@@ -81,6 +82,17 @@ public class Raids extends SavedData {
|
||||
|
||||
public void tick(ServerLevel level) {
|
||||
this.tick++;
|
||||
+ // Purpur start - Raid cooldown setting
|
||||
+ if (level.purpurConfig.raidCooldownSeconds != 0 && this.tick % 20 == 0) {
|
||||
+ com.google.common.collect.ImmutableMap.copyOf(playerCooldowns).forEach((uuid, i) -> {
|
||||
+ if (i < 1) {
|
||||
+ playerCooldowns.remove(uuid);
|
||||
+ } else {
|
||||
+ playerCooldowns.put(uuid, i - 1);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ // Purpur end - Raid cooldown setting
|
||||
Iterator<Raid> iterator = this.raidMap.values().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -148,11 +160,13 @@ public class Raids extends SavedData {
|
||||
// }
|
||||
|
||||
if (!raid.isStarted() || (raid.isInProgress() && raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel())) { // CraftBukkit - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
|
||||
+ if (serverLevel.purpurConfig.raidCooldownSeconds != 0 && playerCooldowns.containsKey(player.getUUID())) return null; // Purpur - Raid cooldown setting
|
||||
// CraftBukkit start
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(serverLevel, raid, player)) {
|
||||
player.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN);
|
||||
return null;
|
||||
}
|
||||
+ if (serverLevel.purpurConfig.raidCooldownSeconds != 0) playerCooldowns.put(player.getUUID(), serverLevel.purpurConfig.raidCooldownSeconds); // Purpur - Raid cooldown setting
|
||||
|
||||
if (!raid.isStarted() && !this.raidMap.containsValue(raid)) {
|
||||
this.raidMap.put(this.getUniqueId(), raid);
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/vehicle/AbstractBoat.java b/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
index 4541bb5233e986d9993d8593afef9b12c935d00a..abfe3370382c39aeab2cc7832c0ff6ee5b95fa5b 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
@@ -433,6 +433,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {
|
||||
float groundFriction = this.getGroundFriction();
|
||||
if (groundFriction > 0.0F) {
|
||||
this.landFriction = groundFriction;
|
||||
+ if (level().purpurConfig.boatEjectPlayersOnLand) ejectPassengers(); // Purpur - Add option for boats to eject players on land
|
||||
return AbstractBoat.Status.ON_LAND;
|
||||
} else {
|
||||
return AbstractBoat.Status.IN_AIR;
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java b/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java
|
||||
index 090b19752fbfc856d9fbf118510afc6cda2b9989..325ec57df2885f5e81b8a6b61e3a9fed9484b30f 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java
|
||||
@@ -391,7 +391,7 @@ public class NewMinecartBehavior extends MinecartBehavior {
|
||||
private Vec3 calculateBoostTrackSpeed(Vec3 speed, BlockPos pos, BlockState state) {
|
||||
if (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED)) {
|
||||
if (speed.length() > 0.01) {
|
||||
- return speed.normalize().scale(speed.length() + 0.06);
|
||||
+ return speed.normalize().scale(speed.length() + this.level().purpurConfig.poweredRailBoostModifier); // Purpur - Configurable powered rail boost modifier
|
||||
} else {
|
||||
Vec3 redstoneDirection = this.minecart.getRedstoneDirection(pos);
|
||||
return redstoneDirection.lengthSqr() <= 0.0 ? speed : redstoneDirection.scale(speed.length() + 0.2);
|
||||
@@ -1,21 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java b/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java
|
||||
index 0d09b0809e7b224538cf5cfac9e36ec5ba10b709..4d224dc127d245556892e761fa4927a76e4b8e9a 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java
|
||||
@@ -243,8 +243,8 @@ public class OldMinecartBehavior extends MinecartBehavior {
|
||||
Vec3 deltaMovement1 = this.getDeltaMovement();
|
||||
double d13 = deltaMovement1.horizontalDistance();
|
||||
if (d13 > 0.01) {
|
||||
- double d14 = 0.06;
|
||||
- this.setDeltaMovement(deltaMovement1.add(deltaMovement1.x / d13 * 0.06, 0.0, deltaMovement1.z / d13 * 0.06));
|
||||
+ double d14 = level.purpurConfig.poweredRailBoostModifier; // Purpur - Configurable powered rail boost modifier
|
||||
+ this.setDeltaMovement(deltaMovement1.add(deltaMovement1.x / d13 * level.purpurConfig.poweredRailBoostModifier, 0.0, deltaMovement1.z / d13 * level.purpurConfig.poweredRailBoostModifier)); // Purpur - Configurable powered rail boost modifier
|
||||
} else {
|
||||
Vec3 deltaMovement2 = this.getDeltaMovement();
|
||||
double d15 = deltaMovement2.x;
|
||||
@@ -1,27 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/food/FoodData.java b/net/minecraft/world/food/FoodData.java
|
||||
index 89d783315dab8ca469a1fa724cd59a329d4c2b55..7fa061718989365725ff49abd2d19d1ba3f935f9 100644
|
||||
--- a/net/minecraft/world/food/FoodData.java
|
||||
+++ b/net/minecraft/world/food/FoodData.java
|
||||
@@ -38,6 +38,7 @@ public class FoodData {
|
||||
int oldFoodLevel = this.foodLevel;
|
||||
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(serverPlayer, foodProperties.nutrition() + oldFoodLevel, stack);
|
||||
if (!event.isCancelled()) {
|
||||
+ if (serverPlayer.level().purpurConfig.playerBurpWhenFull && event.getFoodLevel() == 20 && oldFoodLevel < 20) serverPlayer.burpDelay = serverPlayer.level().purpurConfig.playerBurpDelay; // Purpur - Burp after eating food fills hunger bar completely
|
||||
this.add(event.getFoodLevel() - oldFoodLevel, foodProperties.saturation());
|
||||
}
|
||||
serverPlayer.getBukkitEntity().sendHealthUpdate();
|
||||
@@ -86,7 +87,7 @@ public class FoodData {
|
||||
this.tickTimer++;
|
||||
if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
|
||||
if (player.getHealth() > 10.0F || difficulty == Difficulty.HARD || player.getHealth() > 1.0F && difficulty == Difficulty.NORMAL) {
|
||||
- player.hurtServer(serverLevel, player.damageSources().starve(), 1.0F);
|
||||
+ player.hurtServer(serverLevel, player.damageSources().starve(), player.level().purpurConfig.hungerStarvationDamage); // Purpur - Configurable hunger starvation damage
|
||||
}
|
||||
|
||||
this.tickTimer = 0;
|
||||
@@ -1,25 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/food/FoodProperties.java b/net/minecraft/world/food/FoodProperties.java
|
||||
index 793e4528755fa5688efbad75418188e693ad0157..20f702c8266eb54a8835861188eb937f4732e078 100644
|
||||
--- a/net/minecraft/world/food/FoodProperties.java
|
||||
+++ b/net/minecraft/world/food/FoodProperties.java
|
||||
@@ -42,9 +42,11 @@ public record FoodProperties(int nutrition, float saturation, boolean canAlwaysE
|
||||
level.playSound(null, entity.getX(), entity.getY(), entity.getZ(), consumable.sound().value(), SoundSource.NEUTRAL, 1.0F, random.triangle(1.0F, 0.4F));
|
||||
if (entity instanceof Player player) {
|
||||
player.getFoodData().eat(this, stack, (net.minecraft.server.level.ServerPlayer) player); // CraftBukkit
|
||||
- level.playSound(
|
||||
- null, player.getX(), player.getY(), player.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, Mth.randomBetween(random, 0.9F, 1.0F)
|
||||
- );
|
||||
+ // Purpur start - Burp delay - moved to Player#tick()
|
||||
+ //level.playSound(
|
||||
+ // null, player.getX(), player.getY(), player.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, Mth.randomBetween(random, 0.9F, 1.0F)
|
||||
+ //);
|
||||
+ // Purpur end - Burp delay - moved to Player#tick()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 813417a09b4acc7d57e80a53d970767e230d75b1..c4721eb0efe34f5e313bc890b4e960144eca4fe1 100644
|
||||
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -65,6 +65,7 @@ public abstract class AbstractContainerMenu {
|
||||
@Nullable
|
||||
private ContainerSynchronizer synchronizer;
|
||||
private boolean suppressRemoteUpdates;
|
||||
+ @Nullable protected ItemStack activeQuickItem = null; // Purpur - Anvil API
|
||||
// CraftBukkit start
|
||||
public boolean checkReachable = true;
|
||||
public abstract org.bukkit.inventory.InventoryView getBukkitView();
|
||||
@@ -1,25 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/AbstractFurnaceMenu.java b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
index b42d55c1c0c405ce3ce073138343e74fa036fa65..b86e49b09a036532e7dbd56bc52b13cefe77f75b 100644
|
||||
--- a/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
@@ -121,7 +121,13 @@ public abstract class AbstractFurnaceMenu extends RecipeBookMenu {
|
||||
} else if (index != 1 && index != 0) {
|
||||
if (this.canSmelt(item)) {
|
||||
if (!this.moveItemStackTo(item, 0, 1, false)) {
|
||||
- return ItemStack.EMPTY;
|
||||
+ // Purpur start - Added the ability to add combustible items
|
||||
+ if (this.isFuel(item)) {
|
||||
+ if (!this.moveItemStackTo(item, 1, 2, false)) {
|
||||
+ return ItemStack.EMPTY;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Added the ability to add combustible items
|
||||
}
|
||||
} else if (this.isFuel(item)) {
|
||||
if (!this.moveItemStackTo(item, 1, 2, false)) {
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/ArmorSlot.java b/net/minecraft/world/inventory/ArmorSlot.java
|
||||
index 0a440ea37d14cd840cf87a99264ace5ccde7c073..dec920727401de7f5bcc6c7e50f9dd325367ee90 100644
|
||||
--- a/net/minecraft/world/inventory/ArmorSlot.java
|
||||
+++ b/net/minecraft/world/inventory/ArmorSlot.java
|
||||
@@ -47,7 +47,7 @@ class ArmorSlot extends Slot {
|
||||
@Override
|
||||
public boolean mayPickup(Player player) {
|
||||
ItemStack item = this.getItem();
|
||||
- return (item.isEmpty() || player.isCreative() || !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE))
|
||||
+ return (item.isEmpty() || player.isCreative() || (!EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) || player.level().purpurConfig.playerRemoveBindingWithWeakness && player.hasEffect(net.minecraft.world.effect.MobEffects.WEAKNESS))) // Purpur - Config to remove curse of binding with weakness
|
||||
&& super.mayPickup(player);
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/EnchantmentMenu.java b/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
index cf9ab4c9fba11f5a0b293978853e205de81d6fc7..d0d6ae9c9c432f8bd5d9c91113fc5491e321afad 100644
|
||||
--- a/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
+++ b/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
@@ -63,6 +63,22 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
return access.getLocation();
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Purpur start - Enchantment Table Persists Lapis
|
||||
+ @Override
|
||||
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
|
||||
+ super.onClose(who);
|
||||
+
|
||||
+ if (who.getHandle().level().purpurConfig.enchantmentTableLapisPersists) {
|
||||
+ access.execute((level, pos) -> {
|
||||
+ net.minecraft.world.level.block.entity.BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
+ if (blockEntity instanceof net.minecraft.world.level.block.entity.EnchantingTableBlockEntity enchantmentTable) {
|
||||
+ enchantmentTable.setLapis(this.getItem(1).getCount());
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Enchantment Table Persists Lapis
|
||||
};
|
||||
// Paper end - Add missing InventoryHolders
|
||||
this.access = access;
|
||||
@@ -83,6 +99,16 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
return EnchantmentMenu.EMPTY_SLOT_LAPIS_LAZULI;
|
||||
}
|
||||
});
|
||||
+ // Purpur start - Enchantment Table Persists Lapis
|
||||
+ access.execute((level, pos) -> {
|
||||
+ if (level.purpurConfig.enchantmentTableLapisPersists) {
|
||||
+ net.minecraft.world.level.block.entity.BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
+ if (blockEntity instanceof net.minecraft.world.level.block.entity.EnchantingTableBlockEntity enchantmentTable) {
|
||||
+ this.getSlot(1).set(new ItemStack(Items.LAPIS_LAZULI, enchantmentTable.getLapis()));
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ // Purpur end - Enchantment Table Persists Lapis
|
||||
this.addStandardInventorySlots(playerInventory, 8, 84);
|
||||
this.addDataSlot(DataSlot.shared(this.costs, 0));
|
||||
this.addDataSlot(DataSlot.shared(this.costs, 1));
|
||||
@@ -299,7 +325,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public void removed(Player player) {
|
||||
super.removed(player);
|
||||
- this.access.execute((level, blockPos) -> this.clearContainer(player, this.enchantSlots));
|
||||
+ this.access.execute((level, blockPos) -> {if (level.purpurConfig.enchantmentTableLapisPersists) this.getSlot(1).set(ItemStack.EMPTY);this.clearContainer(player, this.enchantSlots);}); // Purpur - Enchantment Table Persists Lapis
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,146 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/GrindstoneMenu.java b/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 6eaa468c90a826f9fdecf2cf672c4893122d2504..5cb69b7ffc82905e5ba8c99c76ce14348f89e21c 100644
|
||||
--- a/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -91,11 +91,13 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public void onTake(Player player, ItemStack stack) {
|
||||
access.execute((level, blockPos) -> {
|
||||
+ ItemStack itemstack = activeQuickItem == null ? stack : activeQuickItem; // Purpur - Grindstone API
|
||||
if (level instanceof ServerLevel) {
|
||||
// Paper start - Fire BlockExpEvent on grindstone use
|
||||
org.bukkit.event.block.BlockExpEvent event = new org.bukkit.event.block.BlockExpEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, blockPos), this.getExperienceAmount(level));
|
||||
event.callEvent();
|
||||
- ExperienceOrb.award((ServerLevel) level, Vec3.atCenterOf(blockPos), event.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player);
|
||||
+ org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent grindstoneTakeResultEvent = new org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent(player.getBukkitEntity(), getBukkitView(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), event.getExpToDrop()); grindstoneTakeResultEvent.callEvent(); // Purpur - Grindstone API
|
||||
+ ExperienceOrb.award((ServerLevel) level, Vec3.atCenterOf(blockPos), grindstoneTakeResultEvent.getExperienceAmount(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Purpur - Grindstone API
|
||||
// Paper end - Fire BlockExpEvent on grindstone use
|
||||
}
|
||||
|
||||
@@ -124,7 +126,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
for (Entry<Holder<Enchantment>> entry : enchantmentsForCrafting.entrySet()) {
|
||||
Holder<Enchantment> holder = entry.getKey();
|
||||
int intValue = entry.getIntValue();
|
||||
- if (!holder.is(EnchantmentTags.CURSE)) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(holder.value())) { // Purpur - Config for grindstones
|
||||
i += holder.value().getMinCost(intValue);
|
||||
}
|
||||
}
|
||||
@@ -202,15 +204,75 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
|
||||
for (Entry<Holder<Enchantment>> entry : enchantmentsForCrafting.entrySet()) {
|
||||
Holder<Enchantment> holder = entry.getKey();
|
||||
- if (!holder.is(EnchantmentTags.CURSE) || mutable.getLevel(holder) == 0) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(holder.value()) || mutable.getLevel(holder) == 0) { // Purpur - Config for grindstones
|
||||
mutable.upgrade(holder, entry.getIntValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+ // Purpur start - Config for grindstones
|
||||
+ private java.util.List<net.minecraft.core.component.DataComponentType<?>> GRINDSTONE_REMOVE_ATTRIBUTES_REMOVAL_LIST = java.util.List.of(
|
||||
+ // DataComponents.MAX_STACK_SIZE,
|
||||
+ // DataComponents.DAMAGE,
|
||||
+ // DataComponents.BLOCK_STATE,
|
||||
+ DataComponents.CUSTOM_DATA,
|
||||
+ // DataComponents.MAX_DAMAGE,
|
||||
+ // DataComponents.UNBREAKABLE,
|
||||
+ // DataComponents.CUSTOM_NAME,
|
||||
+ // DataComponents.ITEM_NAME,
|
||||
+ // DataComponents.LORE,
|
||||
+ // DataComponents.RARITY,
|
||||
+ // DataComponents.ENCHANTMENTS,
|
||||
+ // DataComponents.CAN_PLACE_ON,
|
||||
+ // DataComponents.CAN_BREAK,
|
||||
+ DataComponents.ATTRIBUTE_MODIFIERS,
|
||||
+ DataComponents.CUSTOM_MODEL_DATA,
|
||||
+ // DataComponents.HIDE_ADDITIONAL_TOOLTIP,
|
||||
+ // DataComponents.HIDE_TOOLTIP,
|
||||
+ // DataComponents.REPAIR_COST,
|
||||
+ // DataComponents.CREATIVE_SLOT_LOCK,
|
||||
+ // DataComponents.ENCHANTMENT_GLINT_OVERRIDE,
|
||||
+ // DataComponents.INTANGIBLE_PROJECTILE,
|
||||
+ // DataComponents.FOOD,
|
||||
+ // DataComponents.FIRE_RESISTANT,
|
||||
+ // DataComponents.TOOL,
|
||||
+ // DataComponents.STORED_ENCHANTMENTS,
|
||||
+ DataComponents.DYED_COLOR,
|
||||
+ // DataComponents.MAP_COLOR,
|
||||
+ // DataComponents.MAP_ID,
|
||||
+ // DataComponents.MAP_DECORATIONS,
|
||||
+ // DataComponents.MAP_POST_PROCESSING,
|
||||
+ // DataComponents.CHARGED_PROJECTILES,
|
||||
+ // DataComponents.BUNDLE_CONTENTS,
|
||||
+ // DataComponents.POTION_CONTENTS,
|
||||
+ DataComponents.SUSPICIOUS_STEW_EFFECTS
|
||||
+ // DataComponents.WRITABLE_BOOK_CONTENT,
|
||||
+ // DataComponents.WRITTEN_BOOK_CONTENT,
|
||||
+ // DataComponents.TRIM,
|
||||
+ // DataComponents.DEBUG_STICK_STATE,
|
||||
+ // DataComponents.ENTITY_DATA,
|
||||
+ // DataComponents.BUCKET_ENTITY_DATA,
|
||||
+ // DataComponents.BLOCK_ENTITY_DATA,
|
||||
+ // DataComponents.INSTRUMENT,
|
||||
+ // DataComponents.OMINOUS_BOTTLE_AMPLIFIER,
|
||||
+ // DataComponents.RECIPES,
|
||||
+ // DataComponents.LODESTONE_TRACKER,
|
||||
+ // DataComponents.FIREWORK_EXPLOSION,
|
||||
+ // DataComponents.FIREWORKS,
|
||||
+ // DataComponents.PROFILE,
|
||||
+ // DataComponents.NOTE_BLOCK_SOUND,
|
||||
+ // DataComponents.BANNER_PATTERNS,
|
||||
+ // DataComponents.BASE_COLOR,
|
||||
+ // DataComponents.POT_DECORATIONS,
|
||||
+ // DataComponents.CONTAINER,
|
||||
+ // DataComponents.BEES,
|
||||
+ // DataComponents.LOCK,
|
||||
+ // DataComponents.CONTAINER_LOOT,
|
||||
+ );
|
||||
+ // Purpur end - Config for grindstones
|
||||
private ItemStack removeNonCursesFrom(ItemStack item) {
|
||||
- ItemEnchantments itemEnchantments = EnchantmentHelper.updateEnchantments(item, mutable -> mutable.removeIf(holder -> !holder.is(EnchantmentTags.CURSE)));
|
||||
+ ItemEnchantments itemEnchantments = EnchantmentHelper.updateEnchantments(item, mutable -> mutable.removeIf(holder -> !org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(holder.value()))); // Purpur - Config for grindstones
|
||||
if (item.is(Items.ENCHANTED_BOOK) && itemEnchantments.isEmpty()) {
|
||||
item = item.transmuteCopy(Items.BOOK);
|
||||
}
|
||||
@@ -222,6 +284,23 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
}
|
||||
|
||||
item.set(DataComponents.REPAIR_COST, i);
|
||||
+
|
||||
+ // Purpur start - Config for grindstones
|
||||
+ net.minecraft.core.component.DataComponentPatch.Builder builder = net.minecraft.core.component.DataComponentPatch.builder();
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.grindstoneRemoveAttributes) {
|
||||
+ item.getComponents().forEach(typedDataComponent -> {
|
||||
+ if (GRINDSTONE_REMOVE_ATTRIBUTES_REMOVAL_LIST.contains(typedDataComponent.type())) {
|
||||
+ builder.remove(typedDataComponent.type());
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.grindstoneRemoveDisplay) {
|
||||
+ builder.remove(DataComponents.CUSTOM_NAME);
|
||||
+ builder.remove(DataComponents.LORE);
|
||||
+ }
|
||||
+ item.applyComponents(builder.build());
|
||||
+ // Purpur end - Config for grindstones
|
||||
+
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -278,7 +357,9 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
+ this.activeQuickItem = itemStack; // Purpur - Grindstone API
|
||||
slot.onTake(player, item);
|
||||
+ this.activeQuickItem = null; // Purpur - Grindstone API
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
@@ -1,20 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/ItemCombinerMenu.java b/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
index 34d52c941395645e77de810855b14012c259cf02..c605bd700fd9f5a6596a2bf9648492786306b025 100644
|
||||
--- a/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
+++ b/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
@@ -156,7 +156,9 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
+ this.activeQuickItem = itemStack; // Purpur - Anvil API
|
||||
slot.onTake(player, item);
|
||||
+ this.activeQuickItem = null; // Purpur - Anvil API
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
@@ -1,79 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/AxeItem.java b/net/minecraft/world/item/AxeItem.java
|
||||
index bd919b9a83f9736f02783b1ba3863fd1b77c7e89..eb8d2d6f9c65185f5fe16a13ab0cdbba78a25a40 100644
|
||||
--- a/net/minecraft/world/item/AxeItem.java
|
||||
+++ b/net/minecraft/world/item/AxeItem.java
|
||||
@@ -62,13 +62,15 @@ public class AxeItem extends Item {
|
||||
if (playerHasBlockingItemUseIntent(context)) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
- Optional<BlockState> optional = this.evaluateNewBlockState(level, clickedPos, player, level.getBlockState(clickedPos));
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional = this.evaluateActionable(level, clickedPos, player, level.getBlockState(clickedPos)); // Purpur - Tool actionable options
|
||||
if (optional.isEmpty()) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
+ org.purpurmc.purpur.tool.Actionable actionable = optional.get(); // Purpur - Tool actionable options
|
||||
+ BlockState state = actionable.into().withPropertiesOf(level.getBlockState(clickedPos)); // Purpur - Tool actionable options
|
||||
ItemStack itemInHand = context.getItemInHand();
|
||||
// Paper start - EntityChangeBlockEvent
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, clickedPos, optional.get())) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, clickedPos, state)) { // Purpur - Tool actionable options
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
// Paper end
|
||||
@@ -76,8 +78,15 @@ public class AxeItem extends Item {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, clickedPos, itemInHand);
|
||||
}
|
||||
|
||||
- level.setBlock(clickedPos, optional.get(), 11);
|
||||
- level.gameEvent(GameEvent.BLOCK_CHANGE, clickedPos, GameEvent.Context.of(player, optional.get()));
|
||||
+ // Purpur start - Tool actionable options
|
||||
+ level.setBlock(clickedPos, state, 11);
|
||||
+ actionable.drops().forEach((drop, chance) -> {
|
||||
+ if (level.random.nextDouble() < chance) {
|
||||
+ Block.popResourceFromFace(level, clickedPos, context.getClickedFace(), new ItemStack(drop));
|
||||
+ }
|
||||
+ });
|
||||
+ level.gameEvent(GameEvent.BLOCK_CHANGE, clickedPos, GameEvent.Context.of(player, state));
|
||||
+ // Purpur end - Tool actionable options
|
||||
if (player != null) {
|
||||
itemInHand.hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
|
||||
}
|
||||
@@ -94,22 +103,24 @@ public class AxeItem extends Item {
|
||||
&& !player.isSecondaryUseActive();
|
||||
}
|
||||
|
||||
- private Optional<BlockState> evaluateNewBlockState(Level level, BlockPos pos, @Nullable Player player, BlockState state) {
|
||||
- Optional<BlockState> stripped = this.getStripped(state);
|
||||
+ private Optional<org.purpurmc.purpur.tool.Actionable> evaluateActionable(Level level, BlockPos pos, @Nullable Player player, BlockState state) { // Purpur - Tool actionable options
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> stripped = Optional.ofNullable(level.purpurConfig.axeStrippables.get(state.getBlock())); // Purpur - Tool actionable options
|
||||
if (stripped.isPresent()) {
|
||||
- level.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(STRIPPABLES.containsKey(state.getBlock()) ? player : null, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
return stripped;
|
||||
} else {
|
||||
- Optional<BlockState> previous = WeatheringCopper.getPrevious(state);
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> previous = Optional.ofNullable(level.purpurConfig.axeWeatherables.get(state.getBlock())); // Purpur - Tool actionable options
|
||||
if (previous.isPresent()) {
|
||||
- level.playSound(player, pos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(WeatheringCopper.getPrevious(state).isPresent() ? player : null, pos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - Tool actionable options - force sound
|
||||
level.levelEvent(player, 3005, pos, 0);
|
||||
return previous;
|
||||
} else {
|
||||
- Optional<BlockState> optional = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(state.getBlock()))
|
||||
- .map(block -> block.withPropertiesOf(state));
|
||||
+ // Purpur start - Tool actionable options
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional = Optional.ofNullable(level.purpurConfig.axeWaxables.get(state.getBlock()));
|
||||
+ // .map(block -> block.withPropertiesOf(state));
|
||||
+ // Purpur end - Tool actionable options
|
||||
if (optional.isPresent()) {
|
||||
- level.playSound(player, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(HoneycombItem.WAX_OFF_BY_BLOCK.get().containsKey(state.getBlock()) ? player : null, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - Tool actionable options - force sound
|
||||
level.levelEvent(player, 3004, pos, 0);
|
||||
return optional;
|
||||
} else {
|
||||
@@ -1,44 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
|
||||
index cc363ba3bc719d8b93992141d779b4c1d1bbd2fb..571a0f27a86ab24a9f8750ce1ab802bfd64d9ccf 100644
|
||||
--- a/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/net/minecraft/world/item/BlockItem.java
|
||||
@@ -145,7 +145,16 @@ public class BlockItem extends Item {
|
||||
}
|
||||
|
||||
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level level, @Nullable Player player, ItemStack stack, BlockState state) {
|
||||
- return updateCustomBlockEntityTag(level, player, pos, stack);
|
||||
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
|
||||
+ boolean handled = updateCustomBlockEntityTag(level, player, pos, stack);
|
||||
+ if (level.purpurConfig.persistentTileEntityLore) {
|
||||
+ BlockEntity blockEntity1 = level.getBlockEntity(pos);
|
||||
+ if (blockEntity1 != null) {
|
||||
+ blockEntity1.setPersistentLore(stack.getOrDefault(DataComponents.LORE, net.minecraft.world.item.component.ItemLore.EMPTY));
|
||||
+ }
|
||||
+ }
|
||||
+ return handled;
|
||||
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -212,6 +221,7 @@ public class BlockItem extends Item {
|
||||
}
|
||||
|
||||
if (!type.onlyOpCanSetNbt() || player != null && (player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place")))) { // Spigot - add permission
|
||||
+ if (!(level.purpurConfig.silkTouchEnabled && blockEntity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners"))) // Purpur - Silk touch spawners
|
||||
return customData.loadInto(blockEntity, level.registryAccess());
|
||||
}
|
||||
|
||||
@@ -253,6 +263,7 @@ public class BlockItem extends Item {
|
||||
public void onDestroyed(ItemEntity itemEntity) {
|
||||
ItemContainerContents itemContainerContents = itemEntity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY);
|
||||
if (itemContainerContents != null) {
|
||||
+ if (itemEntity.level().purpurConfig.shulkerBoxItemDropContentsWhenDestroyed && this.getBlock() instanceof ShulkerBoxBlock) // Purpur - option to disable shulker box items from dropping contents when destroyed
|
||||
ItemUtils.onContainerDestroyed(itemEntity, itemContainerContents.nonEmptyItemsCopy());
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/BowItem.java b/net/minecraft/world/item/BowItem.java
|
||||
index c4c8775de328d40bb8218d993872be5249e8174d..ce1ce18410fc1d47d999c918a8f880b43bf9797c 100644
|
||||
--- a/net/minecraft/world/item/BowItem.java
|
||||
+++ b/net/minecraft/world/item/BowItem.java
|
||||
@@ -28,6 +28,11 @@ public class BowItem extends ProjectileWeaponItem {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack projectile = player.getProjectile(stack);
|
||||
+ // Purpur start - Infinity bow settings
|
||||
+ if (level.purpurConfig.infinityWorksWithoutArrows && projectile.isEmpty() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, stack) > 0) {
|
||||
+ projectile = new ItemStack(Items.ARROW);
|
||||
+ }
|
||||
+ // Purpur end - Infinity bow settings
|
||||
if (projectile.isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -38,7 +43,7 @@ public class BowItem extends ProjectileWeaponItem {
|
||||
} else {
|
||||
List<ItemStack> list = draw(stack, projectile, player);
|
||||
if (level instanceof ServerLevel serverLevel && !list.isEmpty()) {
|
||||
- this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, powerForTime * 3.0F, 1.0F, powerForTime == 1.0F, null, powerForTime); // Paper - Pass draw strength
|
||||
+ this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, powerForTime * 3.0F, (float) serverLevel.purpurConfig.bowProjectileOffset, powerForTime == 1.0F, null, powerForTime); // Paper - Pass draw strength // Purpur - Projectile offset config
|
||||
}
|
||||
|
||||
level.playSound(
|
||||
@@ -89,7 +94,7 @@ public class BowItem extends ProjectileWeaponItem {
|
||||
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
boolean flag = !player.getProjectile(itemInHand).isEmpty();
|
||||
- if (!player.hasInfiniteMaterials() && !flag) {
|
||||
+ if (!player.hasInfiniteMaterials() && !flag && !(level.purpurConfig.infinityWorksWithoutArrows && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, itemInHand) > 0)) { // Purpur - Infinity bow settings
|
||||
return InteractionResult.FAIL;
|
||||
} else {
|
||||
player.startUsingItem(hand);
|
||||
@@ -1,28 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/BucketItem.java b/net/minecraft/world/item/BucketItem.java
|
||||
index de287715568f358dd83383d68f845df9a7b5a117..8c7be8a71348a3e66c8bf6b6cb39fe002c20bdb0 100644
|
||||
--- a/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/net/minecraft/world/item/BucketItem.java
|
||||
@@ -147,7 +147,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
// CraftBukkit end
|
||||
if (!flag) {
|
||||
return hitResult != null && this.emptyContents(entity, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null, direction, clicked, itemstack, hand); // CraftBukkit
|
||||
- } else if (level.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) {
|
||||
+ } else if ((level.dimensionType().ultraWarm() || (level.isTheEnd() && !org.purpurmc.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) && this.content.is(FluidTags.WATER)) { // Purpur - Add allow water in end world option
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
@@ -156,7 +156,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
- level.addParticle(ParticleTypes.LARGE_SMOKE, x + Math.random(), y + Math.random(), z + Math.random(), 0.0, 0.0, 0.0);
|
||||
+ ((net.minecraft.server.level.ServerLevel) level).sendParticlesSource(null, ParticleTypes.LARGE_SMOKE, true, false, x + Math.random(), y + Math.random(), z + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0.0D); // Purpur - Add allow water in end world option
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/CrossbowItem.java b/net/minecraft/world/item/CrossbowItem.java
|
||||
index 4c5a751bc5618a19ac6355564189cb283a01eb98..9275ba72415beaa4e495cae81674fd14ec671156 100644
|
||||
--- a/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -66,7 +66,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
ChargedProjectiles chargedProjectiles = itemInHand.get(DataComponents.CHARGED_PROJECTILES);
|
||||
if (chargedProjectiles != null && !chargedProjectiles.isEmpty()) {
|
||||
- this.performShooting(level, player, hand, itemInHand, getShootingPower(chargedProjectiles), 1.0F, null);
|
||||
+ this.performShooting(level, player, hand, itemInHand, getShootingPower(chargedProjectiles), (float) level.purpurConfig.crossbowProjectileOffset, null); // Purpur - Projectile offset config
|
||||
return InteractionResult.CONSUME;
|
||||
} else if (!player.getProjectile(itemInHand).isEmpty()) {
|
||||
this.startSoundPlayed = false;
|
||||
@@ -1,21 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/DyeColor.java b/net/minecraft/world/item/DyeColor.java
|
||||
index 63751ad67d44bb20912870df5d0d2b2fee4d8cec..6bac07817d2916c64f703586599a2cab226872e6 100644
|
||||
--- a/net/minecraft/world/item/DyeColor.java
|
||||
+++ b/net/minecraft/world/item/DyeColor.java
|
||||
@@ -126,4 +126,10 @@ public enum DyeColor implements StringRepresentable {
|
||||
private static CraftingInput makeCraftColorInput(DyeColor first, DyeColor second) {
|
||||
return CraftingInput.of(2, 1, List.of(new ItemStack(DyeItem.byColor(first)), new ItemStack(DyeItem.byColor(second))));
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Shulker spawn from bullet options
|
||||
+ public static DyeColor random(net.minecraft.util.RandomSource random) {
|
||||
+ return values()[random.nextInt(values().length)];
|
||||
+ }
|
||||
+ // Purpur end - Shulker spawn from bullet options
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
From 10208bcef5c949e133092f588296ebb6e22f36d8 Mon Sep 17 00:00:00 2001
|
||||
From: File <noreply+automated@papermc.io>
|
||||
Date: Sun, 20 Apr 1997 06:37:42 -0700
|
||||
Subject: [PATCH] purpur File Patches
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/item/EggItem.java b/net/minecraft/world/item/EggItem.java
|
||||
index ccae6089cdc4fffca7d759252006a13c2c14691a..c4097bd6acf671ddf857350154e6e1a04e76d64b 100644
|
||||
--- a/net/minecraft/world/item/EggItem.java
|
||||
+++ b/net/minecraft/world/item/EggItem.java
|
||||
@@ -24,7 +24,7 @@ public class EggItem extends Item implements ProjectileItem {
|
||||
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
// Paper start
|
||||
- final Projectile.Delayed<ThrownEgg> thrownEgg = Projectile.spawnProjectileFromRotationDelayed(ThrownEgg::new, (ServerLevel) level, itemInHand, player, 0.0F, EggItem.PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ final Projectile.Delayed<ThrownEgg> thrownEgg = Projectile.spawnProjectileFromRotationDelayed(ThrownEgg::new, (ServerLevel) level, itemInHand, player, 0.0F, EggItem.PROJECTILE_SHOOT_POWER, (float) level.purpurConfig.eggProjectileOffset); // Purpur - Projectile offset config
|
||||
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Projectile) thrownEgg.projectile().getBukkitEntity());
|
||||
if (event.callEvent() && thrownEgg.attemptSpawn()) {
|
||||
if (event.shouldConsume()) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user