This commit is contained in:
Ben Kerllenevich
2021-06-17 10:39:48 -04:00
parent 90faff263b
commit b3f8037c18
11 changed files with 334 additions and 305 deletions

View File

@@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 4 Aug 2020 22:08:23 -0500
Subject: [PATCH] Allow anvil colors
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java
index 1b2d633f3d5d735039f18f27fb1387bd5a74f0d8..77810fbb70bf2e1ad03c28c0d69ceaa63221d94c 100644
--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java
@@ -28,6 +28,13 @@ import org.apache.logging.log4j.Logger;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
// CraftBukkit end
+// Purpur start
+import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.text.Component;
+
+import static net.kyori.adventure.text.format.TextDecoration.ITALIC;
+// Purpur end
+
public class ContainerAnvil extends ContainerAnvilAbstract {
private static final Logger LOGGER = LogManager.getLogger();
@@ -269,6 +276,17 @@ public class ContainerAnvil extends ContainerAnvilAbstract {
} else if (!this.renameText.equals(itemstack.getName().getString())) {
b1 = 1;
i += b1;
+ // Purpur start
+ if (player != null && player.world.purpurConfig.anvilAllowColors && player.getBukkitEntity().hasPermission("purpur.anvil.color")) {
+ final Component renameTextComponent;
+ if (renameText.startsWith("&r") && player.getBukkitEntity().hasPermission("purpur.anvil.remove_italics")) {
+ renameTextComponent = PaperAdventure.LEGACY_AMPERSAND.deserialize(renameText.substring(2)).decoration(ITALIC, false);
+ } else {
+ renameTextComponent = PaperAdventure.LEGACY_AMPERSAND.deserialize(renameText);
+ }
+ itemstack1.a(PaperAdventure.asVanilla(renameTextComponent));
+ } else
+ // Purpur end
itemstack1.a((IChatBaseComponent) (new ChatComponentText(this.renameText)));
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 54b8021bfac69800d4cec996a94c2fea53249130..96e5aaec4e35bd092e9a71ca5cb61c6a66b9c0fc 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -280,6 +280,11 @@ public class PurpurWorldConfig {
});
}
+ public boolean anvilAllowColors = false;
+ private void anvilSettings() {
+ anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
+ }
+
public boolean bedExplode = true;
public double bedExplosionPower = 5.0D;
public boolean bedExplosionFire = true;

View File

