mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
thats a whole lot of patches
This commit is contained in:
@@ -1,124 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 25 Jul 2019 18:07:37 -0500
|
||||
Subject: [PATCH] Implement elytra settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2553fe5fa89d353d4e41c04c178eb57174b2750a..71ef80e636ac7c208b362410eaaffa497dd9ceca 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3297,7 +3297,16 @@ public abstract class LivingEntity extends Entity {
|
||||
int j = i / 10;
|
||||
|
||||
if (j % 2 == 0) {
|
||||
- itemstack.hurtAndBreak(1, this, (entityliving) -> {
|
||||
+ // Purpur start
|
||||
+ int damage = level.purpurConfig.elytraDamagePerSecond;
|
||||
+ if (level.purpurConfig.elytraDamageMultiplyBySpeed > 0) {
|
||||
+ double speed = getDeltaMovement().lengthSqr();
|
||||
+ if (speed > level.purpurConfig.elytraDamageMultiplyBySpeed) {
|
||||
+ damage *= (int) speed;
|
||||
+ }
|
||||
+ }
|
||||
+ itemstack.hurtAndBreak(damage, this, (entityliving) -> {
|
||||
+ // Purpur end
|
||||
entityliving.broadcastBreakEvent(EquipmentSlot.CHEST);
|
||||
});
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
index 543a08f920319a2547258640bafebb1e70af65c4..dd211aa7c4ef1e158933a89898b9e5bc1451ee14 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
+import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
@@ -70,6 +71,14 @@ public class FireworkRocketItem extends Item {
|
||||
com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Firework) fireworkRocketEntity.getBukkitEntity());
|
||||
if (event.callEvent() && world.addFreshEntity(fireworkRocketEntity)) {
|
||||
user.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ // Purpur start
|
||||
+ if (world.purpurConfig.elytraDamagePerFireworkBoost > 0) {
|
||||
+ ItemStack chestItem = user.getItemBySlot(EquipmentSlot.CHEST);
|
||||
+ if (chestItem.getItem() == Items.ELYTRA) {
|
||||
+ chestItem.hurtAndBreak(world.purpurConfig.elytraDamagePerFireworkBoost, user, (entityliving) -> entityliving.broadcastBreakEvent(EquipmentSlot.CHEST));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
if (event.shouldConsume() && !user.getAbilities().instabuild) {
|
||||
itemStack.shrink(1);
|
||||
} else ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 47b8b3df98eb775f7e642924fd36005d542a10c6..3bd63474205bf7982af291d973a2a71a8490f20b 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -542,7 +542,7 @@ public final class ItemStack {
|
||||
int j;
|
||||
|
||||
if (amount > 0) {
|
||||
- j = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, this);
|
||||
+ j = (getItem() == Items.ELYTRA && player != null && player.level.purpurConfig.elytraIgnoreUnbreaking) ? 0 : EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, this);
|
||||
int k = 0;
|
||||
|
||||
for (int l = 0; j > 0 && l < amount; ++l) {
|
||||
@@ -596,6 +596,12 @@ public final class ItemStack {
|
||||
if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent
|
||||
breakCallback.accept(entity);
|
||||
Item item = this.getItem();
|
||||
+ // Purpur start
|
||||
+ if (item == Items.ELYTRA) {
|
||||
+ setDamageValue(item.getMaxDamage() - 1);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
// CraftBukkit start - Check for item breaking
|
||||
if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
index 510ed67a7de2b503ab8b01db57ed09ee33b0d825..3f53dc8f250ad3f7616ce7ef0a2353caa0ab1879 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
@@ -126,6 +126,14 @@ public class TridentItem extends Item implements Vanishable {
|
||||
f2 *= f6 / f5;
|
||||
f3 *= f6 / f5;
|
||||
f4 *= f6 / f5;
|
||||
+
|
||||
+ // Purpur start
|
||||
+ ItemStack chestItem = entityhuman.getItemBySlot(EquipmentSlot.CHEST);
|
||||
+ if (chestItem.getItem() == Items.ELYTRA && world.purpurConfig.elytraDamagePerTridentBoost > 0) {
|
||||
+ chestItem.hurtAndBreak(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, (entity) -> entity.broadcastBreakEvent(EquipmentSlot.CHEST));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
entityhuman.push((double) f2, (double) f3, (double) f4);
|
||||
entityhuman.startAutoSpinAttack(20);
|
||||
if (entityhuman.isOnGround()) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 42e4c17030054fa75619c3db7c5f4db113b8f6e8..c80a13bce7998f8dbcd1684724bb5aa4b07d9479 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -99,6 +99,19 @@ public class PurpurWorldConfig {
|
||||
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
|
||||
}
|
||||
|
||||
+ public int elytraDamagePerSecond = 1;
|
||||
+ public double elytraDamageMultiplyBySpeed = 0;
|
||||
+ public boolean elytraIgnoreUnbreaking = false;
|
||||
+ public int elytraDamagePerFireworkBoost = 0;
|
||||
+ public int elytraDamagePerTridentBoost = 0;
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
public boolean minecartPlaceAnywhere = false;
|
||||
public boolean minecartControllable = false;
|
||||
@@ -1,202 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 22 Feb 2020 15:54:08 -0600
|
||||
Subject: [PATCH] Item entity immunities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 7bb12a30d8b4a817f5a85969c6200306fd45a43d..cf94a78d15873f851bf7d79d8e846c66cf45d646 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -2283,7 +2283,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
|
||||
public class TrackedEntity {
|
||||
|
||||
- final ServerEntity serverEntity;
|
||||
+ public final ServerEntity serverEntity; // Purpur -> package -> public
|
||||
final Entity entity;
|
||||
private final int range;
|
||||
SectionPos lastSectionPos;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index e158c9bf0fb527105da9dc3f28d88e0ba7337e65..47f5c6726e620072d76f1fa028d7ae51f79cccfb 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -68,7 +68,7 @@ public class ServerEntity {
|
||||
private boolean wasRiding;
|
||||
private boolean wasOnGround;
|
||||
// CraftBukkit start
|
||||
- final Set<ServerPlayerConnection> trackedPlayers; // Paper - private -> package
|
||||
+ public final Set<ServerPlayerConnection> trackedPlayers; // Paper - private -> package // Purpur - package -> public
|
||||
|
||||
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
||||
this.trackedPlayers = trackedPlayers;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 063f3e4c67e6716c9a03dbe4b72eafd32e4f0d53..f3e642e27dc1e122199088dd1e4b3de5fa13180d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -53,6 +53,12 @@ public class ItemEntity extends Entity {
|
||||
public final float bobOffs;
|
||||
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||
public boolean canMobPickup = true; // Paper
|
||||
+ // Purpur start
|
||||
+ public boolean immuneToCactus = false;
|
||||
+ public boolean immuneToExplosion = false;
|
||||
+ public boolean immuneToFire = false;
|
||||
+ public boolean immuneToLightning = false;
|
||||
+ // Purpur end
|
||||
|
||||
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -322,6 +328,16 @@ public class ItemEntity extends Entity {
|
||||
return false;
|
||||
} else if (!this.getItem().getItem().canBeHurtBy(source)) {
|
||||
return false;
|
||||
+ // Purpur start
|
||||
+ } else if (
|
||||
+ (immuneToCactus && source == DamageSource.CACTUS) ||
|
||||
+ (immuneToFire && (source.isFire() || source == DamageSource.IN_FIRE)) ||
|
||||
+ (immuneToLightning && source == DamageSource.LIGHTNING_BOLT) ||
|
||||
+ (immuneToExplosion && source.isExplosion())
|
||||
+ ) {
|
||||
+ respawnOnClient();
|
||||
+ return false;
|
||||
+ // Purpur end
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount)) {
|
||||
@@ -504,6 +520,12 @@ public class ItemEntity extends Entity {
|
||||
com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
|
||||
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
||||
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.itemImmuneToCactus.contains(stack.getItem())) immuneToCactus = true;
|
||||
+ if (level.purpurConfig.itemImmuneToExplosion.contains(stack.getItem())) immuneToExplosion = true;
|
||||
+ if (level.purpurConfig.itemImmuneToFire.contains(stack.getItem())) immuneToFire = true;
|
||||
+ if (level.purpurConfig.itemImmuneToLightning.contains(stack.getItem())) immuneToLightning = true;
|
||||
+ // level end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -594,4 +616,17 @@ public class ItemEntity extends Entity {
|
||||
public SoundSource getSoundSource() {
|
||||
return SoundSource.AMBIENT;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public void respawnOnClient() {
|
||||
+ Packet<?> spawnPacket = new ClientboundAddEntityPacket(this);
|
||||
+ Packet<?> metadataPacket = new net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket(getId(), getEntityData(), true);
|
||||
+ for (net.minecraft.server.network.ServerPlayerConnection connection : this.tracker.serverEntity.trackedPlayers) {
|
||||
+ if (!connection.getPlayer().purpurClient) {
|
||||
+ connection.send(spawnPacket);
|
||||
+ connection.send(metadataPacket);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index c80a13bce7998f8dbcd1684724bb5aa4b07d9479..3d88ccc1ff7c87815bac2e9f573333e63caea223 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -112,6 +112,49 @@ public class PurpurWorldConfig {
|
||||
elytraDamagePerTridentBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.trident", elytraDamagePerTridentBoost);
|
||||
}
|
||||
|
||||
+ public List<Item> itemImmuneToCactus = new ArrayList<>();
|
||||
+ public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
||||
+ public List<Item> itemImmuneToFire = new ArrayList<>();
|
||||
+ public List<Item> itemImmuneToLightning = new ArrayList<>();
|
||||
+ private void itemSettings() {
|
||||
+ itemImmuneToCactus.clear();
|
||||
+ getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
+ if (key.toString().equals("*")) {
|
||||
+ Registry.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToCactus.add(item));
|
||||
+ return;
|
||||
+ }
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(key.toString()));
|
||||
+ if (item != Items.AIR) itemImmuneToCactus.add(item);
|
||||
+ });
|
||||
+ itemImmuneToExplosion.clear();
|
||||
+ getList("gameplay-mechanics.item.immune.explosion", new ArrayList<>()).forEach(key -> {
|
||||
+ if (key.toString().equals("*")) {
|
||||
+ Registry.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToExplosion.add(item));
|
||||
+ return;
|
||||
+ }
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(key.toString()));
|
||||
+ if (item != Items.AIR) itemImmuneToExplosion.add(item);
|
||||
+ });
|
||||
+ itemImmuneToFire.clear();
|
||||
+ getList("gameplay-mechanics.item.immune.fire", new ArrayList<>()).forEach(key -> {
|
||||
+ if (key.toString().equals("*")) {
|
||||
+ Registry.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToFire.add(item));
|
||||
+ return;
|
||||
+ }
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(key.toString()));
|
||||
+ if (item != Items.AIR) itemImmuneToFire.add(item);
|
||||
+ });
|
||||
+ itemImmuneToLightning.clear();
|
||||
+ getList("gameplay-mechanics.item.immune.lightning", new ArrayList<>()).forEach(key -> {
|
||||
+ if (key.toString().equals("*")) {
|
||||
+ Registry.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToLightning.add(item));
|
||||
+ return;
|
||||
+ }
|
||||
+ Item item = Registry.ITEM.get(new ResourceLocation(key.toString()));
|
||||
+ if (item != Items.AIR) itemImmuneToLightning.add(item);
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
public boolean minecartPlaceAnywhere = false;
|
||||
public boolean minecartControllable = false;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
index 342345eb04d00efb58392ccf209e3c51c1064173..5f5c37fb447a4c1790714158f4b41f15793002d1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
@@ -116,4 +116,46 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
public EntityType getType() {
|
||||
return EntityType.DROPPED_ITEM;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void setImmuneToCactus(boolean immuneToCactus) {
|
||||
+ item.immuneToCactus = immuneToCactus;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isImmuneToCactus() {
|
||||
+ return item.immuneToCactus;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setImmuneToExplosion(boolean immuneToExplosion) {
|
||||
+ item.immuneToExplosion = immuneToExplosion;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isImmuneToExplosion() {
|
||||
+ return item.immuneToExplosion;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setImmuneToFire(boolean immuneToFire) {
|
||||
+ item.immuneToFire = immuneToFire;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isImmuneToFire() {
|
||||
+ return item.immuneToFire;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setImmuneToLightning(boolean immuneToLightning) {
|
||||
+ item.immuneToLightning = immuneToLightning;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isImmuneToLightning() {
|
||||
+ return item.immuneToLightning;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 13 Mar 2020 22:29:10 -0500
|
||||
Subject: [PATCH] Add ping command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index dc0d785432b8e511a738bebb5c7335432b69427f..47ee3e70021ce17beea4ee6ac967c3180045b804 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -198,6 +198,7 @@ public class Commands {
|
||||
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
|
||||
StopCommand.register(this.dispatcher);
|
||||
WhitelistCommand.register(this.dispatcher);
|
||||
+ net.pl3x.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
if (environment.includeIntegrated) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index c27088998dca02124c0381dd4166d63e75a634f6..10a3bcd31f6cd2ec27c79c622fecc4a24fda9f17 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -162,12 +162,14 @@ public class PurpurConfig {
|
||||
public static String afkBroadcastBack = "<yellow><italic>%s is no longer AFK";
|
||||
public static String afkTabListPrefix = "[AFK] ";
|
||||
public static String afkTabListSuffix = "";
|
||||
+ public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
|
||||
afkBroadcastBack = getString("settings.messages.afk-broadcast-back", afkBroadcastBack);
|
||||
afkTabListPrefix = getString("settings.messages.afk-tab-list-prefix", afkTabListPrefix);
|
||||
afkTabListSuffix = getString("settings.messages.afk-tab-list-suffix", afkTabListSuffix);
|
||||
+ pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
}
|
||||
|
||||
public static String serverModName = "Purpur";
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/PingCommand.java b/src/main/java/net/pl3x/purpur/command/PingCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6de4f71aa5d501f3f5da93cd631da654a6e264e0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/PingCommand.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.commands.arguments.EntityArgument;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+
|
||||
+public class PingCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("ping")
|
||||
+ .requires((listener) -> listener.hasPermission(2))
|
||||
+ .executes((context) -> execute(context.getSource(), Collections.singleton(context.getSource().getPlayerOrException())))
|
||||
+ .then(Commands.argument("targets", EntityArgument.players())
|
||||
+ .executes((context) -> execute(context.getSource(), EntityArgument.getPlayers(context, "targets")))
|
||||
+ )
|
||||
+ ).setPermission("bukkit.command.ping");
|
||||
+ }
|
||||
+
|
||||
+ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
|
||||
+ for (ServerPlayer player : targets) {
|
||||
+ String output = String.format(PurpurConfig.pingCommandOutput, player.getGameProfile().getName(), player.latency);
|
||||
+ sender.sendSuccess(output, false);
|
||||
+ }
|
||||
+ return targets.size();
|
||||
+ }
|
||||
+}
|
||||
@@ -1,78 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 30 Nov 2020 03:12:04 -0600
|
||||
Subject: [PATCH] Add demo command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 47ee3e70021ce17beea4ee6ac967c3180045b804..376768b272f70d1eb45d483c51dec22d91c9d325 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -198,6 +198,7 @@ public class Commands {
|
||||
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
|
||||
StopCommand.register(this.dispatcher);
|
||||
WhitelistCommand.register(this.dispatcher);
|
||||
+ net.pl3x.purpur.command.DemoCommand.register(this.dispatcher); // Purpur
|
||||
net.pl3x.purpur.command.PingCommand.register(this.dispatcher); // Purpur
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 10a3bcd31f6cd2ec27c79c622fecc4a24fda9f17..196f57d3c7f1b9e57122c42c73de7157da477246 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -162,6 +162,7 @@ public class PurpurConfig {
|
||||
public static String afkBroadcastBack = "<yellow><italic>%s is no longer AFK";
|
||||
public static String afkTabListPrefix = "[AFK] ";
|
||||
public static String afkTabListSuffix = "";
|
||||
+ public static String demoCommandOutput = "<green>%s has been shown the demo screen";
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
@@ -169,6 +170,7 @@ public class PurpurConfig {
|
||||
afkBroadcastBack = getString("settings.messages.afk-broadcast-back", afkBroadcastBack);
|
||||
afkTabListPrefix = getString("settings.messages.afk-tab-list-prefix", afkTabListPrefix);
|
||||
afkTabListSuffix = getString("settings.messages.afk-tab-list-suffix", afkTabListSuffix);
|
||||
+ demoCommandOutput = getString("settings.messages.demo-command-output", demoCommandOutput);
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/DemoCommand.java b/src/main/java/net/pl3x/purpur/command/DemoCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..63686e55d169a81c0c225f8dfb47973075c1e491
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/DemoCommand.java
|
||||
@@ -0,0 +1,34 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.commands.arguments.EntityArgument;
|
||||
+import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+
|
||||
+public class DemoCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("demo")
|
||||
+ .requires((listener) -> listener.hasPermission(2))
|
||||
+ .executes((context) -> execute(context.getSource(), Collections.singleton(context.getSource().getPlayerOrException())))
|
||||
+ .then(Commands.argument("targets", EntityArgument.players())
|
||||
+ .executes((context) -> execute(context.getSource(), EntityArgument.getPlayers(context, "targets")))
|
||||
+ )
|
||||
+ ).setPermission("bukkit.command.demo");
|
||||
+ }
|
||||
+
|
||||
+ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
|
||||
+ for (ServerPlayer player : targets) {
|
||||
+ ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 0);
|
||||
+ player.connection.send(packet);
|
||||
+ String output = String.format(PurpurConfig.demoCommandOutput, player.getGameProfile().getName());
|
||||
+ sender.sendSuccess(output, false);
|
||||
+ }
|
||||
+ return targets.size();
|
||||
+ }
|
||||
+}
|
||||
@@ -1,79 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Fri, 30 Apr 2021 14:03:06 -0400
|
||||
Subject: [PATCH] Add credits command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 376768b272f70d1eb45d483c51dec22d91c9d325..4308cf798c7f97532ee56369a11afe4dbf7a898f 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -198,6 +198,7 @@ public class Commands {
|
||||
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
|
||||
StopCommand.register(this.dispatcher);
|
||||
WhitelistCommand.register(this.dispatcher);
|
||||
+ 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
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 196f57d3c7f1b9e57122c42c73de7157da477246..c202cb7e325b8ace1ed3aa3ba86419d7571d0f0e 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -162,6 +162,7 @@ public class PurpurConfig {
|
||||
public static String afkBroadcastBack = "<yellow><italic>%s is no longer AFK";
|
||||
public static String afkTabListPrefix = "[AFK] ";
|
||||
public static String afkTabListSuffix = "";
|
||||
+ public static String creditsCommandOutput = "<green>%s has been shown the end credits";
|
||||
public static String demoCommandOutput = "<green>%s has been shown the demo screen";
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
private static void messages() {
|
||||
@@ -170,6 +171,7 @@ public class PurpurConfig {
|
||||
afkBroadcastBack = getString("settings.messages.afk-broadcast-back", afkBroadcastBack);
|
||||
afkTabListPrefix = getString("settings.messages.afk-tab-list-prefix", afkTabListPrefix);
|
||||
afkTabListSuffix = getString("settings.messages.afk-tab-list-suffix", afkTabListSuffix);
|
||||
+ creditsCommandOutput = getString("settings.messages.credits-command-output", creditsCommandOutput);
|
||||
demoCommandOutput = getString("settings.messages.demo-command-output", demoCommandOutput);
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/CreditsCommand.java b/src/main/java/net/pl3x/purpur/command/CreditsCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..282be3e0e0cb3137829a88bd40fa18772dc344c2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/CreditsCommand.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import com.mojang.brigadier.CommandDispatcher;
|
||||
+import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands;
|
||||
+import net.minecraft.commands.arguments.EntityArgument;
|
||||
+import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+
|
||||
+public class CreditsCommand {
|
||||
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
+ dispatcher.register(Commands.literal("credits")
|
||||
+ .requires((listener) -> listener.hasPermission(2))
|
||||
+ .executes((context) -> execute(context.getSource(), Collections.singleton(context.getSource().getPlayerOrException())))
|
||||
+ .then(Commands.argument("targets", EntityArgument.players())
|
||||
+ .executes((context) -> execute(context.getSource(), EntityArgument.getPlayers(context, "targets")))
|
||||
+ )
|
||||
+ ).setPermission("bukkit.command.credits");
|
||||
+ }
|
||||
+
|
||||
+ private static int execute(CommandSourceStack sender, Collection<ServerPlayer> targets) {
|
||||
+ for (ServerPlayer player : targets) {
|
||||
+ ClientboundGameEventPacket packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1F);
|
||||
+ player.wonGame = true;
|
||||
+ player.connection.send(packet);
|
||||
+ String output = String.format(PurpurConfig.creditsCommandOutput, player.getGameProfile().getName());
|
||||
+ sender.sendSuccess(output, false);
|
||||
+ }
|
||||
+ return targets.size();
|
||||
+ }
|
||||
+}
|
||||
@@ -1,270 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 26 Mar 2020 21:39:32 -0500
|
||||
Subject: [PATCH] Configurable jockey options
|
||||
|
||||
|
||||
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 5c4e028d3a7620af1476f63a8ad000eb94ffb992..b2e3ad40cdc594b13eaf43e71e2e18edd1fbb1b7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -89,6 +89,21 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
protected void randomizeReinforcementsChance() {
|
||||
this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * this.level.purpurConfig.drownedSpawnReinforcements);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level.purpurConfig.drownedJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level.purpurConfig.drownedJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level.purpurConfig.drownedJockeyTryExistingChickens;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
index 81a3f6c1774b187be96b412dae44be623ce7f6cb..7bb8ef0bb2de9a0b0d5048f8a4089835c41de568 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
@@ -42,6 +42,21 @@ public class Husk extends Zombie {
|
||||
protected void randomizeReinforcementsChance() {
|
||||
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * this.level.purpurConfig.huskSpawnReinforcements);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level.purpurConfig.huskJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level.purpurConfig.huskJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level.purpurConfig.huskJockeyTryExistingChickens;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
public static boolean checkHuskSpawnRules(EntityType<Husk> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
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 dc16331adb1d02265617af9d19638d9d1a28668d..1341377c6fd5ada85831d46d71a6066e8cc2e5cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -122,6 +122,18 @@ public class Zombie extends Monster {
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.drownedMaxHealth);
|
||||
}
|
||||
+
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level.purpurConfig.zombieJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ public double jockeyChance() {
|
||||
+ return level.purpurConfig.zombieJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level.purpurConfig.zombieJockeyTryExistingChickens;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -528,19 +540,20 @@ public class Zombie extends Monster {
|
||||
if (object instanceof Zombie.ZombieGroupData) {
|
||||
Zombie.ZombieGroupData entityzombie_groupdatazombie = (Zombie.ZombieGroupData) object;
|
||||
|
||||
- if (entityzombie_groupdatazombie.isBaby) {
|
||||
- this.setBaby(true);
|
||||
+ // Purpur start
|
||||
+ if (!jockeyOnlyBaby() || entityzombie_groupdatazombie.isBaby) {
|
||||
+ this.setBaby(entityzombie_groupdatazombie.isBaby);
|
||||
if (entityzombie_groupdatazombie.canSpawnJockey) {
|
||||
- if ((double) world.getRandom().nextFloat() < 0.05D) {
|
||||
- List<Chicken> list = world.getEntitiesOfClass(Chicken.class, this.getBoundingBox().inflate(5.0D, 3.0D, 5.0D), EntitySelector.ENTITY_NOT_BEING_RIDDEN);
|
||||
+ if ((double) world.getRandom().nextFloat() < jockeyChance()) {
|
||||
+ List<Chicken> list = jockeyTryExistingChickens() ? world.getEntitiesOfClass(Chicken.class, this.getBoundingBox().inflate(5.0D, 3.0D, 5.0D), EntitySelector.ENTITY_NOT_BEING_RIDDEN) : java.util.Collections.emptyList();
|
||||
+ // Purpur end
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
Chicken entitychicken = (Chicken) list.get(0);
|
||||
|
||||
entitychicken.setChickenJockey(true);
|
||||
this.startRiding(entitychicken);
|
||||
- }
|
||||
- } else if ((double) world.getRandom().nextFloat() < 0.05D) {
|
||||
+ } else { // Purpur
|
||||
Chicken entitychicken1 = (Chicken) EntityType.CHICKEN.create(this.level);
|
||||
|
||||
entitychicken1.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
@@ -548,6 +561,7 @@ public class Zombie extends Monster {
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
world.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
+ } // Purpur
|
||||
}
|
||||
}
|
||||
}
|
||||
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 9c60e3b3e62a29d6898c82a4110ffd4d1c7cb5f2..7fda07f5fa756077dab59de95f15b9197e09581a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -94,6 +94,21 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
protected void randomizeReinforcementsChance() {
|
||||
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * this.level.purpurConfig.zombieVillagerSpawnReinforcements);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level.purpurConfig.zombieVillagerJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level.purpurConfig.zombieVillagerJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level.purpurConfig.zombieVillagerJockeyTryExistingChickens;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
index cc5bd132bbd40aba8c910695f25a896c5f4fe635..96e727cd703a1da5f60ab07e47b6bc5265b309e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
@@ -73,6 +73,21 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.zombifiedPiglinMaxHealth);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level.purpurConfig.zombifiedPiglinJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level.purpurConfig.zombifiedPiglinJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level.purpurConfig.zombifiedPiglinJockeyTryExistingChickens;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 3d88ccc1ff7c87815bac2e9f573333e63caea223..f15963106c5592e1ea7ef715ed79d7c62e35d308 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -540,6 +540,9 @@ public class PurpurWorldConfig {
|
||||
public boolean drownedRidableInWater = false;
|
||||
public double drownedMaxHealth = 20.0D;
|
||||
public double drownedSpawnReinforcements = 0.1D;
|
||||
+ public boolean drownedJockeyOnlyBaby = true;
|
||||
+ public double drownedJockeyChance = 0.05D;
|
||||
+ public boolean drownedJockeyTryExistingChickens = true;
|
||||
private void drownedSettings() {
|
||||
drownedRidable = getBoolean("mobs.drowned.ridable", drownedRidable);
|
||||
drownedRidableInWater = getBoolean("mobs.drowned.ridable-in-water", drownedRidableInWater);
|
||||
@@ -550,6 +553,9 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
drownedMaxHealth = getDouble("mobs.drowned.attributes.max_health", drownedMaxHealth);
|
||||
drownedSpawnReinforcements = getDouble("mobs.drowned.attributes.spawn_reinforcements", drownedSpawnReinforcements);
|
||||
+ drownedJockeyOnlyBaby = getBoolean("mobs.drowned.jockey.only-babies", drownedJockeyOnlyBaby);
|
||||
+ drownedJockeyChance = getDouble("mobs.drowned.jockey.chance", drownedJockeyChance);
|
||||
+ drownedJockeyTryExistingChickens = getBoolean("mobs.drowned.jockey.try-existing-chickens", drownedJockeyTryExistingChickens);
|
||||
}
|
||||
|
||||
public boolean elderGuardianRidable = false;
|
||||
@@ -762,6 +768,9 @@ public class PurpurWorldConfig {
|
||||
public boolean huskRidableInWater = false;
|
||||
public double huskMaxHealth = 20.0D;
|
||||
public double huskSpawnReinforcements = 0.1D;
|
||||
+ public boolean huskJockeyOnlyBaby = true;
|
||||
+ public double huskJockeyChance = 0.05D;
|
||||
+ public boolean huskJockeyTryExistingChickens = true;
|
||||
private void huskSettings() {
|
||||
huskRidable = getBoolean("mobs.husk.ridable", huskRidable);
|
||||
huskRidableInWater = getBoolean("mobs.husk.ridable-in-water", huskRidableInWater);
|
||||
@@ -772,6 +781,9 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
huskMaxHealth = getDouble("mobs.husk.attributes.max_health", huskMaxHealth);
|
||||
huskSpawnReinforcements = getDouble("mobs.husk.attributes.spawn_reinforcements", huskSpawnReinforcements);
|
||||
+ huskJockeyOnlyBaby = getBoolean("mobs.husk.jockey.only-babies", huskJockeyOnlyBaby);
|
||||
+ huskJockeyChance = getDouble("mobs.husk.jockey.chance", huskJockeyChance);
|
||||
+ huskJockeyTryExistingChickens = getBoolean("mobs.husk.jockey.try-existing-chickens", huskJockeyTryExistingChickens);
|
||||
}
|
||||
|
||||
public boolean illusionerRidable = false;
|
||||
@@ -1472,6 +1484,9 @@ public class PurpurWorldConfig {
|
||||
public boolean zombieRidableInWater = false;
|
||||
public double zombieMaxHealth = 20.0D;
|
||||
public double zombieSpawnReinforcements = 0.1D;
|
||||
+ public boolean zombieJockeyOnlyBaby = true;
|
||||
+ public double zombieJockeyChance = 0.05D;
|
||||
+ public boolean zombieJockeyTryExistingChickens = true;
|
||||
private void zombieSettings() {
|
||||
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
|
||||
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
|
||||
@@ -1482,6 +1497,9 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
zombieMaxHealth = getDouble("mobs.zombie.attributes.max_health", zombieMaxHealth);
|
||||
zombieSpawnReinforcements = getDouble("mobs.zombie.attributes.spawn_reinforcements", zombieSpawnReinforcements);
|
||||
+ zombieJockeyOnlyBaby = getBoolean("mobs.zombie.jockey.only-babies", zombieJockeyOnlyBaby);
|
||||
+ zombieJockeyChance = getDouble("mobs.zombie.jockey.chance", zombieJockeyChance);
|
||||
+ zombieJockeyTryExistingChickens = getBoolean("mobs.zombie.jockey.try-existing-chickens", zombieJockeyTryExistingChickens);
|
||||
}
|
||||
|
||||
public boolean zombieHorseRidableInWater = false;
|
||||
@@ -1515,6 +1533,9 @@ public class PurpurWorldConfig {
|
||||
public boolean zombieVillagerRidableInWater = false;
|
||||
public double zombieVillagerMaxHealth = 20.0D;
|
||||
public double zombieVillagerSpawnReinforcements = 0.1D;
|
||||
+ public boolean zombieVillagerJockeyOnlyBaby = true;
|
||||
+ public double zombieVillagerJockeyChance = 0.05D;
|
||||
+ public boolean zombieVillagerJockeyTryExistingChickens = true;
|
||||
private void zombieVillagerSettings() {
|
||||
zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable);
|
||||
zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater);
|
||||
@@ -1525,12 +1546,18 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
zombieVillagerMaxHealth = getDouble("mobs.zombie_villager.attributes.max_health", zombieVillagerMaxHealth);
|
||||
zombieVillagerSpawnReinforcements = getDouble("mobs.zombie_villager.attributes.spawn_reinforcements", zombieVillagerSpawnReinforcements);
|
||||
+ zombieVillagerJockeyOnlyBaby = getBoolean("mobs.zombie_villager.jockey.only-babies", zombieVillagerJockeyOnlyBaby);
|
||||
+ zombieVillagerJockeyChance = getDouble("mobs.zombie_villager.jockey.chance", zombieVillagerJockeyChance);
|
||||
+ zombieVillagerJockeyTryExistingChickens = getBoolean("mobs.zombie_villager.jockey.try-existing-chickens", zombieVillagerJockeyTryExistingChickens);
|
||||
}
|
||||
|
||||
public boolean zombifiedPiglinRidable = false;
|
||||
public boolean zombifiedPiglinRidableInWater = false;
|
||||
public double zombifiedPiglinMaxHealth = 20.0D;
|
||||
public double zombifiedPiglinSpawnReinforcements = 0.0D;
|
||||
+ public boolean zombifiedPiglinJockeyOnlyBaby = true;
|
||||
+ public double zombifiedPiglinJockeyChance = 0.05D;
|
||||
+ public boolean zombifiedPiglinJockeyTryExistingChickens = true;
|
||||
private void zombifiedPiglinSettings() {
|
||||
zombifiedPiglinRidable = getBoolean("mobs.zombified_piglin.ridable", zombifiedPiglinRidable);
|
||||
zombifiedPiglinRidableInWater = getBoolean("mobs.zombified_piglin.ridable-in-water", zombifiedPiglinRidableInWater);
|
||||
@@ -1541,5 +1568,8 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
zombifiedPiglinMaxHealth = getDouble("mobs.zombified_piglin.attributes.max_health", zombifiedPiglinMaxHealth);
|
||||
zombifiedPiglinSpawnReinforcements = getDouble("mobs.zombified_piglin.attributes.spawn_reinforcements", zombifiedPiglinSpawnReinforcements);
|
||||
+ zombifiedPiglinJockeyOnlyBaby = getBoolean("mobs.zombified_piglin.jockey.only-babies", zombifiedPiglinJockeyOnlyBaby);
|
||||
+ zombifiedPiglinJockeyChance = getDouble("mobs.zombified_piglin.jockey.chance", zombifiedPiglinJockeyChance);
|
||||
+ zombifiedPiglinJockeyTryExistingChickens = getBoolean("mobs.zombified_piglin.jockey.try-existing-chickens", zombifiedPiglinJockeyTryExistingChickens);
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 9 May 2019 18:26:06 -0500
|
||||
Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
index b643a2449e329560c936c0a06fb4cc494d0737a7..92e65f3fbc8f5d77bb8cc31e7a7780c2589f4227 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -32,6 +32,12 @@ public class EndCrystal extends Entity {
|
||||
private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
|
||||
public int time;
|
||||
public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
|
||||
+ // Purpur start
|
||||
+ private net.minecraft.world.entity.monster.Phantom targetPhantom;
|
||||
+ private int phantomBeamTicks = 0;
|
||||
+ private int phantomDamageCooldown = 0;
|
||||
+ private int idleCooldown = 0;
|
||||
+ // Purpur end
|
||||
|
||||
public EndCrystal(EntityType<? extends EndCrystal> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -81,7 +87,50 @@ public class EndCrystal extends Entity {
|
||||
// Paper end
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.phantomAttackedByCrystalRadius <= 0 || --idleCooldown > 0) {
|
||||
+ return; // on cooldown
|
||||
+ }
|
||||
+
|
||||
+ if (targetPhantom == null) {
|
||||
+ for (net.minecraft.world.entity.monster.Phantom phantom : level.getEntitiesOfClass(net.minecraft.world.entity.monster.Phantom.class, getBoundingBox().inflate(level.purpurConfig.phantomAttackedByCrystalRadius))) {
|
||||
+ if (phantom.hasLineOfSight(this)) {
|
||||
+ attackPhantom(phantom);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ setBeamTarget(new BlockPos(targetPhantom).offset(0, -2, 0));
|
||||
+ if (--phantomBeamTicks > 0 && targetPhantom.isAlive()) {
|
||||
+ phantomDamageCooldown--;
|
||||
+ if (targetPhantom.hasLineOfSight(this)) {
|
||||
+ if (phantomDamageCooldown <= 0) {
|
||||
+ phantomDamageCooldown = 20;
|
||||
+ targetPhantom.hurt(DamageSource.indirectMagic(this, this), level.purpurConfig.phantomAttackedByCrystalDamage);
|
||||
+ }
|
||||
+ } else {
|
||||
+ forgetPhantom(); // no longer in sight
|
||||
+ }
|
||||
+ } else {
|
||||
+ forgetPhantom(); // attacked long enough
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void attackPhantom(net.minecraft.world.entity.monster.Phantom phantom) {
|
||||
+ phantomDamageCooldown = 0;
|
||||
+ phantomBeamTicks = 60;
|
||||
+ targetPhantom = phantom;
|
||||
+ }
|
||||
+
|
||||
+ private void forgetPhantom() {
|
||||
+ targetPhantom = null;
|
||||
+ setBeamTarget(null);
|
||||
+ phantomBeamTicks = 0;
|
||||
+ phantomDamageCooldown = 0;
|
||||
+ idleCooldown = 60;
|
||||
}
|
||||
+ // Purpur end
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(CompoundTag nbt) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 5e71b3d5126d30626fbc9bd4b9eefebd20916e60..c314cb61f2e643de7eb12478d265f0664858f935 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -50,6 +50,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
Vec3 moveTargetPoint;
|
||||
BlockPos anchorPoint;
|
||||
Phantom.AttackPhase attackPhase;
|
||||
+ Vec3 crystalPosition; // Purpur
|
||||
|
||||
public Phantom(EntityType<? extends Phantom> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -117,6 +118,24 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.phantomMaxHealth);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ protected net.minecraft.world.level.storage.loot.LootContext.Builder createLootContext(boolean causedByPlayer, DamageSource source) {
|
||||
+ boolean dropped = false;
|
||||
+ if (lastHurtByPlayer == null && source.getEntity() instanceof net.minecraft.world.entity.boss.enderdragon.EndCrystal) {
|
||||
+ if (random.nextInt(5) < 1) {
|
||||
+ dropped = spawnAtLocation(new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.PHANTOM_MEMBRANE)) != null;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!dropped) {
|
||||
+ return super.createLootContext(causedByPlayer, source);
|
||||
+ }
|
||||
+ return new net.minecraft.world.level.storage.loot.LootContext.Builder((net.minecraft.server.level.ServerLevel) level);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCirclingCrystal() {
|
||||
+ return crystalPosition != null;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -131,11 +150,17 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
- this.goalSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
- this.goalSelector.addGoal(1, new Phantom.PhantomAttackStrategyGoal());
|
||||
- this.goalSelector.addGoal(2, new Phantom.PhantomSweepAttackGoal());
|
||||
- this.goalSelector.addGoal(3, new Phantom.PhantomCircleAroundAnchorGoal());
|
||||
- this.targetSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
+ // Purpur start
|
||||
+ this.goalSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this));
|
||||
+ if (level.purpurConfig.phantomOrbitCrystalRadius > 0) {
|
||||
+ this.goalSelector.addGoal(1, new FindCrystalGoal(this));
|
||||
+ this.goalSelector.addGoal(2, new OrbitCrystalGoal(this));
|
||||
+ }
|
||||
+ this.goalSelector.addGoal(3, new Phantom.PhantomAttackStrategyGoal());
|
||||
+ this.goalSelector.addGoal(4, new Phantom.PhantomSweepAttackGoal());
|
||||
+ this.goalSelector.addGoal(5, new Phantom.PhantomCircleAroundAnchorGoal());
|
||||
+ this.targetSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this));
|
||||
+ // Purpur end
|
||||
this.targetSelector.addGoal(1, new Phantom.PhantomAttackPlayerTargetGoal());
|
||||
}
|
||||
|
||||
@@ -325,6 +350,124 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
private AttackPhase() {}
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ class FindCrystalGoal extends Goal {
|
||||
+ private final Phantom phantom;
|
||||
+ private net.minecraft.world.entity.boss.enderdragon.EndCrystal crystal;
|
||||
+ private Comparator<net.minecraft.world.entity.boss.enderdragon.EndCrystal> comparator;
|
||||
+
|
||||
+ FindCrystalGoal(Phantom phantom) {
|
||||
+ this.phantom = phantom;
|
||||
+ this.comparator = Comparator.comparingDouble(phantom::distanceToSqr);
|
||||
+ this.setFlags(EnumSet.of(Flag.LOOK));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canUse() {
|
||||
+ double range = maxTargetRange();
|
||||
+ List<net.minecraft.world.entity.boss.enderdragon.EndCrystal> crystals = level.getEntitiesOfClass(net.minecraft.world.entity.boss.enderdragon.EndCrystal.class, phantom.getBoundingBox().inflate(range));
|
||||
+ if (crystals.isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ crystals.sort(comparator);
|
||||
+ crystal = crystals.get(0);
|
||||
+ if (phantom.distanceToSqr(crystal) > range * range) {
|
||||
+ crystal = null;
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canContinueToUse() {
|
||||
+ if (crystal == null || !crystal.isAlive()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ double range = maxTargetRange();
|
||||
+ return phantom.distanceToSqr(crystal) <= (range * range) * 2;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void start() {
|
||||
+ phantom.crystalPosition = new Vec3(crystal.getX(), crystal.getY() + (phantom.random.nextInt(10) + 10), crystal.getZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void stop() {
|
||||
+ crystal = null;
|
||||
+ phantom.crystalPosition = null;
|
||||
+ super.stop();
|
||||
+ }
|
||||
+
|
||||
+ private double maxTargetRange() {
|
||||
+ return phantom.level.purpurConfig.phantomOrbitCrystalRadius;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ class OrbitCrystalGoal extends Goal {
|
||||
+ private final Phantom phantom;
|
||||
+ private float offset;
|
||||
+ private float radius;
|
||||
+ private float verticalChange;
|
||||
+ private float direction;
|
||||
+
|
||||
+ OrbitCrystalGoal(Phantom phantom) {
|
||||
+ this.phantom = phantom;
|
||||
+ this.setFlags(EnumSet.of(Flag.MOVE));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canUse() {
|
||||
+ return phantom.isCirclingCrystal();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void start() {
|
||||
+ this.radius = 5.0F + phantom.random.nextFloat() * 10.0F;
|
||||
+ this.verticalChange = -4.0F + phantom.random.nextFloat() * 9.0F;
|
||||
+ this.direction = phantom.random.nextBoolean() ? 1.0F : -1.0F;
|
||||
+ updateOffset();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void tick() {
|
||||
+ if (phantom.random.nextInt(350) == 0) {
|
||||
+ this.verticalChange = -4.0F + phantom.random.nextFloat() * 9.0F;
|
||||
+ }
|
||||
+ if (phantom.random.nextInt(250) == 0) {
|
||||
+ ++this.radius;
|
||||
+ if (this.radius > 15.0F) {
|
||||
+ this.radius = 5.0F;
|
||||
+ this.direction = -this.direction;
|
||||
+ }
|
||||
+ }
|
||||
+ if (phantom.random.nextInt(450) == 0) {
|
||||
+ this.offset = phantom.random.nextFloat() * 2.0F * 3.1415927F;
|
||||
+ updateOffset();
|
||||
+ }
|
||||
+ if (phantom.moveTargetPoint.distanceToSqr(phantom.getX(), phantom.getY(), phantom.getZ()) < 4.0D) {
|
||||
+ updateOffset();
|
||||
+ }
|
||||
+ if (phantom.moveTargetPoint.y < phantom.getY() && !phantom.level.isEmptyBlock(new BlockPos(phantom).below(1))) {
|
||||
+ this.verticalChange = Math.max(1.0F, this.verticalChange);
|
||||
+ updateOffset();
|
||||
+ }
|
||||
+ if (phantom.moveTargetPoint.y > phantom.getY() && !phantom.level.isEmptyBlock(new BlockPos(phantom).above(1))) {
|
||||
+ this.verticalChange = Math.min(-1.0F, this.verticalChange);
|
||||
+ updateOffset();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void updateOffset() {
|
||||
+ this.offset += this.direction * 15.0F * 0.017453292F;
|
||||
+ phantom.moveTargetPoint = phantom.crystalPosition.add(
|
||||
+ this.radius * Mth.cos(this.offset),
|
||||
+ -4.0F + this.verticalChange,
|
||||
+ this.radius * Mth.sin(this.offset));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
private class PhantomMoveControl extends net.pl3x.purpur.controller.FlyingMoveControllerWASD { // Purpur
|
||||
|
||||
private float speed = 0.1F;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index f15963106c5592e1ea7ef715ed79d7c62e35d308..96bb947390a3d9e0d37ddbce2ff621c53e2c3f58 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -953,6 +953,9 @@ public class PurpurWorldConfig {
|
||||
public int phantomFlameFireTime = 8;
|
||||
public boolean phantomAllowGriefing = false;
|
||||
public double phantomMaxHealth = 20.0D;
|
||||
+ public double phantomAttackedByCrystalRadius = 0.0D;
|
||||
+ public float phantomAttackedByCrystalDamage = 1.0F;
|
||||
+ public double phantomOrbitCrystalRadius = 0.0D;
|
||||
private void phantomSettings() {
|
||||
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
|
||||
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
|
||||
@@ -966,6 +969,9 @@ public class PurpurWorldConfig {
|
||||
set("mobs.phantom.attributes.max_health", oldValue);
|
||||
}
|
||||
phantomMaxHealth = getDouble("mobs.phantom.attributes.max_health", phantomMaxHealth);
|
||||
+ phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius);
|
||||
+ phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage);
|
||||
+ phantomOrbitCrystalRadius = getDouble("mobs.phantom.orbit-crystal-radius", phantomOrbitCrystalRadius);
|
||||
}
|
||||
|
||||
public boolean pigRidable = false;
|
||||
@@ -1,91 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 3 Jul 2020 00:03:52 -0500
|
||||
Subject: [PATCH] Add phantom spawning options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
index 79504dc3448402e73b09c4232b1fd0488872cf68..300c9f136edace2babea4a574090b1849b2adf76 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
@@ -43,8 +43,8 @@ public class PhantomSpawner implements CustomSpawner {
|
||||
if (this.nextTick > 0) {
|
||||
return 0;
|
||||
} else {
|
||||
- this.nextTick += (60 + random.nextInt(60)) * 20;
|
||||
- if (world.getSkyDarken() < 5 && world.dimensionType().hasSkyLight()) {
|
||||
+ this.nextTick += world.purpurConfig.phantomSpawnDelayMin + world.random.nextInt(world.purpurConfig.phantomSpawnDelayMax - world.purpurConfig.phantomSpawnDelayMin + 1); // Purpur
|
||||
+ if (world.getSkyDarken() < world.purpurConfig.phantomSpawnMinSkyDarkness && world.dimensionType().hasSkyLight()) { // Purpur
|
||||
return 0;
|
||||
} else {
|
||||
int i = 0;
|
||||
@@ -56,22 +56,22 @@ public class PhantomSpawner implements CustomSpawner {
|
||||
if (!entityhuman.isSpectator() && (!world.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper
|
||||
BlockPos blockposition = entityhuman.blockPosition();
|
||||
|
||||
- if (!world.dimensionType().hasSkyLight() || blockposition.getY() >= world.getSeaLevel() && world.canSeeSky(blockposition)) {
|
||||
+ if (!world.dimensionType().hasSkyLight() || (!world.purpurConfig.phantomSpawnOnlyAboveSeaLevel || blockposition.getY() >= world.getSeaLevel()) && (!world.purpurConfig.phantomSpawnOnlyWithVisibleSky || world.canSeeSky(blockposition))) { // Purpur
|
||||
DifficultyInstance difficultydamagescaler = world.getCurrentDifficultyAt(blockposition);
|
||||
|
||||
- if (difficultydamagescaler.isHarderThan(random.nextFloat() * 3.0F)) {
|
||||
+ if (difficultydamagescaler.isHarderThan(random.nextFloat() * (float) world.purpurConfig.phantomSpawnLocalDifficultyChance)) { // Purpur
|
||||
ServerStatsCounter serverstatisticmanager = ((ServerPlayer) entityhuman).getStats();
|
||||
int j = Mth.clamp(serverstatisticmanager.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
|
||||
boolean flag2 = true;
|
||||
|
||||
- if (random.nextInt(j) >= 72000) {
|
||||
- BlockPos blockposition1 = blockposition.above(20 + random.nextInt(15)).east(-10 + random.nextInt(21)).south(-10 + random.nextInt(21));
|
||||
+ if (random.nextInt(j) >= world.purpurConfig.phantomSpawnMinTimeSinceSlept) { // Purpur
|
||||
+ BlockPos blockposition1 = blockposition.above(world.purpurConfig.phantomSpawnMinOverhead + random.nextInt(world.purpurConfig.phantomSpawnMaxOverhead - world.purpurConfig.phantomSpawnMinOverhead + 1)).east(-world.purpurConfig.phantomSpawnOverheadRadius + random.nextInt(world.purpurConfig.phantomSpawnOverheadRadius * 2 + 1)).south(-world.purpurConfig.phantomSpawnOverheadRadius + random.nextInt(world.purpurConfig.phantomSpawnOverheadRadius * 2 + 1)); // Purpur
|
||||
BlockState iblockdata = world.getBlockState(blockposition1);
|
||||
FluidState fluid = world.getFluidState(blockposition1);
|
||||
|
||||
if (NaturalSpawner.isValidEmptySpawnBlock((BlockGetter) world, blockposition1, iblockdata, fluid, EntityType.PHANTOM)) {
|
||||
SpawnGroupData groupdataentity = null;
|
||||
- int k = 1 + random.nextInt(difficultydamagescaler.getDifficulty().getId() + 1);
|
||||
+ int k = world.purpurConfig.phantomSpawnMinPerAttempt + world.random.nextInt((world.purpurConfig.phantomSpawnMaxPerAttempt < 0 ? difficultydamagescaler.getDifficulty().getId() : world.purpurConfig.phantomSpawnMaxPerAttempt - world.purpurConfig.phantomSpawnMinPerAttempt) + 1); // Purpur
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
// Paper start
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 96bb947390a3d9e0d37ddbce2ff621c53e2c3f58..e92c0c732af5581c266b146f360bce05364d8a28 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -956,6 +956,18 @@ public class PurpurWorldConfig {
|
||||
public double phantomAttackedByCrystalRadius = 0.0D;
|
||||
public float phantomAttackedByCrystalDamage = 1.0F;
|
||||
public double phantomOrbitCrystalRadius = 0.0D;
|
||||
+ public int phantomSpawnDelayMin = 1200;
|
||||
+ public int phantomSpawnDelayMax = 2400;
|
||||
+ public int phantomSpawnMinSkyDarkness = 5;
|
||||
+ public boolean phantomSpawnOnlyAboveSeaLevel = true;
|
||||
+ public boolean phantomSpawnOnlyWithVisibleSky = true;
|
||||
+ public double phantomSpawnLocalDifficultyChance = 3.0D;
|
||||
+ public int phantomSpawnMinTimeSinceSlept = 72000;
|
||||
+ public int phantomSpawnMinOverhead = 20;
|
||||
+ public int phantomSpawnMaxOverhead = 35;
|
||||
+ public int phantomSpawnOverheadRadius = 10;
|
||||
+ public int phantomSpawnMinPerAttempt = 1;
|
||||
+ public int phantomSpawnMaxPerAttempt = -1;
|
||||
private void phantomSettings() {
|
||||
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
|
||||
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
|
||||
@@ -972,6 +984,18 @@ public class PurpurWorldConfig {
|
||||
phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius);
|
||||
phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage);
|
||||
phantomOrbitCrystalRadius = getDouble("mobs.phantom.orbit-crystal-radius", phantomOrbitCrystalRadius);
|
||||
+ phantomSpawnDelayMin = getInt("mobs.phantom.spawn.delay.min", phantomSpawnDelayMin);
|
||||
+ phantomSpawnDelayMax = getInt("mobs.phantom.spawn.delay.max", phantomSpawnDelayMax);
|
||||
+ phantomSpawnMinSkyDarkness = getInt("mobs.phantom.spawn.min-sky-darkness", phantomSpawnMinSkyDarkness);
|
||||
+ phantomSpawnOnlyAboveSeaLevel = getBoolean("mobs.phantom.spawn.only-above-sea-level", phantomSpawnOnlyAboveSeaLevel);
|
||||
+ phantomSpawnOnlyWithVisibleSky = getBoolean("mobs.phantom.spawn.only-with-visible-sky", phantomSpawnOnlyWithVisibleSky);
|
||||
+ phantomSpawnLocalDifficultyChance = getDouble("mobs.phantom.spawn.local-difficulty-chance", phantomSpawnLocalDifficultyChance);
|
||||
+ phantomSpawnMinTimeSinceSlept = getInt("mobs.phantom.spawn.min-time-since-slept", phantomSpawnMinTimeSinceSlept);
|
||||
+ phantomSpawnMinOverhead = getInt("mobs.phantom.spawn.overhead.min", phantomSpawnMinOverhead);
|
||||
+ phantomSpawnMaxOverhead = getInt("mobs.phantom.spawn.overhead.max", phantomSpawnMaxOverhead);
|
||||
+ phantomSpawnOverheadRadius = getInt("mobs.phantom.spawn.overhead.radius", phantomSpawnOverheadRadius);
|
||||
+ phantomSpawnMinPerAttempt = getInt("mobs.phantom.spawn.per-attempt.min", phantomSpawnMinPerAttempt);
|
||||
+ phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt);
|
||||
}
|
||||
|
||||
public boolean pigRidable = false;
|
||||
@@ -1,55 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 4 Jul 2020 13:12:43 -0500
|
||||
Subject: [PATCH] Implement bed explosion options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
index e3ff04fe21761db65fb03c5e58ecd5823f0507c6..6362c9dcfbc980a0591ac6dfebe45e475b73d020 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
@@ -97,7 +97,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
world.removeBlock(blockposition1, false);
|
||||
}
|
||||
|
||||
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
||||
if (!this.kickVillagerOutOfBed(world, pos)) {
|
||||
@@ -146,7 +146,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
world.removeBlock(blockposition1, false);
|
||||
}
|
||||
|
||||
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index e92c0c732af5581c266b146f360bce05364d8a28..4405108543e36b74be2678d6e5b1de9363db5151 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -292,6 +292,22 @@ public class PurpurWorldConfig {
|
||||
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
||||
}
|
||||
|
||||
+ public boolean bedExplode = true;
|
||||
+ 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);
|
||||
+ bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower);
|
||||
+ bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire);
|
||||
+ try {
|
||||
+ bedExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.bed.explosion-effect`! Using default of `DESTROY`");
|
||||
+ bedExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean dispenserApplyCursedArmor = true;
|
||||
private void dispenserSettings() {
|
||||
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 4 Jul 2020 13:23:19 -0500
|
||||
Subject: [PATCH] Implement respawn anchor explosion options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
index 0a5d563700c9f806139001181f01fa9d0111f792..1aae3d27ed6c0433312502a59fe1eb70b7d14ac3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -120,7 +120,7 @@ public class RespawnAnchorBlock extends Block {
|
||||
return pos.equals(explodedPos) && bl2 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
|
||||
}
|
||||
};
|
||||
- world.explode((Entity)null, DamageSource.badRespawnPointExplosion(), explosionDamageCalculator, (double)explodedPos.getX() + 0.5D, (double)explodedPos.getY() + 0.5D, (double)explodedPos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ if (world.purpurConfig.respawnAnchorExplode) world.explode(null, DamageSource.badRespawnPointExplosion(), explosionDamageCalculator, (double) explodedPos.getX() + 0.5D, (double) explodedPos.getY() + 0.5D, (double) explodedPos.getZ() + 0.5D, (float) world.purpurConfig.respawnAnchorExplosionPower, world.purpurConfig.respawnAnchorExplosionFire, world.purpurConfig.respawnAnchorExplosionEffect); // Purpur
|
||||
}
|
||||
|
||||
public static boolean canSetSpawn(Level world) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 4405108543e36b74be2678d6e5b1de9363db5151..45e2c201f4d6768e029d075dfcb3716c92d394a4 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -336,6 +336,22 @@ public class PurpurWorldConfig {
|
||||
waterInfiniteRequiredSources = getInt("blocks.water.infinite-required-sources", waterInfiniteRequiredSources);
|
||||
}
|
||||
|
||||
+ public boolean respawnAnchorExplode = true;
|
||||
+ public double respawnAnchorExplosionPower = 5.0D;
|
||||
+ public boolean respawnAnchorExplosionFire = true;
|
||||
+ public Explosion.BlockInteraction respawnAnchorExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ private void respawnAnchorSettings() {
|
||||
+ respawnAnchorExplode = getBoolean("blocks.respawn_anchor.explode", respawnAnchorExplode);
|
||||
+ respawnAnchorExplosionPower = getDouble("blocks.respawn_anchor.explosion-power", respawnAnchorExplosionPower);
|
||||
+ respawnAnchorExplosionFire = getBoolean("blocks.respawn_anchor.explosion-fire", respawnAnchorExplosionFire);
|
||||
+ try {
|
||||
+ respawnAnchorExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.respawn_anchor.explosion-effect", respawnAnchorExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.respawn_anchor.explosion-effect`! Using default of `DESTROY`");
|
||||
+ respawnAnchorExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean signAllowColors = false;
|
||||
public boolean signRightClickEdit = false;
|
||||
private void signSettings() {
|
||||
@@ -1,85 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 5 Jul 2020 23:40:16 -0500
|
||||
Subject: [PATCH] Add allow water in end world option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
index 69c992ef0c526adf35907de7726832605187beb6..6356d5fdb349063071c9119ae776c22e0b321d77 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
@@ -170,7 +170,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
// CraftBukkit end
|
||||
if (!flag1) {
|
||||
return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand
|
||||
- } else if (world.dimensionType().ultraWarm() && this.content.is((Tag) FluidTags.WATER)) {
|
||||
+ } else if ((world.isNether() || (world.isTheEnd() && !net.pl3x.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) && this.content.is((Tag) FluidTags.WATER)) {
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY();
|
||||
int k = blockposition.getZ();
|
||||
@@ -178,7 +178,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
world.playSound(entityhuman, blockposition, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
- world.addParticle(ParticleTypes.LARGE_SMOKE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
+ ((ServerLevel) world).sendParticles(null, ParticleTypes.LARGE_SMOKE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0.0D, true); // Purpur
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index c44dc4cefdd74437a39283800aa6e93372525fbd..a1d9e9caed9e922cc65512a36019a0993bf549c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1486,4 +1486,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public boolean isNether() {
|
||||
+ return getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isTheEnd() {
|
||||
+ return getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
index df4f2c729f09d5229553308e4876f29de648543f..f2b0278679fa649bbc2904660e0dc9ab4ad54542 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
@@ -27,7 +27,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
|
||||
super.playerDestroy(world, player, pos, state, blockEntity, stack);
|
||||
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) {
|
||||
- if (world.dimensionType().ultraWarm()) {
|
||||
+ if (world.isNether() || (world.isTheEnd() && !net.pl3x.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) { // Purpur
|
||||
world.removeBlock(pos, false);
|
||||
return;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (world.dimensionType().ultraWarm()) {
|
||||
+ if (world.isNether() || (world.isTheEnd() && !net.pl3x.purpur.PurpurConfig.allowWaterPlacementInTheEnd)) { // Purpur
|
||||
world.removeBlock(pos, false);
|
||||
} else {
|
||||
world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState());
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index c202cb7e325b8ace1ed3aa3ba86419d7571d0f0e..b2b7d0a89a6a0d3482caea8fcad1d46de7e4b8ee 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -244,6 +244,11 @@ public class PurpurConfig {
|
||||
dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
||||
}
|
||||
|
||||
+ public static boolean allowWaterPlacementInTheEnd = true;
|
||||
+ private static void allowWaterPlacementInEnd() {
|
||||
+ allowWaterPlacementInTheEnd = getBoolean("settings.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd);
|
||||
+ }
|
||||
+
|
||||
public static boolean loggerSuppressInitLegacyMaterialError = false;
|
||||
public static boolean loggerSuppressIgnoredAdvancementWarnings = false;
|
||||
public static boolean loggerSuppressUnrecognizedRecipeErrors = false;
|
||||
@@ -1,76 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 3 Nov 2020 01:25:06 -0600
|
||||
Subject: [PATCH] Allow color codes in books
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 367876813fcf772baf6542e1422b5c9572056a18..ba6a674c2b18108390c7b9d2bb313a603d9909b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1219,13 +1219,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
itemstack1.setTag(nbttagcompound.copy());
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ boolean hasPerm = getCraftPlayer().hasPermission("purpur.book.color.edit") || getCraftPlayer().hasPermission("purpur.book.color.sign"); // Purpur
|
||||
itemstack1.addTagElement("author", (Tag) StringTag.valueOf(this.player.getName().getString()));
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- itemstack1.addTagElement("title", (Tag) StringTag.valueOf(title.getFiltered()));
|
||||
+ itemstack1.addTagElement("title", (Tag) StringTag.valueOf(color(title.getFiltered(), hasPerm)));
|
||||
} else {
|
||||
- itemstack1.addTagElement("filtered_title", (Tag) StringTag.valueOf(title.getFiltered()));
|
||||
- itemstack1.addTagElement("title", (Tag) StringTag.valueOf(title.getRaw()));
|
||||
+ itemstack1.addTagElement("filtered_title", (Tag) StringTag.valueOf(color(title.getFiltered(), hasPerm)));
|
||||
+ itemstack1.addTagElement("title", (Tag) StringTag.valueOf(color(title.getRaw(), hasPerm)));
|
||||
}
|
||||
+ // Purpur end
|
||||
|
||||
this.updateBookPages(pages, (s) -> {
|
||||
return Component.Serializer.toJson((Component) (new TextComponent(s)));
|
||||
@@ -1237,10 +1240,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
private void updateBookPages(List<TextFilter.FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit
|
||||
ListTag nbttaglist = new ListTag();
|
||||
|
||||
+ // Purpur start
|
||||
+ boolean hasPerm = getCraftPlayer().hasPermission("purpur.book.color.edit");
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- Stream<StringTag> stream = list.stream().map((itextfilter_a) -> { // CraftBukkit - decompile error
|
||||
- return StringTag.valueOf((String) unaryoperator.apply(itextfilter_a.getFiltered()));
|
||||
+ Stream<StringTag> stream = list.stream().map(s -> color(s.getFiltered(), hasPerm, false)).map((s) -> { // CraftBukkit - decompile error
|
||||
+ return StringTag.valueOf((String) unaryoperator.apply(s));
|
||||
});
|
||||
+ // Purpur end
|
||||
|
||||
Objects.requireNonNull(nbttaglist);
|
||||
stream.forEach(nbttaglist::add);
|
||||
@@ -1250,10 +1256,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
for (int j = list.size(); i < j; ++i) {
|
||||
TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) list.get(i);
|
||||
- String s = itextfilter_a.getRaw();
|
||||
+ String s = color(itextfilter_a.getRaw(), hasPerm, false);
|
||||
|
||||
nbttaglist.add(StringTag.valueOf((String) unaryoperator.apply(s)));
|
||||
- String s1 = itextfilter_a.getFiltered();
|
||||
+ String s1 = color(itextfilter_a.getFiltered(), hasPerm, false);
|
||||
|
||||
if (!s.equals(s1)) {
|
||||
nbttagcompound.putString(String.valueOf(i), (String) unaryoperator.apply(s1));
|
||||
@@ -1269,6 +1275,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent)
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ private String color(String str, boolean hasPerm) {
|
||||
+ return color(str, hasPerm, true);
|
||||
+ }
|
||||
+
|
||||
+ private String color(String str, boolean hasPerm, boolean parseHex) {
|
||||
+ return hasPerm ? org.bukkit.ChatColor.color(str, parseHex) : str;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public void handleEntityTagQuery(ServerboundEntityTagQuery packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
@@ -1,106 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 11 Jul 2020 19:41:34 -0500
|
||||
Subject: [PATCH] Entity lifespan
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 7be2798a1b190b44445e3abd55c0598e3432bf27..a268895fa22b81c164837a731d4bde51a68190c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -126,6 +126,7 @@ public abstract class Mob extends LivingEntity {
|
||||
private BlockPos restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
+ public int ticksSinceLastInteraction; // Purpur
|
||||
public boolean aware = true; // CraftBukkit
|
||||
|
||||
protected Mob(EntityType<? extends Mob> type, Level world) {
|
||||
@@ -283,6 +284,7 @@ public abstract class Mob extends LivingEntity {
|
||||
entityliving = null;
|
||||
}
|
||||
}
|
||||
+ if (entityliving instanceof ServerPlayer) this.ticksSinceLastInteraction = 0; // Purpur
|
||||
this.target = entityliving;
|
||||
return true;
|
||||
// CraftBukkit end
|
||||
@@ -327,9 +329,35 @@ public abstract class Mob extends LivingEntity {
|
||||
this.playAmbientSound();
|
||||
}
|
||||
|
||||
+ incrementTicksSinceLastInteraction();
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ private void incrementTicksSinceLastInteraction() {
|
||||
+ ++ticksSinceLastInteraction;
|
||||
+ //if (hasRider()) {
|
||||
+ // ticksSinceLastInteraction = 0;
|
||||
+ // return;
|
||||
+ //}
|
||||
+ if (level.purpurConfig.entityLifeSpan <= 0) {
|
||||
+ return; // feature disabled
|
||||
+ }
|
||||
+ if (!this.removeWhenFarAway(0) || isPersistenceRequired() || requiresCustomPersistence() || hasCustomName()) {
|
||||
+ return; // mob persistent
|
||||
+ }
|
||||
+ if (ticksSinceLastInteraction > level.purpurConfig.entityLifeSpan) {
|
||||
+ this.discard();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hurt(DamageSource source, float amount) {
|
||||
+ if (source.getEntity() instanceof ServerPlayer) this.ticksSinceLastInteraction = 0; // Purpur
|
||||
+ return super.hurt(source, amount);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
protected void playHurtSound(DamageSource source) {
|
||||
this.resetAmbientSoundTime();
|
||||
@@ -513,6 +541,7 @@ public abstract class Mob extends LivingEntity {
|
||||
}
|
||||
|
||||
nbt.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
|
||||
+ nbt.putInt("Purpur.ticksSinceLastInteraction", ticksSinceLastInteraction); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -583,6 +612,11 @@ public abstract class Mob extends LivingEntity {
|
||||
this.aware = nbt.getBoolean("Bukkit.Aware");
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Purpur start
|
||||
+ if (nbt.contains("Purpur.ticksSinceLastInteraction")) {
|
||||
+ ticksSinceLastInteraction = nbt.getInt("Purpur.ticksSinceLastInteraction");
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1590,6 +1624,7 @@ public abstract class Mob extends LivingEntity {
|
||||
this.setLastHurtMob(target);
|
||||
}
|
||||
|
||||
+ if (target instanceof ServerPlayer) this.ticksSinceLastInteraction = 0; // Purpur
|
||||
return flag;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 45e2c201f4d6768e029d075dfcb3716c92d394a4..a16797934b4c803828996c7a7f1b18f6b4925250 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -112,6 +112,11 @@ public class PurpurWorldConfig {
|
||||
elytraDamagePerTridentBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.trident", elytraDamagePerTridentBoost);
|
||||
}
|
||||
|
||||
+ public int entityLifeSpan = 0;
|
||||
+ private void entitySettings() {
|
||||
+ entityLifeSpan = getInt("gameplay-mechanics.entity-lifespan", entityLifeSpan);
|
||||
+ }
|
||||
+
|
||||
public List<Item> itemImmuneToCactus = new ArrayList<>();
|
||||
public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
||||
public List<Item> itemImmuneToFire = new ArrayList<>();
|
||||
@@ -1,76 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 13 Jul 2020 11:40:00 -0500
|
||||
Subject: [PATCH] Add option to teleport to spawn if outside world border
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c488f0c2db28b5eff7209fe900ca27408fc1ce0e..dd3b3e4821dbd3a1fb73ddcc31c022175c18708d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2519,5 +2519,25 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Purpur start
|
||||
+ public void teleport(Location to) {
|
||||
+ this.ejectPassengers();
|
||||
+ this.stopRiding(true);
|
||||
|
||||
+ if (this.isSleeping()) {
|
||||
+ this.stopSleepInBed(true, false);
|
||||
+ }
|
||||
+
|
||||
+ if (this.containerMenu != this.inventoryMenu) {
|
||||
+ this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.TELEPORT);
|
||||
+ }
|
||||
+
|
||||
+ ServerLevel toLevel = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+ if (this.level == toLevel) {
|
||||
+ this.connection.teleport(to);
|
||||
+ } else {
|
||||
+ this.server.getPlayerList().moveToWorld(this, toLevel, true, to, !toLevel.paperConfig.disableTeleportationSuffocationCheck);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 71ef80e636ac7c208b362410eaaffa497dd9ceca..63936445bc9005c11bbe669e29897786963e7626 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -45,6 +45,7 @@ import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -407,6 +408,7 @@ public abstract class LivingEntity extends Entity {
|
||||
double d1 = this.level.getWorldBorder().getDamagePerBlock();
|
||||
|
||||
if (d1 > 0.0D) {
|
||||
+ if (level.purpurConfig.teleportIfOutsideBorder && this instanceof ServerPlayer) { ((ServerPlayer) this).teleport(MCUtil.toLocation(level, ((ServerLevel) level).getSharedSpawnPos())); return; } // Purpur
|
||||
this.hurt(DamageSource.IN_WALL, (float) Math.max(1, Mth.floor(-d0 * d1)));
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index a16797934b4c803828996c7a7f1b18f6b4925250..213950f1d36c504824d0053843c3fe869f9eed84 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -231,6 +231,7 @@ public class PurpurWorldConfig {
|
||||
public boolean playerInvulnerableWhileAcceptingResourcePack = false;
|
||||
public String playerDeathExpDropEquation = "expLevel * 7";
|
||||
public int playerDeathExpDropMax = 100;
|
||||
+ public boolean teleportIfOutsideBorder = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -246,6 +247,7 @@ public class PurpurWorldConfig {
|
||||
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
|
||||
playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
|
||||
playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
|
||||
+ teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
|
||||
}
|
||||
|
||||
public boolean silkTouchEnabled = false;
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 13 Jul 2020 13:49:41 -0500
|
||||
Subject: [PATCH] Squid EAR immunity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 213950f1d36c504824d0053843c3fe869f9eed84..1c1a1ed14a1e2a80b3a26cb990b2577904d73b0b 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1289,6 +1289,7 @@ public class PurpurWorldConfig {
|
||||
|
||||
public boolean squidRidable = false;
|
||||
public double squidMaxHealth = 10.0D;
|
||||
+ public boolean squidImmuneToEAR = true;
|
||||
private void squidSettings() {
|
||||
squidRidable = getBoolean("mobs.squid.ridable", squidRidable);
|
||||
if (PurpurConfig.version < 10) {
|
||||
@@ -1297,6 +1298,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.squid.attributes.max_health", oldValue);
|
||||
}
|
||||
squidMaxHealth = getDouble("mobs.squid.attributes.max_health", squidMaxHealth);
|
||||
+ squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
|
||||
}
|
||||
|
||||
public boolean spiderRidable = false;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 12ffca6a545e4af5c66ecd8b15d9d8e20a6327c1..a42a96819abe9651ea31a6f869d0017303a17323 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.entity.ambient.AmbientCreature;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.animal.Bee;
|
||||
import net.minecraft.world.entity.animal.Sheep;
|
||||
+import net.minecraft.world.entity.animal.Squid;
|
||||
import net.minecraft.world.entity.animal.WaterAnimal;
|
||||
import net.minecraft.world.entity.animal.horse.Llama;
|
||||
import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||
@@ -357,6 +358,7 @@ public class ActivationRange
|
||||
*/
|
||||
public static boolean checkIfActive(Entity entity)
|
||||
{
|
||||
+ if (entity.level.purpurConfig.squidImmuneToEAR && entity instanceof Squid) return true; // Purpur
|
||||
// Never safe to skip fireworks or entities not yet added to chunk
|
||||
if ( entity instanceof FireworkRocketEntity ) {
|
||||
return true;
|
||||
@@ -1,72 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: draycia <lonelyyordle@gmail.com>
|
||||
Date: Sun, 12 Apr 2020 20:41:59 -0700
|
||||
Subject: [PATCH] Phantoms burn in light
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index c314cb61f2e643de7eb12478d265f0664858f935..789224c6285cde2009e000d98e190c36459f04e8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -51,6 +51,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
BlockPos anchorPoint;
|
||||
Phantom.AttackPhase attackPhase;
|
||||
Vec3 crystalPosition; // Purpur
|
||||
+ private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur
|
||||
|
||||
public Phantom(EntityType<? extends Phantom> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -230,7 +231,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
@Override
|
||||
public void aiStep() {
|
||||
- if (this.isAlive() && getRider() == null && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning // Purpur
|
||||
+ if (this.isAlive() && getRider() == null && (((shouldBurnInDay || level.purpurConfig.phantomBurnInDaylight) && this.isSunBurnTick()) || (level.purpurConfig.phantomBurnInLight > 0 && level.getMaxLocalRawBrightness(blockPosition()) >= level.purpurConfig.phantomBurnInLight))) { // Paper - Configurable Burning // Purpur
|
||||
this.setSecondsOnFire(8);
|
||||
}
|
||||
|
||||
@@ -630,6 +631,12 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
return false;
|
||||
} else if (!entityliving.isAlive()) {
|
||||
return false;
|
||||
+ // Purpur start
|
||||
+ } else if (level.purpurConfig.phantomBurnInLight > 0 && level.getLightEmission(new BlockPos(Phantom.this)) >= level.purpurConfig.phantomBurnInLight) {
|
||||
+ return false;
|
||||
+ } else if (level.purpurConfig.phantomIgnorePlayersWithTorch && (TORCH.test(entityliving.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(entityliving.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND)))) {
|
||||
+ return false;
|
||||
+ // Purpur end
|
||||
} else if (entityliving instanceof Player && (((Player) entityliving).isSpectator() || ((Player) entityliving).isCreative())) {
|
||||
return false;
|
||||
} else if (!this.canUse()) {
|
||||
@@ -767,6 +774,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
this.nextScanTick = 60;
|
||||
List<Player> list = Phantom.this.level.getNearbyPlayers(this.attackTargeting, (LivingEntity) Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
||||
|
||||
+ if (level.purpurConfig.phantomIgnorePlayersWithTorch) list.removeIf(human -> TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND)));// Purpur
|
||||
if (!list.isEmpty()) {
|
||||
list.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed()); // Paper - remap fix
|
||||
Iterator iterator = list.iterator();
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 1c1a1ed14a1e2a80b3a26cb990b2577904d73b0b..f06fb11df26f7a7e3fdb1f7ce21aa67e3ed5a07d 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1007,6 +1007,9 @@ public class PurpurWorldConfig {
|
||||
public int phantomSpawnOverheadRadius = 10;
|
||||
public int phantomSpawnMinPerAttempt = 1;
|
||||
public int phantomSpawnMaxPerAttempt = -1;
|
||||
+ public int phantomBurnInLight = 0;
|
||||
+ public boolean phantomIgnorePlayersWithTorch = false;
|
||||
+ public boolean phantomBurnInDaylight = true;
|
||||
private void phantomSettings() {
|
||||
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
|
||||
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
|
||||
@@ -1035,6 +1038,9 @@ public class PurpurWorldConfig {
|
||||
phantomSpawnOverheadRadius = getInt("mobs.phantom.spawn.overhead.radius", phantomSpawnOverheadRadius);
|
||||
phantomSpawnMinPerAttempt = getInt("mobs.phantom.spawn.per-attempt.min", phantomSpawnMinPerAttempt);
|
||||
phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt);
|
||||
+ phantomBurnInLight = getInt("mobs.phantom.burn-in-light", phantomBurnInLight);
|
||||
+ phantomBurnInDaylight = getBoolean("mobs.phantom.burn-in-daylight", phantomBurnInDaylight);
|
||||
+ phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch);
|
||||
}
|
||||
|
||||
public boolean pigRidable = false;
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: draycia <lonelyyordle@gmail.com>
|
||||
Date: Tue, 31 Mar 2020 23:48:55 -0700
|
||||
Subject: [PATCH] Configurable villager breeding
|
||||
|
||||
|
||||
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 f5a24c2be1c9c4148594130107981ad7434bb835..c942bcedcfb260141589465105091c67d6e762c9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -751,7 +751,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
- return this.foodLevel + this.countFoodPointsInInventory() >= 12 && this.getAge() == 0;
|
||||
+ return level.purpurConfig.villagerCanBreed && this.foodLevel + this.countFoodPointsInInventory() >= 12 && this.getAge() == 0;
|
||||
}
|
||||
|
||||
private boolean hungry() {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index f06fb11df26f7a7e3fdb1f7ce21aa67e3ed5a07d..970fee2f23d79ca702e6e2ca22afac434945cf9f 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1432,6 +1432,7 @@ public class PurpurWorldConfig {
|
||||
public boolean villagerCanBeLeashed = false;
|
||||
public int villagerSpawnIronGolemRadius = 0;
|
||||
public int villagerSpawnIronGolemLimit = 0;
|
||||
+ public boolean villagerCanBreed = true;
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
@@ -1447,6 +1448,7 @@ public class PurpurWorldConfig {
|
||||
villagerCanBeLeashed = getBoolean("mobs.villager.can-be-leashed", villagerCanBeLeashed);
|
||||
villagerSpawnIronGolemRadius = getInt("mobs.villager.spawn-iron-golem.radius", villagerSpawnIronGolemRadius);
|
||||
villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit);
|
||||
+ villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed);
|
||||
}
|
||||
|
||||
public boolean vindicatorRidable = false;
|
||||
@@ -1,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: draycia <lonelyyordle@gmail.com>
|
||||
Date: Tue, 14 Apr 2020 00:35:12 -0700
|
||||
Subject: [PATCH] Redstone deactivates spawners
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index 569cef8fcb1e3e1e8b66dad4fa9b956b44542bf1..53a4faa154e1da8dc37b2adec1a5b74c2e1de4b9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -78,6 +78,7 @@ public abstract class BaseSpawner {
|
||||
}
|
||||
|
||||
public boolean isNearPlayer(Level world, BlockPos pos) { // Paper private->public
|
||||
+ if (world.purpurConfig.spawnerDeactivateByRedstone && world.hasNeighborSignal(pos)) return false; // Purpur
|
||||
return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 970fee2f23d79ca702e6e2ca22afac434945cf9f..932dc1b97ae84244f1c8fd8e9c49b655a0c8b62c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -366,6 +366,11 @@ public class PurpurWorldConfig {
|
||||
signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
||||
}
|
||||
|
||||
+ public boolean spawnerDeactivateByRedstone = false;
|
||||
+ private void spawnerSettings() {
|
||||
+ spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
|
||||
+ }
|
||||
+
|
||||
public boolean babiesAreRidable = true;
|
||||
public boolean untamedTamablesAreRidable = true;
|
||||
public boolean useNightVisionWhenRiding = false;
|
||||
@@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: draycia <lonelyyordle@gmail.com>
|
||||
Date: Wed, 29 Apr 2020 00:45:58 -0700
|
||||
Subject: [PATCH] Totems work in inventory
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 63936445bc9005c11bbe669e29897786963e7626..f23b12206e762a52879ba800353638b536e3a2f1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1517,6 +1517,19 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer && (itemstack == null || itemstack.getItem() != Items.TOTEM_OF_UNDYING)) {
|
||||
+ ServerPlayer player = (ServerPlayer) this;
|
||||
+ for (ItemStack item : player.getInventory().items) {
|
||||
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
|
||||
+ itemstack1 = item;
|
||||
+ itemstack = item.cloneItemStack(false);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity());
|
||||
event.setCancelled(itemstack == null);
|
||||
this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 932dc1b97ae84244f1c8fd8e9c49b655a0c8b62c..88cb60050442a757fb94fa050c4d9a073f197e85 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -232,6 +232,7 @@ public class PurpurWorldConfig {
|
||||
public String playerDeathExpDropEquation = "expLevel * 7";
|
||||
public int playerDeathExpDropMax = 100;
|
||||
public boolean teleportIfOutsideBorder = false;
|
||||
+ public boolean totemOfUndyingWorksInInventory = false;
|
||||
private void playerSettings() {
|
||||
if (PurpurConfig.version < 19) {
|
||||
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
||||
@@ -248,6 +249,7 @@ public class PurpurWorldConfig {
|
||||
playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
|
||||
playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
|
||||
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
|
||||
+ totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
|
||||
}
|
||||
|
||||
public boolean silkTouchEnabled = false;
|
||||
@@ -1,51 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 24 Jul 2020 19:38:21 -0500
|
||||
Subject: [PATCH] Add vindicator johnny spawn chance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
index 9b4a20a78f24d4b05fefbf2a7d05686ef9cc8adb..f65a997db7ee0d8e06dfe7cf41dd2231e67b1a2f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
@@ -7,6 +7,7 @@ import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
+import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@@ -147,6 +148,12 @@ public class Vindicator extends AbstractIllager {
|
||||
((GroundPathNavigation)this.getNavigation()).setCanOpenDoors(true);
|
||||
this.populateDefaultEquipmentSlots(difficulty);
|
||||
this.populateDefaultEquipmentEnchantments(difficulty);
|
||||
+ // Purpur start
|
||||
+ Level level = world.getMinecraftWorld();
|
||||
+ if (level.purpurConfig.vindicatorJohnnySpawnChance > 0D && random.nextDouble() <= level.purpurConfig.vindicatorJohnnySpawnChance) {
|
||||
+ setCustomName(new TranslatableComponent("Johnny"));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
return spawnGroupData;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 88cb60050442a757fb94fa050c4d9a073f197e85..73f0ba30c099a2d32111cfde8e100092f6885304 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1461,6 +1461,7 @@ public class PurpurWorldConfig {
|
||||
public boolean vindicatorRidable = false;
|
||||
public boolean vindicatorRidableInWater = false;
|
||||
public double vindicatorMaxHealth = 24.0D;
|
||||
+ public double vindicatorJohnnySpawnChance = 0D;
|
||||
private void vindicatorSettings() {
|
||||
vindicatorRidable = getBoolean("mobs.vindicator.ridable", vindicatorRidable);
|
||||
vindicatorRidableInWater = getBoolean("mobs.vindicator.ridable-in-water", vindicatorRidableInWater);
|
||||
@@ -1470,6 +1471,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.vindicator.attributes.max_health", oldValue);
|
||||
}
|
||||
vindicatorMaxHealth = getDouble("mobs.vindicator.attributes.max_health", vindicatorMaxHealth);
|
||||
+ vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance);
|
||||
}
|
||||
|
||||
public boolean wanderingTraderRidable = false;
|
||||
@@ -1,146 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Tue, 4 Aug 2020 17:11:58 -0500
|
||||
Subject: [PATCH] Add option to disable certain block updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
||||
index bdd3369ac1b5386642d706921e5b2c94450ae96b..3ce2146099ca55b1ac96c02fdb95712a0becf43f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
||||
@@ -21,6 +21,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableChorusPlantUpdates) return this.defaultBlockState(); // Purpur
|
||||
return this.getStateForPlacement(ctx.getLevel(), ctx.getClickedPos());
|
||||
}
|
||||
|
||||
@@ -36,6 +37,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
||||
|
||||
@Override
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableChorusPlantUpdates) return state; // Purpur
|
||||
if (!state.canSurvive(world, pos)) {
|
||||
world.getBlockTicks().scheduleTick(pos, this, 1);
|
||||
return super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
||||
index 3c6d97b51c6fec130b80e5965afa2c49d48843c9..174d16ae5c45dd3a4c9b4cc58b36121bef38d9cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
||||
@@ -22,29 +22,65 @@ public class HugeMushroomBlock extends Block {
|
||||
|
||||
public HugeMushroomBlock(BlockBehaviour.Properties settings) {
|
||||
super(settings);
|
||||
- this.registerDefaultState(this.stateDefinition.any().setValue(NORTH, Boolean.valueOf(true)).setValue(EAST, Boolean.valueOf(true)).setValue(SOUTH, Boolean.valueOf(true)).setValue(WEST, Boolean.valueOf(true)).setValue(UP, Boolean.valueOf(true)).setValue(DOWN, Boolean.valueOf(true)));
|
||||
+ // Purpur start
|
||||
+ this.registerDefaultState(this.stateDefinition.any()
|
||||
+ .setValue(NORTH, true)
|
||||
+ .setValue(EAST, true)
|
||||
+ .setValue(SOUTH, true)
|
||||
+ .setValue(WEST, true)
|
||||
+ .setValue(UP, true)
|
||||
+ .setValue(DOWN, true));
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableMushroomBlockUpdates) return this.defaultBlockState(); // Purpur
|
||||
BlockGetter blockGetter = ctx.getLevel();
|
||||
BlockPos blockPos = ctx.getClickedPos();
|
||||
- return this.defaultBlockState().setValue(DOWN, Boolean.valueOf(!blockGetter.getBlockState(blockPos.below()).is(this))).setValue(UP, Boolean.valueOf(!blockGetter.getBlockState(blockPos.above()).is(this))).setValue(NORTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.north()).is(this))).setValue(EAST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.east()).is(this))).setValue(SOUTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.south()).is(this))).setValue(WEST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.west()).is(this)));
|
||||
+ // Purpur start
|
||||
+ return this.defaultBlockState()
|
||||
+ .setValue(DOWN, this != blockGetter.getTypeIfLoaded(blockPos.below()).getBlock())
|
||||
+ .setValue(UP, this != blockGetter.getTypeIfLoaded(blockPos.above()).getBlock())
|
||||
+ .setValue(NORTH, this != blockGetter.getTypeIfLoaded(blockPos.north()).getBlock())
|
||||
+ .setValue(EAST, this != blockGetter.getTypeIfLoaded(blockPos.east()).getBlock())
|
||||
+ .setValue(SOUTH, this != blockGetter.getTypeIfLoaded(blockPos.south()).getBlock())
|
||||
+ .setValue(WEST, this != blockGetter.getTypeIfLoaded(blockPos.west()).getBlock());
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableMushroomBlockUpdates) return state; // Purpur
|
||||
return neighborState.is(this) ? state.setValue(PROPERTY_BY_DIRECTION.get(direction), Boolean.valueOf(false)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
- return state.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.DOWN)), state.getValue(DOWN));
|
||||
+ // Purpur start
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableMushroomBlockUpdates) return state;
|
||||
+ return state
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.WEST)), state.getValue(NORTH))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.UP)), state.getValue(UP))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.DOWN)), state.getValue(DOWN));
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState mirror(BlockState state, Mirror mirror) {
|
||||
- return state.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.DOWN)), state.getValue(DOWN));
|
||||
+ // Purpur start
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableMushroomBlockUpdates) return state;
|
||||
+ return state
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.WEST)), state.getValue(NORTH))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.UP)), state.getValue(UP))
|
||||
+ .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.DOWN)), state.getValue(DOWN));
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
index f8e58d9f71703139a736d93e7f1996e027a29444..59ae3bb34678cdb5241f691915c96d6568363d3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
@@ -35,11 +35,13 @@ public class NoteBlock extends Block {
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableNoteBlockUpdates) return this.defaultBlockState(); // Purpur
|
||||
return (BlockState) this.defaultBlockState().setValue(NoteBlock.INSTRUMENT, NoteBlockInstrument.byState(ctx.getLevel().getBlockState(ctx.getClickedPos().below())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.disableNoteBlockUpdates) return this.defaultBlockState(); // Purpur
|
||||
return direction == Direction.DOWN ? (BlockState) state.setValue(NoteBlock.INSTRUMENT, NoteBlockInstrument.byState(neighborState)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
||||
@@ -53,6 +55,7 @@ public class NoteBlock extends Block {
|
||||
state = world.getBlockState(pos); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
||||
}
|
||||
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.disableNoteBlockUpdates) // Purpur
|
||||
world.setBlock(pos, (BlockState) state.setValue(NoteBlock.POWERED, flag1), 3);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index b2b7d0a89a6a0d3482caea8fcad1d46de7e4b8ee..c55f0be5437f36d42dacb2e61efcecac3cf379ee 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -249,6 +249,15 @@ public class PurpurConfig {
|
||||
allowWaterPlacementInTheEnd = getBoolean("settings.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd);
|
||||
}
|
||||
|
||||
+ public static boolean disableMushroomBlockUpdates = false;
|
||||
+ public static boolean disableNoteBlockUpdates = false;
|
||||
+ public static boolean disableChorusPlantUpdates = false;
|
||||
+ private static void blockUpdatesSettings() {
|
||||
+ disableMushroomBlockUpdates = getBoolean("settings.blocks.disable-mushroom-updates", disableMushroomBlockUpdates);
|
||||
+ disableNoteBlockUpdates = getBoolean("settings.blocks.disable-note-block-updates", disableNoteBlockUpdates);
|
||||
+ disableChorusPlantUpdates = getBoolean("settings.blocks.disable-chorus-plant-updates", disableChorusPlantUpdates);
|
||||
+ }
|
||||
+
|
||||
public static boolean loggerSuppressInitLegacyMaterialError = false;
|
||||
public static boolean loggerSuppressIgnoredAdvancementWarnings = false;
|
||||
public static boolean loggerSuppressUnrecognizedRecipeErrors = false;
|
||||
@@ -1,57 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Tue, 4 Aug 2020 21:11:03 -0500
|
||||
Subject: [PATCH] Dispensers place anvils option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index 915c68888963b879bf74dc67cc6ffb174228f9e4..c507e60a4836d9cfa5e076841b9b7375ea9ac997 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -53,6 +53,7 @@ import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
+import net.minecraft.world.level.block.AnvilBlock;
|
||||
import net.minecraft.world.level.block.BaseFireBlock;
|
||||
import net.minecraft.world.level.block.BeehiveBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -1110,6 +1111,23 @@ public interface DispenseItemBehavior {
|
||||
}
|
||||
}
|
||||
}));
|
||||
+ // Purpur start
|
||||
+ DispenserBlock.registerBehavior(Items.ANVIL, (new OptionalDispenseItemBehavior() {
|
||||
+ @Override
|
||||
+ public ItemStack execute(BlockSource dispenser, ItemStack stack) {
|
||||
+ Level level = dispenser.getLevel();
|
||||
+ if (!level.purpurConfig.dispenserPlaceAnvils) return super.execute(dispenser, stack);
|
||||
+ Direction facing = dispenser.getBlockState().getValue(DispenserBlock.FACING);
|
||||
+ BlockPos pos = dispenser.getPos().relative(facing);
|
||||
+ BlockState state = level.getBlockState(pos);
|
||||
+ if (state.isAir()) {
|
||||
+ level.setBlockAndUpdate(pos, Blocks.ANVIL.defaultBlockState().setValue(AnvilBlock.FACING, facing.getAxis() == Direction.Axis.Y ? Direction.NORTH : facing.getClockWise()));
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
+ return stack;
|
||||
+ }
|
||||
+ }));
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
static void setEntityPokingOutOfBlock(BlockSource pointer, Entity entity, Direction direction) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 73f0ba30c099a2d32111cfde8e100092f6885304..3b56a3668d417890c5233c04f15dda9499e8265d 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -318,8 +318,10 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean dispenserApplyCursedArmor = true;
|
||||
+ public boolean dispenserPlaceAnvils = false;
|
||||
private void dispenserSettings() {
|
||||
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
||||
+ dispenserPlaceAnvils = getBoolean("blocks.dispenser.place-anvils", dispenserPlaceAnvils);
|
||||
}
|
||||
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
Reference in New Issue
Block a user