--- a/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
+++ b/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
@@ -17,50 +17,59 @@
 import net.minecraft.world.level.block.state.BlockState;
 
 public class WorkAtComposter extends WorkAtPoi {
+
     private static final List<Item> COMPOSTABLE_ITEMS = ImmutableList.of(Items.WHEAT_SEEDS, Items.BEETROOT_SEEDS);
 
+    public WorkAtComposter() {}
+
     @Override
     protected void useWorkstation(ServerLevel world, Villager entity) {
         Optional<GlobalPos> optional = entity.getBrain().getMemory(MemoryModuleType.JOB_SITE);
+
         if (optional.isPresent()) {
-            GlobalPos globalPos = optional.get();
-            BlockState blockState = world.getBlockState(globalPos.pos());
-            if (blockState.is(Blocks.COMPOSTER)) {
+            GlobalPos globalpos = (GlobalPos) optional.get();
+            BlockState iblockdata = world.getBlockState(globalpos.pos());
+
+            if (iblockdata.is(Blocks.COMPOSTER)) {
                 this.makeBread(entity);
-                this.compostItems(world, entity, globalPos, blockState);
+                this.compostItems(world, entity, globalpos, iblockdata);
             }
 
         }
     }
 
     private void compostItems(ServerLevel world, Villager entity, GlobalPos pos, BlockState composterState) {
-        BlockPos blockPos = pos.pos();
-        if (composterState.getValue(ComposterBlock.LEVEL) == 8) {
-            composterState = ComposterBlock.extractProduce(composterState, world, blockPos);
+        BlockPos blockposition = pos.pos();
+
+        if ((Integer) composterState.getValue(ComposterBlock.LEVEL) == 8) {
+            composterState = ComposterBlock.extractProduce(composterState, world, blockposition, entity); // CraftBukkit
         }
 
         int i = 20;
-        int j = 10;
-        int[] is = new int[COMPOSTABLE_ITEMS.size()];
-        SimpleContainer simpleContainer = entity.getInventory();
-        int k = simpleContainer.getContainerSize();
-        BlockState blockState = composterState;
+        boolean flag = true;
+        int[] aint = new int[WorkAtComposter.COMPOSTABLE_ITEMS.size()];
+        SimpleContainer inventorysubcontainer = entity.getInventory();
+        int j = inventorysubcontainer.getContainerSize();
+        BlockState iblockdata1 = composterState;
 
-        for(int l = k - 1; l >= 0 && i > 0; --l) {
-            ItemStack itemStack = simpleContainer.getItem(l);
-            int m = COMPOSTABLE_ITEMS.indexOf(itemStack.getItem());
-            if (m != -1) {
-                int n = itemStack.getCount();
-                int o = is[m] + n;
-                is[m] = o;
-                int p = Math.min(Math.min(o - 10, i), n);
-                if (p > 0) {
-                    i -= p;
+        for (int k = j - 1; k >= 0 && i > 0; --k) {
+            ItemStack itemstack = inventorysubcontainer.getItem(k);
+            int l = WorkAtComposter.COMPOSTABLE_ITEMS.indexOf(itemstack.getItem());
 
-                    for(int q = 0; q < p; ++q) {
-                        blockState = ComposterBlock.insertItem(blockState, world, itemStack, blockPos);
-                        if (blockState.getValue(ComposterBlock.LEVEL) == 7) {
-                            this.spawnComposterFillEffects(world, composterState, blockPos, blockState);
+            if (l != -1) {
+                int i1 = itemstack.getCount();
+                int j1 = aint[l] + i1;
+
+                aint[l] = j1;
+                int k1 = Math.min(Math.min(j1 - 10, i), i1);
+
+                if (k1 > 0) {
+                    i -= k1;
+
+                    for (int l1 = 0; l1 < k1; ++l1) {
+                        iblockdata1 = ComposterBlock.insertItem(iblockdata1, world, itemstack, blockposition, entity); // CraftBukkit
+                        if ((Integer) iblockdata1.getValue(ComposterBlock.LEVEL) == 7) {
+                            this.spawnComposterFillEffects(world, composterState, blockposition, iblockdata1);
                             return;
                         }
                     }
@@ -68,7 +77,7 @@
             }
         }
 
-        this.spawnComposterFillEffects(world, composterState, blockPos, blockState);
+        this.spawnComposterFillEffects(world, composterState, blockposition, iblockdata1);
     }
 
     private void spawnComposterFillEffects(ServerLevel world, BlockState oldState, BlockPos pos, BlockState newState) {
@@ -76,18 +85,24 @@
     }
 
     private void makeBread(Villager entity) {
-        SimpleContainer simpleContainer = entity.getInventory();
-        if (simpleContainer.countItem(Items.BREAD) <= 36) {
-            int i = simpleContainer.countItem(Items.WHEAT);
-            int j = 3;
-            int k = 3;
-            int l = Math.min(3, i / 3);
-            if (l != 0) {
-                int m = l * 3;
-                simpleContainer.removeItemType(Items.WHEAT, m);
-                ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
-                if (!itemStack.isEmpty()) {
-                    entity.spawnAtLocation(itemStack, 0.5F);
+        SimpleContainer inventorysubcontainer = entity.getInventory();
+
+        if (inventorysubcontainer.countItem(Items.BREAD) <= 36) {
+            int i = inventorysubcontainer.countItem(Items.WHEAT);
+            boolean flag = true;
+            boolean flag1 = true;
+            int j = Math.min(3, i / 3);
+
+            if (j != 0) {
+                int k = j * 3;
+
+                inventorysubcontainer.removeItemType(Items.WHEAT, k);
+                ItemStack itemstack = inventorysubcontainer.addItem(new ItemStack(Items.BREAD, j));
+
+                if (!itemstack.isEmpty()) {
+                    entity.forceDrops = true; // Paper
+                    entity.spawnAtLocation(itemstack, 0.5F);
+                    entity.forceDrops = false; // Paper
                 }
 
             }
