Fixed cable connections rendering, other fixes
- Fixed cable connections rendering to parts and other tiles. - Fixed facade & anchors rendering. - Many other parts related bug fixes.
This commit is contained in:
parent
d109878821
commit
3b7d1685c5
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import appeng.api.util.AECableType;
|
||||
|
||||
|
||||
public interface ICustomCableConnection
|
||||
{
|
||||
|
||||
/**
|
||||
* @return This controls the cable connection to the node. -1 to render connection yourself.
|
||||
*/
|
||||
public float getCableConnectionLength( AECableType cable );
|
||||
|
||||
}
|
|
@ -48,10 +48,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import appeng.api.client.BakingPipeline;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
|
||||
public interface IPart extends IBoxProvider
|
||||
public interface IPart extends IBoxProvider, ICustomCableConnection
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -225,7 +226,7 @@ public interface IPart extends IBoxProvider
|
|||
* @return 0 - 8, reasonable default 3-4, this controls the cable connection to the node. -1 to render connection
|
||||
* yourself.
|
||||
*/
|
||||
int getCableConnectionLength();
|
||||
public float getCableConnectionLength( AECableType cable );
|
||||
|
||||
/**
|
||||
* same as Block.randomDisplayTick, for but parts.
|
||||
|
|
|
@ -39,11 +39,11 @@ import appeng.api.util.DimensionalCoord;
|
|||
|
||||
|
||||
/**
|
||||
* Implemented on AE's TileEntity or AE's FMP Part.
|
||||
* Implemented on AE's TileEntity.
|
||||
*
|
||||
* Do Not Implement
|
||||
*/
|
||||
public interface IPartHost
|
||||
public interface IPartHost extends ICustomCableConnection
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
|
@ -388,7 +388,7 @@ public class ClientHelper extends ServerHelper
|
|||
@SubscribeEvent
|
||||
public void wheelEvent( final MouseEvent me )
|
||||
{
|
||||
if( me.isCanceled() || me.getDwheel() == 0 )
|
||||
if( me.getDwheel() == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
package appeng.client.render.model;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
@ -22,21 +17,18 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
|||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.FacingToRotation;
|
||||
import appeng.api.client.BakingPipeline;
|
||||
import appeng.client.render.model.pipeline.DoubleFacingQuadRotator;
|
||||
import appeng.client.render.model.pipeline.ParentQuads;
|
||||
import appeng.client.render.model.pipeline.TypeTransformer;
|
||||
|
||||
|
||||
public class CachingRotatingBakedModel implements IBakedModel
|
||||
{
|
||||
|
||||
private static final BakingPipeline<Void, BakedQuad> pipeline = new BakingPipeline<>( new ParentQuads(), TypeTransformer.quads2vecs, new DoubleFacingQuadRotator(), TypeTransformer.vecs2quads );
|
||||
private final IBakedModel parent;
|
||||
private final LoadingCache<Pair<IBlockState, EnumFacing>, List<BakedQuad>> quadCache;
|
||||
|
||||
|
@ -49,24 +41,7 @@ public class CachingRotatingBakedModel implements IBakedModel
|
|||
@Override
|
||||
public List<BakedQuad> load( Pair<IBlockState, EnumFacing> key ) throws Exception
|
||||
{
|
||||
final EnumFacing forward = key.getLeft().getValue( AEBaseTileBlock.AE_BLOCK_FORWARD );
|
||||
final EnumFacing up = key.getLeft().getValue( AEBaseTileBlock.AE_BLOCK_UP );
|
||||
final FacingToRotation f2r = FacingToRotation.get( forward, up );
|
||||
|
||||
List<BakedQuad> original = CachingRotatingBakedModel.this.parent.getQuads( key.getLeft(), f2r.resultingRotate( key.getRight() ), 0 );
|
||||
List<BakedQuad> rotated = new ArrayList<>();
|
||||
for( BakedQuad quad : original )
|
||||
{
|
||||
VertexFormat format = quad.getFormat();
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( format );
|
||||
VertexRotator rot = new VertexRotator( f2r, quad.getFace() );
|
||||
rot.setParent( builder );
|
||||
quad.pipe( rot );
|
||||
builder.setQuadOrientation( f2r.rotate( quad.getFace() ) );
|
||||
BakedQuad q = builder.build();
|
||||
rotated.add( q );
|
||||
}
|
||||
return rotated;
|
||||
return pipeline.pipe( null, parent, key.getLeft(), key.getRight(), 0 );
|
||||
}
|
||||
|
||||
} );
|
||||
|
@ -118,125 +93,4 @@ public class CachingRotatingBakedModel implements IBakedModel
|
|||
return quadCache.getUnchecked( new ImmutablePair<IBlockState, EnumFacing>( state, side ) );
|
||||
}
|
||||
|
||||
public class VertexRotator extends QuadGatheringTransformer
|
||||
{
|
||||
private final FacingToRotation f2r;
|
||||
private final EnumFacing face;
|
||||
|
||||
public VertexRotator( FacingToRotation f2r, EnumFacing face )
|
||||
{
|
||||
this.f2r = f2r;
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent( IVertexConsumer parent )
|
||||
{
|
||||
super.setParent( parent );
|
||||
if( Objects.equal( getVertexFormat(), parent.getVertexFormat() ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
setVertexFormat( parent.getVertexFormat() );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processQuad()
|
||||
{
|
||||
VertexFormat format = parent.getVertexFormat();
|
||||
int count = format.getElementCount();
|
||||
|
||||
for( int v = 0; v < 4; v++ )
|
||||
{
|
||||
for( int e = 0; e < count; e++ )
|
||||
{
|
||||
VertexFormatElement element = format.getElement( e );
|
||||
if( element.getUsage() == VertexFormatElement.EnumUsage.POSITION )
|
||||
{
|
||||
parent.put( e, transform( quadData[e][v] ) );
|
||||
}
|
||||
else if( element.getUsage() == VertexFormatElement.EnumUsage.NORMAL )
|
||||
{
|
||||
parent.put( e, transformNormal( quadData[e][v] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.put( e, quadData[e][v] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float[] transform( float[] fs )
|
||||
{
|
||||
switch( fs.length )
|
||||
{
|
||||
case 3:
|
||||
Vector3f vec = new Vector3f( fs[0], fs[1], fs[2] );
|
||||
vec.x -= 0.5f;
|
||||
vec.y -= 0.5f;
|
||||
vec.z -= 0.5f;
|
||||
f2r.getMat().transform( vec );
|
||||
vec.x += 0.5f;
|
||||
vec.y += 0.5f;
|
||||
vec.z += 0.5f;
|
||||
return new float[] { vec.x, vec.y, vec.z };
|
||||
case 4:
|
||||
Vector4f vecc = new Vector4f( fs[0], fs[1], fs[2], fs[3] );
|
||||
vecc.x -= 0.5f;
|
||||
vecc.y -= 0.5f;
|
||||
vecc.z -= 0.5f;
|
||||
f2r.getMat().transform( vecc );
|
||||
vecc.x += 0.5f;
|
||||
vecc.y += 0.5f;
|
||||
vecc.z += 0.5f;
|
||||
return new float[] { vecc.x, vecc.y, vecc.z, vecc.w };
|
||||
|
||||
default:
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
private float[] transformNormal( float[] fs )
|
||||
{
|
||||
switch( fs.length )
|
||||
{
|
||||
case 3:
|
||||
Vec3i vec = f2r.rotate( face ).getDirectionVec();
|
||||
return new float[] { vec.getX(), vec.getY(), vec.getZ() };
|
||||
case 4:
|
||||
Vector4f veccc = new Vector4f( fs[0], fs[1], fs[2], fs[3] );
|
||||
Vec3i vecc = f2r.rotate( face ).getDirectionVec();
|
||||
return new float[] { vecc.getX(), vecc.getY(), vecc.getZ(), veccc.w };
|
||||
|
||||
default:
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
public void setQuadTint( int tint )
|
||||
{
|
||||
parent.setQuadTint( tint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuadOrientation( EnumFacing orientation )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplyDiffuseLighting( boolean diffuse )
|
||||
{
|
||||
parent.setApplyDiffuseLighting( diffuse );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture( TextureAtlasSprite texture )
|
||||
{
|
||||
parent.setTexture( texture );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package appeng.client.render.model.pipeline;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -24,7 +25,7 @@ public class TypeTransformer
|
|||
@Override
|
||||
public List<QuadVertexData> pipe( List<BakedQuad> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
|
||||
{
|
||||
return Lists.transform( elements, ( quad ) -> {
|
||||
return Lists.transform( elements != null ? elements : new ArrayList<>(), ( quad ) -> {
|
||||
if( quad instanceof UnpackedBakedQuad )
|
||||
{
|
||||
return new QuadVertexData( (UnpackedBakedQuad) quad );
|
||||
|
@ -53,9 +54,7 @@ public class TypeTransformer
|
|||
@Override
|
||||
public List<BakedQuad> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
|
||||
{
|
||||
return Lists.transform( elements, ( data ) -> {
|
||||
return data.toQuad();
|
||||
} );
|
||||
return Lists.transform( elements != null ? elements : new ArrayList<>(), data -> data.toQuad() );
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -369,7 +369,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||
private final EnumSet<LayerFlags> myLayerFlags = EnumSet.noneOf( LayerFlags.class );
|
||||
private YesNo hasRedstone = YesNo.UNDECIDED;
|
||||
private IPartHost tcb;
|
||||
//TODO 1.10.2-R - does somebody seriously want to make parts TESR??? Hope not.
|
||||
// TODO 1.10.2-R - does somebody seriously want to make parts TESR??? Hope not.
|
||||
private boolean requiresDynamicRender = false;
|
||||
private boolean inWorld = false;
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public AEPartLocation addPart( ItemStack is, final AEPartLocation side, final @Nullable EntityPlayer player, final @Nullable EnumHand hand )
|
||||
public AEPartLocation addPart( ItemStack is, final AEPartLocation side, final @Nullable EntityPlayer player, final @Nullable EnumHand hand )
|
||||
{
|
||||
if( this.canAddPart( is, side ) )
|
||||
{
|
||||
|
@ -710,6 +710,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||
return AECableType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return getPart( AEPartLocation.INTERNAL ) instanceof IPartCable ? getPart( AEPartLocation.INTERNAL ).getCableConnectionLength( cable ) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void securityBreak()
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ import appeng.api.parts.IPart;
|
|||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||
|
@ -208,7 +209,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ import appeng.api.parts.IPartCollisionHelper;
|
|||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
@ -184,7 +185,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ import appeng.api.storage.IMEInventoryHandler;
|
|||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.AEConfig;
|
||||
|
@ -274,7 +275,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import appeng.api.parts.IPartCollisionHelper;
|
|||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.Reflected;
|
||||
|
@ -95,7 +96,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package appeng.parts.misc;
|
|||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -35,6 +36,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -48,7 +50,10 @@ import appeng.api.parts.IPart;
|
|||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.render.model.ModelsCache;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
public class PartCableAnchor implements IPart
|
||||
|
@ -210,7 +215,7 @@ public class PartCableAnchor implements IPart
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -237,7 +242,7 @@ public class PartCableAnchor implements IPart
|
|||
@SideOnly( Side.CLIENT )
|
||||
public List<BakedQuad> getOrBakeQuads( BakingPipeline<BakedQuad, BakedQuad> rotatingPipeline, IBlockState state, EnumFacing side, long rand )
|
||||
{
|
||||
return null;
|
||||
return rotatingPipeline.pipe( ModelsCache.INSTANCE.getOrLoadBakedModel( new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor" ) ).getQuads( state, side, rand ), null, state, mySide.getFacing(), rand );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import appeng.api.storage.IMEMonitor;
|
|||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.DualityInterface;
|
||||
|
@ -138,7 +139,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
|||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.settings.TickRates;
|
||||
|
@ -265,7 +266,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ public class PartToggleBus extends PartBasicState
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -51,6 +52,7 @@ import appeng.api.networking.IGridConnection;
|
|||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.ICustomCableConnection;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
@ -104,6 +106,23 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
return AECableType.GLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
if( cable == this.getCableConnectionType() )
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
else if( cable.ordinal() >= this.getCableConnectionType().ordinal() )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changeColor( final AEColor newColor, final EntityPlayer who )
|
||||
{
|
||||
|
@ -199,7 +218,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
final IPart p = ph.getPart( dir );
|
||||
if( p instanceof IGridHost )
|
||||
{
|
||||
final double dist = p.getCableConnectionLength();
|
||||
final double dist = p.getCableConnectionLength( this.getCableConnectionType() );
|
||||
|
||||
if( dist > 8 )
|
||||
{
|
||||
|
@ -396,16 +415,24 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
elements.addAll( ModelsCache.INSTANCE.getOrLoadModel( withProperties( getCableConnectionType().getModel(), propertiesForModel( null ) ), getCableConnectionType().getModel(), propertyTextureGetter( propertiesForModel( null ) ) ).getQuads( state, side, rand ) );
|
||||
for( EnumFacing facing : EnumFacing.values() )
|
||||
{
|
||||
if( isConnected( facing ) )
|
||||
if( isConnected( facing ) || getHost().getPart( facing ) != null )
|
||||
{
|
||||
elements.addAll( rotatingPipeline.pipe( ModelsCache.INSTANCE.getOrLoadModel( withProperties( getCableConnectionType().getConnectionModel(), propertiesForModel( facing ) ), getCableConnectionType().getConnectionModel(), propertyTextureGetter( propertiesForModel( facing ) ) ).getQuads( state, side, rand ), null, state, facing, rand ) );
|
||||
}
|
||||
else if( getHost().getPart( facing ) != null )
|
||||
{
|
||||
IPart part = getHost().getPart( facing );
|
||||
if( part.getCableConnectionLength() != -1 )
|
||||
float f = 4;
|
||||
if( getHost().getPart( facing ) != null )
|
||||
{
|
||||
elements.addAll( new BakingPipeline( TypeTransformer.quads2vecs, new MatVecApplicator( TRSRTransformation.toVecmath( new Matrix4f().scale( new Vector3f( 1, 1, part.getCableConnectionLength() / 4f ) ) ) ), new FacingQuadRotator( facing ), TypeTransformer.vecs2quads ).pipe( ModelsCache.INSTANCE.getOrLoadModel( withProperties( getCableConnectionType().getConnectionModel(), propertiesForModel( facing ) ), getCableConnectionType().getConnectionModel(), propertyTextureGetter( propertiesForModel( facing ) ) ).getQuads( state, side, rand ), null, state, facing, rand ) );
|
||||
f = getHost().getPart( facing ).getCableConnectionLength( this.getCableConnectionType() );
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity to = getHost().getTile().getWorld().getTileEntity( getHost().getTile().getPos().offset( facing ) );
|
||||
if( to instanceof ICustomCableConnection )
|
||||
{
|
||||
f = ( (ICustomCableConnection) to ).getCableConnectionLength( this.getCableConnectionType() );
|
||||
}
|
||||
}
|
||||
if( f != -1 )
|
||||
{
|
||||
elements.addAll( new BakingPipeline( TypeTransformer.quads2vecs, new MatVecApplicator( TRSRTransformation.toVecmath( new Matrix4f().scale( new Vector3f( 1, 1, f / 4f ) ) ) ), new FacingQuadRotator( facing ), TypeTransformer.vecs2quads ).pipe( ModelsCache.INSTANCE.getOrLoadModel( withProperties( getCableConnectionType().getConnectionModel(), propertiesForModel( facing ) ), getCableConnectionType().getConnectionModel(), propertyTextureGetter( propertiesForModel( facing ) ) ).getQuads( state, side, rand ), null, state, facing, rand ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,12 +449,18 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
}
|
||||
if( !b && sides.size() == 2 )
|
||||
{
|
||||
return ( sides.contains( AEPartLocation.EAST ) && sides.contains( AEPartLocation.WEST ) ) || ( sides.contains( AEPartLocation.NORTH ) && sides.contains( AEPartLocation.SOUTH ) ) || ( sides.contains( AEPartLocation.UP ) && sides.contains( AEPartLocation.DOWN ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
AEPartLocation[] sa = sides.toArray( new AEPartLocation[0] );
|
||||
if( sa[0] == sa[1].getOpposite() )
|
||||
{
|
||||
for( AEPartLocation side : sides )
|
||||
{
|
||||
TileEntity to = host.getTile().getWorld().getTileEntity( host.getTile().getPos().offset( side.getFacing() ) );
|
||||
b |= to instanceof IPartHost && ( (IPartHost) to ).getPart( AEPartLocation.INTERNAL ) instanceof IPartCable && ( (IPartCable) ( (IPartHost) to ).getPart( AEPartLocation.INTERNAL ) ).getCableConnectionType() == getCableConnectionType();
|
||||
}
|
||||
return !b;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getChannelsOnSide( final int i )
|
||||
|
|
|
@ -110,7 +110,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import appeng.api.parts.IPart;
|
|||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.me.GridAccessException;
|
||||
|
@ -149,7 +150,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getCableConnectionLength()
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -138,6 +138,12 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
|||
return this.getCableBus().getCableConnectionType( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCableConnectionLength( AECableType cable )
|
||||
{
|
||||
return this.getCableBus().getCableConnectionLength( cable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
|
@ -262,7 +268,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
|||
@Override
|
||||
public boolean isBlocked( final EnumFacing side )
|
||||
{
|
||||
//TODO 1.10.2-R - Stuff.
|
||||
// TODO 1.10.2-R - Stuff.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{
|
||||
"name": "Element",
|
||||
"from": [ 6.0, 6.0, 0.0 ],
|
||||
"to": [ 10.0, 10.0, 5.0 ],
|
||||
"to": [ 10.0, 10.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
|
||||
"east": { "texture": "#base", "uv": [ 11.0, 6.0, 16.0, 10.0 ] },
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{
|
||||
"name": "Base",
|
||||
"from": [ 4.0, 4.0, 0.0 ],
|
||||
"to": [ 12.0, 12.0, 3.0 ],
|
||||
"to": [ 12.0, 12.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#base", "uv": [ 5.5, 5.5, 10.5, 10.5 ] },
|
||||
"east": { "texture": "#base", "uv": [ 11.0, 5.5, 16.0, 10.5 ] },
|
||||
|
@ -20,7 +20,7 @@
|
|||
{
|
||||
"name": "Channels",
|
||||
"from": [ 4.0, 4.0, 0.0 ],
|
||||
"to": [ 12.0, 12.0, 3.0 ],
|
||||
"to": [ 12.0, 12.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#channels", "uv": [ 5.5, 5.5, 10.5, 10.5 ] },
|
||||
"east": { "texture": "#channels", "uv": [ 11.0, 5.5, 16.0, 10.5 ] },
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{
|
||||
"name": "Element",
|
||||
"from": [ 6.0, 6.0, 0.0 ],
|
||||
"to": [ 10.0, 10.0, 6.0 ],
|
||||
"to": [ 10.0, 10.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
|
||||
"east": { "texture": "#base", "uv": [ 10.0, 6.0, 16.0, 10.0 ] },
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{
|
||||
"name": "Element",
|
||||
"from": [ 6.0, 6.0, 0.0 ],
|
||||
"to": [ 10.0, 10.0, 5.0 ],
|
||||
"to": [ 10.0, 10.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
|
||||
"east": { "texture": "#base", "uv": [ 11.0, 6.0, 16.0, 10.0 ] },
|
||||
|
@ -20,7 +20,7 @@
|
|||
{
|
||||
"name": "Channels",
|
||||
"from": [ 6.0, 6.0, 0.0 ],
|
||||
"to": [ 10.0, 10.0, 5.0 ],
|
||||
"to": [ 10.0, 10.0, 8.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#channels", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
|
||||
"east": { "texture": "#channels", "uv": [ 11.0, 6.0, 16.0, 10.0 ] },
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"textures": {
|
||||
"0": "appliedenergistics2:parts/CableAnchor"
|
||||
"0": "appliedenergistics2:parts/cable_anchor"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Element",
|
||||
"from": [ 7.0, 7.0, 0.0 ],
|
||||
"to": [ 9.0, 9.0, 6.0 ],
|
||||
"to": [ 9.0, 9.0, 6 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
|
||||
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 2.0 ] },
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
{
|
||||
"parent": "appliedenergistics2:parts/cableanchor"
|
||||
"textures": {
|
||||
"0": "appliedenergistics2:parts/cable_anchor"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Element",
|
||||
"from": [ 7.0, 7.0, 1.0 ],
|
||||
"to": [ 9.0, 9.0, 6.0 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
|
||||
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 5.0, 2.0 ] },
|
||||
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
|
||||
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 5.0, 2.0 ] },
|
||||
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 5.0 ] },
|
||||
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 5.0 ] }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Loading…
Reference in New Issue