Increase diff stability

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:57:13 +10:00
parent 8a3c8cfcd4
commit e903417936
27 changed files with 162 additions and 170 deletions

View File

@@ -7,11 +7,11 @@
- entity.getSelfAndPassengers().forEach(this::addFreshEntity);
+ // CraftBukkit start
+ this.addFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
}
+ }
+
+ default void addFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ entity.getSelfAndPassengers().forEach((e) -> this.addFreshEntity(e, reason));
+ }
}
+
+ @Override
+ default WorldServer getMinecraftWorld() {

View File

@@ -24,7 +24,7 @@
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -504,16 +510,24 @@
@@ -504,17 +510,25 @@
return this.builtInRegistryHolder;
}
@@ -42,12 +42,13 @@
}
+ return 0;
+ }
+
}
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
+ return 0;
}
+ }
+ // CraftBukkit end
+
public static final class a {
private final IBlockData first;

View File

@@ -16,7 +16,8 @@
- boolean flag1 = world.hasNeighborSignal(blockposition) || world.hasNeighborSignal(blockposition.relative(iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN));
+ // CraftBukkit start
+ BlockPosition otherHalf = blockposition.relative(iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN);
+
- if (!this.defaultBlockState().is(block) && flag1 != (Boolean) iblockdata.getValue(BlockDoor.POWERED)) {
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block blockTop = bworld.getBlockAt(otherHalf.getX(), otherHalf.getY(), otherHalf.getZ());
@@ -29,8 +30,7 @@
+ if (oldPower == 0 ^ power == 0) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
- if (!this.defaultBlockState().is(block) && flag1 != (Boolean) iblockdata.getValue(BlockDoor.POWERED)) {
+
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
if (flag1 != (Boolean) iblockdata.getValue(BlockDoor.OPEN)) {

View File

@@ -28,7 +28,7 @@
@Nullable
static MobEffectList filterEffect(@Nullable MobEffectList mobeffectlist) {
@@ -245,39 +259,78 @@
@@ -245,38 +259,77 @@
super.setRemoved();
}
@@ -93,9 +93,9 @@
}
+ return false;
}
}
+ }
+ }
+
+ private static void applyEffects(World world, BlockPosition blockposition, int i, @Nullable MobEffectList mobeffectlist, @Nullable MobEffectList mobeffectlist1) {
+ if (!world.isClientSide && mobeffectlist != null) {
+ double d0 = (double) (i * 10 + 10);
@@ -109,14 +109,13 @@
+ if (hasSecondaryEffect(i, mobeffectlist, mobeffectlist1)) {
+ applyEffect(list, mobeffectlist1, j, 0);
+ }
+ }
}
+
+ }
}
+ // CraftBukkit end
+
public static void playSound(World world, BlockPosition blockposition, SoundEffect soundeffect) {
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -312,7 +365,7 @@
if (nbttagcompound.contains(s, 8)) {
MinecraftKey minecraftkey = MinecraftKey.tryParse(nbttagcompound.getString(s));

View File

@@ -124,8 +124,9 @@
ItemStack itemstack = (ItemStack) nonnulllist.get(3);
+ InventoryHolder owner = tileentitybrewingstand.getOwner();
+ List<org.bukkit.inventory.ItemStack> brewResults = new ArrayList<>(3);
+
+ for (int i = 0; i < 3; ++i) {
for (int i = 0; i < 3; ++i) {
- nonnulllist.set(i, PotionBrewer.mix(itemstack, (ItemStack) nonnulllist.get(i)));
+ brewResults.add(i, CraftItemStack.asCraftMirror(PotionBrewer.mix(itemstack, (ItemStack) nonnulllist.get(i))));
+ }
+
@@ -137,9 +138,8 @@
+ }
+ }
+ // CraftBukkit end
for (int i = 0; i < 3; ++i) {
- nonnulllist.set(i, PotionBrewer.mix(itemstack, (ItemStack) nonnulllist.get(i)));
+
+ for (int i = 0; i < 3; ++i) {
+ // CraftBukkit start - validate index in case it is cleared by plugins
+ if (i < brewResults.size()) {
+ nonnulllist.set(i, CraftItemStack.asNMSCopy(brewResults.get(i)));