Reimplemented cable and parts rendering.
This commit is contained in:
@@ -57,13 +57,14 @@ import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
|
||||
public class ApiPart implements IPartHelper
|
||||
{
|
||||
|
||||
private final Map<String, Class> tileImplementations = new HashMap<String, Class>();
|
||||
private final Map<String, Class<? extends AEBaseTile>> tileImplementations = new HashMap<>();
|
||||
private final Map<Class<?>, String> interfaces2Layer = new HashMap<Class<?>, String>();
|
||||
private final Map<String, Class> roots = new HashMap<String, Class>();
|
||||
private final List<String> desc = new LinkedList<String>();
|
||||
@@ -79,18 +80,13 @@ public class ApiPart implements IPartHelper
|
||||
}
|
||||
}
|
||||
|
||||
public Class getCombinedInstance( final String base )
|
||||
public Class<? extends AEBaseTile> getCombinedInstance( final Class<? extends AEBaseTile> baseClass )
|
||||
{
|
||||
String base = baseClass.getName();
|
||||
|
||||
if( this.desc.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Class.forName( base );
|
||||
}
|
||||
catch( final ClassNotFoundException e )
|
||||
{
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
return baseClass;
|
||||
}
|
||||
|
||||
final String description = base + ':' + Joiner.on( ";" ).skipNulls().join( this.desc.iterator() );
|
||||
@@ -101,25 +97,8 @@ public class ApiPart implements IPartHelper
|
||||
}
|
||||
|
||||
String f = base;// TileCableBus.class.getName();
|
||||
String Addendum = "";
|
||||
try
|
||||
{
|
||||
Addendum = Class.forName( base ).getSimpleName();
|
||||
}
|
||||
catch( final ClassNotFoundException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
Class myCLass;
|
||||
|
||||
try
|
||||
{
|
||||
myCLass = Class.forName( f );
|
||||
}
|
||||
catch( final ClassNotFoundException e )
|
||||
{
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
String Addendum = baseClass.getSimpleName();
|
||||
Class<? extends AEBaseTile> myClass = baseClass;
|
||||
|
||||
String path = f;
|
||||
|
||||
@@ -128,21 +107,20 @@ public class ApiPart implements IPartHelper
|
||||
try
|
||||
{
|
||||
final String newPath = path + ';' + name;
|
||||
myCLass = this.getClassByDesc( Addendum, newPath, f, this.interfaces2Layer.get( Class.forName( name ) ) );
|
||||
myClass = this.getClassByDesc( baseClass.getSimpleName(), newPath, f, this.interfaces2Layer.get( Class.forName( name ) ) );
|
||||
path = newPath;
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.warn( "Error loading " + name );
|
||||
AELog.debug( t );
|
||||
// throw new RuntimeException( t );
|
||||
}
|
||||
f = myCLass.getName();
|
||||
f = myClass.getName();
|
||||
}
|
||||
|
||||
this.tileImplementations.put( description, myCLass );
|
||||
this.tileImplementations.put( description, myClass );
|
||||
|
||||
return myCLass;
|
||||
return myClass;
|
||||
}
|
||||
|
||||
private Class getClassByDesc( final String addendum, final String fullPath, final String root, final String next )
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -85,6 +86,7 @@ import appeng.bootstrap.IItemRendering;
|
||||
import appeng.client.render.model.GlassModel;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockCubeGenerator;
|
||||
import appeng.debug.BlockItemGen;
|
||||
@@ -101,6 +103,8 @@ import appeng.decorative.solid.BlockSkyStone;
|
||||
import appeng.decorative.solid.BlockSkyStone.SkystoneType;
|
||||
import appeng.decorative.stair.BlockStairCommon;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
import appeng.tile.networking.CableBusTESR;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
@@ -184,7 +188,7 @@ public final class ApiBlocks implements IBlocks
|
||||
private final IBlockDefinition phantomNode;
|
||||
private final IBlockDefinition cubeGenerator;
|
||||
|
||||
public ApiBlocks( FeatureFactory registry )
|
||||
public ApiBlocks( FeatureFactory registry, PartModels partModels )
|
||||
{
|
||||
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
||||
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
||||
@@ -357,8 +361,15 @@ public final class ApiBlocks implements IBlocks
|
||||
this.chiseledQuartzStairs = makeStairs( "chiseled_quartz_stairs", registry, this.chiseledQuartzBlock() );
|
||||
this.quartzPillarStairs = makeStairs( "quartz_pillar_stairs", registry, this.quartzPillar() );
|
||||
|
||||
this.multiPart = registry.block( "multipart_block", BlockCableBus::new )
|
||||
.rendering( new CableBusRendering() )
|
||||
this.multiPart = registry.block( "cable_bus", BlockCableBus::new )
|
||||
.rendering( new CableBusRendering( partModels ) )
|
||||
.postInit( (block, item) -> {
|
||||
( (BlockCableBus) block ).setupTile();
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() );
|
||||
}
|
||||
} )
|
||||
.build();
|
||||
|
||||
// TODO Re-Add Slabs...
|
||||
|
||||
@@ -22,13 +22,13 @@ package appeng.core.api.definitions;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.DamagedItemDefinition;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
import appeng.items.parts.ItemMultipartRendering;
|
||||
import appeng.items.parts.PartType;
|
||||
@@ -78,13 +78,19 @@ public final class ApiParts implements IParts
|
||||
private final IItemDefinition storageMonitor;
|
||||
private final IItemDefinition conversionMonitor;
|
||||
|
||||
public ApiParts( FeatureFactory registry, IPartHelper partHelper )
|
||||
public ApiParts( FeatureFactory registry, PartModels partModels )
|
||||
{
|
||||
final ItemMultiPart itemMultiPart = new ItemMultiPart( partHelper );
|
||||
final ItemMultiPart itemMultiPart = new ItemMultiPart();
|
||||
registry.item( "multipart", () -> itemMultiPart )
|
||||
.rendering( new ItemMultipartRendering( itemMultiPart ) )
|
||||
.rendering( new ItemMultipartRendering( partModels, itemMultiPart ) )
|
||||
.build();
|
||||
|
||||
// Register all part models
|
||||
for( PartType partType : PartType.values() )
|
||||
{
|
||||
partModels.registerModels( partType.getModels() );
|
||||
}
|
||||
|
||||
this.cableSmart = constructColoredDefinition( itemMultiPart, PartType.CableSmart );
|
||||
this.cableCovered = constructColoredDefinition( itemMultiPart, PartType.CableCovered );
|
||||
this.cableGlass = constructColoredDefinition( itemMultiPart, PartType.CableGlass );
|
||||
|
||||
Reference in New Issue
Block a user