Allow Visual/Non Visual Boxes to differ for Custom Collsion / Buses.
This commit is contained in:
parent
dd37b28190
commit
8460cffd6c
|
@ -423,7 +423,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
|||
|
||||
if ( collisionHandler != null )
|
||||
{
|
||||
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z );
|
||||
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z, null, true );
|
||||
MovingObjectPosition br = null;
|
||||
|
||||
double lastDist = 0;
|
||||
|
@ -484,7 +484,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
|||
{
|
||||
LookDirection ld = Platform.getPlayerRay( Minecraft.getMinecraft().thePlayer );
|
||||
|
||||
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z );
|
||||
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z, Minecraft.getMinecraft().thePlayer, true );
|
||||
AxisAlignedBB br = null;
|
||||
|
||||
double lastDist = 0;
|
||||
|
@ -519,7 +519,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
|||
}
|
||||
}
|
||||
|
||||
for (AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z ))
|
||||
for (AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z, null, false ))
|
||||
{
|
||||
if ( b == null )
|
||||
b = bx;
|
||||
|
|
|
@ -99,7 +99,7 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
|
||||
{
|
||||
TileCharger tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
|
|
|
@ -85,7 +85,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
|
||||
{
|
||||
ForgeDirection up = getOrientable( w, x, y, z ).getUp();
|
||||
double xOff = -0.3 * up.offsetX;
|
||||
|
@ -97,10 +97,11 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
|
|||
@Override
|
||||
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{/*
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
|
||||
* getUp().offsetZ; out.add( AxisAlignedBB.getAABBPool().getAABB( xOff + (double) x + 0.15, yOff + (double) y +
|
||||
* 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z +
|
||||
* 0.85 ) );
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
|
||||
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
|
||||
* AxisAlignedBB.getAABBPool().getAABB( xOff + (double) x + 0.15, yOff +
|
||||
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x +
|
||||
* 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
|
||||
{
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) } );
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
|
||||
{
|
||||
TileWireless tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Locale;
|
|||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.core.Configuration;
|
||||
|
@ -53,8 +52,6 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
|||
currenttip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
currenttip.add( StatCollector.translateToLocal( "AppEng.Gui.Whitelisted" ) );
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,12 @@ public class BusRenderHelper implements IPartRenderHelper
|
|||
return az;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBBCollision()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
BoundBoxCalculator bbc = new BoundBoxCalculator();
|
||||
|
@ -157,9 +163,8 @@ public class BusRenderHelper implements IPartRenderHelper
|
|||
list[4] = West;
|
||||
list[5] = East;
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( list[mapRotation( ForgeDirection.UP ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.DOWN ).ordinal()], list[mapRotation( ForgeDirection.SOUTH ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.NORTH ).ordinal()], list[mapRotation( ForgeDirection.EAST ).ordinal()],
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( list[mapRotation( ForgeDirection.UP ).ordinal()], list[mapRotation( ForgeDirection.DOWN ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.SOUTH ).ordinal()], list[mapRotation( ForgeDirection.NORTH ).ordinal()], list[mapRotation( ForgeDirection.EAST ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.WEST ).ordinal()] );
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.world.World;
|
|||
public interface ICustomCollision
|
||||
{
|
||||
|
||||
Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z);
|
||||
Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity thePlayer, boolean b);
|
||||
|
||||
void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package appeng.parts;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.parts.IPartCollsionHelper;
|
||||
|
@ -15,15 +16,22 @@ public class BusCollisionHelper implements IPartCollsionHelper
|
|||
final private ForgeDirection y;
|
||||
final private ForgeDirection z;
|
||||
|
||||
public BusCollisionHelper(List<AxisAlignedBB> boxes, ForgeDirection x, ForgeDirection y, ForgeDirection z) {
|
||||
final private Entity entity;
|
||||
final private boolean isVisual;
|
||||
|
||||
public BusCollisionHelper(List<AxisAlignedBB> boxes, ForgeDirection x, ForgeDirection y, ForgeDirection z, Entity e, boolean visual) {
|
||||
this.boxes = boxes;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
entity = e;
|
||||
isVisual = visual;
|
||||
}
|
||||
|
||||
public BusCollisionHelper(List<AxisAlignedBB> boxes, ForgeDirection s) {
|
||||
public BusCollisionHelper(List<AxisAlignedBB> boxes, ForgeDirection s, Entity e, boolean visual) {
|
||||
this.boxes = boxes;
|
||||
entity = e;
|
||||
isVisual = visual;
|
||||
|
||||
switch (s)
|
||||
{
|
||||
|
@ -66,6 +74,12 @@ public class BusCollisionHelper implements IPartCollsionHelper
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBBCollision()
|
||||
{
|
||||
return !isVisual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
|
||||
{
|
||||
|
|
|
@ -366,13 +366,13 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
return null;
|
||||
}
|
||||
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(boolean ignoreCableConnections)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(boolean ignoreCableConnections, Entity e, boolean visual)
|
||||
{
|
||||
List<AxisAlignedBB> boxes = new LinkedList<AxisAlignedBB>();
|
||||
|
||||
for (ForgeDirection s : ForgeDirection.values())
|
||||
{
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, s );
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, s, e, visual );
|
||||
|
||||
IPart part = getPart( s );
|
||||
if ( part != null )
|
||||
|
@ -543,8 +543,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
if ( part != null )
|
||||
{
|
||||
setSide( s );
|
||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, BusRenderHelper.instance.ax, BusRenderHelper.instance.ay,
|
||||
BusRenderHelper.instance.az );
|
||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, BusRenderHelper.instance.ax, BusRenderHelper.instance.ay, BusRenderHelper.instance.az, null, true );
|
||||
part.getBoxes( bch );
|
||||
}
|
||||
}
|
||||
|
@ -937,7 +936,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
{
|
||||
List<AxisAlignedBB> boxes = new LinkedList<AxisAlignedBB>();
|
||||
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side );
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true );
|
||||
p.getBoxes( bch );
|
||||
for (AxisAlignedBB bb : boxes)
|
||||
{
|
||||
|
@ -957,7 +956,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
{
|
||||
List<AxisAlignedBB> boxes = new LinkedList<AxisAlignedBB>();
|
||||
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side );
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true );
|
||||
p.getBoxes( bch );
|
||||
for (AxisAlignedBB bb : boxes)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,11 @@ public class PartDenseCable extends PartCable
|
|||
@Override
|
||||
public void getBoxes(IPartCollsionHelper bch)
|
||||
{
|
||||
bch.addBox( 3.0, 3.0, 3.0, 13.0, 13.0, 13.0 );
|
||||
boolean noLadder = !bch.isBBCollision();
|
||||
double min = noLadder ? 3.0 : 4.9;
|
||||
double max = noLadder ? 13.0 : 11.1;
|
||||
|
||||
bch.addBox( min, min, min, max, max, max );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
|
@ -113,22 +117,22 @@ public class PartDenseCable extends PartCable
|
|||
switch (of)
|
||||
{
|
||||
case DOWN:
|
||||
bch.addBox( 3.0, 0.0, 3.0, 13.0, 3.0, 13.0 );
|
||||
bch.addBox( min, 0.0, min, max, min, max );
|
||||
break;
|
||||
case EAST:
|
||||
bch.addBox( 13.0, 3.0, 3.0, 16.0, 13.0, 13.0 );
|
||||
bch.addBox( max, min, min, 16.0, max, max );
|
||||
break;
|
||||
case NORTH:
|
||||
bch.addBox( 3.0, 3.0, 0.0, 13.0, 13.0, 3.0 );
|
||||
bch.addBox( min, min, 0.0, max, max, min );
|
||||
break;
|
||||
case SOUTH:
|
||||
bch.addBox( 3.0, 3.0, 13.0, 13.0, 13.0, 16.0 );
|
||||
bch.addBox( min, min, max, max, max, 16.0 );
|
||||
break;
|
||||
case UP:
|
||||
bch.addBox( 3.0, 13.0, 3.0, 13.0, 16.0, 13.0 );
|
||||
bch.addBox( min, max, min, max, 16.0, max );
|
||||
break;
|
||||
case WEST:
|
||||
bch.addBox( 0.0, 3.0, 3.0, 3.0, 13.0, 13.0 );
|
||||
bch.addBox( 0.0, min, min, min, max, max );
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
|
|
|
@ -111,13 +111,12 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
|
||||
{
|
||||
double xOff = -0.15 * getUp().offsetX;
|
||||
double yOff = -0.15 * getUp().offsetY;
|
||||
double zOff = -0.15 * getUp().offsetZ;
|
||||
return Arrays
|
||||
.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) } );
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) } );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -174,15 +174,15 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean visual)
|
||||
{
|
||||
return cb.getSelectedBoundingBoxsFromPool( false );
|
||||
return cb.getSelectedBoundingBoxsFromPool( false, e, visual );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{
|
||||
for (AxisAlignedBB bx : getSelectedBoundingBoxsFromPool( w, x, y, z ))
|
||||
for (AxisAlignedBB bx : getSelectedBoundingBoxsFromPool( w, x, y, z, e, false ))
|
||||
out.add( AxisAlignedBB.getAABBPool().getAABB( bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue