--- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
@@ -12,34 +12,44 @@
 import net.minecraft.world.level.levelgen.structure.BoundingBox;
 
 public class StructurePlaceSettings {
-    private Mirror mirror = Mirror.NONE;
-    private Rotation rotation = Rotation.NONE;
-    private BlockPos rotationPivot = BlockPos.ZERO;
+
+    private Mirror mirror;
+    private Rotation rotation;
+    private BlockPos rotationPivot;
     private boolean ignoreEntities;
     @Nullable
     private BoundingBox boundingBox;
-    private boolean keepLiquids = true;
+    private boolean keepLiquids;
     @Nullable
     private RandomSource random;
-    private int palette;
-    private final List<StructureProcessor> processors = Lists.newArrayList();
+    public int palette = -1; // CraftBukkit - Set initial value so we know if the palette has been set forcefully
+    private final List<StructureProcessor> processors;
     private boolean knownShape;
     private boolean finalizeEntities;
 
+    public StructurePlaceSettings() {
+        this.mirror = Mirror.NONE;
+        this.rotation = Rotation.NONE;
+        this.rotationPivot = BlockPos.ZERO;
+        this.keepLiquids = true;
+        this.processors = Lists.newArrayList();
+    }
+
     public StructurePlaceSettings copy() {
-        StructurePlaceSettings structurePlaceSettings = new StructurePlaceSettings();
-        structurePlaceSettings.mirror = this.mirror;
-        structurePlaceSettings.rotation = this.rotation;
-        structurePlaceSettings.rotationPivot = this.rotationPivot;
-        structurePlaceSettings.ignoreEntities = this.ignoreEntities;
-        structurePlaceSettings.boundingBox = this.boundingBox;
-        structurePlaceSettings.keepLiquids = this.keepLiquids;
-        structurePlaceSettings.random = this.random;
-        structurePlaceSettings.palette = this.palette;
-        structurePlaceSettings.processors.addAll(this.processors);
-        structurePlaceSettings.knownShape = this.knownShape;
-        structurePlaceSettings.finalizeEntities = this.finalizeEntities;
-        return structurePlaceSettings;
+        StructurePlaceSettings definedstructureinfo = new StructurePlaceSettings();
+
+        definedstructureinfo.mirror = this.mirror;
+        definedstructureinfo.rotation = this.rotation;
+        definedstructureinfo.rotationPivot = this.rotationPivot;
+        definedstructureinfo.ignoreEntities = this.ignoreEntities;
+        definedstructureinfo.boundingBox = this.boundingBox;
+        definedstructureinfo.keepLiquids = this.keepLiquids;
+        definedstructureinfo.random = this.random;
+        definedstructureinfo.palette = this.palette;
+        definedstructureinfo.processors.addAll(this.processors);
+        definedstructureinfo.knownShape = this.knownShape;
+        definedstructureinfo.finalizeEntities = this.finalizeEntities;
+        return definedstructureinfo;
     }
 
     public StructurePlaceSettings setMirror(Mirror mirror) {
@@ -110,11 +120,7 @@
     }
 
     public RandomSource getRandom(@Nullable BlockPos pos) {
-        if (this.random != null) {
-            return this.random;
-        } else {
-            return pos == null ? RandomSource.create(Util.getMillis()) : RandomSource.create(Mth.getSeed(pos));
-        }
+        return this.random != null ? this.random : (pos == null ? RandomSource.create(Util.getMillis()) : RandomSource.create(Mth.getSeed(pos)));
     }
 
     public boolean isIgnoreEntities() {
@@ -140,10 +146,18 @@
 
     public StructureTemplate.Palette getRandomPalette(List<StructureTemplate.Palette> infoLists, @Nullable BlockPos pos) {
         int i = infoLists.size();
+
         if (i == 0) {
             throw new IllegalStateException("No palettes");
+        // CraftBukkit start
+        } else if (this.palette >= 0) {
+            if (this.palette >= i) {
+                throw new IllegalArgumentException("Palette index out of bounds. Got " + this.palette + " where there are only " + i + " palettes available.");
+            }
+            return infoLists.get(this.palette);
+        // CraftBukkit end
         } else {
-            return infoLists.get(this.getRandom(pos).nextInt(i));
+            return (StructureTemplate.Palette) infoLists.get(this.getRandom(pos).nextInt(i));
         }
     }
 
