Round distance to target block up instead of down

This makes for less confusing error messages if the block is just barely out of range.
This commit is contained in:
TomyLobo 2017-05-04 09:04:07 +02:00
parent dd6d250e2f
commit 767d6bf5a2

View file

@ -133,7 +133,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
IPhantomTile phantom = (IPhantomTile)tile;
minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
if(phantom.hasBoundPosition()){
int distance = (int)new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition()));
int distance = (int)Math.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())));
IBlockState state = minecraft.theWorld.getBlockState(phantom.getBoundPosition());
Block block = state.getBlock();
Item item = Item.getItemFromBlock(block);