Fixed QNB Derp.

Fixed QNB's Bounding Boxes.
This commit is contained in:
AlgorithmX2 2014-03-06 21:24:01 -06:00
parent 2e9d6641fe
commit aac12dd1fd
3 changed files with 63 additions and 3 deletions

View file

@ -1,11 +1,15 @@
package appeng.block.qnb;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.block.AEBaseBlock;
@ -15,12 +19,13 @@ import appeng.client.render.blocks.RenderQNB;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumLinkChamber extends AEBaseBlock
public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomCollision
{
public BlockQuantumLinkChamber() {
@ -78,4 +83,18 @@ public class BlockQuantumLinkChamber extends AEBaseBlock
return false;
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
double OnePx = 2.0 / 16.0;
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) } );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
{
double OnePx = 2.0 / 16.0;
out.add( AxisAlignedBB.getAABBPool().getAABB( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
}

View file

@ -1,17 +1,22 @@
package appeng.block.qnb;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderQNB;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge;
public class BlockQuantumRing extends AEBaseBlock
public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
{
public BlockQuantumRing() {
@ -38,4 +43,36 @@ public class BlockQuantumRing extends AEBaseBlock
return RenderQNB.class;
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
double OnePx = 2.0 / 16.0;
TileQuantumBridge bridge = getTileEntity( w, x, y, z );
if ( bridge != null && bridge.isCorner() )
{
OnePx = 4.0 / 16.0;
}
else if ( bridge != null && bridge.isFormed() )
{
OnePx = 1.0 / 16.0;
}
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) } );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
{
double OnePx = 2.0 / 16.0;
TileQuantumBridge bridge = getTileEntity( w, x, y, z );
if ( bridge != null && bridge.isCorner() )
{
OnePx = 4.0 / 16.0;
}
else if ( bridge != null && bridge.isFormed() )
{
OnePx = 1.0 / 16.0;
}
out.add( AxisAlignedBB.getAABBPool().getAABB( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
}

View file

@ -2,6 +2,7 @@ package appeng.me.cluster.implementations;
import java.util.Iterator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
@ -64,7 +65,10 @@ public class QuantumCluster implements ILocatable, IAECluster
{
Chunk c = qc.center.getWorldObj().getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord );
if ( c.isChunkLoaded )
return false;
{
TileEntity te = qc.center.getWorldObj().getTileEntity( qc.center.xCoord, qc.center.yCoord, qc.center.zCoord );
return te != qc.center;
}
}
}
return true;