This commit is contained in:
Owen1212055 2024-10-24 10:02:45 -04:00
parent 26e2a9cbd2
commit a11f1c8dbf
9 changed files with 25 additions and 11 deletions

View File

@ -118,8 +118,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Overridden @Overridden
boolean isEmpty() { boolean isEmpty() {
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null); - return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasEnchantable() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.hasTooltipStyle() || this.hasItemModel() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isGlider() || this.hasDamageResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasUseRemainder() || this.hasUseCooldown() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasEquippable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper + return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasEnchantable() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.hasTooltipStyle() || this.hasItemModel() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isGlider() || this.hasDamageResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasUseRemainder() || this.hasUseCooldown() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasEquippable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
} }
// Paper start // Paper start
@ -171,7 +171,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
if (!this.unhandledTags.isEmpty()) { if (!this.unhandledTags.isEmpty()) {
Tag unhandled = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), this.unhandledTags.build()).getOrThrow(IllegalStateException::new); net.minecraft.nbt.Tag unhandled = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), this.unhandledTags.build()).getOrThrow(IllegalStateException::new);
try { try {
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex);

View File

@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end - Handle large packets disconnecting client + // Paper end - Handle large packets disconnecting client
+ +
private void write(RegistryFriendlyByteBuf buf) { private void write(RegistryFriendlyByteBuf buf) {
buf.writeByte(this.containerId); buf.writeContainerId(this.containerId);
buf.writeVarInt(this.stateId); buf.writeVarInt(this.stateId);
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View File

@ -9,16 +9,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
amount = 0.0F;
} }
this.noActionTime = 0;
- float f1 = amount; - float f1 = amount;
+ float f1 = amount; final float originalAmount = f1; // Paper - revert to vanilla #hurt - OBFHELPER + float f1 = amount; final float originalAmount = f1; // Paper - revert to vanilla #hurt - OBFHELPER
boolean flag = amount > 0.0F && this.isDamageSourceBlocked(source); // Copied from below boolean flag = amount > 0.0F && this.isDamageSourceBlocked(source); // Copied from below
float f2 = 0.0F; float f2 = 0.0F;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.actuallyHurt(source, (float) event.getFinalDamage() - this.lastHurt, event)) { if (!this.actuallyHurt(world, source, (float) event.getFinalDamage() - this.lastHurt, event)) {
return false; return false;
} }
+ if (this instanceof ServerPlayer && event.getDamage() == 0 && originalAmount == 0) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0 - skip damage if the vanilla damage is 0 and was not modified by plugins in the event. + if (this instanceof ServerPlayer && event.getDamage() == 0 && originalAmount == 0) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0 - skip damage if the vanilla damage is 0 and was not modified by plugins in the event.
@ -26,13 +26,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lastHurt = amount; this.lastHurt = amount;
flag1 = false; flag1 = false;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.actuallyHurt(source, (float) event.getFinalDamage(), event)) { if (!this.actuallyHurt(world, source, (float) event.getFinalDamage(), event)) {
return false; return false;
} }
+ if (this instanceof ServerPlayer && event.getDamage() == 0 && originalAmount == 0) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0 - skip damage if the vanilla damage is 0 and was not modified by plugins in the event. + if (this instanceof ServerPlayer && event.getDamage() == 0 && originalAmount == 0) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0 - skip damage if the vanilla damage is 0 and was not modified by plugins in the event.
this.lastHurt = amount; this.lastHurt = amount;
this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks
// this.actuallyHurt(damagesource, f); // this.actuallyHurt(worldserver, damagesource, f);
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
return true; return true;

View File

