mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
all but 3
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 4 Jun 2021 09:13:54 -0500
|
||||
Subject: [PATCH] Add toggle for sand duping fix
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 8336ea928faa92c6f58f8cdfb9faf1d8e26c9ccf..c765c182081fe83eb0f30dcbf97d812681236bc6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -107,7 +107,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@Override
|
||||
public void tick() {
|
||||
// Paper start - fix sand duping
|
||||
- if (this.isRemoved()) {
|
||||
+ if (this.level.purpurConfig.fixSandDuping && this.isRemoved()) { // Purpur
|
||||
return;
|
||||
}
|
||||
// Paper end - fix sand duping
|
||||
@@ -144,7 +144,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
|
||||
// Paper start - fix sand duping
|
||||
- if (this.isRemoved()) {
|
||||
+ if (this.level.purpurConfig.fixSandDuping && this.isRemoved()) { // Purpur
|
||||
return;
|
||||
}
|
||||
// Paper end - fix sand duping
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 143253d4b16cec33359723b65d1b6ae89e13525a..8efb4959efef67e650a1344e299bb01984e884e4 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -722,6 +722,11 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean fixSandDuping = true;
|
||||
+ private void sandSettings() {
|
||||
+ fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping);
|
||||
+ }
|
||||
+
|
||||
public boolean shulkerBoxAllowOversizedStacks = false;
|
||||
private void shulkerBoxSettings() {
|
||||
shulkerBoxAllowOversizedStacks = getBoolean("blocks.shulker_box.allow-oversized-stacks", shulkerBoxAllowOversizedStacks);
|
||||
@@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Wed, 9 Jun 2021 11:03:40 -0500
|
||||
Subject: [PATCH] Add toggle for end portal safe teleporting
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 451a5f43b745daa0820d9e483dfb5bcb13b88013..b375c8654787fc287304416b03ab84d044fec5c9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2767,7 +2767,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
}
|
||||
|
||||
this.processPortalCooldown();
|
||||
- this.tickEndPortal(); // Paper - make end portalling safe
|
||||
+ if (this.level.purpurConfig.endPortalSafeTeleporting) this.tickEndPortal(); // Paper - make end portalling safe // Purpur
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
index 197482e1ace23c3de002242097a68c6cc297cd3f..428875a6a99a619d337e2a7bbd2cb1828ca11d04 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
@@ -61,6 +61,22 @@ public class EndPortalBlock extends BaseEntityBlock {
|
||||
// return; // CraftBukkit - always fire event in case plugins wish to change it
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (!world.purpurConfig.endPortalSafeTeleporting) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (entity instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ entity.changeDimension(worldserver);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
// Paper start - move all of this logic into portal tick
|
||||
entity.portalWorld = ((ServerLevel)world);
|
||||
entity.portalBlock = pos.immutable();
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 8efb4959efef67e650a1344e299bb01984e884e4..7ac4ae0d7614bb0e8b6e221fa75a871af9280b21 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -657,6 +657,11 @@ public class PurpurWorldConfig {
|
||||
furnaceUseLavaFromUnderneath = getBoolean("blocks.furnace.use-lava-from-underneath", furnaceUseLavaFromUnderneath);
|
||||
}
|
||||
|
||||
+ public boolean endPortalSafeTeleporting = true;
|
||||
+ private void endPortalSettings() {
|
||||
+ endPortalSafeTeleporting = getBoolean("blocks.end_portal.safe-teleporting", endPortalSafeTeleporting);
|
||||
+ }
|
||||
+
|
||||
public boolean snowOnBlueIce = true;
|
||||
public boolean mobsSpawnOnPackedIce = true;
|
||||
public boolean mobsSpawnOnBlueIce = true;
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TreyRuffy <TreyRuffy@users.noreply.github.com>
|
||||
Date: Wed, 9 Jun 2021 16:31:14 -0600
|
||||
Subject: [PATCH] Flying Fall Damage API
|
||||
|
||||
|
||||
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 0c0d4ec5893f082a8b4071a627a64c7b88fd0067..3b5c1bf87268dc10719c3f8e3e8c105fa7177b9f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -182,6 +182,7 @@ public abstract class Player extends LivingEntity {
|
||||
// Paper start
|
||||
public boolean affectsSpawning = true;
|
||||
// Paper end
|
||||
+ public boolean flyingFallDamage = false; // Purpur
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
@@ -1727,7 +1728,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
|
||||
- if (this.abilities.mayfly) {
|
||||
+ if (this.abilities.mayfly && !flyingFallDamage) { // Purpur
|
||||
return false;
|
||||
} else {
|
||||
if (fallDistance >= 2.0F) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 2fe84d9d7b0a829baefdb9fad7ba02d336ba5254..f93887579837a9cfc6699c0b481ac60f16a31770 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2628,5 +2628,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setSpawnInvulnerableTicks(int spawnInvulnerableTime) {
|
||||
getHandle().spawnInvulnerableTime = spawnInvulnerableTime;
|
||||
}
|
||||
+
|
||||
+ public void setFlyingFallDamage(boolean flyingFallDamage) {
|
||||
+ getHandle().flyingFallDamage = flyingFallDamage;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasFlyingFallDamage() {
|
||||
+ return getHandle().flyingFallDamage;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Wed, 23 Jun 2021 13:36:20 +0200
|
||||
Subject: [PATCH] Make lightning rod range configurable
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 9c44609b3258168e0a38111cfba5c16b999bec4e..f969c706e47a9613fdc892f92c05ddb054164310 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -997,7 +997,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return villageplacetype == PoiType.LIGHTNING_ROD;
|
||||
}, (blockposition1) -> {
|
||||
return blockposition1.getY() == this.getLevel().getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1;
|
||||
- }, pos, 128, PoiManager.Occupancy.ANY);
|
||||
+ }, pos, net.pl3x.purpur.PurpurConfig.lightningRodRange, PoiManager.Occupancy.ANY);
|
||||
|
||||
return optional.map((blockposition1) -> {
|
||||
return blockposition1.above(1);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 197ceea9fa314ebe1d0af4eeeeb4926a79a08954..942c45e53e3458271bd2e8e2a86e5b31e2de90d3 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -258,6 +258,7 @@ public class PurpurConfig {
|
||||
public static boolean cryingObsidianValidForPortalFrame = false;
|
||||
public static int beeInsideBeeHive = 3;
|
||||
public static boolean anvilCumulativeCost = true;
|
||||
+ public static int lightningRodRange = 128;
|
||||
private static void blockSettings() {
|
||||
if (version < 3) {
|
||||
boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
|
||||
@@ -291,6 +292,7 @@ public class PurpurConfig {
|
||||
cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean allowInfinityMending = false;
|
||||
@@ -1,76 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 24 Jun 2021 21:19:30 -0500
|
||||
Subject: [PATCH] Burp after eating food fills hunger bar completely
|
||||
|
||||
|
||||
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 3b5c1bf87268dc10719c3f8e3e8c105fa7177b9f..ffa4b28ffee3a0429cc350777234345f9cefe9f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -195,6 +195,8 @@ public abstract class Player extends LivingEntity {
|
||||
// CraftBukkit end
|
||||
|
||||
// Purpur start
|
||||
+ public int burpCooldown = 0;
|
||||
+
|
||||
public abstract void resetLastActionTime();
|
||||
|
||||
public void setAfk(boolean afk) {
|
||||
@@ -257,6 +259,12 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ // Purpur start
|
||||
+ if (this.burpCooldown > 0 && --this.burpCooldown == 0) {
|
||||
+ this.level.playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level.random.nextFloat() * 0.1F + 0.9F);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
this.noPhysics = this.isSpectator();
|
||||
if (this.isSpectator()) {
|
||||
this.onGround = false;
|
||||
@@ -2342,7 +2350,7 @@ public abstract class Player extends LivingEntity {
|
||||
public ItemStack eat(Level world, ItemStack stack) {
|
||||
this.getFoodData().eat(stack.getItem(), stack);
|
||||
this.awardStat(Stats.ITEM_USED.get(stack.getItem()));
|
||||
- world.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
+ // world.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Purpur - moved to tick()
|
||||
if (this instanceof ServerPlayer) {
|
||||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) this, stack);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index 97133bd4af30d0ba92cbf884b83140f3399f92e2..c1130952e3fa22abaa27fcc1c4761c831dc56cc3 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -34,8 +34,10 @@ public class FoodData {
|
||||
// CraftBukkit end
|
||||
|
||||
public void eat(int food, float saturationModifier) {
|
||||
+ int oldValue = this.foodLevel; // Purpur
|
||||
this.foodLevel = Math.min(food + this.foodLevel, 20);
|
||||
this.saturationLevel = Math.min(this.saturationLevel + (float) food * saturationModifier * 2.0F, (float) this.foodLevel);
|
||||
+ if (this.entityhuman.level.purpurConfig.playerBurpWhenFull && this.foodLevel == 20 && oldValue < 20) this.entityhuman.burpCooldown = 10; // Purpur
|
||||
}
|
||||
|
||||
public void eat(Item item, ItemStack stack) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 7ac4ae0d7614bb0e8b6e221fa75a871af9280b21..87d4412a8cb4cac1d112436981d9df7c7314d6de 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -342,6 +342,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerSleepNearMonsters = false;
|
||||
public boolean playersSkipNight = true;
|
||||
public double playerCriticalDamageMultiplier = 1.5D;
|
||||
+ public boolean playerBurpWhenFull = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -364,6 +365,7 @@ public class PurpurWorldConfig {
|
||||
playerSleepNearMonsters = getBoolean("gameplay-mechanics.player.sleep-ignore-nearby-mobs", playerSleepNearMonsters);
|
||||
playersSkipNight = getBoolean("gameplay-mechanics.player.can-skip-night", playersSkipNight);
|
||||
playerCriticalDamageMultiplier = getDouble("gameplay-mechanics.player.critical-damage-multiplier", playerCriticalDamageMultiplier);
|
||||
+ playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Thu, 24 Jun 2021 02:28:32 +0200
|
||||
Subject: [PATCH] Allow player join full server by permission
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 4baeaf922b8529e7fb4a44fff9428a77e2ea78de..e3dadb8ad7d1f4154ae56fbc0129b64617aacf8a 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -764,7 +764,7 @@ public abstract class PlayerList {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure
|
||||
} else {
|
||||
// return this.players.size() >= this.maxPlayers && !this.d(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
- if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) {
|
||||
+ if (this.players.size() >= this.maxPlayers && (!player.hasPermission("purpur.joinfullserver") || !this.canBypassPlayerLimit(gameprofile))) { // Purpur
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_FULL, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 26 Jun 2021 23:05:12 -0500
|
||||
Subject: [PATCH] Add permission bypass for portal waiting
|
||||
|
||||
|
||||
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 ffa4b28ffee3a0429cc350777234345f9cefe9f6..e6c429b2afc2f45ffbe4c8dcf1a4b4955626ee86 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -183,6 +183,7 @@ public abstract class Player extends LivingEntity {
|
||||
public boolean affectsSpawning = true;
|
||||
// Paper end
|
||||
public boolean flyingFallDamage = false; // Purpur
|
||||
+ public boolean canPortalInstant = false; // Purpur
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
@@ -464,7 +465,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public int getPortalWaitTime() {
|
||||
- return this.abilities.invulnerable ? 1 : 80;
|
||||
+ return this.abilities.invulnerable || canPortalInstant ? 1 : 80; // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index 7c7d05852dd463331110d1dcb71b4d4f5312900f..5939aeff08fd1216c53f3af15362dddfa1e207c9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -245,6 +245,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
@Override
|
||||
public void recalculatePermissions() {
|
||||
this.perm.recalculatePermissions();
|
||||
+ getHandle().canPortalInstant = hasPermission("purpur.portal.instant"); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,90 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 25 Jun 2021 19:48:21 -0500
|
||||
Subject: [PATCH] Shulker spawn from bullet options
|
||||
|
||||
(0 - 1) / 5.0 = -0.2 (can never happen because self is included in count)
|
||||
(1 - 1) / 5.0 = 0.0 1.0 - 0.0 = 1.0 100% (just self)
|
||||
(2 - 1) / 5.0 = 0.2 1.0 - 0.2 = 0.8 80% (1 other shulker)
|
||||
(3 - 1) / 5.0 = 0.4 1.0 - 0.4 = 0.6 60% (2 other shulkers)
|
||||
(4 - 1) / 5.0 = 0.6 1.0 - 0.6 = 0.4 40% (3 other shulkers)
|
||||
(5 - 1) / 5.0 = 0.8 1.0 - 0.8 = 0.2 20% (4 other shulkers)
|
||||
(6 - 1) / 5.0 = 1.0 1.0 - 1.0 = 0.0 0% (5 other shulkers)
|
||||
(7 - 1) / 5.0 = 1.2 1.0 - 1.2 = -0.2 0% (6 other shulkers)
|
||||
|
||||
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 23b038d4cca101313303299779ca50be7a596d27..06c6be23da8d1090aed33f48fc0bbbe442a974b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -501,13 +501,22 @@ public class Shulker extends AbstractGolem implements Enemy {
|
||||
Vec3 vec3d = this.position();
|
||||
AABB axisalignedbb = this.getBoundingBox();
|
||||
|
||||
- if (!this.isClosed() && this.teleportSomewhere()) {
|
||||
- int i = this.level.getEntities((EntityTypeTest) EntityType.SHULKER, axisalignedbb.inflate(8.0D), Entity::isAlive).size();
|
||||
- float f = (float) (i - 1) / 5.0F;
|
||||
-
|
||||
- if (this.level.random.nextFloat() >= f) {
|
||||
+ if ((!this.level.purpurConfig.shulkerSpawnFromBulletRequireOpenLid || !this.isClosed()) && this.teleportSomewhere()) {
|
||||
+ // Purpur start
|
||||
+ float chance = this.level.purpurConfig.shulkerSpawnFromBulletBaseChance;
|
||||
+ if (!this.level.purpurConfig.shulkerSpawnFromBulletNearbyEquation.isBlank()) {
|
||||
+ int nearby = this.level.getEntities((EntityTypeTest) EntityType.SHULKER, axisalignedbb.inflate(this.level.purpurConfig.shulkerSpawnFromBulletNearbyRange), Entity::isAlive).size();
|
||||
+ try {
|
||||
+ scriptEngine.eval("nearby = " + nearby);
|
||||
+ chance -= (float) scriptEngine.eval(this.level.purpurConfig.shulkerSpawnFromBulletNearbyEquation);
|
||||
+ } catch (Exception ignore) {
|
||||
+ chance -= (float) (nearby - 1) / 5.0F;
|
||||
+ }
|
||||
+ }
|
||||
+ if (this.level.random.nextFloat() <= chance) {
|
||||
+ // Purpur end
|
||||
Shulker entityshulker = (Shulker) EntityType.SHULKER.create(this.level);
|
||||
- DyeColor enumcolor = this.getColor();
|
||||
+ DyeColor enumcolor = this.level.purpurConfig.shulkerSpawnFromBulletRandomColor ? DyeColor.random(this.level.random) : this.getColor(); // Purpur
|
||||
|
||||
if (enumcolor != null) {
|
||||
entityshulker.setColor(enumcolor);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/DyeColor.java b/src/main/java/net/minecraft/world/item/DyeColor.java
|
||||
index f812a75985d26785639491c9a980387a3f261f2d..b11fb39b69f5225ca7da72ca1a2200c7eaf7e873 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/DyeColor.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/DyeColor.java
|
||||
@@ -109,4 +109,10 @@ public enum DyeColor implements StringRepresentable {
|
||||
public String getSerializedName() {
|
||||
return this.name;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public static DyeColor random(java.util.Random random) {
|
||||
+ return BY_ID[random.nextInt(BY_ID.length)];
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 87d4412a8cb4cac1d112436981d9df7c7314d6de..297f7c068e0af8c65f7cc33e8731bd595b95bacf 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1834,6 +1834,11 @@ public class PurpurWorldConfig {
|
||||
public boolean shulkerRidableInWater = false;
|
||||
public double shulkerMaxHealth = 30.0D;
|
||||
public boolean shulkerTakeDamageFromWater = false;
|
||||
+ public float shulkerSpawnFromBulletBaseChance = 1.0F;
|
||||
+ public boolean shulkerSpawnFromBulletRequireOpenLid = true;
|
||||
+ public double shulkerSpawnFromBulletNearbyRange = 8.0D;
|
||||
+ public String shulkerSpawnFromBulletNearbyEquation = "(nearby - 1) / 5.0";
|
||||
+ public boolean shulkerSpawnFromBulletRandomColor = false;
|
||||
private void shulkerSettings() {
|
||||
shulkerRidable = getBoolean("mobs.shulker.ridable", shulkerRidable);
|
||||
shulkerRidableInWater = getBoolean("mobs.shulker.ridable-in-water", shulkerRidableInWater);
|
||||
@@ -1844,6 +1849,11 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
shulkerMaxHealth = getDouble("mobs.shulker.attributes.max_health", shulkerMaxHealth);
|
||||
shulkerTakeDamageFromWater = getBoolean("mobs.shulker.takes-damage-from-water", shulkerTakeDamageFromWater);
|
||||
+ shulkerSpawnFromBulletBaseChance = (float) getDouble("mobs.shulker.spawn-from-bullet.base-chance", shulkerSpawnFromBulletBaseChance);
|
||||
+ shulkerSpawnFromBulletRequireOpenLid = getBoolean("mobs.shulker.spawn-from-bullet.require-open-lid", shulkerSpawnFromBulletRequireOpenLid);
|
||||
+ 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);
|
||||
}
|
||||
|
||||
public boolean silverfishRidable = false;
|
||||
@@ -1,71 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 28 Jun 2021 14:07:35 -0500
|
||||
Subject: [PATCH] Eating glow berries adds glow effect
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
|
||||
index 89d4b7e4cd4222b61b49833fceda56ffa39710fa..1eb50f0bc41db79f091f900861ba71d702a5bd2a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/Items.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/Items.java
|
||||
@@ -1069,7 +1069,7 @@ public class Items {
|
||||
public static final Item LANTERN = registerBlock(Blocks.LANTERN, CreativeModeTab.TAB_DECORATIONS);
|
||||
public static final Item SOUL_LANTERN = registerBlock(Blocks.SOUL_LANTERN, CreativeModeTab.TAB_DECORATIONS);
|
||||
public static final Item SWEET_BERRIES = registerItem("sweet_berries", new ItemNameBlockItem(Blocks.SWEET_BERRY_BUSH, (new Item.Properties()).tab(CreativeModeTab.TAB_FOOD).food(Foods.SWEET_BERRIES)));
|
||||
- public static final Item GLOW_BERRIES = registerItem("glow_berries", new ItemNameBlockItem(Blocks.CAVE_VINES, (new Item.Properties()).food(Foods.GLOW_BERRIES).tab(CreativeModeTab.TAB_FOOD)));
|
||||
+ public static final Item GLOW_BERRIES = registerItem("glow_berries", new net.pl3x.purpur.item.GlowBerryItem(Blocks.CAVE_VINES, (new Item.Properties()).food(Foods.GLOW_BERRIES).tab(CreativeModeTab.TAB_FOOD))); // Purpur
|
||||
public static final Item CAMPFIRE = registerBlock(Blocks.CAMPFIRE, CreativeModeTab.TAB_DECORATIONS);
|
||||
public static final Item SOUL_CAMPFIRE = registerBlock(Blocks.SOUL_CAMPFIRE, CreativeModeTab.TAB_DECORATIONS);
|
||||
public static final Item SHROOMLIGHT = registerBlock(Blocks.SHROOMLIGHT, CreativeModeTab.TAB_DECORATIONS);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 297f7c068e0af8c65f7cc33e8731bd595b95bacf..a4a1befc72efb329d5b6edec620a8a4a8bc92d74 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -174,6 +174,7 @@ public class PurpurWorldConfig {
|
||||
public int enderPearlCooldown = 20;
|
||||
public int enderPearlCooldownCreative = 20;
|
||||
public float enderPearlEndermiteChance = 0.05F;
|
||||
+ public int glowBerriesEatGlowDuration = 0;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -217,6 +218,7 @@ public class PurpurWorldConfig {
|
||||
enderPearlCooldown = getInt("gameplay-mechanics.item.ender-pearl.cooldown", enderPearlCooldown);
|
||||
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);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/item/GlowBerryItem.java b/src/main/java/net/pl3x/purpur/item/GlowBerryItem.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d45a39afbef10ae6888e2941faa4b9769ab4a832
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/item/GlowBerryItem.java
|
||||
@@ -0,0 +1,26 @@
|
||||
+package net.pl3x.purpur.item;
|
||||
+
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.effect.MobEffectInstance;
|
||||
+import net.minecraft.world.effect.MobEffects;
|
||||
+import net.minecraft.world.entity.LivingEntity;
|
||||
+import net.minecraft.world.item.ItemNameBlockItem;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
+
|
||||
+public class GlowBerryItem extends ItemNameBlockItem {
|
||||
+ public GlowBerryItem(Block block, Properties settings) {
|
||||
+ super(block, settings);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) {
|
||||
+ ItemStack result = super.finishUsingItem(stack, world, user);
|
||||
+ if (world.purpurConfig.glowBerriesEatGlowDuration > 0 && user instanceof ServerPlayer player) {
|
||||
+ player.addEffect(new MobEffectInstance(MobEffects.GLOWING, world.purpurConfig.glowBerriesEatGlowDuration), EntityPotionEffectEvent.Cause.FOOD);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,55 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 12emin34 <macanovic.emin@gmail.com>
|
||||
Date: Fri, 25 Jun 2021 13:56:15 +0200
|
||||
Subject: [PATCH] Option to make drowned break doors
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
index 729b4a414918b1f74c225e15b5c41dc0db2a9f5b..c69cf2d2778d73f6834208d20e5e0b1502a905c8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.world.entity.ai.goal.MoveToBlockGoal;
|
||||
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
|
||||
import net.minecraft.world.entity.ai.goal.RangedAttackGoal;
|
||||
import net.minecraft.world.entity.ai.goal.ZombieAttackGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
@@ -118,6 +119,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
this.goalSelector.addGoal(2, new Drowned.DrownedAttackGoal(this, 1.0D, false));
|
||||
this.goalSelector.addGoal(5, new Drowned.DrownedGoToBeachGoal(this, 1.0D));
|
||||
this.goalSelector.addGoal(6, new Drowned.DrownedSwimUpGoal(this, 1.0D, this.level.getSeaLevel()));
|
||||
+ if (level.purpurConfig.drownedBreakDoors) this.goalSelector.addGoal(6, new MoveThroughVillageGoal(this, 1.0D, true, 4, this::canBreakDoors));
|
||||
this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0D));
|
||||
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, Drowned.class)).setAlertOthers(ZombifiedPiglin.class));
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));
|
||||
@@ -166,7 +168,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
|
||||
@Override
|
||||
public boolean supportsBreakDoorGoal() {
|
||||
- return false;
|
||||
+ return level.purpurConfig.drownedBreakDoors ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index a4a1befc72efb329d5b6edec620a8a4a8bc92d74..31ba21490a9e645e679f88e7e801f0b3928d83e9 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1065,6 +1065,7 @@ public class PurpurWorldConfig {
|
||||
public double drownedJockeyChance = 0.05D;
|
||||
public boolean drownedJockeyTryExistingChickens = true;
|
||||
public boolean drownedTakeDamageFromWater = false;
|
||||
+ public boolean drownedBreakDoors = false;
|
||||
private void drownedSettings() {
|
||||
drownedRidable = getBoolean("mobs.drowned.ridable", drownedRidable);
|
||||
drownedRidableInWater = getBoolean("mobs.drowned.ridable-in-water", drownedRidableInWater);
|
||||
@@ -1079,6 +1080,7 @@ public class PurpurWorldConfig {
|
||||
drownedJockeyChance = getDouble("mobs.drowned.jockey.chance", drownedJockeyChance);
|
||||
drownedJockeyTryExistingChickens = getBoolean("mobs.drowned.jockey.try-existing-chickens", drownedJockeyTryExistingChickens);
|
||||
drownedTakeDamageFromWater = getBoolean("mobs.drowned.takes-damage-from-water", drownedTakeDamageFromWater);
|
||||
+ drownedBreakDoors = getBoolean("mobs.drowned.can-break-doors", drownedBreakDoors);
|
||||
}
|
||||
|
||||
public boolean elderGuardianRidable = false;
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 29 Jun 2021 23:44:36 -0400
|
||||
Subject: [PATCH] Configurable hunger starvation damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index c1130952e3fa22abaa27fcc1c4761c831dc56cc3..1ac08eca469739cb52abd38483c431b63b7f84a2 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -103,7 +103,7 @@ public class FoodData {
|
||||
++this.tickTimer;
|
||||
if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
|
||||
if (player.getHealth() > 10.0F || enumdifficulty == Difficulty.HARD || player.getHealth() > 1.0F && enumdifficulty == Difficulty.NORMAL) {
|
||||
- player.hurt(DamageSource.STARVE, 1.0F);
|
||||
+ player.hurt(DamageSource.STARVE, player.level.purpurConfig.hungerStarvationDamage); // Purpur
|
||||
}
|
||||
|
||||
this.tickTimer = 0;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 31ba21490a9e645e679f88e7e801f0b3928d83e9..07cd83c76b34c6d02dd375292ac5fc3edd5f4491 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2432,4 +2432,9 @@ public class PurpurWorldConfig {
|
||||
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
|
||||
zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater);
|
||||
}
|
||||
+
|
||||
+ public float hungerStarvationDamage = 1.0F;
|
||||
+ private void hungerSettings() {
|
||||
+ hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
|
||||
+ }
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 28 Jun 2021 13:33:12 -0500
|
||||
Subject: [PATCH] Redirect System.out calls to plugin loggers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 489c0a317e5c5711bf7de3e54d24c6d9f609f43e..14dcea731e255a6697fa9df0342e04b91e5b55e0 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -178,8 +178,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
*/
|
||||
// Paper end
|
||||
|
||||
- System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream());
|
||||
- System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream());
|
||||
+ System.setOut(new net.pl3x.purpur.PurpurPrintStream(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream(), java.util.logging.Logger::info)); // Purpur
|
||||
+ System.setErr(new net.pl3x.purpur.PurpurPrintStream(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream(), java.util.logging.Logger::severe)); // Purpur
|
||||
// CraftBukkit end
|
||||
|
||||
thread.setDaemon(true);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurPrintStream.java b/src/main/java/net/pl3x/purpur/PurpurPrintStream.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f88da0b86a683b25d429ceea4a36d6dde12b2b56
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurPrintStream.java
|
||||
@@ -0,0 +1,65 @@
|
||||
+/*
|
||||
+ * MIT License
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Josh (Vicarious)
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+ * of this software and associated documentation files (the "Software"), to deal
|
||||
+ * in the Software without restriction, including without limitation the rights
|
||||
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
+ * copies of the Software, and to permit persons to whom the Software is
|
||||
+ * furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in all
|
||||
+ * copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
+ * SOFTWARE.
|
||||
+ */
|
||||
+package net.pl3x.purpur;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.plugin.java.JavaPlugin;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.io.OutputStream;
|
||||
+import java.io.PrintStream;
|
||||
+import java.util.function.BiConsumer;
|
||||
+import java.util.logging.Logger;
|
||||
+
|
||||
+/**
|
||||
+ * Logic borrowed from SysoutCatcher
|
||||
+ * <p>
|
||||
+ * https://www.spigotmc.org/resources/sysoutcatcher.79076/
|
||||
+ */
|
||||
+
|
||||
+public class PurpurPrintStream extends PrintStream {
|
||||
+ private static final StackWalker STACKWALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
|
||||
+ private final BiConsumer<Logger, String> consumer;
|
||||
+
|
||||
+ public PurpurPrintStream(@NotNull OutputStream out, BiConsumer<Logger, String> consumer) {
|
||||
+ super(out);
|
||||
+ this.consumer = consumer;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void println(String line) {
|
||||
+ try {
|
||||
+ // Get the JavaPlugin that "owns" the calling class
|
||||
+ JavaPlugin plugin = JavaPlugin.getProvidingPlugin(STACKWALKER.getCallerClass());
|
||||
+
|
||||
+ // Instead of just printing the message, send it to the plugin's logger
|
||||
+ consumer.accept(plugin.getLogger(), line);
|
||||
+ } catch (Throwable ignore) {
|
||||
+ // If anything happens, the calling class doesn't exist, there is no JavaPlugin that "owns" the calling class, etc
|
||||
+ // Just print out normally, with some added information
|
||||
+ StackTraceElement element = Thread.currentThread().getStackTrace()[2];
|
||||
+ consumer.accept(Bukkit.getLogger(), String.format("(%s:%d) %s", element.getClassName(), element.getLineNumber(), line));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index d6c1c46e56ad39ec7fde5448120c8750d3ce3fa5..5e24bff3cbbbd59df175db6fa8293b7dc4d59916 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -291,7 +291,7 @@ public final class CraftServer implements Server {
|
||||
public int reloadCount;
|
||||
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
|
||||
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
||||
- private final SysoutCatcher sysoutCatcher = new SysoutCatcher(); // Paper
|
||||
+ //private final SysoutCatcher sysoutCatcher = new SysoutCatcher(); // Paper // Purpur - we have our own implementation that doesnt nag or prefix output
|
||||
|
||||
static {
|
||||
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
|
||||
@@ -1,81 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Mon, 28 Jun 2021 15:32:57 -0400
|
||||
Subject: [PATCH] Armor click equip options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 585e921585529c03756c51550110c796e6f27ea5..a61c0ca02b085d1ab2587d54c9fcdc76a726cc4e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -499,7 +499,7 @@ public class ServerPlayerGameMode {
|
||||
return interactionresultwrapper.getResult();
|
||||
} else {
|
||||
player.setItemInHand(hand, itemstack1);
|
||||
- if (this.isCreative()) {
|
||||
+ if (this.isCreative() && itemstack1 != ItemStack.EMPTY) { // Purpur
|
||||
itemstack1.setCount(i);
|
||||
if (itemstack1.isDamageableItem() && itemstack1.getDamageValue() != j) {
|
||||
itemstack1.setDamageValue(j);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
index 043ea496bd04bbf4571ec9d16e5362257b3658c8..dffa24f16b96912c3e539df71b521dd29bd6a165 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
@@ -146,7 +146,14 @@ public class ArmorItem extends Item implements Wearable {
|
||||
}
|
||||
|
||||
itemstack.setCount(0);
|
||||
- return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide());
|
||||
+ // Purpur start
|
||||
+ return InteractionResultHolder.success(world.purpurConfig.playerArmorSwappingCreativeMakesCopy ? itemstack : ItemStack.EMPTY);
|
||||
+ } else if (world.purpurConfig.playerArmorSwapping && !net.minecraft.world.item.enchantment.EnchantmentHelper.hasBindingCurse(itemstack1)) {
|
||||
+ user.setItemSlot(enumitemslot, itemstack);
|
||||
+ user.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ user.level.playSound(null, user.getX(), user.getY(), user.getZ(), itemstack.getEquipSound(), net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F); // we have to force the sound, for whatever reason
|
||||
+ return InteractionResultHolder.success(itemstack1);
|
||||
+ // Purpur end
|
||||
} else {
|
||||
return InteractionResultHolder.fail(itemstack);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ElytraItem.java b/src/main/java/net/minecraft/world/item/ElytraItem.java
|
||||
index 42f79d418ec4e2dbeac9a217d9dc144cda2ef714..250c0e31825f772d3fee7a523f150cb25e8ae558 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ElytraItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ElytraItem.java
|
||||
@@ -39,7 +39,14 @@ public class ElytraItem extends Item implements Wearable {
|
||||
}
|
||||
|
||||
itemStack.setCount(0);
|
||||
- return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
|
||||
+ // Purpur start
|
||||
+ return InteractionResultHolder.success(world.purpurConfig.playerArmorSwappingCreativeMakesCopy ? itemStack : ItemStack.EMPTY);
|
||||
+ } else if (world.purpurConfig.playerArmorSwapping) {
|
||||
+ user.setItemSlot(equipmentSlot, itemStack);
|
||||
+ user.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ user.level.playSound(null, user.getX(), user.getY(), user.getZ(), itemStack.getEquipSound(), net.minecraft.sounds.SoundSource.BLOCKS, 1.0F, 1.0F); // we have to force the sound, for whatever reason
|
||||
+ return InteractionResultHolder.success(itemStack2);
|
||||
+ // Purpur end
|
||||
} else {
|
||||
return InteractionResultHolder.fail(itemStack);
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 07cd83c76b34c6d02dd375292ac5fc3edd5f4491..94162749f3f9b68455ef7ef327dc4d474a19d8a1 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -345,6 +345,8 @@ public class PurpurWorldConfig {
|
||||
public boolean playersSkipNight = true;
|
||||
public double playerCriticalDamageMultiplier = 1.5D;
|
||||
public boolean playerBurpWhenFull = false;
|
||||
+ public boolean playerArmorSwapping = false;
|
||||
+ public boolean playerArmorSwappingCreativeMakesCopy = true;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -368,6 +370,8 @@ public class PurpurWorldConfig {
|
||||
playersSkipNight = getBoolean("gameplay-mechanics.player.can-skip-night", playersSkipNight);
|
||||
playerCriticalDamageMultiplier = getDouble("gameplay-mechanics.player.critical-damage-multiplier", playerCriticalDamageMultiplier);
|
||||
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);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
@@ -1,143 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 1 Jul 2021 15:48:02 -0500
|
||||
Subject: [PATCH] Add uptime command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index d734addd622f6d429a79df08310bce562db3425e..d298e70100741808d466d7113eb268fb4ccf76e2 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -201,6 +201,7 @@ public class Commands {
|
||||
net.pl3x.purpur.command.CreditsCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.DemoCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
+ net.pl3x.purpur.command.UptimeCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.TPSBarCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 63476c39ca2f78e0e53729325220196be5932dde..106f40481c9b8786bc54a89a0719985c44d0e71a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
|
||||
//public ConsoleReader reader; // Paper
|
||||
public static int currentTick = 0; // Paper - Further improve tick loop
|
||||
+ public static final long startTimeMillis = System.currentTimeMillis();
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
public boolean serverAutoSave = false; // Paper
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 942c45e53e3458271bd2e8e2a86e5b31e2de90d3..fc6c0717aa13d4bdc28ba1fa2ae5e4a9be87aa18 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -166,6 +166,7 @@ public class PurpurConfig {
|
||||
public static String demoCommandOutput = "<green>%s has been shown the demo screen";
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
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";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
@@ -177,6 +178,7 @@ public class PurpurConfig {
|
||||
demoCommandOutput = getString("settings.messages.demo-command-output", demoCommandOutput);
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
+ uptimeCommandOutput = getString("settings.messages.uptime-command-output", uptimeCommandOutput);
|
||||
unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
|
||||
}
|
||||
|
||||
@@ -237,6 +239,15 @@ public class PurpurConfig {
|
||||
public static int commandTPSBarTickInterval = 20;
|
||||
public static boolean commandGamemodeRequiresPermission = false;
|
||||
public static boolean hideHiddenPlayersFromEntitySelector = false;
|
||||
+ public static String uptimeFormat = "<days><hours><minutes><seconds>";
|
||||
+ public static String uptimeDay = "%02d day, ";
|
||||
+ public static String uptimeDays = "%02d days, ";
|
||||
+ public static String uptimeHour = "%02d hour, ";
|
||||
+ public static String uptimeHours = "%02d hours, ";
|
||||
+ public static String uptimeMinute = "%02d minute, and ";
|
||||
+ public static String uptimeMinutes = "%02d minutes, and ";
|
||||
+ public static String uptimeSecond = "%02d second";
|
||||
+ public static String uptimeSeconds = "%02d seconds";
|
||||
private static void commandSettings() {
|
||||
commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
|
||||
commandTPSBarProgressOverlay = BossBar.Overlay.valueOf(getString("settings.command.tpsbar.overlay", commandTPSBarProgressOverlay.name()));
|
||||
@@ -250,6 +261,15 @@ public class PurpurConfig {
|
||||
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);
|
||||
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);
|
||||
+ uptimeDay = getString("settings.command.uptime.day", uptimeDay);
|
||||
+ uptimeDays = getString("settings.command.uptime.days", uptimeDays);
|
||||
+ uptimeHour = getString("settings.command.uptime.hour", uptimeHour);
|
||||
+ uptimeHours = getString("settings.command.uptime.hours", uptimeHours);
|
||||
+ uptimeMinute = getString("settings.command.uptime.minute", uptimeMinute);
|
||||
+ uptimeMinutes = getString("settings.command.uptime.minutes", uptimeMinutes);
|
||||
+ uptimeSecond = getString("settings.command.uptime.second", uptimeSecond);
|
||||
+ uptimeSeconds = getString("settings.command.uptime.seconds", uptimeSeconds);
|
||||
}
|
||||
|
||||
public static int barrelRows = 3;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/UptimeCommand.java b/src/main/java/net/pl3x/purpur/command/UptimeCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c63ad24ca4ea4c2bd6239c7fe9beb64e78332e77
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/UptimeCommand.java
|
||||
@@ -0,0 +1,55 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.Template;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+public class UptimeCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("uptime")
|
||||
+ .requires((listener) -> listener.hasPermission(2))
|
||||
+ .executes((context) -> execute(context.getSource()))
|
||||
+ ).setPermission("bukkit.command.uptime");
|
||||
+ }
|
||||
+
|
||||
+ private static int execute(CommandSourceStack sender) {
|
||||
+ Data data = new Data();
|
||||
+
|
||||
+ data.format = PurpurConfig.uptimeFormat;
|
||||
+ data.hide = true;
|
||||
+ data.millis = System.currentTimeMillis() - MinecraftServer.startTimeMillis;
|
||||
+
|
||||
+ process(data, "<days>", PurpurConfig.uptimeDay, PurpurConfig.uptimeDays, TimeUnit.DAYS, TimeUnit.MILLISECONDS::toDays);
|
||||
+ process(data, "<hours>", PurpurConfig.uptimeHour, PurpurConfig.uptimeHours, TimeUnit.HOURS, TimeUnit.MILLISECONDS::toHours);
|
||||
+ process(data, "<minutes>", PurpurConfig.uptimeMinute, PurpurConfig.uptimeMinutes, TimeUnit.MINUTES, TimeUnit.MILLISECONDS::toMinutes);
|
||||
+ data.hide = false; // never hide seconds
|
||||
+ process(data, "<seconds>", PurpurConfig.uptimeSecond, PurpurConfig.uptimeSeconds, TimeUnit.SECONDS, TimeUnit.MILLISECONDS::toSeconds);
|
||||
+
|
||||
+ Component output = MiniMessage.get().parse(PurpurConfig.uptimeCommandOutput, Template.of("uptime", data.format));
|
||||
+ sender.sendSuccess(output, false);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ private static void process(Data data, String replace, String singular, String plural, TimeUnit unit, Function<Long, Long> func) {
|
||||
+ if (data.format.contains(replace)) {
|
||||
+ long val = func.apply(data.millis);
|
||||
+ if (data.hide) data.hide = val == 0;
|
||||
+ if (!data.hide) data.millis -= unit.toMillis(val);
|
||||
+ data.format = data.format.replace(replace, data.hide ? "" : String.format(val == 1 ? singular : plural, val));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class Data {
|
||||
+ String format;
|
||||
+ boolean hide;
|
||||
+ long millis;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,56 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 1 Jul 2021 19:25:05 -0500
|
||||
Subject: [PATCH] Structure seed options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index 6a1cb38de5733e384546984a0eadd4bab53c0122..42cc3ef9bd70b96f2c2f166590792650ffbd1507 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -424,6 +424,23 @@ public abstract class ChunkGenerator {
|
||||
case "village":
|
||||
seed = conf.villageSeed;
|
||||
break;
|
||||
+ // Purpur start
|
||||
+ case "stronghold":
|
||||
+ if (net.pl3x.purpur.PurpurConfig.seedStructureStronghold != -1) {
|
||||
+ seed = net.pl3x.purpur.PurpurConfig.seedStructureStronghold;
|
||||
+ }
|
||||
+ break;
|
||||
+ case "mineshaft":
|
||||
+ if (net.pl3x.purpur.PurpurConfig.seedStructureMineshaft != -1) {
|
||||
+ seed = net.pl3x.purpur.PurpurConfig.seedStructureMineshaft;
|
||||
+ }
|
||||
+ break;
|
||||
+ case "buried_treasure":
|
||||
+ if (net.pl3x.purpur.PurpurConfig.seedStructureBuriedTreasure != -1) {
|
||||
+ seed = net.pl3x.purpur.PurpurConfig.seedStructureBuriedTreasure;
|
||||
+ }
|
||||
+ break;
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
updated.put(entry.getKey(), new StructureFeatureConfiguration(feature.spacing(), feature.separation(), seed));
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index fc6c0717aa13d4bdc28ba1fa2ae5e4a9be87aa18..a68f8efb7ad6de35d9703417cc6d65c7b99efa23 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -194,6 +194,17 @@ public class PurpurConfig {
|
||||
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
|
||||
}
|
||||
|
||||
+ public static int seedStructureBuriedTreasure = -1;
|
||||
+ public static int seedStructureMineshaft = -1;
|
||||
+ public static int seedStructureStronghold = -1;
|
||||
+ private static void seedSettings() {
|
||||
+ seedStructureBuriedTreasure = getInt("settings.seed.structure.buried_treasure", seedStructureBuriedTreasure);
|
||||
+ seedStructureMineshaft = getInt("settings.seed.structure.mineshaft", seedStructureMineshaft);
|
||||
+ seedStructureStronghold = getInt("settings.seed.structure.stronghold", seedStructureStronghold);
|
||||
+ // hide these from timings report
|
||||
+ if (!TimingsManager.hiddenConfigs.contains("settings.seed")) TimingsManager.hiddenConfigs.add("settings.seed");
|
||||
+ }
|
||||
+
|
||||
public static String serverModName = "Purpur";
|
||||
private static void serverModName() {
|
||||
serverModName = getString("settings.server-mod-name", serverModName);
|
||||
@@ -1,408 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 2 Jul 2021 20:54:29 -0500
|
||||
Subject: [PATCH] Tool actionable options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
index 734276a74ad11f117a816b214c62415818c27dcc..b2fdfc62f1f273fd6f78ae6153444e9c1a863b00 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
@@ -32,22 +32,22 @@ public class AxeItem extends DiggerItem {
|
||||
BlockPos blockPos = context.getClickedPos();
|
||||
Player player = context.getPlayer();
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
- Optional<BlockState> optional = this.getStripped(blockState);
|
||||
- Optional<BlockState> optional2 = WeatheringCopper.getPrevious(blockState);
|
||||
- Optional<BlockState> optional3 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(blockState.getBlock())).map((block) -> {
|
||||
- return block.withPropertiesOf(blockState);
|
||||
- });
|
||||
+ // Purpur start
|
||||
+ Optional<net.pl3x.purpur.tool.Actionable> optional = Optional.ofNullable(level.purpurConfig.axeStrippables.get(blockState.getBlock()));
|
||||
+ Optional<net.pl3x.purpur.tool.Actionable> optional2 = Optional.ofNullable(level.purpurConfig.axeWeatherables.get(blockState.getBlock()));
|
||||
+ Optional<net.pl3x.purpur.tool.Actionable> optional3 = Optional.ofNullable(level.purpurConfig.axeWaxables.get(blockState.getBlock()));
|
||||
+ // Purpur end
|
||||
ItemStack itemStack = context.getItemInHand();
|
||||
- Optional<BlockState> optional4 = Optional.empty();
|
||||
+ Optional<net.pl3x.purpur.tool.Actionable> optional4 = Optional.empty(); // Purpur
|
||||
if (optional.isPresent()) {
|
||||
- level.playSound(player, blockPos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
optional4 = optional;
|
||||
} else if (optional2.isPresent()) {
|
||||
- level.playSound(player, blockPos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
level.levelEvent(player, 3005, blockPos, 0);
|
||||
optional4 = optional2;
|
||||
} else if (optional3.isPresent()) {
|
||||
- level.playSound(player, blockPos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
level.levelEvent(player, 3004, blockPos, 0);
|
||||
optional4 = optional3;
|
||||
}
|
||||
@@ -57,14 +57,22 @@ public class AxeItem extends DiggerItem {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
|
||||
}
|
||||
|
||||
- level.setBlock(blockPos, optional4.get(), 11);
|
||||
+ // Purpur start
|
||||
+ net.pl3x.purpur.tool.Actionable actionable = optional4.get();
|
||||
+ level.setBlock(blockPos, actionable.into().withPropertiesOf(blockState), 11);
|
||||
+ actionable.drops().forEach((drop, chance) -> {
|
||||
+ if (level.random.nextDouble() < chance) {
|
||||
+ Block.popResourceFromFace(level, blockPos, context.getClickedFace(), new ItemStack(drop));
|
||||
+ }
|
||||
+ });
|
||||
+ // Purpur end
|
||||
if (player != null) {
|
||||
itemStack.hurtAndBreak(1, player, (p) -> {
|
||||
p.broadcastBreakEvent(context.getHand());
|
||||
});
|
||||
}
|
||||
|
||||
- return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
+ return InteractionResult.SUCCESS; // Purpur - force arm swing
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/HoeItem.java b/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
index 009dd6b59e27a9413b3ef115468a6d1dd0746d56..fdbc1378bc148f5a16b414a3e5867cdce91c73b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
@@ -33,15 +33,22 @@ public class HoeItem extends DiggerItem {
|
||||
public InteractionResult useOn(UseOnContext context) {
|
||||
Level level = context.getLevel();
|
||||
BlockPos blockPos = context.getClickedPos();
|
||||
- Pair<Predicate<UseOnContext>, Consumer<UseOnContext>> pair = TILLABLES.get(level.getBlockState(blockPos).getBlock());
|
||||
- if (pair == null) {
|
||||
- return InteractionResult.PASS;
|
||||
- } else {
|
||||
- Predicate<UseOnContext> predicate = pair.getFirst();
|
||||
- Consumer<UseOnContext> consumer = pair.getSecond();
|
||||
+ // Purpur start
|
||||
+ var tillable = level.purpurConfig.hoeTillables.get(level.getBlockState(blockPos).getBlock());
|
||||
+ if (tillable == null) { return InteractionResult.PASS; } else {
|
||||
+ Predicate<UseOnContext> predicate = tillable.condition().predicate();
|
||||
+ Consumer<UseOnContext> consumer = (ctx) -> {
|
||||
+ level.setBlock(blockPos, tillable.into().defaultBlockState(), 11);
|
||||
+ tillable.drops().forEach((drop, chance) -> {
|
||||
+ if (level.random.nextDouble() < chance) {
|
||||
+ Block.popResourceFromFace(level, blockPos, ctx.getClickedFace(), new ItemStack(drop));
|
||||
+ }
|
||||
+ });
|
||||
+ };
|
||||
+ // Purpur end
|
||||
if (predicate.test(context)) {
|
||||
Player player = context.getPlayer();
|
||||
- level.playSound(player, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
if (!level.isClientSide) {
|
||||
consumer.accept(context);
|
||||
if (player != null) {
|
||||
@@ -51,7 +58,7 @@ public class HoeItem extends DiggerItem {
|
||||
}
|
||||
}
|
||||
|
||||
- return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
+ return InteractionResult.SUCCESS; // Purpur - force arm swing
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 94162749f3f9b68455ef7ef327dc4d474a19d8a1..d9ceea264e37f5cf27380afa2ff7b82ea94fbabb 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -472,6 +472,153 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public Map<Block, Strippable> axeStrippables = new HashMap<>();
|
||||
+ public Map<Block, Waxable> axeWaxables = new HashMap<>();
|
||||
+ public Map<Block, Weatherable> axeWeatherables = new HashMap<>();
|
||||
+ public Map<Block, Tillable> hoeTillables = new HashMap<>();
|
||||
+ private void toolSettings() {
|
||||
+ axeStrippables.clear();
|
||||
+ axeWaxables.clear();
|
||||
+ axeWeatherables.clear();
|
||||
+ hoeTillables.clear();
|
||||
+ if (PurpurConfig.version < 18) {
|
||||
+ ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + ".tools.hoe.tilling");
|
||||
+ if (section != null) {
|
||||
+ PurpurConfig.config.set("world-settings." + worldName + ".tools.hoe.tillables", section);
|
||||
+ PurpurConfig.config.set("world-settings." + worldName + ".tools.hoe.tilling", null);
|
||||
+ }
|
||||
+ section = PurpurConfig.config.getConfigurationSection("world-settings.default.tools.hoe.tilling");
|
||||
+ if (section != null) {
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.hoe.tillables", section);
|
||||
+ PurpurConfig.config.set("world-settings.default.tools.hoe.tilling", null);
|
||||
+ }
|
||||
+ }
|
||||
+ getMap("tools.axe.strippables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:oak_wood", Map.of("into", "minecraft:stripped_oak_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oak_log", Map.of("into", "minecraft:stripped_oak_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dark_oak_wood", Map.of("into", "minecraft:stripped_dark_oak_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dark_oak_log", Map.of("into", "minecraft:stripped_dark_oak_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:acacia_wood", Map.of("into", "minecraft:stripped_acacia_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:acacia_log", Map.of("into", "minecraft:stripped_acacia_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:birch_wood", Map.of("into", "minecraft:stripped_birch_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:birch_log", Map.of("into", "minecraft:stripped_birch_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:jungle_wood", Map.of("into", "minecraft:stripped_jungle_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:jungle_log", Map.of("into", "minecraft:stripped_jungle_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:spruce_wood", Map.of("into", "minecraft:stripped_spruce_wood", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:spruce_log", Map.of("into", "minecraft:stripped_spruce_log", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:warped_stem", Map.of("into", "minecraft:stripped_warped_stem", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:warped_hyphae", Map.of("into", "minecraft:stripped_warped_hyphae", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:crimson_stem", Map.of("into", "minecraft:stripped_crimson_stem", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:crimson_hyphae", Map.of("into", "minecraft:stripped_crimson_hyphae", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = Registry.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = Registry.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.strippables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ axeStrippables.put(block, new Strippable(into, drops));
|
||||
+ });
|
||||
+ getMap("tools.axe.waxables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:waxed_copper_block", Map.of("into", "minecraft:copper_block", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_copper", Map.of("into", "minecraft:exposed_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_copper", Map.of("into", "minecraft:weathered_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_copper", Map.of("into", "minecraft:oxidized_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_cut_copper", Map.of("into", "minecraft:cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_cut_copper", Map.of("into", "minecraft:exposed_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_cut_copper", Map.of("into", "minecraft:weathered_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_cut_copper", Map.of("into", "minecraft:oxidized_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_cut_copper_slab", Map.of("into", "minecraft:cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_cut_copper_slab", Map.of("into", "minecraft:exposed_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_cut_copper_slab", Map.of("into", "minecraft:weathered_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_cut_copper_slab", Map.of("into", "minecraft:oxidized_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_cut_copper_stairs", Map.of("into", "minecraft:cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_exposed_cut_copper_stairs", Map.of("into", "minecraft:exposed_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_weathered_cut_copper_stairs", Map.of("into", "minecraft:weathered_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:waxed_oxidized_cut_copper_stairs", Map.of("into", "minecraft:oxidized_cut_copper_stairs", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = Registry.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = Registry.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.waxables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ axeWaxables.put(block, new Waxable(into, drops));
|
||||
+ });
|
||||
+ getMap("tools.axe.weatherables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:exposed_copper", Map.of("into", "minecraft:copper_block", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_copper", Map.of("into", "minecraft:exposed_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_copper", Map.of("into", "minecraft:weathered_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_cut_copper", Map.of("into", "minecraft:cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_cut_copper", Map.of("into", "minecraft:exposed_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_cut_copper", Map.of("into", "minecraft:weathered_cut_copper", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_cut_copper_slab", Map.of("into", "minecraft:cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_cut_copper_slab", Map.of("into", "minecraft:exposed_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_cut_copper_slab", Map.of("into", "minecraft:weathered_cut_copper_slab", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:exposed_cut_copper_stairs", Map.of("into", "minecraft:cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:weathered_cut_copper_stairs", Map.of("into", "minecraft:exposed_cut_copper_stairs", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:oxidized_cut_copper_stairs", Map.of("into", "minecraft:weathered_cut_copper_stairs", "drops", new HashMap<String, Double>())))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = Registry.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + "`"); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = Registry.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.weatherables." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ axeWeatherables.put(block, new Weatherable(into, drops));
|
||||
+ });
|
||||
+ getMap("tools.hoe.tillables", Map.ofEntries(
|
||||
+ Map.entry("minecraft:grass_block", Map.of("condition", "air_above", "into", "minecraft:farmland", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dirt_path", Map.of("condition", "air_above", "into", "minecraft:farmland", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:dirt", Map.of("condition", "air_above", "into", "minecraft:farmland", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:coarse_dirt", Map.of("condition", "air_above", "into", "minecraft:dirt", "drops", new HashMap<String, Double>())),
|
||||
+ Map.entry("minecraft:rooted_dirt", Map.of("condition", "always", "into", "minecraft:dirt", "drops", Map.of("minecraft:hanging_roots", 1.0D))))
|
||||
+ ).forEach((blockId, obj) -> {
|
||||
+ Block block = Registry.BLOCK.get(new ResourceLocation(blockId));
|
||||
+ if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tilling`: " + blockId); return; }
|
||||
+ if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tilling." + blockId + "`"); return; }
|
||||
+ String conditionId = (String) map.get("condition");
|
||||
+ Tillable.Condition condition = Tillable.Condition.get(conditionId);
|
||||
+ if (condition == null) { PurpurConfig.log(Level.SEVERE, "Invalid condition for `tools.hoe.tilling." + blockId + ".condition`: " + conditionId); return; }
|
||||
+ String intoId = (String) map.get("into");
|
||||
+ Block into = Registry.BLOCK.get(new ResourceLocation(intoId));
|
||||
+ if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tilling." + blockId + ".into`: " + intoId); return; }
|
||||
+ Object dropsObj = map.get("drops");
|
||||
+ if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tilling." + blockId + ".drops`"); return; }
|
||||
+ Map<Item, Double> drops = new HashMap<>();
|
||||
+ dropsMap.forEach((itemId, chance) -> {
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(itemId.toString()));
|
||||
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.hoe.tilling." + blockId + ".drops`: " + itemId); return; }
|
||||
+ drops.put(item, (double) chance);
|
||||
+ });
|
||||
+ hoeTillables.put(block, new Tillable(condition, into, drops));
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
public boolean useBetterMending = false;
|
||||
public boolean alwaysTameInCreative = false;
|
||||
public boolean boatEjectPlayersOnLand = false;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/tool/Actionable.java b/src/main/java/net/pl3x/purpur/tool/Actionable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9273eb5f5cacf00eedeb5a396616871a3a39a7a0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/tool/Actionable.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package net.pl3x.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public abstract class Actionable {
|
||||
+ private final Block into;
|
||||
+ private final Map<Item, Double> drops;
|
||||
+
|
||||
+ public Actionable(Block into, Map<Item, Double> drops) {
|
||||
+ this.into = into;
|
||||
+ this.drops = drops;
|
||||
+ }
|
||||
+
|
||||
+ public Block into() {
|
||||
+ return into;
|
||||
+ }
|
||||
+
|
||||
+ public Map<Item, Double> drops() {
|
||||
+ return drops;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/tool/Strippable.java b/src/main/java/net/pl3x/purpur/tool/Strippable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c15b623db3331757963a4f565ae842d93471b769
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/tool/Strippable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package net.pl3x.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Strippable extends Actionable {
|
||||
+ public Strippable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/tool/Tillable.java b/src/main/java/net/pl3x/purpur/tool/Tillable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ec2e3c4009e7a18592eed677697680926db67247
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/tool/Tillable.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package net.pl3x.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.HoeItem;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.item.context.UseOnContext;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
+public class Tillable extends Actionable {
|
||||
+ private final Condition condition;
|
||||
+
|
||||
+ public Tillable(Condition condition, Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ this.condition = condition;
|
||||
+ }
|
||||
+
|
||||
+ public Condition condition() {
|
||||
+ return condition;
|
||||
+ }
|
||||
+
|
||||
+ public enum Condition {
|
||||
+ AIR_ABOVE(HoeItem::onlyIfAirAbove),
|
||||
+ ALWAYS((useOnContext) -> true);
|
||||
+
|
||||
+ private final Predicate<UseOnContext> predicate;
|
||||
+
|
||||
+ Condition(Predicate<UseOnContext> predicate) {
|
||||
+ this.predicate = predicate;
|
||||
+ }
|
||||
+
|
||||
+ public Predicate<UseOnContext> predicate() {
|
||||
+ return predicate;
|
||||
+ }
|
||||
+
|
||||
+ private static final Map<String, Condition> BY_NAME = new HashMap<>();
|
||||
+
|
||||
+ static {
|
||||
+ for (Condition condition : values()) {
|
||||
+ BY_NAME.put(condition.name(), condition);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static Condition get(String name) {
|
||||
+ return BY_NAME.get(name.toUpperCase());
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/tool/Waxable.java b/src/main/java/net/pl3x/purpur/tool/Waxable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..45a8007a9aaf3f9f11b9387ed4d980fe4f1ab8e3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/tool/Waxable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package net.pl3x.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Waxable extends Actionable {
|
||||
+ public Waxable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/tool/Weatherable.java b/src/main/java/net/pl3x/purpur/tool/Weatherable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..89c6a18580382d011aae000b39e8fede18d7c5ea
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/tool/Weatherable.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package net.pl3x.purpur.tool;
|
||||
+
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public class Weatherable extends Actionable {
|
||||
+ public Weatherable(Block into, Map<Item, Double> drops) {
|
||||
+ super(into, drops);
|
||||
+ }
|
||||
+}
|
||||
@@ -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 342e229fc0039510fdf2fc56998ee0891dda7380..98b4d5321c7d3023021045bf22b640d2a0744323 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -382,6 +382,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;
|
||||
|
||||
@@ -411,6 +412,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 577f38fcff55ef23fcacce1b05b6d0de117efd5e..938e427aaf762e107685579cbf3f4d2076112067 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -482,7 +482,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 e19e0c934c2e494a439ba8ec22b238e82aa72c28..6b3030ae02e986355409a6e648cedf93a374b6cc 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 static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39);
|
||||
private int remainingPersistentAngerTime;
|
||||
private UUID persistentAngerTarget;
|
||||
+ @Nullable private UUID summoner; // Purpur
|
||||
|
||||
public IronGolem(EntityType<? extends IronGolem> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -90,6 +91,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
|
||||
@@ -175,6 +185,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);
|
||||
}
|
||||
|
||||
@@ -182,6 +193,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 cbb09b62b0bf10b191e8e7fbe98885736807ea40..2682c176f4bff27fb5e332efc9a8a3e598482149 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -48,6 +48,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);
|
||||
@@ -68,6 +69,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
|
||||
@@ -97,6 +107,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
|
||||
@@ -105,6 +116,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 2f9e10be559bbf685bbe8b4ac4b8a55a6a663821..8a100e5bf4f40f2fd75fbe5a90cfce499b6f534a 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
|
||||
@@ -84,6 +84,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;
|
||||
|
||||
@@ -211,6 +212,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
|
||||
@@ -240,6 +250,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
|
||||
@@ -249,6 +260,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 f4186225cdc8123dab1fc4f0cca86cef64147bc9..f7dffa2703cd8a1048e1af079efd63a0a6b59714 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.addEntity(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.addEntity(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 91fdab51cfb0f45977abb0f378cee2b27f6a2cd3..1360eab31ab0be5fa2aae59a4f1c8afe6d8c13ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java
|
||||
@@ -82,6 +82,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.addEntity(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 299d5e47489cfe489ac130a33a08cdb29ba76d72..6b4a9b706142866d5e712d1ed49ae7220e471c91 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
@@ -65,4 +65,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 f969c706e47a9613fdc892f92c05ddb054164310..a4684af09f3a01b71b33cfff519ec5b99cfafd61 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1046,11 +1046,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 (net.pl3x.purpur.PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(net.pl3x.purpur.PurpurConfig.sleepSkippingNight));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
chatmessage = new TranslatableComponent("sleep.skipping_night");
|
||||
} else {
|
||||
+ // Purpur start
|
||||
+ if (net.pl3x.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(net.pl3x.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||
+ net.kyori.adventure.text.minimessage.Template.of("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ net.kyori.adventure.text.minimessage.Template.of("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/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index a68f8efb7ad6de35d9703417cc6d65c7b99efa23..151f3022a190a30da60b2ea60ee925ecca8a4b4a 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -168,6 +168,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);
|
||||
@@ -180,6 +182,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 boolean advancementOnlyBroadcastToAffectedPlayer = false;
|
||||
@@ -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 8cb5e91bdf5e0a9cdcef1c3b7a683ab125751f9f..c825363812278a4a88186b49c1d4fb8c9504e70b 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -300,7 +300,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) {
|
||||
CompoundTag nbttagcompound = entity.getItem().getTag();
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index d9ceea264e37f5cf27380afa2ff7b82ea94fbabb..290a118997a930d307e321234cc2671d1cc94f8c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -175,6 +175,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 -> {
|
||||
@@ -219,6 +220,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,41 +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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 290a118997a930d307e321234cc2671d1cc94f8c..56f6ddc63ed3db366a17a4ebc57d27017f25aa79 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -720,6 +720,11 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean buddingAmethystSilkTouch = false;
|
||||
+ private void buddingAmethystSettings() {
|
||||
+ buddingAmethystSilkTouch = getBoolean("blocks.budding_amethyst.silk-touch", buddingAmethystSilkTouch);
|
||||
+ }
|
||||
+
|
||||
public double caveVinesGrowthModifier = 0.10D;
|
||||
public int caveVinesMaxGrowthAge = 25;
|
||||
private void caveVinesSettings() {
|
||||
@@ -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 343f57c202001460a70c034da63cc3d7ed54eb68..290cc41ceb77dda59ffc181613a54c45101e696c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
@@ -234,7 +234,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.getBlockTicks().scheduleTick(blockposition, this, i);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 56f6ddc63ed3db366a17a4ebc57d27017f25aa79..f2411dc94d0c4fbc71b3dd13f0df89a09fbdfef8 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -720,6 +720,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 e6c429b2afc2f45ffbe4c8dcf1a4b4955626ee86..ab3fa78c369ebbf92857ef257e0019a0af2f323a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2059,6 +2059,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index f2411dc94d0c4fbc71b3dd13f0df89a09fbdfef8..9897fa9049f6bd7d2d09374292637976a1882036 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -349,6 +349,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);
|
||||
@@ -374,6 +375,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 51f9da43e3fc1f744d0cb7fc09f0477fd5a9c59a..3b27735db58fe69512d6a38738f585edf6598e90 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -394,7 +394,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
return false;
|
||||
} else if (getRider() != null) { return super.hurt(source, amount); // Purpur - no teleporting on damage
|
||||
} else if (net.pl3x.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
|
||||
if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (this.teleport()) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 9897fa9049f6bd7d2d09374292637976a1882036..c9bbe0d85b16eb877c18db060c37652040571762 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1312,6 +1312,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);
|
||||
@@ -1333,6 +1334,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,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Tue, 20 Jul 2021 02:18:23 +0200
|
||||
Subject: [PATCH] Fix Important Issue Crash with Plugin or Datapack Generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java
|
||||
index ae11f1ecf23b38b84ab09f66796d1509a21bfbd8..0a4a0a3d81753a7dea6a6483f601254928c697fb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java
|
||||
@@ -24,12 +24,16 @@ public class DecoratedFeature extends Feature<DecoratedFeatureConfiguration> {
|
||||
Random random = context.random();
|
||||
BlockPos blockPos = context.origin();
|
||||
ConfiguredFeature<?, ?> configuredFeature = decoratedFeatureConfiguration.feature.get();
|
||||
- decoratedFeatureConfiguration.decorator.getPositions(new DecorationContext(worldGenLevel, chunkGenerator), random, blockPos).forEach((blockPosx) -> {
|
||||
- if (configuredFeature.place(worldGenLevel, chunkGenerator, random, blockPosx)) {
|
||||
- mutableBoolean.setTrue();
|
||||
- }
|
||||
-
|
||||
- });
|
||||
+ // Purpur Start - Change forEach to Iterator for check with try catch error with caves 1.18
|
||||
+ java.util.Iterator<BlockPos> blockPosIterator = decoratedFeatureConfiguration.decorator.getPositions(new DecorationContext(worldGenLevel, chunkGenerator), random, blockPos).iterator();
|
||||
+ while (blockPosIterator.hasNext()) {
|
||||
+ try {
|
||||
+ if (configuredFeature.place(worldGenLevel, chunkGenerator, random, blockPosIterator.next())) {
|
||||
+ mutableBoolean.setTrue();
|
||||
+ }
|
||||
+ } catch (Exception ignored) {} // No need set false (Exception Possible : NullPointerException and RuntimeException
|
||||
+ }
|
||||
+ // Purpur End
|
||||
return mutableBoolean.isTrue();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
index 0be9ce0734e3ba72893a7349bb9f83a94f4af30c..f1a04ef36ee5e898529e99d98905b74607a16177 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
@@ -147,7 +147,7 @@ public class TreeFeature extends Feature<TreeConfiguration> {
|
||||
worldGenLevel.setBlock(pos, state, 19);
|
||||
};
|
||||
boolean bl = this.doPlace(worldGenLevel, random, blockPos, biConsumer, biConsumer2, treeConfiguration);
|
||||
- if (bl && (!set.isEmpty() || !set2.isEmpty())) {
|
||||
+ if (bl && !set.isEmpty() && !set2.isEmpty()) { // Purpur - Fix Paper#6068
|
||||
if (!treeConfiguration.decorators.isEmpty()) {
|
||||
List<BlockPos> list = Lists.newArrayList(set);
|
||||
List<BlockPos> list2 = Lists.newArrayList(set2);
|
||||
@@ -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 d298e70100741808d466d7113eb268fb4ccf76e2..0dde919a6e48664f687181967b8f180f8646b662 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -203,6 +203,7 @@ public class Commands {
|
||||
net.pl3x.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.UptimeCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.TPSBarCommand.register(this.dispatcher); // Purpur
|
||||
+ net.pl3x.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 176168d37000fe439593bd0cfc0a07d29577b474..7dff9956c8dc07701a9796098bed0f28f22cce56 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -261,6 +261,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
|
||||
@@ -483,6 +484,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
|
||||
@@ -544,6 +546,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
|
||||
@@ -2561,5 +2564,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/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java
|
||||
index 9d541c9e53f3f8db871f01f8d083e4cfc0de0de1..046bf9cbf02b002e89f7d39b616dd0f5a9539ed7 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CompassItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java
|
||||
@@ -46,6 +46,17 @@ public class CompassItem extends Item implements Vanishable {
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
|
||||
if (!world.isClientSide) {
|
||||
+ // Purpur start
|
||||
+ if (world.purpurConfig.compassItemShowsBossBar && entity instanceof net.minecraft.server.level.ServerPlayer player && !player.compassBar()) {
|
||||
+ net.pl3x.purpur.task.CompassTask task = net.pl3x.purpur.task.CompassTask.instance();
|
||||
+ boolean hasTask = task.hasPlayer(player.getUUID());
|
||||
+ if (selected && !hasTask) {
|
||||
+ task.addPlayer(player.getBukkitEntity());
|
||||
+ } else if (!selected && hasTask) {
|
||||
+ task.removePlayer(player.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
if (isLodestoneCompass(stack)) {
|
||||
CompoundTag compoundTag = stack.getOrCreateTag();
|
||||
if (compoundTag.contains("LodestoneTracked") && !compoundTag.getBoolean("LodestoneTracked")) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 151f3022a190a30da60b2ea60ee925ecca8a4b4a..82c7694de79094f4d944cdaba8d06572147dfd34 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -252,6 +252,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>";
|
||||
@@ -274,6 +279,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index c9bbe0d85b16eb877c18db060c37652040571762..6888c9ff183a869f241a72f36df6f3691897edfc 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -176,6 +176,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 -> {
|
||||
@@ -221,6 +222,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/net/pl3x/purpur/command/CompassCommand.java b/src/main/java/net/pl3x/purpur/command/CompassCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5381dfa162dae02c93afcf28d7c6dfb2170ab175
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/CompassCommand.java
|
||||
@@ -0,0 +1,21 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.pl3x.purpur.task.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();
|
||||
+ boolean result = CompassTask.instance().togglePlayer(player.getBukkitEntity());
|
||||
+ player.compassBar(result);
|
||||
+ return 1;
|
||||
+ })
|
||||
+ ).setPermission("bukkit.command.compass");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/task/BossBarTask.java b/src/main/java/net/pl3x/purpur/task/BossBarTask.java
|
||||
index 89122d7bcfd037a22d277e562f5300f2f3eab2db..d4d08946f38e6e29943a310c4b9385d2e092c803 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/task/BossBarTask.java
|
||||
+++ b/src/main/java/net/pl3x/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/net/pl3x/purpur/task/CompassTask.java b/src/main/java/net/pl3x/purpur/task/CompassTask.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..556ac7b6127a3827b686627364a7db9c853a2abd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/task/CompassTask.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package net.pl3x.purpur.task;
|
||||
+
|
||||
+import net.kyori.adventure.bossbar.BossBar;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+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;
|
||||
+
|
||||
+ 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 dbd34f589a146b9b408318c3810321ab6bce57f6..6e3f56843c47bc58eaf3d8e3b75299b36acd47d1 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
|
||||
@@ -394,7 +394,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 6888c9ff183a869f241a72f36df6f3691897edfc..c86ecc0d293f0f780e287c29e7383506275eabd5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1510,6 +1510,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) {
|
||||
@@ -1527,6 +1528,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,42 +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 4deef279a88f938354437e573df9e595cf5cc22c..75af080311863667feaeb27441461c27ad6704ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2791,7 +2791,11 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
if (f4 > 0.0F) {
|
||||
this.playSound(this.getFallDamageSound((int) f4), 1.0F, 1.0F);
|
||||
- this.hurt(DamageSource.FLY_INTO_WALL, f4);
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.elytraKineticDamage) {
|
||||
+ this.hurt(DamageSource.FLY_INTO_WALL, f4);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index c86ecc0d293f0f780e287c29e7383506275eabd5..0f87222f076cb16c4851bb72ef3d8b0b569e9494 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -138,12 +138,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 101317912b8299f5be406b75c19cfddb30c1f3f3..21f5632bbc58a1c34b85d9fef240893887e5ae6c 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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 0f87222f076cb16c4851bb72ef3d8b0b569e9494..607f4cde4b55503908a4ac11a0b9f0db8db6c947 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -321,6 +321,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 cea87c026130334503ad0d4753f4a8e46669e86c..a320483ef8b72edc40453c9e88bd90bd882dfe60 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -208,7 +208,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 607f4cde4b55503908a4ac11a0b9f0db8db6c947..5983666699e458aeb1d787370fac1800b959dee5 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2580,6 +2580,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);
|
||||
@@ -2594,6 +2596,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 5b10e1110f938745c8f9ed0b55960566bc720c30..c97fddfc680a9d1934c751e0e87e287dd9b9c640 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -74,7 +74,7 @@ public class SpongeBlock extends Block {
|
||||
// CraftBukkit end
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
- if (fluid.is((Tag) FluidTags.WATER)) {
|
||||
+ if (fluid.is(FluidTags.WATER) || (world.purpurConfig.spongeAbsorbsLava && fluid.is(FluidTags.LAVA))) {
|
||||
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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 5983666699e458aeb1d787370fac1800b959dee5..b856613b8085fde1d53ed83a5a5bb46f1a19c1b7 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -950,9 +950,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 8a100e5bf4f40f2fd75fbe5a90cfce499b6f534a..6b75aaca3f22cdf3b6b51db04d6d2ed642fc0e73 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
|
||||
@@ -403,7 +403,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.b(1023, new BlockPosition(this), 0);
|
||||
//int viewDistance = ((WorldServer) this.world).getServer().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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index b856613b8085fde1d53ed83a5a5bb46f1a19c1b7..213ce168873e865947962787cc1d82f0dfe19b6e 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2435,6 +2435,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);
|
||||
@@ -2455,6 +2456,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 2a02fdf58640d26b82e0ca22d0d8ff3326921b61..c65ec767363b76aa8e8234037d937423abedfdcf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
@@ -110,7 +110,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((Tag) FluidTags.LAVA));
|
||||
+ } while ((!world.getWorldBorder().world.purpurConfig.cactusBreaksFromSolidNeighbors || !material.isSolid()) && !world.getFluidState(pos.relative(enumdirection)).is((Tag) FluidTags.LAVA)); // Purpur
|
||||
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 213ce168873e865947962787cc1d82f0dfe19b6e..a27718df469c94544d8900e9d1cd26ff17b821fc 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -752,6 +752,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 double caveVinesGrowthModifier = 0.10D;
|
||||
public int caveVinesMaxGrowthAge = 25;
|
||||
private void caveVinesSettings() {
|
||||
@@ -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 777c21d8f3d5a7e9c156d25263f4b50ad67bd7c7..98cc31b2f318c468d1d2a26b24441bfe03055562 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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index a27718df469c94544d8900e9d1cd26ff17b821fc..7931b33300e1131b38e332c80c088bfaf688e0ce 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -359,6 +359,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);
|
||||
@@ -385,6 +386,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,77 +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 fc996199616156d04d6ae06ddc3da8d2c159c771..dd76fe8aa67a9c4142295b72b1c3cb7858c2b30b 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
|
||||
@@ -175,7 +175,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) {
|
||||
@@ -195,7 +195,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();
|
||||
@@ -233,14 +233,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((Vec3i) blockEntity.destroyTarget.blockPosition(), 8.0D)) {
|
||||
+ } else if (!blockEntity.destroyTarget.isAlive() || !pos.closerThan((Vec3i) 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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 7931b33300e1131b38e332c80c088bfaf688e0ce..2717f0c6344ed0df8ce6132a66e237319df92e4c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2641,4 +2641,27 @@ 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,35 +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/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 2717f0c6344ed0df8ce6132a66e237319df92e4c..d55a4d9b55bee1a0399bf8d6e6c1e6acd90321fd 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2664,4 +2664,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
conduitBlocks = conduitBlockList.toArray(Block[]::new);
|
||||
}
|
||||
+
|
||||
+ public float cauldronRainChance = 0.05F;
|
||||
+ public float cauldronPowderSnowChance = 0.1F;
|
||||
+ private void cauldronSettings() {
|
||||
+ cauldronRainChance = (float) getDouble("blocks.cauldron.fill-chances.rain", cauldronRainChance);
|
||||
+ cauldronPowderSnowChance = (float) getDouble("blocks.cauldron.fill-chances.powder-snow", cauldronPowderSnowChance);
|
||||
+ }
|
||||
}
|
||||
@@ -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 60605a8a021cc56f9c3ba22bc43c43c302fb1a70..e7dc64c3ef715e3e58d79bb55546a1222c101edf 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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index d55a4d9b55bee1a0399bf8d6e6c1e6acd90321fd..84f2135fc50e2c3a4f6035e1231ba70bd0e2eac4 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -655,6 +655,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);
|
||||
@@ -677,6 +678,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 Set<Block> noRandomTickBlocks = new HashSet<>();
|
||||
@@ -1,44 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 17 Aug 2021 17:39:21 -0500
|
||||
Subject: [PATCH] Add force and prompt parameters to resource pack api
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index f93887579837a9cfc6699c0b481ac60f16a31770..9bf8f53491a93c13313d6b35eca365aa183a574b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -25,6 +25,8 @@ import java.util.WeakHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.advancements.AdvancementProgress;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -1758,11 +1760,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void setResourcePack(String url, byte[] hash) {
|
||||
+ // Purpur start
|
||||
+ this.setResourcePack(url, hash, false, (net.kyori.adventure.text.Component) null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setResourcePack(String url, byte[] hash, boolean force, String prompt) {
|
||||
+ this.setResourcePack(url, hash, force, prompt == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(prompt));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setResourcePack(String url, byte[] hash, boolean force, net.kyori.adventure.text.Component prompt) {
|
||||
+ // Purpur end
|
||||
Validate.notNull(url, "Resource pack URL cannot be null");
|
||||
Validate.notNull(hash, "Resource pack hash cannot be null");
|
||||
Validate.isTrue(hash.length == 20, "Resource pack hash should be 20 bytes long but was " + hash.length);
|
||||
|
||||
- this.getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), false, null);
|
||||
+ this.getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), force, prompt == null ? null : io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)); // Purpur
|
||||
}
|
||||
|
||||
public void addChannel(String channel) {
|
||||
@@ -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 06c6be23da8d1090aed33f48fc0bbbe442a974b4..ae6e73a34fe0392be05120428716479fdcaad002 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;
|
||||
@@ -112,6 +116,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 84f2135fc50e2c3a4f6035e1231ba70bd0e2eac4..2d39f14fdf2eff4556a4d9e4920f2fd25a2f9d5a 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2043,6 +2043,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);
|
||||
@@ -2058,6 +2059,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 b20bfe5ab165bf86985e5ff2f93f415d9710e0e4..830d3163990002c7c1ba0a5a63531fa1bfff507d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -525,4 +525,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 9bf8f53491a93c13313d6b35eca365aa183a574b..8eab4b0b3a4412445a66088e374591873c847b2a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1933,6 +1933,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 ((OfflinePlayer)this).teleportOffline(destination);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean teleportOffline(Location destination, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ return ((OfflinePlayer)this).teleportOffline(destination, cause);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination) {
|
||||
+ return ((OfflinePlayer)this).teleportOfflineAsync(destination);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ return ((OfflinePlayer)this).teleportOfflineAsync(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 37878812892ea5cdfdd2d76d87bd14e035eab908..a2e1aaed795823d4054414d704404ceb73bf4424 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 400b4643df9c0e44614d5420809f64ddc1fd5a7f..f17cf16a0818f031b4697b2a08afe0905ba00da6 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
|
||||
@@ -205,6 +205,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 5e24bff3cbbbd59df175db6fa8293b7dc4d59916..908f817e86db90cfda71a73512138167cc002f08 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1413,6 +1413,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 a4684af09f3a01b71b33cfff519ec5b99cfafd61..31acce7d38bdbc17eb29f3ab03a247cccddfca95 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1098,6 +1098,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
private void stopWeather() {
|
||||
// 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....
|
||||
@@ -1105,6 +1106,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 2d39f14fdf2eff4556a4d9e4920f2fd25a2f9d5a..0b8337e23fe6352a21340d79d64b5c89c5664441 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -656,6 +656,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);
|
||||
@@ -679,6 +681,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 Set<Block> noRandomTickBlocks = new HashSet<>();
|
||||
@@ -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 47b32d89766862b998824fd3dd97265899651c15..8c0646dda3032bce8a95c66c9e504b68a32af85f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
@@ -48,6 +48,20 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock {
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, net.minecraft.world.level.block.state.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
|
||||
// CraftBukkit start
|
||||
world.captureTreeGeneration = true;
|
||||
// CraftBukkit end
|
||||
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 af4287e2fff8bc920f615ba56f78bd5acdec8721..31f84a7231667b593da8ed6cdada976f7769feef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
@@ -992,8 +992,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 0b8337e23fe6352a21340d79d64b5c89c5664441..dee41edc75353252b2c1dae3dee265ac7396a140 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -712,6 +712,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;
|
||||
@@ -848,6 +853,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 a61c0ca02b085d1ab2587d54c9fcdc76a726cc4e..a11a7deefb7fdf7ca9b23f85f5ae5f7c8ca935ac 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -526,6 +526,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;
|
||||
@@ -619,4 +620,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 212d5ea064ad7281d6ed4a468464c7e8615b67a0..e50eb7c89c3b7b523950d3fe02a433a8e8b57a6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1936,6 +1936,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index dee41edc75353252b2c1dae3dee265ac7396a140..cf94fe5e55cb42f81d96870ce0fcffb3ee0caddb 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -360,6 +360,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);
|
||||
@@ -387,6 +388,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 cff66ff55b5741d58cecf331444fac87798de4c9..b7cb3db55ddfa5a56c9cd3fa050adfb7832082c5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -85,6 +85,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);
|
||||
@@ -175,6 +176,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 = level.purpurConfig.dolphinNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.purpurConfig.dolphinNaturallyAggressiveToPlayersChance; // Purpur
|
||||
return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
}
|
||||
|
||||
@@ -245,18 +247,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 net.pl3x.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 net.pl3x.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Guardian.class})).setAlertOthers(new Class[0])); // CraftBukkit - decompile error
|
||||
+ 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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index cf94fe5e55cb42f81d96870ce0fcffb3ee0caddb..9bb24aacd36d571e9b12e87c8cf2b78b0891b48d 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1226,6 +1226,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);
|
||||
dolphinSpitCooldown = getInt("mobs.dolphin.spit.cooldown", dolphinSpitCooldown);
|
||||
@@ -1239,6 +1240,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 36c06895e270be41ac37a012c9c2444f5968d4c5..7900aa1db625a7f98773a574aac5c87d6057d90a 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);
|
||||
@@ -56,6 +57,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
|
||||
@@ -67,6 +69,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 = level.purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.purpurConfig.cowNaturallyAggressiveToPlayersChance;
|
||||
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -74,6 +82,7 @@ public class Cow extends Animal {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(0, new net.pl3x.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));
|
||||
@@ -81,10 +90,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 9bb24aacd36d571e9b12e87c8cf2b78b0891b48d..c182ddd23d3de94deee3f31afee880df3b3726ba 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1179,7 +1179,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);
|
||||
if (PurpurConfig.version < 10) {
|
||||
@@ -1191,6 +1198,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 c8cef183734d05d0d9c1fa00b0b52539649cfd87..d15169aa6fbad01ded1ae075bb2fc68b4ca8299e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -1172,6 +1172,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index c182ddd23d3de94deee3f31afee880df3b3726ba..c6cb7c1de2eccfea27281d76be336a3e680c5dad 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -731,11 +731,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,38 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: oharass <oharass@bk.ru>
|
||||
Date: Mon, 6 Sep 2021 05:13:09 +0300
|
||||
Subject: [PATCH] horses tempted by gold config
|
||||
|
||||
|
||||
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 6e3f56843c47bc58eaf3d8e3b75299b36acd47d1..311c18145a3c01d0105f81f32d5f7fe49c016500 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
|
||||
@@ -168,6 +168,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
|
||||
protected void addBehaviourGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
+ if (this.level.purpurConfig.horseTemptedByGold) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.25D, Ingredient.of(Items.GOLDEN_CARROT, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE), false)); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index c6cb7c1de2eccfea27281d76be336a3e680c5dad..b8146303d1f079f0a75fde23c6c1be8abbd1ac8c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1558,6 +1558,7 @@ public class PurpurWorldConfig {
|
||||
public int horseBreedingTicks = 6000;
|
||||
public boolean horseTakeDamageFromWater = false;
|
||||
public boolean horseStandWithRider = true;
|
||||
+ public boolean horseTemptedByGold = false;
|
||||
private void horseSettings() {
|
||||
horseRidableInWater = getBoolean("mobs.horse.ridable-in-water", horseRidableInWater);
|
||||
if (PurpurConfig.version < 10) {
|
||||
@@ -1576,6 +1577,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);
|
||||
+ horseTemptedByGold = getBoolean("mobs.horse.tempted-by-gold", horseTemptedByGold);
|
||||
}
|
||||
|
||||
public boolean huskRidable = false;
|
||||
@@ -1,38 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: oharass <oharass@bk.ru>
|
||||
Date: Mon, 6 Sep 2021 05:53:11 +0300
|
||||
Subject: [PATCH] llama tempted by hay config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
index ddef9b81c20b28cf8d8eebcbe7f4a7036ba21dfb..9e72325a05982ae593a6a49f4e4b007cc4d90436 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
@@ -190,6 +190,7 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
|
||||
this.goalSelector.addGoal(3, new RangedAttackGoal(this, 1.25D, 40, 20.0F));
|
||||
this.goalSelector.addGoal(3, new PanicGoal(this, 1.2D));
|
||||
this.goalSelector.addGoal(4, new BreedGoal(this, 1.0D));
|
||||
+ if (this.level.purpurConfig.llamaTemptedByHay) this.goalSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.25D, Ingredient.of(Items.HAY_BLOCK), false)); // Purpur
|
||||
this.goalSelector.addGoal(5, new FollowParentGoal(this, 1.0D));
|
||||
this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 0.7D));
|
||||
this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index b8146303d1f079f0a75fde23c6c1be8abbd1ac8c..048b6cee3396a0fe09378ee4527f1413b9f0cedd 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1659,6 +1659,7 @@ public class PurpurWorldConfig {
|
||||
public int llamaBreedingTicks = 6000;
|
||||
public boolean llamaTakeDamageFromWater = false;
|
||||
public boolean llamaJoinCaravans = true;
|
||||
+ public boolean llamaTemptedByHay = false;
|
||||
private void llamaSettings() {
|
||||
llamaRidable = getBoolean("mobs.llama.ridable", llamaRidable);
|
||||
llamaRidableInWater = getBoolean("mobs.llama.ridable-in-water", llamaRidableInWater);
|
||||
@@ -1678,6 +1679,7 @@ public class PurpurWorldConfig {
|
||||
llamaBreedingTicks = getInt("mobs.llama.breeding-delay-ticks", llamaBreedingTicks);
|
||||
llamaTakeDamageFromWater = getBoolean("mobs.llama.takes-damage-from-water", llamaTakeDamageFromWater);
|
||||
llamaJoinCaravans = getBoolean("mobs.llama.join-caravans", llamaJoinCaravans);
|
||||
+ llamaTemptedByHay = getBoolean("mobs.llama.tempted-by-hay", llamaTemptedByHay);
|
||||
}
|
||||
|
||||
public boolean magmaCubeRidable = false;
|
||||
@@ -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 48ef026a0bc49be0284749777cf4a6b447447665..90d2c7c1e63c8980ee1d4a7628b7d3e68ff54781 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -309,7 +309,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;
|
||||
@@ -319,6 +319,7 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
|
||||
private static boolean isHalloween() {
|
||||
LocalDate localdate = LocalDate.now();
|
||||
int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
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 5b19d8db09867791782c899d41d314c511f6c8a2..3d8b1b8d49af74babf628231345ac1c1864a8efb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -138,11 +138,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 6c253894866b870e79e110efd7eaf306aa5d7af5..d5ecaf051ec86b5dd9d1fde6af5bf6cd445dccc0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -568,11 +568,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 048b6cee3396a0fe09378ee4527f1413b9f0cedd..22fa1209876b2d3856f5de5086ab4f6fc3f676fc 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1530,6 +1530,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 double hoglinMaxHealth = 40.0D;
|
||||
@@ -1,57 +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 ignoring curses
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 51f3650bc19bddc71731c0cb36e600cc8d16a495..12f6a8cb3df14a457d6618ed02237391529b3c22 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -131,7 +131,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
Enchantment enchantment = (Enchantment) entry.getKey();
|
||||
Integer integer = (Integer) entry.getValue();
|
||||
|
||||
- if (!enchantment.isCurse()) {
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.grindstoneIgnoreCurses || !enchantment.isCurse()) { // Purpur
|
||||
j += enchantment.getMinCost(integer);
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,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 (!net.pl3x.purpur.PurpurConfig.grindstoneIgnoreCurses || !enchantment.isCurse() || EnchantmentHelper.getItemEnchantmentLevel(enchantment, itemstack2) == 0) { // Purpur
|
||||
itemstack2.enchant(enchantment, (Integer) entry.getValue());
|
||||
}
|
||||
}
|
||||
@@ -252,7 +252,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 net.pl3x.purpur.PurpurConfig.grindstoneIgnoreCurses && ((Enchantment) entry.getKey()).isCurse(); // Purpur
|
||||
}).collect(Collectors.toMap(Entry::getKey, Entry::getValue));
|
||||
|
||||
EnchantmentHelper.setEnchantments(map, itemstack1);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 82c7694de79094f4d944cdaba8d06572147dfd34..1134bc154cb3d83b510e48bd78851a93cfecbbe3 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -306,6 +306,7 @@ public class PurpurConfig {
|
||||
public static int beeInsideBeeHive = 3;
|
||||
public static boolean anvilCumulativeCost = true;
|
||||
public static int lightningRodRange = 128;
|
||||
+ public static boolean grindstoneIgnoreCurses = true;
|
||||
private static void blockSettings() {
|
||||
if (version < 3) {
|
||||
boolean oldValue = getBoolean("settings.barrel.packed-barrels", true);
|
||||
@@ -340,6 +341,7 @@ 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);
|
||||
+ grindstoneIgnoreCurses = getBoolean("settings.blocks.grindstone.ignore-curses", grindstoneIgnoreCurses);
|
||||
}
|
||||
|
||||
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 106f40481c9b8786bc54a89a0719985c44d0e71a..0bb080702af2d83aec19a83b146aced4c11bc942 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
|
||||
// Spigot end
|
||||
public static long currentTickLong = 0L; // Paper
|
||||
+ protected boolean upnp = false; // Purpur
|
||||
|
||||
public volatile Thread shutdownThread; // Paper
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
@@ -1050,6 +1051,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 14dcea731e255a6697fa9df0342e04b91e5b55e0..c38cea09161875a981e360d5909b82ca5ebfeb02 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -290,6 +290,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 (net.pl3x.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.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage))); // Spigot - moved up
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 1134bc154cb3d83b510e48bd78851a93cfecbbe3..7e36bcda5b8caee9fb604d26f7b9b22a7b1fea98 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -396,4 +396,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 7d0d6da335ff3bf810fa951553b58ff8a3267b0f..39f337c46aa3caa71d3cfa923ca4cf656445bcd0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
@@ -124,7 +124,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 22fa1209876b2d3856f5de5086ab4f6fc3f676fc..0f7e1de894b10d109a7ce020995128cfda3fa7be 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1008,6 +1008,11 @@ public class PurpurWorldConfig {
|
||||
weepingVinesMaxGrowthAge = getInt("blocks.weeping_vines.max-growth-age", weepingVinesMaxGrowthAge);
|
||||
}
|
||||
|
||||
+ public boolean campFireLitWhenPlaced = true;
|
||||
+ private void campFireSettings() {
|
||||
+ campFireLitWhenPlaced = getBoolean("blocks.campfire.lit-when-placed", campFireLitWhenPlaced);
|
||||
+ }
|
||||
+
|
||||
public boolean babiesAreRidable = true;
|
||||
public boolean untamedTamablesAreRidable = true;
|
||||
public boolean useNightVisionWhenRiding = false;
|
||||
@@ -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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 0f7e1de894b10d109a7ce020995128cfda3fa7be..d31fba4f062e9fe4e3f52827936edbb3f81f234b 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -179,6 +179,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 -> {
|
||||
@@ -225,6 +228,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 a320483ef8b72edc40453c9e88bd90bd882dfe60..956bfa524eabfea15d448d0b477e82e0f4a8f283 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -202,7 +202,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index d31fba4f062e9fe4e3f52827936edbb3f81f234b..d60fefd418cb1f55dfe7c71e12355e0f836ab56b 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2648,6 +2648,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);
|
||||
@@ -2664,6 +2665,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;
|
||||
Reference in New Issue
Block a user