Cables & parts and Baking pipeline

- Added cables & parts rendering.
- Facades got a completely new way of rendering. Anvil facades are
totally a thing.
- Added baking pipeline for simplified, highly configurable quad baking.

NOTE: Yes, there are a lot of improvements to do, bugs to fix, stuff to
add. I'm just pushing it prior to code structure change, so it does not
get lost in stashes. But it actually works!
This commit is contained in:
elix-x 2016-08-19 22:45:27 +02:00
parent 8b9743f2bf
commit d7f32a985d
186 changed files with 2102 additions and 295 deletions

View File

@ -0,0 +1,55 @@
/*
* 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.client;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
public class BakingPipeline<F, T> implements BakingPipelineElement<F, T>
{
private final ImmutableList<BakingPipelineElement<?, ?>> pipeline;
public BakingPipeline( BakingPipelineElement<?, ?>... pipeline )
{
this.pipeline = ImmutableList.copyOf( pipeline );
}
public List pipe( List things, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
for( BakingPipelineElement pipe : pipeline )
{
things = pipe.pipe( things, parent, state, side, rand );
}
return things;
}
}

View File

@ -0,0 +1,39 @@
/*
* 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.client;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
public interface BakingPipelineElement<F, T>
{
public List<T> pipe( List<F> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand );
}

View File

@ -86,4 +86,5 @@ public interface IPartCable extends IPart, IGridHost
* @return true if this side is currently connects to an external block.
*/
boolean isConnected( EnumFacing side );
}

View File

@ -24,11 +24,19 @@
package appeng.api.parts;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.client.BakingPipeline;
import appeng.api.util.AEPartLocation;
@ -72,4 +80,7 @@ public interface IFacadePart
void setThinFacades( boolean useThinFacades );
boolean isTransparent();
@SideOnly( Side.CLIENT )
public List<BakedQuad> getOrBakeQuads( IPartHost host, BakingPipeline<BakedQuad, BakedQuad> rotatingPipeline, IBlockState state, EnumFacing side, long rand );
}

View File

@ -30,17 +30,23 @@ import java.util.Random;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
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.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.client.BakingPipeline;
import appeng.api.networking.IGridNode;
import appeng.api.util.AEPartLocation;
@ -216,9 +222,10 @@ public interface IPart extends IBoxProvider
void getDrops( List<ItemStack> drops, boolean wrenched );
/**
* @return 0 - 8, reasonable default 3-4, this controls the cable connection to the node.
* @return 0 - 8, reasonable default 3-4, this controls the cable connection to the node. -1 to render connection
* yourself.
*/
int cableConnectionRenderTo();
int getCableConnectionLength();
/**
* same as Block.randomDisplayTick, for but parts.
@ -246,4 +253,8 @@ public interface IPart extends IBoxProvider
* @return true if the part can be placed on this support.
*/
boolean canBePlacedOn( BusSupport what );
@SideOnly( Side.CLIENT )
public List<BakedQuad> getOrBakeQuads( BakingPipeline<BakedQuad, BakedQuad> rotatingPipeline, IBlockState state, EnumFacing side, long rand );
}

View File

@ -26,6 +26,7 @@ package appeng.api.parts;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@ -72,7 +73,7 @@ public interface IPartHelper
*
* @return true if placing was successful
*/
boolean placeBus( ItemStack is, BlockPos pos, EnumFacing side, EntityPlayer player, EnumHand hand, World world );
EnumActionResult placeBus( ItemStack is, BlockPos pos, EnumFacing side, EntityPlayer player, EnumHand hand, World world );
/**
* @return the render mode

View File

@ -36,26 +36,20 @@ import net.minecraft.item.ItemStack;
*
* you must register your bus with the Bus renderer, using AEApi.INSTANCE().partHelper().setItemBusRenderer( this );
*
* then simply add these two methods, which tell MC to use the Block Textures, and call AE's Bus Placement Code.
* then simply add this, and call AE's Bus Placement Code.
*
* <pre>
* <code>
* {@literal @}Override
* {@literal @}SideOnly(Side.CLIENT)
* public int getSpriteNumber()
* {
* return 0;
* }
*
* {@literal @}Override
* public boolean onItemUse(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
* {
* return AEApi.INSTANCE().partHelper().placeBus( is, x, y, z, side, player, world );
* }
* public default EnumActionResult onItemUse(ItemStack is, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
* {
* return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world );
* }
* </code>
* </pre>
*/
public interface IPartItem
public interface IPartItem<P extends IPart>
{
/**
@ -66,5 +60,6 @@ public interface IPartItem
* @return part from item
*/
@Nullable
IPart createPartFromItemStack( ItemStack is );
P createPartFromItemStack( ItemStack is );
}

View File

@ -24,31 +24,71 @@
package appeng.api.util;
import net.minecraft.util.ResourceLocation;
public enum AECableType
{
/**
* No Cable present.
*/
NONE,
NONE( null, 0 ),
/**
* Connections to this block should render as glass.
*/
GLASS,
GLASS( "glass", 0 ),
/**
* Connections to this block should render as covered.
*/
COVERED,
COVERED( "covered", 0 ),
/**
* Connections to this block should render as smart.
*/
SMART,
SMART( "smart", 8 ),
/**
* Dense Cable, represents a tier 2 block that can carry 32 channels.
*/
DENSE,
DENSE( "dense", 32 );
public static final AECableType[] VALIDCABLES = { GLASS, COVERED, SMART, DENSE };
private final String type;
private final int displayedChannels;
private final ResourceLocation model;
private final ResourceLocation connectionModel;
private final ResourceLocation straightModel;
private AECableType( String type, int displayedChannels )
{
this.type = type;
this.displayedChannels = displayedChannels;
this.model = new ResourceLocation( "appliedenergistics2", "part/cable/" + type + "/center" );
this.connectionModel = new ResourceLocation( "appliedenergistics2", "part/cable/" + type + "/connection" );
this.straightModel = new ResourceLocation( "appliedenergistics2", "part/cable/" + type + "/straight" );
}
public int displayedChannels()
{
return displayedChannels;
}
public ResourceLocation getModel()
{
return model;
}
public ResourceLocation getConnectionModel()
{
return connectionModel;
}
public ResourceLocation getStraightModel()
{
return straightModel;
}
}

View File

@ -26,6 +26,8 @@ import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.creativetab.CreativeTabs;
@ -44,6 +46,9 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -55,11 +60,9 @@ import appeng.api.util.AEColor;
import appeng.block.AEBaseTileBlock;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.CommonHelper;
import appeng.core.features.AECableBusFeatureHandler;
import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.Reflected;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
@ -67,30 +70,14 @@ import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
// TODO: MFR INTEGRATION
//@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = IntegrationType.MFR )
public class BlockCableBus extends AEBaseTileBlock // implements
// IRedNetConnection
public class BlockCableBus extends AEBaseTileBlock
{
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
private static Class<? extends AEBaseTile> noTesrTile;
private static Class<? extends AEBaseTile> tesrTile;
/**
* Immibis MB Support.
*
* It will look for a field named
* ImmibisMicroblocks_TransformableBlockMarker or
* ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc
* can be ignored.
*/
@Reflected
private static final boolean ImmibisMicroblocks_TransformableBlockMarker = true;
public BlockCableBus()
{
@ -104,6 +91,26 @@ public class BlockCableBus extends AEBaseTileBlock // implements
this.setFeature( EnumSet.of( AEFeature.Core ) );
}
public static final CableBusContainerUnlistedProperty cableBus = new CableBusContainerUnlistedProperty();
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { cableBus } );
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
return state;
}
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
return ( (IExtendedBlockState) state ).withProperty( cableBus, ( (TileCableBus) world.getTileEntity( pos ) ).getCableBus() );
}
@Override
public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand )
{
@ -146,8 +153,8 @@ public class BlockCableBus extends AEBaseTileBlock // implements
public int getStrongPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO:
// IS
// OPPOSITE!?
// IS
// OPPOSITE!?
}
@Override
@ -236,7 +243,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements
return null;
}
@Override
@SideOnly( Side.CLIENT )
public boolean addHitEffects( final IBlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer )
@ -352,24 +359,6 @@ public class BlockCableBus extends AEBaseTileBlock // implements
// do nothing
}
@Override
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final BlockPos pos )
{
final TileEntity te = w.getTileEntity( pos );
if( noTesrTile.isInstance( te ) )
{
return (T) te;
}
if( tesrTile != null && tesrTile.isInstance( te ) )
{
return (T) te;
}
return null;
}
@Override
protected void setFeature( final EnumSet<AEFeature> f )
{
@ -382,17 +371,6 @@ public class BlockCableBus extends AEBaseTileBlock // implements
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() );
this.setTileEntity( noTesrTile );
GameRegistry.registerTileEntity( noTesrTile, "BlockCableBus" );
if( Platform.isClient() )
{
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this );
}
}
public static Class<? extends AEBaseTile> getTesrTile()
{
return tesrTile;
}
public static Class<? extends AEBaseTile> getNoTesrTile()
@ -400,19 +378,4 @@ public class BlockCableBus extends AEBaseTileBlock // implements
return noTesrTile;
}
// TODO MFR Integration
// @Override
// @Method( iname = IntegrationType.MFR )
// public RedNetConnectionType getConnectionType( World world, int x, int y,
// int z, ForgeDirection side )
// {
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf(
// ForgeDirection.class ) ) ?
// RedNetConnectionType.CableSingle : RedNetConnectionType.None;
// }
//
// public void setRenderColor( int color )
// {
// this.myColorMultiplier = color;
// }
}

View File

@ -0,0 +1,34 @@
package appeng.block.networking;
import net.minecraftforge.common.property.IUnlistedProperty;
import appeng.parts.CableBusContainer;
public class CableBusContainerUnlistedProperty implements IUnlistedProperty<CableBusContainer>
{
@Override
public String getName()
{
return "bus";
}
@Override
public boolean isValid( CableBusContainer value )
{
return true;
}
@Override
public Class<CableBusContainer> getType()
{
return CableBusContainer.class;
}
@Override
public String valueToString( CableBusContainer value )
{
return null;
}
}

View File

