mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Dont run with scissors!
inspired by https://modrinth.com/mod/dont-run-with-scissors
This commit is contained in:
@@ -1,181 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JustDoom <justdoomdev@gmail.com>
|
||||
Date: Fri, 5 Mar 2021 14:23:16 -0500
|
||||
Subject: [PATCH] Dont run with scissors!
|
||||
|
||||
inspired by https://modrinth.com/mod/dont-run-with-scissors
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 2e714a4faf07e7ca18fa073ff6660c5d4f377507..ea6713bd5a2807cf00d664296c13e076b2fca3a0 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1720,6 +1720,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
this.player.tryResetCurrentImpulseContext();
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (this.player.serverLevel().purpurConfig.dontRunWithScissors && this.player.isSprinting() && !(this.player.serverLevel().purpurConfig.ignoreScissorsInWater && this.player.isInWater()) && !(this.player.serverLevel().purpurConfig.ignoreScissorsInLava && this.player.isInLava()) && (isScissors(this.player.getItemInHand(InteractionHand.MAIN_HAND)) || isScissors(this.player.getItemInHand(InteractionHand.OFF_HAND))) && (int) (Math.random() * 10) == 0) {
|
||||
+ this.player.hurtServer(this.player.serverLevel(), this.player.damageSources().scissors(), (float) this.player.serverLevel().purpurConfig.scissorsRunningDamage);
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.dontRunWithScissors.isBlank()) this.player.sendActionBarMessage(org.purpurmc.purpur.PurpurConfig.dontRunWithScissors);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);
|
||||
this.lastGoodX = this.player.getX();
|
||||
this.lastGoodY = this.player.getY();
|
||||
@@ -1759,6 +1766,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public boolean isScissors(ItemStack stack) {
|
||||
+ if (!stack.is(Items.SHEARS)) return false;
|
||||
+
|
||||
+ ResourceLocation itemModelReference = stack.get(net.minecraft.core.component.DataComponents.ITEM_MODEL);
|
||||
+ if (itemModelReference != null && itemModelReference.equals(this.player.serverLevel().purpurConfig.dontRunWithScissorsItemModelReference)) return true;
|
||||
+
|
||||
+ return stack.getOrDefault(DataComponents.CUSTOM_MODEL_DATA, net.minecraft.world.item.component.CustomModelData.EMPTY).equals(net.minecraft.world.item.component.CustomModelData.EMPTY);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
// Paper start - optimise out extra getCubes
|
||||
private boolean hasNewCollision(final ServerLevel world, final Entity entity, final AABB oldBox, final AABB newBox) {
|
||||
final List<AABB> collisionsBB = new java.util.ArrayList<>();
|
||||
diff --git a/net/minecraft/world/damagesource/CombatTracker.java b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
index 99a7e9eb75231c15bd8bb24fbb4e296bc9fdedff..254aea4138afa1009a3c949a24c1a0fb8edbbd1d 100644
|
||||
--- a/net/minecraft/world/damagesource/CombatTracker.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
@@ -98,6 +98,11 @@ public class CombatTracker {
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
|
||||
return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
|
||||
} else {
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (damageSource.isScissors()) {
|
||||
+ return damageSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgRunWithScissors, this.mob);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
return damageSource.getLocalizedDeathMessage(this.mob);
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/damagesource/DamageSource.java b/net/minecraft/world/damagesource/DamageSource.java
|
||||
index ab0ba4406dcaa915435c3f53ac9ca06fb21c673b..43985b4442145728c28bbeb9d18444a7c8f3a41f 100644
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -29,6 +29,7 @@ public class DamageSource {
|
||||
private boolean sweep = false;
|
||||
private boolean melting = false;
|
||||
private boolean poison = false;
|
||||
+ private boolean scissors = false; // Purpur - Dont run with scissors!
|
||||
@Nullable
|
||||
private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
||||
|
||||
@@ -59,6 +60,17 @@ public class DamageSource {
|
||||
return this.poison;
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ this.scissors = true;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isScissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
// Paper start - fix DamageSource API
|
||||
@Nullable
|
||||
public Entity getCustomEventDamager() {
|
||||
@@ -117,6 +129,7 @@ public class DamageSource {
|
||||
damageSource.sweep = this.isSweep();
|
||||
damageSource.poison = this.isPoison();
|
||||
damageSource.melting = this.isMelting();
|
||||
+ damageSource.scissors = this.isScissors(); // Purpur - Dont run with scissors!
|
||||
return damageSource;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/net/minecraft/world/damagesource/DamageSources.java b/net/minecraft/world/damagesource/DamageSources.java
|
||||
index be87cb3cfa15a7d889118cdc4b87232e30749023..a4f710ad1aecd8265cde8d71d55eea952cd3c03b 100644
|
||||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -46,11 +46,13 @@ public class DamageSources {
|
||||
// CraftBukkit start
|
||||
private final DamageSource melting;
|
||||
private final DamageSource poison;
|
||||
+ private final DamageSource scissors; // Purpur - Dont run with scissors!
|
||||
|
||||
public DamageSources(RegistryAccess registryManager) {
|
||||
this.damageTypes = registryManager.lookupOrThrow(Registries.DAMAGE_TYPE);
|
||||
this.melting = this.source(DamageTypes.ON_FIRE).melting();
|
||||
this.poison = this.source(DamageTypes.MAGIC).poison();
|
||||
+ this.scissors = this.source(DamageTypes.MAGIC).scissors(); // Purpur - Dont run with scissors!
|
||||
// CraftBukkit end
|
||||
this.inFire = this.source(DamageTypes.IN_FIRE);
|
||||
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
||||
@@ -101,6 +103,12 @@ public class DamageSources {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
public DamageSource inFire() {
|
||||
return this.inFire;
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 6c7b7d6c6aff3dfd4bcc307c004513cf23f44a4d..693b9f04a35f055ea21a1b6be5ac27a04f1d80ad 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -186,6 +186,7 @@ public class PurpurConfig {
|
||||
public static String demoCommandOutput = "<green>%s has been shown the demo screen";
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
public static String tpsbarCommandOutput = "<green>Tpsbar toggled <onoff> for <target>";
|
||||
+ public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
|
||||
@@ -197,6 +198,12 @@ public class PurpurConfig {
|
||||
demoCommandOutput = getString("settings.messages.demo-command-output", demoCommandOutput);
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
tpsbarCommandOutput = getString("settings.messages.tpsbar-command-output", tpsbarCommandOutput);
|
||||
+ dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
+ }
|
||||
+
|
||||
+ public static String deathMsgRunWithScissors = "<player> slipped and fell on their shears";
|
||||
+ private static void deathMessages() {
|
||||
+ deathMsgRunWithScissors = getString("settings.messages.death-message.run-with-scissors", deathMsgRunWithScissors);
|
||||
}
|
||||
|
||||
public static String serverModName = io.papermc.paper.ServerBuildInfo.buildInfo().brandName();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 066a6407ed76a3a2b77541f24d4c3429d3a1a189..2fd0df56e94dca5ce91d0db29b56fa4bd5a2d1f2 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -191,6 +191,11 @@ public class PurpurWorldConfig {
|
||||
public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
||||
public List<Item> itemImmuneToFire = new ArrayList<>();
|
||||
public List<Item> itemImmuneToLightning = new ArrayList<>();
|
||||
+ public boolean dontRunWithScissors = false;
|
||||
+ public ResourceLocation dontRunWithScissorsItemModelReference = ResourceLocation.parse("purpurmc:scissors");
|
||||
+ public boolean ignoreScissorsInWater = false;
|
||||
+ public boolean ignoreScissorsInLava = false;
|
||||
+ public double scissorsRunningDamage = 1D;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -228,6 +233,11 @@ public class PurpurWorldConfig {
|
||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
||||
if (item != Items.AIR) itemImmuneToLightning.add(item);
|
||||
});
|
||||
+ dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
|
||||
+ dontRunWithScissorsItemModelReference = ResourceLocation.parse(getString("gameplay-mechanics.item.shears.damage-if-sprinting-item-model", "purpurmc:scissors"));
|
||||
+ ignoreScissorsInWater = getBoolean("gameplay-mechanics.item.shears.ignore-in-water", ignoreScissorsInWater);
|
||||
+ ignoreScissorsInLava = getBoolean("gameplay-mechanics.item.shears.ignore-in-lava", ignoreScissorsInLava);
|
||||
+ scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
@@ -62,10 +62,10 @@ index 78daeb23bb520774697c8d3d68aa4abe28a40cac..03d0df75dedd414aa54d88ed204cf82c
|
||||
|
||||
private void updatePlayerAttributes() {
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 0c184da09628c0f2fd21e4cacd3ab6ae74f11e64..e569a1e0c282e43410ad321790114acc05bb2ad0 100644
|
||||
index a2832445eab54cc6d93f929ac061949002f1bd4b..6d19faa36b4f824533e1b76e7cda1f324d1c179f 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2800,6 +2800,8 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2818,6 +2818,8 @@ public class ServerGamePacketListenerImpl
|
||||
|
||||
ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event);
|
||||
|
||||
@@ -681,7 +681,7 @@ index 94244b148533ef026bf5c56abbc2bb5cfa83c938..474240c0fd68dbfe18b8fce7ae6e7634
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Cat.java b/net/minecraft/world/entity/animal/Cat.java
|
||||
index 6acb20424597933658b6f99e8e50681a200d84a8..06be2b391bad13165e1e0332053ae4e3e4198dc9 100644
|
||||
index 618f184ce9fed4d9b01f2df4d9a4476d20a55546..f066b0acfa0e954f6d71e62962c76afa1f05a4a5 100644
|
||||
--- a/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -93,10 +93,36 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
|
||||
@@ -1296,7 +1296,7 @@ index 283ddf7d13a17c0a6df5a52b7fd26ed7b7a4826b..19aa39af6685a03eb584820853239a3f
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/Parrot.java b/net/minecraft/world/entity/animal/Parrot.java
|
||||
index 16cc69b14fba16a5a5dfc05d63a40a5112314031..0cd22002a1af6075be4818a4b351ee716f228cb2 100644
|
||||
index 9b43cab816c780a78c823f72119c291a8b264ac7..11a19ad96317d2e44ab998e4125596aeac0e999b 100644
|
||||
--- a/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -124,12 +124,68 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
||||
@@ -1929,7 +1929,7 @@ index 354ec2b987882d8f40ef4ac5257183d2fda73bb8..98cb91574c8d2bdb6d180256f657ecc6
|
||||
this.turtle.setDeltaMovement(this.turtle.getDeltaMovement().add(0.0, this.turtle.getSpeed() * d1 * 0.1, 0.0));
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/Wolf.java b/net/minecraft/world/entity/animal/Wolf.java
|
||||
index c4cf5f96e42e661ec08954649929d63fc93709b6..90472dc99ed1c77ca134ccb01923d1c47465619d 100644
|
||||
index 2455164db9612c97008e4bca76bdcc2e7bf3d0b1..9c517f7afdf18f3cfa7c30da00066b3757f2dbbf 100644
|
||||
--- a/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -180,9 +180,32 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -2638,7 +2638,7 @@ index 31f064267514e590944ad809c95915b481e65aaa..c8bc09c3fe27e69360027698c41fd51a
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index ef3571155ee5757f6eaab67df0fe530408770071..ca9cca5b1eb8549e99d7a594cb96945594678dd4 100644
|
||||
index f7e6866404af629ae0b20425202f592d76df4f3d..bc9564ee22ff9d7f6d819da9601c2d8162d304e1 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -90,6 +90,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
@@ -2795,7 +2795,7 @@ index ef3571155ee5757f6eaab67df0fe530408770071..ca9cca5b1eb8549e99d7a594cb969455
|
||||
this.dragonFight.updateDragon(this);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 3262531c4164dc4420c4a8dff0502cece1a438a5..a38212ad075623b2fa0c37d991aaaf9e1b2bab75 100644
|
||||
index 0ccbcd8b576b082260b17b85291a81e905e6f46f..591dbbbd1da84b0190f010b22d5163bb41cdd3c7 100644
|
||||
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -69,6 +69,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
|
||||
@@ -149,6 +149,38 @@
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
@@ -1582,6 +_,13 @@
|
||||
this.player.tryResetCurrentImpulseContext();
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (this.player.serverLevel().purpurConfig.dontRunWithScissors && this.player.isSprinting() && !(this.player.serverLevel().purpurConfig.ignoreScissorsInWater && this.player.isInWater()) && !(this.player.serverLevel().purpurConfig.ignoreScissorsInLava && this.player.isInLava()) && (isScissors(this.player.getItemInHand(InteractionHand.MAIN_HAND)) || isScissors(this.player.getItemInHand(InteractionHand.OFF_HAND))) && (int) (Math.random() * 10) == 0) {
|
||||
+ this.player.hurtServer(this.player.serverLevel(), this.player.damageSources().scissors(), (float) this.player.serverLevel().purpurConfig.scissorsRunningDamage);
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.dontRunWithScissors.isBlank()) this.player.sendActionBarMessage(org.purpurmc.purpur.PurpurConfig.dontRunWithScissors);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z);
|
||||
this.lastGoodX = this.player.getX();
|
||||
this.lastGoodY = this.player.getY();
|
||||
@@ -1630,6 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public boolean isScissors(ItemStack stack) {
|
||||
+ if (!stack.is(Items.SHEARS)) return false;
|
||||
+
|
||||
+ ResourceLocation itemModelReference = stack.get(net.minecraft.core.component.DataComponents.ITEM_MODEL);
|
||||
+ if (itemModelReference != null && itemModelReference.equals(this.player.serverLevel().purpurConfig.dontRunWithScissorsItemModelReference)) return true;
|
||||
+
|
||||
+ return stack.getOrDefault(DataComponents.CUSTOM_MODEL_DATA, net.minecraft.world.item.component.CustomModelData.EMPTY).equals(net.minecraft.world.item.component.CustomModelData.EMPTY);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
// Paper start - optimise out extra getCubes
|
||||
private boolean hasNewCollision(final ServerLevel level, final Entity entity, final AABB oldBox, final AABB newBox) {
|
||||
final List<AABB> collisionsBB = new java.util.ArrayList<>();
|
||||
@@ -2734,6 +_,7 @@
|
||||
|
||||
AABB boundingBox = target.getBoundingBox();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/world/damagesource/CombatTracker.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
@@ -98,6 +_,11 @@
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
|
||||
return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
|
||||
} else {
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (damageSource.isScissors()) {
|
||||
+ return damageSource.getLocalizedDeathMessage(org.purpurmc.purpur.PurpurConfig.deathMsgRunWithScissors, this.mob);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
return damageSource.getLocalizedDeathMessage(this.mob);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,44 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -188,6 +_,15 @@
|
||||
}
|
||||
@@ -28,6 +_,7 @@
|
||||
private boolean sweep = false;
|
||||
private boolean melting = false;
|
||||
private boolean poison = false;
|
||||
+ private boolean scissors = false; // Purpur - Dont run with scissors!
|
||||
@Nullable
|
||||
private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
||||
|
||||
@@ -58,6 +_,17 @@
|
||||
return this.poison;
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ this.scissors = true;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isScissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
// Paper start - fix DamageSource API
|
||||
@Nullable
|
||||
public Entity getCustomEventDamager() {
|
||||
@@ -116,6 +_,7 @@
|
||||
damageSource.sweep = this.isSweep();
|
||||
damageSource.poison = this.isPoison();
|
||||
damageSource.melting = this.isMelting();
|
||||
+ damageSource.scissors = this.isScissors(); // Purpur - Dont run with scissors!
|
||||
return damageSource;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -187,6 +_,15 @@
|
||||
: Component.translatable(string, livingEntity.getDisplayName(), component);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Component related conveniences
|
||||
+ public Component getLocalizedDeathMessage(String str, LivingEntity entity) {
|
||||
+ net.kyori.adventure.text.Component name = io.papermc.paper.adventure.PaperAdventure.asAdventure(entity.getDisplayName());
|
||||
@@ -12,7 +47,6 @@
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asVanilla(component);
|
||||
+ }
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
|
||||
public String getMsgId() {
|
||||
return this.type().msgId();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -45,11 +_,13 @@
|
||||
// CraftBukkit start
|
||||
private final DamageSource melting;
|
||||
private final DamageSource poison;
|
||||
+ private final DamageSource scissors; // Purpur - Dont run with scissors!
|
||||
|
||||
public DamageSources(RegistryAccess registry) {
|
||||
this.damageTypes = registry.lookupOrThrow(Registries.DAMAGE_TYPE);
|
||||
this.melting = this.source(DamageTypes.ON_FIRE).melting();
|
||||
this.poison = this.source(DamageTypes.MAGIC).poison();
|
||||
+ this.scissors = this.source(DamageTypes.MAGIC).scissors(); // Purpur - Dont run with scissors!
|
||||
// CraftBukkit end
|
||||
this.inFire = this.source(DamageTypes.IN_FIRE);
|
||||
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
||||
@@ -99,6 +_,12 @@
|
||||
return this.poison;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ public DamageSource scissors() {
|
||||
+ return this.scissors;
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
|
||||
public DamageSource inFire() {
|
||||
return this.inFire;
|
||||
@@ -171,6 +171,7 @@ public class PurpurConfig {
|
||||
public static String demoCommandOutput = "<green>%s has been shown the demo screen";
|
||||
public static String pingCommandOutput = "<green>%s's ping is %sms";
|
||||
public static String tpsbarCommandOutput = "<green>Tpsbar toggled <onoff> for <target>";
|
||||
public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
|
||||
@@ -182,6 +183,12 @@ public class PurpurConfig {
|
||||
demoCommandOutput = getString("settings.messages.demo-command-output", demoCommandOutput);
|
||||
pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput);
|
||||
tpsbarCommandOutput = getString("settings.messages.tpsbar-command-output", tpsbarCommandOutput);
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
}
|
||||
|
||||
public static String deathMsgRunWithScissors = "<player> slipped and fell on their shears";
|
||||
private static void deathMessages() {
|
||||
deathMsgRunWithScissors = getString("settings.messages.death-message.run-with-scissors", deathMsgRunWithScissors);
|
||||
}
|
||||
|
||||
public static String serverModName = io.papermc.paper.ServerBuildInfo.buildInfo().brandName();
|
||||
|
||||
@@ -183,6 +183,11 @@ public class PurpurWorldConfig {
|
||||
public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
||||
public List<Item> itemImmuneToFire = new ArrayList<>();
|
||||
public List<Item> itemImmuneToLightning = new ArrayList<>();
|
||||
public boolean dontRunWithScissors = false;
|
||||
public ResourceLocation dontRunWithScissorsItemModelReference = ResourceLocation.parse("purpurmc:scissors");
|
||||
public boolean ignoreScissorsInWater = false;
|
||||
public boolean ignoreScissorsInLava = false;
|
||||
public double scissorsRunningDamage = 1D;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -220,6 +225,11 @@ public class PurpurWorldConfig {
|
||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
||||
if (item != Items.AIR) itemImmuneToLightning.add(item);
|
||||
});
|
||||
dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
|
||||
dontRunWithScissorsItemModelReference = ResourceLocation.parse(getString("gameplay-mechanics.item.shears.damage-if-sprinting-item-model", "purpurmc:scissors"));
|
||||
ignoreScissorsInWater = getBoolean("gameplay-mechanics.item.shears.ignore-in-water", ignoreScissorsInWater);
|
||||
ignoreScissorsInLava = getBoolean("gameplay-mechanics.item.shears.ignore-in-lava", ignoreScissorsInLava);
|
||||
scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
|
||||
Reference in New Issue
Block a user