Reimplemented cable and parts rendering.
This commit is contained in:
@@ -1,25 +1,35 @@
|
||||
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.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
public class ItemMultipartRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
|
||||
private final PartModels partModels;
|
||||
|
||||
private final ItemMultiPart item;
|
||||
|
||||
public ItemMultipartRendering( ItemMultiPart item )
|
||||
public ItemMultipartRendering( PartModels partModels, ItemMultiPart item )
|
||||
{
|
||||
this.partModels = partModels;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@@ -35,6 +45,52 @@ public class ItemMultipartRendering extends ItemRenderingCustomizer
|
||||
rendering.variants( Arrays.stream( PartType.values() )
|
||||
.flatMap( part -> part.getItemModels().stream() )
|
||||
.collect( Collectors.toList() ) );
|
||||
|
||||
// TODO All of this has to go somewhere else! (I.e. when the part is registered)
|
||||
// Register the built-in models for annihilation planes
|
||||
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/annihilation_plane" );
|
||||
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );
|
||||
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/identity_annihilation_plane" );
|
||||
ResourceLocation identityAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/identity_annihilation_plane_on" );
|
||||
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/formation_plane" );
|
||||
ResourceLocation formationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/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( 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() );
|
||||
|
||||
}
|
||||
|
||||
List<ResourceLocation> partResourceLocs = modelNames.stream()
|
||||
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
|
||||
.collect( Collectors.toList() );
|
||||
partModels.registerModels( partResourceLocs );
|
||||
}
|
||||
|
||||
private ModelResourceLocation getItemMeshDefinition( ItemStack is )
|
||||
|
||||
Reference in New Issue
Block a user