@ -24,15 +24,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.google.common.collect.ImmutableMap;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@ -40,20 +41,21 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import appeng.api.parts.CableRenderMode;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.block.AEBaseBlock;
import appeng.client.render.effects.AssemblerFX;
@ -63,11 +65,13 @@ import appeng.client.render.effects.LightningArcFX;
import appeng.client.render.effects.LightningFX;
import appeng.client.render.effects.VibrantFX;
import appeng.client.render.model.GlassModelLoader;
import appeng.client.render.model.ModelsCache;
import appeng.client.render.model.UVLModelLoader;
import appeng.client.render.textures.ParticleTextures;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.CommonHelper;
import appeng.core.features.IAEFeature;
import appeng.core.sync.network.NetworkHandler;
@ -81,6 +85,8 @@ import appeng.helpers.IMouseWheelItem;
import appeng.hooks.TickHandler;
import appeng.hooks.TickHandler.PlayerColor;
import appeng.items.misc.ItemPaintBall;
import appeng.items.parts.PartType;
import appeng.parts.AEBasePart;
import appeng.server.ServerHelper;
import appeng.transformer.MissingCoreMod;
import appeng.util.Platform;
@ -95,6 +101,7 @@ public class ClientHelper extends ServerHelper
MinecraftForge.EVENT_BUS.register( this );
ModelLoaderRegistry.registerLoader( UVLModelLoader.INSTANCE );
ModelLoaderRegistry.registerLoader( new GlassModelLoader() );
( (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager() ).registerReloadListener( ModelsCache.INSTANCE );
for( IAEFeature feature : Api.INSTANCE.definitions().getFeatureRegistry().getRegisteredFeatures() )
{
feature.handler().registerStateMapper();
@ -125,10 +132,6 @@ public class ClientHelper extends ServerHelper
for( IAEFeature feature : Api.INSTANCE.definitions().getFeatureRegistry().getRegisteredFeatures() )
{
feature.handler().registerModel();
if( feature instanceof AEBaseBlock )
{
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( new AEBaseBlockColor(), (Block) feature );
}
}
// Register color handling for paintball items
@ -296,12 +299,6 @@ public class ClientHelper extends ServerHelper
throw new MissingCoreMod();
}
@SubscribeEvent
public void modelsBake( ModelBakeEvent event )
{
UVLModelLoader.INSTANCE.setLoader( event.getModelLoader() );
}
@SubscribeEvent
public void postPlayerRender( final RenderLivingEvent.Pre p )
{
@ -383,9 +380,10 @@ public class ClientHelper extends ServerHelper
@SubscribeEvent
public void onModelBakeEvent( final ModelBakeEvent event )
{
UVLModelLoader.INSTANCE.setLoader( event.getModelLoader() );
for( IAEFeature feature : Api.INSTANCE.definitions().getFeatureRegistry().getRegisteredFeatures() )
{
feature.handler().registerCustomModelOverride(event.getModelRegistry());
feature.handler().registerCustomModelOverride( event.getModelRegistry() );
}
}
@ -432,6 +430,48 @@ public class ClientHelper extends ServerHelper
public void onTextureStitch( final TextureStitchEvent.Pre event )
{
ParticleTextures.registerSprite( event );
for( AECableType type : AECableType.VALIDCABLES )
{
for( IModel model : new IModel[] { ModelsCache.INSTANCE.getOrLoadModel( type.getModel() ), ModelsCache.INSTANCE.getOrLoadModel( type.getConnectionModel() ), ModelsCache.INSTANCE.getOrLoadModel( type.getStraightModel() ) } )
{
for( ResourceLocation location : model.getTextures() )
{
for( AEColor color : AEColor.values() )
{
if( type.displayedChannels() > 0 )
{
for( int i = 0; i <= type.displayedChannels(); i++ )
{
event.getMap().registerSprite( AEBasePart.replaceProperties( location, ImmutableMap.of( "color", color.name(), "channels", String.valueOf( i ) ) ) );
}
}
else
{
event.getMap().registerSprite( AEBasePart.replaceProperties( location, ImmutableMap.of( "color", color.name() ) ) );
}
}
}
}
}
for( PartType part : PartType.values() )
{
if( !part.isCable() )
{
IModel model = ModelsCache.INSTANCE.getOrLoadModel( part.getModel() );
for( ResourceLocation location : model.getTextures() )
{
for( AEColor color : AEColor.values() )
{
event.getMap().registerSprite( AEBasePart.replaceProperties( location, ImmutableMap.of( "color", color.name() ) ) );
}
}
}
}
for( ResourceLocation location : ModelsCache.INSTANCE.getOrLoadModel( new ResourceLocation( AppEng.MOD_ID, "part/cable_facade" ) ).getTextures() )
{
event.getMap().registerSprite( location );
}
}
private static class IconReg
@ -458,15 +498,29 @@ public class ClientHelper extends ServerHelper
}
}
public static class AEBaseBlockColor implements IBlockColor
public class ItemPaintBallColor implements IItemColor
{
@Override
public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex )
public int getColorFromItemstack( ItemStack stack, int tintIndex )
{
return tintIndex;
final AEColor col = ( (ItemPaintBall) stack.getItem() ).getColor( stack );
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
final int b = ( colorValue ) & 0xff;
if( stack.getItemDamage() >= 20 )
{
final float fail = 0.7f;
final int full = (int) ( 255 * 0.3 );
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
}
else
{
return r << 16 | g << 8 | b | 0xff << 24;
}
}
}
}

View File

@ -0,0 +1,119 @@
package appeng.client.render.model;
import java.util.HashMap;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.model.IModelState;
public enum ModelsCache implements IResourceManagerReloadListener
{
INSTANCE;
public static final IModelState DEFAULTMODELSTATE = opt -> Optional.absent();
public static final VertexFormat DEFAULTVERTEXFORMAT = DefaultVertexFormats.BLOCK;
public static final Function<ResourceLocation, TextureAtlasSprite> DEFAULTTEXTUREGETTER = texture -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( texture.toString() );
private final Map<ResourceLocation, IModel> cache = new HashMap<>();
private final Map<ResourceLocation, IBakedModel> bakedCache = new HashMap<>();
public IModel getOrLoadModel( ResourceLocation location )
{
IModel model = cache.get( location );
if( model == null )
{
try
{
model = ModelLoaderRegistry.getModel( location );
}
catch( Exception e )
{
// TODO 1.10.2-R - log this in pretty way
e.printStackTrace();
model = ModelLoaderRegistry.getMissingModel();
}
cache.put( location, model );
}
return model;
}
public IBakedModel getModel( ResourceLocation key )
{
return bakedCache.get( key );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> textureGetter )
{
IBakedModel model = getModel( key );
if( model == null )
{
model = getOrLoadModel( location ).bake( state, format, textureGetter );
bakedCache.put( key, model );
}
return model;
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, IModelState state, VertexFormat format )
{
return getOrLoadModel( key, location, state, format, DEFAULTTEXTUREGETTER );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, IModelState state, Function<ResourceLocation, TextureAtlasSprite> textureGetter )
{
return getOrLoadModel( key, location, state, DEFAULTVERTEXFORMAT, textureGetter );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> textureGetter )
{
return getOrLoadModel( key, location, DEFAULTMODELSTATE, format, textureGetter );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, IModelState state )
{
return getOrLoadModel( key, location, state, DEFAULTVERTEXFORMAT, DEFAULTTEXTUREGETTER );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, VertexFormat format )
{
return getOrLoadModel( key, location, DEFAULTMODELSTATE, format, DEFAULTTEXTUREGETTER );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location, Function<ResourceLocation, TextureAtlasSprite> textureGetter )
{
return getOrLoadModel( key, location, DEFAULTMODELSTATE, DEFAULTVERTEXFORMAT, textureGetter );
}
public IBakedModel getOrLoadModel( ResourceLocation key, ResourceLocation location )
{
return getOrLoadModel( key, location, DEFAULTMODELSTATE, DEFAULTVERTEXFORMAT, DEFAULTTEXTUREGETTER );
}
public IBakedModel getOrLoadBakedModel( ResourceLocation location )
{
return getOrLoadModel( location, location, DEFAULTMODELSTATE, DEFAULTVERTEXFORMAT, DEFAULTTEXTUREGETTER );
}
@Override
public void onResourceManagerReload( IResourceManager resourceManager )
{
cache.clear();
bakedCache.clear();
}
}

View File

@ -0,0 +1,72 @@
package appeng.client.render.model.pipeline;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
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.util.EnumFacing;
import appeng.api.client.BakingPipeline;
import appeng.api.client.BakingPipelineElement;
public class BakingPipelineBakedModel extends BakingPipeline implements IBakedModel
{
private final IBakedModel parent;
public BakingPipelineBakedModel( IBakedModel parent, BakingPipelineElement<?, ?>... pipeline )
{
super( pipeline );
this.parent = parent;
}
@Override
public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
{
return pipe( new ArrayList(), parent, state, side, rand );
}
@Override
public boolean isAmbientOcclusion()
{
return parent.isAmbientOcclusion();
}
@Override
public boolean isGui3d()
{
return parent.isGui3d();
}
@Override
public boolean isBuiltInRenderer()
{
return parent.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture()
{
return parent.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return parent.getItemCameraTransforms();
}
@Override
public ItemOverrideList getOverrides()
{
return parent.getOverrides();
}
}

View File

@ -0,0 +1,107 @@
package appeng.client.render.model.pipeline;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import appeng.api.client.BakingPipelineElement;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.FacingToRotation;
public class DoubleFacingQuadRotator implements BakingPipelineElement<QuadVertexData, QuadVertexData>
{
@Override
public List<QuadVertexData> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
if( state != null )
{
final EnumFacing forward = state.getValue( AEBaseTileBlock.AE_BLOCK_FORWARD );
final EnumFacing up = state.getValue( AEBaseTileBlock.AE_BLOCK_UP );
final FacingToRotation f2r = FacingToRotation.get( forward, up );
List<QuadVertexData> rotated = new ArrayList();
for( QuadVertexData data : elements )
{
data.setFace( f2r.rotate( data.getFace() ) );
float[][][] qd = data.getData();
for( int v = 0; v < 4; v++ )
{
for( int e = 0; e < data.getFormat().getElementCount(); e++ )
{
VertexFormatElement element = data.getFormat().getElement( e );
if( element.getUsage() == VertexFormatElement.EnumUsage.POSITION )
{
qd[v][e] = transform( f2r, qd[v][e] );
}
else if( element.getUsage() == VertexFormatElement.EnumUsage.NORMAL )
{
qd[v][e] = transformNormal( f2r, qd[v][e] );
}
}
}
rotated.add( new QuadVertexData( data.getFormat(), qd, data.getTintIndex(), data.getFace(), data.getSprite(), data.shouldApplyDiffuseLighting() ) );
}
return rotated;
}
return elements;
}
private float[] transform( FacingToRotation f2r, 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( FacingToRotation f2r, float[] fs )
{
switch( fs.length )
{
case 3:
Vector3f vec = new Vector3f( fs[0], fs[1], fs[2] );
f2r.getMat().transform( vec );
return new float[] { vec.x, vec.y, vec.z };
case 4:
Vector4f vecc = new Vector4f( fs[0], fs[1], fs[2], fs[3] );
f2r.getMat().transform( vecc );
return new float[] { vecc.x, vecc.y, vecc.z, vecc.w };
default:
return fs;
}
}
}

View File

@ -0,0 +1,39 @@
package appeng.client.render.model.pipeline;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.model.TRSRTransformation;
public class FacingQuadRotator extends MatVecApplicator
{
private EnumFacing override;
public FacingQuadRotator( EnumFacing override )
{
super( TRSRTransformation.getMatrix( override ) );
this.override = override;
}
public FacingQuadRotator()
{
this.override = null;
}
@Override
public List<QuadVertexData> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
if( override == null )
{
setMatrix( TRSRTransformation.getMatrix( side ) );
}
return super.pipe( elements, parent, state, side, rand );
}
}

