The Twilight Forest

The Twilight Forest

143M Downloads

Twilight Portal can be smaller than 4 blocks

Andromander opened this issue ยท 1 comments

commented

Forge version: 14.23.3.2673
Twilight Forest version: 3.7.398

The portal can be built up to 64 blocks, but should be restricted to not be smaller than 4 blocks. This is not the case, and 1 block portals can be made.
2018-04-29_10 14 21

commented

See:

public boolean tryToCreatePortal(World world, BlockPos pos, EntityItem activationItem) {
IBlockState state = world.getBlockState(pos);
if (state == Blocks.WATER.getDefaultState() || (state.getBlock() == this && state.getValue(DISALLOW_RETURN))) {
HashMap<BlockPos, Boolean> blocksChecked = new HashMap<>();
blocksChecked.put(pos, true);
MutableInt number = new MutableInt(64);
if (recursivelyValidatePortal(world, pos, blocksChecked, number, state) && number.getInt() > 3) {
activationItem.getItem().shrink(1);
causeLightning(world, pos, TFConfig.portalLightning);
for (Map.Entry<BlockPos, Boolean> checkedPos : blocksChecked.entrySet())
if (checkedPos.getValue()) world.setBlockState(checkedPos.getKey(), TFBlocks.portal.getDefaultState(), 2);
return true;
}
}
return false;
}

The check is for number.getInt() > 3, but number is initialised to 64 and decremented, instead of being initialised to 0 and incremented.