it compiles?

This commit is contained in:
Jake Potrebic 2024-12-15 14:35:59 -08:00
parent 9bb6731cc4
commit 4cc2be301d
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
7 changed files with 95 additions and 16 deletions

View file

@ -1,6 +1,6 @@
--- /dev/null
+++ b/io/papermc/paper/FeatureHooks.java
@@ -1,0 +_,72 @@
@@ -1,0 +_,77 @@
+package io.papermc.paper;
+
+import io.papermc.paper.command.PaperSubcommand;
@ -16,6 +16,7 @@
+import net.minecraft.core.Registry;
+import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.entity.monster.Spider;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.biome.Biome;
@ -72,4 +73,8 @@
+ public static boolean isChunkSent(final ServerPlayer player, final long chunkKey) {
+ return player.getChunkTrackingView().contains(new ChunkPos(chunkKey));
+ }
+
+ public static boolean isSpiderCollidingWithWorldBorder(final Spider spider) {
+ return true; // ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isCollidingWithBorder(spider.level().getWorldBorder(), spider.getBoundingBox().inflate(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_EPSILON))
+ }
+}

View file

@ -1,16 +1,43 @@
--- a/net/minecraft/gametest/framework/GameTestServer.java
+++ b/net/minecraft/gametest/framework/GameTestServer.java
@@ -304,6 +_,13 @@
@@ -139,6 +_,8 @@
BlockPos spawnPos
) {
super(
+ null, // Paper
+ null, // Paper
serverThread,
storageSource,
packRepository,
@@ -154,8 +_,15 @@
@Override
public boolean initServer() {
- this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, 1) {});
- this.loadLevel();
+ // Paper start
+ this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, 1) {
+ @Override
+ public void loadAndSaveFiles() {
+ throw new UnsupportedOperationException("Should not be called in a GameTestServer");
+ }
+ });
+ this.loadLevel("blah");
+ // Paper end
ServerLevel serverLevel = this.overworld();
this.testBatches = Lists.newArrayList(GameTestBatchFactory.fromTestFunction(this.testFunctions, serverLevel));
serverLevel.setDefaultSpawnPos(this.spawnPos, 0.0F);
@@ -303,6 +_,13 @@
public boolean shouldInformAdmins() {
return false;
}
+
+ // Paper start
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(final net.minecraft.commands.CommandSourceStack wrapper) {
+ throw new UnsupportedOperationException("Not supported.");
+ }
+ // Paper end
+
@Override
public boolean isSingleplayerOwner(GameProfile profile) {
return false;

View file

@ -65,8 +65,8 @@
.apply(instance, MutableComponent::new)
);
+ // Paper start - adventure; create separate codec for each locale
+ final Codec<Component> origCodec = codec;
+ codec = new Codec<>() {
+ final Codec<Component> origCodec = codec1;
+ codec1 = new Codec<>() {
+ @Override
+ public <T> DataResult<com.mojang.datafixers.util.Pair<Component, T>> decode(final DynamicOps<T> ops, final T input) {
+ return origCodec.decode(ops, input);

View file

@ -5,7 +5,7 @@
super.tick();
if (!this.level().isClientSide) {
- this.setClimbing(this.horizontalCollision);
+ this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isCollidingWithBorder(this.level().getWorldBorder(), this.getBoundingBox().inflate(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_EPSILON)) && this.level().getWorldBorder().isInsideCloseToBorder(this, this.getBoundingBox())))); // Paper - Add config option for spider worldborder climbing (Inflate by +EPSILON as collision will just barely place us outside border)
+ this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !(io.papermc.paper.FeatureHooks.isSpiderCollidingWithWorldBorder(this) && this.level().getWorldBorder().isInsideCloseToBorder(this, this.getBoundingBox())))); // Paper - Add config option for spider worldborder climbing (Inflate by +EPSILON as collision will just barely place us outside border)
}
}

View file

@ -8,10 +8,25 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@@ -74,6 +_,16 @@
@@ -63,16 +_,26 @@
protected int inGroundTime;
public AbstractArrow.Pickup pickup = AbstractArrow.Pickup.DISALLOWED;
public int shakeTime;
- private int life;
+ public int life; // Paper - private -> public
private double baseDamage = 2.0;
- private SoundEvent soundEvent = this.getDefaultHitGroundSoundEvent();
+ public SoundEvent soundEvent = this.getDefaultHitGroundSoundEvent(); // Paper - private -> public
@Nullable
private ItemStack firedFromWeapon = null;
private IntOpenHashSet piercingIgnoreEntityIds;
@Nullable
private List<Entity> piercedAndKilledEntities;
- private ItemStack pickupItemStack = this.getDefaultPickupItem();
+ public ItemStack pickupItemStack = this.getDefaultPickupItem(); // Paper - private -> public
@Nullable
- private ItemStack firedFromWeapon = null;
+ public ItemStack firedFromWeapon = null; // Paper - private -> public
+
+ // Spigot Start
+ @Override
+ public void inactiveTick() {
@ -21,10 +36,9 @@
+ super.inactiveTick();
+ }
+ // Spigot End
+
protected AbstractArrow(EntityType<? extends AbstractArrow> entityType, Level level) {
super(entityType, level);
}
@@ -87,7 +_,13 @@
ItemStack pickupItemStack,
@Nullable ItemStack firedFromWeapon
@ -231,3 +245,34 @@
}
}
}
@@ -643,7 +_,7 @@
};
}
- protected ItemStack getPickupItem() {
+ public ItemStack getPickupItem() { // Paper - protected -> public
return this.pickupItemStack.copy();
}
@@ -675,7 +_,7 @@
this.setFlag(1, critArrow);
}
- private void setPierceLevel(byte pierceLevel) {
+ public void setPierceLevel(byte pierceLevel) { // Paper - private -> public
this.entityData.set(PIERCE_LEVEL, pierceLevel);
}
@@ -687,6 +_,12 @@
this.entityData.set(ID_FLAGS, (byte)(b & ~id));
}
}
+
+ // Paper start
+ public void setPickupItemStackPublic(final ItemStack pickupItemStack) {
+ this.setPickupItemStack(pickupItemStack);
+ }
+ // Paper end
protected void setPickupItemStack(ItemStack pickupItemStack) {
if (!pickupItemStack.isEmpty()) {

View file

@ -219,11 +219,13 @@
return interactionResult;
}
@@ -470,30 +_,69 @@
@@ -469,31 +_,70 @@
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
}
public void hurtAndBreak(int damage, ServerLevel level, @Nullable ServerPlayer player, Consumer<Item> onBreak) {
- public void hurtAndBreak(int damage, ServerLevel level, @Nullable ServerPlayer player, Consumer<Item> onBreak) {
- int i = this.processDurabilityChange(damage, level, player);
+ public void hurtAndBreak(int damage, ServerLevel level, @Nullable LivingEntity player, Consumer<Item> onBreak) { // Paper - Add EntityDamageItemEvent
+ // Paper start - add force boolean overload
+ this.hurtAndBreak(damage, level, player, onBreak, false);
+ }

View file

@ -150,7 +150,7 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
@Override
public void setItemStack(final ItemStack stack) {
Preconditions.checkArgument(stack != null, "ItemStack cannot be null");
this.getHandle().setPickupItemStack(CraftItemStack.asNMSCopy(stack));
this.getHandle().setPickupItemStackPublic(CraftItemStack.asNMSCopy(stack));
}
@Override