View File

@ -0,0 +1,141 @@
package appeng.client.render.model.pipeline;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.model.TRSRTransformation;
import appeng.api.client.BakingPipelineElement;
public class MatVecApplicator implements BakingPipelineElement<QuadVertexData, QuadVertexData>
{
private Matrix4f matrix;
private boolean forceTranslate;
public MatVecApplicator( Matrix4f matrix, boolean forceTranslate )
{
this.matrix = matrix;
this.forceTranslate = forceTranslate;
}
public MatVecApplicator( Matrix4f matrix )
{
this( matrix, false );
}
public MatVecApplicator()
{
this( new Matrix4f() );
}
public Matrix4f getMatrix()
{
return matrix;
}
public void setMatrix( Matrix4f matrix )
{
this.matrix = matrix;
}
public boolean forceTranslate()
{
return forceTranslate;
}
public void setForceTranslate( boolean forceTranslate )
{
this.forceTranslate = forceTranslate;
}
@Override
public List<QuadVertexData> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
List<QuadVertexData> rotated = new ArrayList();
for( QuadVertexData data : elements )
{
float[][][] qd = data.getData();
data.setFace( side != null ? TRSRTransformation.rotate( matrix, side ) : side );
for( int v = 0; v < 4; v++ )
{
for( int e = 0; e < data.getFormat().getElementCount(); e++ )
{
VertexFormatElement element = data.getFormat().getElement( e );
if( element.getUsage() == VertexFormatElement.EnumUsage.POSITION )
{
qd[v][e] = transform( qd[v][e] );
}
else if( element.getUsage() == VertexFormatElement.EnumUsage.NORMAL )
{
qd[v][e] = transformNormal( qd[v][e] );
}
}
}
rotated.add( new QuadVertexData( data.getFormat(), qd, data.getTintIndex(), data.getFace(), data.getSprite(), data.shouldApplyDiffuseLighting() ) );
}
return rotated;
}
private float[] transform( float[] fs )
{
switch( fs.length )
{
case 3:
Vector4f vec = new Vector4f( fs[0], fs[1], fs[2], forceTranslate ? 1 : 0 );
vec.x -= 0.5f;
vec.y -= 0.5f;
vec.z -= 0.5f;
this.matrix.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], forceTranslate ? 1 : fs[3] );
vecc.x -= 0.5f;
vecc.y -= 0.5f;
vecc.z -= 0.5f;
this.matrix.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:
Vector3f vec = new Vector3f( fs[0], fs[1], fs[2] );
this.matrix.transform( vec );
vec.normalize();
return new float[] { vec.x, vec.y, vec.z };
case 4:
Vector4f vecc = new Vector4f( fs[0], fs[1], fs[2], fs[3] );
this.matrix.transform( vecc );
vecc.normalize();
return new float[] { vecc.x, vecc.y, vecc.z, vecc.w };
default:
return fs;
}
}
}

View File

@ -0,0 +1,37 @@
package appeng.client.render.model.pipeline;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import appeng.api.client.BakingPipelineElement;
public class Merge<F, T> implements BakingPipelineElement<F, T>
{
private final ImmutableList<BakingPipelineElement<?, ?>> pipeline;
public Merge( BakingPipelineElement<?, ?>... pipeline )
{
this.pipeline = ImmutableList.copyOf( pipeline );
}
@Override
public List pipe( List elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
for( BakingPipelineElement<?, ?> element : pipeline )
{
elements.addAll( element.pipe( new ArrayList<>(), parent, state, side, rand ) );
}
return elements;
}
}

View File

@ -0,0 +1,21 @@
package appeng.client.render.model.pipeline;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import appeng.api.client.BakingPipelineElement;
public class ParentQuads implements BakingPipelineElement<Void, BakedQuad>
{
@Override
public List<BakedQuad> pipe( List<Void> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
return parent.getQuads( state, side, rand );
}
}

View File

@ -0,0 +1,121 @@
package appeng.client.render.model.pipeline;
import java.lang.reflect.Field;
import com.google.common.base.Throwables;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
public final class QuadVertexData
{
private static final Field unpackedData = ReflectionHelper.findField( UnpackedBakedQuad.class, "unpackedData" );
private static float[][][] unpackedData( UnpackedBakedQuad quad )
{
try
{
return (float[][][]) unpackedData.get( quad );
}
catch( Exception e )
{
throw Throwables.propagate( e );
}
}
private VertexFormat format;
private float[][][] data;
private int tintIndex;
private EnumFacing face;
private TextureAtlasSprite sprite;
protected boolean applyDiffuseLighting;
public QuadVertexData( VertexFormat format, float[][][] data, int tintIndex, EnumFacing face, TextureAtlasSprite sprite, boolean applyDiffuseLighting )
{
this.format = format;
this.data = data;
this.tintIndex = tintIndex;
this.face = face;
this.sprite = sprite;
this.applyDiffuseLighting = applyDiffuseLighting;
}
public QuadVertexData( UnpackedBakedQuad quad )
{
this( quad.getFormat(), unpackedData( quad ), quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting() );
}
public UnpackedBakedQuad toQuad()
{
return new UnpackedBakedQuad( data, tintIndex, face, sprite, applyDiffuseLighting, format );
}
public VertexFormat getFormat()
{
return format;
}
public void setFormat( VertexFormat format )
{
this.format = format;
}
public float[][][] getData()
{
return data;
}
public void setData( float[][][] data )
{
this.data = data;
}
public int getTintIndex()
{
return tintIndex;
}
public void setTintIndex( int tintIndex )
{
this.tintIndex = tintIndex;
}
public EnumFacing getFace()
{
return face;
}
public void setFace( EnumFacing face )
{
this.face = face;
}
public TextureAtlasSprite getSprite()
{
return sprite;
}
public void setSprite( TextureAtlasSprite sprite )
{
this.sprite = sprite;
}
public boolean shouldApplyDiffuseLighting()
{
return applyDiffuseLighting;
}
public void setApplyDiffuseLighting( boolean applyDiffuseLighting )
{
this.applyDiffuseLighting = applyDiffuseLighting;
}
}

View File

@ -0,0 +1,71 @@
package appeng.client.render.model.pipeline;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import appeng.api.client.BakingPipelineElement;
public class StatePosRecolorator implements BakingPipelineElement<QuadVertexData, QuadVertexData>
{
private IBlockAccess blockAccess;
private BlockPos pos;
private IBlockState state;
public StatePosRecolorator( IBlockAccess blockAccess, BlockPos pos, IBlockState state )
{
this.blockAccess = blockAccess;
this.pos = pos;
this.state = state;
}
public IBlockAccess getBlockAccess()
{
return blockAccess;
}
public void setBlockAccess( IBlockAccess blockAccess )
{
this.blockAccess = blockAccess;
}
public BlockPos getPos()
{
return pos;
}
public void setPos( BlockPos pos )
{
this.pos = pos;
}
public IBlockState getState()
{
return state;
}
public void setState( IBlockState state )
{
this.state = state;
}
@Override
public List<QuadVertexData> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
for( QuadVertexData data : elements )
{
data.setTintIndex( Minecraft.getMinecraft().getBlockColors().colorMultiplier( this.state, blockAccess, this.pos, data.getTintIndex() ) );
}
return elements;
}
}

View File

@ -0,0 +1,45 @@
package appeng.client.render.model.pipeline;
import java.util.List;
import java.util.function.Function;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import appeng.api.client.BakingPipelineElement;
public class TintIndexModifier implements BakingPipelineElement<QuadVertexData, QuadVertexData>
{
private Function<Integer, Integer> tintTransformer;
public TintIndexModifier( Function<Integer, Integer> tintTransformer )
{
this.tintTransformer = tintTransformer;
}
public Function<Integer, Integer> getTintTransformer()
{
return tintTransformer;
}
public void setTintTransformer( Function<Integer, Integer> tintTransformer )
{
this.tintTransformer = tintTransformer;
}
@Override
public List<QuadVertexData> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
for( QuadVertexData quad : elements )
{
quad.setTintIndex( tintTransformer.apply( quad.getTintIndex() ) );
}
return elements;
}
}

View File

@ -0,0 +1,63 @@
package appeng.client.render.model.pipeline;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.pipeline.LightUtil;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import appeng.api.client.BakingPipelineElement;
public class TypeTransformer
{
public static final BakingPipelineElement<BakedQuad, QuadVertexData> quads2vecs = new BakingPipelineElement<BakedQuad, QuadVertexData>(){
@Override
public List<QuadVertexData> pipe( List<BakedQuad> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
return Lists.transform( elements, ( quad ) -> {
if( quad instanceof UnpackedBakedQuad )
{
return new QuadVertexData( (UnpackedBakedQuad) quad );
}
else
{
int[] qdata = quad.getVertexData();
float[][][] data = new float[4][quad.getFormat().getElementCount()][4];
for( int v = 0; v < data.length; v++ )
{
float[][] vd = data[v];
for( int e = 0; e < vd.length; e++ )
{
LightUtil.unpack( qdata, vd[e], quad.getFormat(), v, e );
}
}
return new QuadVertexData( quad.getFormat(), data, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting() );
}
} );
}
};
public static final BakingPipelineElement<QuadVertexData, BakedQuad> vecs2quads = new BakingPipelineElement<QuadVertexData, BakedQuad>(){
@Override
public List<BakedQuad> pipe( List<QuadVertexData> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
return Lists.transform( elements, ( data ) -> {
return data.toQuad();
} );
}
};
}

