Reimplemented cable and parts rendering.
This commit is contained in:
@@ -31,6 +31,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -58,6 +59,7 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.PartBasicState;
|
||||
import appeng.server.ServerHelper;
|
||||
@@ -69,6 +71,14 @@ import appeng.util.item.AEItemStack;
|
||||
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable, IWorldCallable<TickRateModulation>
|
||||
{
|
||||
|
||||
private static final PlaneModels MODELS = new PlaneModels( "part/annihilation_plane_", "part/annihilation_plane_on_" );
|
||||
|
||||
@PartModels
|
||||
public static List<ResourceLocation> getModels()
|
||||
{
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private final BaseActionSource mySrc = new MachineSource( this );
|
||||
private boolean isAccepting = true;
|
||||
private boolean breaking = false;
|
||||
@@ -128,6 +138,78 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
bch.addBox( minX, minY, 15, maxX, maxY, bch.isBBCollision() ? 15 : 16 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An object describing which adjacent planes this plane connects to visually.
|
||||
*/
|
||||
public PlaneConnections getConnections()
|
||||
{
|
||||
|
||||
final EnumFacing facingRight, facingUp;
|
||||
AEPartLocation location = getSide();
|
||||
switch( location )
|
||||
{
|
||||
case UP:
|
||||
facingRight = EnumFacing.EAST;
|
||||
facingUp = EnumFacing.NORTH;
|
||||
break;
|
||||
case DOWN:
|
||||
facingRight = EnumFacing.WEST;
|
||||
facingUp = EnumFacing.NORTH;
|
||||
break;
|
||||
case NORTH:
|
||||
facingRight = EnumFacing.WEST;
|
||||
facingUp = EnumFacing.UP;
|
||||
break;
|
||||
case SOUTH:
|
||||
facingRight = EnumFacing.EAST;
|
||||
facingUp = EnumFacing.UP;
|
||||
break;
|
||||
case WEST:
|
||||
facingRight = EnumFacing.SOUTH;
|
||||
facingUp = EnumFacing.UP;
|
||||
break;
|
||||
case EAST:
|
||||
facingRight = EnumFacing.NORTH;
|
||||
facingUp = EnumFacing.UP;
|
||||
break;
|
||||
default:
|
||||
case INTERNAL:
|
||||
return PlaneConnections.of( false, false, false, false );
|
||||
}
|
||||
|
||||
boolean left = false, right = false, down = false, up = false;
|
||||
|
||||
final IPartHost host = this.getHost();
|
||||
if( host != null )
|
||||
{
|
||||
final TileEntity te = host.getTile();
|
||||
|
||||
final BlockPos pos = te.getPos();
|
||||
|
||||
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( facingRight.getOpposite() ) ), this.getSide() ) )
|
||||
{
|
||||
left = true;
|
||||
}
|
||||
|
||||
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( facingRight ) ), this.getSide() ) )
|
||||
{
|
||||
right = true;
|
||||
}
|
||||
|
||||
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( facingUp.getOpposite() ) ), this.getSide() ) )
|
||||
{
|
||||
down = true;
|
||||
}
|
||||
|
||||
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( facingUp ) ), this.getSide() ) )
|
||||
{
|
||||
up = true;
|
||||
}
|
||||
}
|
||||
|
||||
return PlaneConnections.of( up, right, down, left );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
@@ -235,6 +317,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
* Stores an {@link ItemStack} inside the network.
|
||||
*
|
||||
* @param item {@link ItemStack} to store
|
||||
*
|
||||
* @return the leftover items, which could not be stored inside the network
|
||||
*/
|
||||
private IAEItemStack storeItemStack( final ItemStack item )
|
||||
@@ -265,6 +348,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
*
|
||||
* @param entityItem the entity to update or destroy
|
||||
* @param overflow the leftover {@link IAEItemStack}
|
||||
*
|
||||
* @return true, if the entity was changed otherwise false.
|
||||
*/
|
||||
private boolean handleOverflow( final EntityItem entityItem, final IAEItemStack overflow )
|
||||
@@ -496,4 +580,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
this.spawnOverflow( overflow );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getStaticModels()
|
||||
{
|
||||
return MODELS.getModel( getConnections(), isPowered(), isActive() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user