Skip to content

Commit

Permalink
When getters modify things they shouldn't.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlgorithmX2 committed Nov 5, 2016
1 parent e4f5f9e commit 027e60d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/mod/chiselsandbits/helpers/ModUtil.java
Expand Up @@ -317,7 +317,22 @@ public static TileEntity getTileEntitySafely(
final BlockPos pos )
{
// not going to lie, this is really stupid.
return world instanceof ChunkCache ? ( (ChunkCache) world ).func_190300_a( pos, Chunk.EnumCreateEntityType.CHECK ) : world.getTileEntity( pos );
if ( world instanceof ChunkCache )
{
return ( (ChunkCache) world ).func_190300_a( pos, Chunk.EnumCreateEntityType.CHECK );
}

// also stupid...
else if ( world instanceof World )
{
return ( (World) world ).getChunkFromBlockCoords( pos ).getTileEntity( pos, Chunk.EnumCreateEntityType.CHECK );
}

// yep... stupid.
else
{
return world.getTileEntity( pos );
}
}

public static TileEntityBlockChiseled getChiseledTileEntity(
Expand Down

1 comment on commit 027e60d

@Dushess
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, stupid things can be useful.

Please sign in to comment.