View File

@ -0,0 +1,53 @@
package appeng.client.render.model.pipeline.cable;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.client.BakingPipeline;
import appeng.api.client.BakingPipelineElement;
import appeng.api.implementations.parts.IPartCable;
import appeng.api.parts.IPart;
import appeng.api.util.AEPartLocation;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.model.pipeline.TintIndexModifier;
import appeng.parts.CableBusContainer;
public class CableAndConnections implements BakingPipelineElement<BakedQuad, BakedQuad>
{
private final BakingPipeline rotatingPipeline;
private final TintIndexModifier tintIndexModifier;
private final BakingPipeline tintIndexFixPipeline;
public CableAndConnections( BakingPipeline rotatingPipeline, TintIndexModifier tintIndexModifier, BakingPipeline tintIndexFixPipeline )
{
this.rotatingPipeline = rotatingPipeline;
this.tintIndexModifier = tintIndexModifier;
this.tintIndexFixPipeline = tintIndexFixPipeline;
}
@Override
public List<BakedQuad> pipe( List<BakedQuad> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
if( state != null )
{
CableBusContainer cableBus = ( (IExtendedBlockState) state ).getValue( BlockCableBus.cableBus );
IPart part = cableBus.getPart( AEPartLocation.INTERNAL );
if( part instanceof IPartCable )
{
tintIndexModifier.setTintTransformer( tint -> ( AEPartLocation.INTERNAL.ordinal() << 2 ) | tint );
elements.addAll( tintIndexFixPipeline.pipe( ( (IPartCable) part ).getOrBakeQuads( rotatingPipeline, state, side, rand ), parent, state, side, rand ) );
}
}
return elements;
}
}

View File

@ -0,0 +1,55 @@
package appeng.client.render.model.pipeline.cable;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.client.BakingPipeline;
import appeng.api.client.BakingPipelineElement;
import appeng.api.parts.IFacadePart;
import appeng.api.util.AEPartLocation;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.model.pipeline.TintIndexModifier;
import appeng.parts.CableBusContainer;
public class Facades implements BakingPipelineElement<BakedQuad, BakedQuad>
{
private final BakingPipeline rotatingPipeline;
private final TintIndexModifier tintIndexModifier;
private final BakingPipeline tintIndexFixPipeline;
public Facades( BakingPipeline rotatingPipeline, TintIndexModifier tintIndexModifier, BakingPipeline tintIndexFixPipeline )
{
this.rotatingPipeline = rotatingPipeline;
this.tintIndexModifier = tintIndexModifier;
this.tintIndexFixPipeline = tintIndexFixPipeline;
}
@Override
public List<BakedQuad> pipe( List<BakedQuad> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
if( state != null )
{
CableBusContainer cableBus = ( (IExtendedBlockState) state ).getValue( BlockCableBus.cableBus );
for( AEPartLocation facing : AEPartLocation.SIDE_LOCATIONS )
{
IFacadePart facade = cableBus.getFacadeContainer().getFacade( facing );
if( facade != null )
{
tintIndexModifier.setTintTransformer( tint -> ( facing.ordinal() << 2 ) | tint );
elements.addAll( tintIndexFixPipeline.pipe( facade.getOrBakeQuads( cableBus, rotatingPipeline, state, side, rand ), parent, state, side, rand ) );
}
}
}
return elements;
}
}

View File

@ -0,0 +1,55 @@
package appeng.client.render.model.pipeline.cable;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.client.BakingPipeline;
import appeng.api.client.BakingPipelineElement;
import appeng.api.parts.IPart;
import appeng.api.util.AEPartLocation;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.model.pipeline.TintIndexModifier;
import appeng.parts.CableBusContainer;
public class Parts implements BakingPipelineElement<BakedQuad, BakedQuad>
{
private final BakingPipeline rotatingPipeline;
private final TintIndexModifier tintIndexModifier;
private final BakingPipeline tintIndexFixPipeline;
public Parts( BakingPipeline rotatingPipeline, TintIndexModifier tintIndexModifier, BakingPipeline tintIndexFixPipeline )
{
this.rotatingPipeline = rotatingPipeline;
this.tintIndexModifier = tintIndexModifier;
this.tintIndexFixPipeline = tintIndexFixPipeline;
}
@Override
public List<BakedQuad> pipe( List<BakedQuad> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
if( state != null )
{
CableBusContainer cableBus = ( (IExtendedBlockState) state ).getValue( BlockCableBus.cableBus );
for( AEPartLocation facing : AEPartLocation.SIDE_LOCATIONS )
{
IPart part = cableBus.getPart( facing );
if( part != null )
{
tintIndexModifier.setTintTransformer( tint -> ( facing.ordinal() << 2 ) | tint );
elements.addAll( tintIndexFixPipeline.pipe( part.getOrBakeQuads( rotatingPipeline, state, side, rand ), parent, state, side, rand ) );
}
}
}
return elements;
}
}

View File

@ -58,7 +58,7 @@ public class FacadeConfig extends Configuration
{
if( f.get( Block.class ) == id )
{
return this.get( "minecraft", f.getName() + ( metadata == 0 ? "" : "." + metadata ), automatic ).getBoolean( automatic );
return this.get( "minecraft", f.getName() + ( metadata == 0 ? "" : "/" + metadata ), automatic ).getBoolean( automatic );
}
}
catch( final Throwable e )

View File

@ -42,6 +42,7 @@ import org.objectweb.asm.tree.MethodNode;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@ -326,7 +327,7 @@ public class ApiPart implements IPartHelper
}
@Override
public boolean placeBus( final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final EnumHand hand, final World w )
public EnumActionResult placeBus( final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final EnumHand hand, final World w )
{
return PartPlacement.place( is, pos, side, player, hand, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
}

View File

@ -20,25 +20,43 @@ package appeng.core.features;
import java.util.EnumSet;
import java.util.Set;
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.IRegistry;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import appeng.api.client.BakingPipeline;
import appeng.api.definitions.ITileDefinition;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.model.pipeline.BakingPipelineBakedModel;
import appeng.client.render.model.pipeline.FacingQuadRotator;
import appeng.client.render.model.pipeline.Merge;
import appeng.client.render.model.pipeline.TintIndexModifier;
import appeng.client.render.model.pipeline.TypeTransformer;
import appeng.client.render.model.pipeline.cable.CableAndConnections;
import appeng.client.render.model.pipeline.cable.Facades;
import appeng.client.render.model.pipeline.cable.Parts;
import appeng.core.AppEng;
import appeng.core.CommonHelper;
import appeng.core.CreativeTab;
import appeng.parts.CableBusContainer;
import appeng.util.Platform;
@ -106,6 +124,7 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
@Override
public void registerModel()
{
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( new CableBusColor(), this.featured );
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "normal" ) );
}
@ -118,6 +137,40 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
@Override
public void registerCustomModelOverride( IRegistry<ModelResourceLocation, IBakedModel> modelRegistry )
{
final BakingPipeline rotatingPipeline = new BakingPipeline( TypeTransformer.quads2vecs, new FacingQuadRotator(), TypeTransformer.vecs2quads );
final TintIndexModifier tintIndexModifier = new TintIndexModifier( tint -> tint );
final BakingPipeline tintIndexFixPipeline = new BakingPipeline( TypeTransformer.quads2vecs, tintIndexModifier, TypeTransformer.vecs2quads );
Set<ModelResourceLocation> keys = Sets.newHashSet( modelRegistry.getKeys() );
for( ModelResourceLocation model : keys )
{
if( model.getResourceDomain().equals( registryName.getResourceDomain() ) && model.getResourcePath().equals( registryName.getResourcePath() ) )
{
modelRegistry.putObject( model, new BakingPipelineBakedModel( modelRegistry.getObject( model ), new Merge( new CableAndConnections( rotatingPipeline, tintIndexModifier, tintIndexFixPipeline ), new Facades( rotatingPipeline, tintIndexModifier, tintIndexFixPipeline ), new Parts( rotatingPipeline, tintIndexModifier, tintIndexFixPipeline ) ) ) );
}
}
}
public static class CableBusColor implements IBlockColor
{
@Override
public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int color )
{
AEPartLocation side = AEPartLocation.fromOrdinal( ( color >> 2 ) & 7 );
CableBusContainer bus = ( (IExtendedBlockState) state ).getValue( BlockCableBus.cableBus );
switch( color & 3 )
{
case 0:
return bus.getGridNode( side ) != null && bus.getGridNode( side ).isActive() ? 0xffffff : 0;
case 1:
return bus.getColor().blackVariant;
case 2:
return bus.getColor().mediumVariant;
case 3:
return bus.getColor().whiteVariant;
default:
return color;
}
}
}
}

View File

