-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
. #282
Open
sprytex
wants to merge
13
commits into
hpfxd:master
Choose a base branch
from
sprytex:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
. #282
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f867178
removed random damage & fix visually open chest
sprytex f4ebbfc
0109-Reset-NaN-Entity-Values.patch
sprytex 0c8901a
Ensure correct attack damage on slot change
sprytex 91399c9
Merge branch 'hpfxd:master' into master
sprytex d0b3bd3
latest changes
sprytex fa7b74a
Merge branch 'hpfxd:master' into master
sprytex 109f601
reorder
sprytex aca1ce4
Faking Death Support
sprytex 1fca44a
Update 0113-Faking-Death.patch
sprytex 42dbd6e
Update 0113-Faking-Death.patch
sprytex 41461c7
Update 0113-Faking-Death.patch
sprytex f18c291
Delete patches/server/0113-Faking-Death.patch
sprytex 6227b02
Merge branch 'hpfxd:master' into master
sprytex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Rejomy <[email protected]> | ||
Date: Fri, 10 Jan 2025 21:02:29 +0500 | ||
Subject: [PATCH] Prevent chest visual open bug. | ||
|
||
|
||
diff --git a/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotConfig.java b/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotConfig.java | ||
index 1d8e4d1050ebafef8784920481621965fd5c212f..66bb8b59e406a54e10a2291e0615c3e2b6b24285 100644 | ||
--- a/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotConfig.java | ||
+++ b/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotConfig.java | ||
@@ -94,6 +94,9 @@ public class PandaSpigotConfig { | ||
public static PandaSpigotConfig get() { | ||
return config; | ||
} | ||
+ | ||
+ @Comment("Prevent chest and sound bugs.") | ||
+ public boolean dropUsePacketsInInventory = true; | ||
|
||
//------------------------------------------------------------------------ | ||
@Comment("On servers with plugins that constantly churn through scoreboards, there is a risk of\n" + | ||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java | ||
index 40dc1eb6a86dede8377775ad2776fd9193d24cbc..0b1d3f5c79bf3ca9a9b2a3b51f39db225493d8c5 100644 | ||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java | ||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java | ||
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists; | ||
import com.google.common.primitives.Doubles; | ||
import com.google.common.primitives.Floats; | ||
import com.google.common.util.concurrent.Futures; | ||
+import com.hpfxd.pandaspigot.config.PandaSpigotConfig; | ||
import io.netty.buffer.Unpooled; | ||
import io.netty.util.concurrent.Future; | ||
import io.netty.util.concurrent.GenericFutureListener; | ||
@@ -24,6 +25,7 @@ import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; | ||
import java.util.HashSet; | ||
|
||
+import org.bukkit.Bukkit; | ||
import org.bukkit.craftbukkit.entity.CraftPlayer; | ||
import org.bukkit.craftbukkit.event.CraftEventFactory; | ||
import org.bukkit.craftbukkit.inventory.CraftInventoryView; | ||
@@ -658,6 +660,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList | ||
// CraftBukkit start | ||
if (this.player.dead) return; | ||
|
||
+ // Rejomy patch Use packets while inventory is open. | ||
+ // Even if inventory is not open active container will equals player inventory same with defaultContainer. | ||
+ if (PandaSpigotConfig.get().dropUsePacketsInInventory && player.activeContainer != player.defaultContainer) { | ||
+ return; | ||
+ } | ||
+ // Rejomy patch End | ||
+ | ||
// CraftBukkit - if rightclick decremented the item, always send the update packet. */ | ||
// this is not here for CraftBukkit's own functionality; rather it is to fix | ||
// a notch bug where the item doesn't update correctly. |
88 changes: 88 additions & 0 deletions
88
patches/server/0110-Ensure-correct-attack-damage-on-slot-change.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: necrozma <[email protected]> | ||
Date: Fri, 14 Jul 2023 22:16:17 -0600 | ||
Subject: [PATCH] Ensure correct attack damage on slot change | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java | ||
index 86ab9994079c6e18e3aed885db4171d0d87b4c1a..10284da163e2f1d1b5f12ca738a8fc5580d1373b 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityHuman.java | ||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java | ||
@@ -692,6 +692,7 @@ public abstract class EntityHuman extends EntityLiving { | ||
NBTTagList nbttaglist = nbttagcompound.getList("Inventory", 10); | ||
|
||
this.inventory.b(nbttaglist); | ||
+ this.inventory.prevItemInHandIndex = this.inventory.itemInHandIndex; // PandaSpigot | ||
this.inventory.itemInHandIndex = nbttagcompound.getInt("SelectedItemSlot"); | ||
this.sleeping = nbttagcompound.getBoolean("Sleeping"); | ||
this.sleepTicks = nbttagcompound.getShort("SleepTimer"); | ||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java | ||
index 94d8f2ffe938bd2d57d0297f9efc43ee55da3ba9..95c92fe5a1f1866da16fb991d29c6de1671684d6 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityLiving.java | ||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java | ||
@@ -34,7 +34,7 @@ public abstract class EntityLiving extends Entity { | ||
|
||
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); | ||
private static final AttributeModifier b = (new AttributeModifier(EntityLiving.a, "Sprinting speed boost", 0.30000001192092896D, 2)).a(false); | ||
- private AttributeMapBase c; | ||
+ public AttributeMapBase c; // PandaSpigot | ||
public CombatTracker combatTracker = new CombatTracker(this); | ||
public final Map<Integer, MobEffect> effects = Maps.newHashMap(); | ||
private final ItemStack[] h = new ItemStack[5]; | ||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java | ||
index 23bd5d11f8b909817855f593adc51d3ca5d9f976..eb56c4ee33c756bc7adfed0e76ef516b5c0566da 100644 | ||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java | ||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java | ||
@@ -963,8 +963,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList | ||
return; | ||
} | ||
// CraftBukkit end | ||
+ this.player.inventory.prevItemInHandIndex = this.player.inventory.itemInHandIndex; // PandaSpigot | ||
this.player.inventory.itemInHandIndex = packetplayinhelditemslot.a(); | ||
this.player.resetIdleTimer(); | ||
+ // PandaSpigot start - ensure correct attack damage on slot change | ||
+ ItemStack prevItemStack = this.player.inventory.items[this.player.inventory.prevItemInHandIndex]; | ||
+ if (prevItemStack != null) { | ||
+ for (AttributeModifier attributemodifier : prevItemStack.B().get("generic.attackDamage")) { | ||
+ this.player.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).c(attributemodifier); // remove attack damage from previous held item | ||
+ } | ||
+ } | ||
+ if (this.player.inventory.getItemInHand() != null) { | ||
+ ((EntityLiving) this.player).c.b(this.player.inventory.getItemInHand().B()); // apply attack damage from current held item | ||
+ } | ||
+ // PandaSpigot end | ||
} else { | ||
PlayerConnection.c.warn(this.player.getName() + " tried to set an invalid carried item"); | ||
this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason | ||
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java | ||
index 76fa51d97e9a938d4198bbe657d77900f6327744..3a8c600b7d80a46be0c33f0f6b50b751b764eb49 100644 | ||
--- a/src/main/java/net/minecraft/server/PlayerInventory.java | ||
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java | ||
@@ -14,6 +14,7 @@ public class PlayerInventory implements IInventory { | ||
public ItemStack[] items = new ItemStack[36]; | ||
public ItemStack[] armor = new ItemStack[4]; | ||
public int itemInHandIndex; | ||
+ public int prevItemInHandIndex; // PandaSpigot | ||
public EntityHuman player; | ||
private ItemStack f; | ||
public boolean e; | ||
@@ -571,6 +572,7 @@ public class PlayerInventory implements IInventory { | ||
this.armor[i] = ItemStack.b(playerinventory.armor[i]); | ||
} | ||
|
||
+ this.prevItemInHandIndex = playerinventory.prevItemInHandIndex; // PandaSpigot | ||
this.itemInHandIndex = playerinventory.itemInHandIndex; | ||
} | ||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java | ||
index dba8d5ba1df8c04d8988af9b1e3329269e9a1942..202975055eda4e66e922b7d67d84ad30973591b0 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java | ||
@@ -81,6 +81,7 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i | ||
|
||
public void setHeldItemSlot(int slot) { | ||
Validate.isTrue(slot >= 0 && slot < PlayerInventory.getHotbarSize(), "Slot is not between 0 and 8 inclusive"); | ||
+ this.getInventory().prevItemInHandIndex = this.getInventory().itemInHandIndex; // PandaSpigot | ||
this.getInventory().itemInHandIndex = slot; | ||
((CraftPlayer) this.getHolder()).getHandle().playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(slot)); | ||
} |
19 changes: 19 additions & 0 deletions
19
patches/server/0111-Remove-random-damage-for-protection.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Kirill <[email protected]> | ||
Date: Fri, 3 Jan 2025 21:55:01 +0500 | ||
Subject: [PATCH] Remove random damage for protection. | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java | ||
index 98656815ff5b4a176e145162d0077c30cb1ea1a6..09c69dd4f984201a7bf1168623e8574918e41d36 100644 | ||
--- a/src/main/java/net/minecraft/server/EnchantmentManager.java | ||
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java | ||
@@ -148,7 +148,7 @@ public class EnchantmentManager { | ||
EnchantmentManager.b.a = 0; | ||
} | ||
|
||
- return (EnchantmentManager.b.a + 1 >> 1) + EnchantmentManager.a.nextInt((EnchantmentManager.b.a >> 1) + 1); | ||
+ return (EnchantmentManager.b.a + 1 >> 1); | ||
} | ||
|
||
public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From 750a22a1f122a92275eebd14b555ea0482010b54 Mon Sep 17 00:00:00 2001 | ||
From: LinsaFTW <[email protected]> | ||
Date: Fri, 13 Jan 2023 17:02:17 -0300 | ||
Subject: [PATCH] Reset NaN Entity Values | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java | ||
index 5971e4375..2d48d02ab 100644 | ||
--- a/src/main/java/net/minecraft/server/Entity.java | ||
+++ b/src/main/java/net/minecraft/server/Entity.java | ||
@@ -1204,6 +1204,12 @@ public abstract class Entity implements ICommandListener { | ||
|
||
public void e(NBTTagCompound nbttagcompound) { | ||
try { | ||
+ // FlamePaper start - Reset NaN Entity Values | ||
+ if (Double.isNaN(locX)) this.locX = 0; | ||
+ if (Double.isNaN(locY)) this.locY = 0; | ||
+ if (Double.isNaN(locZ)) this.locZ = 0; | ||
+ // FlamePaper start - Reset NaN Entity Values | ||
+ | ||
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ})); | ||
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); | ||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | ||
index d44fc62b9..a0269fbe0 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | ||
@@ -1374,7 +1374,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { | ||
|
||
@Override | ||
public double getHealth() { | ||
- return health; | ||
+ return Double.isNaN(health) ? 0.0D : health; // FlamePaper - Reset NaN Entity Values | ||
} | ||
|
||
public void setRealHealth(double health) { | ||
-- | ||
2.37.3.windows.1 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly @ThatApplePieGuy closed the original pullrequest because the patch didn't fix the problem 100%