diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicOverlayPebbles.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicOverlayPebbles.java
index 6305aa3ed..c9032d5f7 100644
--- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicOverlayPebbles.java
+++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicOverlayPebbles.java
@@ -17,6 +17,8 @@ import org.jetbrains.annotations.Nullable;
 import org.joml.primitives.AABBdc;
 
 public class BlockLogicOverlayPebbles extends BlockLogic {
+    public static final int MAX_PEBBLES = 3;
+    public static final int MASK_PEBBLE_AMOUNT = 0b0000_0011;
     public BlockLogicOverlayPebbles(@NotNull Block<?> block, @NotNull Material material) {
         super(block, material);
         setBlockBounds(0, 0, 0, 1, 0.0625F, 1);
@@ -36,7 +38,7 @@ public class BlockLogicOverlayPebbles extends BlockLogic {
     @Override
     public boolean canPlaceAt(@NotNull World world, @NotNull TilePosc tilePos) {
         Block<?> block = world.getBlockType(tilePos.down(new TilePos()));
-        return block != null && block.getMaterial().isSolid();
+        return block.getMaterial().isSolid();
     }
 
     @Override
@@ -79,4 +81,12 @@ public class BlockLogicOverlayPebbles extends BlockLogic {
         }
         return new ItemStack[]{new ItemStack(Items.AMMO_PEBBLE, data + 1)};
     }
+
+    public static int setCount(int data, int count) {
+        return (data & ~MASK_PEBBLE_AMOUNT) | (count & MASK_PEBBLE_AMOUNT);
+    }
+
+    public static int getStackCount(int data) {
+        return data & MASK_PEBBLE_AMOUNT;
+    }
 }
diff --git a/game/core/src/main/java/net/minecraft/core/block/Blocks.java b/game/core/src/main/java/net/minecraft/core/block/Blocks.java
index efeb20e1a..95ac8901b 100644
--- a/game/core/src/main/java/net/minecraft/core/block/Blocks.java
+++ b/game/core/src/main/java/net/minecraft/core/block/Blocks.java
@@ -1188,7 +1188,7 @@ public final class Blocks {
         .withSound(BlockSounds.GLASS).withHardness(0.1F).withDisabledNeighborNotifyOnMetadataChange().setStatParent(() -> Items.JAR)
         .withTags(BlockTags.BROKEN_BY_FLUIDS, BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU);
 
-    public static final @NotNull Block<?> OVERLAY_PEBBLES = register("overlay.pebbles", "minecraft:block/overlay_pebbles", 880, (b) -> new BlockLogicOverlayPebbles(b, Materials.DECORATION))
+    public static final @NotNull Block<BlockLogicOverlayPebbles> OVERLAY_PEBBLES = register("overlay.pebbles", "minecraft:block/overlay_pebbles", 880, (BlockLogicSupplier<BlockLogicOverlayPebbles>)b -> new BlockLogicOverlayPebbles(b, Materials.DECORATION))
         .withSound(BlockSounds.STONE).withHardness(0.0F).withDisabledNeighborNotifyOnMetadataChange().setStatParent(() -> Items.AMMO_PEBBLE)
         .withTags(BlockTags.BROKEN_BY_FLUIDS, BlockTags.NOT_IN_CREATIVE_MENU, BlockTags.OVERRIDE_FRICTION);
 
diff --git a/game/core/src/main/java/net/minecraft/core/block/entity/TileEntityFlag.java b/game/core/src/main/java/net/minecraft/core/block/entity/TileEntityFlag.java
index 05e21f11c..75eb6db52 100644
--- a/game/core/src/main/java/net/minecraft/core/block/entity/TileEntityFlag.java
+++ b/game/core/src/main/java/net/minecraft/core/block/entity/TileEntityFlag.java
@@ -188,6 +188,7 @@ public class TileEntityFlag extends TileEntity
 
     @Override
     public @Nullable ItemStack getItem(int slot) {
+        slot -= 36;
         if (slot < 0 || slot >= 3) return null;
         
         return items[slot];
@@ -195,6 +196,7 @@ public class TileEntityFlag extends TileEntity
 
     @Override
     public @Nullable ItemStack removeItem(int slot, int takeAmount) {
+        slot -= 36;
         if (items[slot] != null)
         {
             if (items[slot].stackSize <= takeAmount)
@@ -231,6 +233,7 @@ public class TileEntityFlag extends TileEntity
     @Override
     public void setItem(int slot, @Nullable ItemStack stack)
     {
+        slot -= 36; // This seems so wrong and will almost certainly cause an issue at some point
         items[slot] = stack;
         itemsChanges();
         setChanged();
diff --git a/game/core/src/main/java/net/minecraft/core/item/ItemPebble.java b/game/core/src/main/java/net/minecraft/core/item/ItemPebble.java
index 89bb4b95e..573cdc66f 100644
--- a/game/core/src/main/java/net/minecraft/core/item/ItemPebble.java
+++ b/game/core/src/main/java/net/minecraft/core/item/ItemPebble.java
@@ -1,6 +1,7 @@
 package net.minecraft.core.item;
 
 import net.minecraft.core.block.Block;
+import net.minecraft.core.block.BlockLogicOverlayPebbles;
 import net.minecraft.core.block.Blocks;
 import net.minecraft.core.block.entity.TileEntityActivator;
 import net.minecraft.core.block.tag.BlockTags;
@@ -59,7 +60,7 @@ public class ItemPebble extends Item implements IDispensable {
                 return false;
             }
 
-            if (newMeta < 3) {
+            if (newMeta < BlockLogicOverlayPebbles.MAX_PEBBLES) {
                 world.setBlockTypeDataNotify(blockPos, Blocks.OVERLAY_PEBBLES, newMeta);
                 world.playBlockSoundEffect(player, blockPos.x() + 0.5F, blockPos.y() + 0.5F, blockPos.z() + 0.5F, Blocks.OVERLAY_PEBBLES, EnumBlockSoundEffectType.PLACE);
                 selfStack.consumeItem(player);
@@ -83,7 +84,7 @@ public class ItemPebble extends Item implements IDispensable {
                 return false;
             }
 
-            if (newMeta < 3) {
+            if (newMeta < BlockLogicOverlayPebbles.MAX_PEBBLES) {
                 world.setBlockTypeDataNotify(blockPos, Blocks.OVERLAY_PEBBLES, newMeta);
                 world.playBlockSoundEffect(player, blockPos.x() + 0.5F, blockPos.y() + 0.5F, blockPos.z() + 0.5F, Blocks.OVERLAY_PEBBLES, EnumBlockSoundEffectType.PLACE);
                 selfStack.consumeItem(player);
diff --git a/game/core/src/main/java/net/minecraft/core/player/inventory/menu/MenuFlag.java b/game/core/src/main/java/net/minecraft/core/player/inventory/menu/MenuFlag.java
index 393fc9003..9826d846e 100644
--- a/game/core/src/main/java/net/minecraft/core/player/inventory/menu/MenuFlag.java
+++ b/game/core/src/main/java/net/minecraft/core/player/inventory/menu/MenuFlag.java
@@ -24,7 +24,7 @@ public class MenuFlag extends MenuAbstract {
 
 		// Dye slots
 		for (int i = 0; i < NUM_DYE_SLOTS; i++) {
-			addSlot(new SlotDye(flag, i, 129, 10 + 22 * i));
+			addSlot(new SlotDye(flag, ContainerInventory.MAIN_INVENTORY_SIZE + i, 129, 10 + 22 * i));
 		}
 
 		// Player inv slots
diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java
index 79128fb4b..a199b81af 100644
--- a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java
+++ b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java
@@ -596,7 +596,7 @@ public class ChunkDecoratorOverworld
             final int xx = x + rand.nextInt(16) + 8;
             final int yy = minY + rand.nextInt(rangeY);
             final int zz = z + rand.nextInt(16) + 8;
-            (new WorldFeaturePebbles(Blocks.OVERLAY_PEBBLES.id(), 16, true)).place(this.world, rand, xx, yy, zz);
+            new WorldFeaturePebbles(Blocks.OVERLAY_PEBBLES, 16, true).place(this.world, rand, xx, yy, zz);
         }
 
         int oceanY = this.world.getWorldType().getOceanY();
diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeaturePebbles.java b/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeaturePebbles.java
index 299061d6c..88ac639a0 100644
--- a/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeaturePebbles.java
+++ b/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeaturePebbles.java
@@ -1,47 +1,44 @@
 package net.minecraft.core.world.generate.feature;
 
 import net.minecraft.core.block.Block;
-import net.minecraft.core.block.BlockLogicFlowerStackable;
 import net.minecraft.core.block.BlockLogicOverlayPebbles;
 import net.minecraft.core.block.Blocks;
 import net.minecraft.core.world.World;
+import net.minecraft.core.world.pos.TilePos;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Random;
 
 public class WorldFeaturePebbles extends WorldFeature {
-    private final int blockId;
+    private final @NotNull Block<? extends BlockLogicOverlayPebbles> block;
     private final int count;
     private final boolean varyStackSize;
 
     @MethodParametersAnnotation(names = { "blockId", "count", "varyStackSize" })
-    public WorldFeaturePebbles(final int blockId, final int count, final boolean varyStackSize) {
-        this.blockId = blockId;
+    public WorldFeaturePebbles(final @NotNull Block<? extends BlockLogicOverlayPebbles> block, final int count, final boolean varyStackSize) {
+        this.block = block;
         this.count = count;
         this.varyStackSize = varyStackSize;
     }
 
     @Override
     public boolean place(final @NotNull World world, final @NotNull Random random, final int x, final int y, final int z) {
+        TilePos p = new TilePos();
+        TilePos queryPos = new TilePos();
         for (int i = 0; i < this.count; i++) {
-            final int xx = (x + random.nextInt(8)) - random.nextInt(8);
-            final int yy = (y + random.nextInt(4)) - random.nextInt(4);
-            final int zz = (z + random.nextInt(8)) - random.nextInt(8);
-            if (world.isAirBlock(xx, yy, zz) && BlockLogicOverlayPebbles.canSpawnOn(world.getBlock(xx, yy - 1, zz))) {
-                final int metadata;
-                if (Block.hasLogicClass(Blocks.getBlock(this.blockId), BlockLogicOverlayPebbles.class)) {
-                    final int stackSize;
-                    if (this.varyStackSize) {
-                        stackSize = getStackSize(random);
-                    } else {
-                        stackSize = 0;
-                    }
-
-                    metadata = BlockLogicFlowerStackable.setStackCount(0, stackSize);
+            p.set(
+                (x + random.nextInt(8)) - random.nextInt(8),
+                (y + random.nextInt(4)) - random.nextInt(4),
+                (z + random.nextInt(8)) - random.nextInt(8));
+            if (world.isAirBlock(p) && BlockLogicOverlayPebbles.canSpawnOn(world.getBlockType(p.down(queryPos)))) {
+                final int stackSize;
+                if (this.varyStackSize) {
+                    stackSize = getStackSize(random);
                 } else {
-                    metadata = 0;
+                    stackSize = 0;
                 }
-                world.setBlockAndMetadata(xx, yy, zz, this.blockId, metadata);
+
+                world.setBlockTypeData(p, this.block, BlockLogicOverlayPebbles.setCount(0, stackSize));
             }
         }
 
