mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
928bcc8d3a
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
43 lines
2.4 KiB
Diff
43 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Legitimoose <legitimoose@gmail.com>
|
|
Date: Wed, 28 Sep 2022 22:45:49 -0700
|
|
Subject: [PATCH] fix Jigsaw block kicking user
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
|
index fee4aef1bdae1b1ca57ff0b6c3fd2ec31439c37b..b56e4be3228489b5b910c23bde1717d5d3e2ad9a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
|
@@ -108,7 +108,12 @@ public class JigsawBlockEntity extends BlockEntity {
|
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
|
BlockPos blockPos = this.getBlockPos().relative(this.getBlockState().getValue(JigsawBlock.ORIENTATION).front());
|
|
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registry.TEMPLATE_POOL_REGISTRY);
|
|
- Holder<StructureTemplatePool> holder = registry.getHolderOrThrow(this.pool);
|
|
+ // Paper start - Replace getHolderOrThrow with a null check
|
|
+ Holder<StructureTemplatePool> holder = registry.getHolder(this.pool).orElse(null);
|
|
+ if (holder == null) {
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
JigsawPlacement.generateJigsaw(world, holder, this.target, maxDepth, blockPos, keepJigsaws);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java
|
|
index de7435f6596e200c8511224a0479c2ad499b2a97..bcf9eb1096b09748bcabba05bc9ffac494d3c611 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java
|
|
@@ -89,7 +89,13 @@ public class StructureTemplatePool {
|
|
}
|
|
|
|
public StructurePoolElement getRandomTemplate(RandomSource random) {
|
|
+ //Paper start - Prevent random.nextInt throwing an IllegalArgumentException
|
|
+ if (this.templates.size() == 0) {
|
|
+ return EmptyPoolElement.INSTANCE;
|
|
+ } else {
|
|
return this.templates.get(random.nextInt(this.templates.size()));
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
public List<StructurePoolElement> getShuffledTemplates(RandomSource random) {
|