reformatted all src files (#141)
This commit is contained in:
@@ -25,23 +25,20 @@ import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
public class BlockColorComponent implements IInitComponent
|
||||
{
|
||||
public class BlockColorComponent implements IInitComponent {
|
||||
|
||||
private final Block block;
|
||||
private final Block block;
|
||||
|
||||
private final IBlockColor blockColor;
|
||||
private final IBlockColor blockColor;
|
||||
|
||||
public BlockColorComponent( Block block, IBlockColor blockColor )
|
||||
{
|
||||
this.block = block;
|
||||
this.blockColor = blockColor;
|
||||
}
|
||||
public BlockColorComponent(Block block, IBlockColor blockColor) {
|
||||
this.block = block;
|
||||
this.blockColor = blockColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize( Side side )
|
||||
{
|
||||
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( this.blockColor, this.block );
|
||||
}
|
||||
@Override
|
||||
public void initialize(Side side) {
|
||||
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(this.blockColor, this.block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,39 +19,34 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.client.render.model.BuiltInModelLoader;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.client.render.model.BuiltInModelLoader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class BuiltInModelComponent implements IPreInitComponent
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class BuiltInModelComponent implements IPreInitComponent {
|
||||
|
||||
private final Map<String, IModel> builtInModels = new HashMap<>();
|
||||
private final Map<String, IModel> builtInModels = new HashMap<>();
|
||||
|
||||
private boolean hasInitialized = false;
|
||||
private boolean hasInitialized = false;
|
||||
|
||||
public void addModel( String path, IModel model )
|
||||
{
|
||||
Preconditions.checkState( !this.hasInitialized );
|
||||
this.builtInModels.put( path, model );
|
||||
}
|
||||
public void addModel(String path, IModel model) {
|
||||
Preconditions.checkState(!this.hasInitialized);
|
||||
this.builtInModels.put(path, model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInitialize( Side side )
|
||||
{
|
||||
this.hasInitialized = true;
|
||||
@Override
|
||||
public void preInitialize(Side side) {
|
||||
this.hasInitialized = true;
|
||||
|
||||
BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
|
||||
ModelLoaderRegistry.registerLoader( loader );
|
||||
}
|
||||
BuiltInModelLoader loader = new BuiltInModelLoader(this.builtInModels);
|
||||
ModelLoaderRegistry.registerLoader(loader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IBlockRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void blockRegistration( Side side, IForgeRegistry<Block> blockRegistry );
|
||||
public interface IBlockRegistrationComponent extends IBootstrapComponent {
|
||||
void blockRegistration(Side side, IForgeRegistry<Block> blockRegistry);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IEntityRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void entityRegistration( IForgeRegistry<EntityEntry> entityRegistry );
|
||||
public interface IEntityRegistrationComponent extends IBootstrapComponent {
|
||||
void entityRegistration(IForgeRegistry<EntityEntry> entityRegistry);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IInitComponent extends IBootstrapComponent
|
||||
{
|
||||
void initialize( Side side );
|
||||
public interface IInitComponent extends IBootstrapComponent {
|
||||
void initialize(Side side);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IItemRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void itemRegistration( Side side, IForgeRegistry<Item> itemRegistry );
|
||||
public interface IItemRegistrationComponent extends IBootstrapComponent {
|
||||
void itemRegistration(Side side, IForgeRegistry<Item> itemRegistry);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,7 +29,6 @@ import appeng.bootstrap.IModelRegistry;
|
||||
*/
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IModelRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void modelRegistration( Side side, IModelRegistry registry );
|
||||
public interface IModelRegistrationComponent extends IBootstrapComponent {
|
||||
void modelRegistration(Side side, IModelRegistry registry);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IOreDictComponent extends IBootstrapComponent
|
||||
{
|
||||
void oreRegistration( Side side );
|
||||
public interface IOreDictComponent extends IBootstrapComponent {
|
||||
void oreRegistration(Side side);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IPostInitComponent extends IBootstrapComponent
|
||||
{
|
||||
void postInitialize( Side side );
|
||||
public interface IPostInitComponent extends IBootstrapComponent {
|
||||
void postInitialize(Side side);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IPreInitComponent extends IBootstrapComponent
|
||||
{
|
||||
void preInitialize( Side side );
|
||||
public interface IPreInitComponent extends IBootstrapComponent {
|
||||
void preInitialize(Side side);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void recipeRegistration( Side side, IForgeRegistry<IRecipe> recipeRegistry );
|
||||
public interface IRecipeRegistrationComponent extends IBootstrapComponent {
|
||||
void recipeRegistration(Side side, IForgeRegistry<IRecipe> recipeRegistry);
|
||||
}
|
||||
|
||||
@@ -25,22 +25,19 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
public class ItemColorComponent implements IInitComponent
|
||||
{
|
||||
public class ItemColorComponent implements IInitComponent {
|
||||
|
||||
private final Item item;
|
||||
private final Item item;
|
||||
|
||||
private final IItemColor itemColor;
|
||||
private final IItemColor itemColor;
|
||||
|
||||
public ItemColorComponent( Item item, IItemColor itemColor )
|
||||
{
|
||||
this.item = item;
|
||||
this.itemColor = itemColor;
|
||||
}
|
||||
public ItemColorComponent(Item item, IItemColor itemColor) {
|
||||
this.item = item;
|
||||
this.itemColor = itemColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize( Side side )
|
||||
{
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler( this.itemColor, this.item );
|
||||
}
|
||||
@Override
|
||||
public void initialize(Side side) {
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(this.itemColor, this.item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,35 +19,31 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* Registers a custom item mesh definition that can be used to dynamically determine the item model based on
|
||||
* item stack properties.
|
||||
*/
|
||||
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent
|
||||
{
|
||||
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent {
|
||||
|
||||
private final Item item;
|
||||
private final Item item;
|
||||
|
||||
private final ItemMeshDefinition meshDefinition;
|
||||
private final ItemMeshDefinition meshDefinition;
|
||||
|
||||
public ItemMeshDefinitionComponent( @Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition )
|
||||
{
|
||||
this.item = item;
|
||||
this.meshDefinition = meshDefinition;
|
||||
}
|
||||
public ItemMeshDefinitionComponent(@Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition) {
|
||||
this.item = item;
|
||||
this.meshDefinition = meshDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
registry.setCustomMeshDefinition( this.item, this.meshDefinition );
|
||||
}
|
||||
@Override
|
||||
public void modelRegistration(Side side, IModelRegistry registry) {
|
||||
registry.setCustomMeshDefinition(this.item, this.meshDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,41 +19,36 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Registers the models that should by used for an item, including the ability to
|
||||
* distinguish by meta.
|
||||
*/
|
||||
public class ItemModelComponent implements IModelRegistrationComponent
|
||||
{
|
||||
public class ItemModelComponent implements IModelRegistrationComponent {
|
||||
|
||||
private final Item item;
|
||||
private final Item item;
|
||||
|
||||
private final Map<Integer, ModelResourceLocation> modelsByMeta;
|
||||
private final Map<Integer, ModelResourceLocation> modelsByMeta;
|
||||
|
||||
public ItemModelComponent( @Nonnull Item item, @Nonnull Map<Integer, ModelResourceLocation> modelsByMeta )
|
||||
{
|
||||
this.item = item;
|
||||
this.modelsByMeta = modelsByMeta;
|
||||
}
|
||||
public ItemModelComponent(@Nonnull Item item, @Nonnull Map<Integer, ModelResourceLocation> modelsByMeta) {
|
||||
this.item = item;
|
||||
this.modelsByMeta = modelsByMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
this.modelsByMeta.forEach( ( meta, model ) ->
|
||||
{
|
||||
registry.setCustomModelResourceLocation( this.item, meta, model );
|
||||
} );
|
||||
}
|
||||
@Override
|
||||
public void modelRegistration(Side side, IModelRegistry registry) {
|
||||
this.modelsByMeta.forEach((meta, model) ->
|
||||
{
|
||||
registry.setCustomModelResourceLocation(this.item, meta, model);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,32 +19,28 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
public class ItemVariantsComponent implements IModelRegistrationComponent
|
||||
{
|
||||
public class ItemVariantsComponent implements IModelRegistrationComponent {
|
||||
|
||||
private final Item item;
|
||||
private final Item item;
|
||||
|
||||
private final Collection<ResourceLocation> resources;
|
||||
private final Collection<ResourceLocation> resources;
|
||||
|
||||
public ItemVariantsComponent( Item item, Collection<ResourceLocation> resources )
|
||||
{
|
||||
this.item = item;
|
||||
this.resources = resources;
|
||||
}
|
||||
public ItemVariantsComponent(Item item, Collection<ResourceLocation> resources) {
|
||||
this.item = item;
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
ResourceLocation[] resourceArr = this.resources.toArray( new ResourceLocation[0] );
|
||||
registry.registerItemVariants( this.item, resourceArr );
|
||||
}
|
||||
@Override
|
||||
public void modelRegistration(Side side, IModelRegistry registry) {
|
||||
ResourceLocation[] resourceArr = this.resources.toArray(new ResourceLocation[0]);
|
||||
registry.registerItemVariants(this.item, resourceArr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,8 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
@@ -36,61 +31,55 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
|
||||
public class ModelOverrideComponent implements IPreInitComponent
|
||||
{
|
||||
public class ModelOverrideComponent implements IPreInitComponent {
|
||||
|
||||
private static final ModelResourceLocation MODEL_MISSING = new ModelResourceLocation( "builtin/missing", "missing" );
|
||||
private static final ModelResourceLocation MODEL_MISSING = new ModelResourceLocation("builtin/missing", "missing");
|
||||
|
||||
// Maps from resource path to customizer
|
||||
private final Map<String, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel>> customizer = new HashMap<>();
|
||||
// Maps from resource path to customizer
|
||||
private final Map<String, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel>> customizer = new HashMap<>();
|
||||
|
||||
public void addOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
{
|
||||
this.customizer.put( resourcePath, customizer );
|
||||
}
|
||||
public void addOverride(String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer) {
|
||||
this.customizer.put(resourcePath, customizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInitialize( Side side )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
@Override
|
||||
public void preInitialize(Side side) {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelBakeEvent( final ModelBakeEvent event )
|
||||
{
|
||||
IRegistry<ModelResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||
Set<ModelResourceLocation> keys = Sets.newHashSet( modelRegistry.getKeys() );
|
||||
// IBakedModel missingModel = modelRegistry.getObject( MODEL_MISSING );
|
||||
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
||||
@SubscribeEvent
|
||||
public void onModelBakeEvent(final ModelBakeEvent event) {
|
||||
IRegistry<ModelResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||
Set<ModelResourceLocation> keys = Sets.newHashSet(modelRegistry.getKeys());
|
||||
// IBakedModel missingModel = modelRegistry.getObject( MODEL_MISSING );
|
||||
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
||||
|
||||
for( ModelResourceLocation location : keys )
|
||||
{
|
||||
if( !location.getResourceDomain().equals( AppEng.MOD_ID ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (ModelResourceLocation location : keys) {
|
||||
if (!location.getResourceDomain().equals(AppEng.MOD_ID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IBakedModel orgModel = modelRegistry.getObject( location );
|
||||
IBakedModel orgModel = modelRegistry.getObject(location);
|
||||
|
||||
// Don't customize the missing model. This causes Forge to swallow exceptions
|
||||
if( orgModel == missingModel )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Don't customize the missing model. This causes Forge to swallow exceptions
|
||||
if (orgModel == missingModel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get( location.getResourcePath() );
|
||||
if( customizer != null )
|
||||
{
|
||||
IBakedModel newModel = customizer.apply( location, orgModel );
|
||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getResourcePath());
|
||||
if (customizer != null) {
|
||||
IBakedModel newModel = customizer.apply(location, orgModel);
|
||||
|
||||
if( newModel != orgModel )
|
||||
{
|
||||
modelRegistry.putObject( location, newModel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newModel != orgModel) {
|
||||
modelRegistry.putObject(location, newModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
@@ -26,33 +27,27 @@ import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* Registers a custom state mapper for a given block.
|
||||
*/
|
||||
public class StateMapperComponent implements IModelRegistrationComponent
|
||||
{
|
||||
public class StateMapperComponent implements IModelRegistrationComponent {
|
||||
|
||||
private final Block block;
|
||||
private final Block block;
|
||||
|
||||
private final IStateMapper stateMapper;
|
||||
private final IStateMapper stateMapper;
|
||||
|
||||
public StateMapperComponent( Block block, IStateMapper stateMapper )
|
||||
{
|
||||
this.block = block;
|
||||
this.stateMapper = stateMapper;
|
||||
}
|
||||
public StateMapperComponent(Block block, IStateMapper stateMapper) {
|
||||
this.block = block;
|
||||
this.stateMapper = stateMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
registry.setCustomStateMapper( this.block, this.stateMapper );
|
||||
if( this.stateMapper instanceof IResourceManagerReloadListener )
|
||||
{
|
||||
( (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager() )
|
||||
.registerReloadListener( (IResourceManagerReloadListener) this.stateMapper );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void modelRegistration(Side side, IModelRegistry registry) {
|
||||
registry.setCustomStateMapper(this.block, this.stateMapper);
|
||||
if (this.stateMapper instanceof IResourceManagerReloadListener) {
|
||||
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager())
|
||||
.registerReloadListener((IResourceManagerReloadListener) this.stateMapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
/**
|
||||
* Registers a TESR for a given tile entity class.
|
||||
@@ -32,23 +31,20 @@ import appeng.tile.AEBaseTile;
|
||||
* @param <T>
|
||||
*/
|
||||
// public class TesrComponent<T extends AEBaseTile> implements ModelRegComponent
|
||||
public class TesrComponent<T extends AEBaseTile> implements IPreInitComponent
|
||||
{
|
||||
public class TesrComponent<T extends AEBaseTile> implements IPreInitComponent {
|
||||
|
||||
private final Class<T> tileEntityClass;
|
||||
private final Class<T> tileEntityClass;
|
||||
|
||||
private final TileEntitySpecialRenderer<? super T> tesr;
|
||||
private final TileEntitySpecialRenderer<? super T> tesr;
|
||||
|
||||
public TesrComponent( Class<T> tileEntityClass, TileEntitySpecialRenderer<? super T> tesr )
|
||||
{
|
||||
this.tileEntityClass = tileEntityClass;
|
||||
this.tesr = tesr;
|
||||
}
|
||||
public TesrComponent(Class<T> tileEntityClass, TileEntitySpecialRenderer<? super T> tesr) {
|
||||
this.tileEntityClass = tileEntityClass;
|
||||
this.tesr = tesr;
|
||||
}
|
||||
|
||||
@Override
|
||||
// public void modelReg( Side side )
|
||||
public void preInitialize( Side side )
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( this.tileEntityClass, this.tesr );
|
||||
}
|
||||
@Override
|
||||
// public void modelReg( Side side )
|
||||
public void preInitialize(Side side) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(this.tileEntityClass, this.tesr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,37 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author GuntherDW
|
||||
*/
|
||||
public class TileEntityComponent implements IPreInitComponent
|
||||
{
|
||||
private List<TileEntityDefinition> tileEntityDefinitions = new ArrayList<>();
|
||||
public class TileEntityComponent implements IPreInitComponent {
|
||||
private final List<TileEntityDefinition> tileEntityDefinitions = new ArrayList<>();
|
||||
|
||||
public TileEntityComponent()
|
||||
{
|
||||
}
|
||||
public TileEntityComponent() {
|
||||
}
|
||||
|
||||
public void addTileEntity( TileEntityDefinition tileEntityDefinition )
|
||||
{
|
||||
if( !this.tileEntityDefinitions.contains( tileEntityDefinition ) )
|
||||
{
|
||||
this.tileEntityDefinitions.add( tileEntityDefinition );
|
||||
}
|
||||
}
|
||||
public void addTileEntity(TileEntityDefinition tileEntityDefinition) {
|
||||
if (!this.tileEntityDefinitions.contains(tileEntityDefinition)) {
|
||||
this.tileEntityDefinitions.add(tileEntityDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInitialize( Side side )
|
||||
{
|
||||
for( TileEntityDefinition tileEntityDefinition : this.tileEntityDefinitions )
|
||||
{
|
||||
if( !tileEntityDefinition.isRegistered() )
|
||||
{
|
||||
GameRegistry.registerTileEntity( tileEntityDefinition.getTileEntityClass(), AppEng.MOD_ID + ":" + tileEntityDefinition.getName() );
|
||||
tileEntityDefinition.setRegistered( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void preInitialize(Side side) {
|
||||
for (TileEntityDefinition tileEntityDefinition : this.tileEntityDefinitions) {
|
||||
if (!tileEntityDefinition.isRegistered()) {
|
||||
GameRegistry.registerTileEntity(tileEntityDefinition.getTileEntityClass(), AppEng.MOD_ID + ":" + tileEntityDefinition.getName());
|
||||
tileEntityDefinition.setRegistered(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user