3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

fix more compile issues

Dieser Commit ist enthalten in:
Jake Potrebic 2022-12-07 22:11:20 -08:00
Ursprung 4a3753dbb1
Commit 04801b7982
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27CC63F7CBC866C7
7 geänderte Dateien mit 38 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -144,6 +144,19 @@ index d025df087e7b87fbc89a722226f2f2263c54ac47..2f712bfc1f717ba410bf34669d7b0a91
}));
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 7798cbbae6b72d64e6129cebf1f66696f21e15f9..240c19f4a7552a01b3c48f1f6413119e4cfc2b67 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -56,7 +56,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
private static <T, C extends PalettedContainerRO<T>> Codec<C> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T defaultValue, PalettedContainerRO.Unpacker<T, C> reader) {
- return RecordCodecBuilder.<PalettedContainerRO.PackedData>create((instance) -> {
+ return RecordCodecBuilder.<PalettedContainerRO.PackedData<T>>create((instance) -> { // Paper - decompile fix
return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(defaultValue)).listOf().fieldOf("palette").forGetter(PalettedContainerRO.PackedData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainerRO.PackedData::storage)).apply(instance, PalettedContainerRO.PackedData::new);
}).comapFlatMap((serialized) -> {
return reader.read(idList, provider, serialized);
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
index 6b91771a4bf559881a4f3e6c98500e09b33d16e0..21a2800db22f287b9c6a8290326fdf3b94ae94b1 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index a889be9dd2a94b531a227ff69a5e761e103067be..d8c9beab9163820df949f6002bbb9224a044c6f3 100644
index a889be9dd2a94b531a227ff69a5e761e103067be..3b14fd5d67716a5b3610c10e8105d29f93a1d7a9 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -532,6 +532,11 @@ public class EnderDragon extends Mob implements Enemy {
@ -14,7 +14,7 @@ index a889be9dd2a94b531a227ff69a5e761e103067be..d8c9beab9163820df949f6002bbb9224
}
+ // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = level.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSourceMob().getBukkitEntity()).callEvent())
+ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getIndirectSourceEntity().getBukkitEntity()).callEvent())
+ continue;
+ // Paper end
nmsBlock.wasExploded(level, blockposition, explosionSource);

Datei anzeigen

@ -6,20 +6,12 @@ Subject: [PATCH] Add villager reputation API
== AT ==
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips <init>()V
public net.minecraft.world.entity.ai.gossip.GossipContainer gossips
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
index 6c021402ab7522f132193619fae4be4ca70d70f8..4e7b7a3910840908b73c80faf9a83b728186f775 100644
index a28f359202e6502c6ea5e9c918ec0b3e9a3fca61..76dffb2705e5207db96895f82f1c7c5638f817c6 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -30,7 +30,7 @@ import org.slf4j.Logger;
public class GossipContainer {
private static final Logger LOGGER = LogUtils.getLogger();
public static final int DISCARD_THRESHOLD = 2;
- private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap();
+ private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap(); public Map<UUID, GossipContainer.EntityGossips> getReputations() { return this.gossips; } // Paper - add getter for reputations
@VisibleForDebug
public Map<UUID, Object2IntMap<GossipType>> getGossipEntries() {
@@ -231,6 +231,43 @@ public class GossipContainer {
public void remove(GossipType gossipType) {
this.entries.removeInt(gossipType);
@ -65,7 +57,7 @@ index 6c021402ab7522f132193619fae4be4ca70d70f8..4e7b7a3910840908b73c80faf9a83b72
static record GossipEntry(UUID target, GossipType type, int value) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 4f73b71fb39eab10c44da31617632a83e4f0b83f..11e44a81934255fd4efa418009d8bb78c785cfd5 100644
index 4f73b71fb39eab10c44da31617632a83e4f0b83f..1fa8026ca63b7e38870daac59936a10b1950561e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -17,6 +17,13 @@ import org.bukkit.entity.Villager;
@ -90,7 +82,7 @@ index 4f73b71fb39eab10c44da31617632a83e4f0b83f..11e44a81934255fd4efa418009d8bb78
+ // Paper start - Add villager reputation API
+ @Override
+ public Reputation getReputation(UUID uniqueId) {
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getGossips().getReputations().get(uniqueId);
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips rep = getHandle().getGossips().gossips.get(uniqueId);
+ if (rep == null) {
+ return new Reputation(new java.util.EnumMap<>(com.destroystokyo.paper.entity.villager.ReputationType.class));
+ }
@ -100,7 +92,7 @@ index 4f73b71fb39eab10c44da31617632a83e4f0b83f..11e44a81934255fd4efa418009d8bb78
+
+ @Override
+ public Map<UUID, Reputation> getReputations() {
+ return getHandle().getGossips().getReputations().entrySet()
+ return getHandle().getGossips().gossips.entrySet()
+ .stream()
+ .collect(java.util.stream.Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getPaperReputation()));
+ }
@ -108,7 +100,7 @@ index 4f73b71fb39eab10c44da31617632a83e4f0b83f..11e44a81934255fd4efa418009d8bb78
+ @Override
+ public void setReputation(UUID uniqueId, Reputation reputation) {
+ net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips nmsReputation =
+ getHandle().getGossips().getReputations().computeIfAbsent(
+ getHandle().getGossips().gossips.computeIfAbsent(
+ uniqueId,
+ key -> new net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips()
+ );
@ -124,7 +116,7 @@ index 4f73b71fb39eab10c44da31617632a83e4f0b83f..11e44a81934255fd4efa418009d8bb78
+
+ @Override
+ public void clearReputations() {
+ getHandle().getGossips().getReputations().clear();
+ getHandle().getGossips().gossips.clear();
+ }
+ // Paper end
}

Datei anzeigen

@ -5,18 +5,9 @@ Subject: [PATCH] Remove streams from classes related villager gossip
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
index 4e7b7a3910840908b73c80faf9a83b728186f775..f64da4c3bd4301453688974182e7793804655d2c 100644
index 76dffb2705e5207db96895f82f1c7c5638f817c6..097007c1c25ba55d9916fc820dd1d1149d81f6f4 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -30,7 +30,7 @@ import org.slf4j.Logger;
public class GossipContainer {
private static final Logger LOGGER = LogUtils.getLogger();
public static final int DISCARD_THRESHOLD = 2;
- private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap(); public Map<UUID, GossipContainer.EntityGossips> getReputations() { return this.gossips; } // Paper - add getter for reputations
+ private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap();
@VisibleForDebug
public Map<UUID, Object2IntMap<GossipType>> getGossipEntries() {
@@ -61,8 +61,22 @@ public class GossipContainer {
});
}

Datei anzeigen

@ -8,7 +8,7 @@ and curing a villager on repeat by simply resetting the relevant part of
the reputation when it is cured.
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 e3db573f10b7a3f8f605a11dc886859c68168467..ec46a095a26af507fdee0485f7c519c14decc95f 100644
index e3db573f10b7a3f8f605a11dc886859c68168467..105f8fcbbc5c7c384b77ca8eb768f1147d6ce4b2 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -980,6 +980,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@ -17,7 +17,7 @@ index e3db573f10b7a3f8f605a11dc886859c68168467..ec46a095a26af507fdee0485f7c519c1
if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) {
+ // Paper start - fix MC-181190
+ if (level.paperConfig().fixes.fixCuringZombieVillagerDiscountExploit) {
+ final GossipContainer.EntityGossips playerReputation = this.getGossips().getReputations().get(entity.getUUID());
+ final GossipContainer.EntityGossips playerReputation = this.getGossips().gossips.get(entity.getUUID());
+ if (playerReputation != null) {
+ playerReputation.remove(GossipType.MAJOR_POSITIVE);
+ playerReputation.remove(GossipType.MINOR_POSITIVE);

Datei anzeigen

@ -57,7 +57,7 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 96f6eb2b152d1183ee45cb0b77c9c77ae8e03950..647be350a7fcd74b1ae82811e6977c9899ce9543 100644
index 96f6eb2b152d1183ee45cb0b77c9c77ae8e03950..39d96d24c532c51c3ca8051b7fcf4b55c5971ef9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -362,7 +362,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -126,6 +126,15 @@ index 96f6eb2b152d1183ee45cb0b77c9c77ae8e03950..647be350a7fcd74b1ae82811e6977c98
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -475,7 +485,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerGamePacketListenerImpl.this.disconnect(reason); // Paper - adventure
+ ServerGamePacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure, kick event cause
return null;
}
};
@@ -494,7 +504,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
@ -373,7 +382,7 @@ index 16210f30249ecc83c92e0374f7821693a9fd27c1..20598ef01293d8889145921cb3c5a9c7
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9ad9ef67eb6e8ef9bde99882839c0d5518651147..99d4f032418cfc3e1cf836f1c68717ad414809a3 100644
index d404233e4982dc93fbca408003e52c6892253707..cc9db27d89c3b2a0ee7bc42f88bb68902188ba13 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -599,7 +599,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Fix PotionSplashEvent for water splash potions
Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6221
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
index b5e2c391ebcca05db5c960792fcb14991aec4fe2..87c148922d693b5a5bfde89b0dcbc44438df592b 100644
index b5e2c391ebcca05db5c960792fcb14991aec4fe2..b1abab9396cf1dc867e9b8df8f2479f75d07fa01 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -123,18 +123,30 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
}
}
+ private static final Predicate<net.minecraft.world.entity.LivingEntity> APPLY_WATER_GET_ENTITIES_PREDICATE = ThrownPotion.WATER_SENSITIVE.or(Axolotl.class::isInstance); // Paper
+ private static final Predicate<net.minecraft.world.entity.LivingEntity> APPLY_WATER_GET_ENTITIES_PREDICATE = ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE.or(Axolotl.class::isInstance); // Paper
private void applyWater() {
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
- List<net.minecraft.world.entity.LivingEntity> list = this.level.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);