Fix upstreams block state factories
Sometimes, blocks are changed and then logic is called before the associated tile entity is removed. When this happens, the factories were relying on the block at the position, not the tile entity. This change prioritizes using the tile entity type to determine the block state factory and falls back on the material type of the block at that location. == AT == public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
This commit is contained in:
@@ -7,6 +7,7 @@ import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.support.environment.AllFeatures;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -42,4 +43,13 @@ public class BlockStateTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Test
|
||||
public void testBlockEntityTypes() {
|
||||
for (var blockEntityType : BuiltInRegistries.BLOCK_ENTITY_TYPE) {
|
||||
org.junit.jupiter.api.Assertions.assertNotNull(CraftBlockStates.getBlockStateType(blockEntityType));
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user