Prevent IndexOutOfBoundsException when clicking an already-remembered stone circle, fixes second crash in #217

This commit is contained in:
Electroblob77
2019-09-02 16:03:40 +01:00
parent ebe64b06e3
commit 960d97de49
@@ -73,7 +73,7 @@ public class BlockTransportationStone extends Block {
public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side){
return side == EnumFacing.DOWN;
@@ -147,7 +147,7 @@ public class BlockTransportationStone extends Block {
if(locations.isEmpty()) locations.add(here);
else{
locations.remove(here); // Prevents duplicates
locations.set(locations.size() - 1, here);
locations.set(Math.max(locations.size() - 1, 0), here);
}
if(!world.isRemote) player.sendStatusMessage(new TextComponentTranslation("tile." + Wizardry.MODID + ":transportation_stone.confirm", Spells.transportation.getNameForTranslationFormatted()), true);
}