--- a/net/minecraft/world/level/block/InfestedBlock.java
+++ b/net/minecraft/world/level/block/InfestedBlock.java
@@ -3,6 +3,7 @@
 import com.google.common.collect.Maps;
 import com.mojang.serialization.MapCodec;
 import com.mojang.serialization.codecs.RecordCodecBuilder;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.function.Supplier;
 import net.minecraft.core.BlockPos;
@@ -17,12 +18,13 @@
 import net.minecraft.world.level.block.state.BlockBehaviour;
 import net.minecraft.world.level.block.state.BlockState;
 import net.minecraft.world.level.block.state.properties.Property;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit
 
 public class InfestedBlock extends Block {
-    public static final MapCodec<InfestedBlock> CODEC = RecordCodecBuilder.mapCodec(
-        instance -> instance.group(BuiltInRegistries.BLOCK.byNameCodec().fieldOf("host").forGetter(InfestedBlock::getHostBlock), propertiesCodec())
-                .apply(instance, InfestedBlock::new)
-    );
+
+    public static final MapCodec<InfestedBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
+        return instance.group(BuiltInRegistries.BLOCK.byNameCodec().fieldOf("host").forGetter(InfestedBlock::getHostBlock), propertiesCodec()).apply(instance, InfestedBlock::new);
+    });
     private final Block hostBlock;
     private static final Map<Block, Block> BLOCK_BY_HOST_BLOCK = Maps.newIdentityHashMap();
     private static final Map<BlockState, BlockState> HOST_TO_INFESTED_STATES = Maps.newIdentityHashMap();
@@ -30,13 +32,13 @@
 
     @Override
     public MapCodec<? extends InfestedBlock> codec() {
-        return CODEC;
+        return InfestedBlock.CODEC;
     }
 
     public InfestedBlock(Block regularBlock, BlockBehaviour.Properties settings) {
         super(settings.destroyTime(regularBlock.defaultDestroyTime() / 2.0F).explosionResistance(0.75F));
         this.hostBlock = regularBlock;
-        BLOCK_BY_HOST_BLOCK.put(regularBlock, this);
+        InfestedBlock.BLOCK_BY_HOST_BLOCK.put(regularBlock, this);
     }
 
     public Block getHostBlock() {
@@ -44,16 +46,18 @@
     }
 
     public static boolean isCompatibleHostBlock(BlockState block) {
-        return BLOCK_BY_HOST_BLOCK.containsKey(block.getBlock());
+        return InfestedBlock.BLOCK_BY_HOST_BLOCK.containsKey(block.getBlock());
     }
 
     private void spawnInfestation(ServerLevel world, BlockPos pos) {
-        Silverfish silverfish = EntityType.SILVERFISH.create(world);
-        if (silverfish != null) {
-            silverfish.moveTo((double)pos.getX() + 0.5, (double)pos.getY(), (double)pos.getZ() + 0.5, 0.0F, 0.0F);
-            world.addFreshEntity(silverfish);
-            silverfish.spawnAnim();
+        Silverfish entitysilverfish = (Silverfish) EntityType.SILVERFISH.create(world);
+
+        if (entitysilverfish != null) {
+            entitysilverfish.moveTo((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D, 0.0F, 0.0F);
+            world.addFreshEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
+            entitysilverfish.spawnAnim();
         }
+
     }
 
     @Override
@@ -62,25 +66,32 @@
         if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !EnchantmentHelper.hasTag(tool, EnchantmentTags.PREVENTS_INFESTED_SPAWNS)) {
             this.spawnInfestation(world, pos);
         }
+
     }
 
     public static BlockState infestedStateByHost(BlockState regularState) {
-        return getNewStateWithProperties(HOST_TO_INFESTED_STATES, regularState, () -> BLOCK_BY_HOST_BLOCK.get(regularState.getBlock()).defaultBlockState());
+        return InfestedBlock.getNewStateWithProperties(InfestedBlock.HOST_TO_INFESTED_STATES, regularState, () -> {
+            return ((Block) InfestedBlock.BLOCK_BY_HOST_BLOCK.get(regularState.getBlock())).defaultBlockState();
+        });
     }
 
     public BlockState hostStateByInfested(BlockState infestedState) {
-        return getNewStateWithProperties(INFESTED_TO_HOST_STATES, infestedState, () -> this.getHostBlock().defaultBlockState());
+        return InfestedBlock.getNewStateWithProperties(InfestedBlock.INFESTED_TO_HOST_STATES, infestedState, () -> {
+            return this.getHostBlock().defaultBlockState();
+        });
     }
 
     private static BlockState getNewStateWithProperties(Map<BlockState, BlockState> stateMap, BlockState fromState, Supplier<BlockState> toStateSupplier) {
-        return stateMap.computeIfAbsent(fromState, infestedState -> {
-            BlockState blockState = toStateSupplier.get();
+        return (BlockState) stateMap.computeIfAbsent(fromState, (iblockdata1) -> {
+            BlockState iblockdata2 = (BlockState) toStateSupplier.get();
 
-            for (Property property : infestedState.getProperties()) {
-                blockState = blockState.hasProperty(property) ? blockState.setValue(property, infestedState.getValue(property)) : blockState;
+            Property iblockstate;
+
+            for (Iterator iterator = iblockdata1.getProperties().iterator(); iterator.hasNext(); iblockdata2 = iblockdata2.hasProperty(iblockstate) ? (BlockState) iblockdata2.setValue(iblockstate, iblockdata1.getValue(iblockstate)) : iblockdata2) {
+                iblockstate = (Property) iterator.next();
             }
 
-            return blockState;
+            return iblockdata2;
         });
     }
 }