@ -19,27 +19,48 @@
package appeng.facade;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
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.util.math.Vec3i;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.client.BakingPipeline;
import appeng.api.parts.IBoxProvider;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.util.AEPartLocation;
import appeng.client.render.model.ModelsCache;
import appeng.client.render.model.pipeline.MatVecApplicator;
import appeng.client.render.model.pipeline.ParentQuads;
import appeng.client.render.model.pipeline.StatePosRecolorator;
import appeng.client.render.model.pipeline.TypeTransformer;
import appeng.core.AppEng;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
@ -147,7 +168,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
final ItemStack is = this.getTexture();
final Block blk = Block.getBlockFromItem( is.getItem() );
return !blk.isOpaqueCube(blk.getDefaultState());
return !blk.isOpaqueCube( blk.getDefaultState() );
}
@Nullable
@ -237,7 +258,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
* if ( out.contains( AEPartLocation.EAST ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade(
* AEPartLocation.EAST ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove(
* AEPartLocation.EAST ); }
* if ( out.contains( AEPartLocation.WEST ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade(
* if ( out.contains( AEPartLocation.WEST ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade(s
* AEPartLocation.WEST ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove(
* AEPartLocation.WEST ); }
*/
@ -262,4 +283,24 @@ public class FacadePart implements IFacadePart, IBoxProvider
{
this.getBoxes( bch, null );
}
@Override
@SideOnly( Side.CLIENT )
public List<BakedQuad> getOrBakeQuads( IPartHost host, BakingPipeline<BakedQuad, BakedQuad> rotatingPipeline, IBlockState state, EnumFacing side, long rand )
{
List<BakedQuad> elements = new ArrayList();
elements.addAll( rotatingPipeline.pipe( ModelsCache.INSTANCE.getOrLoadBakedModel( new ResourceLocation( AppEng.MOD_ID, "part/cable_facade" ) ).getQuads( state, side, rand ), null, state, getSide().getFacing(), rand ) );
ItemStack titem = getTexture();
if( titem != null && titem.getItem() != null && Block.getBlockFromItem( titem.getItem() ) != null )
{
Block tblock = Block.getBlockFromItem( titem.getItem() );
IBlockState tstate = tblock.getStateFromMeta( titem.getItem().getMetadata( titem.getItemDamage() ) );
Vec3i s = getSide().getFacing().getDirectionVec();
Vector3f scale = new Vector3f( s.getX() == 0 ? 0.9999f : 0.125f, s.getY() == 0 ? 0.9999f : 0.125f, s.getZ() == 0 ? 0.9999f : 0.125f );
Vector3f trans = new Vector3f( s.getX() * 3.5f, s.getY() * 3.5f, s.getZ() * 3.5f );
elements.addAll( new BakingPipeline( new ParentQuads(), TypeTransformer.quads2vecs, new MatVecApplicator( TRSRTransformation.toVecmath( new Matrix4f().scale( scale ).translate( trans ) ), true ), new StatePosRecolorator( host.getTile().getWorld(), host.getLocation().getPos(), tstate ), TypeTransformer.vecs2quads ).pipe( new ArrayList<>(), Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( tstate ), tstate, side, rand ) );
}
return elements;
}
}

View File

@ -48,7 +48,6 @@ import appeng.api.parts.IAlphaPassItem;
import appeng.api.util.AEPartLocation;
import appeng.core.FacadeConfig;
import appeng.core.features.AEFeature;
import appeng.decorative.solid.BlockQuartzOre;
import appeng.facade.FacadePart;
import appeng.facade.IFacadeItem;
import appeng.items.AEBaseItem;
@ -68,7 +67,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public EnumActionResult onItemUseFirst( final ItemStack is, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world );
}
@Override
@ -148,11 +147,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
final int metadata = l.getItem().getMetadata( l.getItemDamage() );
final boolean hasTile = b.hasTileEntity( b.getStateFromMeta( metadata ) );
final boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
final boolean disableOre = b instanceof BlockQuartzOre;
final boolean defaultValue = ( b.isOpaqueCube(b.getDefaultState()) && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
// TODO 1.10.2-R - XD
final boolean defaultValue = true || b instanceof BlockGlass || b instanceof BlockStainedGlass;
if( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
{
if( returnItem )

View File

@ -35,6 +35,8 @@ import javax.annotation.Nullable;
import com.google.common.base.Preconditions;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -81,6 +83,12 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
instance = this;
}
@Override
public ItemMeshDefinition getItemMeshDefinition()
{
return itemstack -> new ModelResourceLocation( getTypeByStack( itemstack ).getModel(), null );
}
@Nonnull
public final ItemStackSrc createPart( final PartType mat )
{
@ -177,7 +185,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
return EnumActionResult.PASS;
}
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, w ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, w );
}
@Override

View File

@ -24,7 +24,10 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPart;
import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.integration.IntegrationType;
@ -62,9 +65,9 @@ import appeng.parts.reporting.PartTerminal;
public enum PartType
{
InvalidType( -1, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), null ),
InvalidType( -1, new ResourceLocation( AppEng.MOD_ID, "invalid" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), null ),
CableGlass( 0, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
CableGlass( 0, new ResourceLocation( AppEng.MOD_ID, "cable_glass" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
{
@Override
public boolean isCable()
@ -73,7 +76,7 @@ public enum PartType
}
},
CableCovered( 20, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
CableCovered( 20, new ResourceLocation( AppEng.MOD_ID, "cable_covered" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
{
@Override
public boolean isCable()
@ -82,7 +85,7 @@ public enum PartType
}
},
CableSmart( 40, EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
CableSmart( 40, new ResourceLocation( AppEng.MOD_ID, "cable_smart" ), EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
{
@Override
public boolean isCable()
@ -91,7 +94,7 @@ public enum PartType
}
},
CableDense( 60, EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartDenseCable.class )
CableDense( 60, new ResourceLocation( AppEng.MOD_ID, "cable_dense" ), EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartDenseCable.class )
{
@Override
public boolean isCable()
@ -100,53 +103,53 @@ public enum PartType
}
},
ToggleBus( 80, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
ToggleBus( 80, new ResourceLocation( AppEng.MOD_ID, "toggle_bus" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
InvertedToggleBus( 100, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
InvertedToggleBus( 100, new ResourceLocation( AppEng.MOD_ID, "inverted_toggle_bus" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
CableAnchor( 120, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
CableAnchor( 120, new ResourceLocation( AppEng.MOD_ID, "cable_anchor" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
QuartzFiber( 140, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
QuartzFiber( 140, new ResourceLocation( AppEng.MOD_ID, "quartz_fiber" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
Monitor( 160, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class ),
Monitor( 160, new ResourceLocation( AppEng.MOD_ID, "monitor" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class ),
SemiDarkMonitor( 180, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartSemiDarkPanel.class ),
SemiDarkMonitor( 180, new ResourceLocation( AppEng.MOD_ID, "semi_dark_monitor" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartSemiDarkPanel.class ),
DarkMonitor( 200, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class ),
DarkMonitor( 200, new ResourceLocation( AppEng.MOD_ID, "dark_monitor" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class ),
StorageBus( 220, EnumSet.of( AEFeature.StorageBus ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
StorageBus( 220, new ResourceLocation( AppEng.MOD_ID, "storage_bus" ), EnumSet.of( AEFeature.StorageBus ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
ImportBus( 240, EnumSet.of( AEFeature.ImportBus ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
ImportBus( 240, new ResourceLocation( AppEng.MOD_ID, "import_bus" ), EnumSet.of( AEFeature.ImportBus ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
ExportBus( 260, EnumSet.of( AEFeature.ExportBus ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
ExportBus( 260, new ResourceLocation( AppEng.MOD_ID, "export_bus" ), EnumSet.of( AEFeature.ExportBus ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
LevelEmitter( 280, EnumSet.of( AEFeature.LevelEmitter ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
LevelEmitter( 280, new ResourceLocation( AppEng.MOD_ID, "level_emitter" ), EnumSet.of( AEFeature.LevelEmitter ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
AnnihilationPlane( 300, EnumSet.of( AEFeature.AnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
AnnihilationPlane( 300, new ResourceLocation( AppEng.MOD_ID, "annihilation_plane" ), EnumSet.of( AEFeature.AnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
IdentityAnnihilationPlane( 301, EnumSet.of( AEFeature.AnnihilationPlane, AEFeature.IdentityAnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
IdentityAnnihilationPlane( 301, new ResourceLocation( AppEng.MOD_ID, "identity_annihilation_plane" ), EnumSet.of( AEFeature.AnnihilationPlane, AEFeature.IdentityAnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
FormationPlane( 320, EnumSet.of( AEFeature.FormationPlane ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
FormationPlane( 320, new ResourceLocation( AppEng.MOD_ID, "formation_plane" ), EnumSet.of( AEFeature.FormationPlane ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
PatternTerminal( 340, EnumSet.of( AEFeature.Patterns ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
PatternTerminal( 340, new ResourceLocation( AppEng.MOD_ID, "pattern_terminal" ), EnumSet.of( AEFeature.Patterns ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
CraftingTerminal( 360, EnumSet.of( AEFeature.CraftingTerminal ), EnumSet.noneOf( IntegrationType.class ), PartCraftingTerminal.class ),
CraftingTerminal( 360, new ResourceLocation( AppEng.MOD_ID, "crafting_terminal" ), EnumSet.of( AEFeature.CraftingTerminal ), EnumSet.noneOf( IntegrationType.class ), PartCraftingTerminal.class ),
Terminal( 380, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
Terminal( 380, new ResourceLocation( AppEng.MOD_ID, "terminal" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
StorageMonitor( 400, EnumSet.of( AEFeature.StorageMonitor ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
StorageMonitor( 400, new ResourceLocation( AppEng.MOD_ID, "storage_monitor" ), EnumSet.of( AEFeature.StorageMonitor ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
ConversionMonitor( 420, EnumSet.of( AEFeature.PartConversionMonitor ), EnumSet.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
ConversionMonitor( 420, new ResourceLocation( AppEng.MOD_ID, "conversion_monitor" ), EnumSet.of( AEFeature.PartConversionMonitor ), EnumSet.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
Interface( 440, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
Interface( 440, new ResourceLocation( AppEng.MOD_ID, "interface" ), EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
P2PTunnelME( 460, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelME ), EnumSet.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel ),
P2PTunnelME( 460, new ResourceLocation( AppEng.MOD_ID, "p2p_tunnel_me" ), EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelME ), EnumSet.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel ),
P2PTunnelRedstone( 461, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRedstone ), EnumSet.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel ),
P2PTunnelRedstone( 461, new ResourceLocation( AppEng.MOD_ID, "p2p_tunnel_redstone" ), EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRedstone ), EnumSet.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel ),
P2PTunnelItems( 462, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelItems ), EnumSet.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel ),
P2PTunnelItems( 462, new ResourceLocation( AppEng.MOD_ID, "p2p_tunnel_items" ), EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelItems ), EnumSet.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel ),
P2PTunnelLiquids( 463, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLiquids ), EnumSet.noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel ),
P2PTunnelLiquids( 463, new ResourceLocation( AppEng.MOD_ID, "p2p_tunnel_liquids" ), EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLiquids ), EnumSet.noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel ),
// P2PTunnelEU( 465, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), EnumSet.of( IntegrationType.IC2 ),
// PartP2PIC2Power.class, GuiText.EUTunnel ),
@ -154,7 +157,7 @@ public enum PartType
// P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), EnumSet.of( IntegrationType.RF ),
// PartP2PRFPower.class, GuiText.RFTunnel ),
P2PTunnelLight( 467, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLight ), EnumSet.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel ),
P2PTunnelLight( 467, new ResourceLocation( AppEng.MOD_ID, "p2p_tunnel_light" ), EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLight ), EnumSet.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel ),
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
@ -162,27 +165,44 @@ public enum PartType
// P2PTunnelPressure( 469, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelPressure ), EnumSet.of(
// IntegrationType.PneumaticCraft ), PartP2PPressure.class, GuiText.PressureTunnel ),
InterfaceTerminal( 480, EnumSet.of( AEFeature.InterfaceTerminal ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
InterfaceTerminal( 480, new ResourceLocation( AppEng.MOD_ID, "interface_terminal" ), EnumSet.of( AEFeature.InterfaceTerminal ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
private final int baseDamage;
private final ResourceLocation name;
private final Set<AEFeature> features;
private final Set<IntegrationType> integrations;
private final Class<? extends IPart> myPart;
private final GuiText extraName;
private Constructor<? extends IPart> constructor;
PartType( final int baseMetaValue, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
PartType( final int baseMetaValue, final ResourceLocation name, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
{
this( baseMetaValue, features, integrations, c, null );
this( baseMetaValue, name, features, integrations, c, null );
}
PartType( final int baseMetaValue, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en )
PartType( final int baseMetaValue, final ResourceLocation name, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en )
{
this.baseDamage = baseMetaValue;
this.name = name;
this.features = Collections.unmodifiableSet( features );
this.integrations = Collections.unmodifiableSet( integrations );
this.myPart = c;
this.extraName = en;
this.baseDamage = baseMetaValue;
}
int getBaseDamage()
{
return this.baseDamage;
}
public ResourceLocation getName()
{
return name;
}
public ResourceLocation getModel()
{
return new ResourceLocation( name.getResourceDomain(), "part/" + name.getResourcePath() );
}
public boolean isCable()
@ -220,9 +240,4 @@ public enum PartType
this.constructor = constructor;
}
int getBaseDamage()
{
return this.baseDamage;
}
}

View File

@ -24,11 +24,17 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
@ -40,6 +46,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;
@ -47,6 +54,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.client.BakingPipeline;
import appeng.api.config.Upgrades;
import appeng.api.definitions.IDefinitions;
import appeng.api.implementations.IUpgradeableHost;
@ -64,8 +72,11 @@ import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.client.render.model.ModelsCache;
import appeng.helpers.ICustomNameObject;
import appeng.helpers.IPriorityHost;
import appeng.items.parts.ItemMultiPart;
import appeng.items.parts.PartType;
import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.parts.networking.PartCable;
@ -77,6 +88,35 @@ import appeng.util.SettingsFrom;
public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradeableHost, ICustomNameObject
{
private static final Pattern PROPERTY_PATTERN = Pattern.compile( "\\$\\{([\\p{Alnum}_\\-\\.]+)\\}" );
public static final ResourceLocation replaceProperties( ResourceLocation location, ImmutableMap<String, String> properties )
{
Matcher m = PROPERTY_PATTERN.matcher( location.getResourcePath() );
StringBuffer buffer = new StringBuffer();
while( m.find() )
{
m.appendReplacement( buffer, properties.get( m.group( 1 ) ) );
}
m.appendTail( buffer );
return new ResourceLocation( location.getResourceDomain(), buffer.toString() );
}
protected static final Function<ResourceLocation, TextureAtlasSprite> propertyTextureGetter( ImmutableMap<String, String> properties )
{
return location -> ModelsCache.DEFAULTTEXTUREGETTER.apply( replaceProperties( location, properties ) );
}
protected static final Function<ResourceLocation, TextureAtlasSprite> propertyTextureGetter( ImmutableMap.Builder<String, String> properties )
{
return propertyTextureGetter( properties.build() );
}
protected static final ResourceLocation withProperties( ResourceLocation location, ImmutableMap.Builder<String, String> properties )
{
return new ResourceLocation( location.getResourceDomain(), location.getResourcePath() + properties.build().toString() );
}
private final AENetworkProxy proxy;
private final ItemStack is;
private TileEntity tile = null;
@ -97,6 +137,16 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
return this.host;
}
public PartType getType()
{
return ItemMultiPart.instance.getTypeByStack( is );
}
public ResourceLocation getDefaultModelLocation()
{
return getType().getModel();
}
@Override
public IGridNode getGridNode( final AEPartLocation dir )
{
@ -319,7 +369,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 3;
}
@ -515,6 +565,18 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
return false;
}
@Override
@SideOnly( Side.CLIENT )
public List<BakedQuad> getOrBakeQuads( BakingPipeline<BakedQuad, BakedQuad> rotatingPipeline, IBlockState state, EnumFacing side, long rand )
{
return rotatingPipeline.pipe( ModelsCache.INSTANCE.getOrLoadModel( withProperties( getDefaultModelLocation(), propertiesForModel( getSide().getFacing() ) ), getDefaultModelLocation(), propertyTextureGetter( propertiesForModel( getSide().getFacing() ) ) ).getQuads( state, side, rand ), null, state, getSide().getFacing(), rand );
}
protected ImmutableMap.Builder<String, String> propertiesForModel( EnumFacing facing )
{
return ImmutableMap.<String, String>builder().put( "color", getColor().name() );
}
public AEPartLocation getSide()
{
return this.side;

View File

@ -80,6 +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.
private boolean requiresDynamicRender = false;
private boolean inWorld = false;

View File

@ -32,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
@ -75,18 +76,18 @@ public class PartPlacement
private final ThreadLocal<Object> placing = new ThreadLocal<Object>();
private boolean wasCanceled = false;
public static boolean place( final ItemStack held, final BlockPos pos, EnumFacing side, final EntityPlayer player, final EnumHand hand, final World world, PlaceType pass, final int depth )
public static EnumActionResult place( final ItemStack held, final BlockPos pos, EnumFacing side, final EntityPlayer player, final EnumHand hand, final World world, PlaceType pass, final int depth )
{
if( depth > 3 )
{
return false;
return EnumActionResult.FAIL;
}
if( held != null && Platform.isWrench( player, held, pos ) && player.isSneaking() )
{
if( !Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
{
return false;
return EnumActionResult.FAIL;
}
final Block block = world.getBlockState( pos ).getBlock();
@ -140,10 +141,10 @@ public class PartPlacement
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return true;
return EnumActionResult.SUCCESS;
}
return false;
return EnumActionResult.PASS;
}
TileEntity tile = world.getTileEntity( pos );
@ -165,7 +166,7 @@ public class PartPlacement
{
if( host.getPart( AEPartLocation.INTERNAL ) == null )
{
return false;
return EnumActionResult.FAIL;
}
if( host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
@ -182,7 +183,7 @@ public class PartPlacement
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) );
}
}
return true;
return EnumActionResult.SUCCESS;
}
}
}
@ -190,10 +191,10 @@ public class PartPlacement
{
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
return true;
return EnumActionResult.SUCCESS;
}
}
return false;
return EnumActionResult.FAIL;
}
}
@ -233,7 +234,7 @@ public class PartPlacement
{
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return true;
return EnumActionResult.SUCCESS;
}
}
}
@ -242,7 +243,7 @@ public class PartPlacement
if( held == null || !( held.getItem() instanceof IPartItem ) )
{
return false;
return EnumActionResult.PASS;
}
BlockPos te_pos = pos;
@ -312,18 +313,18 @@ public class PartPlacement
{
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
return true;
return EnumActionResult.SUCCESS;
}
}
else if( host != null && !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
{
return false;
return EnumActionResult.FAIL;
}
}
if( host == null )
{
return false;
return EnumActionResult.PASS;
}
if( !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
@ -341,13 +342,13 @@ public class PartPlacement
}
if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) // /&& side !=
// AEPartLocation.INTERNAL
// )
// AEPartLocation.INTERNAL
// )
{
return place( held, te_pos, side.getOpposite(), player, hand, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
}
}
return false;
return EnumActionResult.PASS;
}
if( !world.isRemote )
@ -364,7 +365,7 @@ public class PartPlacement
{
if( !player.isSneaking() && sp.part.onActivate( player, hand, mop.hitVec ) )
{
return false;
return EnumActionResult.FAIL;
}
}
}
@ -372,7 +373,7 @@ public class PartPlacement
final DimensionalCoord dc = host.getLocation();
if( !Platform.hasPermissions( dc, player ) )
{
return false;
return EnumActionResult.FAIL;
}
final AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player, hand );
@ -401,7 +402,7 @@ public class PartPlacement
player.swingArm( hand );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return true;
return EnumActionResult.SUCCESS;
}
private static float getEyeOffset( final EntityPlayer p )
@ -494,7 +495,7 @@ public class PartPlacement
this.placing.set( event );
final ItemStack held = event.getEntityPlayer().getHeldItem( event.getHand() );
if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getHand(), event.getEntityPlayer().worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) )
if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getHand(), event.getEntityPlayer().worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) == EnumActionResult.SUCCESS )
{
event.setCanceled( true );
this.wasCanceled = true;

View File

@ -208,7 +208,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 1;
}

View File

@ -184,7 +184,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 5;
}

View File

@ -274,7 +274,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 1;
}

View File

@ -95,7 +95,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 5;
}

View File

@ -425,7 +425,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 16;
}

View File

@ -25,17 +25,23 @@ import java.util.Random;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
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.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.client.BakingPipeline;
import appeng.api.networking.IGridNode;
import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
@ -204,7 +210,7 @@ public class PartCableAnchor implements IPart
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 0;
}
@ -226,4 +232,12 @@ public class PartCableAnchor implements IPart
{
return what == BusSupport.CABLE || what == BusSupport.DENSE_CABLE;
}
@Override
@SideOnly( Side.CLIENT )
public List<BakedQuad> getOrBakeQuads( BakingPipeline<BakedQuad, BakedQuad> rotatingPipeline, IBlockState state, EnumFacing side, long rand )
{
return null;
}
}

View File

@ -138,7 +138,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 4;
}

View File

@ -265,7 +265,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 4;
}

View File

@ -159,7 +159,7 @@ public class PartToggleBus extends PartBasicState
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 5;
}

View File

@ -20,16 +20,29 @@ package appeng.parts.networking;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import com.google.common.collect.ImmutableSet;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.state.IBlockState;
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.util.EnumFacing;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.client.BakingPipeline;
import appeng.api.config.SecurityPermissions;
import appeng.api.definitions.IParts;
import appeng.api.implementations.parts.IPartCable;
@ -45,6 +58,10 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IReadOnlyCollection;
import appeng.client.render.model.ModelsCache;
import appeng.client.render.model.pipeline.FacingQuadRotator;
import appeng.client.render.model.pipeline.MatVecApplicator;
import appeng.client.render.model.pipeline.TypeTransformer;
import appeng.items.parts.ItemMultiPart;
import appeng.me.GridAccessException;
import appeng.parts.AEBasePart;
@ -54,6 +71,8 @@ import appeng.util.Platform;
public class PartCable extends AEBasePart implements IPartCable
{
private static final ImmutableSet<AEPartLocation> STRAIGHT_PART_LOCATIONS = ImmutableSet.of( AEPartLocation.DOWN, AEPartLocation.NORTH, AEPartLocation.EAST );
private final int[] channelsOnSide = { 0, 0, 0, 0, 0, 0 };
private EnumSet<AEPartLocation> connections = EnumSet.noneOf( AEPartLocation.class );
@ -180,7 +199,7 @@ public class PartCable extends AEBasePart implements IPartCable
final IPart p = ph.getPart( dir );
if( p instanceof IGridHost )
{
final double dist = p.cableConnectionRenderTo();
final double dist = p.getCableConnectionLength();
if( dist > 8 )
{
@ -281,14 +300,7 @@ public class PartCable extends AEBasePart implements IPartCable
final IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
for( final IGridConnection gc : set )
{
if( this.getProxy().getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( this.getProxy().getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) )
{
sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * thisSide.ordinal() );
}
else
{
sideOut |= ( gc.getUsedChannels() ) << ( 4 * thisSide.ordinal() );
}
sideOut |= ( gc.getUsedChannels() ) << ( 5 * thisSide.ordinal() );
}
}
}
@ -299,17 +311,7 @@ public class PartCable extends AEBasePart implements IPartCable
final AEPartLocation side = gc.getDirection( n );
if( side != AEPartLocation.INTERNAL )
{
final boolean isTier2a = this.getProxy().getNode().hasFlag( GridFlags.DENSE_CAPACITY );
final boolean isTier2b = gc.getOtherSide( this.getProxy().getNode() ).hasFlag( GridFlags.DENSE_CAPACITY );
if( isTier2a && isTier2b )
{
sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * side.ordinal() );
}
else
{
sideOut |= gc.getUsedChannels() << ( 4 * side.ordinal() );
}
sideOut |= gc.getUsedChannels() << ( 5 * side.ordinal() );
cs |= ( 1 << side.ordinal() );
}
}
@ -346,7 +348,7 @@ public class PartCable extends AEBasePart implements IPartCable
{
if( d != AEPartLocation.INTERNAL )
{
final int ch = ( sideOut >> ( d.ordinal() * 4 ) ) & 0xF;
final int ch = ( sideOut >> ( d.ordinal() * 5 ) ) & 0x1F;
if( ch != this.getChannelsOnSide( d.ordinal() ) )
{
channelsChanged = true;
@ -379,9 +381,53 @@ public class PartCable extends AEBasePart implements IPartCable
return !myC.equals( this.getConnections() ) || wasPowered != this.powered || channelsChanged;
}
protected boolean nonLinear( final EnumSet<AEPartLocation> sides )
@Override
@SideOnly( Side.CLIENT )
public List<BakedQuad> getOrBakeQuads( BakingPipeline rotatingPipeline, IBlockState state, EnumFacing side, long rand )
{
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 ) );
List<BakedQuad> elements = new ArrayList<>();
if( isStraight( getHost(), connections ) )
{
EnumFacing facing = getConnections().contains( AEPartLocation.DOWN ) ? EnumFacing.DOWN : getConnections().contains( AEPartLocation.NORTH ) ? EnumFacing.NORTH : getConnections().contains( AEPartLocation.EAST ) ? EnumFacing.EAST : EnumFacing.NORTH;
elements.addAll( rotatingPipeline.pipe( ModelsCache.INSTANCE.getOrLoadModel( withProperties( getCableConnectionType().getStraightModel(), propertiesForModel( facing ) ), getCableConnectionType().getStraightModel(), propertyTextureGetter( propertiesForModel( facing ) ) ).getQuads( state, side, rand ), null, state, connections.contains( AEPartLocation.DOWN ) ? EnumFacing.DOWN : connections.contains( AEPartLocation.NORTH ) ? EnumFacing.NORTH : connections.contains( AEPartLocation.EAST ) ? EnumFacing.EAST : EnumFacing.NORTH, rand ) );
}
else
{
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 ) )
{
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 )
{
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 ) );
}
}
}
}
return elements;
}
protected boolean isStraight( IPartHost host, final EnumSet<AEPartLocation> sides )
{
boolean b = false;
for( EnumFacing facing : EnumFacing.values() )
{
b |= host.getPart( facing ) != null;
}
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;
}
}
int getChannelsOnSide( final int i )

View File

@ -19,7 +19,10 @@
package appeng.parts.networking;
import com.google.common.collect.ImmutableMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkChannelsChanged;
@ -102,4 +105,11 @@ public class PartCableSmart extends PartCable
}
}
}
@Override
protected ImmutableMap.Builder<String, String> propertiesForModel( EnumFacing facing )
{
return facing != null ? super.propertiesForModel( facing ).put( "channels", String.valueOf( getChannelsOnSide( facing.ordinal() ) ) ) : super.propertiesForModel( facing );
}
}

View File

@ -19,8 +19,11 @@
package appeng.parts.networking;
import com.google.common.collect.ImmutableMap.Builder;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridHost;
@ -168,4 +171,11 @@ public class PartDenseCable extends PartCable
{
this.getHost().markForUpdate();
}
@Override
protected Builder<String, String> propertiesForModel( EnumFacing facing )
{
return facing != null ? super.propertiesForModel( facing ).put( "channels", String.valueOf( getChannelsOnSide( facing.ordinal() ) ) ) : super.propertiesForModel( facing );
}
}

View File

@ -110,7 +110,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 16;
}

View File

@ -149,7 +149,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public int cableConnectionRenderTo()
public int getCableConnectionLength()
{
return 1;
}

View File

@ -45,7 +45,6 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.block.networking.BlockCableBus;
import appeng.helpers.AEMultiTile;
import appeng.helpers.ICustomCollision;
import appeng.hooks.TickHandler;
@ -64,10 +63,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
private CableBusContainer cb = new CableBusContainer( this );
/**
* Immibis MB Support
*/
private final boolean ImmibisMicroblocks_TransformableTileEntityMarker = true;
private int oldLV = -1; // on re-calculate light when it changes
@TileEvent( TileEventType.WORLD_NBT_READ )
@ -94,27 +89,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
this.worldObj.checkLight( this.pos );
}
this.updateTileSetting();
return ret;
}
protected void updateTileSetting()
{
if( this.getCableBus().isRequiresDynamicRender() )
{
try
{
final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance();
tcb.copyFrom( this );
this.getWorld().setTileEntity( this.pos, tcb );
}
catch( final Throwable ignored )
{
}
}
}
protected void copyFrom( final TileCableBus oldTile )
{
final CableBusContainer tmpCB = this.getCableBus();
@ -285,7 +262,8 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
public boolean isBlocked( final EnumFacing side )
{
return !this.ImmibisMicroblocks_isSideOpen( side );
//TODO 1.10.2-R - Stuff.
return false;
}
@Override
@ -369,16 +347,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return this.getCableBus().isInWorld();
}
private boolean ImmibisMicroblocks_isSideOpen( final EnumFacing side )
{
return true;
}
public void ImmibisMicroblocks_onMicroblocksChanged()
{
this.getCableBus().updateConnections();
}
@Override
public boolean recolourBlock( final EnumFacing side, final AEColor colour, final EntityPlayer who )
{

View File

@ -1,45 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.tile.networking;
import appeng.block.networking.BlockCableBus;
public class TileCableBusTESR extends TileCableBus
{
@Override
protected void updateTileSetting()
{
if( !this.getCableBus().isRequiresDynamicRender() )
{
try
{
final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance();
tcb.copyFrom( this );
this.getWorld().setTileEntity( this.pos, tcb );
}
catch( final Throwable ignored )
{
}
}
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "appliedenergistics2:part/crafting_terminal"
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/covered/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 5.0, 5.0, 5.0 ],
"to": [ 11.0, 11.0, 11.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"south": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"up": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"down": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/covered/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 6.0, 6.0, 0.0 ],
"to": [ 10.0, 10.0, 5.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 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 16.0, 6.0, 11.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 0.0, 10.0, 5.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 11.0, 10.0, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/covered/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 5.0, 5.0, 0.0 ],
"to": [ 11.0, 11.0, 16.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#base", "uv": [ 0.0, 5.0, 5.0, 11.0 ] },
"south": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#base", "uv": [ 5.0, 5.0, 0.0, 11.0 ] },
"up": { "texture": "#base", "uv": [ 5.0, 0.0, 11.0, 5.0 ] },
"down": { "texture": "#base", "uv": [ 5.0, 11.0, 11.0, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/dense/${color}"
},
"elements": [
{
"name": "Base",
"from": [ 3.0, 3.0, 3.0 ],
"to": [ 13.0, 13.0, 13.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 5.5, 5.5, 10.5, 10.5 ] },
"east": { "texture": "#base", "uv": [ 5.5, 5.5, 10.5, 10.5 ] },
"south": { "texture": "#base", "uv": [ 10.5, 5.5, 5.5, 10.5 ] },
"west": { "texture": "#base", "uv": [ 10.5, 5.5, 5.5, 10.5 ] },
"up": { "texture": "#base", "uv": [ 5.5, 5.5, 10.5, 10.5 ] },
"down": { "texture": "#base", "uv": [ 5.5, 5.5, 10.5, 10.5 ] }
}
}
]
}

View File

@ -0,0 +1,34 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/dense/${color}",
"channels": "appliedenergistics2:parts/cable/dense/${channels}"
},
"elements": [
{
"name": "Base",
"from": [ 4.0, 4.0, 0.0 ],
"to": [ 12.0, 12.0, 3.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 ] },
"south": { "texture": "#base", "uv": [ 10.5, 10.5, 5.5, 5.5 ] },
"west": { "texture": "#base", "uv": [ 16.0, 5.5, 11.0, 10.5 ] },
"up": { "texture": "#base", "uv": [ 5.5, 0.0, 10.5, 5.0 ] },
"down": { "texture": "#base", "uv": [ 5.5, 11.0, 10.5, 16.0 ] }
}
},
{
"name": "Channels",
"from": [ 4.0, 4.0, 0.0 ],
"to": [ 12.0, 12.0, 3.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 ] },
"south": { "texture": "#channels", "uv": [ 10.5, 10.5, 5.5, 5.5 ] },
"west": { "texture": "#channels", "uv": [ 16.0, 5.5, 11.0, 10.5 ] },
"up": { "texture": "#channels", "uv": [ 5.5, 0.0, 10.5, 5.0 ] },
"down": { "texture": "#channels", "uv": [ 5.5, 11.0, 10.5, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,34 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/dense/${color}",
"channels": "appliedenergistics2:parts/cable/dense/${channels}"
},
"elements": [
{
"name": "Base",
"from": [ 3.0, 3.0, 0.0 ],
"to": [ 13.0, 13.0, 16.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#base", "uv": [ 0.0, 5.0, 5.0, 11.0 ] },
"south": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#base", "uv": [ 5.0, 5.0, 0.0, 11.0 ] },
"up": { "texture": "#base", "uv": [ 5.0, 0.0, 11.0, 5.0 ] },
"down": { "texture": "#base", "uv": [ 5.0, 11.0, 11.0, 16.0 ] }
}
},
{
"name": "Channels",
"from": [ 3.0, 3.0, 0.0 ],
"to": [ 13.0, 13.0, 16.0 ],
"faces": {
"north": { "texture": "#channels", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#channels", "uv": [ 0.0, 5.0, 5.0, 11.0 ] },
"south": { "texture": "#channels", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#channels", "uv": [ 5.0, 5.0, 0.0, 11.0 ] },
"up": { "texture": "#channels", "uv": [ 5.0, 0.0, 11.0, 5.0 ] },
"down": { "texture": "#channels", "uv": [ 5.0, 11.0, 11.0, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/glass/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 6.0, 6.0, 6.0 ],
"to": [ 10.0, 10.0, 10.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"east": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/glass/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 6.0, 6.0, 0.0 ],
"to": [ 10.0, 10.0, 6.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 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 16.0, 6.0, 10.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 0.0, 10.0, 6.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 10.0, 10.0, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,46 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/glass/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 6.0, 6.0, 6.0 ],
"to": [ 10.0, 10.0, 10.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"east": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }
}
},
{
"name": "Element",
"from": [ 6.0, 6.0, 0.0 ],
"to": [ 10.0, 10.0, 6.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 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 16.0, 6.0, 10.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 0.0, 10.0, 6.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 10.0, 10.0, 16.0 ] }
}
},
{
"name": "Element",
"from": [ 6.0, 6.0, 10.0 ],
"to": [ 10.0, 10.0, 16.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 6.0, 6.0, 10.0, 10.0 ] },
"east": { "texture": "#base", "uv": [ 0.0, 6.0, 6.0, 10.0 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 6.0, 6.0, 0.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 10.0, 10.0, 16.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 0.0, 10.0, 6.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/smart/${color}"
},
"elements": [
{
"name": "Element",
"from": [ 5.0, 5.0, 5.0 ],
"to": [ 11.0, 11.0, 11.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"south": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"up": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"down": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] }
}
}
]
}

View File

@ -0,0 +1,34 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/smart/${color}",
"channels": "appliedenergistics2:parts/cable/smart/${channels}"
},
"elements": [
{
"name": "Element",
"from": [ 6.0, 6.0, 0.0 ],
"to": [ 10.0, 10.0, 5.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 ] },
"south": { "texture": "#base", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#base", "uv": [ 16.0, 6.0, 11.0, 10.0 ] },
"up": { "texture": "#base", "uv": [ 6.0, 0.0, 10.0, 5.0 ] },
"down": { "texture": "#base", "uv": [ 6.0, 11.0, 10.0, 16.0 ] }
}
},
{
"name": "Channels",
"from": [ 6.0, 6.0, 0.0 ],
"to": [ 10.0, 10.0, 5.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 ] },
"south": { "texture": "#channels", "uv": [ 10.0, 6.0, 6.0, 10.0 ] },
"west": { "texture": "#channels", "uv": [ 16.0, 6.0, 11.0, 10.0 ] },
"up": { "texture": "#channels", "uv": [ 6.0, 0.0, 10.0, 5.0 ] },
"down": { "texture": "#channels", "uv": [ 6.0, 11.0, 10.0, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,34 @@
{
"textures": {
"base": "appliedenergistics2:parts/cable/smart/${color}",
"channels": "appliedenergistics2:parts/cable/smart/${channels}"
},
"elements": [
{
"name": "Element",
"from": [ 5.0, 5.0, 0.0 ],
"to": [ 11.0, 11.0, 16.0 ],
"faces": {
"north": { "texture": "#base", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#base", "uv": [ 0.0, 5.0, 5.0, 11.0 ] },
"south": { "texture": "#base", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#base", "uv": [ 5.0, 5.0, 0.0, 11.0 ] },
"up": { "texture": "#base", "uv": [ 5.0, 0.0, 11.0, 5.0 ] },
"down": { "texture": "#base", "uv": [ 5.0, 11.0, 11.0, 16.0 ] }
}
},
{
"name": "Channels",
"from": [ 5.0, 5.0, 0.0 ],
"to": [ 11.0, 11.0, 16.0 ],
"faces": {
"north": { "texture": "#channels", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
"east": { "texture": "#channels", "uv": [ 0.0, 5.0, 5.0, 11.0 ] },
"south": { "texture": "#channels", "uv": [ 11.0, 5.0, 5.0, 11.0 ] },
"west": { "texture": "#channels", "uv": [ 5.0, 5.0, 0.0, 11.0 ] },
"up": { "texture": "#channels", "uv": [ 5.0, 0.0, 11.0, 5.0 ] },
"down": { "texture": "#channels", "uv": [ 5.0, 11.0, 11.0, 16.0 ] }
}
}
]
}

View File

@ -0,0 +1,20 @@
{
"textures": {
"0": "appliedenergistics2:parts/CableAnchor"
},
"elements": [
{
"name": "Element",
"from": [ 7.0, 7.0, 0.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, 6.0, 2.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 2.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 6.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 6.0 ] }
}
}
]
}

View File

@ -0,0 +1,3 @@
{
"parent": "appliedenergistics2:parts/cableanchor"
}

View File

@ -0,0 +1,75 @@
{
"textures": {
"frame": "appliedenergistics2:parts/crafting_terminal/frame",
"sides": "appliedenergistics2:parts/crafting_terminal/sides",
"back": "appliedenergistics2:parts/crafting_terminal/back",
"l0": "appliedenergistics2:parts/crafting_terminal/l0",
"l1": "appliedenergistics2:parts/crafting_terminal/l1",
"l2": "appliedenergistics2:parts/crafting_terminal/l2",
"SidesStatus": "appliedenergistics2:parts/crafting_terminal/sidesstatus",
"Backlights": "appliedenergistics2:parts/crafting_terminal/backlights"
},
"elements": [
{
"name": "Base",
"from": [ 2.0, 2.0, 0.0 ],
"to": [ 14.0, 14.0, 1.0 ],
"faces": {
"north": { "texture": "frame", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"east": { "texture": "sides", "uv": [ 0.0, 2.0, 1.0, 14.0 ] },
"south": { "texture": "back", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
"west": { "texture": "sides", "uv": [ 15.0, 2.0, 16.0, 14.0 ] },
"up": { "texture": "sides", "uv": [ 2.0, 0.0, 14.0, 1.0 ] },
"down": { "texture": "sides", "uv": [ 2.0, 15.0, 14.0, 16.0 ] }
}
},
{
"name": "l0",
"from": [ 2.0, 2.0, 0.0 ],
"to": [ 14.0, 14.0, 1.0 ],
"faces": {
"north": { "texture": "l0", "tintindex": 1, "uv": [ 2.0, 2.0, 14.0, 14.0 ] }
}
},
{
"name": "l1",
"from": [ 2.0, 2.0, 0.0 ],
"to": [ 14.0, 14.0, 1.0 ],
"faces": {
"north": { "texture": "l1", "tintindex": 2, "uv": [ 2.0, 2.0, 14.0, 14.0 ] }
}
},
{
"name": "l2",
"from": [ 2.0, 2.0, 0.0 ],
"to": [ 14.0, 14.0, 1.0 ],
"faces": {
"north": { "texture": "l2", "tintindex": 3, "uv": [ 2.0, 2.0, 14.0, 14.0 ] }
}
},
{
"name": "Back",
"from": [ 4.0, 4.0, 1.0 ],
"to": [ 12.0, 12.0, 2.0 ],
"faces": {
"north": { "texture": "back", "uv": [ 4.0, 4.0, 12.0, 12.0 ] },
"east": { "texture": "SidesStatus", "uv": [ 0.0, 4.0, 1.0, 12.0 ] },
"south": { "texture": "back", "uv": [ 4.0, 4.0, 12.0, 12.0 ] },
"west": { "texture": "SidesStatus", "uv": [ 15.0, 4.0, 16.0, 12.0 ] },
"up": { "texture": "SidesStatus", "uv": [ 4.0, 0.0, 12.0, 1.0 ] },
"down": { "texture": "SidesStatus", "uv": [ 4.0, 15.0, 12.0, 16.0 ] }
}
},
{
"name": "Backlights",
"from": [ 4.0, 4.0, 1.0 ],
"to": [ 12.0, 12.0, 2.0 ],
"faces": {
"east": { "texture": "Backlights", "tintindex": 0, "uv": [ 0.0, 4.0, 1.0, 12.0 ] },
"west": { "texture": "Backlights", "tintindex": 0, "uv": [ 15.0, 4.0, 16.0, 12.0 ] },
"up": { "texture": "Backlights", "tintindex": 0, "uv": [ 4.0, 0.0, 12.0, 1.0 ] },
"down": { "texture": "Backlights", "tintindex": 0, "uv": [ 4.0, 15.0, 12.0, 16.0 ] }
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Some files were not shown because too many files have changed in this diff Show More