mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
269/273
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 18:40:32 -0500
|
||||
Subject: [PATCH] Store placer on Block when placed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 84d77fee05eda89cdd37be281e771415dcfabda4..5017b30b5714a47b54a00bc9da28bf57f06a6b3f 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -392,6 +392,7 @@ public final class ItemStack {
|
||||
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
|
||||
for (BlockState blockstate : blocks) {
|
||||
blockstate.update(true, false);
|
||||
+ ((CraftBlock) blockstate.getBlock()).getNMS().getBlock().forgetPlacer(); // Purpur
|
||||
}
|
||||
world.preventPoiUpdated = false;
|
||||
|
||||
@@ -421,6 +422,7 @@ public final class ItemStack {
|
||||
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
||||
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
|
||||
}
|
||||
+ block.getBlock().forgetPlacer(); // Purpur
|
||||
|
||||
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index a80f4dc0a642c744223a155232291ace6e007636..5dede264fc3cb045b6330e35123b5b416c1b1f56 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -438,7 +438,17 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
Block.dropResources(state, world, pos, blockEntity, player, stack);
|
||||
}
|
||||
|
||||
- public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {}
|
||||
+ // Purpur start
|
||||
+ @Nullable protected LivingEntity placer = null;
|
||||
+
|
||||
+ public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
||||
+ this.placer = placer;
|
||||
+ }
|
||||
+
|
||||
+ public void forgetPlacer() {
|
||||
+ this.placer = null;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
public boolean isPossibleToRespawnInThis() {
|
||||
return !this.material.isSolid() && !this.material.isLiquid();
|
||||
@@ -1,236 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 18:40:58 -0500
|
||||
Subject: [PATCH] Summoner API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
index df99dca1b3e2871dc365780fde52e93fb2170ef5..1f90c7e164848f08ff6c4aacf0a6154750cfe21d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
@@ -64,6 +64,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
private int remainingPersistentAngerTime;
|
||||
@Nullable
|
||||
private UUID persistentAngerTarget;
|
||||
+ @Nullable private UUID summoner; // Purpur
|
||||
|
||||
public IronGolem(EntityType<? extends IronGolem> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -95,6 +96,15 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
public boolean isSensitiveToWater() {
|
||||
return this.level.purpurConfig.ironGolemTakeDamageFromWater;
|
||||
}
|
||||
+
|
||||
+ @Nullable
|
||||
+ public UUID getSummoner() {
|
||||
+ return summoner;
|
||||
+ }
|
||||
+
|
||||
+ public void setSummoner(@Nullable UUID summoner) {
|
||||
+ this.summoner = summoner;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -180,6 +190,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putBoolean("PlayerCreated", this.isPlayerCreated());
|
||||
+ if (getSummoner() != null) nbt.putUUID("Purpur.Summoner", getSummoner()); // Purpur
|
||||
this.addPersistentAngerSaveData(nbt);
|
||||
}
|
||||
|
||||
@@ -187,6 +198,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
this.setPlayerCreated(nbt.getBoolean("PlayerCreated"));
|
||||
+ if (nbt.contains("Purpur.Summoner")) setSummoner(nbt.getUUID("Purpur.Summoner")); // Purpur
|
||||
this.readPersistentAngerSaveData(this.level, nbt);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
index 16ecfd25dc2b2e450410cff17e75354fec7dc4bc..c98e5b2cb54d4be5746d3bac0551ec743a656cbf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -49,6 +49,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE);
|
||||
private static final byte PUMPKIN_FLAG = 16;
|
||||
private static final float EYE_HEIGHT = 1.7F;
|
||||
+ @Nullable private java.util.UUID summoner; // Purpur
|
||||
|
||||
public SnowGolem(EntityType<? extends SnowGolem> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -74,6 +75,15 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.snowGolemMaxHealth);
|
||||
}
|
||||
+
|
||||
+ @Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return summoner;
|
||||
+ }
|
||||
+
|
||||
+ public void setSummoner(@Nullable java.util.UUID summoner) {
|
||||
+ this.summoner = summoner;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -103,6 +113,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putBoolean("Pumpkin", this.hasPumpkin());
|
||||
+ if (getSummoner() != null) nbt.putUUID("Purpur.Summoner", getSummoner()); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,6 +122,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
if (nbt.contains("Pumpkin")) {
|
||||
this.setPumpkin(nbt.getBoolean("Pumpkin"));
|
||||
}
|
||||
+ if (nbt.contains("Purpur.Summoner")) setSummoner(nbt.getUUID("Purpur.Summoner")); // Purpur
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index b947a9af4c3387aec9b7e62d5899fdae1ccfedbb..0ecd5c20b1d571ac1e147df0c854412b5c9f3741 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -85,6 +85,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
};
|
||||
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
|
||||
private int shootCooldown = 0; // Purpur
|
||||
+ @Nullable private java.util.UUID summoner; // Purpur
|
||||
// Paper start
|
||||
private boolean canPortal = false;
|
||||
|
||||
@@ -227,6 +228,15 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
public boolean isSensitiveToWater() {
|
||||
return this.level.purpurConfig.witherTakeDamageFromWater;
|
||||
}
|
||||
+
|
||||
+ @Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return summoner;
|
||||
+ }
|
||||
+
|
||||
+ public void setSummoner(@Nullable java.util.UUID summoner) {
|
||||
+ this.summoner = summoner;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -255,6 +265,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putInt("Invul", this.getInvulnerableTicks());
|
||||
+ if (getSummoner() != null) nbt.putUUID("Purpur.Summoner", getSummoner()); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -264,6 +275,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
if (this.hasCustomName()) {
|
||||
this.bossEvent.setName(this.getDisplayName());
|
||||
}
|
||||
+ if (nbt.contains("Purpur.Summoner")) setSummoner(nbt.getUUID("Purpur.Summoner")); // Purpur
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
index 7a700892a997aa595ac9c9f28d6b39a35c225053..872507fe50e50429bbaa3af16f8f9d94806c4010 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
@@ -82,6 +82,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock implements We
|
||||
BlockPos blockposition1 = shapedetector_shapedetectorcollection.getBlock(0, 2, 0).getPos();
|
||||
|
||||
entitysnowman.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
+ entitysnowman.setSummoner(this.placer == null ? null : this.placer.getUUID()); // Purpur
|
||||
// CraftBukkit start
|
||||
if (!world.addFreshEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
|
||||
return;
|
||||
@@ -120,6 +121,7 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock implements We
|
||||
|
||||
entityirongolem.setPlayerCreated(true);
|
||||
entityirongolem.moveTo((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
+ entityirongolem.setSummoner(this.placer == null ? null : this.placer.getUUID()); // Purpur
|
||||
// CraftBukkit start
|
||||
if (!world.addFreshEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
index 03b97e9ea6059fa09bbbed7fc9ae7212f3eaa70b..25daac2b7c1cb5f8194704aa36ba04b40a4f8d21 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
@@ -81,6 +81,7 @@ public class WitherSkullBlock extends SkullBlock {
|
||||
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F, 0.0F);
|
||||
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F;
|
||||
entitywither.makeInvulnerable();
|
||||
+ entitywither.setSummoner(iblockdata.getBlock().placer == null ? null : iblockdata.getBlock().placer.getUUID()); // Purpur
|
||||
// CraftBukkit start
|
||||
if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
return;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
|
||||
index 2966d4d466f44751b2f02afda2273a708c12b251..55f19324f92f98e497da49d3022e0edfc2351461 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
|
||||
@@ -33,4 +33,17 @@ public class CraftIronGolem extends CraftGolem implements IronGolem {
|
||||
public EntityType getType() {
|
||||
return EntityType.IRON_GOLEM;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return getHandle().getSummoner();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner) {
|
||||
+ getHandle().setSummoner(summoner);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
index 659e2959c5330e4764ea1edc7f8de9f464f9ff52..c2bac8ae958630acaaa8d758e31428d2ac556ccf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
||||
@@ -34,4 +34,17 @@ public class CraftSnowman extends CraftGolem implements Snowman, com.destroystok
|
||||
public EntityType getType() {
|
||||
return EntityType.SNOWMAN;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return getHandle().getSummoner();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner) {
|
||||
+ getHandle().setSummoner(summoner);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
index 4cf3a374c9ee7c7bcf82e778aa094eb4f8463595..5c1bfd37d4494525d7890f6530a68ae47353e157 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
@@ -88,4 +88,17 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
|
||||
getHandle().setCanTravelThroughPortals(value);
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public java.util.UUID getSummoner() {
|
||||
+ return getHandle().getSummoner();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner) {
|
||||
+ getHandle().setSummoner(summoner);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 21:52:15 -0500
|
||||
Subject: [PATCH] Customizable sleeping actionbar messages
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 24b800d99fda57154c23352b1c8889f7cd2cba36..d85249f7944e548f360712212166cdf7ecbf475c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -964,11 +964,29 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (this.canSleepThroughNights()) {
|
||||
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
|
||||
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
- TranslatableComponent chatmessage;
|
||||
+ Component chatmessage; // Purpur
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i)) {
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
chatmessage = new TranslatableComponent("sleep.skipping_night");
|
||||
} else {
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
chatmessage = new TranslatableComponent("sleep.players_sleeping", new Object[]{this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)});
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 4949c3bc2066e790364db631e7f801c1e83d01e9..d993b5dc4428ed1c156359db7efa4a4f9b449f12 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -180,6 +180,8 @@ public class PurpurConfig {
|
||||
public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
public static String uptimeCommandOutput = "<green>Server uptime is <uptime>";
|
||||
public static String unverifiedUsername = "default";
|
||||
+ public static String sleepSkippingNight = "default";
|
||||
+ public static String sleepingPlayersPercent = "default";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
|
||||
@@ -193,6 +195,8 @@ public class PurpurConfig {
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
uptimeCommandOutput = getString("settings.messages.uptime-command-output", uptimeCommandOutput);
|
||||
unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
|
||||
+ sleepSkippingNight = getString("settings.messages.sleep-skipping-night", sleepSkippingNight);
|
||||
+ sleepingPlayersPercent = getString("settings.messages.sleeping-players-percent", sleepingPlayersPercent);
|
||||
}
|
||||
|
||||
public static String deathMsgStonecutter = "<player> has sawed themself in half";
|
||||
@@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 5 Jul 2021 20:23:08 -0500
|
||||
Subject: [PATCH] option to disable shulker box items from dropping contents
|
||||
when destroyed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 8f3b9b8784f0d7b137a1ad87655ee8bad801b59d..8a5f6d955577a8f8a63a846169a63fe9685b6321 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -294,7 +294,7 @@ public class BlockItem extends Item {
|
||||
|
||||
@Override
|
||||
public void onDestroyed(ItemEntity entity) {
|
||||
- if (this.block instanceof ShulkerBoxBlock) {
|
||||
+ if (this.block instanceof ShulkerBoxBlock && entity.level.purpurConfig.shulkerBoxItemDropContentsWhenDestroyed) {
|
||||
ItemStack itemstack = entity.getItem();
|
||||
CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 719612684b4d5f72589576bb69c2d6c908bdc485..0b14878546df0217fa83eabfc26f6ede84f8ebb2 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -213,6 +213,7 @@ public class PurpurWorldConfig {
|
||||
public int enderPearlCooldownCreative = 20;
|
||||
public float enderPearlEndermiteChance = 0.05F;
|
||||
public int glowBerriesEatGlowDuration = 0;
|
||||
+ public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -257,6 +258,7 @@ public class PurpurWorldConfig {
|
||||
enderPearlCooldownCreative = getInt("gameplay-mechanics.item.ender-pearl.creative-cooldown", enderPearlCooldownCreative);
|
||||
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
||||
+ shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 16 Jul 2021 22:00:17 -0500
|
||||
Subject: [PATCH] Silk touchable budding amethyst
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
index 02fc3ede12eadbf72e26e31b1c475c7f5b2ad73a..2288e727929ffb3a3bca138fb02894080d631594 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
@@ -53,4 +53,14 @@ public class BuddingAmethystBlock extends AmethystBlock {
|
||||
public static boolean canClusterGrowAtState(BlockState state) {
|
||||
return state.isAir() || state.is(Blocks.WATER) && state.getFluidState().getAmount() == 8;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void playerDestroy(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.world.item.ItemStack stack) {
|
||||
+ if (level.purpurConfig.buddingAmethystSilkTouch && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.SILK_TOUCH, stack) > 0) {
|
||||
+ popResource(level, pos, net.minecraft.world.item.Items.BUDDING_AMETHYST.getDefaultInstance());
|
||||
+ }
|
||||
+ super.playerDestroy(level, player, pos, state, blockEntity, stack);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0b14878546df0217fa83eabfc26f6ede84f8ebb2..a755dbab717e6899d57558c7c7f0b17d40ce09fa 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -691,6 +691,11 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean buddingAmethystSilkTouch = false;
|
||||
+ private void buddingAmethystSettings() {
|
||||
+ buddingAmethystSilkTouch = getBoolean("blocks.budding_amethyst.silk-touch", buddingAmethystSilkTouch);
|
||||
+ }
|
||||
+
|
||||
public boolean chestOpenWithBlockOnTop = false;
|
||||
private void chestSettings() {
|
||||
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||
@@ -2683,3 +2688,4 @@ public class PurpurWorldConfig {
|
||||
hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
|
||||
}
|
||||
}
|
||||
+
|
||||
@@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 16 Jul 2021 22:47:29 -0500
|
||||
Subject: [PATCH] Big dripleaf tilt delay
|
||||
|
||||
Makes the tilt delays configurable. There are only 3 types of tilts used by this setting. When an entity steps on a
|
||||
big_dripleaf with no tilt it will immediately change to an UNSTABLE tilt. Each change after that is on a tick timer:
|
||||
|
||||
UNSTABLE: big_dripleaf with UNSTABLE tilt will change to PARTIAL tilt after 10 ticks
|
||||
PARTIAL: big_dripleaf with PARTIAL tilt will change to FULL tilt after 10 ticks
|
||||
UNSTABLE: big_dripleaf with FULL tilt will change back to no tilt after 100 ticks
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
index 45a5343c1109c63ce7864327837979282b904367..042128d6982481fedf8e6ad523cff98fae7dec28 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
@@ -236,7 +236,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
|
||||
BigDripleafBlock.playTiltSound(world, blockposition, soundeffect);
|
||||
}
|
||||
|
||||
- int i = BigDripleafBlock.DELAY_UNTIL_NEXT_TILT_STATE.getInt(tilt);
|
||||
+ int i = world.purpurConfig.bigDripleafTiltDelay.getOrDefault(tilt, -1); // Purpur
|
||||
|
||||
if (i != -1) {
|
||||
world.scheduleTick(blockposition, (Block) this, i);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a755dbab717e6899d57558c7c7f0b17d40ce09fa..6960ee951bc3980c18a101e1285411e40572f9c8 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -691,6 +691,22 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public Map<Tilt, Integer> bigDripleafTiltDelay = new HashMap<>();
|
||||
+ private void bigDripleafSettings() {
|
||||
+ bigDripleafTiltDelay.clear();
|
||||
+ getMap("blocks.big_dripleaf.tilt-delay", Map.ofEntries(
|
||||
+ Map.entry("UNSTABLE", 10),
|
||||
+ Map.entry("PARTIAL", 10),
|
||||
+ Map.entry("FULL", 100))
|
||||
+ ).forEach((tilt, delay) -> {
|
||||
+ try {
|
||||
+ bigDripleafTiltDelay.put(Tilt.valueOf(tilt), (int) delay);
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "Invalid big_dripleaf tilt key: " + tilt);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
public boolean buddingAmethystSilkTouch = false;
|
||||
private void buddingAmethystSettings() {
|
||||
buddingAmethystSilkTouch = getBoolean("blocks.budding_amethyst.silk-touch", buddingAmethystSilkTouch);
|
||||
@@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 17 Jul 2021 15:55:14 -0500
|
||||
Subject: [PATCH] Player ridable in water option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 2d6c0fc0a10c9e31352308ea8a47e3c283775c1b..3198cc253cc7d88ff29a8f5cfb3e7bc01886e408 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2031,6 +2031,11 @@ public abstract class Player extends LivingEntity {
|
||||
return this.inventory.armor;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean rideableUnderWater() {
|
||||
+ return this.level.purpurConfig.playerRidableInWater;
|
||||
+ }
|
||||
+
|
||||
public boolean setEntityOnShoulder(CompoundTag entityNbt) {
|
||||
if (!this.isPassenger() && this.onGround && !this.isInWater() && !this.isInPowderSnow) {
|
||||
if (this.getShoulderEntityLeft().isEmpty()) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 6960ee951bc3980c18a101e1285411e40572f9c8..38232e48fd7e415b2403d96c04170c18691afa1c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -387,6 +387,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerBurpWhenFull = false;
|
||||
public boolean playerArmorSwapping = false;
|
||||
public boolean playerArmorSwappingCreativeMakesCopy = true;
|
||||
+ public boolean playerRidableInWater = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -412,6 +413,7 @@ public class PurpurWorldConfig {
|
||||
playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull);
|
||||
playerArmorSwapping = getBoolean("gameplay-mechanics.player.armor-click-equip.allow-hot-swapping", playerArmorSwapping);
|
||||
playerArmorSwappingCreativeMakesCopy = getBoolean("gameplay-mechanics.player.armor-click-equip.creative-makes-copy", playerArmorSwappingCreativeMakesCopy);
|
||||
+ playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Mon, 19 Jul 2021 19:28:17 -0400
|
||||
Subject: [PATCH] Config to disable Enderman teleport on projectile hit
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 8713db4986d6db80c3422ead4f99203283e22e40..425a2cab66ce456b8e034b008d2cb82ecba62004 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -410,7 +410,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
return false;
|
||||
} else if (getRider() != null && this.isControllable()) { return super.hurt(source, amount); // Purpur - no teleporting on damage
|
||||
} else if (org.purpurmc.purpur.PurpurConfig.endermanShortHeight && source == DamageSource.IN_WALL) { return false; // Purpur - no suffocation damage if short height
|
||||
- } else if (source instanceof IndirectEntityDamageSource) {
|
||||
+ } else if (source instanceof IndirectEntityDamageSource && !(this.level.purpurConfig.endermanIgnoreProjectiles && source.getDirectEntity() instanceof net.minecraft.world.entity.projectile.Projectile)) { // Purpur
|
||||
Entity entity = source.getDirectEntity();
|
||||
boolean flag;
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 38232e48fd7e415b2403d96c04170c18691afa1c..e213ab6708ab18568cae1387c4c0608f2f23af5c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1290,6 +1290,7 @@ public class PurpurWorldConfig {
|
||||
public boolean endermanAggroEndermitesOnlyIfPlayerSpawned = false;
|
||||
public boolean endermanIgnorePlayerDragonHead = false;
|
||||
public boolean endermanDisableStareAggro = false;
|
||||
+ public boolean endermanIgnoreProjectiles = false;
|
||||
private void endermanSettings() {
|
||||
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
|
||||
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
|
||||
@@ -1312,6 +1313,7 @@ public class PurpurWorldConfig {
|
||||
endermanAggroEndermitesOnlyIfPlayerSpawned = getBoolean("mobs.enderman.aggressive-towards-endermites-only-spawned-by-player-thrown-ender-pearls", endermanAggroEndermitesOnlyIfPlayerSpawned);
|
||||
endermanIgnorePlayerDragonHead = getBoolean("mobs.enderman.ignore-players-wearing-dragon-head", endermanIgnorePlayerDragonHead);
|
||||
endermanDisableStareAggro = getBoolean("mobs.enderman.disable-player-stare-aggression", endermanDisableStareAggro);
|
||||
+ endermanIgnoreProjectiles = getBoolean("mobs.enderman.ignore-projectiles", endermanIgnoreProjectiles);
|
||||
}
|
||||
|
||||
public boolean endermiteRidable = false;
|
||||
@@ -1,248 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 24 Jul 2021 00:07:31 -0500
|
||||
Subject: [PATCH] Add compass command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 9e7cc8bf867b6e4f86b55e1f1d3a1cb6233c90f1..7c30d8d61a8e82d8a1f61451090e9bbbca933d2a 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -212,6 +212,7 @@ public class Commands {
|
||||
org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.UptimeCommand.register(this.dispatcher); // Purpur
|
||||
org.purpurmc.purpur.command.TPSBarCommand.register(this.dispatcher); // Purpur
|
||||
+ org.purpurmc.purpur.command.CompassCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
if (environment.includeIntegrated) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index af0cfc57bb941817c4d4bcb60e4f129971091265..0a345562354dc3f1e1366da96149d204a95f6fbc 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -256,6 +256,7 @@ public class ServerPlayer extends Player {
|
||||
public boolean purpurClient = false; // Purpur
|
||||
public boolean acceptingResourcePack = false; // Purpur
|
||||
private boolean tpsBar = false; // Purpur
|
||||
+ private boolean compassBar = false; // Purpur
|
||||
|
||||
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
@@ -478,6 +479,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
|
||||
+ if (nbt.contains("Purpur.CompassBar")) { this.compassBar = nbt.getBoolean("Purpur.CompassBar"); } // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -539,6 +541,7 @@ public class ServerPlayer extends Player {
|
||||
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
|
||||
|
||||
nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
|
||||
+ nbt.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur
|
||||
}
|
||||
|
||||
// CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
@@ -2588,5 +2591,13 @@ public class ServerPlayer extends Player {
|
||||
public void tpsBar(boolean tpsBar) {
|
||||
this.tpsBar = tpsBar;
|
||||
}
|
||||
+
|
||||
+ public boolean compassBar() {
|
||||
+ return this.compassBar;
|
||||
+ }
|
||||
+
|
||||
+ public void compassBar(boolean compassBar) {
|
||||
+ this.compassBar = compassBar;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index d993b5dc4428ed1c156359db7efa4a4f9b449f12..34f098aeb69bcbd79324386f3fe6a55146fa6f70 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -265,6 +265,11 @@ public class PurpurConfig {
|
||||
public static String commandTPSBarTextColorMedium = "<gradient:#ffff55:#ffaa00><text></gradient>";
|
||||
public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
|
||||
public static int commandTPSBarTickInterval = 20;
|
||||
+ public static String commandCompassBarTitle = "S \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 W \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 N \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 E \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 S \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 W \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NW \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 N \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 NE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 E \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 SE \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 \u25C8 \u00B7 ";
|
||||
+ public static BossBar.Overlay commandCompassBarProgressOverlay = BossBar.Overlay.PROGRESS;
|
||||
+ public static BossBar.Color commandCompassBarProgressColor = BossBar.Color.BLUE;
|
||||
+ public static float commandCompassBarProgressPercent = 1.0F;
|
||||
+ public static int commandCompassBarTickInterval = 5;
|
||||
public static boolean commandGamemodeRequiresPermission = false;
|
||||
public static boolean hideHiddenPlayersFromEntitySelector = false;
|
||||
public static String uptimeFormat = "<days><hours><minutes><seconds>";
|
||||
@@ -287,6 +292,13 @@ public class PurpurConfig {
|
||||
commandTPSBarTextColorMedium = getString("settings.command.tpsbar.text-color.medium", commandTPSBarTextColorMedium);
|
||||
commandTPSBarTextColorLow = getString("settings.command.tpsbar.text-color.low", commandTPSBarTextColorLow);
|
||||
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);
|
||||
+
|
||||
+ commandCompassBarTitle = getString("settings.command.compass.title", commandCompassBarTitle);
|
||||
+ commandCompassBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.compass.overlay", commandCompassBarProgressOverlay.name()));
|
||||
+ commandCompassBarProgressColor = BossBar.Color.valueOf(getString("settings.command.compass.progress-color", commandCompassBarProgressColor.name()));
|
||||
+ commandCompassBarProgressPercent = (float) getDouble("settings.command.compass.percent", commandCompassBarProgressPercent);
|
||||
+ commandCompassBarTickInterval = getInt("settings.command.compass.tick-interval", commandCompassBarTickInterval);
|
||||
+
|
||||
commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
||||
hideHiddenPlayersFromEntitySelector = getBoolean("settings.command.hide-hidden-players-from-entity-selector", hideHiddenPlayersFromEntitySelector);
|
||||
uptimeFormat = getString("settings.command.uptime.format", uptimeFormat);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index e213ab6708ab18568cae1387c4c0608f2f23af5c..7fb4ee9e72d001da6a372d91392a87cdff7bbf20 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -214,6 +214,7 @@ public class PurpurWorldConfig {
|
||||
public float enderPearlEndermiteChance = 0.05F;
|
||||
public int glowBerriesEatGlowDuration = 0;
|
||||
public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
|
||||
+ public boolean compassItemShowsBossBar = false;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -259,6 +260,7 @@ public class PurpurWorldConfig {
|
||||
enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
||||
shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
|
||||
+ compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/command/CompassCommand.java b/src/main/java/org/purpurmc/purpur/command/CompassCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..34b6b1db6ef85d40cb84a5e19453ef5c5110d539
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/command/CompassCommand.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package org.purpurmc.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.purpurmc.purpur.task.CompassTask;
|
||||
+
|
||||
+public class CompassCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("compass")
|
||||
+ .requires(listener -> listener.hasPermission(2))
|
||||
+ .executes(context -> {
|
||||
+ ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
+ CompassTask task = CompassTask.instance();
|
||||
+ if (player.compassBar()) {
|
||||
+ task.removePlayer(player.getBukkitEntity());
|
||||
+ player.compassBar(false);
|
||||
+ } else {
|
||||
+ task.addPlayer(player.getBukkitEntity());
|
||||
+ player.compassBar(true);
|
||||
+ }
|
||||
+ return 1;
|
||||
+ })
|
||||
+ ).setPermission("bukkit.command.compass");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/task/BossBarTask.java b/src/main/java/org/purpurmc/purpur/task/BossBarTask.java
|
||||
index d38b3c4a722396cc3b61a9a8ed7e39cea4ae65cb..d333334f323049ca97e756324cff0b23eddacd2a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/task/BossBarTask.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/task/BossBarTask.java
|
||||
@@ -90,10 +90,12 @@ public abstract class BossBarTask extends BukkitRunnable {
|
||||
|
||||
public static void startAll() {
|
||||
TPSBarTask.instance().start();
|
||||
+ CompassTask.instance().start();
|
||||
}
|
||||
|
||||
public static void stopAll() {
|
||||
TPSBarTask.instance().stop();
|
||||
+ CompassTask.instance().stop();
|
||||
}
|
||||
|
||||
public static void addToAll(ServerPlayer player) {
|
||||
@@ -101,9 +103,13 @@ public abstract class BossBarTask extends BukkitRunnable {
|
||||
if (player.tpsBar()) {
|
||||
TPSBarTask.instance().addPlayer(bukkit);
|
||||
}
|
||||
+ if (player.compassBar()) {
|
||||
+ CompassTask.instance().addPlayer(bukkit);
|
||||
+ }
|
||||
}
|
||||
|
||||
public static void removeFromAll(Player player) {
|
||||
TPSBarTask.instance().removePlayer(player);
|
||||
+ CompassTask.instance().removePlayer(player);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/task/CompassTask.java b/src/main/java/org/purpurmc/purpur/task/CompassTask.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bdb214bc2e0d944a26c825c1124d23d4fee2eca9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/task/CompassTask.java
|
||||
@@ -0,0 +1,68 @@
|
||||
+package org.purpurmc.purpur.task;
|
||||
+
|
||||
+import net.kyori.adventure.bossbar.BossBar;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.item.Items;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.purpurmc.purpur.PurpurConfig;
|
||||
+
|
||||
+public class CompassTask extends BossBarTask {
|
||||
+ private static CompassTask instance;
|
||||
+
|
||||
+ private int tick = 0;
|
||||
+
|
||||
+ public static CompassTask instance() {
|
||||
+ if (instance == null) {
|
||||
+ instance = new CompassTask();
|
||||
+ }
|
||||
+ return instance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ if (++tick < PurpurConfig.commandCompassBarTickInterval) {
|
||||
+ return;
|
||||
+ }
|
||||
+ tick = 0;
|
||||
+
|
||||
+ MinecraftServer.getServer().levels.forEach((key, level) -> {
|
||||
+ if (level.purpurConfig.compassItemShowsBossBar) {
|
||||
+ level.players.forEach(player -> {
|
||||
+ if (!player.compassBar()) {
|
||||
+ if (player.getMainHandItem().getItem() != Items.COMPASS && player.getOffhandItem().getItem() != Items.COMPASS) {
|
||||
+ removePlayer(player.getBukkitEntity());
|
||||
+ } else if (!hasPlayer(player.getUUID())) {
|
||||
+ addPlayer(player.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ super.run();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ BossBar createBossBar() {
|
||||
+ return BossBar.bossBar(Component.text(""), PurpurConfig.commandCompassBarProgressPercent, PurpurConfig.commandCompassBarProgressColor, PurpurConfig.commandCompassBarProgressOverlay);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ void updateBossBar(BossBar bossbar, Player player) {
|
||||
+ float yaw = player.getLocation().getYaw();
|
||||
+ int length = PurpurConfig.commandCompassBarTitle.length();
|
||||
+ int pos = (int) ((normalize(yaw) * (length / 720F)) + (length / 2F));
|
||||
+ bossbar.name(Component.text(PurpurConfig.commandCompassBarTitle.substring(pos - 25, pos + 25)));
|
||||
+ }
|
||||
+
|
||||
+ private float normalize(float yaw) {
|
||||
+ while (yaw < -180.0F) {
|
||||
+ yaw += 360.0F;
|
||||
+ }
|
||||
+ while (yaw > 180.0F) {
|
||||
+ yaw -= 360.0F;
|
||||
+ }
|
||||
+ return yaw;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Wed, 28 Jul 2021 15:52:32 -0400
|
||||
Subject: [PATCH] Config to prevent horses from standing with riders
|
||||
|
||||
Horses have a chance to stand (rear) when their ambient noise is played.
|
||||
This can happen while the horse is moving with a rider, which will cause the horse to suddenly stop for a moment.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index 0be0c81f2b0a58eba75eb8559f78d8a58014d0ae..f7088aaf65ee5725e928845a634852119b403cef 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -396,7 +396,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@Nullable
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
- if (this.random.nextInt(10) == 0 && !this.isImmobile()) {
|
||||
+ if (this.random.nextInt(10) == 0 && !this.isImmobile() && !(!this.level.purpurConfig.horseStandWithRider && this.getControllingPassenger() != null)) { // Purpur
|
||||
this.stand();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 55f4ff90bd2f9f8138a9a352dd40dfbd1ee98073..9694150ed4832169ed12f8e95cf2d87ada688978 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1507,6 +1507,7 @@ public class PurpurWorldConfig {
|
||||
public double horseMovementSpeedMax = 0.3375D;
|
||||
public int horseBreedingTicks = 6000;
|
||||
public boolean horseTakeDamageFromWater = false;
|
||||
+ public boolean horseStandWithRider = true;
|
||||
private void horseSettings() {
|
||||
horseRidableInWater = getBoolean("mobs.horse.ridable-in-water", horseRidableInWater);
|
||||
if (PurpurConfig.version < 10) {
|
||||
@@ -1524,6 +1525,7 @@ public class PurpurWorldConfig {
|
||||
horseMovementSpeedMax = getDouble("mobs.horse.attributes.movement_speed.max", horseMovementSpeedMax);
|
||||
horseBreedingTicks = getInt("mobs.horse.breeding-delay-ticks", horseBreedingTicks);
|
||||
horseTakeDamageFromWater = getBoolean("mobs.horse.takes-damage-from-water", horseTakeDamageFromWater);
|
||||
+ horseStandWithRider = getBoolean("mobs.horse.stand-with-rider", horseStandWithRider);
|
||||
}
|
||||
|
||||
public boolean huskRidable = false;
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Wed, 4 Aug 2021 11:44:26 +0200
|
||||
Subject: [PATCH] Toggle for kinetic damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2773267524a58219876a84aa44b97094e155883a..360aa9d2f9d5a8ecd0db36a3715825222fec018e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2828,6 +2828,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
if (f3 > 0.0F) {
|
||||
this.playSound(this.getFallDamageSound((int) f3), 1.0F, 1.0F);
|
||||
+ if (level.purpurConfig.elytraKineticDamage) // Purpur
|
||||
this.hurt(DamageSource.FLY_INTO_WALL, f3);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index b481c3bf0311058307b1fc38d68047e48c4df44d..b03142997900921e6cf4c105262ff08678e87097 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -176,12 +176,14 @@ public class PurpurWorldConfig {
|
||||
public boolean elytraIgnoreUnbreaking = false;
|
||||
public int elytraDamagePerFireworkBoost = 0;
|
||||
public int elytraDamagePerTridentBoost = 0;
|
||||
+ public boolean elytraKineticDamage = true;
|
||||
private void elytraSettings() {
|
||||
elytraDamagePerSecond = getInt("gameplay-mechanics.elytra.damage-per-second", elytraDamagePerSecond);
|
||||
elytraDamageMultiplyBySpeed = getDouble("gameplay-mechanics.elytra.damage-multiplied-by-speed", elytraDamageMultiplyBySpeed);
|
||||
elytraIgnoreUnbreaking = getBoolean("gameplay-mechanics.elytra.ignore-unbreaking", elytraIgnoreUnbreaking);
|
||||
elytraDamagePerFireworkBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.firework", elytraDamagePerFireworkBoost);
|
||||
elytraDamagePerTridentBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.trident", elytraDamagePerTridentBoost);
|
||||
+ elytraKineticDamage = getBoolean("gameplay-mechanics.elytra.kinetic-damage", elytraKineticDamage);
|
||||
}
|
||||
|
||||
public int entityLifeSpan = 0;
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 5 Jul 2021 06:00:17 +0200
|
||||
Subject: [PATCH] Add Option for disable observer clocks
|
||||
|
||||
Allow to disable observer clocks: https://www.spigotmc.org/attachments/observerclock-gif.365936/
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ObserverBlock.java b/src/main/java/net/minecraft/world/level/block/ObserverBlock.java
|
||||
index 4a34a08a1d46e4d3020644a51d9e30a36a18791a..be28b5aba28383058548cfb68f98266415367968 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ObserverBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ObserverBlock.java
|
||||
@@ -64,6 +64,7 @@ public class ObserverBlock extends DirectionalBlock {
|
||||
@Override
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (state.getValue(ObserverBlock.FACING) == direction && !(Boolean) state.getValue(ObserverBlock.POWERED)) {
|
||||
+ if (!world.getMinecraftWorld().purpurConfig.disableObserverClocks || !(neighborState.getBlock() instanceof ObserverBlock) || neighborState.getValue(ObserverBlock.FACING).getOpposite() != direction) // Purpur
|
||||
this.startSignal(world, pos);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 6edd607952f087ae41f62478003b76053b43fa57..8462308f580c6f9b07e5eb48f309fd912966c0d9 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -359,6 +359,11 @@ public class PurpurWorldConfig {
|
||||
villageSiegeSpawning = getBoolean("gameplay-mechanics.mob-spawning.village-sieges", predicate);
|
||||
}
|
||||
|
||||
+ public boolean disableObserverClocks = false;
|
||||
+ private void observerSettings() {
|
||||
+ disableObserverClocks = getBoolean("blocks.observer.disable-clock", disableObserverClocks);
|
||||
+ }
|
||||
+
|
||||
public int playerNetheriteFireResistanceDuration = 0;
|
||||
public int playerNetheriteFireResistanceAmplifier = 0;
|
||||
public boolean playerNetheriteFireResistanceAmbient = false;
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Fri, 6 Aug 2021 22:30:10 +0200
|
||||
Subject: [PATCH] Customizeable Zombie Villager curing times
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index ba6875089c122baaf99f21cda5c65228c78e0fa1..6c559f78cc7eab34d6109c1926067720d964d42c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -218,7 +218,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
this.gameEvent(GameEvent.MOB_INTERACT, this.eyeBlockPosition());
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 59cd244212822eea978625dcad475025dbff0c11..2b7d4eeda3244e32c19385dd81531cffc9b1a1d4 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2669,6 +2669,8 @@ public class PurpurWorldConfig {
|
||||
public double zombieVillagerJockeyChance = 0.05D;
|
||||
public boolean zombieVillagerJockeyTryExistingChickens = true;
|
||||
public boolean zombieVillagerTakeDamageFromWater = false;
|
||||
+ public int zombieVillagerCuringTimeMin = 3600;
|
||||
+ public int zombieVillagerCuringTimeMax = 6000;
|
||||
private void zombieVillagerSettings() {
|
||||
zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable);
|
||||
zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater);
|
||||
@@ -2684,6 +2686,8 @@ public class PurpurWorldConfig {
|
||||
zombieVillagerJockeyChance = getDouble("mobs.zombie_villager.jockey.chance", zombieVillagerJockeyChance);
|
||||
zombieVillagerJockeyTryExistingChickens = getBoolean("mobs.zombie_villager.jockey.try-existing-chickens", zombieVillagerJockeyTryExistingChickens);
|
||||
zombieVillagerTakeDamageFromWater = getBoolean("mobs.zombie_villager.takes-damage-from-water", zombieVillagerTakeDamageFromWater);
|
||||
+ zombieVillagerCuringTimeMin = getInt("mobs.zombie_villager.curing_time.min", zombieVillagerCuringTimeMin);
|
||||
+ zombieVillagerCuringTimeMax = getInt("mobs.zombie_villager.curing_time.max", zombieVillagerCuringTimeMax);
|
||||
}
|
||||
|
||||
public boolean zombifiedPiglinRidable = false;
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 20:23:31 +0200
|
||||
Subject: [PATCH] Option for sponges to work on lava
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
index fe4fdd21ae22970ddd8c7f5cd72bdf88b9be0a20..bb05f4d5e0403f39198bff5285698a2a86010ac9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -73,7 +73,7 @@ public class SpongeBlock extends Block {
|
||||
// CraftBukkit end
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
- if (fluid.is(FluidTags.WATER)) {
|
||||
+ if (fluid.is(FluidTags.WATER) || (world.purpurConfig.spongeAbsorbsLava && fluid.is(FluidTags.LAVA))) { // Purpur
|
||||
if (iblockdata.getBlock() instanceof BucketPickup && !((BucketPickup) iblockdata.getBlock()).pickupBlock(blockList, blockposition2, iblockdata).isEmpty()) { // CraftBukkit
|
||||
++i;
|
||||
if (j < world.purpurConfig.spongeAbsorptionRadius) { // Purpur
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 2b7d4eeda3244e32c19385dd81531cffc9b1a1d4..1bb12a3b52c997fa6d44f98ab73552ffaf87c595 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -900,9 +900,11 @@ public class PurpurWorldConfig {
|
||||
|
||||
public int spongeAbsorptionArea = 64;
|
||||
public int spongeAbsorptionRadius = 6;
|
||||
+ public boolean spongeAbsorbsLava = false;
|
||||
private void spongeSettings() {
|
||||
spongeAbsorptionArea = getInt("blocks.sponge.absorption.area", spongeAbsorptionArea);
|
||||
spongeAbsorptionRadius = getInt("blocks.sponge.absorption.radius", spongeAbsorptionRadius);
|
||||
+ spongeAbsorbsLava = getBoolean("blocks.sponge.absorbs-lava", spongeAbsorbsLava);
|
||||
}
|
||||
|
||||
public float stonecutterDamage = 0.0F;
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 21:27:56 +0200
|
||||
Subject: [PATCH] Toggle for Wither's spawn sound
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 0ecd5c20b1d571ac1e147df0c854412b5c9f3741..3e8f13020f56ce232518a6520d16e90744217938 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -418,7 +418,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
- if (!this.isSilent()) {
|
||||
+ if (!this.isSilent() && level.purpurConfig.witherPlaySpawnSound) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
//int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 1bb12a3b52c997fa6d44f98ab73552ffaf87c595..3e14e9ca693cd1649514e84f32951bf70e18863a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2514,6 +2514,7 @@ public class PurpurWorldConfig {
|
||||
public boolean witherTakeDamageFromWater = false;
|
||||
public boolean witherCanRideVehicles = false;
|
||||
public float witherExplosionRadius = 1.0F;
|
||||
+ public boolean witherPlaySpawnSound = true;
|
||||
private void witherSettings() {
|
||||
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
|
||||
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
|
||||
@@ -2535,6 +2536,7 @@ public class PurpurWorldConfig {
|
||||
witherTakeDamageFromWater = getBoolean("mobs.wither.takes-damage-from-water", witherTakeDamageFromWater);
|
||||
witherCanRideVehicles = getBoolean("mobs.wither.can-ride-vehicles", witherCanRideVehicles);
|
||||
witherExplosionRadius = (float) getDouble("mobs.wither.explosion-radius", witherExplosionRadius);
|
||||
+ witherPlaySpawnSound = getBoolean("mobs.wither.play-spawn-sound", witherPlaySpawnSound);
|
||||
}
|
||||
|
||||
public boolean witherSkeletonRidable = false;
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 03:37:56 -0500
|
||||
Subject: [PATCH] Cactus breaks from solid neighbors config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
index 4323e5cc2054804243e8e2f24fd5447280f218de..13e7f1c70e74577a5db84a37d6299204a0384c40 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
@@ -109,7 +109,7 @@ public class CactusBlock extends Block {
|
||||
BlockState iblockdata2 = world.getBlockState(pos.relative(enumdirection));
|
||||
|
||||
material = iblockdata2.getMaterial();
|
||||
- } while (!material.isSolid() && !world.getFluidState(pos.relative(enumdirection)).is(FluidTags.LAVA));
|
||||
+ } while ((!world.getWorldBorder().world.purpurConfig.cactusBreaksFromSolidNeighbors || !material.isSolid()) && !world.getFluidState(pos.relative(enumdirection)).is(FluidTags.LAVA)); // Purpur
|
||||
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 3e14e9ca693cd1649514e84f32951bf70e18863a..347b0ffe2bb47a08d781f9e0e970005b33138960 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -723,6 +723,11 @@ public class PurpurWorldConfig {
|
||||
buddingAmethystSilkTouch = getBoolean("blocks.budding_amethyst.silk-touch", buddingAmethystSilkTouch);
|
||||
}
|
||||
|
||||
+ public boolean cactusBreaksFromSolidNeighbors = true;
|
||||
+ private void cactusSettings() {
|
||||
+ cactusBreaksFromSolidNeighbors = getBoolean("blocks.cactus.breaks-from-solid-neighbors", cactusBreaksFromSolidNeighbors);
|
||||
+ }
|
||||
+
|
||||
public boolean chestOpenWithBlockOnTop = false;
|
||||
private void chestSettings() {
|
||||
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||
@@ -1,47 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 16:59:21 -0400
|
||||
Subject: [PATCH] Config to remove curse of binding with weakness
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
|
||||
index 111da6398bb561e58571e47743088ce80416234d..0a2c776b9b1da7d0d4481dd527e0068b170cac23 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
|
||||
@@ -4,6 +4,7 @@ import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.Container;
|
||||
+import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
@@ -88,7 +89,7 @@ public class InventoryMenu extends RecipeBookMenu<CraftingContainer> {
|
||||
public boolean mayPickup(Player playerEntity) {
|
||||
ItemStack itemstack = this.getItem();
|
||||
|
||||
- return !itemstack.isEmpty() && !playerEntity.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.mayPickup(playerEntity);
|
||||
+ return !itemstack.isEmpty() && !playerEntity.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? playerEntity.level.purpurConfig.playerRemoveBindingWithWeakness && playerEntity.hasEffect(MobEffects.WEAKNESS) : super.mayPickup(playerEntity); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index bb56401a3eea8046ed45c73dcd4d0638455955b5..8f8a8d00fe47a9dc0248c27122212de4e7b3fab3 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -397,6 +397,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerArmorSwapping = false;
|
||||
public boolean playerArmorSwappingCreativeMakesCopy = true;
|
||||
public boolean playerRidableInWater = false;
|
||||
+ public boolean playerRemoveBindingWithWeakness = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -423,6 +424,7 @@ public class PurpurWorldConfig {
|
||||
playerArmorSwapping = getBoolean("gameplay-mechanics.player.armor-click-equip.allow-hot-swapping", playerArmorSwapping);
|
||||
playerArmorSwappingCreativeMakesCopy = getBoolean("gameplay-mechanics.player.armor-click-equip.creative-makes-copy", playerArmorSwappingCreativeMakesCopy);
|
||||
playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater);
|
||||
+ playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,78 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 18:14:31 -0400
|
||||
Subject: [PATCH] Conduit behavior configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
||||
index b7ec481bb9159bb203ff1688dd7f6b9f9199bccc..5d23659fd7b2507525f315d5cc808aa0ab5baaac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
|
||||
@@ -172,7 +172,7 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
if ((l > 1 || i1 > 1 || j1 > 1) && (i == 0 && (i1 == 2 || j1 == 2) || j == 0 && (l == 2 || j1 == 2) || k == 0 && (l == 2 || i1 == 2))) {
|
||||
BlockPos blockposition2 = pos.offset(i, j, k);
|
||||
BlockState iblockdata = world.getBlockState(blockposition2);
|
||||
- Block[] ablock = ConduitBlockEntity.VALID_BLOCKS;
|
||||
+ Block[] ablock = world.purpurConfig.conduitBlocks; // Purpur
|
||||
int k1 = ablock.length;
|
||||
|
||||
for (int l1 = 0; l1 < k1; ++l1) {
|
||||
@@ -192,7 +192,7 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
|
||||
private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) {
|
||||
int i = activatingBlocks.size();
|
||||
- int j = i / 7 * 16;
|
||||
+ int j = i / 7 * world.purpurConfig.conduitDistance; // Purpur
|
||||
int k = pos.getX();
|
||||
int l = pos.getY();
|
||||
int i1 = pos.getZ();
|
||||
@@ -230,14 +230,14 @@ public class ConduitBlockEntity extends BlockEntity {
|
||||
if (!list1.isEmpty()) {
|
||||
blockEntity.destroyTarget = (LivingEntity) list1.get(world.random.nextInt(list1.size()));
|
||||
}
|
||||
- } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan(blockEntity.destroyTarget.blockPosition(), 8.0D)) {
|
||||
+ } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan(blockEntity.destroyTarget.blockPosition(), world.purpurConfig.conduitDamageDistance)) { // Purpur
|
||||
blockEntity.destroyTarget = null;
|
||||
}
|
||||
|
||||
if (blockEntity.destroyTarget != null) {
|
||||
// CraftBukkit start
|
||||
CraftEventFactory.blockDamage = CraftBlock.at(world, pos);
|
||||
- if (blockEntity.destroyTarget.hurt(DamageSource.MAGIC, 4.0F)) {
|
||||
+ if (blockEntity.destroyTarget.hurt(DamageSource.MAGIC, world.purpurConfig.conduitDamageAmount)) { // Purpur
|
||||
world.playSound((Player) null, blockEntity.destroyTarget.getX(), blockEntity.destroyTarget.getY(), blockEntity.destroyTarget.getZ(), SoundEvents.CONDUIT_ATTACK_TARGET, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
CraftEventFactory.blockDamage = null;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 6e77bd28c293537bc7a76b242f01fbb63110b53b..4ca41612b59a003189d12e1062688a6ba920d287 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2733,5 +2733,28 @@ public class PurpurWorldConfig {
|
||||
private void hungerSettings() {
|
||||
hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
|
||||
}
|
||||
+
|
||||
+ public int conduitDistance = 16;
|
||||
+ public double conduitDamageDistance = 8;
|
||||
+ public float conduitDamageAmount = 4;
|
||||
+ public Block[] conduitBlocks;
|
||||
+ private void conduitSettings() {
|
||||
+ conduitDistance = getInt("blocks.conduit.effect-distance", conduitDistance);
|
||||
+ conduitDamageDistance = getDouble("blocks.conduit.mob-damage.distance", conduitDamageDistance);
|
||||
+ conduitDamageAmount = (float) getDouble("blocks.conduit.mob-damage.damage-amount", conduitDamageAmount);
|
||||
+ List<Block> conduitBlockList = new ArrayList<>();
|
||||
+ getList("blocks.conduit.valid-ring-blocks", new ArrayList<String>(){{
|
||||
+ add("minecraft:prismarine");
|
||||
+ add("minecraft:prismarine_bricks");
|
||||
+ add("minecraft:sea_lantern");
|
||||
+ add("minecraft:dark_prismarine");
|
||||
+ }}).forEach(key -> {
|
||||
+ Block block = Registry.BLOCK.get(new ResourceLocation(key.toString()));
|
||||
+ if (!block.defaultBlockState().isAir()) {
|
||||
+ conduitBlockList.add(block);
|
||||
+ }
|
||||
+ });
|
||||
+ conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
||||
+ }
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 18:38:44 -0400
|
||||
Subject: [PATCH] Cauldron fill chances
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
||||
index dbae4f3b56d0290c6d28b9beaaa3b459754d43e3..676184c48c3abd8e2fb9a04ae3e165dc298a02be 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
||||
@@ -29,7 +29,7 @@ public class CauldronBlock extends AbstractCauldronBlock {
|
||||
}
|
||||
|
||||
protected static boolean shouldHandlePrecipitation(Level world, Biome.Precipitation precipitation) {
|
||||
- return precipitation == Biome.Precipitation.RAIN ? world.getRandom().nextFloat() < 0.05F : (precipitation == Biome.Precipitation.SNOW ? world.getRandom().nextFloat() < 0.1F : false);
|
||||
+ return precipitation == Biome.Precipitation.RAIN ? world.getRandom().nextFloat() < world.purpurConfig.cauldronRainChance : (precipitation == Biome.Precipitation.SNOW ? world.getRandom().nextFloat() < world.purpurConfig.cauldronPowderSnowChance : false); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
index 995e3bf2ee863902497ab40cb7cf3a14a22a6e19..0499d79e7882ba521f40851ba31b2a44240f40ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
@@ -187,19 +187,19 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate
|
||||
|
||||
@VisibleForTesting
|
||||
public static void maybeFillCauldron(BlockState state, ServerLevel world, BlockPos pos, float dripChance) {
|
||||
- if (dripChance <= 0.17578125F || dripChance <= 0.05859375F) {
|
||||
+ if (dripChance <= world.purpurConfig.cauldronDripstoneWaterFillChance || dripChance <= world.purpurConfig.cauldronDripstoneLavaFillChance) {
|
||||
if (PointedDripstoneBlock.isStalactiteStartPos(state, world, pos)) {
|
||||
Fluid fluidtype = PointedDripstoneBlock.getCauldronFillFluidType(world, pos);
|
||||
float f1;
|
||||
|
||||
if (fluidtype == Fluids.WATER) {
|
||||
- f1 = 0.17578125F;
|
||||
+ f1 = world.purpurConfig.cauldronDripstoneWaterFillChance;
|
||||
} else {
|
||||
if (fluidtype != Fluids.LAVA) {
|
||||
return;
|
||||
}
|
||||
|
||||
- f1 = 0.05859375F;
|
||||
+ f1 = world.purpurConfig.cauldronDripstoneLavaFillChance;
|
||||
}
|
||||
|
||||
if (dripChance < f1) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 4ca41612b59a003189d12e1062688a6ba920d287..cb28c0dc5a5733e759fc728bb458aaa38452ebea 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2756,5 +2756,16 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
||||
}
|
||||
+
|
||||
+ public float cauldronRainChance = 0.05F;
|
||||
+ public float cauldronPowderSnowChance = 0.1F;
|
||||
+ public float cauldronDripstoneWaterFillChance = 0.17578125F;
|
||||
+ public float cauldronDripstoneLavaFillChance = 0.05859375F;
|
||||
+ private void cauldronSettings() {
|
||||
+ cauldronRainChance = (float) getDouble("blocks.cauldron.fill-chances.rain", cauldronRainChance);
|
||||
+ cauldronPowderSnowChance = (float) getDouble("blocks.cauldron.fill-chances.powder-snow", cauldronPowderSnowChance);
|
||||
+ cauldronDripstoneWaterFillChance = (float) getDouble("blocks.cauldron.fill-chances.dripstone-water", cauldronDripstoneWaterFillChance);
|
||||
+ cauldronDripstoneLavaFillChance = (float) getDouble("blocks.cauldron.fill-chances.dripstone-lava", cauldronDripstoneLavaFillChance);
|
||||
+ }
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 8 Aug 2021 22:50:23 -0400
|
||||
Subject: [PATCH] Config to allow mobs to pathfind over rails
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index d7bdf3c2a5b99ff7adb3e960ff356a1fad169de0..3ca846cc78ec2ac8c9f840a9ac7f0b87b871f8d7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
@@ -240,7 +240,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
}
|
||||
|
||||
if (blockPathTypes != BlockPathTypes.WALKABLE && (!this.isAmphibious() || blockPathTypes != BlockPathTypes.WATER)) {
|
||||
- if ((node == null || node.costMalus < 0.0F) && maxYStep > 0 && blockPathTypes != BlockPathTypes.FENCE && blockPathTypes != BlockPathTypes.UNPASSABLE_RAIL && blockPathTypes != BlockPathTypes.TRAPDOOR && blockPathTypes != BlockPathTypes.POWDER_SNOW) {
|
||||
+ if ((node == null || node.costMalus < 0.0F) && maxYStep > 0 && blockPathTypes != BlockPathTypes.FENCE && !(!this.mob.level.purpurConfig.mobsIgnoreRails && blockPathTypes == BlockPathTypes.UNPASSABLE_RAIL) && blockPathTypes != BlockPathTypes.TRAPDOOR && blockPathTypes != BlockPathTypes.POWDER_SNOW) { // Purpur
|
||||
node = this.findAcceptedNode(x, y + 1, z, maxYStep - 1, prevFeetY, direction, nodeType);
|
||||
if (node != null && (node.type == BlockPathTypes.OPEN || node.type == BlockPathTypes.WALKABLE) && this.mob.getBbWidth() < 1.0F) {
|
||||
double g = (double)(x - direction.getStepX()) + 0.5D;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index b8cf6e9037184d5945887748fb9fbfc8bcbc0f2a..a6909960d14de6c0ecea4f47902d73def5441ffa 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -132,6 +132,7 @@ public class PurpurWorldConfig {
|
||||
public double voidDamageDealt = 4.0D;
|
||||
public int raidCooldownSeconds = 0;
|
||||
public int animalBreedingCooldownSeconds = 0;
|
||||
+ public boolean mobsIgnoreRails = false;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
@@ -153,6 +154,7 @@ public class PurpurWorldConfig {
|
||||
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
||||
raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds);
|
||||
animalBreedingCooldownSeconds = getInt("gameplay-mechanics.animal-breeding-cooldown-seconds", animalBreedingCooldownSeconds);
|
||||
+ mobsIgnoreRails = getBoolean("gameplay-mechanics.mobs-ignore-rails", mobsIgnoreRails);
|
||||
}
|
||||
|
||||
public int daytimeTicks = 12000;
|
||||
@@ -1,68 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 00:07:39 -0500
|
||||
Subject: [PATCH] Shulker change color with dye
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
index edaa34c6c2c65df77c696b4654e64bcf37a3ff20..e63a27abef4b9aab0c2afbb92da994e8a11ac14a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -22,6 +22,8 @@ import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.DifficultyInstance;
|
||||
+import net.minecraft.world.InteractionHand;
|
||||
+import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityDimensions;
|
||||
@@ -48,6 +50,8 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.entity.projectile.ShulkerBullet;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
+import net.minecraft.world.item.DyeItem;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -117,6 +121,19 @@ public class Shulker extends AbstractGolem implements Enemy {
|
||||
public boolean isSensitiveToWater() {
|
||||
return this.level.purpurConfig.shulkerTakeDamageFromWater;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ protected InteractionResult mobInteract(Player player, InteractionHand hand) {
|
||||
+ ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ if (player.level.purpurConfig.shulkerChangeColorWithDye && itemstack.getItem() instanceof DyeItem dye && dye.getDyeColor() != this.getColor()) {
|
||||
+ this.setColor(dye.getDyeColor());
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ return super.mobInteract(player, hand);
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index bf9a4047175bd22a25545d1e5feac6e475b8c436..24f78e964f39104be5f5eb6c961a7d98bfbeb362 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2099,6 +2099,7 @@ public class PurpurWorldConfig {
|
||||
public double shulkerSpawnFromBulletNearbyRange = 8.0D;
|
||||
public String shulkerSpawnFromBulletNearbyEquation = "(nearby - 1) / 5.0";
|
||||
public boolean shulkerSpawnFromBulletRandomColor = false;
|
||||
+ public boolean shulkerChangeColorWithDye = false;
|
||||
private void shulkerSettings() {
|
||||
shulkerRidable = getBoolean("mobs.shulker.ridable", shulkerRidable);
|
||||
shulkerRidableInWater = getBoolean("mobs.shulker.ridable-in-water", shulkerRidableInWater);
|
||||
@@ -2115,6 +2116,7 @@ public class PurpurWorldConfig {
|
||||
shulkerSpawnFromBulletNearbyRange = getDouble("mobs.shulker.spawn-from-bullet.nearby-range", shulkerSpawnFromBulletNearbyRange);
|
||||
shulkerSpawnFromBulletNearbyEquation = getString("mobs.shulker.spawn-from-bullet.nearby-equation", shulkerSpawnFromBulletNearbyEquation);
|
||||
shulkerSpawnFromBulletRandomColor = getBoolean("mobs.shulker.spawn-from-bullet.random-color", shulkerSpawnFromBulletRandomColor);
|
||||
+ shulkerChangeColorWithDye = getBoolean("mobs.shulker.change-color-with-dye", shulkerChangeColorWithDye);
|
||||
}
|
||||
|
||||
public boolean silverfishRidable = false;
|
||||
@@ -1,257 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: YouHaveTrouble <youhavetrouble@youhavetrouble.me>
|
||||
Date: Sun, 22 Aug 2021 05:12:05 +0200
|
||||
Subject: [PATCH] Extended OfflinePlayer API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
index 50927403d07954f3b930b39046866899a1b289e6..c544e411934832cabb230047632454fff0460eef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -538,4 +538,213 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start - OfflinePlayer API
|
||||
+ @Override
|
||||
+ public boolean getAllowFlight() {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().getAllowFlight();
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return false;
|
||||
+ if (!data.contains("abilities")) return false;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ return abilities.getByte("mayfly") == (byte) 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setAllowFlight(boolean flight) {
|
||||
+ if (this.isOnline()) {
|
||||
+ this.getPlayer().setAllowFlight(flight);
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return;
|
||||
+ if (!data.contains("abilities")) return;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ abilities.putByte("mayfly", (byte) (flight ? 1 : 0));
|
||||
+ data.put("abilities", abilities);
|
||||
+ save(data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isFlying() {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.isFlying();
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return false;
|
||||
+ if (!data.contains("abilities")) return false;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ return abilities.getByte("flying") == (byte) 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setFlying(boolean value) {
|
||||
+ if (this.isOnline()) {
|
||||
+ this.getPlayer().setFlying(value);
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return;
|
||||
+ if (!data.contains("abilities")) return;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ abilities.putByte("mayfly", (byte) (value ? 1 : 0));
|
||||
+ data.put("abilities", abilities);
|
||||
+ save(data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setFlySpeed(float value) throws IllegalArgumentException {
|
||||
+ if (value < -1f || value > 1f) throw new IllegalArgumentException("FlySpeed needs to be between -1 and 1");
|
||||
+ if (this.isOnline()) {
|
||||
+ this.getPlayer().setFlySpeed(value);
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return;
|
||||
+ if (!data.contains("abilities")) return;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ abilities.putFloat("flySpeed", value);
|
||||
+ data.put("abilities", abilities);
|
||||
+ save(data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getFlySpeed() {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().getFlySpeed();
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return 0;
|
||||
+ if (!data.contains("abilities")) return 0;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ return abilities.getFloat("flySpeed");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setWalkSpeed(float value) throws IllegalArgumentException {
|
||||
+ if (value < -1f || value > 1f) throw new IllegalArgumentException("WalkSpeed needs to be between -1 and 1");
|
||||
+ if (this.isOnline()) {
|
||||
+ this.getPlayer().setWalkSpeed(value);
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return;
|
||||
+ if (!data.contains("abilities")) return;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ abilities.putFloat("walkSpeed", value);
|
||||
+ data.put("abilities", abilities);
|
||||
+ save(data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getWalkSpeed() {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().getWalkSpeed();
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return 0;
|
||||
+ if (!data.contains("abilities")) return 0;
|
||||
+ CompoundTag abilities = data.getCompound("abilities");
|
||||
+ return abilities.getFloat("walkSpeed");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().getLocation();
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return null;
|
||||
+ long worldUUIDMost = data.getLong("WorldUUIDMost");
|
||||
+ long worldUUIDLeast = data.getLong("WorldUUIDLeast");
|
||||
+ net.minecraft.nbt.ListTag position = data.getList("Pos", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_DOUBLE);
|
||||
+ net.minecraft.nbt.ListTag rotation = data.getList("Rotation", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_FLOAT);
|
||||
+ UUID worldUuid = new UUID(worldUUIDMost, worldUUIDLeast);
|
||||
+ org.bukkit.World world = server.getWorld(worldUuid);
|
||||
+ double x = position.getDouble(0);
|
||||
+ double y = position.getDouble(1);
|
||||
+ double z = position.getDouble(2);
|
||||
+ float yaw = rotation.getFloat(0);
|
||||
+ float pitch = rotation.getFloat(1);
|
||||
+ return new Location(world, x, y, z, yaw, pitch);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean teleportOffline(Location destination) {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().teleport(destination);
|
||||
+ } else {
|
||||
+ return setLocation(destination);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean teleportOffline(Location destination, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause){
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().teleport(destination, cause);
|
||||
+ } else {
|
||||
+ return setLocation(destination);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(Location destination) {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().teleportAsync(destination);
|
||||
+ } else {
|
||||
+ return java.util.concurrent.CompletableFuture.completedFuture(setLocation(destination));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(Location destination, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().teleportAsync(destination, cause);
|
||||
+ } else {
|
||||
+ return java.util.concurrent.CompletableFuture.completedFuture(setLocation(destination));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private boolean setLocation(Location location) {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return false;
|
||||
+ data.putLong("WorldUUIDMost", location.getWorld().getUID().getMostSignificantBits());
|
||||
+ data.putLong("WorldUUIDLeast", location.getWorld().getUID().getLeastSignificantBits());
|
||||
+ net.minecraft.nbt.ListTag position = new net.minecraft.nbt.ListTag();
|
||||
+ position.add(net.minecraft.nbt.DoubleTag.valueOf(location.getX()));
|
||||
+ position.add(net.minecraft.nbt.DoubleTag.valueOf(location.getY()));
|
||||
+ position.add(net.minecraft.nbt.DoubleTag.valueOf(location.getZ()));
|
||||
+ data.put("Pos", position);
|
||||
+ net.minecraft.nbt.ListTag rotation = new net.minecraft.nbt.ListTag();
|
||||
+ rotation.add(net.minecraft.nbt.FloatTag.valueOf(location.getYaw()));
|
||||
+ rotation.add(net.minecraft.nbt.FloatTag.valueOf(location.getPitch()));
|
||||
+ data.put("Rotation", rotation);
|
||||
+ save(data);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Safely replaces player's .dat file with provided CompoundTag
|
||||
+ * @param compoundTag
|
||||
+ */
|
||||
+ private void save(CompoundTag compoundTag) {
|
||||
+ File playerDir = server.console.playerDataStorage.getPlayerDir();
|
||||
+ try {
|
||||
+ File tempFile = File.createTempFile(this.getUniqueId()+"-", ".dat", playerDir);
|
||||
+ net.minecraft.nbt.NbtIo.writeCompressed(compoundTag, tempFile);
|
||||
+ File playerDataFile = new File(playerDir, this.getUniqueId()+".dat");
|
||||
+ File playerDataFileOld = new File(playerDir, this.getUniqueId()+".dat_old");
|
||||
+ net.minecraft.Util.safeReplaceFile(playerDataFile, tempFile, playerDataFileOld);
|
||||
+ } catch (java.io.IOException e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - OfflinePlayer API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index d1e4c0253800ca0aaf83f106353cfb4c5b99b3f8..e339c0109c38fde307573af50cb3746b5c7f5848 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2111,6 +2111,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.getHandle().getAbilities().walkingSpeed * 2f;
|
||||
}
|
||||
|
||||
+ // Purpur start - OfflinePlayer API
|
||||
+ @Override
|
||||
+ public boolean teleportOffline(@NotNull Location destination) {
|
||||
+ return this.teleport(destination);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean teleportOffline(Location destination, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ return this.teleport(destination, cause);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination) {
|
||||
+ return this.teleportAsync(destination);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ return this.teleportAsync(destination, cause);
|
||||
+ }
|
||||
+ // Purpur end - OfflinePlayer API
|
||||
+
|
||||
private void validateSpeed(float value) {
|
||||
if (value < 0) {
|
||||
if (value < -1f) {
|
||||
@@ -1,76 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 9 Aug 2021 13:22:20 +0200
|
||||
Subject: [PATCH] Added the ability to add combustible items
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractFurnaceMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
index 4adfc26062b322443828e94e6b0943884a18846b..0d9ecca25bff63f3428ccf93e2789fca0bcef7cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
@@ -145,7 +145,13 @@ public abstract class AbstractFurnaceMenu extends RecipeBookMenu<Container> {
|
||||
} else if (index != 1 && index != 0) {
|
||||
if (this.canSmelt(itemstack1)) {
|
||||
if (!this.moveItemStackTo(itemstack1, 0, 1, false)) {
|
||||
- return ItemStack.EMPTY;
|
||||
+ // Purpur start - fix #625
|
||||
+ if (this.isFuel(itemstack1)) {
|
||||
+ if (!this.moveItemStackTo(itemstack1, 1, 2, false)) {
|
||||
+ return ItemStack.EMPTY;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
} else if (this.isFuel(itemstack1)) {
|
||||
if (!this.moveItemStackTo(itemstack1, 1, 2, false)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 99c207457ec9d1a1b7d9e7becfcc8aae383e93ae..158945281178c80495f1dc2125ea21a2cd6eeb90 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -207,6 +207,22 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
// Paper end
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public static void addFuel(ItemStack itemStack, Integer burnTime) {
|
||||
+ Map<Item, Integer> map = Maps.newLinkedHashMap();
|
||||
+ map.putAll(getFuel());
|
||||
+ map.put(itemStack.getItem(), burnTime);
|
||||
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
|
||||
+ }
|
||||
+
|
||||
+ public static void removeFuel(ItemStack itemStack) {
|
||||
+ Map<Item, Integer> map = Maps.newLinkedHashMap();
|
||||
+ map.putAll(getFuel());
|
||||
+ map.remove(itemStack.getItem());
|
||||
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
|
||||
+ }
|
||||
+ // Purpur End
|
||||
+
|
||||
// CraftBukkit start - add fields and methods
|
||||
private int maxStack = MAX_STACK;
|
||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index aec3440b25ca53f04361b7c256d63ff2beb5ba74..bdabc6ec495ca56848ad7b8cc7aef7e5788c7efa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1434,6 +1434,19 @@ public final class CraftServer implements Server {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Purpur Start
|
||||
+ @Override
|
||||
+ public void addFuel(org.bukkit.Material material, int burnTime) {
|
||||
+ Preconditions.checkArgument(burnTime > 0, "BurnTime must be greater than 0");
|
||||
+ net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity.addFuel(net.minecraft.world.item.ItemStack.fromBukkitCopy(new ItemStack(material)), burnTime);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void removeFuel(org.bukkit.Material material) {
|
||||
+ net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity.removeFuel(net.minecraft.world.item.ItemStack.fromBukkitCopy(new ItemStack(material)));
|
||||
+ }
|
||||
+ // Purpur End
|
||||
+
|
||||
@Override
|
||||
public List<Recipe> getRecipesFor(ItemStack result) {
|
||||
Validate.notNull(result, "Result cannot be null");
|
||||
@@ -1,48 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Mon, 23 Aug 2021 17:59:29 +0200
|
||||
Subject: [PATCH] Option for if rain and thunder should stop on sleep
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d85249f7944e548f360712212166cdf7ecbf475c..77cb010bd8b67f436726dfe32e5dd3b897beff55 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1125,6 +1125,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
private void resetWeatherCycle() {
|
||||
// CraftBukkit start
|
||||
+ if (this.purpurConfig.rainStopsAfterSleep) // Purpur
|
||||
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night
|
||||
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
// Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
@@ -1132,6 +1133,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.serverLevelData.setRainTime(0);
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ if (this.purpurConfig.thunderStopsAfterSleep) // Purpur
|
||||
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - when passing the night
|
||||
// CraftBukkit start
|
||||
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 759ca5b6ac6269957b28ef2454e9fd89a9eafc8f..0af5fe7dc87551b1f0322e5955aca6a13fd8dfa2 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -133,6 +133,8 @@ public class PurpurWorldConfig {
|
||||
public int raidCooldownSeconds = 0;
|
||||
public int animalBreedingCooldownSeconds = 0;
|
||||
public boolean mobsIgnoreRails = false;
|
||||
+ public boolean rainStopsAfterSleep = true;
|
||||
+ public boolean thunderStopsAfterSleep = true;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
@@ -155,6 +157,8 @@ public class PurpurWorldConfig {
|
||||
raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds);
|
||||
animalBreedingCooldownSeconds = getInt("gameplay-mechanics.animal-breeding-cooldown-seconds", animalBreedingCooldownSeconds);
|
||||
mobsIgnoreRails = getBoolean("gameplay-mechanics.mobs-ignore-rails", mobsIgnoreRails);
|
||||
+ rainStopsAfterSleep = getBoolean("gameplay-mechanics.rain-stops-after-sleep", rainStopsAfterSleep);
|
||||
+ thunderStopsAfterSleep = getBoolean("gameplay-mechanics.thunder-stops-after-sleep", thunderStopsAfterSleep);
|
||||
}
|
||||
|
||||
public int daytimeTicks = 12000;
|
||||
@@ -1,74 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 23 Aug 2021 20:57:04 -0500
|
||||
Subject: [PATCH] Chance for azalea blocks to grow into trees naturally
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
index ade4d3c56b02b82cf71c6d1b030209c5ba172957..f6273abc36944e2265e6776c57169776e5ea3850 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
@@ -42,6 +42,20 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock {
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
||||
+ // Purpur start
|
||||
+ growTree(world, random, pos, state);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void randomTick(net.minecraft.world.level.block.state.BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
+ double chance = state.getBlock() == Blocks.FLOWERING_AZALEA ? world.purpurConfig.floweringAzaleaGrowthChance : world.purpurConfig.azaleaGrowthChance;
|
||||
+ if (chance > 0.0D && world.getMaxLocalRawBrightness(pos.above()) > 9 && random.nextDouble() < chance) {
|
||||
+ growTree(world, random, pos, state);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void growTree(ServerLevel world, Random random, BlockPos pos, net.minecraft.world.level.block.state.BlockState state) {
|
||||
+ // Purpur end
|
||||
TREE_GROWER.growTree(world, world.getChunkSource().getGenerator(), pos, state, random);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
index 71e494b949541284b0642dae4b20a6b3ec459828..625ad12e43cc651c986a3b45ce9a7c5be6b715ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
@@ -996,8 +996,8 @@ public class Blocks {
|
||||
public static final Block CAVE_VINES = register("cave_vines", new CaveVinesBlock(BlockBehaviour.Properties.of(Material.PLANT).randomTicks().noCollission().lightLevel(CaveVines.emission(14)).instabreak().sound(SoundType.CAVE_VINES)));
|
||||
public static final Block CAVE_VINES_PLANT = register("cave_vines_plant", new CaveVinesPlantBlock(BlockBehaviour.Properties.of(Material.PLANT).noCollission().lightLevel(CaveVines.emission(14)).instabreak().sound(SoundType.CAVE_VINES)));
|
||||
public static final Block SPORE_BLOSSOM = register("spore_blossom", new SporeBlossomBlock(BlockBehaviour.Properties.of(Material.PLANT).instabreak().noCollission().sound(SoundType.SPORE_BLOSSOM)));
|
||||
- public static final Block AZALEA = register("azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).instabreak().sound(SoundType.AZALEA).noOcclusion()));
|
||||
- public static final Block FLOWERING_AZALEA = register("flowering_azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).instabreak().sound(SoundType.FLOWERING_AZALEA).noOcclusion()));
|
||||
+ public static final Block AZALEA = register("azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).randomTicks().instabreak().sound(SoundType.AZALEA).noOcclusion())); // Purpur
|
||||
+ public static final Block FLOWERING_AZALEA = register("flowering_azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).randomTicks().instabreak().sound(SoundType.FLOWERING_AZALEA).noOcclusion())); // Purpur
|
||||
public static final Block MOSS_CARPET = register("moss_carpet", new CarpetBlock(BlockBehaviour.Properties.of(Material.PLANT, MaterialColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS_CARPET)));
|
||||
public static final Block MOSS_BLOCK = register("moss_block", new MossBlock(BlockBehaviour.Properties.of(Material.MOSS, MaterialColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS)));
|
||||
public static final Block BIG_DRIPLEAF = register("big_dripleaf", new BigDripleafBlock(BlockBehaviour.Properties.of(Material.PLANT).strength(0.1F).sound(SoundType.BIG_DRIPLEAF)));
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index b1545bf97518fd60b54a5a52aec9a2a1d88f3691..3b1d8e8663c5a377567ccd2946839fb3fd66a1f5 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -683,6 +683,11 @@ public class PurpurWorldConfig {
|
||||
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
||||
}
|
||||
|
||||
+ public double azaleaGrowthChance = 0.0D;
|
||||
+ private void azaleaSettings() {
|
||||
+ azaleaGrowthChance = getDouble("blocks.azalea.growth-chance", azaleaGrowthChance);
|
||||
+ }
|
||||
+
|
||||
public int beaconLevelOne = 20;
|
||||
public int beaconLevelTwo = 30;
|
||||
public int beaconLevelThree = 40;
|
||||
@@ -812,6 +817,11 @@ public class PurpurWorldConfig {
|
||||
farmlandTramplingFeatherFalling = getBoolean("blocks.farmland.feather-fall-distance-affects-trampling", farmlandTramplingFeatherFalling);
|
||||
}
|
||||
|
||||
+ public double floweringAzaleaGrowthChance = 0.0D;
|
||||
+ private void floweringAzaleaSettings() {
|
||||
+ floweringAzaleaGrowthChance = getDouble("blocks.flowering_azalea.growth-chance", floweringAzaleaGrowthChance);
|
||||
+ }
|
||||
+
|
||||
public boolean furnaceUseLavaFromUnderneath = false;
|
||||
private void furnaceSettings() {
|
||||
if (PurpurConfig.version < 17) {
|
||||
@@ -1,69 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 24 Aug 2021 16:48:35 -0500
|
||||
Subject: [PATCH] Shift right click to use exp for mending
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index f9f7afa0bf2989aaef2f0e8456fe3c93a226b6d0..00dee850e9ae93ed4e8209c67da2da6aac8ae22a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -547,6 +547,7 @@ public class ServerPlayerGameMode {
|
||||
public InteractionHand interactHand;
|
||||
public ItemStack interactItemStack;
|
||||
public InteractionResult useItemOn(ServerPlayer player, Level world, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) {
|
||||
+ if (shiftClickMended(stack)) return InteractionResult.SUCCESS; // Purpur
|
||||
BlockPos blockposition = hitResult.getBlockPos();
|
||||
BlockState iblockdata = world.getBlockState(blockposition);
|
||||
InteractionResult enuminteractionresult = InteractionResult.PASS;
|
||||
@@ -640,4 +641,18 @@ public class ServerPlayerGameMode {
|
||||
public void setLevel(ServerLevel world) {
|
||||
this.level = world;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public boolean shiftClickMended(ItemStack itemstack) {
|
||||
+ if (this.player.level.purpurConfig.shiftRightClickRepairsMendingPoints > 0 && this.player.isShiftKeyDown()) {
|
||||
+ 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(-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
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index d1ff93ffb591bb7c5a905c4794d19e0dd179346e..44581f275fb2133e96599af6460ff5e841b7aa88 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1980,6 +1980,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
boolean cancelled;
|
||||
if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) {
|
||||
+ if (this.player.gameMode.shiftClickMended(itemstack)) return; // Purpur
|
||||
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
|
||||
cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
} else {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 5240abedf1d90471250fac0dad32252ba22f7855..30b988908f249cd370caafaaaca7ff032ec23ed5 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -404,6 +404,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerArmorSwappingCreativeMakesCopy = true;
|
||||
public boolean playerRidableInWater = false;
|
||||
public boolean playerRemoveBindingWithWeakness = false;
|
||||
+ public int shiftRightClickRepairsMendingPoints = 0;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -431,6 +432,7 @@ public class PurpurWorldConfig {
|
||||
playerArmorSwappingCreativeMakesCopy = getBoolean("gameplay-mechanics.player.armor-click-equip.creative-makes-copy", playerArmorSwappingCreativeMakesCopy);
|
||||
playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater);
|
||||
playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness);
|
||||
+ shiftRightClickRepairsMendingPoints = getInt("gameplay-mechanics.player.shift-right-click-repairs-mending-points", shiftRightClickRepairsMendingPoints);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,68 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 30 Aug 2021 22:14:39 -0500
|
||||
Subject: [PATCH] Dolphins naturally aggressive to players chance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 3cc3539f0664eeb048290f4d9b229a5d674fff3c..f41aadb12c2d661014c488b4fc52298668c95da0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -79,6 +79,7 @@ public class Dolphin extends WaterAnimal {
|
||||
return !entityitem.hasPickUpDelay() && entityitem.isAlive() && entityitem.isInWater();
|
||||
};
|
||||
private int spitCooldown; // Purpur
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur
|
||||
|
||||
public Dolphin(EntityType<? extends Dolphin> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -174,6 +175,7 @@ public class Dolphin extends WaterAnimal {
|
||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
|
||||
this.setAirSupply(this.getMaxAirSupply());
|
||||
this.setXRot(0.0F);
|
||||
+ this.isNaturallyAggressiveToPlayers = world.getLevel().purpurConfig.dolphinNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= world.getLevel().purpurConfig.dolphinNaturallyAggressiveToPlayersChance; // Purpur
|
||||
return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
}
|
||||
|
||||
@@ -244,18 +246,20 @@ public class Dolphin extends WaterAnimal {
|
||||
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
||||
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
+ this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur
|
||||
this.goalSelector.addGoal(1, new Dolphin.DolphinSwimToTreasureGoal(this));
|
||||
this.goalSelector.addGoal(2, new Dolphin.DolphinSwimWithPlayerGoal(this, 4.0D));
|
||||
this.goalSelector.addGoal(4, new RandomSwimmingGoal(this, 1.0D, 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.2000000476837158D, true));
|
||||
+ //this.goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur - moved up
|
||||
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.0D, 1.0D));
|
||||
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Guardian.class})).setAlertOthers());
|
||||
+ this.targetSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, target -> isNaturallyAggressiveToPlayers)); // Purpur
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 27662839ca797f13296bcad00575991be3fa646c..2fdd689519f4610d9845632a88807aad1093d2ed 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1196,6 +1196,7 @@ public class PurpurWorldConfig {
|
||||
public double dolphinMaxHealth = 10.0D;
|
||||
public boolean dolphinDisableTreasureSearching = false;
|
||||
public boolean dolphinTakeDamageFromWater = false;
|
||||
+ public double dolphinNaturallyAggressiveToPlayersChance = 0.0D;
|
||||
private void dolphinSettings() {
|
||||
dolphinRidable = getBoolean("mobs.dolphin.ridable", dolphinRidable);
|
||||
dolphinControllable = getBoolean("mobs.dolphin.controllable", dolphinControllable);
|
||||
@@ -1210,6 +1211,7 @@ public class PurpurWorldConfig {
|
||||
dolphinMaxHealth = getDouble("mobs.dolphin.attributes.max_health", dolphinMaxHealth);
|
||||
dolphinDisableTreasureSearching = getBoolean("mobs.dolphin.disable-treasure-searching", dolphinDisableTreasureSearching);
|
||||
dolphinTakeDamageFromWater = getBoolean("mobs.dolphin.takes-damage-from-water", dolphinTakeDamageFromWater);
|
||||
+ dolphinNaturallyAggressiveToPlayersChance = getDouble("mobs.dolphin.naturally-aggressive-to-players-chance", dolphinNaturallyAggressiveToPlayersChance);
|
||||
}
|
||||
|
||||
public boolean donkeyRidableInWater = false;
|
||||
@@ -1,88 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 30 Aug 2021 22:49:53 -0500
|
||||
Subject: [PATCH] Cows naturally aggressive to players chance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
index 00eec3f51e62858e7b85b3340e76bf66bfd4370f..b5002526f20fb8ae52783a6ba95ccd2d4f9b7840 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
@@ -37,6 +37,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
// CraftBukkit end
|
||||
|
||||
public class Cow extends Animal {
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur
|
||||
|
||||
public Cow(EntityType<? extends Cow> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -61,6 +62,7 @@ public class Cow extends Animal {
|
||||
@Override
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.cowMaxHealth);
|
||||
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level.purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,6 +74,12 @@ public class Cow extends Animal {
|
||||
public boolean isSensitiveToWater() {
|
||||
return this.level.purpurConfig.cowTakeDamageFromWater;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.MobSpawnType spawnReason, net.minecraft.world.entity.SpawnGroupData entityData, net.minecraft.nbt.CompoundTag entityNbt) {
|
||||
+ this.isNaturallyAggressiveToPlayers = world.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= world.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance;
|
||||
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -79,6 +87,7 @@ public class Cow extends Animal {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0D));
|
||||
+ this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
|
||||
if (level.purpurConfig.cowFeedMushrooms > 0) this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT, Blocks.RED_MUSHROOM.asItem(), Blocks.BROWN_MUSHROOM.asItem()), false)); else // Purpur
|
||||
this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT), false));
|
||||
@@ -86,10 +95,11 @@ public class Cow extends Animal {
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
|
||||
+ this.targetSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, target -> isNaturallyAggressiveToPlayers)); // Purpur
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
- return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 0.20000000298023224D);
|
||||
+ return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 0.20000000298023224D).add(Attributes.ATTACK_DAMAGE, 0.0D); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 2fdd689519f4610d9845632a88807aad1093d2ed..164a5485500a59008fda77e2d5e890e952ec4830 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1145,7 +1145,14 @@ public class PurpurWorldConfig {
|
||||
public int cowFeedMushrooms = 0;
|
||||
public int cowBreedingTicks = 6000;
|
||||
public boolean cowTakeDamageFromWater = false;
|
||||
+ public double cowNaturallyAggressiveToPlayersChance = 0.0D;
|
||||
+ public double cowNaturallyAggressiveToPlayersDamage = 2.0D;
|
||||
private void cowSettings() {
|
||||
+ if (PurpurConfig.version < 22) {
|
||||
+ double oldValue = getDouble("mobs.cow.naturally-aggressive-to-players-chance", cowNaturallyAggressiveToPlayersChance);
|
||||
+ set("mobs.cow.naturally-aggressive-to-players-chance", null);
|
||||
+ set("mobs.cow.naturally-aggressive-to-players.chance", oldValue);
|
||||
+ }
|
||||
cowRidable = getBoolean("mobs.cow.ridable", cowRidable);
|
||||
cowRidableInWater = getBoolean("mobs.cow.ridable-in-water", cowRidableInWater);
|
||||
cowControllable = getBoolean("mobs.cow.controllable", cowControllable);
|
||||
@@ -1158,6 +1165,8 @@ public class PurpurWorldConfig {
|
||||
cowFeedMushrooms = getInt("mobs.cow.feed-mushrooms-for-mooshroom", cowFeedMushrooms);
|
||||
cowBreedingTicks = getInt("mobs.cow.breeding-delay-ticks", cowBreedingTicks);
|
||||
cowTakeDamageFromWater = getBoolean("mobs.cow.takes-damage-from-water", cowTakeDamageFromWater);
|
||||
+ cowNaturallyAggressiveToPlayersChance = getDouble("mobs.cow.naturally-aggressive-to-players.chance", cowNaturallyAggressiveToPlayersChance);
|
||||
+ cowNaturallyAggressiveToPlayersDamage = getDouble("mobs.cow.naturally-aggressive-to-players.damage", cowNaturallyAggressiveToPlayersDamage);
|
||||
}
|
||||
|
||||
public boolean creeperRidable = false;
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Tue, 31 Aug 2021 16:48:29 +0200
|
||||
Subject: [PATCH] Option for beds to explode on villager sleep
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index f810e1d00c084e9a1edaa367752c040032a58d75..8a4a18e87f5770addf4316ab9262895780396ba5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -1176,6 +1176,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
@Override
|
||||
public void startSleeping(BlockPos pos) {
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.bedExplodeOnVillagerSleep && this.level.getBlockState(pos).getBlock() instanceof net.minecraft.world.level.block.BedBlock) {
|
||||
+ this.level.explode(null, DamageSource.explosion(this), null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) this.level.purpurConfig.bedExplosionPower, this.level.purpurConfig.bedExplosionFire, this.level.purpurConfig.bedExplosionEffect);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
super.startSleeping(pos);
|
||||
this.brain.setMemory(MemoryModuleType.LAST_SLEPT, this.level.getGameTime()); // CraftBukkit - decompile error
|
||||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 164a5485500a59008fda77e2d5e890e952ec4830..8f89e57f08570f5c93b7b764c60ae6180a1fd096 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -702,11 +702,13 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean bedExplode = true;
|
||||
+ public boolean bedExplodeOnVillagerSleep = false;
|
||||
public double bedExplosionPower = 5.0D;
|
||||
public boolean bedExplosionFire = true;
|
||||
public Explosion.BlockInteraction bedExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
private void bedSettings() {
|
||||
bedExplode = getBoolean("blocks.bed.explode", bedExplode);
|
||||
+ bedExplodeOnVillagerSleep = getBoolean("blocks.bed.explode-on-villager-sleep", bedExplodeOnVillagerSleep);
|
||||
bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower);
|
||||
bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire);
|
||||
try {
|
||||
@@ -1,79 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 13 Sep 2021 04:48:21 +0200
|
||||
Subject: [PATCH] Halloween options and optimizations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
index d4dde82e28200df974b5a084f2d3d7780d8da1bf..4d39f68a0d0de84474ef96f10cb35e97db2fd9f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -316,7 +316,7 @@ public class Bat extends AmbientCreature {
|
||||
int i = world.getMaxLocalRawBrightness(pos);
|
||||
byte b0 = 4;
|
||||
|
||||
- if (Bat.isHalloween()) {
|
||||
+ if (Bat.isHalloweenSeason(world.getMinecraftWorld())) { // Purpur
|
||||
b0 = 7;
|
||||
} else if (random.nextBoolean()) {
|
||||
return false;
|
||||
@@ -330,6 +330,7 @@ public class Bat extends AmbientCreature {
|
||||
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
|
||||
private static boolean isHalloween() {
|
||||
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
|
||||
LocalDate localdate = LocalDate.now();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 193622015c6d3dbff787061e13fa098a287bce0c..1c48ac2f0b6cfee952ce5e76d7d886034ef871c0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -137,11 +137,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
this.reassessWeaponGoal();
|
||||
this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
|
||||
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
|
||||
- LocalDate localdate = LocalDate.now();
|
||||
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||
-
|
||||
- if (j == 10 && i == 31 && this.random.nextFloat() < 0.25F) {
|
||||
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(world.getMinecraftWorld()) && this.random.nextFloat() < this.level.purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur
|
||||
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index bc92a419f15d20f741dc6b7b218018c0c06ae6c2..9ece6bea001aa74b4f2c2971d6f27dc4b1168045 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -580,11 +580,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 j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||
-
|
||||
- if (j == 10 && i == 31 && this.random.nextFloat() < 0.25F) {
|
||||
+ if (net.minecraft.world.entity.ambient.Bat.isHalloweenSeason(world.getMinecraftWorld()) && this.random.nextFloat() < this.level.purpurConfig.chanceHeadHalloweenOnEntity) { // Purpur
|
||||
this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN));
|
||||
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 63fdfe796bc828046a54a8dd522a834a12860105..f111aa6439f785cc9ea396efe50ab06a159ee1b2 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1525,6 +1525,13 @@ public class PurpurWorldConfig {
|
||||
guardianTakeDamageFromWater = getBoolean("mobs.guardian.takes-damage-from-water", guardianTakeDamageFromWater);
|
||||
}
|
||||
|
||||
+ public boolean forceHalloweenSeason = false;
|
||||
+ public float chanceHeadHalloweenOnEntity = 0.25F;
|
||||
+ private void halloweenSetting() {
|
||||
+ forceHalloweenSeason = getBoolean("gameplay-mechanics.halloween.force", forceHalloweenSeason);
|
||||
+ chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
|
||||
+ }
|
||||
+
|
||||
public boolean hoglinRidable = false;
|
||||
public boolean hoglinRidableInWater = false;
|
||||
public boolean hoglinControllable = true;
|
||||
@@ -1,92 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Wed, 29 Sep 2021 13:37:57 -0400
|
||||
Subject: [PATCH] Config for grindstones
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 0bdf874ddb951daf8d469575a44144504472d12d..855ff86696d27f7029ec8bd2558207078a62525b 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -130,7 +130,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
Enchantment enchantment = (Enchantment) entry.getKey();
|
||||
Integer integer = (Integer) entry.getValue();
|
||||
|
||||
- if (!enchantment.isCurse()) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(enchantment)) { // Purpur
|
||||
j += enchantment.getMinCost(integer);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
Entry<Enchantment, Integer> entry = (Entry) iterator.next();
|
||||
Enchantment enchantment = (Enchantment) entry.getKey();
|
||||
|
||||
- if (!enchantment.isCurse() || EnchantmentHelper.getItemEnchantmentLevel(enchantment, itemstack2) == 0) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(enchantment) || EnchantmentHelper.getItemEnchantmentLevel(enchantment, itemstack2) == 0) { // Purpur
|
||||
itemstack2.enchant(enchantment, (Integer) entry.getValue());
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
|
||||
itemstack1.setCount(amount);
|
||||
Map<Enchantment, Integer> map = (Map) EnchantmentHelper.getEnchantments(item).entrySet().stream().filter((entry) -> {
|
||||
- return ((Enchantment) entry.getKey()).isCurse();
|
||||
+ return org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains((Enchantment) entry.getKey()); // Purpur
|
||||
}).collect(Collectors.toMap(Entry::getKey, Entry::getValue));
|
||||
|
||||
EnchantmentHelper.setEnchantments(map, itemstack1);
|
||||
@@ -267,6 +267,20 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
itemstack1.setRepairCost(AnvilMenu.calculateIncreasedRepairCost(itemstack1.getBaseRepairCost()));
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.grindstoneRemoveAttributes && itemstack1.getTag() != null) {
|
||||
+ for (String key : itemstack1.getTag().getAllKeys()) {
|
||||
+ if (!key.equals("display")) {
|
||||
+ itemstack1.getTag().remove(key);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.grindstoneRemoveDisplay && itemstack1.getTag() != null) {
|
||||
+ itemstack1.getTag().remove("display");
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return itemstack1;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index f59247132b92abafc20437f958b69a7964676423..147175986954fbcc66a960efd65c3f60cd6016d3 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -319,6 +319,9 @@ public class PurpurConfig {
|
||||
public static int beeInsideBeeHive = 3;
|
||||
public static boolean anvilCumulativeCost = true;
|
||||
public static int lightningRodRange = 128;
|
||||
+ public static Set<Enchantment> grindstoneIgnoredEnchants = new HashSet<>();
|
||||
+ public static boolean grindstoneRemoveAttributes = false;
|
||||
+ public static boolean grindstoneRemoveDisplay = false;
|
||||
private static void blockSettings() {
|
||||
if (version < 3) {
|
||||
boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
|
||||
@@ -353,6 +356,19 @@ public class PurpurConfig {
|
||||
beeInsideBeeHive = getInt("settings.blocks.beehive.max-bees-inside", beeInsideBeeHive);
|
||||
anvilCumulativeCost = getBoolean("settings.blocks.anvil.cumulative-cost", anvilCumulativeCost);
|
||||
lightningRodRange = getInt("settings.blocks.lightning_rod.range", lightningRodRange);
|
||||
+ ArrayList<String> defaultCurses = new ArrayList<>(){{
|
||||
+ add("minecraft:binding_curse");
|
||||
+ add("minecraft:vanishing_curse");
|
||||
+ }};
|
||||
+ if (version < 24 && !getBoolean("settings.blocks.grindstone.ignore-curses", true)) {
|
||||
+ defaultCurses.clear();
|
||||
+ }
|
||||
+ getList("settings.blocks.grindstone.ignored-enchants", defaultCurses).forEach(key -> {
|
||||
+ Enchantment enchantment = Registry.ENCHANTMENT.get(new ResourceLocation(key.toString()));
|
||||
+ grindstoneIgnoredEnchants.add(enchantment);
|
||||
+ });
|
||||
+ grindstoneRemoveAttributes = getBoolean("settings.blocks.grindstone.remove-attributes", grindstoneRemoveAttributes);
|
||||
+ grindstoneRemoveDisplay = getBoolean("settings.blocks.grindstone.remove-name-and-lore", grindstoneRemoveDisplay);
|
||||
}
|
||||
|
||||
public static boolean allowInfinityMending = false;
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Wed, 22 Jan 2020 20:13:40 -0600
|
||||
Subject: [PATCH] UPnP Port Forwarding
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 2d31d6beb1f98c05c8ff1ffca6f477328e692bbe..836028033093ea72c670afafeee4b81a421dd459 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Spigot end
|
||||
public static long currentTickLong = 0L; // Paper
|
||||
public boolean lagging = false; // Purpur
|
||||
+ protected boolean upnp = false; // Purpur
|
||||
|
||||
public volatile Thread shutdownThread; // Paper
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
@@ -971,6 +972,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// CraftBukkit end
|
||||
MinecraftServer.LOGGER.info("Stopping server");
|
||||
MinecraftTimings.stopServer(); // Paper
|
||||
+ // Purpur start
|
||||
+ 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());
|
||||
+ }
|
||||
+ }
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.disablePlugins();
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index f508eda7f689ef1a5743bda4d68a863f37108486..2a6d3c49a337b3815fdcc7624e90d875464bb7da 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -293,6 +293,30 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
||||
return false;
|
||||
}
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.useUPnP) {
|
||||
+ LOGGER.info("[UPnP] Attempting to start UPnP port forwarding service...");
|
||||
+ if (dev.omega24.upnp4j.UPnP4J.isUPnPAvailable()) {
|
||||
+ if (dev.omega24.upnp4j.UPnP4J.isOpen(this.getPort(), dev.omega24.upnp4j.util.Protocol.TCP)) {
|
||||
+ this.upnp = false;
|
||||
+ LOGGER.info("[UPnP] Port {} is already open", this.getPort());
|
||||
+ } else if (dev.omega24.upnp4j.UPnP4J.open(this.getPort(), dev.omega24.upnp4j.util.Protocol.TCP)) {
|
||||
+ this.upnp = true;
|
||||
+ LOGGER.info("[UPnP] Successfully opened port {}", this.getPort());
|
||||
+ } else {
|
||||
+ this.upnp = false;
|
||||
+ LOGGER.info("[UPnP] Failed to open port {}", this.getPort());
|
||||
+ }
|
||||
+
|
||||
+ if (upnp) {
|
||||
+ LOGGER.info("[UPnP] {}:{}", dev.omega24.upnp4j.UPnP4J.getExternalIP(), this.getPort());
|
||||
+ }
|
||||
+ } else {
|
||||
+ this.upnp = false;
|
||||
+ LOGGER.error("[UPnP] Service is unavailable");
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
// CraftBukkit start
|
||||
// this.setPlayerList(new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)); // Spigot - moved up
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 2657f8e49058f7801c2435d499e6133e912021ac..3462a34a7d8e2bbf4c19c02a0b9f19ad5ccdc00f 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -422,4 +422,9 @@ public class PurpurConfig {
|
||||
private static void tpsCatchup() {
|
||||
tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
|
||||
}
|
||||
+
|
||||
+ public static boolean useUPnP = false;
|
||||
+ private static void networkSettings() {
|
||||
+ useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
||||
+ }
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: granny <granny@pl3x.net>
|
||||
Date: Thu, 14 Oct 2021 01:53:20 -0700
|
||||
Subject: [PATCH] Campfire option for lit when placed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
index b29d1fd37f3f265e01128ff6fb1d56da2280f6e0..9b8d7fac4cb70a9abcbed7371fd64358fb12fd10 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
@@ -123,7 +123,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
|
||||
BlockPos blockposition = ctx.getClickedPos();
|
||||
boolean flag = world.getFluidState(blockposition).getType() == Fluids.WATER;
|
||||
|
||||
- return (BlockState) ((BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(CampfireBlock.WATERLOGGED, flag)).setValue(CampfireBlock.SIGNAL_FIRE, this.isSmokeSource(world.getBlockState(blockposition.below())))).setValue(CampfireBlock.LIT, !flag)).setValue(CampfireBlock.FACING, ctx.getHorizontalDirection());
|
||||
+ return (BlockState) ((BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(CampfireBlock.WATERLOGGED, flag)).setValue(CampfireBlock.SIGNAL_FIRE, this.isSmokeSource(world.getBlockState(blockposition.below())))).setValue(CampfireBlock.LIT, world.purpurConfig.campFireLitWhenPlaced ? !flag : world.purpurConfig.campFireLitWhenPlaced)).setValue(CampfireBlock.FACING, ctx.getHorizontalDirection()); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 06f7a566d0f47a4f3345f9348869e2bd841db2a7..d6fa58516e0301399d5ba4bfbe0256c5076414c0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -745,6 +745,11 @@ public class PurpurWorldConfig {
|
||||
cactusBreaksFromSolidNeighbors = getBoolean("blocks.cactus.breaks-from-solid-neighbors", cactusBreaksFromSolidNeighbors);
|
||||
}
|
||||
|
||||
+ public boolean campFireLitWhenPlaced = true;
|
||||
+ private void campFireSettings() {
|
||||
+ campFireLitWhenPlaced = getBoolean("blocks.campfire.lit-when-placed", campFireLitWhenPlaced);
|
||||
+ }
|
||||
+
|
||||
public boolean chestOpenWithBlockOnTop = false;
|
||||
private void chestSettings() {
|
||||
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||
@@ -1,71 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: granny <granny@pl3x.net>
|
||||
Date: Thu, 14 Oct 2021 02:05:52 -0700
|
||||
Subject: [PATCH] options to extinguish fire blocks with snowballs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
index d5d84893c77b4e60a19032d765d76bfd24cbbb2b..ef265cec066ef3b84c2b3a4929af518308a409c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
@@ -58,6 +58,36 @@ public class Snowball extends ThrowableItemProjectile {
|
||||
entity.hurt(DamageSource.thrown(this, this.getOwner()), (float)i);
|
||||
}
|
||||
|
||||
+ // Purpur start - 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 blockposition = blockHitResult.getBlockPos();
|
||||
+ net.minecraft.core.BlockPos blockposition1 = blockposition.relative(blockHitResult.getDirection());
|
||||
+
|
||||
+ net.minecraft.world.level.block.state.BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
+
|
||||
+ if (this.level.purpurConfig.snowballExtinguishesFire && this.level.getBlockState(blockposition1).is(net.minecraft.world.level.block.Blocks.FIRE)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ this.level.removeBlock(blockposition1, false);
|
||||
+ }
|
||||
+ } else if (this.level.purpurConfig.snowballExtinguishesCandles && net.minecraft.world.level.block.AbstractCandleBlock.isLit(iblockdata)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.setValue(net.minecraft.world.level.block.AbstractCandleBlock.LIT, false)).isCancelled()) {
|
||||
+ net.minecraft.world.level.block.AbstractCandleBlock.extinguish(null, iblockdata, this.level, blockposition);
|
||||
+ }
|
||||
+ } else if (this.level.purpurConfig.snowballExtinguishesCampfires && net.minecraft.world.level.block.CampfireBlock.isLitCampfire(iblockdata)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false)).isCancelled()) {
|
||||
+ this.level.levelEvent(null, 1009, blockposition, 0);
|
||||
+ net.minecraft.world.level.block.CampfireBlock.dowse(this.getOwner(), this.level, blockposition, iblockdata);
|
||||
+ this.level.setBlockAndUpdate(blockposition, iblockdata.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0ce648f03aaa9e3e56ae01c3b5e5da941f9da9af..f8d5d37afe4ce8f884b927447b0875f3b6e08171 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -223,6 +223,9 @@ public class PurpurWorldConfig {
|
||||
public int glowBerriesEatGlowDuration = 0;
|
||||
public boolean shulkerBoxItemDropContentsWhenDestroyed = true;
|
||||
public boolean compassItemShowsBossBar = false;
|
||||
+ public boolean snowballExtinguishesFire = false;
|
||||
+ public boolean snowballExtinguishesCandles = false;
|
||||
+ public boolean snowballExtinguishesCampfires = false;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -269,6 +272,9 @@ public class PurpurWorldConfig {
|
||||
glowBerriesEatGlowDuration = getInt("gameplay-mechanics.item.glow_berries.eat-glow-duration", glowBerriesEatGlowDuration);
|
||||
shulkerBoxItemDropContentsWhenDestroyed = getBoolean("gameplay-mechanics.item.shulker_box.drop-contents-when-destroyed", shulkerBoxItemDropContentsWhenDestroyed);
|
||||
compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
|
||||
+ snowballExtinguishesFire = getBoolean("gameplay-mechanics.item.snowball.extinguish.fire", snowballExtinguishesFire);
|
||||
+ snowballExtinguishesCandles = getBoolean("gameplay-mechanics.item.snowball.extinguish.candles", snowballExtinguishesCandles);
|
||||
+ snowballExtinguishesCampfires = getBoolean("gameplay-mechanics.item.snowball.extinguish.campfires", snowballExtinguishesCampfires);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: rafael59r2 <12960698+rafael59r2@users.noreply.github.com>
|
||||
Date: Tue, 19 Oct 2021 13:10:44 +0100
|
||||
Subject: [PATCH] Add option to disable zombie villagers cure
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index 6c559f78cc7eab34d6109c1926067720d964d42c..2ed3df59dbbb811a1b2c13c4a6eff9c602371149 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -212,7 +212,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
ItemStack itemstack = player.getItemInHand(hand);
|
||||
|
||||
if (itemstack.is(Items.GOLDEN_APPLE)) {
|
||||
- if (this.hasEffect(MobEffects.WEAKNESS)) {
|
||||
+ if (this.hasEffect(MobEffects.WEAKNESS) && level.purpurConfig.zombieVillagerCureEnabled) { // Purpur
|
||||
if (!player.getAbilities().instabuild) {
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 21a4f4e4ddf8d9b27df012192db11344dfd44752..f1d8ddc36abfd278cc7d956f5fe980e0d1bcafeb 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2733,6 +2733,7 @@ public class PurpurWorldConfig {
|
||||
public boolean zombieVillagerTakeDamageFromWater = false;
|
||||
public int zombieVillagerCuringTimeMin = 3600;
|
||||
public int zombieVillagerCuringTimeMax = 6000;
|
||||
+ public boolean zombieVillagerCureEnabled = true;
|
||||
private void zombieVillagerSettings() {
|
||||
zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable);
|
||||
zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater);
|
||||
@@ -2750,6 +2751,7 @@ public class PurpurWorldConfig {
|
||||
zombieVillagerTakeDamageFromWater = getBoolean("mobs.zombie_villager.takes-damage-from-water", zombieVillagerTakeDamageFromWater);
|
||||
zombieVillagerCuringTimeMin = getInt("mobs.zombie_villager.curing_time.min", zombieVillagerCuringTimeMin);
|
||||
zombieVillagerCuringTimeMax = getInt("mobs.zombie_villager.curing_time.max", zombieVillagerCuringTimeMax);
|
||||
+ zombieVillagerCureEnabled = getBoolean("mobs.zombie_villager.cure.enabled", zombieVillagerCureEnabled);
|
||||
}
|
||||
|
||||
public boolean zombifiedPiglinRidable = false;
|
||||
@@ -1,220 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Wed, 30 Sep 2020 14:32:46 -0700
|
||||
Subject: [PATCH] Persistent BlockEntity Lore and DisplayName
|
||||
|
||||
Makes it so that when a BlockEntity is placed in the world and then broken,
|
||||
the dropped ItemStack retains any original custom display name/lore.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 8a5f6d955577a8f8a63a846169a63fe9685b6321..eb595d1b6ef59ca18ce1c3c3ccd2aa05242ebe65 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -151,7 +151,24 @@ public class BlockItem extends Item {
|
||||
}
|
||||
|
||||
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) {
|
||||
- return BlockItem.updateCustomBlockEntityTag(world, player, pos, stack);
|
||||
+ // Purpur start
|
||||
+ boolean handled = updateCustomBlockEntityTag(world, player, pos, stack);
|
||||
+ if (world.purpurConfig.persistentTileEntityDisplayNames && stack.hasTag()) {
|
||||
+ CompoundTag display = stack.getTagElement("display");
|
||||
+ if (display != null) {
|
||||
+ BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
+ if (blockEntity != null) {
|
||||
+ if (display.contains("Name", 8)) {
|
||||
+ blockEntity.setPersistentDisplayName(display.getString("Name"));
|
||||
+ }
|
||||
+ if (display.contains("Lore", 9)) {
|
||||
+ blockEntity.setPersistentLore(display.getList("Lore", 8));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return handled;
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 5dede264fc3cb045b6330e35123b5b416c1b1f56..10fa3a544d01ce3cdb72e72952073d86913bd65b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -20,6 +20,9 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IdMapper;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.Registry;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.ListTag;
|
||||
+import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
@@ -27,6 +30,7 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
+import net.minecraft.world.Nameable;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
@@ -325,7 +329,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
|
||||
if (world instanceof ServerLevel) {
|
||||
Block.getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> {
|
||||
- Block.popResource((ServerLevel) world, pos, itemstack);
|
||||
+ Block.popResource((ServerLevel) world, pos, applyDisplayNameAndLoreFromTile(itemstack, blockEntity)); // Purpur
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY);
|
||||
}
|
||||
@@ -341,7 +345,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
io.papermc.paper.event.block.BlockBreakBlockEvent event = new io.papermc.paper.event.block.BlockBreakBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.block.CraftBlock.at(world, source), items);
|
||||
event.callEvent();
|
||||
for (var drop : event.getDrops()) {
|
||||
- popResource(world.getMinecraftWorld(), pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(drop));
|
||||
+ popResource(world.getMinecraftWorld(), pos, applyDisplayNameAndLoreFromTile(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(drop), blockEntity)); // Purpur
|
||||
}
|
||||
state.spawnAfterBreak(world.getMinecraftWorld(), pos, ItemStack.EMPTY);
|
||||
}
|
||||
@@ -352,13 +356,53 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
|
||||
if (world instanceof ServerLevel) {
|
||||
Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack).forEach((itemstack1) -> {
|
||||
- Block.popResource(world, pos, itemstack1);
|
||||
+ Block.popResource(world, pos, applyDisplayNameAndLoreFromTile(itemstack1, blockEntity)); // Purpur
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ private static ItemStack applyDisplayNameAndLoreFromTile(ItemStack stack, BlockEntity blockEntity) {
|
||||
+ if (stack.getItem() instanceof BlockItem) {
|
||||
+ if (blockEntity != null && blockEntity.getLevel() instanceof ServerLevel && blockEntity.getLevel().purpurConfig.persistentTileEntityDisplayNames) {
|
||||
+ String name = blockEntity.getPersistentDisplayName();
|
||||
+ ListTag lore = blockEntity.getPersistentLore();
|
||||
+ if (blockEntity instanceof Nameable) {
|
||||
+ Nameable namedTile = (Nameable) blockEntity;
|
||||
+ if (namedTile.hasCustomName()) {
|
||||
+ name = Component.Serializer.toJson(namedTile.getCustomName());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (name != null || lore != null) {
|
||||
+ CompoundTag display = stack.getTagElement("display");
|
||||
+ if (display == null) {
|
||||
+ display = new CompoundTag();
|
||||
+ }
|
||||
+
|
||||
+ if (name != null) {
|
||||
+ display.put("Name", StringTag.valueOf(name));
|
||||
+ }
|
||||
+ if (lore != null) {
|
||||
+ display.put("Lore", lore);
|
||||
+ }
|
||||
+
|
||||
+ CompoundTag tag = stack.getTag();
|
||||
+ if (tag == null) {
|
||||
+ tag = new CompoundTag();
|
||||
+ }
|
||||
+ tag.put("display", display);
|
||||
+
|
||||
+ stack.setTag(tag);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return stack;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public static void popResource(Level world, BlockPos pos, ItemStack stack) {
|
||||
float f = EntityType.ITEM.getHeight() / 2.0F;
|
||||
// Paper start - don't convert potentially massive numbers to floats
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index b96d57b0bcf21508f8e03e96b7553eb486fdf212..d3de829a4ab5f5a127fb026a8cb4ef4ed6b9c394 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -6,6 +6,8 @@ import net.minecraft.CrashReportCategory;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.ListTag;
|
||||
+import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -74,10 +76,27 @@ public abstract class BlockEntity {
|
||||
if (persistentDataTag instanceof CompoundTag) {
|
||||
this.persistentDataContainer.putAll((CompoundTag) persistentDataTag);
|
||||
}
|
||||
+ // Purpur start
|
||||
+ if (nbt.contains("Purpur.persistentDisplayName")) {
|
||||
+ this.persistentDisplayName = nbt.getString("Purpur.persistentDisplayName");
|
||||
+ }
|
||||
+ if (nbt.contains("Purpur.persistentLore")) {
|
||||
+ this.persistentLore = nbt.getList("Purpur.persistentLore", 8);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
- protected void saveAdditional(CompoundTag nbt) {}
|
||||
+ protected void saveAdditional(CompoundTag nbt) {
|
||||
+ // Purpur start
|
||||
+ if (this.persistentDisplayName != null) {
|
||||
+ nbt.put("Purpur.persistentDisplayName", StringTag.valueOf(this.persistentDisplayName));
|
||||
+ }
|
||||
+ if (this.persistentLore != null) {
|
||||
+ nbt.put("Purpur.persistentLore", this.persistentLore);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+ }
|
||||
|
||||
public final CompoundTag saveWithFullMetadata() {
|
||||
CompoundTag nbttagcompound = this.saveWithoutMetadata();
|
||||
@@ -264,4 +283,24 @@ public abstract class BlockEntity {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Purpur start
|
||||
+ private String persistentDisplayName = null;
|
||||
+ private ListTag persistentLore = null;
|
||||
+
|
||||
+ public void setPersistentDisplayName(String json) {
|
||||
+ this.persistentDisplayName = json;
|
||||
+ }
|
||||
+
|
||||
+ public void setPersistentLore(ListTag lore) {
|
||||
+ this.persistentLore = lore;
|
||||
+ }
|
||||
+
|
||||
+ public String getPersistentDisplayName() {
|
||||
+ return this.persistentDisplayName;
|
||||
+ }
|
||||
+
|
||||
+ public ListTag getPersistentLore() {
|
||||
+ return this.persistentLore;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index e953cba9d472ade2261011b8e5f8f340ca0c3b4e..90d31d52f7b2c8933c6703ab6d621b48ef801df0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -124,6 +124,7 @@ public class PurpurWorldConfig {
|
||||
public boolean milkCuresBadOmen = true;
|
||||
public boolean noteBlockIgnoreAbove = false;
|
||||
public boolean persistentDroppableEntityDisplayNames = false;
|
||||
+ public boolean persistentTileEntityDisplayNames = false;
|
||||
public boolean projectilesBypassMobGriefing = false;
|
||||
public boolean tickFluids = true;
|
||||
public double mobsBlindnessMultiplier = 1;
|
||||
@@ -147,6 +148,7 @@ public class PurpurWorldConfig {
|
||||
imposeTeleportRestrictionsOnGateways = getBoolean("gameplay-mechanics.impose-teleport-restrictions-on-gateways", imposeTeleportRestrictionsOnGateways);
|
||||
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
||||
noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
|
||||
+ persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
|
||||
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
|
||||
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
||||
tickFluids = getBoolean("gameplay-mechanics.tick-fluids", tickFluids);
|
||||
@@ -1,86 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 6 Jun 2019 17:40:30 -0500
|
||||
Subject: [PATCH] Signs allow color codes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 0a345562354dc3f1e1366da96149d204a95f6fbc..b717dad7145eeb7b4d1f6870779c1df9dea3261a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1501,6 +1501,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void openTextEdit(SignBlockEntity sign) {
|
||||
+ if (level.purpurConfig.signAllowColors) this.connection.send(sign.getTranslatedUpdatePacket(textFilteringEnabled)); // Purpur
|
||||
sign.setAllowedPlayerEditor(this.getUUID());
|
||||
this.connection.send(new ClientboundBlockUpdatePacket(this.level, sign.getBlockPos()));
|
||||
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 44581f275fb2133e96599af6460ff5e841b7aa88..5d930933dd3fdca91374eba8991275faebd86935 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3195,11 +3195,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- if (this.player.isTextFilteringEnabled()) {
|
||||
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
|
||||
- } else {
|
||||
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw())));
|
||||
- }
|
||||
+ String line = SharedConstants.filterText(this.player.isTextFilteringEnabled() ? currentLine.getFiltered() : currentLine.getRaw());
|
||||
+ if (worldserver.purpurConfig.signAllowColors) {
|
||||
+ if (player.hasPermission("purpur.sign.color")) line = line.replaceAll("(?i)&([0-9a-fr])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.style")) line = line.replaceAll("(?i)&([l-or])", "\u00a7$1");
|
||||
+ if (player.hasPermission("purpur.sign.magic")) line = line.replaceAll("(?i)&([kr])", "\u00a7$1");
|
||||
+ lines.add(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(line));
|
||||
+ } else
|
||||
+ lines.add(net.kyori.adventure.text.Component.text(line));
|
||||
+ // Purpur end
|
||||
}
|
||||
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
index d5bcc81a809e3c733c6fc11309bcf0913860edf6..1846aeffc9ad24405ddce0e727552fa6df6e3997 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
@@ -186,6 +186,23 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
return ClientboundBlockEntityDataPacket.create(this);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public ClientboundBlockEntityDataPacket getTranslatedUpdatePacket(boolean filtered) {
|
||||
+ final CompoundTag nbt = new CompoundTag();
|
||||
+ this.saveAdditional(nbt);
|
||||
+ final Component[] lines = getMessages(filtered);
|
||||
+ for (int i = 0; i < 4; i++) {
|
||||
+ final var component = io.papermc.paper.adventure.PaperAdventure.asAdventure(lines[i]);
|
||||
+ final String line = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().serialize(component);
|
||||
+ final var text = net.kyori.adventure.text.Component.text(line);
|
||||
+ final String json = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(text);
|
||||
+ nbt.putString("Text" + (i + 1), json);
|
||||
+ }
|
||||
+ nbt.putString("PurpurEditor", "true");
|
||||
+ return ClientboundBlockEntityDataPacket.create(this, entity -> nbt);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public CompoundTag getUpdateTag() {
|
||||
return this.saveWithoutMetadata();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 90d31d52f7b2c8933c6703ab6d621b48ef801df0..52d451bec22ad9667ec736715131030df75a022a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -924,8 +924,10 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean signRightClickEdit = false;
|
||||
+ public boolean signAllowColors = false;
|
||||
private void signSettings() {
|
||||
signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
||||
+ signAllowColors = getBoolean("blocks.sign.allow-colors", signAllowColors);
|
||||
}
|
||||
|
||||
public boolean slabHalfBreak = false;
|
||||
@@ -1,199 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 22 Nov 2020 20:13:27 -0600
|
||||
Subject: [PATCH] Kelp weeping and twisting vines configurable max growth age
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
||||
index effee89e308c9a663938ac5b00a8c6512ce407c2..702f1b804df86e7df497ba65e0c51f05d3491860 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
||||
@@ -88,4 +88,11 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
|
||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
||||
world.setBlock(pos, (BlockState) state.setValue(CaveVinesBlock.BERRIES, true), 2);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ return world.purpurConfig.caveVinesMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
||||
index 8e642ff6d387e05f900acfc3cf6cfa5975bf69e4..c17bfbd26ad70010ca6c3553970b3fdbf704d1b7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
||||
@@ -38,6 +38,8 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
||||
return (Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25;
|
||||
}
|
||||
|
||||
+ public abstract int getMaxGrowthAge(ServerLevel world); // Purpur
|
||||
+
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
// Paper start
|
||||
@@ -53,7 +55,7 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
||||
} else {
|
||||
modifier = 100; // Above cases are exhaustive as of 1.18
|
||||
}
|
||||
- if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (modifier / 100.0D) * this.growPerTickProbability) { // Spigot // Paper - fix growth modifier having the reverse effect
|
||||
+ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < getMaxGrowthAge(world) && random.nextDouble() < (modifier / 100.0D) * this.growPerTickProbability) { // Spigot // Paper - fix growth modifier having the reverse effect // Purpur
|
||||
// Paper end
|
||||
BlockPos blockposition1 = pos.relative(this.growthDirection);
|
||||
|
||||
@@ -121,13 +123,13 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
||||
BlockPos blockposition1 = pos.relative(this.growthDirection);
|
||||
- int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, 25);
|
||||
+ int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, getMaxGrowthAge(world));
|
||||
int j = this.getBlocksToGrowWhenBonemealed(random);
|
||||
|
||||
for (int k = 0; k < j && this.canGrowInto(world.getBlockState(blockposition1)); ++k) {
|
||||
world.setBlockAndUpdate(blockposition1, (BlockState) state.setValue(GrowingPlantHeadBlock.AGE, i));
|
||||
blockposition1 = blockposition1.relative(this.growthDirection);
|
||||
- i = Math.min(i + 1, 25);
|
||||
+ i = Math.min(i + 1, getMaxGrowthAge(world));
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/KelpBlock.java b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
|
||||
index 2bd5db55656c9ace95ad5ffdc4a6d07daa0948e4..9ddd25648c70ec1608609f4a63f4df53805c8732 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/KelpBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
|
||||
@@ -4,6 +4,7 @@ import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
@@ -64,4 +65,11 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getSource(false);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ return world.purpurConfig.kelpMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
|
||||
index bc9813ad36d95d90eafe51afa27857937b6eecc6..23f4663cb3760097b464ee310682bd6f1bfae580 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
@@ -27,4 +28,11 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock {
|
||||
protected boolean canGrowInto(BlockState state) {
|
||||
return NetherVines.isValidGrowthState(state);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ return world.purpurConfig.twistingVinesMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
|
||||
index 35b2bad76c45b5a94ba7f2e9c7a8cfeb8c3f498b..913818656f058990270ed1e4303da1c45bd70c8d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
@@ -27,4 +28,11 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock {
|
||||
protected boolean canGrowInto(BlockState state) {
|
||||
return NetherVines.isValidGrowthState(state);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public int getMaxGrowthAge(ServerLevel world) {
|
||||
+ return world.purpurConfig.weepingVinesMaxGrowthAge;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 9f3e5b797bbb00035093915a8a6277b3be4fb9b8..193b88dfce1b6db8687ce4552bb6cd26fdee23f0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -768,6 +768,11 @@ public class PurpurWorldConfig {
|
||||
composterBulkProcess = getBoolean("blocks.composter.sneak-to-bulk-process", composterBulkProcess);
|
||||
}
|
||||
|
||||
+ public int caveVinesMaxGrowthAge = 25;
|
||||
+ private void caveVinesSettings() {
|
||||
+ caveVinesMaxGrowthAge = getInt("blocks.cave_vines.max-growth-age", caveVinesMaxGrowthAge);
|
||||
+ }
|
||||
+
|
||||
public boolean dispenserApplyCursedArmor = true;
|
||||
public boolean dispenserPlaceAnvils = false;
|
||||
private void dispenserSettings() {
|
||||
@@ -864,6 +869,16 @@ public class PurpurWorldConfig {
|
||||
mobsSpawnOnBlueIce = getBoolean("blocks.blue_ice.allow-mob-spawns", mobsSpawnOnBlueIce);
|
||||
}
|
||||
|
||||
+ public int kelpMaxGrowthAge = 25;
|
||||
+ private void kelpSettings() {
|
||||
+ kelpMaxGrowthAge = getInt("blocks.kelp.max-growth-age", kelpMaxGrowthAge);
|
||||
+ if (kelpMaxGrowthAge > 25) {
|
||||
+ kelpMaxGrowthAge = 25;
|
||||
+ log(Level.WARNING, "blocks.kelp.max-growth-age is set to above maximum allowed value of 25");
|
||||
+ log(Level.WARNING, "Using value of 25 anyway to prevent issues");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean lavaInfinite = false;
|
||||
public int lavaInfiniteRequiredSources = 2;
|
||||
public int lavaSpeedNether = 10;
|
||||
@@ -965,6 +980,16 @@ public class PurpurWorldConfig {
|
||||
turtleEggsBypassMobGriefing = getBoolean("blocks.turtle_egg.bypass-mob-griefing", turtleEggsBypassMobGriefing);
|
||||
}
|
||||
|
||||
+ public int twistingVinesMaxGrowthAge = 25;
|
||||
+ private void twistingVinesSettings() {
|
||||
+ twistingVinesMaxGrowthAge = getInt("blocks.twisting_vines.max-growth-age", twistingVinesMaxGrowthAge);
|
||||
+ if (twistingVinesMaxGrowthAge > 25) {
|
||||
+ twistingVinesMaxGrowthAge = 25;
|
||||
+ log(Level.WARNING, "blocks.twisting_vines.max-growth-age is set to above maximum allowed value of 25");
|
||||
+ log(Level.WARNING, "Using value of 25 anyway to prevent issues");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean waterInfinite = true;
|
||||
public int waterInfiniteRequiredSources = 2;
|
||||
private void waterSources() {
|
||||
@@ -972,6 +997,16 @@ public class PurpurWorldConfig {
|
||||
waterInfiniteRequiredSources = getInt("blocks.water.infinite-required-sources", waterInfiniteRequiredSources);
|
||||
}
|
||||
|
||||
+ public int weepingVinesMaxGrowthAge = 25;
|
||||
+ private void weepingVinesSettings() {
|
||||
+ weepingVinesMaxGrowthAge = getInt("blocks.weeping_vines.max-growth-age", weepingVinesMaxGrowthAge);
|
||||
+ if (weepingVinesMaxGrowthAge > 25) {
|
||||
+ weepingVinesMaxGrowthAge = 25;
|
||||
+ log(Level.WARNING, "blocks.weeping_vines.max-growth-age is set to above maximum allowed value of 25");
|
||||
+ log(Level.WARNING, "Using value of 25 anyway to prevent issues");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean babiesAreRidable = true;
|
||||
public boolean untamedTamablesAreRidable = true;
|
||||
public boolean useNightVisionWhenRiding = false;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,298 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Racci <tangentmoons@gmail.com>
|
||||
Date: Sat, 4 Dec 2021 00:07:05 +1100
|
||||
Subject: [PATCH] Potion NamespacedKey
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
index b84610d00f710c656d9eaf85b80e796f8be4bca3..390a70b9d9aa40a2511ab6588df2833a34682e5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
@@ -6,6 +6,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.slf4j.Logger;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
|
||||
public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -17,6 +18,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
private boolean visible;
|
||||
private boolean showIcon;
|
||||
@Nullable
|
||||
+ private NamespacedKey key; // Purpur - add key
|
||||
private MobEffectInstance hiddenEffect;
|
||||
|
||||
public MobEffectInstance(MobEffect type) {
|
||||
@@ -40,12 +42,27 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
}
|
||||
|
||||
public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect) {
|
||||
+ // Purpur start
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, (NamespacedKey)null, hiddenEffect);
|
||||
+ }
|
||||
+
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, @Nullable NamespacedKey key) {
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showParticles, key, (MobEffectInstance)null);
|
||||
+ }
|
||||
+
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable NamespacedKey key) {
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, key, (MobEffectInstance)null);
|
||||
+ }
|
||||
+
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable NamespacedKey key, @Nullable MobEffectInstance hiddenEffect) { // Purpur - add key
|
||||
+ // Purpur end
|
||||
this.effect = type;
|
||||
this.duration = duration;
|
||||
this.amplifier = amplifier;
|
||||
this.ambient = ambient;
|
||||
this.visible = showParticles;
|
||||
this.showIcon = showIcon;
|
||||
+ this.key = key; // Purpur - add key
|
||||
this.hiddenEffect = hiddenEffect;
|
||||
}
|
||||
|
||||
@@ -60,6 +77,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
this.ambient = that.ambient;
|
||||
this.visible = that.visible;
|
||||
this.showIcon = that.showIcon;
|
||||
+ this.key = that.key; // Purpur - add key
|
||||
}
|
||||
|
||||
public boolean update(MobEffectInstance that) {
|
||||
@@ -104,6 +122,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
bl = true;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (that.key != this.key) {
|
||||
+ this.key = that.key;
|
||||
+ bl = true;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return bl;
|
||||
}
|
||||
|
||||
@@ -131,6 +156,17 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
return this.showIcon;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public boolean hasKey() {
|
||||
+ return this.key != null;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public NamespacedKey getKey() {
|
||||
+ return this.key;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public boolean tick(LivingEntity entity, Runnable overwriteCallback) {
|
||||
if (this.duration > 0) {
|
||||
if (this.effect.isDurationEffectTick(this.duration, this.amplifier)) {
|
||||
@@ -184,6 +220,12 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
string = string + ", Show Icon: false";
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (this.hasKey()) {
|
||||
+ string = string + ", Key: " + this.key;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -195,7 +237,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
return false;
|
||||
} else {
|
||||
MobEffectInstance mobEffectInstance = (MobEffectInstance)object;
|
||||
- return this.duration == mobEffectInstance.duration && this.amplifier == mobEffectInstance.amplifier && this.ambient == mobEffectInstance.ambient && this.effect.equals(mobEffectInstance.effect);
|
||||
+ return this.duration == mobEffectInstance.duration && this.amplifier == mobEffectInstance.amplifier && this.ambient == mobEffectInstance.ambient && this.effect.equals(mobEffectInstance.effect) && this.key == mobEffectInstance.key; // Purpur - add key
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +261,11 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
nbt.putBoolean("Ambient", this.isAmbient());
|
||||
nbt.putBoolean("ShowParticles", this.isVisible());
|
||||
nbt.putBoolean("ShowIcon", this.showIcon());
|
||||
+ // Purpur start
|
||||
+ if (this.key != null) {
|
||||
+ nbt.putString("Key", this.key.toString());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
if (this.hiddenEffect != null) {
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
this.hiddenEffect.save(compoundTag);
|
||||
@@ -248,12 +295,19 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
bl3 = nbt.getBoolean("ShowIcon");
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ NamespacedKey key = null;
|
||||
+ if (nbt.contains("Key")) {
|
||||
+ key = NamespacedKey.fromString(nbt.getString("Key"));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
MobEffectInstance mobEffectInstance = null;
|
||||
if (nbt.contains("HiddenEffect", 10)) {
|
||||
mobEffectInstance = loadSpecifiedEffect(type, nbt.getCompound("HiddenEffect"));
|
||||
}
|
||||
|
||||
- return new MobEffectInstance(type, j, i < 0 ? 0 : i, bl, bl2, bl3, mobEffectInstance);
|
||||
+ return new MobEffectInstance(type, j, i < 0 ? 0 : i, bl, bl2, bl3, key, mobEffectInstance); // Purpur - add key
|
||||
}
|
||||
|
||||
public void setNoCounter(boolean permanent) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index ab5d668cf295d84663ced382cbde8dc940176470..7534889c4169cbd26f7e778cbd3be49bd2640c83 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -436,7 +436,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
|
||||
@Override
|
||||
public boolean addPotionEffect(PotionEffect effect, boolean force) {
|
||||
- this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
|
||||
+ this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey()), EntityPotionEffectEvent.Cause.PLUGIN); // Purpur - add key // Paper - Don't ignore icon
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@Override
|
||||
public PotionEffect getPotionEffect(PotionEffectType type) {
|
||||
MobEffectInstance handle = this.getHandle().getEffect(MobEffect.byId(type.getId()));
|
||||
- return (handle == null) ? null : new PotionEffect(PotionEffectType.getById(MobEffect.getId(handle.getEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
|
||||
+ return (handle == null) ? null : new PotionEffect(PotionEffectType.getById(MobEffect.getId(handle.getEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible(), handle.getKey()); // Purpur - add key
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -469,7 +469,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public Collection<PotionEffect> getActivePotionEffects() {
|
||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||
for (MobEffectInstance handle : this.getHandle().activeEffects.values()) {
|
||||
- effects.add(new PotionEffect(PotionEffectType.getById(MobEffect.getId(handle.getEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
|
||||
+ effects.add(new PotionEffect(PotionEffectType.getById(MobEffect.getId(handle.getEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible(), handle.getKey())); // Purpur - add key
|
||||
}
|
||||
return effects;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
|
||||
index 4d325f61e9171b9e1a069ae69a87ec397735da79..056de387d0971f0b994e562c0b638442875b3a71 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.nbt.ListTag;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.craftbukkit.inventory.CraftMetaItem.ItemMetaKey;
|
||||
import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta;
|
||||
@@ -33,6 +34,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
static final ItemMetaKey POTION_COLOR = new ItemMetaKey("CustomPotionColor", "custom-color");
|
||||
static final ItemMetaKey ID = new ItemMetaKey("Id", "potion-id");
|
||||
static final ItemMetaKey DEFAULT_POTION = new ItemMetaKey("Potion", "potion-type");
|
||||
+ static final ItemMetaKey KEY = new ItemMetaKey("Key", "namespacedkey"); // Purpur - add key
|
||||
|
||||
// Having an initial "state" in ItemMeta seems bit dirty but the UNCRAFTABLE potion type
|
||||
// is treated as the empty form of the meta because it represents an empty potion with no effect
|
||||
@@ -83,7 +85,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
boolean ambient = effect.getBoolean(AMBIENT.NBT);
|
||||
boolean particles = tag.contains(SHOW_PARTICLES.NBT, CraftMagicNumbers.NBT.TAG_BYTE) ? effect.getBoolean(SHOW_PARTICLES.NBT) : true;
|
||||
boolean icon = tag.contains(SHOW_ICON.NBT, CraftMagicNumbers.NBT.TAG_BYTE) ? effect.getBoolean(SHOW_ICON.NBT) : particles;
|
||||
- this.customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon));
|
||||
+ // Purpur start
|
||||
+ NamespacedKey key = null;
|
||||
+ if (tag.contains(KEY.NBT)) {
|
||||
+ key = NamespacedKey.fromString(effect.getString(KEY.NBT));
|
||||
+ }
|
||||
+ this.customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon, key));
|
||||
+ // Purpur end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +140,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
effectData.putBoolean(AMBIENT.NBT, effect.isAmbient());
|
||||
effectData.putBoolean(SHOW_PARTICLES.NBT, effect.hasParticles());
|
||||
effectData.putBoolean(SHOW_ICON.NBT, effect.hasIcon());
|
||||
+ // Purpur start
|
||||
+ if (effect.hasKey()) {
|
||||
+ effectData.putString(KEY.NBT, effect.getKey().toString());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
effectList.add(effectData);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +214,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
if (index != -1) {
|
||||
if (overwrite) {
|
||||
PotionEffect old = this.customEffects.get(index);
|
||||
- if (old.getAmplifier() == effect.getAmplifier() && old.getDuration() == effect.getDuration() && old.isAmbient() == effect.isAmbient()) {
|
||||
+ if (old.getAmplifier() == effect.getAmplifier() && old.getDuration() == effect.getDuration() && old.isAmbient() == effect.isAmbient() && old.getKey() == effect.getKey()) { // Purpur - add key
|
||||
return false;
|
||||
}
|
||||
this.customEffects.set(index, effect);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
index acb69821a99aa69bce6d127e10976089c85be223..c5abd73981c5f4b41605eba0d44e6573dfd2a77a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
@@ -101,7 +101,7 @@ public class CraftPotionUtil {
|
||||
|
||||
public static MobEffectInstance fromBukkit(PotionEffect effect) {
|
||||
MobEffect type = MobEffect.byId(effect.getType().getId());
|
||||
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
|
||||
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.getKey()); // Purpur - add key
|
||||
}
|
||||
|
||||
public static PotionEffect toBukkit(MobEffectInstance effect) {
|
||||
@@ -110,7 +110,7 @@ public class CraftPotionUtil {
|
||||
int duration = effect.getDuration();
|
||||
boolean ambient = effect.isAmbient();
|
||||
boolean particles = effect.isVisible();
|
||||
- return new PotionEffect(type, duration, amp, ambient, particles);
|
||||
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.getKey()); // Purpur - add key
|
||||
}
|
||||
|
||||
public static boolean equals(MobEffect mobEffect, PotionEffectType type) {
|
||||
diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java
|
||||
index 7ea3cc4f8e35b61b3eba717ed58ee98cf835168c..48aa077ab2e2b708fb3d3287e636b4dc1c969925 100644
|
||||
--- a/src/test/java/org/bukkit/potion/PotionTest.java
|
||||
+++ b/src/test/java/org/bukkit/potion/PotionTest.java
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -47,4 +48,27 @@ public class PotionTest extends AbstractTestingBase {
|
||||
assertEquals("Same type not returned by name " + key, bukkit, byName);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Test
|
||||
+ public void testNamespacedKey() {
|
||||
+ NamespacedKey key = new NamespacedKey("testnamespace", "testkey");
|
||||
+ PotionEffect namedSpacedEffect = new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 20, 0, true, true, true, key);
|
||||
+ assertNotNull(namedSpacedEffect.getKey());
|
||||
+ assertTrue(namedSpacedEffect.hasKey());
|
||||
+ assertFalse(namedSpacedEffect.withKey(null).hasKey());
|
||||
+
|
||||
+ PotionEffect effect = new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 20, 0, true, true, true);
|
||||
+ assertNull(effect.getKey());
|
||||
+ assertFalse(effect.hasKey());
|
||||
+ assertTrue(namedSpacedEffect.withKey(key).hasKey());
|
||||
+
|
||||
+ Map<String, Object> s1 = namedSpacedEffect.serialize();
|
||||
+ Map<String, Object> s2 = effect.serialize();
|
||||
+ assertTrue(s1.containsKey("namespacedKey"));
|
||||
+ assertFalse(s2.containsKey("namespacedKey"));
|
||||
+ assertNotNull(new PotionEffect(s1).getKey());
|
||||
+ assertNull(new PotionEffect(s2).getKey());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 27 Dec 2021 08:11:00 -0600
|
||||
Subject: [PATCH] Grindstone API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 66d1b438227e004d7ffb6e7c5d0cd3e6da3d2a49..a884b00d3ebd5cd89bd870b84afea136bdc79a10 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -96,8 +96,9 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public void onTake(net.minecraft.world.entity.player.Player player, ItemStack stack) {
|
||||
context.execute((world, blockposition) -> {
|
||||
+ org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent grindstoneTakeResultEvent = new org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent(player.getBukkitEntity(), getBukkitView(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), this.getExperienceAmount(world)); grindstoneTakeResultEvent.callEvent(); // Purpur
|
||||
if (world instanceof ServerLevel) {
|
||||
- ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf(blockposition), this.getExperienceAmount(world), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Paper
|
||||
+ ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf(blockposition), grindstoneTakeResultEvent.getExperienceAmount(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Paper // Purpur
|
||||
}
|
||||
|
||||
world.levelEvent(1042, blockposition, 0);
|
||||
@@ -1,60 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 28 Dec 2021 10:11:31 -0600
|
||||
Subject: [PATCH] Option to prevent spiders from climbing world border
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2c60091945aa3510d34c21b31827cb0b7f302ec2..7c82a0a596357ce118918fb5b86a0c13dea9e0ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -243,6 +243,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean verticalCollision;
|
||||
public boolean verticalCollisionBelow;
|
||||
public boolean minorHorizontalCollision;
|
||||
+ public boolean collidingWithWorldBorder; // Purpur
|
||||
public boolean hurtMarked;
|
||||
protected Vec3 stuckSpeedMultiplier;
|
||||
@Nullable
|
||||
@@ -1341,7 +1342,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, false, true,
|
||||
false, false, null, null);
|
||||
|
||||
- if (io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) {
|
||||
+ if (this.collidingWithWorldBorder = io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) { // Purpur
|
||||
io.papermc.paper.util.CollisionUtil.addBoxesToIfIntersects(world.getWorldBorder().getCollisionShape(), collisionBox, potentialCollisions);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
index 177f9fe0d0a10e5d3644805751f2050fe984fde7..07dc3b10a275895f23fcf50720ef25faea358c58 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
@@ -118,7 +118,7 @@ public class Spider extends Monster {
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!this.level.isClientSide) {
|
||||
- this.setClimbing(this.horizontalCollision);
|
||||
+ this.setClimbing(this.horizontalCollision && (this.level.purpurConfig.spiderCanClimbWorldBorder || !this.collidingWithWorldBorder)); // Purpur
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index d28424cc74068904f0a3479789307f9529b03efa..b7edb6045624efa24929ab3d3b583b5237e7015c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2462,6 +2462,7 @@ public class PurpurWorldConfig {
|
||||
public double spiderMaxHealth = 16.0D;
|
||||
public boolean spiderTakeDamageFromWater = false;
|
||||
public boolean spiderAlwaysDropExp = false;
|
||||
+ public boolean spiderCanClimbWorldBorder = true;
|
||||
private void spiderSettings() {
|
||||
spiderRidable = getBoolean("mobs.spider.ridable", spiderRidable);
|
||||
spiderRidableInWater = getBoolean("mobs.spider.ridable-in-water", spiderRidableInWater);
|
||||
@@ -2474,6 +2475,7 @@ public class PurpurWorldConfig {
|
||||
spiderMaxHealth = getDouble("mobs.spider.attributes.max_health", spiderMaxHealth);
|
||||
spiderTakeDamageFromWater = getBoolean("mobs.spider.takes-damage-from-water", spiderTakeDamageFromWater);
|
||||
spiderAlwaysDropExp = getBoolean("mobs.spider.always-drop-exp", spiderAlwaysDropExp);
|
||||
+ spiderCanClimbWorldBorder = getBoolean("mobs.spider.can-climb-world-border", spiderCanClimbWorldBorder);
|
||||
}
|
||||
|
||||
public boolean strayRidable = false;
|
||||
@@ -1,97 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 28 Dec 2021 16:22:20 -0600
|
||||
Subject: [PATCH] Ability for hoe to replant crops and nether warts
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java
|
||||
index 03fde6e47c4a347c62fe9b4a3351769aedf874f6..3eb95e9b4870b7dd782f676f50e381bf15f143dc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BushBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BushBlock.java
|
||||
@@ -48,4 +48,24 @@ public class BushBlock extends Block {
|
||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
|
||||
return type == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(state, world, pos, type);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public void playerDestroyAndReplant(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, @javax.annotation.Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.world.item.ItemStack itemInHand, net.minecraft.world.level.ItemLike itemToReplant) {
|
||||
+ player.awardStat(net.minecraft.stats.Stats.BLOCK_MINED.get(this));
|
||||
+ player.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED);
|
||||
+ java.util.List<net.minecraft.world.item.ItemStack> dropList = Block.getDrops(state, (net.minecraft.server.level.ServerLevel) world, pos, blockEntity, player, itemInHand);
|
||||
+
|
||||
+ boolean planted = false;
|
||||
+ for (net.minecraft.world.item.ItemStack itemToDrop : dropList) {
|
||||
+ if (!planted && itemToDrop.getItem() == itemToReplant) {
|
||||
+ world.setBlock(pos, defaultBlockState(), 3);
|
||||
+ itemToDrop.setCount(itemToDrop.getCount() - 1);
|
||||
+ planted = true;
|
||||
+ }
|
||||
+ Block.popResource(world, pos, itemToDrop);
|
||||
+ }
|
||||
+
|
||||
+ state.spawnAfterBreak((net.minecraft.server.level.ServerLevel) world, pos, itemInHand);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
index e054edf9e7c4eef231e155516433c6faeb2ca540..8f035b1f1486f0e4d00e586fccf1a008ef8aaf36 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -199,4 +199,15 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(CropBlock.AGE);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void playerDestroy(Level world, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, @javax.annotation.Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, ItemStack itemInHand) {
|
||||
+ if (world.purpurConfig.hoeReplantsCrops && itemInHand.getItem() instanceof net.minecraft.world.item.HoeItem) {
|
||||
+ super.playerDestroyAndReplant(world, player, pos, state, blockEntity, itemInHand, getBaseSeedId());
|
||||
+ } else {
|
||||
+ super.playerDestroy(world, player, pos, state, blockEntity, itemInHand);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NetherWartBlock.java b/src/main/java/net/minecraft/world/level/block/NetherWartBlock.java
|
||||
index cc8e94dc7ad93a9b7cf71315f5910daa35bc0778..c0ef9c9c438a2716f5d2cd589a0b4e8538b5b347 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NetherWartBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NetherWartBlock.java
|
||||
@@ -60,4 +60,15 @@ public class NetherWartBlock extends BushBlock {
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(NetherWartBlock.AGE);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void playerDestroy(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, @javax.annotation.Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, ItemStack itemInHand) {
|
||||
+ if (world.purpurConfig.hoeReplantsNetherWarts && itemInHand.getItem() instanceof net.minecraft.world.item.HoeItem) {
|
||||
+ super.playerDestroyAndReplant(world, player, pos, state, blockEntity, itemInHand, Items.NETHER_WART);
|
||||
+ } else {
|
||||
+ super.playerDestroy(world, player, pos, state, blockEntity, itemInHand);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index c684f8e65ae8e32c85d511030358c5b1cd56c003..19873560257005a4039454f53352f1817b79a520 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -545,6 +545,8 @@ public class PurpurWorldConfig {
|
||||
public Map<Block, Waxable> axeWaxables = new HashMap<>();
|
||||
public Map<Block, Weatherable> axeWeatherables = new HashMap<>();
|
||||
public Map<Block, Tillable> hoeTillables = new HashMap<>();
|
||||
+ public boolean hoeReplantsCrops = false;
|
||||
+ public boolean hoeReplantsNetherWarts = false;
|
||||
private void toolSettings() {
|
||||
axeStrippables.clear();
|
||||
axeWaxables.clear();
|
||||
@@ -686,6 +688,8 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
hoeTillables.put(block, new Tillable(condition, into, drops));
|
||||
});
|
||||
+ hoeReplantsCrops = getBoolean("tools.hoe.replant-crops", hoeReplantsCrops);
|
||||
+ hoeReplantsNetherWarts = getBoolean("tools.hoe.replant-nether-warts", hoeReplantsNetherWarts);
|
||||
}
|
||||
|
||||
public boolean anvilAllowColors = false;
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 31 Dec 2021 06:03:12 -0600
|
||||
Subject: [PATCH] Shearing jeb produces random color wool
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
index 17d1a0b43b2d155535cf2483af4ba9dd09700c83..fbe71ed86553965aa9fc20b7d8e6fdefd1d85a60 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -293,7 +293,7 @@ public class Sheep extends Animal implements Shearable {
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
this.forceDrops = true; // CraftBukkit
|
||||
- ItemEntity entityitem = this.spawnAtLocation((ItemLike) Sheep.ITEM_BY_DYE.get(this.getColor()), 1);
|
||||
+ ItemEntity entityitem = this.spawnAtLocation((ItemLike) Sheep.ITEM_BY_DYE.get(this.level.purpurConfig.sheepShearJebRandomColor && hasCustomName() && getCustomName().getString().equals("jeb_") ? DyeColor.random(this.level.random) : this.getColor()), 1); // Purpur
|
||||
this.forceDrops = false; // CraftBukkit
|
||||
|
||||
if (entityitem != null) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 19873560257005a4039454f53352f1817b79a520..ce431461ea8b55e5b3bf87c3a1a338a63acc578e 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2255,6 +2255,7 @@ public class PurpurWorldConfig {
|
||||
public boolean sheepBypassMobGriefing = false;
|
||||
public boolean sheepTakeDamageFromWater = false;
|
||||
public boolean sheepAlwaysDropExp = false;
|
||||
+ public boolean sheepShearJebRandomColor = false;
|
||||
private void sheepSettings() {
|
||||
sheepRidable = getBoolean("mobs.sheep.ridable", sheepRidable);
|
||||
sheepRidableInWater = getBoolean("mobs.sheep.ridable-in-water", sheepRidableInWater);
|
||||
@@ -2269,6 +2270,7 @@ public class PurpurWorldConfig {
|
||||
sheepBypassMobGriefing = getBoolean("mobs.sheep.bypass-mob-griefing", sheepBypassMobGriefing);
|
||||
sheepTakeDamageFromWater = getBoolean("mobs.sheep.takes-damage-from-water", sheepTakeDamageFromWater);
|
||||
sheepAlwaysDropExp = getBoolean("mobs.sheep.always-drop-exp", sheepAlwaysDropExp);
|
||||
+ sheepShearJebRandomColor = getBoolean("mobs.sheep.jeb-shear-random-color", sheepShearJebRandomColor);
|
||||
}
|
||||
|
||||
public boolean shulkerRidable = false;
|
||||
@@ -1,51 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 31 Dec 2021 06:18:54 -0600
|
||||
Subject: [PATCH] Turtle eggs random tick crack chance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
index 08401d2908e41d1ce3968ab085c4c376da33181f..09438e86f7228336f6376118ec2476247f477841 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
@@ -11,13 +11,11 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.ExperienceOrb;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
-import net.minecraft.world.entity.ambient.Bat;
|
||||
import net.minecraft.world.entity.animal.Turtle;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
-import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
@@ -157,7 +155,7 @@ public class TurtleEggBlock extends Block {
|
||||
private boolean shouldUpdateHatchLevel(Level world) {
|
||||
float f = world.getTimeOfDay(1.0F);
|
||||
|
||||
- return (double) f < 0.69D && (double) f > 0.65D ? true : world.random.nextInt(500) == 0;
|
||||
+ return (double) f < 0.69D && (double) f > 0.65D ? true : world.random.nextInt(world.purpurConfig.turtleEggsRandomTickCrackChance) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index ce431461ea8b55e5b3bf87c3a1a338a63acc578e..7017a397dc2a3e27376c95983cedcd6313ca8ebd 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -977,11 +977,13 @@ public class PurpurWorldConfig {
|
||||
public boolean turtleEggsBreakFromItems = true;
|
||||
public boolean turtleEggsBreakFromMinecarts = true;
|
||||
public boolean turtleEggsBypassMobGriefing = false;
|
||||
+ public int turtleEggsRandomTickCrackChance = 500;
|
||||
private void turtleEggSettings() {
|
||||
turtleEggsBreakFromExpOrbs = getBoolean("blocks.turtle_egg.break-from-exp-orbs", turtleEggsBreakFromExpOrbs);
|
||||
turtleEggsBreakFromItems = getBoolean("blocks.turtle_egg.break-from-items", turtleEggsBreakFromItems);
|
||||
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
|
||||
turtleEggsBypassMobGriefing = getBoolean("blocks.turtle_egg.bypass-mob-griefing", turtleEggsBypassMobGriefing);
|
||||
+ turtleEggsRandomTickCrackChance = getInt("blocks.turtle_egg.random-tick-crack-chance", turtleEggsRandomTickCrackChance);
|
||||
}
|
||||
|
||||
public int twistingVinesMaxGrowthAge = 25;
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 31 Dec 2021 06:40:19 -0600
|
||||
Subject: [PATCH] Mob head visibility percent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 360aa9d2f9d5a8ecd0db36a3715825222fec018e..f8c7eb51608fcf91de3da03afd9ffd34dbedaffc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -992,9 +992,17 @@ public abstract class LivingEntity extends Entity {
|
||||
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
EntityType<?> entitytypes = entity.getType();
|
||||
|
||||
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
|
||||
- d0 *= 0.5D;
|
||||
+ // Purpur start
|
||||
+ if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL)) {
|
||||
+ d0 *= entity.level.purpurConfig.skeletonHeadVisibilityPercent;
|
||||
+ }
|
||||
+ else if (entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD)) {
|
||||
+ d0 *= entity.level.purpurConfig.zombieHeadVisibilityPercent;
|
||||
}
|
||||
+ else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
|
||||
+ d0 *= entity.level.purpurConfig.creeperHeadVisibilityPercent;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
// Purpur start
|
||||
if (entity instanceof LivingEntity entityliving) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 7017a397dc2a3e27376c95983cedcd6313ca8ebd..978be4f1f14a8fe647ea31ff2002a16010210a33 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1256,6 +1256,7 @@ public class PurpurWorldConfig {
|
||||
public boolean creeperExplodeWhenKilled = false;
|
||||
public boolean creeperHealthRadius = false;
|
||||
public boolean creeperAlwaysDropExp = false;
|
||||
+ public double creeperHeadVisibilityPercent = 0.5D;
|
||||
private void creeperSettings() {
|
||||
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
|
||||
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
|
||||
@@ -1273,6 +1274,7 @@ public class PurpurWorldConfig {
|
||||
creeperExplodeWhenKilled = getBoolean("mobs.creeper.explode-when-killed", creeperExplodeWhenKilled);
|
||||
creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius);
|
||||
creeperAlwaysDropExp = getBoolean("mobs.creeper.always-drop-exp", creeperAlwaysDropExp);
|
||||
+ creeperHeadVisibilityPercent = getDouble("mobs.creeper.head-visibility-percent", creeperHeadVisibilityPercent);
|
||||
}
|
||||
|
||||
public boolean dolphinRidable = false;
|
||||
@@ -2335,6 +2337,7 @@ public class PurpurWorldConfig {
|
||||
public double skeletonMaxHealth = 20.0D;
|
||||
public boolean skeletonTakeDamageFromWater = false;
|
||||
public boolean skeletonAlwaysDropExp = false;
|
||||
+ public double skeletonHeadVisibilityPercent = 0.5D;
|
||||
private void skeletonSettings() {
|
||||
skeletonRidable = getBoolean("mobs.skeleton.ridable", skeletonRidable);
|
||||
skeletonRidableInWater = getBoolean("mobs.skeleton.ridable-in-water", skeletonRidableInWater);
|
||||
@@ -2347,6 +2350,7 @@ public class PurpurWorldConfig {
|
||||
skeletonMaxHealth = getDouble("mobs.skeleton.attributes.max_health", skeletonMaxHealth);
|
||||
skeletonTakeDamageFromWater = getBoolean("mobs.skeleton.takes-damage-from-water", skeletonTakeDamageFromWater);
|
||||
skeletonAlwaysDropExp = getBoolean("mobs.skeleton.always-drop-exp", skeletonAlwaysDropExp);
|
||||
+ skeletonHeadVisibilityPercent = getDouble("mobs.skeleton.head-visibility-percent", skeletonHeadVisibilityPercent);
|
||||
}
|
||||
|
||||
public boolean skeletonHorseRidableInWater = true;
|
||||
@@ -2860,6 +2864,7 @@ public class PurpurWorldConfig {
|
||||
public boolean zombieBypassMobGriefing = false;
|
||||
public boolean zombieTakeDamageFromWater = false;
|
||||
public boolean zombieAlwaysDropExp = false;
|
||||
+ public double zombieHeadVisibilityPercent = 0.5D;
|
||||
private void zombieSettings() {
|
||||
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
|
||||
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
|
||||
@@ -2878,6 +2883,7 @@ public class PurpurWorldConfig {
|
||||
zombieBypassMobGriefing = getBoolean("mobs.zombie.bypass-mob-griefing", zombieBypassMobGriefing);
|
||||
zombieTakeDamageFromWater = getBoolean("mobs.zombie.takes-damage-from-water", zombieTakeDamageFromWater);
|
||||
zombieAlwaysDropExp = getBoolean("mobs.zombie.always-drop-exp", zombieAlwaysDropExp);
|
||||
+ zombieHeadVisibilityPercent = getDouble("mobs.zombie.head-visibility-percent", zombieHeadVisibilityPercent);
|
||||
}
|
||||
|
||||
public boolean zombieHorseRidableInWater = false;
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 1 Jan 2022 18:38:58 -0600
|
||||
Subject: [PATCH] Configurable valid characters for usernames
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 03eb7933f309b30fa8c243f4dd0a292b850bfda0..00a5731e7b1e2b84453e6d1416dce8bd9e1b1b10 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -233,6 +233,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (true) return org.purpurmc.purpur.PurpurConfig.usernameValidCharactersPattern.matcher(in).matches(); // Purpur
|
||||
+
|
||||
for (int i = 0, len = in.length(); i < len; ++i) {
|
||||
char c = in.charAt(i);
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 3462a34a7d8e2bbf4c19c02a0b9f19ad5ccdc00f..73b4aeb50ba60e5708bca6a7762b8c44be9c9287 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -427,4 +427,11 @@ public class PurpurConfig {
|
||||
private static void networkSettings() {
|
||||
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
||||
}
|
||||
+
|
||||
+ public static java.util.regex.Pattern usernameValidCharactersPattern;
|
||||
+ private static void usernameValidationSettings() {
|
||||
+ String defaultPattern = "^[a-zA-Z0-9_.]*$";
|
||||
+ String setPattern = getString("settings.username-valid-characters", defaultPattern);
|
||||
+ usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
|
||||
+ }
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Mon, 3 Jan 2022 00:06:51 -0600
|
||||
Subject: [PATCH] Shears can have looting enchantment
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
index 2366d411bf64f88c7296e888cd3bf584825ae4a9..c119aae5b5f0d0717a883f3df5566185046534ee 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
@@ -107,7 +107,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- ishearable.shear(SoundSource.BLOCKS);
|
||||
+ ishearable.shear(SoundSource.BLOCKS, net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.MOB_LOOTING, CraftItemStack.asNMSCopy(craftItem))); // Purpur
|
||||
worldserver.gameEvent((Entity) null, GameEvent.SHEAR, blockposition);
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
index 5e8cc5cfac8888628c6d513148f41be09ca65a2c..a089fc61ec09be6b7490375489178dc6ba5a644b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
@@ -3,7 +3,13 @@ package net.minecraft.world.entity;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
|
||||
public interface Shearable {
|
||||
- void shear(SoundSource shearedSoundCategory);
|
||||
+ // Purpur start
|
||||
+ default void shear(SoundSource shearedSoundCategory) {
|
||||
+ shear(shearedSoundCategory, 0);
|
||||
+ }
|
||||
+
|
||||
+ void shear(SoundSource shearedSoundCategory, int looting);
|
||||
+ // Purpur end
|
||||
|
||||
boolean readyForShearing();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
index 48459f6c9a9d7112ef335725e1989883a892c9d7..abd93b9b1edd9166cf17852a547a9d0d99909871 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -165,7 +165,7 @@ public class MushroomCow extends Cow implements Shearable {
|
||||
return tryRide(player, hand); // Purpur
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, net.minecraft.world.item.enchantment.EnchantmentHelper.getMobLooting(player)); // Purpur
|
||||
this.gameEvent(GameEvent.SHEAR, (Entity) player);
|
||||
if (!this.level.isClientSide) {
|
||||
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
|
||||
@@ -208,7 +208,7 @@ public class MushroomCow extends Cow implements Shearable {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void shear(SoundSource shearedSoundCategory) {
|
||||
+ public void shear(SoundSource shearedSoundCategory, int looting) { // Purpur
|
||||
this.level.playSound((Player) null, (Entity) this, SoundEvents.MOOSHROOM_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
((ServerLevel) this.level).sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
@@ -243,7 +243,7 @@ public class MushroomCow extends Cow implements Shearable {
|
||||
this.discard(); // CraftBukkit - from above
|
||||
// CraftBukkit end
|
||||
|
||||
- for (int i = 0; i < 5; ++i) {
|
||||
+ for (int i = 0; i < 5 + (org.purpurmc.purpur.PurpurConfig.allowShearsLooting ? looting : 0); ++i) { // Purpur
|
||||
// CraftBukkit start
|
||||
ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock()));
|
||||
EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
index fbe71ed86553965aa9fc20b7d8e6fdefd1d85a60..d61204c8aaef5e0e4e79096b6469ce3f6e8f92af 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -271,7 +271,7 @@ public class Sheep extends Animal implements Shearable {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, net.minecraft.world.item.enchantment.EnchantmentHelper.getMobLooting(player)); // Purpur
|
||||
this.gameEvent(GameEvent.SHEAR, (Entity) player);
|
||||
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
|
||||
entityhuman1.broadcastBreakEvent(hand);
|
||||
@@ -286,10 +286,11 @@ public class Sheep extends Animal implements Shearable {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void shear(SoundSource shearedSoundCategory) {
|
||||
+ public void shear(SoundSource shearedSoundCategory, int looting) { // Purpur
|
||||
this.level.playSound((Player) null, (Entity) this, SoundEvents.SHEEP_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
this.setSheared(true);
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.allowShearsLooting) i += looting; // Purpur
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
this.forceDrops = true; // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
index 83906fbb59d678451f93e6335aa674a7ff6bc9b1..908df941020d0f4aed1fe0827f7649056354f5d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -200,7 +200,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
return tryRide(player, hand); // Purpur
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, net.minecraft.world.item.enchantment.EnchantmentHelper.getMobLooting(player)); // Purpur
|
||||
this.gameEvent(GameEvent.SHEAR, (Entity) player);
|
||||
if (!this.level.isClientSide) {
|
||||
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
|
||||
@@ -223,12 +223,13 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void shear(SoundSource shearedSoundCategory) {
|
||||
+ public void shear(SoundSource shearedSoundCategory, int looting) { // Purpur
|
||||
this.level.playSound((Player) null, (Entity) this, SoundEvents.SNOW_GOLEM_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
this.setPumpkin(false);
|
||||
this.forceDrops = true; // CraftBukkit
|
||||
if (level.purpurConfig.snowGolemDropsPumpkin) // Purpur
|
||||
+ for (int i = 0; i < 1 + (org.purpurmc.purpur.PurpurConfig.allowShearsLooting ? looting : 0); i++) // Purpur
|
||||
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
|
||||
this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java
|
||||
index d6417c1e77ac8823e18a179dc9f61757a1f339ad..a19dd0946f853193ff32b2b560db27534b8b4abf 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java
|
||||
@@ -104,6 +104,12 @@ public enum EnchantmentCategory {
|
||||
public boolean canEnchant(Item item) {
|
||||
return item instanceof BowItem || item instanceof CrossbowItem;
|
||||
}
|
||||
+ },
|
||||
+ WEAPON_AND_SHEARS {
|
||||
+ @Override
|
||||
+ public boolean canEnchant(Item item) {
|
||||
+ return WEAPON.canEnchant(item) || item instanceof net.minecraft.world.item.ShearsItem;
|
||||
+ }
|
||||
// Purpur end
|
||||
};
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java
|
||||
index 6b8a1535086aae7e4e3229d05615fb903188f507..60af917083de1b790b1d93d61835a669143068fb 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java
|
||||
@@ -7,6 +7,14 @@ public class LootBonusEnchantment extends Enchantment {
|
||||
super(weight, type, slotTypes);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public boolean canEnchant(net.minecraft.world.item.ItemStack stack) {
|
||||
+ // we have to cheat the system because this class is loaded before purpur's config is loaded
|
||||
+ return (org.purpurmc.purpur.PurpurConfig.allowShearsLooting && this.category == EnchantmentCategory.WEAPON ? EnchantmentCategory.WEAPON_AND_SHEARS : this.category).canEnchant(stack.getItem());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public int getMinCost(int level) {
|
||||
return 15 + (level - 1) * 9;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 73b4aeb50ba60e5708bca6a7762b8c44be9c9287..9ea922b7b41b1805d94ea18f437dd52fd756a821 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -373,6 +373,7 @@ public class PurpurConfig {
|
||||
|
||||
public static boolean allowInfinityMending = false;
|
||||
public static boolean allowCrossbowInfinity = false;
|
||||
+ public static boolean allowShearsLooting = false;
|
||||
public static boolean allowUnsafeEnchants = false;
|
||||
public static boolean allowUnsafeEnchantCommand = false;
|
||||
private static void enchantmentSettings() {
|
||||
@@ -383,6 +384,7 @@ public class PurpurConfig {
|
||||
}
|
||||
allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
|
||||
allowCrossbowInfinity = getBoolean("settings.enchantment.allow-infinity-on-crossbow", allowCrossbowInfinity);
|
||||
+ allowShearsLooting = getBoolean("settings.enchantment.allow-looting-on-shears", allowShearsLooting);
|
||||
allowUnsafeEnchants = getBoolean("settings.enchantment.allow-unsafe-enchants", allowUnsafeEnchants);
|
||||
allowUnsafeEnchantCommand = getBoolean("settings.enchantment.allow-unsafe-enchant-command", allowUnsafeEnchants); // allowUnsafeEnchants as default for backwards compatability
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Mon, 3 Jan 2022 01:19:46 -0600
|
||||
Subject: [PATCH] Stop bees from dying after stinging
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
index 02fc6bb52419b75f04092b33e15e0ab1ea7a7b1a..2a1785a6758a030bc554accfba35d82974fc1fa7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -454,6 +454,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
this.hurt(DamageSource.DROWN, 1.0F);
|
||||
}
|
||||
|
||||
+ if (flag && !this.level.purpurConfig.beeDiesAfterSting) setHasStung(false); else // Purpur
|
||||
if (flag) {
|
||||
++this.timeSinceSting;
|
||||
if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, (int) 1, (int) 1200)) == 0) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 978be4f1f14a8fe647ea31ff2002a16010210a33..18611782bc89ea034565709530637838e5327eb7 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1076,6 +1076,7 @@ public class PurpurWorldConfig {
|
||||
public boolean beeCanWorkAtNight = false;
|
||||
public boolean beeCanWorkInRain = false;
|
||||
public boolean beeAlwaysDropExp = false;
|
||||
+ public boolean beeDiesAfterSting = true;
|
||||
private void beeSettings() {
|
||||
beeRidable = getBoolean("mobs.bee.ridable", beeRidable);
|
||||
beeRidableInWater = getBoolean("mobs.bee.ridable-in-water", beeRidableInWater);
|
||||
@@ -1092,6 +1093,7 @@ public class PurpurWorldConfig {
|
||||
beeCanWorkAtNight = getBoolean("mobs.bee.can-work-at-night", beeCanWorkAtNight);
|
||||
beeCanWorkInRain = getBoolean("mobs.bee.can-work-in-rain", beeCanWorkInRain);
|
||||
beeAlwaysDropExp = getBoolean("mobs.bee.always-drop-exp", beeAlwaysDropExp);
|
||||
+ beeDiesAfterSting = getBoolean("mobs.bee.dies-after-sting", beeDiesAfterSting);
|
||||
}
|
||||
|
||||
public boolean blazeRidable = false;
|
||||
@@ -1,117 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 30 Dec 2021 09:56:43 -0600
|
||||
Subject: [PATCH] Give bee counts in beehives to Purpur clients
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 836028033093ea72c670afafeee4b81a421dd459..20cdc0eb26fd53a4193b39171982dfa255d355bf 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1099,6 +1099,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
public void safeShutdown(boolean flag, boolean isRestarting) {
|
||||
org.purpurmc.purpur.task.BossBarTask.stopAll(); // Purpur
|
||||
+ org.purpurmc.purpur.task.BeehiveTask.instance().unregister(); // Purpur
|
||||
this.isRestarting = isRestarting;
|
||||
this.hasLoggedStop = true; // Paper
|
||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 2a6d3c49a337b3815fdcc7624e90d875464bb7da..20f016e24b679af2651dc84819b1c62d2937b77b 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -386,6 +386,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish
|
||||
org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur
|
||||
+ org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur
|
||||
return true;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java b/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..055dd307e9d5ac0d4623c961164c84bab1edd3bd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
|
||||
@@ -0,0 +1,81 @@
|
||||
+package org.purpurmc.purpur.task;
|
||||
+
|
||||
+import com.google.common.io.ByteArrayDataInput;
|
||||
+import com.google.common.io.ByteArrayDataOutput;
|
||||
+import com.google.common.io.ByteStreams;
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
|
||||
+import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.plugin.PluginBase;
|
||||
+import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class BeehiveTask implements PluginMessageListener {
|
||||
+ public static final ResourceLocation BEEHIVE_C2S = new ResourceLocation("purpur", "beehive_c2s");
|
||||
+ public static final ResourceLocation BEEHIVE_S2C = new ResourceLocation("purpur", "beehive_s2c");
|
||||
+
|
||||
+ private static BeehiveTask instance;
|
||||
+
|
||||
+ public static BeehiveTask instance() {
|
||||
+ if (instance == null) {
|
||||
+ instance = new BeehiveTask();
|
||||
+ }
|
||||
+ return instance;
|
||||
+ }
|
||||
+
|
||||
+ private final PluginBase plugin = new MinecraftInternalPlugin();
|
||||
+
|
||||
+ private BeehiveTask() {
|
||||
+ }
|
||||
+
|
||||
+ public void register() {
|
||||
+ Bukkit.getMessenger().registerOutgoingPluginChannel(this.plugin, BEEHIVE_S2C.toString());
|
||||
+ Bukkit.getMessenger().registerIncomingPluginChannel(this.plugin, BEEHIVE_C2S.toString(), this);
|
||||
+ }
|
||||
+
|
||||
+ public void unregister() {
|
||||
+ Bukkit.getMessenger().unregisterOutgoingPluginChannel(this.plugin, BEEHIVE_S2C.toString());
|
||||
+ Bukkit.getMessenger().unregisterIncomingPluginChannel(this.plugin, BEEHIVE_C2S.toString());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onPluginMessageReceived(@NotNull String channel, Player player, byte[] bytes) {
|
||||
+ ByteArrayDataInput in = in(bytes);
|
||||
+ long packedPos = in.readLong();
|
||||
+ BlockPos pos = BlockPos.of(packedPos);
|
||||
+
|
||||
+ ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
|
||||
+
|
||||
+ BlockEntity blockEntity = serverPlayer.level.getBlockEntity(pos);
|
||||
+ if (!(blockEntity instanceof BeehiveBlockEntity beehive)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ByteArrayDataOutput out = out();
|
||||
+
|
||||
+ out.writeInt(beehive.getOccupantCount());
|
||||
+ out.writeLong(packedPos);
|
||||
+
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(out.toByteArray()));
|
||||
+ serverPlayer.connection.send(new ClientboundCustomPayloadPacket(BEEHIVE_S2C, buf));
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("UnstableApiUsage")
|
||||
+ private static ByteArrayDataOutput out() {
|
||||
+ return ByteStreams.newDataOutput();
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("UnstableApiUsage")
|
||||
+ private static ByteArrayDataInput in(byte[] bytes) {
|
||||
+ return ByteStreams.newDataInput(bytes);
|
||||
+ }
|
||||
+}
|
||||
@@ -1,56 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Tue, 4 Jan 2022 11:56:48 -0600
|
||||
Subject: [PATCH] Configurable farmland trample height
|
||||
|
||||
This is _not_ in block height or an exact science.
|
||||
During my testing I found very inconsistent values
|
||||
for the fallDistance variable. Here are the results
|
||||
of those tests (https://imgur.com/BojltJF):
|
||||
|
||||
Value set -> Actual fall distance needed to trample
|
||||
1.0 -> 1.25
|
||||
1.5 -> 1.75
|
||||
2.0 -> 2.25
|
||||
2.5 -> 2.87
|
||||
3.0 -> 3.5
|
||||
3.5 -> 4.25
|
||||
4.0 -> 4.25
|
||||
4.5 -> 5.0
|
||||
5.0 -> 5.87
|
||||
5.5 -> 5.87
|
||||
6.0 -> 6.75
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index 29a538964d31527c9d10e25716e99ac22775119d..4871afa8f86f2945dc35fb55c709d91c28a15120 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -98,7 +98,7 @@ public class FarmBlock extends Block {
|
||||
@Override
|
||||
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
|
||||
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
- if (!world.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.purpurConfig.farmlandBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur
|
||||
+ if (!world.isClientSide && (world.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= world.purpurConfig.farmlandTrampleHeight : world.random.nextFloat() < fallDistance - 0.5F) && entity instanceof LivingEntity && (entity instanceof Player || world.purpurConfig.farmlandBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof Player) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 18611782bc89ea034565709530637838e5327eb7..248ed206c8cfdf1dc3363a8f8a930a7d6acea97f 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -834,6 +834,7 @@ public class PurpurWorldConfig {
|
||||
public boolean farmlandTramplingDisabled = false;
|
||||
public boolean farmlandTramplingOnlyPlayers = false;
|
||||
public boolean farmlandTramplingFeatherFalling = false;
|
||||
+ public double farmlandTrampleHeight = -1D;
|
||||
private void farmlandSettings() {
|
||||
farmlandBypassMobGriefing = getBoolean("blocks.farmland.bypass-mob-griefing", farmlandBypassMobGriefing);
|
||||
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
@@ -841,6 +842,7 @@ public class PurpurWorldConfig {
|
||||
farmlandTramplingDisabled = getBoolean("blocks.farmland.disable-trampling", farmlandTramplingDisabled);
|
||||
farmlandTramplingOnlyPlayers = getBoolean("blocks.farmland.only-players-trample", farmlandTramplingOnlyPlayers);
|
||||
farmlandTramplingFeatherFalling = getBoolean("blocks.farmland.feather-fall-distance-affects-trampling", farmlandTramplingFeatherFalling);
|
||||
+ farmlandTrampleHeight = getDouble("blocks.farmland.trample-height", farmlandTrampleHeight);
|
||||
}
|
||||
|
||||
public double floweringAzaleaGrowthChance = 0.0D;
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Mon, 10 Jan 2022 10:04:31 -0600
|
||||
Subject: [PATCH] Configurable player pickup exp delay
|
||||
|
||||
Default vanilla value is to delay 2 ticks between picking up exp orbs.
|
||||
Players only pick up 1 orb at a time, so even with setting this to 0
|
||||
players still only pick up one orb every tick. However, setting this
|
||||
to any negative number will pick up all orbs instantly.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index 37fe86f0f6ea006f658cd6a68757c1c12ae32eb7..d6ee7b9d2fafbe76d4705a182ae1a0e98ce91eef 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -301,8 +301,8 @@ public class ExperienceOrb extends Entity {
|
||||
@Override
|
||||
public void playerTouch(Player player) {
|
||||
if (!this.level.isClientSide) {
|
||||
- if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
||||
- player.takeXpDelay = 2;
|
||||
+ if (player.takeXpDelay <= 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
||||
+ player.takeXpDelay = this.level.purpurConfig.playerExpPickupDelay; // Purpur
|
||||
player.take(this, 1);
|
||||
int i = this.repairPlayerItems(player, this.value);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 302db826868980d3ad617013413632f97ab6643a..64b4ce3dc8b5e43125f668f5fc00b3f9809c843a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -622,7 +622,7 @@ public abstract class Player extends LivingEntity {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
- if (entity.getType() == EntityType.EXPERIENCE_ORB) {
|
||||
+ if (entity.getType() == EntityType.EXPERIENCE_ORB && entity.level.purpurConfig.playerExpPickupDelay >= 0) { // Purpur
|
||||
list1.add(entity);
|
||||
} else if (!entity.isRemoved()) {
|
||||
this.touch(entity);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 248ed206c8cfdf1dc3363a8f8a930a7d6acea97f..0f03c0e7c9b22f0144730153eb70f82fe8df4a35 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -413,6 +413,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerRidableInWater = false;
|
||||
public boolean playerRemoveBindingWithWeakness = false;
|
||||
public int shiftRightClickRepairsMendingPoints = 0;
|
||||
+ public int playerExpPickupDelay = 2;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -441,6 +442,7 @@ public class PurpurWorldConfig {
|
||||
playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater);
|
||||
playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness);
|
||||
shiftRightClickRepairsMendingPoints = getInt("gameplay-mechanics.player.shift-right-click-repairs-mending-points", shiftRightClickRepairsMendingPoints);
|
||||
+ playerExpPickupDelay = getInt("gameplay-mechanics.player.exp-pickup-delay-ticks", playerExpPickupDelay);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Sat, 15 Jan 2022 03:27:29 -0600
|
||||
Subject: [PATCH] Allow void trading
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 77cb010bd8b67f436726dfe32e5dd3b897beff55..72df9c6d1ac2fef090b0532da079c607f79bce89 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2602,7 +2602,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
// Paper start
|
||||
- if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
|
||||
+ if (!entity.level.purpurConfig.playerVoidTrading && entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) { // Purpur
|
||||
merchant.getTrader().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED);
|
||||
}
|
||||
// Paper end
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 87d0af46eaf49f88f56e50ea52fcbb8ac93f11a9..0193ed7024b0283366aa7597006a8188673fbc69 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -414,6 +414,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerRemoveBindingWithWeakness = false;
|
||||
public int shiftRightClickRepairsMendingPoints = 0;
|
||||
public int playerExpPickupDelay = 2;
|
||||
+ public boolean playerVoidTrading = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -443,6 +444,7 @@ public class PurpurWorldConfig {
|
||||
playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness);
|
||||
shiftRightClickRepairsMendingPoints = getInt("gameplay-mechanics.player.shift-right-click-repairs-mending-points", shiftRightClickRepairsMendingPoints);
|
||||
playerExpPickupDelay = getInt("gameplay-mechanics.player.exp-pickup-delay-ticks", playerExpPickupDelay);
|
||||
+ playerVoidTrading = getBoolean("gameplay-mechanics.player.allow-void-trading", playerVoidTrading);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Sat, 15 Jan 2022 06:23:04 -0600
|
||||
Subject: [PATCH] Dont eat blocks in non ticking chunks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 1647627a02754f5bc8c0f86e467bd11369c24be3..c0bb015bd1ce923a5a2a805e68ae3d25cc252777 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1778,7 +1778,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return this.anyPlayerCloseEnoughForSpawning(this.getUpdatingChunkIfPresent(chunkcoordintpair.toLong()), chunkcoordintpair, reducedRange);
|
||||
}
|
||||
|
||||
- final boolean anyPlayerCloseEnoughForSpawning(ChunkHolder playerchunk, ChunkPos chunkcoordintpair, boolean reducedRange) {
|
||||
+ public final boolean anyPlayerCloseEnoughForSpawning(ChunkHolder playerchunk, ChunkPos chunkcoordintpair, boolean reducedRange) { // Purpur - package -> public
|
||||
// this function is so hot that removing the map lookup call can have an order of magnitude impact on its performance
|
||||
// tested and confirmed via System.nanoTime()
|
||||
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInRange = reducedRange ? playerchunk.playersInMobSpawnRange : playerchunk.playersInChunkTickRange;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
index 8a4080a77bd5b73ac812e3ae67c6f21dcd270215..16e66ae7cf761fabb74a035e2fd8c28615365dc2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
@@ -32,6 +32,12 @@ public class EatBlockGoal extends Goal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
+ // Purpur start
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.mob.level.getChunkIfLoaded(this.mob.blockPosition);
|
||||
+ if (chunk == null || chunk.playerChunk == null || !((net.minecraft.server.level.ServerLevel) this.mob.level).getChunkSource().chunkMap.anyPlayerCloseEnoughForSpawning(chunk.playerChunk, this.mob.chunkPosition(), false)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
if (this.mob.getRandom().nextInt(this.mob.isBaby() ? 50 : 1000) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Mon, 17 Jan 2022 21:28:49 -0600
|
||||
Subject: [PATCH] Configurable phantom size
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 3b14a9b0ae1d0dc918552c91cb8f82db7ac00cbf..32ba17f4098382cc8d8d278378ca00211209b8ae 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -272,7 +272,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@Override
|
||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
|
||||
this.anchorPoint = this.blockPosition().above(5);
|
||||
- this.setPhantomSize(0);
|
||||
+ // Purpur start
|
||||
+ int min = world.getLevel().purpurConfig.phantomMinSize;
|
||||
+ int max = world.getLevel().purpurConfig.phantomMaxSize;
|
||||
+ this.setPhantomSize(min == max ? min : world.getRandom().nextInt(max + 1 - min) + min);
|
||||
+ // Purpur end
|
||||
return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index e9b1fccdde19d543dd02a08889dd37c6a8ebcb60..1fd070e037b8bbd358ce162a011cddc1a565385c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1994,6 +1994,8 @@ public class PurpurWorldConfig {
|
||||
public boolean phantomFlamesOnSwoop = false;
|
||||
public boolean phantomTakeDamageFromWater = false;
|
||||
public boolean phantomAlwaysDropExp = false;
|
||||
+ public int phantomMinSize = 0;
|
||||
+ public int phantomMaxSize = 0;
|
||||
private void phantomSettings() {
|
||||
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
|
||||
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
|
||||
@@ -2036,6 +2038,13 @@ public class PurpurWorldConfig {
|
||||
phantomFlamesOnSwoop = getBoolean("mobs.phantom.flames-on-swoop", phantomFlamesOnSwoop);
|
||||
phantomTakeDamageFromWater = getBoolean("mobs.phantom.takes-damage-from-water", phantomTakeDamageFromWater);
|
||||
phantomAlwaysDropExp = getBoolean("mobs.phantom.always-drop-exp", phantomAlwaysDropExp);
|
||||
+ phantomMinSize = Mth.clamp(getInt("mobs.phantom.size.min", phantomMinSize), 0, 64);
|
||||
+ phantomMaxSize = Mth.clamp(getInt("mobs.phantom.size.max", phantomMaxSize), 0, 64);
|
||||
+ if (phantomMinSize > phantomMaxSize) {
|
||||
+ phantomMinSize = phantomMinSize ^ phantomMaxSize;
|
||||
+ phantomMaxSize = phantomMinSize ^ phantomMaxSize;
|
||||
+ phantomMinSize = phantomMinSize ^ phantomMaxSize;
|
||||
+ }
|
||||
}
|
||||
|
||||
public boolean pigRidable = false;
|
||||
@@ -1,132 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Tue, 18 Jan 2022 04:51:51 -0600
|
||||
Subject: [PATCH] Configurable food attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodProperties.java b/src/main/java/net/minecraft/world/food/FoodProperties.java
|
||||
index 9967ba762567631f2bdb1e4f8fe16a13ea927b46..6c945ae8fe8b1517e312c688f829fab41f12d9f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodProperties.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodProperties.java
|
||||
@@ -2,15 +2,22 @@ package net.minecraft.world.food;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
|
||||
public class FoodProperties {
|
||||
- private final int nutrition;
|
||||
- private final float saturationModifier;
|
||||
- private final boolean isMeat;
|
||||
- private final boolean canAlwaysEat;
|
||||
- private final boolean fastFood;
|
||||
+ // Purpur start
|
||||
+ private int nutrition; public void setNutrition(int nutrition) { this.nutrition = nutrition; }
|
||||
+ private float saturationModifier; public void setSaturationModifier(float saturation) { this.saturationModifier = saturation; }
|
||||
+ private boolean isMeat; public void setIsMeat(boolean isMeat) { this.isMeat = isMeat; }
|
||||
+ private boolean canAlwaysEat; public void setCanAlwaysEat(boolean canAlwaysEat) { this.canAlwaysEat = canAlwaysEat; }
|
||||
+ private boolean fastFood; public void setFastFood(boolean isFastFood) { this.fastFood = isFastFood; }
|
||||
+ public FoodProperties copy() {
|
||||
+ return new FoodProperties(this.nutrition, this.saturationModifier, this.isMeat, this.canAlwaysEat, this.fastFood, new ArrayList<>(this.effects));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
private final List<Pair<MobEffectInstance, Float>> effects;
|
||||
|
||||
FoodProperties(int hunger, float saturationModifier, boolean meat, boolean alwaysEdible, boolean snack, List<Pair<MobEffectInstance, Float>> statusEffects) {
|
||||
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
index b16d9e2eaa589f19c563ee70b1a56d67dbcdecb0..71beab673f04cd051c46ea37f8c847316885d38d 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/Foods.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
@@ -4,6 +4,9 @@ import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
|
||||
public class Foods {
|
||||
+ public static final java.util.Map<String, FoodProperties> ALL_PROPERTIES = new java.util.HashMap<>(); // Purpur
|
||||
+ public static final java.util.Map<String, FoodProperties> DEFAULT_PROPERTIES = new java.util.HashMap<>(); // Purpur
|
||||
+
|
||||
public static final FoodProperties APPLE = (new FoodProperties.Builder()).nutrition(4).saturationMod(0.3F).build();
|
||||
public static final FoodProperties BAKED_POTATO = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).build();
|
||||
public static final FoodProperties BEEF = (new FoodProperties.Builder()).nutrition(3).saturationMod(0.3F).meat().build();
|
||||
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
|
||||
index 513343d225a71e242b0f237eefcd25147709d9d1..1f65bba67cd4fab1dee115f24b213075c1d9c2a7 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/Items.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/Items.java
|
||||
@@ -1164,6 +1164,13 @@ public class Items {
|
||||
((BlockItem)item).registerBlocks(Item.BY_BLOCK, item);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (item.getFoodProperties() != null) {
|
||||
+ Foods.ALL_PROPERTIES.put(id.getPath(), item.getFoodProperties());
|
||||
+ Foods.DEFAULT_PROPERTIES.put(id.getPath(), item.getFoodProperties().copy());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return Registry.register(Registry.ITEM, id, item);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 9ea922b7b41b1805d94ea18f437dd52fd756a821..acf676c756ef6b99631f4fc8e0297548465c8fe0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -436,4 +436,57 @@ public class PurpurConfig {
|
||||
String setPattern = getString("settings.username-valid-characters", defaultPattern);
|
||||
usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
|
||||
}
|
||||
+
|
||||
+ private static void foodSettings() {
|
||||
+ ConfigurationSection properties = config.getConfigurationSection("settings.food-properties");
|
||||
+ if (properties == null) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "missing food properties...");
|
||||
+ config.addDefault("settings.food-properties", new HashMap<>());
|
||||
+ return;
|
||||
+ }
|
||||
+ properties.getKeys(false).forEach(foodKey -> {
|
||||
+ FoodProperties food = Foods.ALL_PROPERTIES.get(foodKey);
|
||||
+ if (food == null) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "Invalid food property: " + foodKey);
|
||||
+ return;
|
||||
+ }
|
||||
+ FoodProperties foodDefaults = Foods.DEFAULT_PROPERTIES.get(foodKey);
|
||||
+ food.setNutrition(properties.getInt(foodKey + ".nutrition", foodDefaults.getNutrition()));
|
||||
+ food.setSaturationModifier((float) properties.getDouble(foodKey + ".saturation-modifier", foodDefaults.getSaturationModifier()));
|
||||
+ food.setIsMeat(properties.getBoolean(foodKey + ".is-meat", foodDefaults.isMeat()));
|
||||
+ food.setCanAlwaysEat(properties.getBoolean(foodKey + ".can-always-eat", foodDefaults.canAlwaysEat()));
|
||||
+ food.setFastFood(properties.getBoolean(foodKey + ".fast-food", foodDefaults.isFastFood()));
|
||||
+ ConfigurationSection effects = properties.getConfigurationSection(foodKey + ".effects");
|
||||
+ if (effects != null) {
|
||||
+ Map<String, Object> effectDefaults = new HashMap<>();
|
||||
+ foodDefaults.getEffects().forEach(pair -> {
|
||||
+ effectDefaults.put("chance", pair.getSecond());
|
||||
+ MobEffectInstance effect = pair.getFirst();
|
||||
+ effectDefaults.put("duration", effect.getDuration());
|
||||
+ effectDefaults.put("amplifier", effect.getAmplifier());
|
||||
+ effectDefaults.put("ambient", effect.isAmbient());
|
||||
+ effectDefaults.put("visible", effect.isVisible());
|
||||
+ effectDefaults.put("show-icon", effect.showIcon());
|
||||
+ });
|
||||
+ effects.getKeys(false).forEach(effectKey -> {
|
||||
+ MobEffect effect = Registry.MOB_EFFECT.get(new ResourceLocation(effectKey));
|
||||
+ if (effect == null) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "Invalid food property effect for " + foodKey + ": " + effectKey);
|
||||
+ return;
|
||||
+ }
|
||||
+ food.getEffects().removeIf(pair -> pair.getFirst().getEffect() == effect);
|
||||
+ float chance = (float) effects.getDouble(effectKey + ".chance", ((Float) effectDefaults.get("chance")).doubleValue());
|
||||
+ int duration = effects.getInt(effectKey + ".duration", (int) effectDefaults.get("duration"));
|
||||
+ if (chance <= 0.0F || duration < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int amplifier = effects.getInt(effectKey + ".amplifier", (int) effectDefaults.get("amplifier"));
|
||||
+ boolean ambient = effects.getBoolean(effectKey + ".ambient", (boolean) effectDefaults.get("ambient"));
|
||||
+ boolean visible = effects.getBoolean(effectKey + ".visible", (boolean) effectDefaults.get("visible"));
|
||||
+ boolean showIcon = effects.getBoolean(effectKey + ".show-icon", (boolean) effectDefaults.get("show-icon"));
|
||||
+ food.getEffects().add(Pair.of(new MobEffectInstance(effect, duration, amplifier, ambient, visible, showIcon), chance));
|
||||
+ });
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Tue, 18 Jan 2022 06:35:54 -0600
|
||||
Subject: [PATCH] Max joins per second
|
||||
|
||||
When this option is set to true the `max-joins-per-tick` setting in paper.yml will be used per second instead of per tick
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 9bbf990212ee55a267d0eb1e863618c50fa706da..76d177d27735e93bbac5f9cf0b3556e929d72317 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -544,11 +544,20 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
private static final int MAX_PER_TICK = com.destroystokyo.paper.PaperConfig.maxJoinsPerTick; // Paper
|
||||
private static int joinAttemptsThisTick; // Paper
|
||||
private static int currTick; // Paper
|
||||
+ private static int tickSecond; // Purpur
|
||||
public void tick() {
|
||||
this.flushQueue();
|
||||
// Paper start
|
||||
if (currTick != MinecraftServer.currentTick) {
|
||||
currTick = MinecraftServer.currentTick;
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.maxJoinsPerSecond) {
|
||||
+ if (++tickSecond > 20) {
|
||||
+ tickSecond = 0;
|
||||
+ joinAttemptsThisTick = 0;
|
||||
+ }
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
joinAttemptsThisTick = 0;
|
||||
}
|
||||
// Paper end
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index acf676c756ef6b99631f4fc8e0297548465c8fe0..c8f9a0ac70840af6086f5ebd80066d43dccf8386 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -426,8 +426,10 @@ public class PurpurConfig {
|
||||
}
|
||||
|
||||
public static boolean useUPnP = false;
|
||||
+ public static boolean maxJoinsPerSecond = false;
|
||||
private static void networkSettings() {
|
||||
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
||||
+ maxJoinsPerSecond = getBoolean("settings.network.max-joins-per-second", maxJoinsPerSecond);
|
||||
}
|
||||
|
||||
public static java.util.regex.Pattern usernameValidCharactersPattern;
|
||||
@@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Totorewa <76272501+totorewa@users.noreply.github.com>
|
||||
Date: Fri, 7 Jan 2022 21:34:57 +1300
|
||||
Subject: [PATCH] Configurable minimum demand for trades
|
||||
|
||||
Addresses MC-163962 where villager demand decreases indefinitely. Paper
|
||||
adds a patch to fix this by preventing demand from going below zero.
|
||||
This patch adds a config option to allow the minimum demand to instead
|
||||
be configurable.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 6d43867d149b9ce5356d5ad1fbe119de1af212df..59bfaf90d448223c5aee9b18d2915539f54f0d4b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -534,7 +534,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
while (iterator.hasNext()) {
|
||||
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
|
||||
|
||||
- merchantrecipe.updateDemand();
|
||||
+ merchantrecipe.updateDemand(this.level.purpurConfig.villagerMinimumDemand); // Purpur
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
index c9cb0717c2793acd5b5870a6cc4d672d69a40026..9a402505375af2051673245ec0a1daf9f3a66dc7 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
@@ -132,7 +132,12 @@ public class MerchantOffer {
|
||||
}
|
||||
|
||||
public void updateDemand() {
|
||||
- this.demand = Math.max(0, this.demand + this.uses - (this.maxUses - this.uses)); // Paper
|
||||
+ // Purpur start
|
||||
+ this.updateDemand(0);
|
||||
+ }
|
||||
+ public void updateDemand(int minimumDemand) {
|
||||
+ this.demand = Math.max(minimumDemand, this.demand + this.uses - (this.maxUses - this.uses));
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
public ItemStack assemble() {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 1fd070e037b8bbd358ce162a011cddc1a565385c..e4e75914042b6e1024662ef59b2190865a879759 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2665,6 +2665,7 @@ public class PurpurWorldConfig {
|
||||
public boolean villagerTakeDamageFromWater = false;
|
||||
public boolean villagerAllowTrading = true;
|
||||
public boolean villagerAlwaysDropExp = false;
|
||||
+ public int villagerMinimumDemand = 0;
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
@@ -2689,6 +2690,7 @@ public class PurpurWorldConfig {
|
||||
villagerTakeDamageFromWater = getBoolean("mobs.villager.takes-damage-from-water", villagerTakeDamageFromWater);
|
||||
villagerAllowTrading = getBoolean("mobs.villager.allow-trading", villagerAllowTrading);
|
||||
villagerAlwaysDropExp = getBoolean("mobs.villager.always-drop-exp", villagerAlwaysDropExp);
|
||||
+ villagerMinimumDemand = getInt("mobs.villager.minimum-demand", villagerMinimumDemand);
|
||||
}
|
||||
|
||||
public boolean vindicatorRidable = false;
|
||||
@@ -1,143 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 3 Dec 2020 17:56:18 -0600
|
||||
Subject: [PATCH] Lobotomize stuck villagers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 59bfaf90d448223c5aee9b18d2915539f54f0d4b..b5db8212aa6b20fbaa8ea7dbcd14c9cc13460fe0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -140,6 +140,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
return villageplacetype == PoiType.MEETING;
|
||||
});
|
||||
private final int brainTickOffset; // Purpur
|
||||
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur
|
||||
+ private int notLobotomizedCount = 0; // Purpur
|
||||
|
||||
public long nextGolemPanic = -1; // Pufferfish
|
||||
|
||||
@@ -198,6 +200,47 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
protected boolean isAlwaysExperienceDropper() {
|
||||
return this.level.purpurConfig.villagerAlwaysDropExp;
|
||||
}
|
||||
+
|
||||
+ private boolean checkLobotomized() {
|
||||
+ int interval = this.level.purpurConfig.villagerLobotomizeCheckInterval;
|
||||
+ if (this.notLobotomizedCount > 3) {
|
||||
+ // check half as often if not lobotomized for the last 3+ consecutive checks
|
||||
+ interval *= 2;
|
||||
+ }
|
||||
+ if ((this.level.getGameTime() + brainTickOffset) % interval == 0) {
|
||||
+ // offset Y for short blocks like dirt_path/farmland
|
||||
+ this.isLobotomized = !canTravelFrom(new BlockPos(getX(), getY() + 0.0625D, getZ()));
|
||||
+
|
||||
+ if (this.isLobotomized) {
|
||||
+ this.notLobotomizedCount = 0;
|
||||
+ } else {
|
||||
+ this.notLobotomizedCount++;
|
||||
+ }
|
||||
+ }
|
||||
+ return this.isLobotomized;
|
||||
+ }
|
||||
+
|
||||
+ private boolean canTravelFrom(BlockPos pos) {
|
||||
+ return canTravelTo(pos.east()) || canTravelTo(pos.west()) || canTravelTo(pos.north()) || canTravelTo(pos.south());
|
||||
+ }
|
||||
+
|
||||
+ private boolean canTravelTo(BlockPos pos) {
|
||||
+ BlockState state = this.level.getBlockStateIfLoaded(pos);
|
||||
+ if (state == null) {
|
||||
+ // chunk not loaded
|
||||
+ return false;
|
||||
+ }
|
||||
+ net.minecraft.world.level.block.Block bottom = state.getBlock();
|
||||
+ if (bottom instanceof net.minecraft.world.level.block.FenceBlock ||
|
||||
+ bottom instanceof net.minecraft.world.level.block.FenceGateBlock ||
|
||||
+ bottom instanceof net.minecraft.world.level.block.WallBlock) {
|
||||
+ // bottom block is too tall to get over
|
||||
+ return false;
|
||||
+ }
|
||||
+ net.minecraft.world.level.block.Block top = level.getBlockState(pos.above()).getBlock();
|
||||
+ // only if both blocks have no collision
|
||||
+ return !bottom.hasCollision && !top.hasCollision;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -295,6 +338,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
protected void customServerAiStep() { mobTick(false); }
|
||||
protected void mobTick(boolean inactive) {
|
||||
this.level.getProfiler().push("villagerBrain");
|
||||
+ // Purpur start
|
||||
+ if (this.level.purpurConfig.villagerLobotomizeEnabled) {
|
||||
+ // treat as inactive if lobotomized
|
||||
+ inactive = inactive || checkLobotomized();
|
||||
+ } else {
|
||||
+ // clean up state for API
|
||||
+ this.isLobotomized = false;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
// Pufferfish start
|
||||
if (!inactive) {
|
||||
// Purpur start
|
||||
@@ -305,6 +357,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
this.getBrain().tick((ServerLevel) this.level, this); // Paper
|
||||
}
|
||||
// Pufferfish end
|
||||
+ // Purpur start
|
||||
+ else if (this.isLobotomized && shouldRestock()) {
|
||||
+ // make sure we restock if needed when lobotomized
|
||||
+ restock();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
this.level.getProfiler().pop();
|
||||
if (this.assignProfessionWhenSpawned) {
|
||||
this.assignProfessionWhenSpawned = false;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
||||
index f0b910df1ee471b4d72d97c6197ab14f2854976e..6ce32a52d621a0c2629568ea07e445f50160d97d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
||||
@@ -194,4 +194,11 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
||||
getHandle().getGossips().getReputations().clear();
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public boolean isLobotomized() {
|
||||
+ return getHandle().isLobotomized();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a5ec57fc61835e9dd69bc2222084e13018c459bb..2dc8f909431735aa31dd9ac93cba93dbab98b405 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2666,6 +2666,8 @@ public class PurpurWorldConfig {
|
||||
public boolean villagerAllowTrading = true;
|
||||
public boolean villagerAlwaysDropExp = false;
|
||||
public int villagerMinimumDemand = 0;
|
||||
+ public boolean villagerLobotomizeEnabled = false;
|
||||
+ public int villagerLobotomizeCheckInterval = 100;
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
@@ -2691,6 +2693,17 @@ public class PurpurWorldConfig {
|
||||
villagerAllowTrading = getBoolean("mobs.villager.allow-trading", villagerAllowTrading);
|
||||
villagerAlwaysDropExp = getBoolean("mobs.villager.always-drop-exp", villagerAlwaysDropExp);
|
||||
villagerMinimumDemand = getInt("mobs.villager.minimum-demand", villagerMinimumDemand);
|
||||
+ if (PurpurConfig.version < 9) {
|
||||
+ boolean oldValue = getBoolean("mobs.villager.lobotomize-1x1", villagerLobotomizeEnabled);
|
||||
+ set("mobs.villager.lobotomize.enabled", oldValue);
|
||||
+ set("mobs.villager.lobotomize-1x1", null);
|
||||
+ }
|
||||
+ if (PurpurConfig.version < 27) {
|
||||
+ int oldValue = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheckInterval);
|
||||
+ set("mobs.villager.lobotomize.check-interval", oldValue == 60 ? 100 : oldValue);
|
||||
+ }
|
||||
+ villagerLobotomizeEnabled = getBoolean("mobs.villager.lobotomize.enabled", villagerLobotomizeEnabled);
|
||||
+ villagerLobotomizeCheckInterval = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheckInterval);
|
||||
}
|
||||
|
||||
public boolean vindicatorRidable = false;
|
||||
@@ -1,38 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Tue, 25 Jan 2022 15:03:48 -0600
|
||||
Subject: [PATCH] Option for villager display trade item
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java
|
||||
index 385f3df7044e3f03f17c3ec7484b268004a3def9..47f9832bbba6f9c6038aa96022c28bf023977b78 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java
|
||||
@@ -42,6 +42,7 @@ public class ShowTradesToPlayer extends Behavior<Villager> {
|
||||
|
||||
@Override
|
||||
public boolean canStillUse(ServerLevel serverLevel, Villager villager, long l) {
|
||||
+ if (!villager.level.purpurConfig.villagerDisplayTradeItem) return false; // Purpur
|
||||
return this.checkExtraStartConditions(serverLevel, villager) && this.lookTime > 0 && villager.getBrain().getMemory(MemoryModuleType.INTERACTION_TARGET).isPresent();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 973cec1676fe533a8e4aa268aa15dda135d43367..ff2be61f790f39aae37794e7d7e4115073bfd716 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2668,6 +2668,7 @@ public class PurpurWorldConfig {
|
||||
public int villagerMinimumDemand = 0;
|
||||
public boolean villagerLobotomizeEnabled = false;
|
||||
public int villagerLobotomizeCheckInterval = 100;
|
||||
+ public boolean villagerDisplayTradeItem = true;
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
@@ -2704,6 +2705,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
villagerLobotomizeEnabled = getBoolean("mobs.villager.lobotomize.enabled", villagerLobotomizeEnabled);
|
||||
villagerLobotomizeCheckInterval = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheckInterval);
|
||||
+ villagerDisplayTradeItem = getBoolean("mobs.villager.display-trade-item", villagerDisplayTradeItem);
|
||||
}
|
||||
|
||||
public boolean vindicatorRidable = false;
|
||||
@@ -1,43 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Sat, 29 Jan 2022 19:39:44 -0600
|
||||
Subject: [PATCH] Fill command max area option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/FillCommand.java b/src/main/java/net/minecraft/server/commands/FillCommand.java
|
||||
index 5db7c22f3b2db4fc19af007ee45ad0e11fa5e9cb..9e80bcf237e8e968caa692ec386f7cc94023aba1 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/FillCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/FillCommand.java
|
||||
@@ -58,8 +58,10 @@ public class FillCommand {
|
||||
|
||||
private static int fillBlocks(CommandSourceStack source, BoundingBox range, BlockInput block, FillCommand.Mode mode, @Nullable Predicate<BlockInWorld> filter) throws CommandSyntaxException {
|
||||
int i = range.getXSpan() * range.getYSpan() * range.getZSpan();
|
||||
- if (i > 32768) {
|
||||
- throw ERROR_AREA_TOO_LARGE.create(32768, i);
|
||||
+ // Purpur start
|
||||
+ if (i > org.purpurmc.purpur.PurpurConfig.commandFillMaxArea) {
|
||||
+ throw ERROR_AREA_TOO_LARGE.create(org.purpurmc.purpur.PurpurConfig.commandFillMaxArea, i);
|
||||
+ // Purpur end
|
||||
} else {
|
||||
List<BlockPos> list = Lists.newArrayList();
|
||||
ServerLevel serverLevel = source.getLevel();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 231209f3ed97cd3dfa4fd3ccb9a84b234413107e..b291f3da1070e259a69a967156d4320e5a5aa0c8 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -271,6 +271,7 @@ public class PurpurConfig {
|
||||
public static float commandCompassBarProgressPercent = 1.0F;
|
||||
public static int commandCompassBarTickInterval = 5;
|
||||
public static boolean commandGamemodeRequiresPermission = false;
|
||||
+ public static int commandFillMaxArea = 32768;
|
||||
public static boolean hideHiddenPlayersFromEntitySelector = false;
|
||||
public static String uptimeFormat = "<days><hours><minutes><seconds>";
|
||||
public static String uptimeDay = "%02d day, ";
|
||||
@@ -300,6 +301,7 @@ public class PurpurConfig {
|
||||
commandCompassBarTickInterval = getInt("settings.command.compass.tick-interval", commandCompassBarTickInterval);
|
||||
|
||||
commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
||||
+ commandFillMaxArea = getInt("settings.command.fill.max-area", commandFillMaxArea);
|
||||
hideHiddenPlayersFromEntitySelector = getBoolean("settings.command.hide-hidden-players-from-entity-selector", hideHiddenPlayersFromEntitySelector);
|
||||
uptimeFormat = getString("settings.command.uptime.format", uptimeFormat);
|
||||
uptimeDay = getString("settings.command.uptime.day", uptimeDay);
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Sun, 30 Jan 2022 02:03:34 -0600
|
||||
Subject: [PATCH] MC-238526 - Fix spawner not spawning water animals correctly
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||
index c039b896ee85543c26a8ab76640080f539deaa4c..b79045402f490373d3d83d80aa8e3b94a2ac31ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||
@@ -83,6 +83,6 @@ public abstract class WaterAnimal extends PathfinderMob {
|
||||
i = world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight : i;
|
||||
j = world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight : j;
|
||||
// Paper end
|
||||
- return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER);
|
||||
+ return ((reason == MobSpawnType.SPAWNER && world.getMinecraftWorld().purpurConfig.spawnerFixMC238526) || (pos.getY() >= j && pos.getY() <= i)) && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER); // Purpur
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a138f2067d1f747ef35add78027cd2aa2f191bb2..69318c141b2b05ba22100232f0b637f3ed53b7b7 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -961,8 +961,10 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean spawnerDeactivateByRedstone = false;
|
||||
+ public boolean spawnerFixMC238526 = false;
|
||||
private void spawnerSettings() {
|
||||
spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
|
||||
+ spawnerFixMC238526 = getBoolean("blocks.spawner.fix-mc-238526", spawnerFixMC238526);
|
||||
}
|
||||
|
||||
public int spongeAbsorptionArea = 64;
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Tue, 8 Feb 2022 13:35:48 -0600
|
||||
Subject: [PATCH] Config for mob last hurt by player time
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 27877223340647049f432138caf62326182c8bbb..8bef96dd28ffb2de00a8d3c50f158d5e537516e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1418,13 +1418,13 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
if (entity1 instanceof net.minecraft.world.entity.player.Player) {
|
||||
- this.lastHurtByPlayerTime = 100;
|
||||
+ this.lastHurtByPlayerTime = this.level.purpurConfig.mobLastHurtByPlayerTime; // Purpur
|
||||
this.lastHurtByPlayer = (net.minecraft.world.entity.player.Player) entity1;
|
||||
} else if (entity1 instanceof Wolf) {
|
||||
Wolf entitywolf = (Wolf) entity1;
|
||||
|
||||
if (entitywolf.isTame()) {
|
||||
- this.lastHurtByPlayerTime = 100;
|
||||
+ this.lastHurtByPlayerTime = this.level.purpurConfig.mobLastHurtByPlayerTime; // Purpur
|
||||
LivingEntity entityliving = entitywolf.getOwner();
|
||||
|
||||
if (entityliving != null && entityliving.getType() == EntityType.PLAYER) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 7534889c4169cbd26f7e778cbd3be49bd2640c83..ca767d5a8ecb1d0c41ed149fd77eb2f49221c919 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -425,7 +425,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
ServerPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
|
||||
getHandle().lastHurtByPlayer = entityPlayer;
|
||||
getHandle().lastHurtByMob = entityPlayer;
|
||||
- getHandle().lastHurtByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
|
||||
+ getHandle().lastHurtByPlayerTime = entityPlayer == null ? 0 : getHandle().level.purpurConfig.mobLastHurtByPlayerTime; // 100 value taken from EntityLiving#damageEntity // Purpur
|
||||
}
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 69318c141b2b05ba22100232f0b637f3ed53b7b7..ce375eaefbed62233db7bf95e23cd1c1a650d711 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -136,6 +136,7 @@ public class PurpurWorldConfig {
|
||||
public boolean mobsIgnoreRails = false;
|
||||
public boolean rainStopsAfterSleep = true;
|
||||
public boolean thunderStopsAfterSleep = true;
|
||||
+ public int mobLastHurtByPlayerTime = 100;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
@@ -161,6 +162,7 @@ public class PurpurWorldConfig {
|
||||
mobsIgnoreRails = getBoolean("gameplay-mechanics.mobs-ignore-rails", mobsIgnoreRails);
|
||||
rainStopsAfterSleep = getBoolean("gameplay-mechanics.rain-stops-after-sleep", rainStopsAfterSleep);
|
||||
thunderStopsAfterSleep = getBoolean("gameplay-mechanics.thunder-stops-after-sleep", thunderStopsAfterSleep);
|
||||
+ mobLastHurtByPlayerTime = getInt("gameplay-mechanics.mob-last-hurt-by-player-time", mobLastHurtByPlayerTime);
|
||||
}
|
||||
|
||||
public int daytimeTicks = 12000;
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Sat, 12 Feb 2022 01:08:18 +0100
|
||||
Subject: [PATCH] Anvil repair/damage options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
|
||||
index 61cadc946954a1e92bd9b395b87dcb83eef786c4..e398366f2021554248fda62a7199670b467e7b53 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
|
||||
@@ -55,6 +55,54 @@ public class AnvilBlock extends FallingBlock {
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
+ // Purpur start - repairable/damageable anvils
|
||||
+ if (world.purpurConfig.anvilRepairIngotsAmount > 0) {
|
||||
+ net.minecraft.world.item.ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ if (itemstack.is(net.minecraft.world.item.Items.IRON_INGOT)) {
|
||||
+ if (itemstack.getCount() < world.purpurConfig.anvilRepairIngotsAmount) {
|
||||
+ // not enough iron ingots, play "error" sound and consume
|
||||
+ world.playSound(null, pos, net.minecraft.sounds.SoundEvents.ANVIL_HIT, net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ }
|
||||
+ if (state.is(Blocks.DAMAGED_ANVIL)) {
|
||||
+ world.setBlock(pos, Blocks.CHIPPED_ANVIL.defaultBlockState().setValue(FACING, state.getValue(FACING)), 3);
|
||||
+ } else if (state.is(Blocks.CHIPPED_ANVIL)) {
|
||||
+ world.setBlock(pos, Blocks.ANVIL.defaultBlockState().setValue(FACING, state.getValue(FACING)), 3);
|
||||
+ } else if (state.is(Blocks.ANVIL)) {
|
||||
+ // anvil is already fully repaired, play "error" sound and consume
|
||||
+ world.playSound(null, pos, net.minecraft.sounds.SoundEvents.ANVIL_HIT, net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ }
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(world.purpurConfig.anvilRepairIngotsAmount);
|
||||
+ }
|
||||
+ world.playSound(null, pos, net.minecraft.sounds.SoundEvents.ANVIL_PLACE, net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ }
|
||||
+ }
|
||||
+ if (world.purpurConfig.anvilDamageObsidianAmount > 0) {
|
||||
+ net.minecraft.world.item.ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ if (itemstack.is(net.minecraft.world.item.Items.OBSIDIAN)) {
|
||||
+ if (itemstack.getCount() < world.purpurConfig.anvilDamageObsidianAmount) {
|
||||
+ // not enough obsidian, play "error" sound and consume
|
||||
+ world.playSound(null, pos, net.minecraft.sounds.SoundEvents.ANVIL_HIT, net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ }
|
||||
+ if (state.is(Blocks.DAMAGED_ANVIL)) {
|
||||
+ world.destroyBlock(pos, false);
|
||||
+ } else if (state.is(Blocks.CHIPPED_ANVIL)) {
|
||||
+ world.setBlock(pos, Blocks.DAMAGED_ANVIL.defaultBlockState().setValue(FACING, state.getValue(FACING)), 3);
|
||||
+ } else if (state.is(Blocks.ANVIL)) {
|
||||
+ world.setBlock(pos, Blocks.CHIPPED_ANVIL.defaultBlockState().setValue(FACING, state.getValue(FACING)), 3);
|
||||
+ }
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(world.purpurConfig.anvilDamageObsidianAmount);
|
||||
+ }
|
||||
+ world.playSound(null, pos, net.minecraft.sounds.SoundEvents.ANVIL_LAND, net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
if (world.isClientSide) {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index ce375eaefbed62233db7bf95e23cd1c1a650d711..a9d88e8d33f8950f5bd19e7a2d763fbeabee12c8 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -699,8 +699,12 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean anvilAllowColors = false;
|
||||
+ public int anvilRepairIngotsAmount = 0;
|
||||
+ public int anvilDamageObsidianAmount = 0;
|
||||
private void anvilSettings() {
|
||||
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
||||
+ anvilRepairIngotsAmount = getInt("blocks.anvil.iron-ingots-used-for-repair", anvilRepairIngotsAmount);
|
||||
+ anvilDamageObsidianAmount = getInt("blocks.anvil.obsidian-used-for-damage", anvilDamageObsidianAmount);
|
||||
}
|
||||
|
||||
public double azaleaGrowthChance = 0.0D;
|
||||
@@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 21:00:02 -0500
|
||||
Subject: [PATCH] Fix legacy colors in console
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
|
||||
index ea83ee8762c126c449993a7497257b0bd8663452..ecd3da582fe9f77f39f920029f5121c6d8099525 100644
|
||||
--- a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
|
||||
+++ b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
|
||||
@@ -38,6 +38,7 @@ public final class HexFormattingConverter extends LogEventPatternConverter {
|
||||
private static final String ANSI_RESET = "\u001B[m";
|
||||
|
||||
private static final char COLOR_CHAR = 0x7f;
|
||||
+ private static final char LEGACY_CHAR = 0xa7; // Purpur
|
||||
public static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder()
|
||||
.hexColors()
|
||||
.flattener(PaperAdventure.FLATTENER)
|
||||
@@ -48,6 +49,8 @@ public final class HexFormattingConverter extends LogEventPatternConverter {
|
||||
private static final String RGB_ANSI = "\u001B[38;2;%d;%d;%dm";
|
||||
private static final Pattern NAMED_PATTERN = Pattern.compile(COLOR_CHAR + "[0-9a-fk-orA-FK-OR]");
|
||||
private static final Pattern RGB_PATTERN = Pattern.compile(COLOR_CHAR + "#([0-9a-fA-F]){6}");
|
||||
+ private static final Pattern LEGACY_RGB_PATTERN = Pattern.compile(LEGACY_CHAR + "x((" + LEGACY_CHAR + "[0-9a-fA-F]){6})"); // Purpur
|
||||
+ private static final Pattern LEGACY_PATTERN = Pattern.compile(LEGACY_CHAR + "([0-9a-fk-orxA-FK-ORX])"); // Purpur
|
||||
|
||||
private static final String[] RGB_ANSI_CODES = new String[]{
|
||||
formatHexAnsi(NamedTextColor.BLACK), // Black §0
|
||||
@@ -133,7 +136,21 @@ public final class HexFormattingConverter extends LogEventPatternConverter {
|
||||
}
|
||||
|
||||
private static String convertRGBColors(final String input) {
|
||||
- return RGB_PATTERN.matcher(input).replaceAll(result -> {
|
||||
+ // Purpur start - lets just shove this back in place
|
||||
+ Matcher matcher = LEGACY_RGB_PATTERN.matcher(input);
|
||||
+ StringBuilder buffer = new StringBuilder();
|
||||
+ while (matcher.find()) {
|
||||
+ String s = matcher.group().replace(String.valueOf(LEGACY_CHAR), "").replace('x', '#');
|
||||
+ int hex = Integer.decode(s);
|
||||
+ int red = (hex >> 16) & 0xFF;
|
||||
+ int green = (hex >> 8) & 0xFF;
|
||||
+ int blue = hex & 0xFF;
|
||||
+ String replacement = String.format(RGB_ANSI, red, green, blue);
|
||||
+ matcher.appendReplacement(buffer, replacement);
|
||||
+ }
|
||||
+ matcher.appendTail(buffer);
|
||||
+ return RGB_PATTERN.matcher(buffer.toString()).replaceAll(result -> {
|
||||
+ // Purpur end
|
||||
final int hex = Integer.decode(result.group().substring(1));
|
||||
return formatHexAnsi(hex);
|
||||
});
|
||||
@@ -151,10 +168,11 @@ public final class HexFormattingConverter extends LogEventPatternConverter {
|
||||
}
|
||||
|
||||
private static String stripRGBColors(final String input) {
|
||||
- return RGB_PATTERN.matcher(input).replaceAll("");
|
||||
+ return LEGACY_RGB_PATTERN.matcher(RGB_PATTERN.matcher(input).replaceAll("")).replaceAll(""); // Purpur
|
||||
}
|
||||
|
||||
static void format(String content, StringBuilder result, int start, boolean ansi) {
|
||||
+ content = LEGACY_PATTERN.matcher(content).replaceAll(COLOR_CHAR + "$1"); // Purpur
|
||||
int next = content.indexOf(COLOR_CHAR);
|
||||
int last = content.length() - 1;
|
||||
if (next == -1 || next == last) {
|
||||
@@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Mon, 9 May 2022 23:18:09 +0200
|
||||
Subject: [PATCH] Option to disable turtle egg trampling with feather falling
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
index 09438e86f7228336f6376118ec2476247f477841..8e6df41246c477a1b4a9159c458d0a34fe879ce5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
@@ -204,6 +204,10 @@ public class TurtleEggBlock extends Block {
|
||||
if (entity instanceof LivingEntity && !(entity instanceof Player)) {
|
||||
return world.purpurConfig.turtleEggsBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
}
|
||||
+ if (world.purpurConfig.turtleEggsTramplingFeatherFalling) {
|
||||
+ java.util.Iterator<ItemStack> armor = entity.getArmorSlots().iterator();
|
||||
+ return !armor.hasNext() || net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FALL_PROTECTION, armor.next()) < (int) entity.fallDistance;
|
||||
+ }
|
||||
return true;
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index a9d88e8d33f8950f5bd19e7a2d763fbeabee12c8..992a2e37fa093196165b67e88123e00100ae6208 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -992,12 +992,14 @@ public class PurpurWorldConfig {
|
||||
public boolean turtleEggsBreakFromMinecarts = true;
|
||||
public boolean turtleEggsBypassMobGriefing = false;
|
||||
public int turtleEggsRandomTickCrackChance = 500;
|
||||
+ public boolean turtleEggsTramplingFeatherFalling = false;
|
||||
private void turtleEggSettings() {
|
||||
turtleEggsBreakFromExpOrbs = getBoolean("blocks.turtle_egg.break-from-exp-orbs", turtleEggsBreakFromExpOrbs);
|
||||
turtleEggsBreakFromItems = getBoolean("blocks.turtle_egg.break-from-items", turtleEggsBreakFromItems);
|
||||
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
|
||||
turtleEggsBypassMobGriefing = getBoolean("blocks.turtle_egg.bypass-mob-griefing", turtleEggsBypassMobGriefing);
|
||||
turtleEggsRandomTickCrackChance = getInt("blocks.turtle_egg.random-tick-crack-chance", turtleEggsRandomTickCrackChance);
|
||||
+ turtleEggsTramplingFeatherFalling = getBoolean("blocks.turtle_egg.feather-fall-distance-affects-trampling", turtleEggsTramplingFeatherFalling);
|
||||
}
|
||||
|
||||
public int twistingVinesMaxGrowthAge = 25;
|
||||
@@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Sat, 30 Apr 2022 10:32:40 +0200
|
||||
Subject: [PATCH] Add toggle for enchant level clamping
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index a999e4c82d7fe0ecf127f9132c29886d56c444e5..7471e59ad3362bc3d0bad6555fe29a9bb9ad74a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -1151,7 +1151,7 @@ public final class ItemStack {
|
||||
|
||||
ListTag nbttaglist = this.tag.getList("Enchantments", 10);
|
||||
|
||||
- nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level));
|
||||
+ nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (org.purpurmc.purpur.PurpurConfig.clampEnchantLevels) ? (byte) level : (short) level)); // Purpur
|
||||
processEnchantOrder(this.tag); // Paper
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
index 5422b68674b34d015c94194a974726ea67d07e49..77ccd9e38d916d6ae08e230958134e1cc4443f9e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
@@ -45,7 +45,7 @@ public class EnchantmentHelper {
|
||||
}
|
||||
|
||||
public static int getEnchantmentLevel(CompoundTag nbt) {
|
||||
- return Mth.clamp(nbt.getInt("lvl"), 0, 255);
|
||||
+ return Mth.clamp(nbt.getInt("lvl"), 0, (org.purpurmc.purpur.PurpurConfig.clampEnchantLevels) ? 255 : 32767); // Purpur
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 659e93fb24124318367e5b4d0b144ca1443950e9..c5b18b8d4ad74764fdeb5a1e21231e212e808b99 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -378,6 +378,7 @@ public class PurpurConfig {
|
||||
public static boolean allowShearsLooting = false;
|
||||
public static boolean allowUnsafeEnchants = false;
|
||||
public static boolean allowUnsafeEnchantCommand = false;
|
||||
+ public static boolean clampEnchantLevels = true;
|
||||
private static void enchantmentSettings() {
|
||||
if (version < 5) {
|
||||
boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
|
||||
@@ -389,6 +390,7 @@ public class PurpurConfig {
|
||||
allowShearsLooting = getBoolean("settings.enchantment.allow-looting-on-shears", allowShearsLooting);
|
||||
allowUnsafeEnchants = getBoolean("settings.enchantment.allow-unsafe-enchants", allowUnsafeEnchants);
|
||||
allowUnsafeEnchantCommand = getBoolean("settings.enchantment.allow-unsafe-enchant-command", allowUnsafeEnchants); // allowUnsafeEnchants as default for backwards compatability
|
||||
+ clampEnchantLevels = getBoolean("settings.enchantment.clamp-levels", clampEnchantLevels);
|
||||
}
|
||||
|
||||
public static boolean endermanShortHeight = false;
|
||||
@@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: galacticwarrior9 <zareef1@yahoo.com>
|
||||
Date: Thu, 14 Apr 2022 17:48:07 +0100
|
||||
Subject: [PATCH] Config to prevent horses from standing when hurt
|
||||
|
||||
Horses have a chance to stand when their hurt noise plays (i.e. when taking damage).
|
||||
|
||||
This patch adds an option to toggle this behaviour ('stand-when-hurt').
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index f7088aaf65ee5725e928845a634852119b403cef..443d1bdb352352909a1d8859ae2eb93b4331f45f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -386,7 +386,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@Nullable
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource source) {
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ if (this.level.purpurConfig.horseStandWhenHurt && this.random.nextInt(3) == 0) { // Purpur
|
||||
this.stand();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 992a2e37fa093196165b67e88123e00100ae6208..aefbd3e53d3b608d58b6f051bc775eedb1edc397 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1686,6 +1686,7 @@ public class PurpurWorldConfig {
|
||||
public int horseBreedingTicks = 6000;
|
||||
public boolean horseTakeDamageFromWater = false;
|
||||
public boolean horseStandWithRider = true;
|
||||
+ public boolean horseStandWhenHurt = true;
|
||||
public boolean horseAlwaysDropExp = false;
|
||||
private void horseSettings() {
|
||||
horseRidableInWater = getBoolean("mobs.horse.ridable-in-water", horseRidableInWater);
|
||||
@@ -1705,6 +1706,7 @@ public class PurpurWorldConfig {
|
||||
horseBreedingTicks = getInt("mobs.horse.breeding-delay-ticks", horseBreedingTicks);
|
||||
horseTakeDamageFromWater = getBoolean("mobs.horse.takes-damage-from-water", horseTakeDamageFromWater);
|
||||
horseStandWithRider = getBoolean("mobs.horse.stand-with-rider", horseStandWithRider);
|
||||
+ horseStandWhenHurt = getBoolean("mobs.horse.stand-when-hurt", horseStandWhenHurt);
|
||||
horseAlwaysDropExp = getBoolean("mobs.horse.always-drop-exp", horseAlwaysDropExp);
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Thu, 2 Jun 2022 13:54:19 -0400
|
||||
Subject: [PATCH] Drop incompatible tests
|
||||
|
||||
|
||||
diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
|
||||
deleted file mode 100644
|
||||
index e80f8a32c82f89a2f898db1d869daadee735176f..0000000000000000000000000000000000000000
|
||||
--- a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
|
||||
+++ /dev/null
|
||||
@@ -1,84 +0,0 @@
|
||||
-package io.papermc.paper.permissions;
|
||||
-
|
||||
-import com.mojang.brigadier.tree.CommandNode;
|
||||
-import com.mojang.brigadier.tree.RootCommandNode;
|
||||
-import net.minecraft.commands.CommandSourceStack;
|
||||
-import net.minecraft.commands.Commands;
|
||||
-import net.minecraft.server.Bootstrap;
|
||||
-import org.bukkit.Bukkit;
|
||||
-import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
||||
-import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
||||
-import org.bukkit.permissions.Permission;
|
||||
-import org.bukkit.support.AbstractTestingBase;
|
||||
-import org.junit.AfterClass;
|
||||
-import org.junit.BeforeClass;
|
||||
-import org.junit.Test;
|
||||
-
|
||||
-import java.io.PrintStream;
|
||||
-import java.util.HashSet;
|
||||
-import java.util.LinkedHashSet;
|
||||
-import java.util.List;
|
||||
-import java.util.Set;
|
||||
-import java.util.TreeSet;
|
||||
-
|
||||
-import static org.junit.Assert.assertTrue;
|
||||
-
|
||||
-public class MinecraftCommandPermissionsTest extends AbstractTestingBase {
|
||||
-
|
||||
- private static PrintStream old;
|
||||
- @BeforeClass
|
||||
- public static void before() {
|
||||
- old = System.out;
|
||||
- System.setOut(Bootstrap.STDOUT);
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void test() {
|
||||
- CraftDefaultPermissions.registerCorePermissions();
|
||||
- Set<String> perms = collectMinecraftCommandPerms();
|
||||
-
|
||||
- Commands commands = new Commands(Commands.CommandSelection.DEDICATED);
|
||||
- RootCommandNode<CommandSourceStack> root = commands.getDispatcher().getRoot();
|
||||
- Set<String> missing = new LinkedHashSet<>();
|
||||
- Set<String> foundPerms = new HashSet<>();
|
||||
- for (CommandNode<CommandSourceStack> child : root.getChildren()) {
|
||||
- final String vanillaPerm = VanillaCommandWrapper.getPermission(child);
|
||||
- if (!perms.contains(vanillaPerm)) {
|
||||
- missing.add("Missing permission for " + child.getName() + " (" + vanillaPerm + ") command");
|
||||
- } else {
|
||||
- foundPerms.add(vanillaPerm);
|
||||
- }
|
||||
- }
|
||||
- assertTrue("Commands missing permissions: \n" + String.join("\n", missing), missing.isEmpty());
|
||||
- perms.removeAll(foundPerms);
|
||||
- assertTrue("Extra permissions not associated with a command: \n" + String.join("\n", perms), perms.isEmpty());
|
||||
- }
|
||||
-
|
||||
- private static final List<String> TO_SKIP = List.of(
|
||||
- "minecraft.command.selector"
|
||||
- );
|
||||
-
|
||||
- private static Set<String> collectMinecraftCommandPerms() {
|
||||
- Set<String> perms = new TreeSet<>();
|
||||
- for (Permission perm : Bukkit.getPluginManager().getPermissions()) {
|
||||
- if (perm.getName().startsWith("minecraft.command.")) {
|
||||
- if (TO_SKIP.contains(perm.getName())) {
|
||||
- continue;
|
||||
- }
|
||||
- if (perm.getName().endsWith(".xp")) {
|
||||
- perms.add("minecraft.command.experience"); // for the "experience" command, craftbukkit perm is "minecraft.command.xp"
|
||||
- continue;
|
||||
- }
|
||||
- perms.add(perm.getName());
|
||||
- }
|
||||
- }
|
||||
- return perms;
|
||||
- }
|
||||
-
|
||||
- @AfterClass
|
||||
- public static void after() {
|
||||
- if (old != null) {
|
||||
- System.setOut(old);
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
Reference in New Issue
Block a user