Part models
This commit is contained in:
@@ -19,125 +19,31 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.StaticItemColor;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.parts.automation.PlaneConnections;
|
||||
import appeng.parts.automation.PlaneModel;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
|
||||
private final PartModels partModels;
|
||||
private final AEColor color;
|
||||
|
||||
public ItemPartRendering( PartModels partModels )
|
||||
{
|
||||
this.partModels = partModels;
|
||||
public ItemPartRendering() {
|
||||
this.color = AEColor.TRANSPARENT;
|
||||
}
|
||||
|
||||
public ItemPartRendering(AEColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
|
||||
// FIXME rendering.meshDefinition( this::getItemMeshDefinition );
|
||||
|
||||
rendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
|
||||
|
||||
// Register all item models as variants so they get loaded
|
||||
rendering.variants( Arrays.stream( PartType.values() )
|
||||
.filter( f -> f != PartType.INVALID_TYPE )
|
||||
.flatMap( part -> part.getItemModels().stream() )
|
||||
.collect( Collectors.toList() ) );
|
||||
|
||||
// Register the built-in models for annihilation planes
|
||||
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/annihilation_plane" );
|
||||
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );
|
||||
ResourceLocation fluidAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_annihilation_plane" );
|
||||
ResourceLocation fluidAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_annihilation_plane_on" );
|
||||
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/identity_annihilation_plane" );
|
||||
ResourceLocation identityAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/identity_annihilation_plane_on" );
|
||||
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/formation_plane" );
|
||||
ResourceLocation formationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/formation_plane_on" );
|
||||
ResourceLocation fluidFormationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_formation_plane" );
|
||||
ResourceLocation fluidFormationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_formation_plane_on" );
|
||||
ResourceLocation sidesTexture = new ResourceLocation( AppEng.MOD_ID, "parts/plane_sides" );
|
||||
ResourceLocation backTexture = new ResourceLocation( AppEng.MOD_ID, "parts/transition_plane_back" );
|
||||
|
||||
List<String> modelNames = new ArrayList<>();
|
||||
|
||||
for( PlaneConnections connection : PlaneConnections.PERMUTATIONS )
|
||||
{
|
||||
PlaneModel model = new PlaneModel( annihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( annihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( identityAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/identity_annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/identity_annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( identityAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/identity_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/identity_annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( formationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/formation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/formation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( formationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/formation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/formation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidFormationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_formation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_formation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidFormationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_formation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_formation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
}
|
||||
|
||||
// base p2p model with frequency
|
||||
// FIXME rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
|
||||
|
||||
List<ResourceLocation> partResourceLocs = modelNames.stream()
|
||||
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
|
||||
.collect( Collectors.toList() );
|
||||
this.partModels.registerModels( partResourceLocs );
|
||||
rendering.color( new StaticItemColor(color) );
|
||||
}
|
||||
|
||||
// FIXME private ModelResourceLocation getItemMeshDefinition( ItemStack is )
|
||||
// FIXME {
|
||||
// FIXME PartType partType = this.item.getTypeByStack( is );
|
||||
// FIXME int variant = this.item.variantOf( is.getDamage() );
|
||||
// FIXME return partType.getItemModels().get( variant );
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
@@ -19,28 +19,20 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.parts.p2p.*;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
@@ -69,68 +61,40 @@ import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartSemiDarkPanel;
|
||||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public enum PartType
|
||||
{
|
||||
INVALID_TYPE( -1, "invalid", EnumSet.of( AEFeature.CORE ), EnumSet.noneOf( IntegrationType.class ), null ),
|
||||
INVALID_TYPE(EnumSet.of( AEFeature.CORE ), EnumSet.noneOf( IntegrationType.class ), null ),
|
||||
|
||||
CABLE_GLASS( 0, "cable_glass", EnumSet.of( AEFeature.GLASS_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
|
||||
CABLE_GLASS(EnumSet.of( AEFeature.GLASS_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_COVERED( 20, "cable_covered", EnumSet.of( AEFeature.COVERED_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
|
||||
CABLE_COVERED(EnumSet.of( AEFeature.COVERED_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_SMART( 40, "cable_smart", EnumSet.of( AEFeature.CHANNELS, AEFeature.SMART_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
|
||||
CABLE_SMART(EnumSet.of( AEFeature.CHANNELS, AEFeature.SMART_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_DENSE_SMART( 60, "cable_dense_smart", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
CABLE_DENSE_SMART(EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartDenseCableSmart.class )
|
||||
{
|
||||
@Override
|
||||
@@ -138,18 +102,9 @@ public enum PartType
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_DENSE_COVERED( 500, "cable_dense_covered", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
CABLE_DENSE_COVERED(EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartDenseCableCovered.class )
|
||||
{
|
||||
@Override
|
||||
@@ -157,78 +112,69 @@ public enum PartType
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
TOGGLE_BUS( 80, "toggle_bus", EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
|
||||
TOGGLE_BUS(EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
|
||||
|
||||
INVERTED_TOGGLE_BUS( 100, "inverted_toggle_bus", EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
|
||||
INVERTED_TOGGLE_BUS(EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
|
||||
|
||||
CABLE_ANCHOR( 120, "cable_anchor", EnumSet.of( AEFeature.CABLE_ANCHOR ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
|
||||
CABLE_ANCHOR(EnumSet.of( AEFeature.CABLE_ANCHOR ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
|
||||
|
||||
QUARTZ_FIBER( 140, "quartz_fiber", EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
QUARTZ_FIBER(EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
|
||||
MONITOR( 160, "monitor", EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class, "itemIlluminatedPanel" ),
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
SEMI_DARK_MONITOR( 180, "semi_dark_monitor", EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
SEMI_DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
DARK_MONITOR( 200, "dark_monitor", EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
STORAGE_BUS( 220, "storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
STORAGE_BUS(EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS(EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
|
||||
|
||||
IMPORT_BUS( 240, "import_bus", EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
|
||||
IMPORT_BUS(EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
|
||||
|
||||
FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
FLUID_IMPORT_BUS(EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
|
||||
EXPORT_BUS( 260, "export_bus", EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
|
||||
EXPORT_BUS(EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
|
||||
|
||||
FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
FLUID_EXPORT_BUS(EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
|
||||
LEVEL_EMITTER( 280, "level_emitter", EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
LEVEL_EMITTER(EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER(EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
|
||||
|
||||
ANNIHILATION_PLANE( 300, "annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
|
||||
ANNIHILATION_PLANE(EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
|
||||
|
||||
IDENTITY_ANNIHILATION_PLANE( 301, "identity_annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
IDENTITY_ANNIHILATION_PLANE(EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
|
||||
|
||||
FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
FLUID_ANNIHILATION_PLANE(EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
|
||||
|
||||
FORMATION_PLANE( 320, "formation_plane", EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
|
||||
FORMATION_PLANE(EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
|
||||
|
||||
FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
FLUID_FORMATION_PLANE(EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
|
||||
|
||||
PATTERN_TERMINAL( 340, "pattern_terminal", EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
|
||||
PATTERN_TERMINAL(EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
|
||||
|
||||
CRAFTING_TERMINAL( 360, "crafting_terminal", EnumSet.of( AEFeature.CRAFTING_TERMINAL ), EnumSet
|
||||
CRAFTING_TERMINAL(EnumSet.of( AEFeature.CRAFTING_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartCraftingTerminal.class ),
|
||||
|
||||
TERMINAL( 380, "terminal", EnumSet.of( AEFeature.TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
|
||||
TERMINAL(EnumSet.of( AEFeature.TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
|
||||
|
||||
STORAGE_MONITOR( 400, "storage_monitor", EnumSet.of( AEFeature.STORAGE_MONITOR ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
|
||||
STORAGE_MONITOR(EnumSet.of( AEFeature.STORAGE_MONITOR ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
|
||||
|
||||
CONVERSION_MONITOR( 420, "conversion_monitor", EnumSet.of( AEFeature.PART_CONVERSION_MONITOR ), EnumSet
|
||||
CONVERSION_MONITOR(EnumSet.of( AEFeature.PART_CONVERSION_MONITOR ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
|
||||
|
||||
INTERFACE( 440, "interface", EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
INTERFACE(EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
FLUID_INTERFACE(EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
|
||||
P2P_TUNNEL_ME( 460, "p2p_tunnel_me", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
P2P_TUNNEL_ME(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -238,7 +184,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_REDSTONE( 461, "p2p_tunnel_redstone", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
P2P_TUNNEL_REDSTONE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -248,7 +194,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_ITEMS( 462, "p2p_tunnel_items", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
P2P_TUNNEL_ITEM(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -258,7 +204,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_FLUIDS( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
P2P_TUNNEL_FLUID(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -278,7 +224,7 @@ public enum PartType
|
||||
//FIXME }
|
||||
//FIXME },
|
||||
|
||||
P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
P2P_TUNNEL_LIGHT(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -288,7 +234,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_FE( 469, "p2p_tunnel_fe", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
P2P_TUNNEL_FE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -301,100 +247,50 @@ public enum PartType
|
||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
|
||||
INTERFACE_TERMINAL( 480, "interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
INTERFACE_TERMINAL(EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
|
||||
|
||||
FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
FLUID_TERMINAL(EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
|
||||
private final int baseDamage;
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
private final Class<? extends IPart> myPart;
|
||||
private final GuiText extraName;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private List<ModelResourceLocation> itemModels;
|
||||
private final Set<ResourceLocation> models;
|
||||
private final boolean enabled;
|
||||
private Constructor<? extends IPart> constructor;
|
||||
private final String oreName;
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c)
|
||||
{
|
||||
this( baseMetaValue, itemModel, features, integrations, c, null, null );
|
||||
this(features, integrations, c, null, null );
|
||||
}
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final String oreDict )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final String oreDict)
|
||||
{
|
||||
this( baseMetaValue, itemModel, features, integrations, c, null, oreDict );
|
||||
this(features, integrations, c, null, oreDict );
|
||||
}
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en)
|
||||
{
|
||||
this( baseMetaValue, itemModel, features, integrations, c, en, null );
|
||||
this(features, integrations, c, en, null );
|
||||
}
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en, final String oreDict )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en, final String oreDict)
|
||||
{
|
||||
this.baseDamage = baseMetaValue;
|
||||
this.features = Collections.unmodifiableSet( features );
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
this.myPart = c;
|
||||
this.extraName = en;
|
||||
this.oreName = oreDict;
|
||||
|
||||
// The part is enabled if all features + integrations it needs are enabled
|
||||
this.enabled = features.stream().allMatch( AEConfig.instance()::isFeatureEnabled ); /* FIXME && integrations.stream()
|
||||
.allMatch( IntegrationRegistry.INSTANCE::isEnabled ); */
|
||||
|
||||
if( this.enabled )
|
||||
if( c != null )
|
||||
{
|
||||
// Only load models if the part is enabled, otherwise we also run into class-loading issues while
|
||||
// scanning for annotations
|
||||
if( Platform.isClientInstall() )
|
||||
{
|
||||
this.itemModels = this.createItemModels( itemModel );
|
||||
}
|
||||
if( c != null )
|
||||
{
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Platform.isClientInstall() )
|
||||
{
|
||||
this.itemModels = Collections.emptyList();
|
||||
}
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return ImmutableList.of( modelFromBaseName( baseName ) );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private static ModelResourceLocation modelFromBaseName( String baseName )
|
||||
{
|
||||
return new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "part/" + baseName ), "inventory" );
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
int getBaseDamage()
|
||||
{
|
||||
return this.baseDamage;
|
||||
}
|
||||
|
||||
public boolean isCable()
|
||||
{
|
||||
return false;
|
||||
@@ -420,22 +316,11 @@ public enum PartType
|
||||
return this.extraName;
|
||||
}
|
||||
|
||||
void setConstructor( final Constructor<? extends IPart> constructor )
|
||||
{
|
||||
this.constructor = constructor;
|
||||
}
|
||||
|
||||
public String getOreName()
|
||||
{
|
||||
return this.oreName;
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public List<ModelResourceLocation> getItemModels()
|
||||
{
|
||||
return this.itemModels;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getModels()
|
||||
{
|
||||
return this.models;
|
||||
|
||||
Reference in New Issue
Block a user