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

@@ -21,7 +21,8 @@
+ World world = sourceblock.level();
+ org.bukkit.block.Block block = CraftBlock.at(world, sourceblock.pos());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
- entityliving.setItemSlot(enumitemslot, itemstack1);
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.getBukkitEntity());
+ if (!BlockDispenser.eventFired) {
+ world.getCraftServer().getPluginManager().callEvent(event);
@@ -42,8 +43,7 @@
+ return true;
+ }
+ }
- entityliving.setItemSlot(enumitemslot, itemstack1);
+
+ entityliving.setItemSlot(enumitemslot, CraftItemStack.asNMSCopy(event.getItem()));
+ // CraftBukkit end
if (entityliving instanceof EntityInsentient) {

View File

@@ -100,11 +100,11 @@
+ // CraftBukkit start - store default return
+ boolean defaultReturn = (!this.mustSurvive() || iblockdata.canSurvive(blockactioncontext.getLevel(), blockactioncontext.getClickedPos())) && blockactioncontext.getLevel().isUnobstructed(iblockdata, blockactioncontext.getClickedPos(), voxelshapecollision);
+ org.bukkit.entity.Player player = (blockactioncontext.getPlayer() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getPlayer().getBukkitEntity() : null;
+
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getLevel(), blockactioncontext.getClickedPos()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
+ blockactioncontext.getLevel().getCraftServer().getPluginManager().callEvent(event);
- return (!this.mustSurvive() || iblockdata.canSurvive(blockactioncontext.getLevel(), blockactioncontext.getClickedPos())) && blockactioncontext.getLevel().isUnobstructed(iblockdata, blockactioncontext.getClickedPos(), voxelshapecollision);
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getLevel(), blockactioncontext.getClickedPos()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
+ blockactioncontext.getLevel().getCraftServer().getPluginManager().callEvent(event);
+
+ return event.isBuildable();
+ // CraftBukkit end
}

View File

@@ -107,7 +107,7 @@
});
MinecraftKey minecraftkey = recipeholder.id();
RecipeHolder<?> recipeholder1 = (RecipeHolder) map1.put(minecraftkey, recipeholder);
@@ -182,8 +208,28 @@
@@ -182,9 +208,29 @@
}
});
this.recipes = ImmutableMap.copyOf(map);
@@ -122,8 +122,8 @@
+ }
+
+ return byName.remove(mcKey) != null;
+ }
+
}
+ public void clearRecipes() {
+ this.recipes = Maps.newHashMap();
+
@@ -132,8 +132,9 @@
+ }
+
+ this.byName = Maps.newHashMap();
}
+ }
+ // CraftBukkit end
+
public static <C extends IInventory, T extends IRecipe<C>> CraftingManager.a<C, T> createCheck(final Recipes<T> recipes) {
return new CraftingManager.a<C, T>() {
@Nullable