@ -498,18 +498,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- CraftMetaItem.ITEM_NAME.TYPE, - CraftMetaItem.ITEM_NAME.TYPE,
- CraftMetaItem.LORE.TYPE, - CraftMetaItem.LORE.TYPE,
- CraftMetaItem.CUSTOM_MODEL_DATA.TYPE, - CraftMetaItem.CUSTOM_MODEL_DATA.TYPE,
- CraftMetaItem.ENCHANTABLE.TYPE,
- CraftMetaItem.BLOCK_DATA.TYPE, - CraftMetaItem.BLOCK_DATA.TYPE,
- CraftMetaItem.REPAIR.TYPE, - CraftMetaItem.REPAIR.TYPE,
- CraftMetaItem.ENCHANTMENTS.TYPE, - CraftMetaItem.ENCHANTMENTS.TYPE,
- CraftMetaItem.HIDE_ADDITIONAL_TOOLTIP.TYPE, - CraftMetaItem.HIDE_ADDITIONAL_TOOLTIP.TYPE,
- CraftMetaItem.HIDE_TOOLTIP.TYPE, - CraftMetaItem.HIDE_TOOLTIP.TYPE,
- CraftMetaItem.TOOLTIP_STYLE.TYPE,
- CraftMetaItem.ITEM_MODEL.TYPE,
- CraftMetaItem.UNBREAKABLE.TYPE, - CraftMetaItem.UNBREAKABLE.TYPE,
- CraftMetaItem.ENCHANTMENT_GLINT_OVERRIDE.TYPE, - CraftMetaItem.ENCHANTMENT_GLINT_OVERRIDE.TYPE,
- CraftMetaItem.FIRE_RESISTANT.TYPE, - CraftMetaItem.GLIDER.TYPE,
- CraftMetaItem.DAMAGE_RESISTANT.TYPE,
- CraftMetaItem.MAX_STACK_SIZE.TYPE, - CraftMetaItem.MAX_STACK_SIZE.TYPE,
- CraftMetaItem.RARITY.TYPE, - CraftMetaItem.RARITY.TYPE,
- CraftMetaItem.USE_REMAINDER.TYPE,
- CraftMetaItem.USE_COOLDOWN.TYPE,
- CraftMetaItem.FOOD.TYPE, - CraftMetaItem.FOOD.TYPE,
- CraftMetaItem.TOOL.TYPE, - CraftMetaItem.TOOL.TYPE,
- CraftMetaItem.EQUIPPABLE.TYPE,
- CraftMetaItem.JUKEBOX_PLAYABLE.TYPE, - CraftMetaItem.JUKEBOX_PLAYABLE.TYPE,
- CraftMetaItem.DAMAGE.TYPE, - CraftMetaItem.DAMAGE.TYPE,
- CraftMetaItem.MAX_DAMAGE.TYPE, - CraftMetaItem.MAX_DAMAGE.TYPE,
@ -558,16 +565,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ CraftMetaItem.ITEM_NAME.TYPE, + CraftMetaItem.ITEM_NAME.TYPE,
+ CraftMetaItem.LORE.TYPE, + CraftMetaItem.LORE.TYPE,
+ CraftMetaItem.CUSTOM_MODEL_DATA.TYPE, + CraftMetaItem.CUSTOM_MODEL_DATA.TYPE,
+ CraftMetaItem.CUSTOM_MODEL_DATA.TYPE,
+ CraftMetaItem.BLOCK_DATA.TYPE, + CraftMetaItem.BLOCK_DATA.TYPE,
+ CraftMetaItem.REPAIR.TYPE, + CraftMetaItem.REPAIR.TYPE,
+ CraftMetaItem.ENCHANTMENTS.TYPE, + CraftMetaItem.ENCHANTMENTS.TYPE,
+ CraftMetaItem.HIDE_ADDITIONAL_TOOLTIP.TYPE, + CraftMetaItem.HIDE_ADDITIONAL_TOOLTIP.TYPE,
+ CraftMetaItem.HIDE_TOOLTIP.TYPE, + CraftMetaItem.HIDE_TOOLTIP.TYPE,
+ CraftMetaItem.TOOLTIP_STYLE.TYPE,
+ CraftMetaItem.ITEM_MODEL.TYPE,
+ CraftMetaItem.UNBREAKABLE.TYPE, + CraftMetaItem.UNBREAKABLE.TYPE,
+ CraftMetaItem.ENCHANTMENT_GLINT_OVERRIDE.TYPE, + CraftMetaItem.ENCHANTMENT_GLINT_OVERRIDE.TYPE,
+ CraftMetaItem.FIRE_RESISTANT.TYPE, + CraftMetaItem.GLIDER.TYPE,
+ CraftMetaItem.DAMAGE_RESISTANT.TYPE,
+ CraftMetaItem.ENCHANTABLE.TYPE,
+ CraftMetaItem.MAX_STACK_SIZE.TYPE, + CraftMetaItem.MAX_STACK_SIZE.TYPE,
+ CraftMetaItem.RARITY.TYPE, + CraftMetaItem.RARITY.TYPE,
+ CraftMetaItem.USE_REMAINDER.TYPE,
+ CraftMetaItem.USE_COOLDOWN.TYPE,
+ CraftMetaItem.FOOD.TYPE, + CraftMetaItem.FOOD.TYPE,
+ CraftMetaItem.TOOL.TYPE, + CraftMetaItem.TOOL.TYPE,
+ CraftMetaItem.JUKEBOX_PLAYABLE.TYPE, + CraftMetaItem.JUKEBOX_PLAYABLE.TYPE,
@ -696,7 +710,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ CraftMetaOminousBottle(DataComponentPatch tag, java.util.Set<net.minecraft.core.component.DataComponentType<?>> extraHandledDcts) { // Paper + CraftMetaOminousBottle(DataComponentPatch tag, java.util.Set<net.minecraft.core.component.DataComponentType<?>> extraHandledDcts) { // Paper
+ super(tag, extraHandledDcts); // Paper + super(tag, extraHandledDcts); // Paper
getOrEmpty(tag, CraftMetaOminousBottle.OMINOUS_BOTTLE_AMPLIFIER).ifPresent((amplifier) -> { getOrEmpty(tag, CraftMetaOminousBottle.OMINOUS_BOTTLE_AMPLIFIER).ifPresent((amplifier) -> {
this.ominousBottleAmplifier = amplifier; this.ominousBottleAmplifier = amplifier.value();
}); });
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644