Updated Upstream (Bukkit/CraftBukkit/Spigot)

This commit is contained in:
Jake Potrebic
2021-12-31 19:05:42 -08:00
parent a657f18f1f
commit a36a4e2018
22 changed files with 100 additions and 195 deletions

View File

@@ -4,20 +4,6 @@ Date: Tue, 20 Jul 2021 21:25:35 -0700
Subject: [PATCH] Add a bunch of missing forceDrop toggles
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
}
if (this.tickCount > 100) {
+ this.forceDrops = true; // Paper
this.spawnAtLocation((ItemLike) Items.LEAD);
+ this.forceDrops = false; // Paper
this.leashInfoTag = null;
}
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java

View File

@@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
+ if (merchantrecipe.ignoreDiscounts) continue; // Paper
// CraftBukkit start
int bonus = -Mth.floor((float) i * merchantrecipe.getPriceMultiplier());
merchantrecipe.addToSpecialPriceDiff(-Mth.floor((float) i * merchantrecipe.getPriceMultiplier()));
}
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator1.hasNext()) {

View File

@@ -1303,7 +1303,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.adventure.PaperAdventure; // Paper
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.entity.animal.Bucketable;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
return this.server.isSingleplayerOwner(this.player.getGameProfile());
}

View File

@@ -4,21 +4,6 @@ Date: Sat, 8 May 2021 15:01:54 -0700
Subject: [PATCH] Attributes API for item defaults
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
@@ -0,0 +0,0 @@ public class CraftAttributeInstance implements AttributeInstance {
public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms) {
return new AttributeModifier(nms.getId(), nms.getName(), nms.getAmount(), AttributeModifier.Operation.values()[nms.getOperation().ordinal()]);
}
+
+ // Paper start - construct using slot
+ public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, org.bukkit.inventory.EquipmentSlot slot) {
+ return new AttributeModifier(nms.getId(), nms.getName(), nms.getAmount(), AttributeModifier.Operation.values()[nms.getOperation().ordinal()], slot);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -28,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ @Override
+ public com.google.common.collect.Multimap<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getItemAttributes(org.bukkit.Material material, org.bukkit.inventory.EquipmentSlot equipmentSlot) {
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(Material material, EquipmentSlot equipmentSlot) {
+ Item item = CraftMagicNumbers.getItem(material);
+ if (item == null) {
+ throw new IllegalArgumentException(material + " is not an item and therefore does not have attributes");
+ }
+ com.google.common.collect.ImmutableMultimap.Builder<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> attributeMapBuilder = com.google.common.collect.ImmutableMultimap.builder();
+ item.getDefaultAttributeModifiers(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(equipmentSlot)).forEach((attributeBase, attributeModifier) -> {
+ attributeMapBuilder.put(org.bukkit.Registry.ATTRIBUTE.get(CraftNamespacedKey.fromMinecraft(net.minecraft.core.Registry.ATTRIBUTE.getKey(attributeBase))), org.bukkit.craftbukkit.attribute.CraftAttributeInstance.convert(attributeModifier, equipmentSlot));
+ ImmutableMultimap.Builder<Attribute, AttributeModifier> attributeMapBuilder = ImmutableMultimap.builder();
+ item.getDefaultAttributeModifiers(CraftEquipmentSlot.getNMS(equipmentSlot)).forEach((attributeBase, attributeModifier) -> {
+ attributeMapBuilder.put(CraftAttributeMap.fromMinecraft(net.minecraft.core.Registry.ATTRIBUTE.getKey(attributeBase).toString()), CraftAttributeInstance.convert(attributeModifier, equipmentSlot));
+ });
+ return attributeMapBuilder.build();
+ }

View File

@@ -39,8 +39,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -0,0 +0,0 @@ public class Vindicator extends AbstractIllager {
private static class VindicatorBreakDoorGoal extends BreakDoorGoal {
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) {
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.vindicatorBreakDoors)); // Paper

View File

@@ -346,6 +346,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ExperienceOrb;
+import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.LivingEntity;
@@ -566,8 +567,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
{
- return true;
+ return 20; // Paper
}
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
+ }
+ // Paper start
+ if (entity instanceof Bee) {
+ Bee bee = (Bee)entity;
@@ -595,7 +595,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return config.villagersWorkImmunityFor;
+ }
+ }
+ }
}
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
+ if ( entity instanceof Llama && ( (Llama) entity ).inCaravan() )
{
- return true;
@@ -630,6 +631,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper end
}
// SPIGOT-6644: Otherwise the target refresh tick will be missed
if (entity instanceof ExperienceOrb) {
- return true;
+ return 20; // Paper
}
- return false;
+ return -1; // Paper
}

View File

@@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 12 Oct 2018 01:37:22 -0500
Subject: [PATCH] Here's Johnny!
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
@@ -0,0 +0,0 @@ public class CraftVindicator extends CraftIllager implements Vindicator {
public EntityType getType() {
return EntityType.VINDICATOR;
}
+
+ // Paper start
+ public boolean isJohnny() {
+ return getHandle().isJohnny;
+ }
+
+ public void setJohnny(boolean johnny) {
+ getHandle().isJohnny = johnny;
+ }
+ // Paper end
}

View File

@@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 10 Aug 2018 22:11:49 -0400
Subject: [PATCH] Make EnderDragon implement Mob
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java
@@ -0,0 +0,0 @@
package org.bukkit.craftbukkit.entity;
-import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.entity.Mob;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ComplexLivingEntity;
-public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity {
- public CraftComplexLivingEntity(CraftServer server, LivingEntity entity) {
+public abstract class CraftComplexLivingEntity extends CraftMob implements ComplexLivingEntity { // Paper
+ public CraftComplexLivingEntity(CraftServer server, Mob entity) { // Paper
super(server, entity);
}
@Override
- public LivingEntity getHandle() {
- return (LivingEntity) entity;
+ public Mob getHandle() { // Paper
+ return (Mob) entity; // Paper
}
@Override

View File

@@ -69,21 +69,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
@@ -0,0 +0,0 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo
public Variant getVariant() {
return Variant.SKELETON_HORSE;
public void setTrapTime(int trapTime) {
this.getHandle().trapTime = trapTime;
}
+
+ // Paper start
+ @Override
+ public net.minecraft.world.entity.animal.horse.SkeletonHorse getHandle() {
+ return (net.minecraft.world.entity.animal.horse.SkeletonHorse) super.getHandle();
+ }
+
+ @Override
+ public int getTrapTime() {
+ return getHandle().trapTime;
+ }
+
+ // Paper start - replaced by above methods
+ @Override
+ public boolean isTrap() {
+ return getHandle().isTrap();

View File

@@ -2131,7 +2131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
return clazz;
return defaultAttributes.build();
}
+ // Paper start