Add optional feature to check entire bounding box for ladders. Closes #709
This commit is contained in:
parent
571e441502
commit
ffd4b38801
2 changed files with 36 additions and 4 deletions
|
@ -45,6 +45,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
|
|||
public static boolean removeErroringTileEntities = false;
|
||||
public static boolean disableStitchedFileSaving = false;
|
||||
public static boolean forceDuplicateFluidBlockCrash = true;
|
||||
public static boolean fullBoundingBoxLadders = false;
|
||||
|
||||
public ForgeDummyContainer()
|
||||
{
|
||||
|
@ -116,9 +117,13 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
|
|||
FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true);
|
||||
prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true";
|
||||
disableStitchedFileSaving = prop.getBoolean(true);
|
||||
//prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true);
|
||||
//prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true";
|
||||
//disableStitchedFileSaving = prop.getBoolean(true);
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false);
|
||||
prop.comment = "Set this to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticable differences in mechanics so default is vanilla behavior. Default: false";
|
||||
fullBoundingBoxLadders = prop.getBoolean(false);
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "forceDuplicateFluidBlockCrash", true);
|
||||
prop.comment = "Set this to force a crash if more than one block attempts to link back to the same Fluid. Enabled by default.";
|
||||
|
|
|
@ -18,9 +18,11 @@ import net.minecraft.item.ItemPickaxe;
|
|||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetServerHandler;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.WeightedRandomItem;
|
||||
|
@ -352,9 +354,34 @@ public class ForgeHooks
|
|||
}
|
||||
|
||||
public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLivingBase entity)
|
||||
{
|
||||
if (!ForgeDummyContainer.fullBoundingBoxLadders)
|
||||
{
|
||||
return block != null && block.isLadder(world, x, y, z, entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
AxisAlignedBB bb = entity.boundingBox;
|
||||
int mX = MathHelper.floor_double(bb.minX);
|
||||
int mY = MathHelper.floor_double(bb.minY);
|
||||
int mZ = MathHelper.floor_double(bb.minZ);
|
||||
for (int y2 = mY; y < bb.maxY; y2++)
|
||||
{
|
||||
for (int x2 = mX; x2 < bb.maxX; x2++)
|
||||
{
|
||||
for (int z2 = mZ; z2 < bb.maxZ; z2++)
|
||||
{
|
||||
block = Block.blocksList[world.getBlockId(x2, y2, z2)];
|
||||
if (block != null && block.isLadder(world, x2, y2, z2, entity))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void onLivingJump(EntityLivingBase entity)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue