Skip to content

Commit

Permalink
add back MC-3304 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Apr 29, 2024
1 parent 2c5e308 commit 0a33831
Show file tree
Hide file tree
Showing 31 changed files with 32 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Subject: [PATCH] Add an option to fix MC-3304 (projectile looting)


diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 5d60f038220ef4e7b66834c172cc47c7abfe7da7..a9289c4179a78862361be87aaa83f49d6bf60714 100644
index 342eaa0e3b053e9b39dc58fa92cd18cac446a844..06f7bc4d8d6679d6625a8d392777722fc97739ba 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -75,6 +75,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -77,6 +77,7 @@ public abstract class AbstractArrow extends Projectile {
@Nullable
private List<Entity> piercedAndKilledEntities;
public ItemStack pickupItemStack;
+ public int lootingLevel; // Purpur

// Spigot Start
@Override
@@ -642,6 +643,12 @@ public abstract class AbstractArrow extends Projectile {
@@ -655,6 +656,12 @@ public abstract class AbstractArrow extends Projectile {
this.knockback = punch;
}

Expand All @@ -29,34 +29,16 @@ index 5d60f038220ef4e7b66834c172cc47c7abfe7da7..a9289c4179a78862361be87aaa83f49d
public int getKnockback() {
return this.knockback;
}
diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
index 220513d3fd5645322886522ea4f6b8c55d043b3c..d45a2f49c82d00801578c34e5f5277fc5e82be87 100644
--- a/src/main/java/net/minecraft/world/item/BowItem.java
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
@@ -64,6 +64,13 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.FLAMING_ARROWS, stack) > 0) {
entityarrow.setSecondsOnFire(100);
}
+ // Purpur start
+ int lootingLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MOB_LOOTING, stack);
+
+ if (lootingLevel > 0) {
+ entityarrow.setLootingLevel(lootingLevel);
+ }
+ // Purpur end
// CraftBukkit start
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, stack, itemstack1, entityarrow, entityhuman.getUsedItemHand(), f, !flag1);
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
index 05d3a7c077df1b92819655790230cd22028f6893..211d8e59a9b3460b346e5f8cf581df70b05d1b8f 100644
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
@@ -291,6 +291,14 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
entityarrow.setPierceLevel((byte) i);
diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
index f91ce87491b18f4f4ae6458192d1f320b308102a..aec96d297401b705ca2af97904739afdf1134574 100644
--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
+++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
@@ -131,6 +131,14 @@ public abstract class ProjectileWeaponItem extends Item {
entityarrow.setPierceLevel((byte) k);
}

+ // Purpur start
+ int lootingLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MOB_LOOTING, crossbow);
+ int lootingLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.LOOTING, weaponStack);
+
+ if (lootingLevel > 0) {
+ entityarrow.setLootingLevel(lootingLevel);
Expand All @@ -67,15 +49,15 @@ index 05d3a7c077df1b92819655790230cd22028f6893..211d8e59a9b3460b346e5f8cf581df70
}

diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
index 7030d94ba14ecacc1e5cd6d6432b1bcb59c8b646..95f9dd3f8fbf593fd6898335454951868c867a06 100644
index 85dc79b9b969fa0cbf6964cb26bac139fa55710a..905a020dd7b365d51d5addadbbeb9555d03c5238 100644
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
@@ -82,6 +82,14 @@ public class TridentItem extends Item implements Vanishable {
@@ -81,6 +81,14 @@ public class TridentItem extends Item implements ProjectileItem {
entitythrowntrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
}

+ // Purpur start
+ int lootingLevel = EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.MOB_LOOTING, stack);
+ int lootingLevel = EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.LOOTING, stack);
+
+ if (lootingLevel > 0) {
+ entitythrowntrident.setLootingLevel(lootingLevel);
Expand All @@ -86,7 +68,7 @@ index 7030d94ba14ecacc1e5cd6d6432b1bcb59c8b646..95f9dd3f8fbf593fd689833545495186
// Paper start - PlayerLaunchProjectileEvent
com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), (org.bukkit.entity.Projectile) entitythrowntrident.getBukkitEntity());
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
index 3fb1e558c3510243c94981211f9a0e5e0ef1895b..e5177e5ffcac360f935f2139db4554c6586b551e 100644
index cfe953bc924f46b570e37395ac0f05ebcb82eb39..5500e7ada2dd783cc1317968a3e54696bdd73bf8 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
@@ -57,6 +57,13 @@ public class LootingEnchantFunction extends LootItemConditionalFunction {
Expand All @@ -104,12 +86,12 @@ index 3fb1e558c3510243c94981211f9a0e5e0ef1895b..e5177e5ffcac360f935f2139db4554c6
if (context.hasParam(LootContextParams.LOOTING_MOD)) {
i = context.getParamOrNull(LootContextParams.LOOTING_MOD);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 5329ad6493950a561bd46045e35a9bd70ac4405f..88763ca8cc31bda23f8f31d2bc990fb4a85c9955 100644
index b2e88e4b9b8afbb9ea6d14c6e268ac53b96b41bd..67fe92fdb068ce3cb45317d250dfeeb30475beb4 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -573,4 +573,9 @@ public class PurpurConfig {
private static void fixNetworkSerializedCreativeItems() {
fixNetworkSerializedItemsInCreative = getBoolean("settings.fix-network-serialized-items-in-creative", fixNetworkSerializedItemsInCreative);
@@ -481,4 +481,9 @@ public class PurpurConfig {
String setPattern = getString("settings.username-valid-characters", defaultPattern);
usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
}
+
+ public static boolean fixProjectileLootingTransfer = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ index 3c1091f2a729b7d06ba6e21c37f788edb2ad1775..031fc626d2075cbe0941fecc18840671
protected final SoundType soundType;
protected final float friction;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index b2e88e4b9b8afbb9ea6d14c6e268ac53b96b41bd..4400f8f8efc424ad4593b972f5b5f16575cd2a0d 100644
index 67fe92fdb068ce3cb45317d250dfeeb30475beb4..c218b0d4cfce46c5c2f042566d618bf36ee5e1b4 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -481,4 +481,19 @@ public class PurpurConfig {
String setPattern = getString("settings.username-valid-characters", defaultPattern);
usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
@@ -486,4 +486,19 @@ public class PurpurConfig {
private static void fixProjectileLootingTransfer() {
fixProjectileLootingTransfer = getBoolean("settings.fix-projectile-looting-transfer", fixProjectileLootingTransfer);
}
+
+ private static void blastResistanceSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ index ef364aa171a48482a45bc18cfe730ec20c3f7be6..74971d90506aa253d5ee821b5390fb25
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 4400f8f8efc424ad4593b972f5b5f16575cd2a0d..4efcea9c35e529a25d408412fcb896f3ed47c5d1 100644
index c218b0d4cfce46c5c2f042566d618bf36ee5e1b4..1e66458fc3d91426109d920e8d73d157e91dfed5 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -496,4 +496,50 @@ public class PurpurConfig {
@@ -501,4 +501,50 @@ public class PurpurConfig {
block.explosionResistance = blastResistance.floatValue();
});
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Add log suppression for LibraryLoader


diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 4efcea9c35e529a25d408412fcb896f3ed47c5d1..2d88364e3e721561aa7e132712f3cb1a85a7dd4e 100644
index 1e66458fc3d91426109d920e8d73d157e91dfed5..6baa4b8a2ab5529e6867de7a9113e020d016aff6 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -454,11 +454,14 @@ public class PurpurConfig {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ index f0703302e7dbbda88de8c648d20d87c55ed9b1e0..a913ebabaa5f443afa987b972355a8f8
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 2d88364e3e721561aa7e132712f3cb1a85a7dd4e..9f44620932500f963322f992d9c2621888b70be6 100644
index 6baa4b8a2ab5529e6867de7a9113e020d016aff6..cf2c0642fc09b6f806903a684ccc215b0ad6276f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -485,6 +485,16 @@ public class PurpurConfig {
usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
@@ -490,6 +490,16 @@ public class PurpurConfig {
fixProjectileLootingTransfer = getBoolean("settings.fix-projectile-looting-transfer", fixProjectileLootingTransfer);
}

+ public static boolean clampAttributes = true;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ index b6881d7f02ad4e9e45e947eaec54f0c6b8ff957a..b206d65750fee0a42b805de24ecbb900
}

diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 9f44620932500f963322f992d9c2621888b70be6..65de34005a759ff46f9343ada4404b9637c5ac9d 100644
index cf2c0642fc09b6f806903a684ccc215b0ad6276f..67a719dc069bc77da38b32ba7d32580c8b7f1207 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -555,4 +555,9 @@ public class PurpurConfig {
@@ -560,4 +560,9 @@ public class PurpurConfig {
block.fallDistanceMultiplier = fallDistanceMultiplier.floatValue();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ index 8925440dbc35dbc4a7d59f13511d7afeda803260..411f1f8c6be072cfc5ba88cbec38dbc4

io.papermc.paper.plugin.PluginInitializerManager.load(optionset); // Paper
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 65de34005a759ff46f9343ada4404b9637c5ac9d..37dd3e8708016811f9617d1b9d1af53894cc5d80 100644
index 67a719dc069bc77da38b32ba7d32580c8b7f1207..df83e258d47fdce819c0f6467e2c0f2d681cb1f9 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -560,4 +560,9 @@ public class PurpurConfig {
@@ -565,4 +565,9 @@ public class PurpurConfig {
private static void playerDeathsAlwaysShowItem() {
playerDeathsAlwaysShowItem = getBoolean("settings.player-deaths-always-show-item", playerDeathsAlwaysShowItem);
}
Expand Down

0 comments on commit 0a33831

Please sign in to comment.