Fixes API compilation problem.
This commit is contained in:
parent
11625ea240
commit
9c561d550b
5 changed files with 67 additions and 72 deletions
|
@ -24,38 +24,32 @@
|
|||
package appeng.api.util;
|
||||
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.client.render.cablebus.CableCoreType;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
public enum AECableType
|
||||
{
|
||||
/**
|
||||
* No Cable present.
|
||||
*/
|
||||
NONE( null, 0, null, null ),
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* Connections to this block should render as glass.
|
||||
*/
|
||||
GLASS( "glass", 0, CableCoreType.GLASS, "parts/cable/glass/" ),
|
||||
GLASS,
|
||||
|
||||
/**
|
||||
* Connections to this block should render as covered.
|
||||
*/
|
||||
COVERED( "covered", 0, CableCoreType.COVERED, "parts/cable/covered/" ),
|
||||
COVERED,
|
||||
|
||||
/**
|
||||
* Connections to this block should render as smart.
|
||||
*/
|
||||
SMART( "smart", 8, CableCoreType.COVERED, "parts/cable/smart/" ),
|
||||
SMART,
|
||||
|
||||
/**
|
||||
* Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||
*/
|
||||
DENSE( "dense", 32, CableCoreType.DENSE, "parts/cable/dense/" );
|
||||
DENSE;
|
||||
|
||||
public static final AECableType[] VALIDCABLES = {
|
||||
GLASS,
|
||||
|
@ -64,60 +58,4 @@ public enum AECableType
|
|||
DENSE
|
||||
};
|
||||
|
||||
private final CableCoreType coreType;
|
||||
private final String type;
|
||||
private final int displayedChannels;
|
||||
private final ResourceLocation model;
|
||||
private final ResourceLocation connectionModel;
|
||||
private final ResourceLocation straightModel;
|
||||
private final String textureFolder;
|
||||
|
||||
private AECableType( String type, int displayedChannels, CableCoreType coreType, String textureFolder )
|
||||
{
|
||||
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" );
|
||||
this.coreType = coreType;
|
||||
this.textureFolder = textureFolder;
|
||||
}
|
||||
|
||||
public int displayedChannels()
|
||||
{
|
||||
return displayedChannels;
|
||||
}
|
||||
|
||||
public ResourceLocation getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public ResourceLocation getConnectionModel()
|
||||
{
|
||||
return connectionModel;
|
||||
}
|
||||
|
||||
public ResourceLocation getStraightModel()
|
||||
{
|
||||
return straightModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type of core that should be rendered when this cable isn't straight and needs to have a core to attach connections to. Is null for the NULL
|
||||
* cable.
|
||||
*/
|
||||
public CableCoreType getCoreType()
|
||||
{
|
||||
return coreType;
|
||||
}
|
||||
|
||||
public ResourceLocation getConnectionTexture( AEColor color )
|
||||
{
|
||||
if ( textureFolder == null ) {
|
||||
throw new IllegalStateException( "Cable type " + name() + " does not support connections." );
|
||||
}
|
||||
return new ResourceLocation( AppEng.MOD_ID, textureFolder + color.name().toLowerCase() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,7 @@ class CableBuilder
|
|||
|
||||
for( AEColor color : AEColor.values() )
|
||||
{
|
||||
colorTextures.put( color, bakedTextureGetter.apply( type.getConnectionTexture( color ) ) );
|
||||
colorTextures.put( color, bakedTextureGetter.apply( getConnectionTexture( type, color ) ) );
|
||||
}
|
||||
|
||||
connectionTextures.put( type, colorTextures );
|
||||
|
@ -69,6 +70,29 @@ class CableBuilder
|
|||
smartCableTextures = new SmartCableTextures( bakedTextureGetter );
|
||||
}
|
||||
|
||||
static ResourceLocation getConnectionTexture( AECableType cableType, AEColor color )
|
||||
{
|
||||
String textureFolder;
|
||||
switch (cableType) {
|
||||
case GLASS:
|
||||
textureFolder = "parts/cable/glass/";
|
||||
break;
|
||||
case COVERED:
|
||||
textureFolder = "parts/cable/covered/";
|
||||
break;
|
||||
case SMART:
|
||||
textureFolder = "parts/cable/smart/";
|
||||
break;
|
||||
case DENSE:
|
||||
textureFolder = "parts/cable/dense/";
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException( "Cable type " + cableType + " does not support connections." );
|
||||
}
|
||||
|
||||
return new ResourceLocation( AppEng.MOD_ID, textureFolder + color.name().toLowerCase() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the core of a cable to the given list of quads.
|
||||
*
|
||||
|
@ -656,7 +680,7 @@ class CableBuilder
|
|||
{
|
||||
for( AEColor color : AEColor.values() )
|
||||
{
|
||||
locations.add( cableType.getConnectionTexture( color ) );
|
||||
locations.add( getConnectionTexture( cableType, color ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ public class CableBusBakedModel implements IBakedModel
|
|||
*/
|
||||
public List<TextureAtlasSprite> getParticleTextures( CableBusRenderState renderState )
|
||||
{
|
||||
CableCoreType coreType = renderState.getCableType().getCoreType();
|
||||
CableCoreType coreType = CableCoreType.fromCableType( renderState.getCableType() );
|
||||
AEColor cableColor = renderState.getCableColor();
|
||||
|
||||
if( coreType != null )
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
@ -20,6 +26,24 @@ public enum CableCoreType
|
|||
COVERED( "parts/cable/core/covered" ),
|
||||
DENSE( "parts/cable/core/dense" );
|
||||
|
||||
private static final Map<AECableType, CableCoreType> cableMapping = generateCableMapping();
|
||||
|
||||
/**
|
||||
* Creates the mapping that assigns a cable core type to an AE cable type.
|
||||
*/
|
||||
private static Map<AECableType, CableCoreType> generateCableMapping()
|
||||
{
|
||||
|
||||
Map<AECableType, CableCoreType> result = new EnumMap<>( AECableType.class );
|
||||
|
||||
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
||||
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
||||
result.put( AECableType.SMART, CableCoreType.COVERED );
|
||||
result.put( AECableType.DENSE, CableCoreType.DENSE );
|
||||
|
||||
return ImmutableMap.copyOf( result );
|
||||
}
|
||||
|
||||
private final String textureFolder;
|
||||
|
||||
CableCoreType( String textureFolder )
|
||||
|
@ -27,9 +51,18 @@ public enum CableCoreType
|
|||
this.textureFolder = textureFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type of core that should be rendered when the given cable isn't straight and needs to have a core to attach connections to.
|
||||
* Is null for the NULL cable.
|
||||
*/
|
||||
public static CableCoreType fromCableType( AECableType cableType )
|
||||
{
|
||||
return cableMapping.get( cableType );
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture( AEColor color )
|
||||
{
|
||||
return new ResourceLocation( AppEng.MOD_ID, textureFolder + "/" + color.name().toLowerCase() );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1163,7 +1163,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||
{
|
||||
renderState.setCableColor( cable.getCableColor() );
|
||||
renderState.setCableType( cable.getCableConnectionType() );
|
||||
renderState.setCoreType( cable.getCableConnectionType().getCoreType() );
|
||||
renderState.setCoreType( CableCoreType.fromCableType( cable.getCableConnectionType() ) );
|
||||
|
||||
// Check each outgoing connection for the desired characteristics
|
||||
for( EnumFacing facing : EnumFacing.values() )
|
||||
|
|
Loading…
Reference in a new issue