@@ -1,88 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 7 Aug 2020 12:53:36 -0500
Subject: [PATCH] Add no-random-tick block list
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 6200596f12f4c2b8dec67fc13e02ff95c5608ad0..74245e7f73f69ea843754102b81b26b87c2dc3c8 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -329,14 +329,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit end
if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) {
this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> {
- return block == null || block.getBlockData().isAir();
+ return block == null || block.getBlockData().isAir() || purpurConfig.noRandomTickBlocks.contains(block); // Purpur
}, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings
this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> {
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
}, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings
} else {
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
- return block == null || block.getBlockData().isAir();
+ return block == null || block.getBlockData().isAir() || purpurConfig.noRandomTickBlocks.contains(block); // Purpur
}, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings
this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> {
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
index 0d26250887f80d0c250bcd6bc7de303362427d3e..a1144a3df0287899ef85bc055e8f02ef0a5d6860 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
@@ -615,10 +615,12 @@ public abstract class BlockBase {
}
public void a(WorldServer worldserver, BlockPosition blockposition, Random random) {
+ if (worldserver.purpurConfig.noRandomTickBlocks.contains(getBlock())) return; // Purpur
this.getBlock().tickAlways(this.p(), worldserver, blockposition, random);
}
public void b(WorldServer worldserver, BlockPosition blockposition, Random random) {
+ if (worldserver.purpurConfig.noRandomTickBlocks.contains(getBlock())) return; // Purpur
this.getBlock().tick(this.p(), worldserver, blockposition, random);
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 96e5aaec4e35bd092e9a71ca5cb61c6a66b9c0fc..aa4302ba319c0968632025524d5a9c5479a693e2 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -11,8 +11,10 @@ import org.bukkit.configuration.ConfigurationSection;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.logging.Level;
import static net.pl3x.purpur.PurpurConfig.log;
@@ -247,6 +249,28 @@ public class PurpurWorldConfig {
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
}
+ public Set<Block> noRandomTickBlocks = new HashSet<>();
+ private void noRandomTickBlocks() {
+ if (PurpurConfig.version < 11) {
+ List<String> oldList = PurpurConfig.config.getStringList("world-settings." + worldName + ".blocks.no-tick");
+ if (!oldList.isEmpty()) {
+ PurpurConfig.config.set("world-settings." + worldName + ".blocks.no-random-tick", oldList);
+ PurpurConfig.config.set("world-settings." + worldName + ".blocks.no-tick", null);
+ }
+ oldList = PurpurConfig.config.getStringList("world-settings.default.blocks.no-tick");
+ if (!oldList.isEmpty()) {
+ PurpurConfig.config.set("world-settings.default.blocks.no-random-tick", oldList);
+ PurpurConfig.config.set("world-settings.default.blocks.no-tick", null);
+ }
+ }
+ getList("blocks.no-random-tick", new ArrayList<>()).forEach(key -> {
+ Block block = IRegistry.BLOCK.get(new MinecraftKey(key.toString()));
+ if (!block.getBlockData().isAir()) {
+ noRandomTickBlocks.add(block);
+ }
+ });
+ }
+
public boolean teleportIfOutsideBorder = false;
private void teleportIfOutsideBorder() {
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);

View File

@@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 8 Aug 2020 16:11:51 -0500
Subject: [PATCH] Add option to disable dolphin treasure searching
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityDolphin.java b/src/main/java/net/minecraft/world/entity/animal/EntityDolphin.java
index 5d18e19eafd5dc01a6caa45075d8c0598f1bb709..e0a9b931c26dbd4e7739d09ae45e1cee72ab210c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntityDolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityDolphin.java
@@ -393,6 +393,7 @@ public class EntityDolphin extends EntityWaterAnimal {
@Override
public boolean a() {
+ if (this.a.world.purpurConfig.dolphinDisableTreasureSearching) return false; // Purpur
return this.a.gotFish() && this.a.getAirTicks() >= 100 && this.a.world.getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index aa4302ba319c0968632025524d5a9c5479a693e2..c2e4a8a50b0e70283fccce265e76fa78841f47b9 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -411,6 +411,11 @@ public class PurpurWorldConfig {
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
}
+ public boolean dolphinDisableTreasureSearching = false;
+ private void dolphinSettings() {
+ dolphinDisableTreasureSearching = getBoolean("mobs.dolphin.disable-treasure-searching", dolphinDisableTreasureSearching);
+ }
+
public boolean drownedJockeyOnlyBaby = true;
public double drownedJockeyChance = 0.05D;
public boolean drownedJockeyTryExistingChickens = true;

View File

@@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 10 Aug 2020 21:46:22 -0500
Subject: [PATCH] Short enderman height
diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java
index 1bfde4cfc0f27705238abf7852ad9bb7997e23e6..2cf4e8f68fa85c4e09effda0da0c3a3f64ae7ba9 100644
--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java
+++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java
@@ -268,7 +268,8 @@ public class EntityTypes<T extends Entity> {
private IChatBaseComponent bp;
@Nullable
private MinecraftKey bq;
- private final EntitySize br;
+ public void setEntitySize(EntitySize entitySize) { this.br = entitySize; } // Purpur - OBFHELPER
+ private EntitySize br; // Purpur - remove final
private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
index 6a5593ff735a9e0486d7ed9b3afb4f44ad156b34..1e50f7c51f88afaed01777d2da9ed543718a610d 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -375,6 +375,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
+ } else if (net.pl3x.purpur.PurpurConfig.endermanShortHeight && damagesource == DamageSource.STUCK) { return false; // Purpur - no suffocation damage if short height
} else if (damagesource instanceof EntityDamageSourceIndirect) {
if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
for (int i = 0; i < 64; ++i) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index ad41b9a096e8618a1a033a47918dd26c75781f96..fc458beb3afcb9083b994246454c6ee3d94c80ac 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -4,6 +4,8 @@ import co.aikar.timings.TimingsManager;
import com.google.common.base.Throwables;
import net.minecraft.locale.LocaleLanguage;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.entity.EntitySize;
+import net.minecraft.world.entity.EntityTypes;
import net.pl3x.purpur.command.PurpurCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@@ -192,6 +194,12 @@ public class PurpurConfig {
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
}
+ public static boolean endermanShortHeight = false;
+ private static void entitySettings() {
+ endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
+ if (endermanShortHeight) EntityTypes.ENDERMAN.setEntitySize(EntitySize.b(0.6F, 1.9F));
+ }
+
public static boolean dontSendUselessEntityPackets = false;
private static void dontSendUselessEntityPackets() {
dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);

View File

@@ -1,67 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 13 Aug 2020 04:00:26 -0500
Subject: [PATCH] Stop squids floating on top of water
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ff07ab36b0e4565ddcaf672e503c2a5740670c2a..0ea8e9a4828689fa1f013590285a65a9841325b7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3343,8 +3343,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
this.lastYaw = this.yaw;
}
+ // Purpur start
+ public AxisAlignedBB getAxisForFluidCheck() {
+ return this.getBoundingBox().shrink(0.001D);
+ }
public boolean a(Tag<FluidType> tag, double d0) {
- AxisAlignedBB axisalignedbb = this.getBoundingBox().shrink(0.001D);
+ AxisAlignedBB axisalignedbb = getAxisForFluidCheck();
+ // Purpur end
int i = MathHelper.floor(axisalignedbb.minX);
int j = MathHelper.f(axisalignedbb.maxX);
int k = MathHelper.floor(axisalignedbb.minY);
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java
index 1f5f3e0d209426b97e32b82dd15176b800f85816..e6757b22497c6e274c3999d58671653e931ebe2b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java
@@ -27,6 +27,7 @@ import net.minecraft.world.level.GeneratorAccess;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.material.Fluid;
+import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
public class EntitySquid extends EntityWaterAnimal {
@@ -52,6 +53,14 @@ public class EntitySquid extends EntityWaterAnimal {
this.bu = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
+ // Purpur start
+ @Override
+ public AxisAlignedBB getAxisForFluidCheck() {
+ // Stops squids from floating just over the water
+ return this.getBoundingBox().shrink(0.001D).offsetY(world.purpurConfig.squidOffsetWaterCheck);
+ }
+ // Purpur end
+
@Override
protected void initPathfinder() {
this.goalSelector.a(0, new EntitySquid.PathfinderGoalSquid(this));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index c2e4a8a50b0e70283fccce265e76fa78841f47b9..f16f99517999ccbb0b5a678ffcb3befc93a3ae45 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -557,8 +557,10 @@ public class PurpurWorldConfig {
}
public boolean squidImmuneToEAR = true;
+ public double squidOffsetWaterCheck = 0.0D;
private void squidSettings() {
squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
+ squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck);
}
public int villagerBrainTicks = 1;