Improve update helper task
This commit is contained in:
parent
fc12258f24
commit
2053d6ace7
10 changed files with 82 additions and 36 deletions
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Warrior <50800980+Warriorrrr@users.noreply.github.com>
|
||||
Date: Fri, 13 Aug 2021 01:14:38 +0200
|
||||
Subject: [PATCH] Configurable item frame map cursor update interval
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 7cdebafd7a9f5606980ae89c8f3823f9ce560a9e..04ca37b872a1585c55ac0b64d776073bf678ab0d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -117,7 +117,7 @@ public class ServerEntity {
|
||||
if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
|
||||
ItemStack itemstack = entityitemframe.getItem();
|
||||
|
||||
- if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
|
||||
+ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
|
||||
Integer integer = MapItem.getMapId(itemstack);
|
||||
MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level);
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 21:25:31 -0800
|
||||
Subject: [PATCH] Make EntityUnleashEvent cancellable
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 764a5dd85e3fb581b1e713ce9b148be1874d55be..16d84042e2575418880897c728a99d1b8bbcdd15 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1550,7 +1550,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
if (flag1 && this.isLeashed()) {
|
||||
// Paper start - drop leash variable
|
||||
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
|
||||
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
|
||||
+ if (!event.callEvent()) { return flag1; }
|
||||
this.dropLeash(true, event.isDropLeash());
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
index 8e362ad31208d87f4a69a1747485610e0588be51..463b72cab6a62e9738b33007728b2b00ae12e1bc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
@@ -59,7 +59,7 @@ public abstract class PathfinderMob extends Mob {
|
||||
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
|
||||
// Paper start - drop leash variable
|
||||
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
|
||||
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
|
||||
+ if (!event.callEvent()) { return; }
|
||||
this.dropLeash(true, event.isDropLeash());
|
||||
// Paper end
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public abstract class PathfinderMob extends Mob {
|
||||
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
|
||||
// Paper start - drop leash variable
|
||||
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
|
||||
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
|
||||
+ if (!event.callEvent()) { return; }
|
||||
this.dropLeash(true, event.isDropLeash());
|
||||
// Paper end
|
||||
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
|
20
patches/server/0651-Clear-bucket-NBT-after-dispense.patch
Normal file
20
patches/server/0651-Clear-bucket-NBT-after-dispense.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 13 Aug 2021 15:00:06 -0700
|
||||
Subject: [PATCH] Clear bucket NBT after dispense
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index 8c8d2e81f0866dc1441e181f2580852d87263bcc..9f220c99d7374ab3d9db222346694342d3e926c1 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -650,8 +650,7 @@ public interface DispenseItemBehavior {
|
||||
Item item = Items.BUCKET;
|
||||
stack.shrink(1);
|
||||
if (stack.isEmpty()) {
|
||||
- stack.setItem(Items.BUCKET);
|
||||
- stack.setCount(1);
|
||||
+ stack = new ItemStack(item); // Paper - clear tag
|
||||
} else if (pointer.blockEntity().addItem(new ItemStack(item)) < 0) {
|
||||
this.defaultDispenseItemBehavior.dispense(pointer, new ItemStack(item));
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 12:13:53 -0700
|
||||
Subject: [PATCH] Change EnderEye target without changing other things
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
index ee6bbe96503e9205349e9a5c411dc60dd952ec9e..e48706e2fefc39fcce3c65f629153fdcd677044c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
@@ -70,6 +70,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
}
|
||||
|
||||
public void signalTo(BlockPos pos) {
|
||||
+ // Paper start
|
||||
+ this.signalTo(pos, true);
|
||||
+ }
|
||||
+ public void signalTo(BlockPos pos, boolean update) {
|
||||
+ // Paper end
|
||||
double d0 = (double) pos.getX();
|
||||
int i = pos.getY();
|
||||
double d1 = (double) pos.getZ();
|
||||
@@ -87,8 +92,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
this.tz = d1;
|
||||
}
|
||||
|
||||
+ if (update) { // Paper
|
||||
this.life = 0;
|
||||
this.surviveAfterDeath = this.random.nextInt(5) > 0;
|
||||
+ } // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
|
||||
index d4dfc7a0266086b9bf2c3966c6e149453d0583ba..1fb5760681bf0c745f9f3517489a83666a6d6805 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
|
||||
@@ -32,8 +32,15 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
|
||||
|
||||
@Override
|
||||
public void setTargetLocation(Location location) {
|
||||
+ // Paper start
|
||||
+ this.setTargetLocation(location, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setTargetLocation(Location location, boolean update) {
|
||||
+ // Paper end
|
||||
Preconditions.checkArgument(this.getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
|
||||
- this.getHandle().signalTo(CraftLocation.toBlockPosition(location));
|
||||
+ this.getHandle().signalTo(CraftLocation.toBlockPosition(location), update); // Paper
|
||||
}
|
||||
|
||||
@Override
|
86
patches/server/0653-Add-BlockBreakBlockEvent.patch
Normal file
86
patches/server/0653-Add-BlockBreakBlockEvent.patch
Normal file
|
@ -0,0 +1,86 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 17:58:11 -0800
|
||||
Subject: [PATCH] Add BlockBreakBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 2c190473b98899e86d8bcd5a81c72bbc0a85b2a9..f0a85f1b48a911ffd8740df5ebe869e8f0371a58 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -326,6 +326,23 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
|
||||
}
|
||||
+ // Paper start
|
||||
+ public static boolean dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity, BlockPos source) {
|
||||
+ if (world instanceof ServerLevel) {
|
||||
+ List<org.bukkit.inventory.ItemStack> items = com.google.common.collect.Lists.newArrayList();
|
||||
+ for (net.minecraft.world.item.ItemStack drop : net.minecraft.world.level.block.Block.getDrops(state, world.getMinecraftWorld(), pos, blockEntity)) {
|
||||
+ items.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(drop));
|
||||
+ }
|
||||
+ io.papermc.paper.event.block.BlockBreakBlockEvent event = new io.papermc.paper.event.block.BlockBreakBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.block.CraftBlock.at(world, source), items);
|
||||
+ event.callEvent();
|
||||
+ for (var drop : event.getDrops()) {
|
||||
+ popResource(world.getMinecraftWorld(), pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(drop));
|
||||
+ }
|
||||
+ state.spawnAfterBreak(world.getMinecraftWorld(), pos, ItemStack.EMPTY, true);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
|
||||
if (world instanceof ServerLevel) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index 565da027ca7c395f9b965505cbe9e85e62367834..cda90023ad662e8875365eac98ec69f476dcb42d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -415,7 +415,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
iblockdata1 = world.getBlockState(blockposition3);
|
||||
BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null;
|
||||
|
||||
- dropResources(iblockdata1, world, blockposition3, tileentity);
|
||||
+ dropResources(iblockdata1, world, blockposition3, tileentity, pos); // Paper
|
||||
world.setBlock(blockposition3, Blocks.AIR.defaultBlockState(), 18);
|
||||
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition3, GameEvent.Context.of(iblockdata1));
|
||||
if (!iblockdata1.is(BlockTags.FIRE)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index f7527ed1d47901e52df4e3fffbdcd838782c90db..55208b4889f4af60f2b2b66ed6b102b2cd0bb26b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -296,7 +296,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState);
|
||||
} else {
|
||||
if (!state.isAir()) {
|
||||
- this.beforeDestroyingBlock(world, pos, state);
|
||||
+ this.beforeDestroyingBlock(world, pos, state, pos.relative(direction.getOpposite())); // Paper
|
||||
}
|
||||
|
||||
world.setBlock(pos, fluidState.createLegacyBlock(), 3);
|
||||
@@ -304,6 +304,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
|
||||
}
|
||||
|
||||
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - add source parameter
|
||||
protected abstract void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state);
|
||||
|
||||
private static short getCacheKey(BlockPos from, BlockPos to) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index 1897c0012800d5ba9d2fc386f3e2bf57c9d878bb..82e85fbbd45244d02df90fa00c9046e7f51275a2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -64,6 +64,13 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) {
|
||||
+ BlockEntity tileentity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
||||
+ Block.dropResources(state, world, pos, tileentity, source);
|
||||
+ }
|
||||
+ // Paper end
|
||||
@Override
|
||||
protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||
BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
|
@ -0,0 +1,147 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 12:57:28 -0700
|
||||
Subject: [PATCH] Option to prevent NBT copy in smithing recipes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
index 566b588006da2b46ec1727be85560ccd59c42c6f..8f71a60c1d83dfad67ac77ec4464a55c7439d4b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
@@ -23,8 +23,15 @@ public class SmithingTransformRecipe implements SmithingRecipe {
|
||||
final Ingredient base;
|
||||
final Ingredient addition;
|
||||
final ItemStack result;
|
||||
+ final boolean copyNBT; // Paper
|
||||
|
||||
public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result) {
|
||||
+ // Paper start
|
||||
+ this(template, base, addition, result, true);
|
||||
+ }
|
||||
+ public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result, boolean copyNBT) {
|
||||
+ this.copyNBT = copyNBT;
|
||||
+ // Paper end
|
||||
this.template = template;
|
||||
this.base = base;
|
||||
this.addition = addition;
|
||||
@@ -39,11 +46,13 @@ public class SmithingTransformRecipe implements SmithingRecipe {
|
||||
@Override
|
||||
public ItemStack assemble(Container inventory, RegistryAccess registryManager) {
|
||||
ItemStack itemstack = this.result.copy();
|
||||
+ if (this.copyNBT) { // Paper - copy nbt conditionally
|
||||
CompoundTag nbttagcompound = inventory.getItem(1).getTag();
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
itemstack.setTag(nbttagcompound.copy());
|
||||
}
|
||||
+ } // Paper
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -83,7 +92,7 @@ public class SmithingTransformRecipe implements SmithingRecipe {
|
||||
public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
|
||||
- CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
|
||||
|
||||
return recipe;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..2f26ef211322398e795cbdc75b565fc7922cf4ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
@@ -29,8 +29,15 @@ public class SmithingTrimRecipe implements SmithingRecipe {
|
||||
final Ingredient template;
|
||||
final Ingredient base;
|
||||
final Ingredient addition;
|
||||
+ final boolean copyNbt; // Paper
|
||||
|
||||
public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition) {
|
||||
+ // Paper start
|
||||
+ this(template, base, addition, true);
|
||||
+ }
|
||||
+ public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition, boolean copyNbt) {
|
||||
+ this.copyNbt = copyNbt;
|
||||
+ // Paper end
|
||||
this.template = template;
|
||||
this.base = base;
|
||||
this.addition = addition;
|
||||
@@ -56,7 +63,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
- ItemStack itemstack1 = itemstack.copy();
|
||||
+ ItemStack itemstack1 = this.copyNbt ? itemstack.copy() : new ItemStack(itemstack.getItem(), itemstack.getCount()); // Paper
|
||||
|
||||
itemstack1.setCount(1);
|
||||
ArmorTrim armortrim = new ArmorTrim((Holder) optional.get(), (Holder) optional1.get());
|
||||
@@ -116,7 +123,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
|
||||
// CraftBukkit start
|
||||
@Override
|
||||
public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
- return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+ return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
|
||||
index 8c381e2745e7d5b63e72a60c5541b549f0d1b9bf..8b0e3a92e9893af954bc85adb2566502b65a0fa4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
|
||||
@@ -12,12 +12,17 @@ public class CraftSmithingTransformRecipe extends SmithingTransformRecipe implem
|
||||
public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition) {
|
||||
super(key, result, template, base, addition);
|
||||
}
|
||||
+ // Paper start
|
||||
+ public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
|
||||
+ super(key, result, template, base, addition, copyNbt);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) {
|
||||
if (recipe instanceof CraftSmithingTransformRecipe) {
|
||||
return (CraftSmithingTransformRecipe) recipe;
|
||||
}
|
||||
- CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition());
|
||||
+ CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -25,6 +30,6 @@ public class CraftSmithingTransformRecipe extends SmithingTransformRecipe implem
|
||||
public void addToCraftingManager() {
|
||||
ItemStack result = this.getResult();
|
||||
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result))));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt()))); // Paper
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
||||
index 87f20a4811d082f217638768417c1c0feb84f741..105c72a674e1a8ca4eb6003841f5d933d3a2c275 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
||||
@@ -12,17 +12,22 @@ public class CraftSmithingTrimRecipe extends SmithingTrimRecipe implements Craft
|
||||
public CraftSmithingTrimRecipe(NamespacedKey key, RecipeChoice template, RecipeChoice base, RecipeChoice addition) {
|
||||
super(key, template, base, addition);
|
||||
}
|
||||
+ // Paper start
|
||||
+ public CraftSmithingTrimRecipe(NamespacedKey key, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
|
||||
+ super(key, template, base, addition, copyNbt);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static CraftSmithingTrimRecipe fromBukkitRecipe(SmithingTrimRecipe recipe) {
|
||||
if (recipe instanceof CraftSmithingTrimRecipe) {
|
||||
return (CraftSmithingTrimRecipe) recipe;
|
||||
}
|
||||
- CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition());
|
||||
+ CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToCraftingManager() {
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true))));
|
||||
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), this.willCopyNbt()))); // Paper
|
||||
}
|
||||
}
|
100
patches/server/0655-More-CommandBlock-API.patch
Normal file
100
patches/server/0655-More-CommandBlock-API.patch
Normal file
|
@ -0,0 +1,100 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 10:40:09 -0700
|
||||
Subject: [PATCH] More CommandBlock API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0b42306f17bf8850a13a51067c2d19e7583187e5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package io.papermc.paper.commands;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import io.papermc.paper.command.CommandBlockHolder;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.world.level.BaseCommandBlock;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public interface PaperCommandBlockHolder extends CommandBlockHolder {
|
||||
+
|
||||
+ BaseCommandBlock getCommandBlockHandle();
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull Component lastOutput() {
|
||||
+ return PaperAdventure.asAdventure(getCommandBlockHandle().getLastOutput());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default void lastOutput(@Nullable Component lastOutput) {
|
||||
+ getCommandBlockHandle().setLastOutput(PaperAdventure.asVanilla(lastOutput));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int getSuccessCount() {
|
||||
+ return getCommandBlockHandle().getSuccessCount();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default void setSuccessCount(int successCount) {
|
||||
+ getCommandBlockHandle().setSuccessCount(successCount);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
||||
index 7f5d930b6bfaf9a0042f9be4be68f2cc111b304e..63f6b97d82c8b98eb1379b5c30f6c75eb22f7c23 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.CommandBlock;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
|
||||
-public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock {
|
||||
+public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock, io.papermc.paper.commands.PaperCommandBlockHolder {
|
||||
|
||||
public CraftCommandBlock(World world, CommandBlockEntity tileEntity) {
|
||||
super(world, tileEntity);
|
||||
@@ -50,5 +50,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
|
||||
public void name(net.kyori.adventure.text.Component name) {
|
||||
getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() {
|
||||
+ return getSnapshot().getCommandBlock();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
||||
index 92e21126a9347f1ee2279ab09bb6abf2344ad2e2..0ee159d488b15e571f9b19ec852fe279755696fa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
||||
@@ -13,7 +13,7 @@ import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
-public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart {
|
||||
+public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart, io.papermc.paper.commands.PaperCommandBlockHolder {
|
||||
private final PermissibleBase perm = new PermissibleBase(this);
|
||||
|
||||
public CraftMinecartCommand(CraftServer server, MinecartCommandBlock entity) {
|
||||
@@ -64,6 +64,17 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
|
||||
public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component name() {
|
||||
return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().getCommandBlock().getName());
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() {
|
||||
+ return getHandle().getCommandBlock();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void lastOutput(net.kyori.adventure.text.Component lastOutput) {
|
||||
+ io.papermc.paper.commands.PaperCommandBlockHolder.super.lastOutput(lastOutput);
|
||||
+ getCommandBlockHandle().onUpdated();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
102
patches/server/0656-Add-missing-team-sidebar-display-slots.patch
Normal file
102
patches/server/0656-Add-missing-team-sidebar-display-slots.patch
Normal file
|
@ -0,0 +1,102 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 1 Oct 2021 08:04:39 -0700
|
||||
Subject: [PATCH] Add missing team sidebar display slots
|
||||
|
||||
== AT ==
|
||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations
|
||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations toBukkitSlot(Lnet/minecraft/world/scores/DisplaySlot;)Lorg/bukkit/scoreboard/DisplaySlot;
|
||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)Lnet/minecraft/world/scores/DisplaySlot;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||
index 73c5ffff70605b32188a9bb5fb6c0ee04cb66efe..711d227f5ee6d63356a94a0567968da48e9f284c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||
@@ -7,35 +7,22 @@ import org.bukkit.scoreboard.RenderType;
|
||||
|
||||
public final class CraftScoreboardTranslations {
|
||||
static final int MAX_DISPLAY_SLOT = 19;
|
||||
+ @Deprecated // Paper
|
||||
static final ImmutableBiMap<DisplaySlot, String> SLOTS = ImmutableBiMap.<DisplaySlot, String>builder()
|
||||
.put(DisplaySlot.BELOW_NAME, "below_name")
|
||||
.put(DisplaySlot.PLAYER_LIST, "list")
|
||||
.put(DisplaySlot.SIDEBAR, "sidebar")
|
||||
- .put(DisplaySlot.SIDEBAR_BLACK, "sidebar.team.black")
|
||||
- .put(DisplaySlot.SIDEBAR_DARK_BLUE, "sidebar.team.dark_blue")
|
||||
- .put(DisplaySlot.SIDEBAR_DARK_GREEN, "sidebar.team.dark_green")
|
||||
- .put(DisplaySlot.SIDEBAR_DARK_AQUA, "sidebar.team.dark_aqua")
|
||||
- .put(DisplaySlot.SIDEBAR_DARK_RED, "sidebar.team.dark_red")
|
||||
- .put(DisplaySlot.SIDEBAR_DARK_PURPLE, "sidebar.team.dark_purple")
|
||||
- .put(DisplaySlot.SIDEBAR_GOLD, "sidebar.team.gold")
|
||||
- .put(DisplaySlot.SIDEBAR_GRAY, "sidebar.team.gray")
|
||||
- .put(DisplaySlot.SIDEBAR_DARK_GRAY, "sidebar.team.dark_gray")
|
||||
- .put(DisplaySlot.SIDEBAR_BLUE, "sidebar.team.blue")
|
||||
- .put(DisplaySlot.SIDEBAR_GREEN, "sidebar.team.green")
|
||||
- .put(DisplaySlot.SIDEBAR_AQUA, "sidebar.team.aqua")
|
||||
- .put(DisplaySlot.SIDEBAR_RED, "sidebar.team.red")
|
||||
- .put(DisplaySlot.SIDEBAR_LIGHT_PURPLE, "sidebar.team.light_purple")
|
||||
- .put(DisplaySlot.SIDEBAR_YELLOW, "sidebar.team.yellow")
|
||||
- .put(DisplaySlot.SIDEBAR_WHITE, "sidebar.team.white")
|
||||
.buildOrThrow();
|
||||
|
||||
private CraftScoreboardTranslations() {}
|
||||
|
||||
public static DisplaySlot toBukkitSlot(net.minecraft.world.scores.DisplaySlot minecraft) {
|
||||
+ if (true) return DisplaySlot.NAMES.value(minecraft.getSerializedName()); // Paper
|
||||
return CraftScoreboardTranslations.SLOTS.inverse().get(minecraft.getSerializedName());
|
||||
}
|
||||
|
||||
public static net.minecraft.world.scores.DisplaySlot fromBukkitSlot(DisplaySlot slot) {
|
||||
+ if (true) return net.minecraft.world.scores.DisplaySlot.CODEC.byName(slot.getId()); // Paper
|
||||
return net.minecraft.world.scores.DisplaySlot.CODEC.byName(CraftScoreboardTranslations.SLOTS.get(slot));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 128c9d81814ba1fb24895962e5f08495dbedb176..812819e814cfbdb542051a7dbfe123d3c59e66bd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -239,6 +239,14 @@ public class Commodore
|
||||
desc = getOriginalOrRewrite( desc );
|
||||
}
|
||||
// Paper end
|
||||
+ // Paper start - DisplaySlot
|
||||
+ if (owner.equals("org/bukkit/scoreboard/DisplaySlot")) {
|
||||
+ if (name.startsWith("SIDEBAR_") && !name.startsWith("SIDEBAR_TEAM_")) {
|
||||
+ super.visitFieldInsn(opcode, owner, name.replace("SIDEBAR_", "SIDEBAR_TEAM_"), desc);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - DisplaySlot
|
||||
|
||||
if ( owner.equals( "org/bukkit/block/Biome" ) )
|
||||
{
|
||||
diff --git a/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..69c9678f8218c240be1044eeabe1c6bef7747b1e
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package io.papermc.paper.scoreboard;
|
||||
+
|
||||
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
|
||||
+import org.bukkit.scoreboard.DisplaySlot;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
+
|
||||
+public class DisplaySlotTest {
|
||||
+
|
||||
+ @Test
|
||||
+ public void testBukkitToMinecraftDisplaySlots() {
|
||||
+ for (DisplaySlot bukkitSlot : DisplaySlot.values()) {
|
||||
+ assertNotNull(CraftScoreboardTranslations.fromBukkitSlot(bukkitSlot));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testMinecraftToBukkitDisplaySlots() {
|
||||
+ for (net.minecraft.world.scores.DisplaySlot nmsSlot : net.minecraft.world.scores.DisplaySlot.values()) {
|
||||
+ assertNotNull(CraftScoreboardTranslations.toBukkitSlot(nmsSlot));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
50
patches/server/0657-Add-back-EntityPortalExitEvent.patch
Normal file
50
patches/server/0657-Add-back-EntityPortalExitEvent.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 16 May 2021 09:39:46 -0700
|
||||
Subject: [PATCH] Add back EntityPortalExitEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2731b44b3cd5de300ffcf93c690a617091b199ef..5f642ba64877a3ba53f69b8cffd99ed8c56a3d3f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3373,6 +3373,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
worldserver = shapedetectorshape.world;
|
||||
+ // Paper start - Call EntityPortalExitEvent
|
||||
+ CraftEntity bukkitEntity = this.getBukkitEntity();
|
||||
+ Vec3 position = shapedetectorshape.pos;
|
||||
+ float yaw = shapedetectorshape.yRot;
|
||||
+ float pitch = bukkitEntity.getLocation().getPitch(); // Keep entity pitch as per moveTo line below
|
||||
+ Vec3 velocity = shapedetectorshape.speed;
|
||||
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(bukkitEntity,
|
||||
+ bukkitEntity.getLocation(), new Location(worldserver.getWorld(), position.x, position.y, position.z, yaw, pitch),
|
||||
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(shapedetectorshape.speed));
|
||||
+ event.callEvent();
|
||||
+ if (this.isRemoved()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.isCancelled() && event.getTo() != null) {
|
||||
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ position = new Vec3(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
+ yaw = event.getTo().getYaw();
|
||||
+ pitch = event.getTo().getPitch();
|
||||
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (worldserver == this.level) {
|
||||
// SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
|
||||
this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
@@ -3392,8 +3414,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
|
||||
if (entity != null) {
|
||||
entity.restoreFrom(this);
|
||||
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
- entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - use EntityPortalExitEvent values
|
||||
+ entity.setDeltaMovement(velocity); // Paper - use EntityPortalExitEvent values
|
||||
// CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
|
||||
if (this.inWorld) {
|
||||
worldserver.addDuringTeleport(entity);
|
Loading…
Add table
Add a link
Reference in a new issue