Registration rework (#3018)
Refactored component registration. Fixes #3008: crank rendering
This commit is contained in:
@@ -101,6 +101,7 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
// this will actually be overwritten later through setupTile and the
|
||||
// combined layers
|
||||
this.setTileEntity( TileCableBus.class );
|
||||
this.useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -42,11 +42,13 @@ import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.Registration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockDefinition;
|
||||
@@ -65,13 +67,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
private final Supplier<? extends Block> blockSupplier;
|
||||
|
||||
private final List<BiConsumer<Block, Item>> preInitCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> initCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> modelRegCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> postInitCallbacks = new ArrayList<>();
|
||||
private final List<BiFunction<Block, Item, IBootstrapComponent>> bootstrapComponents = new ArrayList<>();
|
||||
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||
|
||||
@@ -103,30 +99,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder preInit( BiConsumer<Block, Item> callback )
|
||||
public BlockDefinitionBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> callback )
|
||||
{
|
||||
this.preInitCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder init( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.initCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder modelRegInit( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.modelRegCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder postInit( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.postInitCallbacks.add( callback );
|
||||
this.bootstrapComponents.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -221,22 +196,16 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
|
||||
// Register the item and block with the game
|
||||
this.factory.addPreInit( side ->
|
||||
this.factory.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( block ) );
|
||||
if( item != null )
|
||||
{
|
||||
Registration.addBlockToRegister( block );
|
||||
if( item != null )
|
||||
{
|
||||
Registration.addItemToRegister( item );
|
||||
}
|
||||
} );
|
||||
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) );
|
||||
}
|
||||
|
||||
block.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( block, item ) ) );
|
||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( block, item ) ) );
|
||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( block, item ) ) );
|
||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( block, item ) ) );
|
||||
this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) );
|
||||
|
||||
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
||||
{
|
||||
@@ -268,7 +237,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
this.factory.addPreInit( side ->
|
||||
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
|
||||
{
|
||||
AEBaseTile.registerTileItem(
|
||||
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
||||
|
||||
@@ -110,13 +110,13 @@ class BlockRendering implements IBlockRendering
|
||||
|
||||
if( this.modelCustomizer != null )
|
||||
{
|
||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
}
|
||||
else if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||
// extended props
|
||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
}
|
||||
|
||||
// TODO : 1.12
|
||||
|
||||
@@ -20,10 +20,18 @@ package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -33,10 +41,6 @@ import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||
import appeng.bootstrap.components.TileEntityComponent;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -51,10 +55,10 @@ public class FeatureFactory
|
||||
|
||||
private final AEFeature[] defaultFeatures;
|
||||
|
||||
private final List<IBootstrapComponent> bootstrapComponents;
|
||||
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
ModelOverrideComponent modelOverrideComponent;
|
||||
private ModelOverrideComponent modelOverrideComponent;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
private BuiltInModelComponent builtInModelComponent;
|
||||
@@ -64,18 +68,18 @@ public class FeatureFactory
|
||||
public FeatureFactory()
|
||||
{
|
||||
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
||||
this.bootstrapComponents = new ArrayList<>();
|
||||
this.bootstrapComponents = new HashMap<>();
|
||||
|
||||
this.tileEntityComponent = new TileEntityComponent();
|
||||
this.bootstrapComponents.add( this.tileEntityComponent );
|
||||
this.addBootstrapComponent( this.tileEntityComponent );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
||||
this.bootstrapComponents.add( this.modelOverrideComponent );
|
||||
this.addBootstrapComponent( this.modelOverrideComponent );
|
||||
|
||||
this.builtInModelComponent = new BuiltInModelComponent();
|
||||
this.bootstrapComponents.add( this.builtInModelComponent );
|
||||
this.addBootstrapComponent( this.builtInModelComponent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,29 +127,16 @@ public class FeatureFactory
|
||||
return new FeatureFactory( this, features );
|
||||
}
|
||||
|
||||
void addBootstrapComponent( IBootstrapComponent component )
|
||||
public void addBootstrapComponent( IBootstrapComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
Arrays.stream( component.getClass().getInterfaces() )
|
||||
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )
|
||||
.forEach( i -> this.addBootstrapComponent( (Class<? extends IBootstrapComponent>) i, component ) );
|
||||
}
|
||||
|
||||
void addPreInit( IPreInitComponent component )
|
||||
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addInit( IInitComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addModelReg( IModelRegistrationComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addPostInit( IPostInitComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@@ -154,8 +145,14 @@ public class FeatureFactory
|
||||
this.builtInModelComponent.addModel( path, model );
|
||||
}
|
||||
|
||||
public List<IBootstrapComponent> getBootstrapComponents()
|
||||
@SideOnly( Side.CLIENT )
|
||||
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
{
|
||||
return this.bootstrapComponents;
|
||||
this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||
}
|
||||
|
||||
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||
{
|
||||
return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -33,14 +33,7 @@ import appeng.core.features.AEFeature;
|
||||
|
||||
public interface IBlockBuilder
|
||||
{
|
||||
|
||||
IBlockBuilder preInit( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder init( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder modelRegInit( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder postInit( BiConsumer<Block, Item> callback );
|
||||
IBlockBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> component );
|
||||
|
||||
IBlockBuilder features( AEFeature... features );
|
||||
|
||||
|
||||
@@ -19,28 +19,10 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
||||
* See the individual subclasses for a specific forge initalization event.
|
||||
*/
|
||||
public interface IBootstrapComponent
|
||||
{
|
||||
|
||||
default void preInitialize( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
}
|
||||
|
||||
default void initialize( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void postInitialize( Side side )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -36,12 +36,7 @@ import appeng.core.features.ItemDefinition;
|
||||
*/
|
||||
public interface IItemBuilder
|
||||
{
|
||||
|
||||
IItemBuilder preInit( Consumer<Item> callback );
|
||||
|
||||
IItemBuilder init( Consumer<Item> callback );
|
||||
|
||||
IItemBuilder postInit( Consumer<Item> callback );
|
||||
IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component );
|
||||
|
||||
IItemBuilder features( AEFeature... features );
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
@@ -33,10 +33,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.Registration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
@@ -53,13 +54,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||
|
||||
private final List<Consumer<Item>> preInitCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> initCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> modelRegCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> postInitCallbacks = new ArrayList<>();
|
||||
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
|
||||
|
||||
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
||||
|
||||
@@ -80,23 +75,9 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder preInit( Consumer<Item> callback )
|
||||
public IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component )
|
||||
{
|
||||
this.preInitCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder init( Consumer<Item> callback )
|
||||
{
|
||||
this.initCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder postInit( Consumer<Item> callback )
|
||||
{
|
||||
this.postInitCallbacks.add( callback );
|
||||
this.boostrapComponents.add( component );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -163,22 +144,19 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
item.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( item ) ) );
|
||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( item ) ) );
|
||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( item ) ) );
|
||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( item ) ) );
|
||||
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
||||
|
||||
// Register custom dispenser behavior if requested
|
||||
if( this.dispenserBehaviorSupplier != null )
|
||||
{
|
||||
this.factory.addPostInit( side ->
|
||||
this.factory.addBootstrapComponent( (IPostInitComponent) side ->
|
||||
{
|
||||
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
||||
} );
|
||||
}
|
||||
|
||||
this.factory.addPreInit( side -> Registration.addItemToRegister( item ) );
|
||||
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, reg ) -> reg.register( item ) );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -187,4 +165,5 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
|
||||
Block block = ( (ItemBlock) item ).getBlock();
|
||||
|
||||
// We can only do this once the blocks are actually registered...
|
||||
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
|
||||
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||
resources.add( model );
|
||||
}
|
||||
|
||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||
}
|
||||
|
||||
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
|
||||
{
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||
}
|
||||
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
|
||||
else if( this.itemMeshDefinition != null )
|
||||
{
|
||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||
// case
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
else if( item instanceof ItemBlock )
|
||||
{
|
||||
// The default for block items is to register the block model
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
|
||||
if( this.itemColor != null )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
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 );
|
||||
}
|
||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void initialize( Side side );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
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 );
|
||||
}
|
||||
@@ -32,8 +32,5 @@ import appeng.bootstrap.IModelRegistry;
|
||||
@FunctionalInterface
|
||||
public interface IModelRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void modelRegistration( Side side, IModelRegistry registry );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IOreDictComponent extends IBootstrapComponent
|
||||
{
|
||||
void oreRegistration( Side side );
|
||||
}
|
||||
@@ -27,7 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IPostInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void postInitialize( Side side );
|
||||
}
|
||||
|
||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IPreInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void preInitialize( Side side );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
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 );
|
||||
}
|
||||
@@ -28,6 +28,8 @@ import javax.annotation.Nonnull;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
@@ -114,6 +116,7 @@ public final class AppEng
|
||||
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
|
||||
|
||||
this.registration = new Registration();
|
||||
MinecraftForge.EVENT_BUS.register( this.registration );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -123,10 +126,14 @@ public final class AppEng
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Registration getRegistration()
|
||||
public Biome getStorageBiome()
|
||||
{
|
||||
return this.registration;
|
||||
return this.registration.storageBiome;
|
||||
}
|
||||
|
||||
public DimensionType getStorageDimensionType()
|
||||
{
|
||||
return this.registration.storageDimensionType;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -136,7 +143,6 @@ public final class AppEng
|
||||
{
|
||||
AppEng.proxy.missingCoreMod();
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.register( this.registration );
|
||||
|
||||
final Stopwatch watch = Stopwatch.createStarted();
|
||||
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
|
||||
|
||||
@@ -20,9 +20,7 @@ package appeng.core;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -48,8 +46,8 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -70,7 +68,16 @@ import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.recipes.IRecipeHandler;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.IOreDictComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.components.IRecipeRegistrationComponent;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
@@ -100,8 +107,6 @@ import appeng.recipes.CustomRecipeConfig;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.recipes.game.DisassembleRecipe;
|
||||
import appeng.recipes.game.FacadeRecipe;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.recipes.handlers.Crusher;
|
||||
import appeng.recipes.handlers.Grind;
|
||||
import appeng.recipes.handlers.HCCrusher;
|
||||
@@ -111,8 +116,6 @@ import appeng.recipes.handlers.MekCrusher;
|
||||
import appeng.recipes.handlers.MekEnrichment;
|
||||
import appeng.recipes.handlers.Press;
|
||||
import appeng.recipes.handlers.Pulverizer;
|
||||
import appeng.recipes.handlers.Shaped;
|
||||
import appeng.recipes.handlers.Shapeless;
|
||||
import appeng.recipes.handlers.Smelt;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.spatial.BiomeGenStorage;
|
||||
@@ -122,16 +125,11 @@ import appeng.worldgen.MeteoriteWorldGen;
|
||||
import appeng.worldgen.QuartzWorldGen;
|
||||
|
||||
|
||||
public final class Registration
|
||||
final class Registration
|
||||
{
|
||||
private final RecipeHandler recipeHandler;
|
||||
private DimensionType storageDimensionType;
|
||||
private Biome storageBiome;
|
||||
DimensionType storageDimensionType;
|
||||
Biome storageBiome;
|
||||
|
||||
// TODO : 1.12 Improve
|
||||
private static List<Block> blocksToRegister = new ArrayList<>();
|
||||
private static List<Item> itemsToRegister = new ArrayList<>();
|
||||
private static List<IRecipe> recipesToRegister = new ArrayList<>();
|
||||
private File recipeDirectory;
|
||||
private CustomRecipeConfig customRecipeConfig;
|
||||
|
||||
@@ -141,68 +139,24 @@ public final class Registration
|
||||
this.customRecipeConfig = f2;
|
||||
}
|
||||
|
||||
Registration()
|
||||
{
|
||||
this.recipeHandler = new RecipeHandler();
|
||||
}
|
||||
|
||||
public Biome getStorageBiome()
|
||||
{
|
||||
return this.storageBiome;
|
||||
}
|
||||
|
||||
public static void addBlockToRegister( Block b )
|
||||
{
|
||||
if( blocksToRegister == null )
|
||||
{
|
||||
throw new IllegalStateException( "Past the registration phase already!" );
|
||||
}
|
||||
blocksToRegister.add( b );
|
||||
}
|
||||
|
||||
public static void addRecipeToRegister( IRecipe r )
|
||||
{
|
||||
if( recipesToRegister == null )
|
||||
{
|
||||
throw new IllegalStateException( "Past the registration phase already!" );
|
||||
}
|
||||
recipesToRegister.add( r );
|
||||
}
|
||||
|
||||
public static void addItemToRegister( Item i )
|
||||
{
|
||||
if( itemsToRegister == null )
|
||||
{
|
||||
throw new IllegalStateException( "Past the registration phase already!" );
|
||||
}
|
||||
itemsToRegister.add( i );
|
||||
}
|
||||
|
||||
public DimensionType getStorageDimensionType()
|
||||
{
|
||||
return this.storageDimensionType;
|
||||
}
|
||||
|
||||
void preInitialize( final FMLPreInitializationEvent event )
|
||||
{
|
||||
// this.registerSpatial( false );
|
||||
|
||||
Capabilities.register();
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||
this.registerCraftHandlers( recipeRegistry );
|
||||
|
||||
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
||||
// RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||
// RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||
// RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||
|
||||
ApiDefinitions definitions = api.definitions();
|
||||
|
||||
// Register all detected handlers and features (items, blocks) in pre-init
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.preInitialize( event.getSide() ) );
|
||||
// Register
|
||||
definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||
}
|
||||
|
||||
private void registerSpatial( final boolean force, IForgeRegistry<Biome> registry )
|
||||
@@ -216,34 +170,11 @@ public final class Registration
|
||||
|
||||
if( this.storageBiome == null )
|
||||
{
|
||||
// if( force && config.getStorageBiomeID() == -1 )
|
||||
// {
|
||||
// config.setStorageBiomeID( Platform.findEmpty( Biome.REGISTRY, 0, 256 ) );
|
||||
// if( config.getStorageBiomeID() == -1 )
|
||||
// {
|
||||
// throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable
|
||||
// spatial." );
|
||||
// }
|
||||
//
|
||||
// this.storageBiome = new BiomeGenStorage();
|
||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
||||
// );
|
||||
// config.save();
|
||||
// }
|
||||
//
|
||||
// if( !force && config.getStorageBiomeID() != -1 )
|
||||
// {
|
||||
// this.storageBiome = new BiomeGenStorage();
|
||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
||||
// );
|
||||
// }
|
||||
|
||||
// TODO: 1.12, are modders allowed to even touch the ID's any more?
|
||||
this.storageBiome = new BiomeGenStorage();
|
||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||
|
||||
}
|
||||
|
||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||
|
||||
if( config.getStorageProviderID() != -1 )
|
||||
{
|
||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
||||
@@ -285,9 +216,6 @@ public final class Registration
|
||||
registry.addNewCraftHandler( "smelt", Smelt.class );
|
||||
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
||||
registry.addNewCraftHandler( "press", Press.class );
|
||||
|
||||
registry.addNewCraftHandler( "shaped", Shaped.class );
|
||||
registry.addNewCraftHandler( "shapeless", Shapeless.class );
|
||||
}
|
||||
|
||||
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
||||
@@ -302,7 +230,9 @@ public final class Registration
|
||||
final IRegistryContainer registries = api.registries();
|
||||
|
||||
ApiDefinitions definitions = api.definitions();
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.initialize( event.getSide() ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( event.getSide() ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||
|
||||
//
|
||||
// // Perform ore camouflage!
|
||||
// ItemMaterial.instance.makeUnique();
|
||||
@@ -361,9 +291,6 @@ public final class Registration
|
||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||
} );
|
||||
|
||||
// TODO : 1.12 This is way too late for recipes
|
||||
// this.recipeHandler.injectRecipes();
|
||||
|
||||
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance() );
|
||||
registration.registerAchievementHandlers();
|
||||
registration.registerAchievements();
|
||||
@@ -372,41 +299,36 @@ public final class Registration
|
||||
@SubscribeEvent
|
||||
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||
{
|
||||
IForgeRegistry<Biome> registry = event.getRegistry();
|
||||
final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||
this.registerSpatial( false, registry );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||
{
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IModelRegistry registry = new ModelLoaderWrapper();
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.modelRegistration( FMLCommonHandler.instance().getEffectiveSide(), registry ) );
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( side, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||
{
|
||||
IForgeRegistry<Block> registry = event.getRegistry();
|
||||
// TODO : 1.12 Improve
|
||||
for( Block b : blocksToRegister )
|
||||
{
|
||||
registry.register( b );
|
||||
}
|
||||
blocksToRegister = null;
|
||||
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( side, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerItems( RegistryEvent.Register<Item> event )
|
||||
{
|
||||
|
||||
IForgeRegistry<Item> registry = event.getRegistry();
|
||||
// TODO : 1.12 Improve
|
||||
for( Item i : itemsToRegister )
|
||||
{
|
||||
registry.register( i );
|
||||
}
|
||||
itemsToRegister = null;
|
||||
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( side, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -416,20 +338,15 @@ public final class Registration
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final ApiDefinitions definitions = api.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
// Perform ore camouflage!
|
||||
ItemMaterial.instance.makeUnique();
|
||||
|
||||
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, this.recipeHandler );
|
||||
recipeLoader.run();
|
||||
|
||||
this.recipeHandler.injectRecipes();
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||
{
|
||||
DisassembleRecipe r = new DisassembleRecipe();
|
||||
// TODO : 1.12 Improve
|
||||
addRecipeToRegister( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
|
||||
// "after:minecraft:shapeless" );
|
||||
}
|
||||
@@ -438,35 +355,24 @@ public final class Registration
|
||||
{
|
||||
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
||||
{
|
||||
// TODO : 1.12 Improve
|
||||
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
||||
addRecipeToRegister( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||
registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
|
||||
// "after:minecraft:shaped" );
|
||||
} );
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
// TODO : 1.12 Improve
|
||||
for( IRecipe r : recipesToRegister )
|
||||
{
|
||||
// TODO : 1.12 *really* improve.
|
||||
// Move to json where possible?
|
||||
if( r.getRegistryName() == null )
|
||||
{
|
||||
r.setRegistryName( new ResourceLocation( AppEng.MOD_ID.toLowerCase(), "recipe_" + x ) );
|
||||
x++;
|
||||
}
|
||||
registry.register( r );
|
||||
}
|
||||
recipesToRegister = null;
|
||||
definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
|
||||
|
||||
// load machine recipes
|
||||
final IRecipeHandler recipeHandler = new RecipeHandler();
|
||||
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, recipeHandler );
|
||||
recipeLoader.run();
|
||||
recipeHandler.injectRecipes();
|
||||
}
|
||||
|
||||
void postInit( final FMLPostInitializationEvent event )
|
||||
{
|
||||
// TODO : 1.12 Improve
|
||||
|
||||
final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
@@ -480,7 +386,7 @@ public final class Registration
|
||||
PlayerMessages.values();
|
||||
GuiText.values();
|
||||
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||
|
||||
// Interface
|
||||
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||
@@ -556,7 +462,7 @@ public final class Registration
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||
{
|
||||
// TODO: VILLAGER TRADING
|
||||
// VillagerRegistry.instance().getRegisteredVillagers()..registerVillageTradeHandler( 3, new AETrading() );
|
||||
// VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
||||
@@ -657,7 +563,6 @@ public final class Registration
|
||||
{
|
||||
ModelLoader.setCustomStateMapper( block, mapper );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,9 @@ import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.components.IOreDictComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.client.render.crafting.CraftingCubeRendering;
|
||||
import appeng.client.render.model.GlassModel;
|
||||
@@ -239,17 +242,11 @@ public final class ApiBlocks implements IBlocks
|
||||
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
||||
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
||||
.features( AEFeature.CERTUS_ORE )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
||||
} )
|
||||
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||
.build();
|
||||
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
||||
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
||||
} )
|
||||
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||
.build();
|
||||
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
||||
|
||||
@@ -308,6 +305,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.features( AEFeature.GRIND_STONE )
|
||||
.tileEntity( new TileEntityDefinition( TileCrank.class ) )
|
||||
.rendering( new CrankRendering() )
|
||||
.useCustomItemModel()
|
||||
.build();
|
||||
this.inscriber = registry.block( "inscriber", BlockInscriber::new )
|
||||
.features( AEFeature.INSCRIBER )
|
||||
@@ -334,10 +332,8 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||
.features( AEFeature.TINY_TNT )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, new DispenserBehaviorTinyTNT() );
|
||||
} )
|
||||
.bootstrap( ( block, item ) -> (IPreInitComponent) side -> BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item,
|
||||
new DispenserBehaviorTinyTNT() ) )
|
||||
.build();
|
||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||
.features( AEFeature.SECURITY )
|
||||
@@ -497,10 +493,8 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering( new CableBusRendering( partModels ) )
|
||||
// (handled in BlockCableBus.java and its setupTile())
|
||||
// .tileEntity( TileCableBus.class )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
( (BlockCableBus) block ).setupTile();
|
||||
} )
|
||||
// TODO: why the custom registration?
|
||||
.bootstrap( ( block, item ) -> (IPostInitComponent) side -> ( (BlockCableBus) block ).setupTile() )
|
||||
.build();
|
||||
|
||||
this.skyStoneSlab = makeSlab( "sky_stone_slab", "sky_stone_double_slab", registry, this.skyStoneBlock() );
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PacketNewStorageDimension extends AppEngPacket
|
||||
{
|
||||
try
|
||||
{
|
||||
DimensionManager.registerDimension( this.newDim, AppEng.instance().getRegistration().getStorageDimensionType() );
|
||||
DimensionManager.registerDimension( this.newDim, AppEng.instance().getStorageDimensionType() );
|
||||
}
|
||||
catch( final IllegalArgumentException iae )
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ final class DimensionData implements IWorldDimensionData, IOnWorldStartable, IOn
|
||||
{
|
||||
for( final Integer storageCellDimID : this.storageCellDimensionIDs )
|
||||
{
|
||||
DimensionManager.registerDimension( storageCellDimID, AppEng.instance().getRegistration().getStorageDimensionType() );
|
||||
DimensionManager.registerDimension( storageCellDimID, AppEng.instance().getStorageDimensionType() );
|
||||
}
|
||||
|
||||
this.config.save();
|
||||
@@ -111,7 +111,7 @@ final class DimensionData implements IWorldDimensionData, IOnWorldStartable, IOn
|
||||
public void addStorageCell( final int newStorageCellID )
|
||||
{
|
||||
this.storageCellDimensionIDs.add( newStorageCellID );
|
||||
DimensionManager.registerDimension( newStorageCellID, AppEng.instance().getRegistration().getStorageDimensionType() );
|
||||
DimensionManager.registerDimension( newStorageCellID, AppEng.instance().getStorageDimensionType() );
|
||||
|
||||
NetworkHandler.instance().sendToAll( new PacketNewStorageDimension( newStorageCellID ) );
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class BlockSlabCommon extends BlockSlab
|
||||
|
||||
this.setDefaultState( iblockstate.withProperty( VARIANT, Variant.DEFAULT ) );
|
||||
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
||||
this.useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ public class StorageChunkProvider extends ChunkGeneratorOverworld
|
||||
final Chunk chunk = new Chunk( this.world, x, z );
|
||||
|
||||
final byte[] biomes = chunk.getBiomeArray();
|
||||
Biome biome = AppEng.instance().getRegistration().getStorageBiome();
|
||||
Biome biome = AppEng.instance().getStorageBiome();
|
||||
byte biomeId = (byte) Biome.getIdForBiome( biome );
|
||||
|
||||
for( int k = 0; k < biomes.length; ++k )
|
||||
|
||||
@@ -44,7 +44,7 @@ public class StorageWorldProvider extends WorldProvider
|
||||
public StorageWorldProvider()
|
||||
{
|
||||
this.hasSkyLight = true;
|
||||
this.biome = AppEng.instance().getRegistration().getStorageBiome();
|
||||
this.biome = AppEng.instance().getStorageBiome();
|
||||
this.biomeProvider = new BiomeProviderSingle( this.biome );
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class StorageWorldProvider extends WorldProvider
|
||||
@Override
|
||||
public DimensionType getDimensionType()
|
||||
{
|
||||
return AppEng.instance().getRegistration().getStorageDimensionType();
|
||||
return AppEng.instance().getStorageDimensionType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user