use of net.glowstone.block.entity.BlockEntity in project Glowstone by GlowstoneMC.
the class InMemoryBlockStorage method createMockBlock.
private GlowBlock createMockBlock(Location location, Material type, byte data) {
GlowBlock mockBlock = Mockito.mock(GlowBlock.class);
when(mockBlock.getLocation()).thenReturn(location);
when(mockBlock.getType()).thenReturn(type);
when(mockBlock.getType().getId()).thenReturn(type.getId());
when(mockBlock.getData()).thenReturn(data);
BlockEntity entity = null;
BlockType blockType = ItemTable.instance().getBlock(type);
if (blockType != null) {
GlowChunk mockChunk = Mockito.mock(GlowChunk.class);
when(mockChunk.getBlock(anyInt(), anyInt(), anyInt())).thenReturn(mockBlock);
entity = blockType.createBlockEntity(mockChunk, 0, 0, 0);
}
when(mockBlock.getBlockEntity()).thenReturn(entity);
return mockBlock;
}
Aggregations