Custom Model Loader

This commit is contained in:
Sebastian Hartte
2020-06-01 04:02:37 +02:00
parent 077ff17078
commit 5cdeff01be
202 changed files with 942 additions and 1017 deletions
@@ -425,6 +425,7 @@ public abstract class AEBaseBlock extends Block
return null;
}
@Deprecated
protected IProperty[] getAEStates()
{
return new IProperty[0];
@@ -39,7 +39,7 @@ public class ItemCraftingStorage extends AEBaseBlockItem
@Override
public ItemStack getContainerItem( final ItemStack itemStack )
{
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().blocks().craftingUnit().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -111,7 +111,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
{
final TileCharger tc = (TileCharger) tile;
if( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getInternalInventory().getStackInSlot( 0 ) ) )
if( Api.INSTANCE.definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getInternalInventory().getStackInSlot( 0 ) ) )
{
final double xOff = 0.0;
final double yOff = 0.0;
@@ -188,7 +188,7 @@ class PaintBakedModel implements IBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
static List<ResourceLocation> getRequiredTextures()
@@ -70,7 +70,7 @@ class QnbFormedBakedModel implements IBakedModel
this.coveredCableTexture = bakedTextureGetter.apply( TEXTURE_COVERED_CABLE );
this.lightTexture = bakedTextureGetter.apply( TEXTURE_RING_LIGHT );
this.lightCornerTexture = bakedTextureGetter.apply( TEXTURE_RING_LIGHT_CORNER );
this.linkBlock = AEApi.instance().definitions().blocks().quantumLink().maybeBlock().orElse( null );
this.linkBlock = Api.INSTANCE.definitions().blocks().quantumLink().maybeBlock().orElse( null );
}
@Override
@@ -78,7 +78,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
private boolean disableItem = false;
private Function<Block, BlockItem> itemFactory;
private BiFunction<Block, Item.Properties, BlockItem> itemFactory;
@OnlyIn( Dist.CLIENT )
private BlockRendering blockRendering;
@@ -157,7 +157,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
}
@Override
public IBlockBuilder item( Function<Block, BlockItem> factory )
public IBlockBuilder item( BiFunction<Block, Item.Properties, BlockItem> factory )
{
this.itemFactory = factory;
return this;
@@ -258,17 +258,24 @@ class BlockDefinitionBuilder implements IBlockBuilder
return null;
}
Item.Properties itemProperties = new Item.Properties();
if (itemGroup != null) {
itemProperties.group(itemGroup);
}
// FIXME: Allow more/all item properties
if( this.itemFactory != null )
{
return this.itemFactory.apply( block );
return this.itemFactory.apply( block, itemProperties );
}
else if( block instanceof AEBaseBlock )
{
return new AEBaseBlockItem( block, new Item.Properties() /* FIXME THIS IS THE IMPORTANT BIT */ );
return new AEBaseBlockItem( block, itemProperties );
}
else
{
return new BlockItem( block, null );
return new BlockItem( block, itemProperties );
}
}
}
@@ -27,6 +27,7 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -39,7 +40,7 @@ class BlockRendering implements IBlockRendering
{
@OnlyIn( Dist.CLIENT )
private BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> modelCustomizer;
private BiFunction<ResourceLocation, IBakedModel, IBakedModel> modelCustomizer;
@OnlyIn( Dist.CLIENT )
private IBlockColor blockColor;
@@ -55,7 +56,7 @@ class BlockRendering implements IBlockRendering
@Override
@OnlyIn( Dist.CLIENT )
public IBlockRendering modelCustomizer( BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
public IBlockRendering modelCustomizer( BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer )
{
this.modelCustomizer = customizer;
return this;
@@ -29,11 +29,14 @@ import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import appeng.bootstrap.components.BuiltInModelComponent;
import appeng.bootstrap.components.ModelOverrideComponent;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -55,11 +58,11 @@ public class FeatureFactory
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
//FIXME @OnlyIn( Dist.CLIENT )
//FIXME private ModelOverrideComponent modelOverrideComponent;
@OnlyIn( Dist.CLIENT )
private ModelOverrideComponent modelOverrideComponent;
//FIXME @OnlyIn( Dist.CLIENT )
//FIXME private BuiltInModelComponent builtInModelComponent;
@OnlyIn( Dist.CLIENT )
private BuiltInModelComponent builtInModelComponent;
public final TileEntityComponent tileEntityComponent;
@@ -73,10 +76,10 @@ public class FeatureFactory
if( Platform.isClient() )
{
// FIXME this.modelOverrideComponent = new ModelOverrideComponent();
// FIXME this.addBootstrapComponent( this.modelOverrideComponent );
// FIXME this.builtInModelComponent = new BuiltInModelComponent();
// FIXME this.addBootstrapComponent( this.builtInModelComponent );
this.modelOverrideComponent = new ModelOverrideComponent();
this.addBootstrapComponent( this.modelOverrideComponent );
this.builtInModelComponent = new BuiltInModelComponent();
this.addBootstrapComponent( this.builtInModelComponent );
}
}
@@ -87,8 +90,8 @@ public class FeatureFactory
this.tileEntityComponent = parent.tileEntityComponent;
if( Platform.isClient() )
{
// FIXME this.modelOverrideComponent = parent.modelOverrideComponent;
// FIXME this.builtInModelComponent = parent.builtInModelComponent;
this.modelOverrideComponent = parent.modelOverrideComponent;
this.builtInModelComponent = parent.builtInModelComponent;
}
}
@@ -139,13 +142,13 @@ public class FeatureFactory
@OnlyIn( Dist.CLIENT )
void addBuiltInModel( String path, IUnbakedModel model )
{
// FIXME this.builtInModelComponent.addModel( path, model );
this.builtInModelComponent.addModel( path, model );
}
@OnlyIn( Dist.CLIENT )
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
void addModelOverride( String resourcePath, BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer )
{
// FIXME this.modelOverrideComponent.addOverride( resourcePath, customizer );
this.modelOverrideComponent.addOverride( resourcePath, customizer );
}
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
@@ -54,7 +54,7 @@ public interface IBlockBuilder
*/
IBlockBuilder useCustomItemModel();
IBlockBuilder item( Function<Block, BlockItem> factory );
IBlockBuilder item( BiFunction<Block, Item.Properties, BlockItem> factory );
<T extends IBlockDefinition> T build();
}
@@ -26,6 +26,7 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -37,7 +38,7 @@ public interface IBlockRendering
{
@OnlyIn( Dist.CLIENT )
IBlockRendering modelCustomizer( BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer );
IBlockRendering modelCustomizer( BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer );
@OnlyIn( Dist.CLIENT )
IBlockRendering blockColor( IBlockColor blockColor );
@@ -131,11 +131,6 @@ class ItemDefinitionBuilder implements IItemBuilder
@Override
public ItemDefinition build()
{
if( !AEConfig.instance().areFeaturesEnabled( this.features ) )
{
return new ItemDefinition( this.registryName, null );
}
Item item = this.itemSupplier.get();
item.setRegistryName( AppEng.MOD_ID, this.registryName );
@@ -19,16 +19,13 @@
package appeng.bootstrap.components;
import java.util.HashMap;
import java.util.Map;
import com.google.common.base.Preconditions;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.HashMap;
import java.util.Map;
@OnlyIn( Dist.CLIENT )
public class BuiltInModelComponent implements IPreInitComponent
@@ -48,8 +45,8 @@ public class BuiltInModelComponent implements IPreInitComponent
public void preInitialize( Dist dist )
{
this.hasInitialized = true;
// FIXME BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
// FIXME ModelLoaderRegistry.registerLoader( loader );
//
// BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
// ModelLoaderRegistry.registerLoader( loader );
}
}
@@ -95,7 +95,7 @@ public class GuiCraftAmount extends AEBaseGui
ItemStack myIcon = null;
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IParts parts = definitions.parts();
if( target instanceof WirelessTerminalGuiObject )
@@ -62,9 +62,9 @@ public class GuiCraftConfirm extends AEBaseGui
private final int rows = 5;
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> pending = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> missing = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final List<IAEItemStack> visual = new ArrayList<>();
@@ -84,9 +84,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
private final ContainerCraftingCPU craftingCpu;
private IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> active = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> pending = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private List<IAEItemStack> visual = new ArrayList<>();
private GuiButton cancel;
@@ -110,9 +110,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
public void clearItems()
{
this.storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.storage = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.active = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.pending = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.visual = new ArrayList<>();
}
@@ -65,7 +65,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
this.status = (ContainerCraftingStatus) this.inventorySlots;
final Object target = this.status.getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IParts parts = definitions.parts();
if( target instanceof WirelessTerminalGuiObject )
@@ -91,7 +91,7 @@ public class GuiIOPort extends GuiUpgradeable
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
definitions.items().cell1k().maybeStack( 1 ).ifPresent( cell1kStack -> this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack ) );
@@ -349,7 +349,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
if( !parsedItemStack.isEmpty() )
{
final String displayName = Platform
.getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
.getItemDisplayName( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
.toLowerCase();
if( displayName.contains( searchTerm ) )
{
@@ -50,7 +50,7 @@ import net.minecraft.util.text.ITextComponent;
*/
public class FluidRepo
{
private final IItemList<IAEFluidStack> list = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final IItemList<IAEFluidStack> list = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
+1 -1
View File
@@ -51,7 +51,7 @@ import net.minecraft.util.text.ITextComponent;
public class ItemRepo
{
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final ArrayList<IAEItemStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
@@ -86,6 +86,6 @@ public class FacadeBakedItemModel extends DelegateBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -364,6 +364,6 @@ public class CableBusBakedModel implements IBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -109,7 +109,7 @@ public class FacadeBuilder
{
BakedPipeline pipeline = this.pipelines.get();
Quad collectorQuad = this.collectors.get();
boolean transparent = AEApi.instance().partHelper().getCableRenderMode().transparentFacades;
boolean transparent = Api.INSTANCE.partHelper().getCableRenderMode().transparentFacades;
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
List<AxisAlignedBB> partBoxes = renderState.getBoundingBoxes();
Set<Direction> sidesWithParts = renderState.getAttachments().keySet();
@@ -137,6 +137,6 @@ public class P2PTunnelFrequencyBakedModel implements IBakedModel, IPartBakedMode
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -308,6 +308,6 @@ abstract class CraftingCubeBakedModel implements IBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -19,13 +19,11 @@
package appeng.client.render.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.*;
import java.util.function.Function;
import java.util.stream.IntStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.base.Strings;
@@ -33,48 +31,63 @@ import com.google.common.base.Strings;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import appeng.decorative.solid.BlockQuartzGlass;
import appeng.decorative.solid.GlassState;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraftforge.client.model.ModelDataManager;
import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
class GlassBakedModel implements IBakedModel
class GlassBakedModel implements IDynamicBakedModel
{
// This unlisted property is used to determine the actual block that should be rendered
public static final ModelProperty<GlassState> GLASS_STATE = new ModelProperty<>();
private static final byte[][][] OFFSETS = generateOffsets();
// Alternating textures based on position
static final ResourceLocation TEXTURE_A = new ResourceLocation( "appliedenergistics2:blocks/glass/quartz_glass_a" );
static final ResourceLocation TEXTURE_B = new ResourceLocation( "appliedenergistics2:blocks/glass/quartz_glass_b" );
static final ResourceLocation TEXTURE_C = new ResourceLocation( "appliedenergistics2:blocks/glass/quartz_glass_c" );
static final ResourceLocation TEXTURE_D = new ResourceLocation( "appliedenergistics2:blocks/glass/quartz_glass_d" );
static final Material TEXTURE_A = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( "appliedenergistics2:block/glass/quartz_glass_a" ));
static final Material TEXTURE_B = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( "appliedenergistics2:block/glass/quartz_glass_b" ));
static final Material TEXTURE_C = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( "appliedenergistics2:block/glass/quartz_glass_c" ));
static final Material TEXTURE_D = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( "appliedenergistics2:block/glass/quartz_glass_d" ));
// Frame texture
static final ResourceLocation[] TEXTURES_FRAME = generateTexturesFrame();
static final Material[] TEXTURES_FRAME = generateTexturesFrame();
// Generates the required textures for the frame
private static ResourceLocation[] generateTexturesFrame()
private static Material[] generateTexturesFrame()
{
return IntStream.range( 1, 16 )
.mapToObj( Integer::toBinaryString )
.map( s -> Strings.padStart( s, 4, '0' ) )
.map( s -> new ResourceLocation( "appliedenergistics2:blocks/glass/quartz_glass_frame" + s ) )
.toArray( ResourceLocation[]::new );
.map( s -> new ResourceLocation( "appliedenergistics2:block/glass/quartz_glass_frame" + s ) )
.map( rl -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, rl) )
.toArray( Material[]::new );
}
private final TextureAtlasSprite[] glassTextures;
private final TextureAtlasSprite[] frameTextures;
private final VertexFormat vertexFormat;
public GlassBakedModel( VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
public GlassBakedModel( Function<Material, TextureAtlasSprite> bakedTextureGetter )
{
this.glassTextures = new TextureAtlasSprite[] {
bakedTextureGetter.apply( TEXTURE_A ),
@@ -83,8 +96,6 @@ class GlassBakedModel implements IBakedModel
bakedTextureGetter.apply( TEXTURE_D )
};
this.vertexFormat = format;
// The first frame texture would be empty, so we simply leave it set to null here
this.frameTextures = new TextureAtlasSprite[16];
for( int i = 0; i < TEXTURES_FRAME.length; i++ )
@@ -94,15 +105,14 @@ class GlassBakedModel implements IBakedModel
}
@Override
public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, long rand )
public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData )
{
if( !( state instanceof IExtendedBlockState ) || side == null )
if( side == null )
{
return Collections.emptyList();
}
final IExtendedBlockState extState = (IExtendedBlockState) state;
final GlassState glassState = extState.getValue( BlockQuartzGlass.GLASS_STATE );
final GlassState glassState = extraData.getData( GLASS_STATE );
if( glassState == null )
{
@@ -153,6 +163,13 @@ class GlassBakedModel implements IBakedModel
return quads;
}
@Override
public boolean func_230044_c_()
{
// TODO: Forge: Auto-generated method stub
return false;
}
/**
* Creates the bitmask that indicates, in which directions (in terms of u,v space) a border should be drawn.
*/
@@ -217,8 +234,9 @@ class GlassBakedModel implements IBakedModel
float v1 = MathHelper.clamp( 0 - vOffset, 0, 16 );
float v2 = MathHelper.clamp( 16 - vOffset, 0, 16 );
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( this.vertexFormat );
builder.setTexture( sprite );
BakedQuadBuilder builder = new BakedQuadBuilder(sprite);
builder.setQuadOrientation(side);
this.putVertex( builder, normal, c1.x, c1.y, c1.z, sprite, u1, v1 );
this.putVertex( builder, normal, c2.x, c2.y, c2.z, sprite, u1, v2 );
this.putVertex( builder, normal, c3.x, c3.y, c3.z, sprite, u2, v2 );
@@ -231,11 +249,13 @@ class GlassBakedModel implements IBakedModel
* has to be precisely the order
* in which the vertex elements had been declared in the vertex format.
*/
private void putVertex( UnpackedBakedQuad.Builder builder, Vec3d normal, double x, double y, double z, TextureAtlasSprite sprite, float u, float v )
private void putVertex( BakedQuadBuilder builder, Vec3d normal, double x, double y, double z, TextureAtlasSprite sprite, float u, float v )
{
for( int e = 0; e < this.vertexFormat.getElementCount(); e++ )
VertexFormat vertexFormat = builder.getVertexFormat();
for( int e = 0; e < vertexFormat.getElements().size(); e++ )
{
switch( this.vertexFormat.getElement( e ).getUsage() )
VertexFormatElement el = vertexFormat.getElements().get(e);
switch( el.getUsage() )
{
case POSITION:
builder.put( e, (float) x, (float) y, (float) z, 1.0f );
@@ -244,7 +264,7 @@ class GlassBakedModel implements IBakedModel
builder.put( e, 1.0f, 1.0f, 1.0f, 1.0f );
break;
case UV:
if( this.vertexFormat.getElement( e ).getIndex() == 0 )
if( el.getIndex() == 0 )
{
u = sprite.getInterpolatedU( u );
v = sprite.getInterpolatedV( v );
@@ -264,7 +284,7 @@ class GlassBakedModel implements IBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
@Override
@@ -291,12 +311,6 @@ class GlassBakedModel implements IBakedModel
return this.frameTextures[this.frameTextures.length - 1];
}
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return ItemCameraTransforms.DEFAULT;
}
private static byte[][][] generateOffsets()
{
final Random r = new Random( 924 );
@@ -312,4 +326,31 @@ class GlassBakedModel implements IBakedModel
return offset;
}
@Nonnull
@Override
public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) {
EnumSet<Direction> flushWith = EnumSet.noneOf( Direction.class );
// Test every direction for another glass block
for( Direction facing : Direction.values() )
{
if( isGlassBlock( world, pos, facing ) )
{
flushWith.add( facing );
}
}
GlassState glassState = new GlassState( pos.getX(), pos.getY(), pos.getZ(), flushWith );
return new ModelDataMap.Builder()
.withInitial(GLASS_STATE, glassState)
.build();
}
private static boolean isGlassBlock(IBlockReader world, BlockPos pos, Direction facing )
{
return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass;
}
}
@@ -19,52 +19,40 @@
package appeng.client.render.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import com.google.common.collect.ImmutableSet;
import net.minecraft.client.renderer.block.model.IBakedModel;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import javax.annotation.Nullable;
/**
* Model class for the connected texture glass model.
*/
public class GlassModel implements IModel
public class GlassModel implements IModelGeometry<GlassModel>
{
@Override
public Collection<ResourceLocation> getDependencies()
{
return Collections.emptySet();
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) {
return new GlassBakedModel( spriteGetter );
}
@Override
public Collection<ResourceLocation> getTextures()
{
return ImmutableSet.<ResourceLocation>builder()
.add( GlassBakedModel.TEXTURE_A, GlassBakedModel.TEXTURE_B, GlassBakedModel.TEXTURE_C, GlassBakedModel.TEXTURE_D )
.add( GlassBakedModel.TEXTURES_FRAME )
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return ImmutableSet.<Material>builder()
.add(GlassBakedModel.TEXTURE_A, GlassBakedModel.TEXTURE_B, GlassBakedModel.TEXTURE_C, GlassBakedModel.TEXTURE_D)
.add(GlassBakedModel.TEXTURES_FRAME)
.build();
}
@Override
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
return new GlassBakedModel( format, bakedTextureGetter );
}
@Override
public IModelState getDefaultState()
{
return TRSRTransformation.identity();
}
}
@@ -0,0 +1,21 @@
package appeng.client.render.model;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import net.minecraft.resources.IResourceManager;
import net.minecraftforge.client.model.IModelLoader;
public class GlassModelLoader implements IModelLoader<GlassModel> {
public static final GlassModelLoader INSTANCE = new GlassModelLoader();
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
}
@Override
public GlassModel read(JsonDeserializationContext deserializationContext, JsonObject modelContents) {
return new GlassModel();
}
}
@@ -255,6 +255,6 @@ class SpatialPylonBakedModel implements IBakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -803,7 +803,7 @@ public abstract class AEBaseContainer extends Container
if( !isg.isEmpty() && releaseQty > 0 )
{
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( isg );
IAEItemStack ais = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( isg );
ais.setStackSize( 1 );
final IAEItemStack extracted = ais.copy();
@@ -893,7 +893,7 @@ public abstract class AEBaseContainer extends Container
}
else
{
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
IAEItemStack ais = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais != null )
{
@@ -942,7 +942,7 @@ public abstract class AEBaseContainer extends Container
}
else
{
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
IAEItemStack ais = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
ais.setStackSize( 1 );
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais == null )
@@ -1041,7 +1041,7 @@ public abstract class AEBaseContainer extends Container
return input;
}
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(),
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( input ),
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( input ),
this.getActionSource() );
if( ais == null )
{
@@ -225,11 +225,11 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
final IItemHandler inv = this.getUpgradeable().getInventoryByName( "config" );
final ItemStack is = this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 );
final IStorageChannel channel = is.getItem() instanceof IStorageCell ? ( (IStorageCell) is.getItem() ).getChannel() : AEApi.instance()
final IStorageChannel channel = is.getItem() instanceof IStorageCell ? ( (IStorageCell) is.getItem() ).getChannel() : Api.INSTANCE
.storage()
.getStorageChannel( IItemStorageChannel.class );
final IMEInventory cellInv = AEApi.instance().registries().cell().getCellInventory( is, null, channel );
final IMEInventory cellInv = Api.INSTANCE.registries().cell().getCellInventory( is, null, channel );
Iterator<IAEStack> i = new NullIterator<>();
if( cellInv != null )
@@ -209,7 +209,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
final PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
final PacketMEInventoryUpdate c = this.result.isSimulation() ? new PacketMEInventoryUpdate( (byte) 2 ) : null;
final IItemList<IAEItemStack> plan = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> plan = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.result.populatePlan( plan );
this.setUsedBytes( this.result.getByteTotal() );
@@ -226,7 +226,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
p.setStackSize( out.getCountRequestable() );
final IStorageGrid sg = this.getGrid().getCache( IStorageGrid.class );
final IMEInventory<IAEItemStack> items = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final IMEInventory<IAEItemStack> items = sg.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
IAEItemStack m = null;
if( c != null && this.result.isSimulation() )
@@ -53,7 +53,7 @@ import appeng.util.Platform;
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
{
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IGrid network;
private CraftingCPUCluster monitor = null;
private String cpuName = null;
@@ -120,14 +120,14 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
if( s == this.middle )
{
IItemDefinition press = AEApi.instance().definitions().materials().namePress();
IItemDefinition press = Api.INSTANCE.definitions().materials().namePress();
if( press.isSameAs( top ) || press.isSameAs( bot ) )
{
return !press.isSameAs( is );
}
boolean matches = false;
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
for( final IInscriberRecipe recipe : Api.INSTANCE.registries().inscriber().getRecipes() )
{
final boolean matchA = !top
.isEmpty() && ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) || Platform
@@ -168,14 +168,14 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
}
// name presses
final IItemDefinition namePress = AEApi.instance().definitions().materials().namePress();
final IItemDefinition namePress = Api.INSTANCE.definitions().materials().namePress();
if( namePress.isSameAs( otherSlot ) )
{
return namePress.isSameAs( is );
}
// everything else
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
for( final IInscriberRecipe recipe : Api.INSTANCE.registries().inscriber().getRecipes() )
{
boolean isValid = false;
if( Platform.itemComparisons().isSameItem( otherSlot, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) )
@@ -78,7 +78,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
private final IMEMonitor<IAEItemStack> monitor;
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> items = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IConfigManager clientCM;
private final ITerminalHost host;
@GuiSync( 99 )
@@ -109,7 +109,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
this.serverCM = monitorable.getConfigManager();
this.monitor = monitorable.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.monitor = monitorable.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
if( this.monitor != null )
{
this.monitor.addListener( this, null );
@@ -189,7 +189,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
if( Platform.isServer() )
{
if( this.monitor != this.host.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) )
if( this.monitor != this.host.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) )
{
this.setValidContainer( false );
}
@@ -114,7 +114,7 @@ public class ContainerNetworkStatus extends AEBaseContainer
for( final Class<? extends IGridHost> machineClass : this.network.getMachinesClasses() )
{
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
for( final IGridNode machine : this.network.getMachines( machineClass ) )
{
final IGridBlock blk = machine.getGridBlock();
@@ -237,7 +237,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
// add a new encoded pattern.
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 );
Optional<ItemStack> maybePattern = Api.INSTANCE.definitions().items().encodedPattern().maybeStack( 1 );
if( maybePattern.isPresent() )
{
output = maybePattern.get();
@@ -334,7 +334,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
return false;
}
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
boolean isPattern = definitions.items().encodedPattern().isSameAs( output );
isPattern |= definitions.materials().blankPattern().isSameAs( output );
@@ -419,7 +419,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal()
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IItemList<IAEItemStack> all = storage.getStorageList();
final ItemStack is = r.getCraftingResult( ic );
@@ -121,7 +121,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
if( ContainerQuartzKnife.this.myName.length() > 0 )
{
return AEApi.instance().definitions().materials().namePress().maybeStack( 1 ).map( namePressStack ->
return Api.INSTANCE.definitions().materials().namePress().maybeStack( 1 ).map( namePressStack ->
{
final CompoundNBT compound = namePressStack.getOrCreateTag();
compound.putString("InscribeName", ContainerQuartzKnife.this.myName);
@@ -156,7 +156,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
networkEncodable = (INetworkEncodable) term.getItem();
}
final IWirelessTermHandler wTermHandler = AEApi.instance().registries().wireless().getWirelessTerminalHandler( term );
final IWirelessTermHandler wTermHandler = Api.INSTANCE.registries().wireless().getWirelessTerminalHandler( term );
if( wTermHandler != null )
{
networkEncodable = wTermHandler;
@@ -159,7 +159,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
if( cellInv != null )
{
final IItemList<IAEItemStack> list = cellInv
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
i = list.iterator();
}
@@ -107,7 +107,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
return;
}
final IMEMonitor<IAEItemStack> inv = this.storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final IMEMonitor<IAEItemStack> inv = this.storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final int howManyPerCraft = this.getStack().getCount();
int maxTimesToCraft = 0;
@@ -52,7 +52,7 @@ public class SlotPatternTerm extends SlotCraftingTerm
public AppEngPacket getRequest( final boolean shift ) throws IOException
{
return new PacketPatternSlot( this
.getPattern(), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.getStack() ), shift );
.getPattern(), Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.getStack() ), shift );
}
@Override
@@ -122,7 +122,7 @@ public class SlotRestrictedInput extends AppEngSlot
return false;
}
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IMaterials materials = definitions.materials();
final IItems items = definitions.items();
@@ -170,7 +170,7 @@ public class SlotRestrictedInput extends AppEngSlot
return true;
}
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
for( final ItemStack optional : Api.INSTANCE.registries().inscriber().getOptionals() )
{
if( Platform.itemComparisons().isSameItem( i, optional ) )
{
@@ -194,7 +194,7 @@ public class SlotRestrictedInput extends AppEngSlot
case VIEW_CELL:
return items.viewCell().isSameAs( i );
case ORE:
return appeng.api.AEApi.instance().registries().grinder().getRecipeForInput( i ) != null;
return appeng.api.Api.INSTANCE.registries().grinder().getRecipeForInput( i ) != null;
case FUEL:
return TileEntityFurnace.getItemBurnTime( i ) > 0;
case POWERED_TOOL:
@@ -208,20 +208,20 @@ public class SlotRestrictedInput extends AppEngSlot
case SPATIAL_STORAGE_CELLS:
return i.getItem() instanceof ISpatialStorageCell && ( (ISpatialStorageCell) i.getItem() ).isSpatialStorage( i );
case STORAGE_CELLS:
return AEApi.instance().registries().cell().isCellHandled( i );
return Api.INSTANCE.registries().cell().isCellHandled( i );
case WORKBENCH_CELL:
return i.getItem() instanceof ICellWorkbenchItem && ( (ICellWorkbenchItem) i.getItem() ).isEditable( i );
case STORAGE_COMPONENT:
return i.getItem() instanceof IStorageComponent && ( (IStorageComponent) i.getItem() ).isStorageComponent( i );
case TRASH:
if( AEApi.instance().registries().cell().isCellHandled( i ) )
if( Api.INSTANCE.registries().cell().isCellHandled( i ) )
{
return false;
}
return !( i.getItem() instanceof IStorageComponent && ( (IStorageComponent) i.getItem() ).isStorageComponent( i ) );
case ENCODABLE_ITEM:
return i.getItem() instanceof INetworkEncodable || AEApi.instance().registries().wireless().isWirelessTerminal( i );
return i.getItem() instanceof INetworkEncodable || Api.INSTANCE.registries().wireless().isWirelessTerminal( i );
case BIOMETRIC_CARD:
return i.getItem() instanceof IBiometricCard;
case UPGRADES:
+5 -15
View File
@@ -25,6 +25,7 @@ import appeng.api.definitions.IMaterials;
import appeng.api.definitions.IParts;
import appeng.bootstrap.FeatureFactory;
import appeng.core.api.definitions.ApiBlocks;
import appeng.core.api.definitions.ApiItems;
import appeng.core.features.registries.PartModels;
@@ -33,9 +34,8 @@ import appeng.core.features.registries.PartModels;
*/
public final class ApiDefinitions implements IDefinitions
{
// TODO : Check if this can be final again after the Register part.
private ApiBlocks blocks;
// private ApiItems items;
private final ApiBlocks blocks;
private final ApiItems items;
//private final ApiMaterials materials;
//private final ApiParts parts;
@@ -44,20 +44,10 @@ public final class ApiDefinitions implements IDefinitions
public ApiDefinitions( final PartModels partModels )
{
this.blocks = new ApiBlocks( this.registry, partModels );
// this.items = new ApiItems( this.registry );
this.items = new ApiItems( this.registry );
//this.materials = new ApiMaterials( this.registry );
//this.parts = new ApiParts( this.registry, partModels );
}
//
// public void addBlocks( final PartModels partModels )
// {
// this.blocks = new ApiBlocks( registry, partModels );
// }
//
// public void addItems()
// {
// this.items = new ApiItems( registry );
// }
public FeatureFactory getRegistry()
{
@@ -73,7 +63,7 @@ public final class ApiDefinitions implements IDefinitions
@Override
public IItems items()
{
return null /* FIXME */;
return items;
}
@Override
+5 -6
View File
@@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import appeng.client.ClientHelper;
import appeng.core.features.AEFeature;
import appeng.server.ServerHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
@@ -83,6 +84,9 @@ public final class AppEng
//FIXMEthis.registration = new Registration();
//FIXMEMinecraftForge.EVENT_BUS.register( this.registration );
CreativeTab.init();
CreativeTabFacade.init();
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
Registration registration = new Registration();
modEventBus.addGenericListener(Block.class, registration::registerBlocks);
@@ -140,11 +144,6 @@ public final class AppEng
//
// AELog.info( "Pre Initialization ( started )" );
//
// CreativeTab.init();
// if( AEConfig.instance().isFeatureEnabled( AEFeature.FACADES ) )
// {
// CreativeTabFacade.init();
// }
//
// for( final IntegrationType type : IntegrationType.values() )
// {
@@ -172,7 +171,7 @@ public final class AppEng
//
// // Instantiate all Plugins
// List<Object> injectables = Lists.newArrayList(
// AEApi.instance() );
// Api.INSTANCE );
// new PluginLoader().loadPlugins( injectables, event.getAsmData() );
// }
//
+6 -4
View File
@@ -38,7 +38,7 @@ public final class CreativeTab
static void init()
{
instance = new ItemGroup( 11, "appliedenergistics2" )
instance = new ItemGroup( "appliedenergistics2" )
{
@Override
@@ -49,13 +49,15 @@ public final class CreativeTab
private ItemStack getIconItemStack()
{
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IBlocks blocks = definitions.blocks();
final IItems items = definitions.items();
final IMaterials materials = definitions.materials();
return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(),
materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() );
return findFirst(blocks.quartzOre());
// FIXME return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(),
// FIXME materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() );
}
private ItemStack findFirst( final IItemDefinition... choices )
@@ -22,44 +22,34 @@ package appeng.core;
import java.util.Optional;
import net.minecraft.block.Blocks;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.items.parts.ItemFacade;
public final class CreativeTabFacade extends CreativeTabs
public final class CreativeTabFacade
{
public static CreativeTabFacade instance = null;
public CreativeTabFacade()
{
super( "appliedenergistics2.facades" );
}
public static ItemGroup instance = null;
static void init()
{
instance = new CreativeTabFacade();
instance = new ItemGroup("appliedenergistics2.facades") {
@Override
public ItemStack createIcon()
{
// FIXME final Optional<Item> maybeFacade = Api.INSTANCE.definitions().items().facade().maybeItem();
// FIXME if( maybeFacade.isPresent() )
{
// FIXME return ( (ItemFacade) maybeFacade.get() ).getCreativeTabIcon();
}
return new ItemStack( Blocks.OAK_PLANKS );
}
};
}
@Override
public ItemStack getTabIconItem()
{
return this.getIconItemStack();
}
@Override
public ItemStack getIconItemStack()
{
final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem();
if( maybeFacade.isPresent() )
{
return ( (ItemFacade) maybeFacade.get() ).getCreativeTabIcon();
}
return new ItemStack( Blocks.PLANKS );
}
}
+12 -21
View File
@@ -19,49 +19,39 @@
package appeng.core;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import appeng.bootstrap.IModelRegistry;
import appeng.bootstrap.components.IBlockRegistrationComponent;
import appeng.bootstrap.components.IEntityRegistrationComponent;
import appeng.bootstrap.components.IItemRegistrationComponent;
import appeng.bootstrap.components.IModelRegistrationComponent;
import appeng.client.render.effects.ChargedOreFX;
import com.google.common.base.Preconditions;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.advancements.ICriterionInstance;
import net.minecraft.advancements.ICriterionTrigger;
import appeng.client.render.model.GlassModelLoader;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.particles.BasicParticleType;
import net.minecraft.particles.ParticleType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.GenericEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.registries.IForgeRegistry;
import appeng.bootstrap.components.IBlockRegistrationComponent;
import appeng.bootstrap.components.IItemRegistrationComponent;
final class Registration
{
// DimensionType storageDimensionType;
public Registration() {
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "glass"), GlassModelLoader.INSTANCE);
}
// DimensionType storageDimensionType;
// int storageDimensionID;
// Biome storageBiome;
// AdvancementTriggers advancementTriggers;
@@ -191,6 +181,7 @@ final class Registration
@OnlyIn( Dist.CLIENT )
public void modelRegistryEvent( ModelRegistryEvent event )
{
final ApiDefinitions definitions = Api.INSTANCE.definitions();
final IModelRegistry registry = new IModelRegistry() {
@Override
@@ -200,7 +191,7 @@ final class Registration
@Override
public void setCustomModelResourceLocation(Item item, int metadata, ModelResourceLocation model) {
// TODO: this does not actually work
// FIXME: this does not actually work
ItemModelMesher mesher = Minecraft.getInstance().getItemRenderer().getItemModelMesher();
mesher.register(item, model);
}
@@ -22,13 +22,19 @@ package appeng.core.api.definitions;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.FeatureFactory;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.model.GlassModel;
import appeng.core.features.AEFeature;
import appeng.core.features.registries.PartModels;
import appeng.decorative.solid.BlockChargedQuartzOre;
import appeng.decorative.solid.BlockQuartzOre;
import appeng.decorative.AEDecorativeBlock;
import appeng.decorative.solid.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/**
@@ -114,34 +120,37 @@ public final class ApiBlocks implements IBlocks
private IBlockDefinition cubeGenerator;
private IBlockDefinition energyGenerator;
private static final Block.Properties QUARTZ_PROPERTIES = Block.Properties.create(Material.ROCK)
.hardnessAndResistance(3, 5);
public ApiBlocks( FeatureFactory registry, PartModels partModels )
{
this.quartzOre = registry.block( "quartz_ore", () -> new BlockQuartzOre(Block.Properties.create(Material.ROCK).hardnessAndResistance(3, 5)))
this.quartzOre = registry.block( "quartz_ore", () -> new BlockQuartzOre(QUARTZ_PROPERTIES))
.features( AEFeature.CERTUS_ORE )
.build();
this.quartzOreCharged = registry.block( "charged_quartz_ore", () -> new BlockChargedQuartzOre(Block.Properties.create(Material.ROCK).hardnessAndResistance(3, 5)) )
this.quartzOreCharged = registry.block( "charged_quartz_ore", () -> new BlockChargedQuartzOre(QUARTZ_PROPERTIES) )
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
.build();
// this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
//
// FeatureFactory deco = registry.features( AEFeature.DECORATIVE_BLOCKS );
// this.quartzBlock = deco.block( "quartz_block", BlockQuartz::new ).build();
// this.quartzPillar = deco.block( "quartz_pillar", BlockQuartzPillar::new ).build();
// this.chiseledQuartzBlock = deco.block( "chiseled_quartz_block", BlockChiseledQuartz::new ).build();
//
// this.quartzGlass = registry.features( AEFeature.QUARTZ_GLASS )
// .block( "quartz_glass", BlockQuartzGlass::new )
FeatureFactory deco = registry.features( AEFeature.DECORATIVE_BLOCKS );
this.quartzBlock = deco.block( "quartz_block", () -> new AEDecorativeBlock(QUARTZ_PROPERTIES) ).build();
this.quartzPillar = deco.block( "quartz_pillar", () -> new BlockQuartzPillar(QUARTZ_PROPERTIES) ).build();
this.chiseledQuartzBlock = deco.block( "chiseled_quartz_block", () -> new AEDecorativeBlock(QUARTZ_PROPERTIES) ).build();
this.quartzGlass = registry.features( AEFeature.QUARTZ_GLASS )
.block( "quartz_glass", BlockQuartzGlass::new )
// .useCustomItemModel()
// FIXME .rendering( new BlockRenderingCustomizer()
// FIXME {
// FIXME @Override
// FIXME @OnlyIn( Dist.CLIENT )
// FIXME public void customize( IBlockRendering rendering, IItemRendering itemRendering )
// FIXME {
// FIXME rendering.builtInModel( "models/block/builtin/quartz_glass", new GlassModel() );
// FIXME }
// FIXME } )
// .build();
// .rendering( new BlockRenderingCustomizer()
// {
// @Override
// @OnlyIn( Dist.CLIENT)
// public void customize(IBlockRendering rendering, IItemRendering itemRendering )
// {
// rendering.builtInModel( "models/block/builtin/quartz_glass", new GlassModel() );
// }
// } )
.build();
// this.quartzVibrantGlass = deco.block( "quartz_vibrant_glass", BlockQuartzLamp::new )
// .addFeatures( AEFeature.DECORATIVE_LIGHTS, AEFeature.QUARTZ_GLASS )
// .useCustomItemModel()
@@ -19,62 +19,12 @@
package appeng.core.api.definitions;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IItems;
import appeng.api.util.AEColoredItemDefinition;
import appeng.bootstrap.FeatureFactory;
import appeng.bootstrap.components.IEntityRegistrationComponent;
import appeng.bootstrap.components.IOreDictComponent;
import appeng.client.render.crafting.ItemEncodedPatternRendering;
import appeng.core.CreativeTabFacade;
import appeng.core.features.AEFeature;
import appeng.debug.ToolDebugCard;
import appeng.debug.ToolEraser;
import appeng.debug.ToolMeteoritePlacer;
import appeng.debug.ToolReplicatorCard;
import appeng.entity.EntityGrowingCrystal;
import appeng.entity.EntityIds;
import appeng.fluids.items.BasicFluidStorageCell;
import appeng.fluids.items.FluidDummyItem;
import appeng.fluids.items.FluidDummyItemRendering;
import appeng.hooks.DispenserBlockTool;
import appeng.hooks.DispenserMatterCannon;
import appeng.items.materials.MaterialType;
import appeng.items.misc.ItemCrystalSeed;
import appeng.items.misc.ItemCrystalSeedRendering;
import appeng.items.misc.ItemEncodedPattern;
import appeng.items.misc.ItemPaintBall;
import appeng.items.misc.ItemPaintBallRendering;
import appeng.items.parts.FacadeRendering;
import appeng.items.parts.ItemFacade;
import appeng.items.storage.BasicItemStorageCell;
import appeng.items.storage.ItemCreativeStorageCell;
import appeng.items.storage.ItemSpatialStorageCell;
import appeng.items.storage.ItemViewCell;
import appeng.items.tools.ToolBiometricCard;
import appeng.items.tools.ToolBiometricCardRendering;
import appeng.items.tools.ToolMemoryCard;
import appeng.items.tools.ToolMemoryCardRendering;
import appeng.items.tools.ToolNetworkTool;
import appeng.items.tools.powered.ToolChargedStaff;
import appeng.items.tools.powered.ToolColorApplicator;
import appeng.items.tools.powered.ToolColorApplicatorRendering;
import appeng.items.tools.powered.ToolEntropyManipulator;
import appeng.items.tools.powered.ToolMatterCannon;
import appeng.items.tools.powered.ToolPortableCell;
import appeng.items.tools.powered.ToolWirelessTerminal;
import appeng.items.tools.quartz.ToolQuartzAxe;
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
import appeng.items.tools.quartz.ToolQuartzHoe;
import appeng.items.tools.quartz.ToolQuartzPickaxe;
import appeng.items.tools.quartz.ToolQuartzSpade;
import appeng.items.tools.quartz.ToolQuartzSword;
import appeng.items.tools.quartz.ToolQuartzWrench;
import appeng.items.tools.quartz.*;
/**
@@ -82,66 +32,67 @@ import appeng.items.tools.quartz.ToolQuartzWrench;
*/
public final class ApiItems implements IItems
{
private final IItemDefinition certusQuartzAxe;
private final IItemDefinition certusQuartzHoe;
private final IItemDefinition certusQuartzShovel;
private final IItemDefinition certusQuartzPick;
private final IItemDefinition certusQuartzSword;
private final IItemDefinition certusQuartzWrench;
private final IItemDefinition certusQuartzKnife;
// FIXME: Make final after porting
private IItemDefinition certusQuartzAxe;
private IItemDefinition certusQuartzHoe;
private IItemDefinition certusQuartzShovel;
private IItemDefinition certusQuartzPick;
private IItemDefinition certusQuartzSword;
private IItemDefinition certusQuartzWrench;
private IItemDefinition certusQuartzKnife;
private final IItemDefinition netherQuartzAxe;
private final IItemDefinition netherQuartzHoe;
private final IItemDefinition netherQuartzShovel;
private final IItemDefinition netherQuartzPick;
private final IItemDefinition netherQuartzSword;
private final IItemDefinition netherQuartzWrench;
private final IItemDefinition netherQuartzKnife;
private IItemDefinition netherQuartzAxe;
private IItemDefinition netherQuartzHoe;
private IItemDefinition netherQuartzShovel;
private IItemDefinition netherQuartzPick;
private IItemDefinition netherQuartzSword;
private IItemDefinition netherQuartzWrench;
private IItemDefinition netherQuartzKnife;
private final IItemDefinition entropyManipulator;
private final IItemDefinition wirelessTerminal;
private final IItemDefinition biometricCard;
private final IItemDefinition chargedStaff;
private final IItemDefinition massCannon;
private final IItemDefinition memoryCard;
private final IItemDefinition networkTool;
private final IItemDefinition portableCell;
private IItemDefinition entropyManipulator;
private IItemDefinition wirelessTerminal;
private IItemDefinition biometricCard;
private IItemDefinition chargedStaff;
private IItemDefinition massCannon;
private IItemDefinition memoryCard;
private IItemDefinition networkTool;
private IItemDefinition portableCell;
private final IItemDefinition cellCreative;
private final IItemDefinition viewCell;
private IItemDefinition cellCreative;
private IItemDefinition viewCell;
private final IItemDefinition cell1k;
private final IItemDefinition cell4k;
private final IItemDefinition cell16k;
private final IItemDefinition cell64k;
private IItemDefinition cell1k;
private IItemDefinition cell4k;
private IItemDefinition cell16k;
private IItemDefinition cell64k;
private final IItemDefinition fluidCell1k;
private final IItemDefinition fluidCell4k;
private final IItemDefinition fluidCell16k;
private final IItemDefinition fluidCell64k;
private IItemDefinition fluidCell1k;
private IItemDefinition fluidCell4k;
private IItemDefinition fluidCell16k;
private IItemDefinition fluidCell64k;
private final IItemDefinition spatialCell2;
private final IItemDefinition spatialCell16;
private final IItemDefinition spatialCell128;
private IItemDefinition spatialCell2;
private IItemDefinition spatialCell16;
private IItemDefinition spatialCell128;
private final IItemDefinition facade;
private final IItemDefinition crystalSeed;
private IItemDefinition facade;
private IItemDefinition crystalSeed;
// rv1
private final IItemDefinition encodedPattern;
private final IItemDefinition colorApplicator;
private IItemDefinition encodedPattern;
private IItemDefinition colorApplicator;
private final IItemDefinition paintBall;
private final AEColoredItemDefinition coloredPaintBall;
private final AEColoredItemDefinition coloredLumenPaintBall;
private IItemDefinition paintBall;
private AEColoredItemDefinition coloredPaintBall;
private AEColoredItemDefinition coloredLumenPaintBall;
// unsupported dev tools
private final IItemDefinition toolEraser;
private final IItemDefinition toolMeteoritePlacer;
private final IItemDefinition toolDebugCard;
private final IItemDefinition toolReplicatorCard;
private IItemDefinition toolEraser;
private IItemDefinition toolMeteoritePlacer;
private IItemDefinition toolDebugCard;
private IItemDefinition toolReplicatorCard;
private final IItemDefinition dummyFluidItem;
private IItemDefinition dummyFluidItem;
public ApiItems( FeatureFactory registry )
{
@@ -163,11 +114,11 @@ public final class ApiItems implements IItems
.build();
this.certusQuartzWrench = certusTools.item( "certus_quartz_wrench", ToolQuartzWrench::new )
.addFeatures( AEFeature.QUARTZ_WRENCH )
.bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzWrench", new ItemStack( item ) ) )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzWrench", new ItemStack( item ) ) )
.build();
this.certusQuartzKnife = certusTools.item( "certus_quartz_cutting_knife", () -> new ToolQuartzCuttingKnife( AEFeature.CERTUS_QUARTZ_TOOLS ) )
.addFeatures( AEFeature.QUARTZ_KNIFE )
.bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzKnife", new ItemStack( item ) ) )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzKnife", new ItemStack( item ) ) )
.build();
FeatureFactory netherTools = registry.features( AEFeature.NETHER_QUARTZ_TOOLS );
@@ -188,102 +139,102 @@ public final class ApiItems implements IItems
.build();
this.netherQuartzWrench = netherTools.item( "nether_quartz_wrench", ToolQuartzWrench::new )
.addFeatures( AEFeature.QUARTZ_WRENCH )
.bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzWrench", new ItemStack( item ) ) )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzWrench", new ItemStack( item ) ) )
.build();
this.netherQuartzKnife = netherTools.item( "nether_quartz_cutting_knife", () -> new ToolQuartzCuttingKnife( AEFeature.NETHER_QUARTZ_TOOLS ) )
.addFeatures( AEFeature.QUARTZ_KNIFE )
.bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzKnife", new ItemStack( item ) ) )
// FIXME .bootstrap( item -> (IOreDictComponent) side -> OreDictionary.registerOre( "itemQuartzKnife", new ItemStack( item ) ) )
.build();
FeatureFactory powerTools = registry.features( AEFeature.POWERED_TOOLS );
this.entropyManipulator = powerTools.item( "entropy_manipulator", ToolEntropyManipulator::new )
.addFeatures( AEFeature.ENTROPY_MANIPULATOR )
.dispenserBehavior( DispenserBlockTool::new )
.build();
this.wirelessTerminal = powerTools.item( "wireless_terminal", ToolWirelessTerminal::new ).addFeatures( AEFeature.WIRELESS_ACCESS_TERMINAL ).build();
this.chargedStaff = powerTools.item( "charged_staff", ToolChargedStaff::new ).addFeatures( AEFeature.CHARGED_STAFF ).build();
this.massCannon = powerTools.item( "matter_cannon", ToolMatterCannon::new )
.addFeatures( AEFeature.MATTER_CANNON )
.dispenserBehavior( DispenserMatterCannon::new )
.build();
this.portableCell = powerTools.item( "portable_cell", ToolPortableCell::new ).addFeatures( AEFeature.PORTABLE_CELL, AEFeature.STORAGE_CELLS ).build();
this.colorApplicator = powerTools.item( "color_applicator", ToolColorApplicator::new )
.addFeatures( AEFeature.COLOR_APPLICATOR )
.dispenserBehavior( DispenserBlockTool::new )
.rendering( new ToolColorApplicatorRendering() )
.build();
this.biometricCard = registry.item( "biometric_card", ToolBiometricCard::new )
.rendering( new ToolBiometricCardRendering() )
.features( AEFeature.SECURITY )
.build();
this.memoryCard = registry.item( "memory_card", ToolMemoryCard::new )
.rendering( new ToolMemoryCardRendering() )
.features( AEFeature.MEMORY_CARD )
.build();
this.networkTool = registry.item( "network_tool", ToolNetworkTool::new ).features( AEFeature.NETWORK_TOOL ).build();
this.cellCreative = registry.item( "creative_storage_cell", ItemCreativeStorageCell::new )
.features( AEFeature.STORAGE_CELLS, AEFeature.CREATIVE )
.build();
this.viewCell = registry.item( "view_cell", ItemViewCell::new ).features( AEFeature.VIEW_CELL ).build();
FeatureFactory storageCells = registry.features( AEFeature.STORAGE_CELLS );
this.cell1k = storageCells.item( "storage_cell_1k", () -> new BasicItemStorageCell( MaterialType.CELL1K_PART, 1 ) ).build();
this.cell4k = storageCells.item( "storage_cell_4k", () -> new BasicItemStorageCell( MaterialType.CELL4K_PART, 4 ) ).build();
this.cell16k = storageCells.item( "storage_cell_16k", () -> new BasicItemStorageCell( MaterialType.CELL16K_PART, 16 ) ).build();
this.cell64k = storageCells.item( "storage_cell_64k", () -> new BasicItemStorageCell( MaterialType.CELL64K_PART, 64 ) ).build();
this.fluidCell1k = storageCells.item( "fluid_storage_cell_1k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL1K_PART, 1 ) ).build();
this.fluidCell4k = storageCells.item( "fluid_storage_cell_4k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL4K_PART, 4 ) ).build();
this.fluidCell16k = storageCells.item( "fluid_storage_cell_16k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL16K_PART, 16 ) ).build();
this.fluidCell64k = storageCells.item( "fluid_storage_cell_64k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL64K_PART, 64 ) ).build();
FeatureFactory spatialCells = registry.features( AEFeature.SPATIAL_IO );
this.spatialCell2 = spatialCells.item( "spatial_storage_cell_2_cubed", () -> new ItemSpatialStorageCell( 2 ) ).build();
this.spatialCell16 = spatialCells.item( "spatial_storage_cell_16_cubed", () -> new ItemSpatialStorageCell( 16 ) ).build();
this.spatialCell128 = spatialCells.item( "spatial_storage_cell_128_cubed", () -> new ItemSpatialStorageCell( 128 ) ).build();
this.facade = registry.item( "facade", ItemFacade::new )
.features( AEFeature.FACADES )
.creativeTab( CreativeTabFacade.instance )
.rendering( new FacadeRendering() )
.build();
this.crystalSeed = registry.item( "crystal_seed", ItemCrystalSeed::new )
.features( AEFeature.CRYSTAL_SEEDS )
.rendering( new ItemCrystalSeedRendering() )
.bootstrap( item -> (IEntityRegistrationComponent) r ->
{
r.register( EntityEntryBuilder.create()
.entity( EntityGrowingCrystal.class )
.id( new ResourceLocation( "appliedenergistics2", EntityGrowingCrystal.class.getName() ),
EntityIds.get( EntityGrowingCrystal.class ) )
.name( EntityGrowingCrystal.class.getSimpleName() )
.tracker( 16, 4, true )
.build() );
} )
.build();
// rv1
this.encodedPattern = registry.item( "encoded_pattern", ItemEncodedPattern::new )
.features( AEFeature.PATTERNS )
.rendering( new ItemEncodedPatternRendering() )
.build();
this.paintBall = registry.item( "paint_ball", ItemPaintBall::new )
.features( AEFeature.PAINT_BALLS )
.rendering( new ItemPaintBallRendering() )
.build();
this.coloredPaintBall = registry.colored( this.paintBall, 0 );
this.coloredLumenPaintBall = registry.colored( this.paintBall, 20 );
FeatureFactory debugTools = registry.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE );
this.toolEraser = debugTools.item( "debug_eraser", ToolEraser::new ).build();
this.toolMeteoritePlacer = debugTools.item( "debug_meteorite_placer", ToolMeteoritePlacer::new ).build();
this.toolDebugCard = debugTools.item( "debug_card", ToolDebugCard::new ).build();
this.toolReplicatorCard = debugTools.item( "debug_replicator_card", ToolReplicatorCard::new ).build();
this.dummyFluidItem = registry.item( "dummy_fluid_item", FluidDummyItem::new ).rendering( new FluidDummyItemRendering() ).build();
// FeatureFactory powerTools = registry.features( AEFeature.POWERED_TOOLS );
// this.entropyManipulator = powerTools.item( "entropy_manipulator", ToolEntropyManipulator::new )
// .addFeatures( AEFeature.ENTROPY_MANIPULATOR )
// .dispenserBehavior( DispenserBlockTool::new )
// .build();
// this.wirelessTerminal = powerTools.item( "wireless_terminal", ToolWirelessTerminal::new ).addFeatures( AEFeature.WIRELESS_ACCESS_TERMINAL ).build();
// this.chargedStaff = powerTools.item( "charged_staff", ToolChargedStaff::new ).addFeatures( AEFeature.CHARGED_STAFF ).build();
// this.massCannon = powerTools.item( "matter_cannon", ToolMatterCannon::new )
// .addFeatures( AEFeature.MATTER_CANNON )
// .dispenserBehavior( DispenserMatterCannon::new )
// .build();
// this.portableCell = powerTools.item( "portable_cell", ToolPortableCell::new ).addFeatures( AEFeature.PORTABLE_CELL, AEFeature.STORAGE_CELLS ).build();
// this.colorApplicator = powerTools.item( "color_applicator", ToolColorApplicator::new )
// .addFeatures( AEFeature.COLOR_APPLICATOR )
// .dispenserBehavior( DispenserBlockTool::new )
// .rendering( new ToolColorApplicatorRendering() )
// .build();
//
// this.biometricCard = registry.item( "biometric_card", ToolBiometricCard::new )
// .rendering( new ToolBiometricCardRendering() )
// .features( AEFeature.SECURITY )
// .build();
// this.memoryCard = registry.item( "memory_card", ToolMemoryCard::new )
// .rendering( new ToolMemoryCardRendering() )
// .features( AEFeature.MEMORY_CARD )
// .build();
// this.networkTool = registry.item( "network_tool", ToolNetworkTool::new ).features( AEFeature.NETWORK_TOOL ).build();
//
// this.cellCreative = registry.item( "creative_storage_cell", ItemCreativeStorageCell::new )
// .features( AEFeature.STORAGE_CELLS, AEFeature.CREATIVE )
// .build();
// this.viewCell = registry.item( "view_cell", ItemViewCell::new ).features( AEFeature.VIEW_CELL ).build();
//
// FeatureFactory storageCells = registry.features( AEFeature.STORAGE_CELLS );
// this.cell1k = storageCells.item( "storage_cell_1k", () -> new BasicItemStorageCell( MaterialType.CELL1K_PART, 1 ) ).build();
// this.cell4k = storageCells.item( "storage_cell_4k", () -> new BasicItemStorageCell( MaterialType.CELL4K_PART, 4 ) ).build();
// this.cell16k = storageCells.item( "storage_cell_16k", () -> new BasicItemStorageCell( MaterialType.CELL16K_PART, 16 ) ).build();
// this.cell64k = storageCells.item( "storage_cell_64k", () -> new BasicItemStorageCell( MaterialType.CELL64K_PART, 64 ) ).build();
//
// this.fluidCell1k = storageCells.item( "fluid_storage_cell_1k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL1K_PART, 1 ) ).build();
// this.fluidCell4k = storageCells.item( "fluid_storage_cell_4k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL4K_PART, 4 ) ).build();
// this.fluidCell16k = storageCells.item( "fluid_storage_cell_16k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL16K_PART, 16 ) ).build();
// this.fluidCell64k = storageCells.item( "fluid_storage_cell_64k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL64K_PART, 64 ) ).build();
//
// FeatureFactory spatialCells = registry.features( AEFeature.SPATIAL_IO );
// this.spatialCell2 = spatialCells.item( "spatial_storage_cell_2_cubed", () -> new ItemSpatialStorageCell( 2 ) ).build();
// this.spatialCell16 = spatialCells.item( "spatial_storage_cell_16_cubed", () -> new ItemSpatialStorageCell( 16 ) ).build();
// this.spatialCell128 = spatialCells.item( "spatial_storage_cell_128_cubed", () -> new ItemSpatialStorageCell( 128 ) ).build();
//
// this.facade = registry.item( "facade", ItemFacade::new )
// .features( AEFeature.FACADES )
// .creativeTab( CreativeTabFacade.instance )
// .rendering( new FacadeRendering() )
// .build();
// this.crystalSeed = registry.item( "crystal_seed", ItemCrystalSeed::new )
// .features( AEFeature.CRYSTAL_SEEDS )
// .rendering( new ItemCrystalSeedRendering() )
// .bootstrap( item -> (IEntityRegistrationComponent) r ->
// {
// r.register( EntityEntryBuilder.create()
// .entity( EntityGrowingCrystal.class )
// .id( new ResourceLocation( "appliedenergistics2", EntityGrowingCrystal.class.getName() ),
// EntityIds.get( EntityGrowingCrystal.class ) )
// .name( EntityGrowingCrystal.class.getSimpleName() )
// .tracker( 16, 4, true )
// .build() );
// } )
// .build();
//
// // rv1
// this.encodedPattern = registry.item( "encoded_pattern", ItemEncodedPattern::new )
// .features( AEFeature.PATTERNS )
// .rendering( new ItemEncodedPatternRendering() )
// .build();
//
// this.paintBall = registry.item( "paint_ball", ItemPaintBall::new )
// .features( AEFeature.PAINT_BALLS )
// .rendering( new ItemPaintBallRendering() )
// .build();
// this.coloredPaintBall = registry.colored( this.paintBall, 0 );
// this.coloredLumenPaintBall = registry.colored( this.paintBall, 20 );
//
// FeatureFactory debugTools = registry.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE );
// this.toolEraser = debugTools.item( "debug_eraser", ToolEraser::new ).build();
// this.toolMeteoritePlacer = debugTools.item( "debug_meteorite_placer", ToolMeteoritePlacer::new ).build();
// this.toolDebugCard = debugTools.item( "debug_card", ToolDebugCard::new ).build();
// this.toolReplicatorCard = debugTools.item( "debug_replicator_card", ToolReplicatorCard::new ).build();
//
// this.dummyFluidItem = registry.item( "dummy_fluid_item", FluidDummyItem::new ).rendering( new FluidDummyItemRendering() ).build();
}
@Override
@@ -35,39 +35,40 @@ import net.minecraftforge.fml.RegistryObject;
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
{
private final RegistryObject<Block> block;
private final Block block;
private final BlockItem blockItem;
public BlockDefinition( String registryName, Block block, BlockItem item )
{
super( registryName, item );
this.block = null; // FIXME // Optional.ofNullable( block );
this.block = block;
this.blockItem = item;
}
@Override
public final RegistryObject<Block> maybeBlock()
public final Block block()
{
return this.block;
}
@Override
public RegistryObject<BlockItem> maybeBlockItem()
public BlockItem blockItem()
{
// FIXME
return null;
// return this.block.map( BlockItem::new );
return blockItem;
}
@Override
public final Optional<ItemStack> maybeStack( int stackSize )
public final ItemStack stack( int stackSize )
{
Preconditions.checkArgument( stackSize > 0 );
return this.block.map( b -> new ItemStack( b, stackSize ) );
return new ItemStack(block, stackSize);
}
@Override
public final boolean isSameAs( final IBlockReader world, final BlockPos pos )
{
return this.block.isPresent() && world.getBlockState( pos ).getBlock() == this.block.get();
return world.getBlockState( pos ).getBlock() == this.block;
}
}
@@ -36,13 +36,13 @@ import appeng.util.Platform;
public class ItemDefinition implements IItemDefinition
{
private final String identifier;
private final Optional<Item> item;
private final Item item;
public ItemDefinition( String registryName, Item item )
{
Preconditions.checkArgument( !Strings.isNullOrEmpty( registryName ), "registryName" );
this.identifier = registryName;
this.item = Optional.ofNullable( item );
this.item = item;
}
@Nonnull
@@ -53,27 +53,28 @@ public class ItemDefinition implements IItemDefinition
}
@Override
public final Optional<Item> maybeItem()
public final Item item()
{
return this.item;
}
@Override
public Optional<ItemStack> maybeStack( final int stackSize )
public ItemStack stack( final int stackSize )
{
return this.item.map( item -> new ItemStack( item, stackSize ) );
return new ItemStack( item, stackSize );
}
@Override
public boolean isEnabled()
{
return this.item.isPresent();
// FIXME sadly we can only set this after registration
return true;
}
@Override
public final boolean isSameAs( final ItemStack comparableStack )
{
return this.isEnabled() && Platform.itemComparisons().isEqualItemType( comparableStack, this.maybeStack( 1 ).get() );
return Platform.itemComparisons().isEqualItemType( comparableStack, this.stack( 1 ) );
}
}
@@ -56,7 +56,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
public void configure()
{
final IDefinitions definitions = AEApi.instance().definitions();
final IDefinitions definitions = Api.INSTANCE.definitions();
final IBlocks blocks = definitions.blocks();
final IParts parts = definitions.parts();
@@ -102,7 +102,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry
}
final long parsedKey = Long.parseLong( unparsedKey );
final ILocatable securityStation = AEApi.instance().registries().locatable().getLocatableBy( parsedKey );
final ILocatable securityStation = Api.INSTANCE.registries().locatable().getLocatableBy( parsedKey );
if( securityStation == null )
{
player.sendMessage( PlayerMessages.StationCanNotBeLocated.get() );
@@ -24,7 +24,7 @@ public class BasicItemCellGuiHandler implements ICellGuiHandler
@Override
public <T extends IAEStack<T>> boolean isHandlerFor( final IStorageChannel<T> channel )
{
return channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
@@ -43,7 +43,7 @@ public final class CreativeCellHandler implements ICellHandler
@Override
public ICellInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) && !is.isEmpty() && is
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) && !is.isEmpty() && is
.getItem() instanceof ItemCreativeStorageCell )
{
return CreativeCellInventory.getCell( is );
@@ -318,7 +318,7 @@ public enum GuiBridge implements IGuiHandler
return ( (IGuiItem) it.getItem() ).getGuiObject( it, w, new BlockPos( x, y, z ) );
}
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler( it );
final IWirelessTermHandler wh = Api.INSTANCE.registries().wireless().getWirelessTerminalHandler( it );
if( wh != null )
{
return new WirelessTerminalGuiObject( wh, it, player, w, x, y, z );
@@ -113,7 +113,7 @@ public class PacketClick extends AppEngPacket
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player )
{
final ItemStack is = player.inventory.getCurrentItem();
final IItems items = AEApi.instance().definitions().items();
final IItems items = Api.INSTANCE.definitions().items();
final IComparableDefinition maybeMemoryCard = items.memoryCard();
final IComparableDefinition maybeColorApplicator = items.colorApplicator();
final BlockPos pos = new BlockPos( this.x, this.y, this.z );
@@ -139,7 +139,7 @@ public class PacketJEIRecipe extends AppEngPacket
if( inv != null && this.recipe != null && security != null )
{
final IMEMonitor<IAEItemStack> storage = inv.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final IMEMonitor<IAEItemStack> storage = inv.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
for( int x = 0; x < craftMatrix.getSlots(); x++ )
@@ -88,7 +88,7 @@ public class PacketPatternSlot extends AppEngPacket
this.writeItem( slotItem, data );
for( int x = 0; x < 9; x++ )
{
this.pattern[x] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( pat.getStackInSlot( x ) );
this.pattern[x] = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( pat.getStackInSlot( x ) );
this.writeItem( this.pattern[x], data );
}
@@ -55,8 +55,8 @@ public class CraftingJob implements Runnable, ICraftingJob
private final MECraftingInventory original;
private final World world;
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> crafting = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> missing = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
private final Object monitor = new Object();
private final Stopwatch watch = Stopwatch.createUnstarted();
@@ -87,7 +87,7 @@ public class CraftingJob implements Runnable, ICraftingJob
final ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
final IStorageGrid sg = grid.getCache( IStorageGrid.class );
this.original = new MECraftingInventory( sg
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), actionSrc, false, false, false );
.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ), actionSrc, false, false, false );
this.setTree( this.getCraftingTree( cc, what ) );
this.availableCheck = null;
@@ -45,7 +45,7 @@ public class CraftingTreeNode
// what slot!
private final int slot;
private final CraftingJob job;
private final IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> used = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
// parent node.
private final CraftingTreeProcess parent;
private final World world;
@@ -208,7 +208,7 @@ public class CraftingTreeProcess
ItemStack is = ic.getStackInSlot( x );
is = Platform.getContainerItem( is );
final IAEItemStack o = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
final IAEItemStack o = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
if( o != null )
{
this.bytes++;
@@ -227,7 +227,7 @@ public class CraftingTreeProcess
if( this.containerItems )
{
final ItemStack is = Platform.getContainerItem( stack.createItemStack() );
final IAEItemStack o = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
final IAEItemStack o = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
if( o != null )
{
this.bytes++;
@@ -50,7 +50,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
public MECraftingInventory()
{
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
this.localCache = new ItemListIgnoreCrafting<>( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
this.extractedCache = null;
this.injectedCache = null;
this.missingCache = null;
@@ -70,7 +70,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( this.logMissing )
{
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.missingCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -79,7 +79,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( this.logExtracted )
{
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.extractedCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -88,7 +88,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( this.logInjections )
{
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.injectedCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -96,7 +96,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
}
this.localCache = this.target
.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ) );
.getAvailableItems( new ItemListIgnoreCrafting<>( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() ) );
this.par = parent;
}
@@ -110,7 +110,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( logMissing )
{
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.missingCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -119,7 +119,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( logExtracted )
{
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.extractedCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -128,14 +128,14 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( logInjections )
{
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.injectedCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
this.injectedCache = null;
}
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
this.localCache = new ItemListIgnoreCrafting<>( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
for( final IAEItemStack is : target.getStorageList() )
{
this.localCache.add( target.extractItems( is, Actionable.SIMULATE, src ) );
@@ -153,7 +153,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( logMissing )
{
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.missingCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -162,7 +162,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( logExtracted )
{
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.extractedCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
@@ -171,14 +171,14 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
if( logInjections )
{
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.injectedCache = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
}
else
{
this.injectedCache = null;
}
this.localCache = target.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
this.localCache = target.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
this.par = null;
}
@@ -259,7 +259,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
@Override
public IStorageChannel getChannel()
{
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
public IItemList<IAEItemStack> getItemList()
@@ -269,8 +269,8 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
public boolean commit( final IActionSource src )
{
final IItemList<IAEItemStack> added = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> added = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
final IItemList<IAEItemStack> pulled = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
boolean failed = false;
if( this.logInjections )
@@ -19,15 +19,12 @@
package appeng.decorative;
import net.minecraft.block.material.Material;
import appeng.block.AEBaseBlock;
public abstract class AEDecorativeBlock extends AEBaseBlock
public class AEDecorativeBlock extends AEBaseBlock
{
public AEDecorativeBlock( final Material mat )
{
super( mat );
public AEDecorativeBlock(Properties props) {
super(props);
}
}
@@ -42,7 +42,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
// @Override
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
// {
// return AEApi.instance()
// return Api.INSTANCE
// .definitions()
// .materials()
// .certusQuartzCrystalCharged()
@@ -53,7 +53,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
// @Override
// public int damageDropped( final BlockState state )
// {
// return AEApi.instance()
// return Api.INSTANCE
// .definitions()
// .materials()
// .certusQuartzCrystalCharged()
@@ -65,7 +65,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
// @Override
// public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player )
// {
// return AEApi.instance()
// return Api.INSTANCE
// .definitions()
// .blocks()
// .quartzOreCharged()
@@ -1,33 +0,0 @@
/*
* 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.decorative.solid;
import net.minecraft.block.material.Material;
import appeng.decorative.AEDecorativeBlock;
public final class BlockChiseledQuartz extends AEDecorativeBlock
{
public BlockChiseledQuartz()
{
super( Material.ROCK );
}
}
@@ -1,33 +0,0 @@
/*
* 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.decorative.solid;
import net.minecraft.block.material.Material;
import appeng.decorative.AEDecorativeBlock;
public final class BlockQuartz extends AEDecorativeBlock
{
public BlockQuartz()
{
super( Material.ROCK );
}
}
@@ -22,94 +22,80 @@ package appeng.decorative.solid;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.ModelProperty;
import appeng.block.AEBaseBlock;
import appeng.helpers.AEGlassMaterial;
public class BlockQuartzGlass extends AEBaseBlock
{
// This unlisted property is used to determine the actual block that should be rendered
public static final UnlistedGlassStateProperty GLASS_STATE = new UnlistedGlassStateProperty();
public BlockQuartzGlass()
{
super( Material.GLASS );
this.setLightOpacity( 0 );
super( Properties.create(Material.GLASS) );
// FIXME this.setLightOpacity( 0 );
this.setOpaque( false );
}
@Override
protected BlockStateContainer createBlockState()
{
IProperty[] listedProperties = new IProperty[0];
IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[] { GLASS_STATE };
return new ExtendedBlockState( this, listedProperties, unlistedProperties );
// @Override
// protected BlockStateContainer createBlockState()
// {
// IProperty[] listedProperties = new IProperty[0];
// IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[] { GLASS_STATE };
// return new ExtendedBlockState( this, listedProperties, unlistedProperties );
// }
// FIXME @Override
// FIXME public BlockRenderLayer getBlockLayer()
// FIXME {
// FIXME return BlockRenderLayer.CUTOUT;
// FIXME }
// FIXME @Override
// FIXME public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
// FIXME {
// FIXME BlockPos adjacentPos = pos.offset( side );
// FIXME
// FIXME final Material mat = w.getBlockState( adjacentPos ).getMaterial();
// FIXME
// FIXME if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
// FIXME {
// FIXME if( w.getBlockState( adjacentPos ).getRenderType() == this.getRenderType( state ) )
// FIXME {
// FIXME return false;
// FIXME }
// FIXME }
// FIXME
// FIXME return super.shouldSideBeRendered( state, w, pos, side );
// FIXME }
// BEGIN: Copied from AbstractGlassBlock
@OnlyIn(Dist.CLIENT)
public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 1.0F;
}
@Override
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
{
EnumSet<Direction> flushWith = EnumSet.noneOf( Direction.class );
// Test every direction for another glass block
for( Direction facing : Direction.values() )
{
if( isGlassBlock( world, pos, facing ) )
{
flushWith.add( facing );
}
}
GlassState glassState = new GlassState( pos.getX(), pos.getY(), pos.getZ(), flushWith );
IExtendedBlockState extState = (IExtendedBlockState) state;
return extState.withProperty( GLASS_STATE, glassState );
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
return true;
}
private static boolean isGlassBlock( IBlockReader world, BlockPos pos, Direction facing )
{
return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass;
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
{
BlockPos adjacentPos = pos.offset( side );
final Material mat = w.getBlockState( adjacentPos ).getMaterial();
if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
{
if( w.getBlockState( adjacentPos ).getRenderType() == this.getRenderType( state ) )
{
return false;
}
}
return super.shouldSideBeRendered( state, w, pos, side );
}
@Override
public boolean isFullCube( BlockState state )
{
public boolean causesSuffocation(BlockState state, IBlockReader worldIn, BlockPos pos) {
return false;
}
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
return false;
}
public boolean canEntitySpawn(BlockState state, IBlockReader worldIn, BlockPos pos, EntityType<?> type) {
return false;
}
// END: Copied from AbstractGlassBlock
}
@@ -74,7 +74,7 @@ public class BlockQuartzOre extends AEBaseBlock
// @Override
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
// {
// return AEApi.instance()
// return Api.INSTANCE
// .definitions()
// .materials()
// .certusQuartzCrystal()
@@ -86,7 +86,7 @@ public class BlockQuartzOre extends AEBaseBlock
// @Override
// public int damageDropped( final BlockState state )
// {
// return AEApi.instance()
// return Api.INSTANCE
// .definitions()
// .materials()
// .certusQuartzCrystal()
@@ -19,9 +19,11 @@
package appeng.decorative.solid;
import net.minecraft.block.material.Material;
import appeng.decorative.AEDecorativeBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
@@ -29,32 +31,24 @@ import net.minecraft.world.IBlockReader;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock;
import appeng.helpers.MetaRotation;
public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock
public class BlockQuartzPillar extends AEDecorativeBlock implements IOrientableBlock
{
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public BlockQuartzPillar()
{
super( Material.ROCK );
public BlockQuartzPillar(Properties props) {
super(props);
// The upwards facing pillar is the default (i.e. for the item model)
this.setDefaultState( this.getDefaultState().with( AXIS, Direction.Axis.Y ) );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { AXIS };
}
@Override
public boolean usesMetadata()
{
return true;
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(AXIS);
}
@Override
@@ -97,7 +97,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
private boolean transform()
{
final ItemStack item = this.getItem();
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = Api.INSTANCE.definitions().materials();
if( materials.certusQuartzCrystalCharged().isSameAs( item ) )
{
@@ -80,7 +80,7 @@ public final class EntitySingularity extends AEBaseEntityItem
final ItemStack item = this.getItem();
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = Api.INSTANCE.definitions().materials();
if( materials.singularity().isSameAs( item ) )
{
@@ -88,7 +88,7 @@ public final class EntityTinyTNTPrimed extends TNTEntity implements IEntityAddit
if( this.isInWater() && Platform.isServer() ) // put out the fuse.
{
AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack ->
Api.INSTANCE.definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack ->
{
final ItemEntity item = new ItemEntity( this.world, this.getPosX(), this.getPosY(), this.getPosZ(), tntStack );
@@ -133,7 +133,7 @@ public class FacadeContainer implements IFacadeContainer
ids[1] = out.readInt();
ids[0] = Math.abs( ids[0] );
Optional<Item> maybeFacadeItem = AEApi.instance().definitions().items().facade().maybeItem();
Optional<Item> maybeFacadeItem = Api.INSTANCE.definitions().items().facade().maybeItem();
if( maybeFacadeItem.isPresent() )
{
final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
+1 -1
View File
@@ -103,7 +103,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
@Override
public boolean isTransparent()
{
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
if( Api.INSTANCE.partHelper().getCableRenderMode().transparentFacades )
{
return true;
}
@@ -164,7 +164,7 @@ public class ContainerFluidStorageBus extends ContainerFluidConfigurable
if( cellInv != null )
{
final IItemList<IAEFluidStack> list = cellInv
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList() );
.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList() );
i = list.iterator();
}
@@ -81,7 +81,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
{
private final IConfigManager clientCM;
private final IMEMonitor<IAEFluidStack> monitor;
private final IItemList<IAEFluidStack> fluids = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final IItemList<IAEFluidStack> fluids = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
@GuiSync( 99 )
public boolean hasPower = false;
private ITerminalHost terminal;
@@ -103,7 +103,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
if( Platform.isServer() )
{
this.serverCM = terminal.getConfigManager();
this.monitor = terminal.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
this.monitor = terminal.getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) );
if( this.monitor != null )
{
@@ -266,7 +266,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
{
if( Platform.isServer() )
{
if( this.monitor != this.terminal.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) )
if( this.monitor != this.terminal.getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) ) )
{
this.setValidContainer( false );
}
@@ -90,10 +90,10 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
private int isWorking = -1;
private int priority;
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), AEApi.instance()
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), Api.INSTANCE
.storage()
.getStorageChannel( IItemStorageChannel.class ) );
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), AEApi.instance()
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), Api.INSTANCE
.storage()
.getStorageChannel( IFluidStorageChannel.class ) );
@@ -132,7 +132,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
if( this.hasConfig() )
{
@@ -141,7 +141,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
return (IMEMonitor<T>) this.items;
}
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
else if( channel == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
if( this.hasConfig() )
{
@@ -207,8 +207,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
{
try
{
this.items.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) );
this.items.setInternal( this.gridProxy.getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) ) );
}
catch( final GridAccessException gae )
{
@@ -372,7 +372,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
try
{
final IMEInventory<IAEFluidStack> dest = this.gridProxy.getStorage()
.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
.getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) );
final IEnergySource src = this.gridProxy.getEnergy();
if( work.getStackSize() > 0 )
@@ -87,7 +87,7 @@ public final class BasicFluidStorageCell extends AbstractStorageCell<IAEFluidSta
@Override
public IStorageChannel<IAEFluidStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
@@ -105,7 +105,7 @@ public final class BasicFluidStorageCell extends AbstractStorageCell<IAEFluidSta
@Override
protected void dropEmptyStorageCellCase( final InventoryAdaptor ia, final PlayerEntity player )
{
AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is ->
Api.INSTANCE.definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is ->
{
final ItemStack extraA = ia.addItems( is );
if( !extraA.isEmpty() )
@@ -152,7 +152,7 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
@Override
public IStorageChannel<IAEFluidStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
@@ -288,7 +288,7 @@ public class PartFluidAnnihilationPlane extends PartBasicState implements IGridT
try
{
final IStorageGrid storage = this.getProxy().getStorage();
final IMEInventory<IAEFluidStack> inv = storage.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
final IMEInventory<IAEFluidStack> inv = storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) );
if( modulate )
{
@@ -63,7 +63,7 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
return MODELS.getModels();
}
private final MEInventoryHandler<IAEFluidStack> myHandler = new MEInventoryHandler<>( this, AEApi.instance()
private final MEInventoryHandler<IAEFluidStack> myHandler = new MEInventoryHandler<>( this, Api.INSTANCE
.storage()
.getStorageChannel( IFluidStorageChannel.class ) );
private final AEFluidInventory config = new AEFluidInventory( this, 63 );
@@ -81,7 +81,7 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
this.myHandler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.myHandler.setPriority( this.getPriority() );
final IItemList<IAEFluidStack> priorityList = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
final IItemList<IAEFluidStack> priorityList = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
for( int x = 0; x < this.config.getSlots() && x < slotsToUse; x++ )
@@ -196,13 +196,13 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
@Override
public IStorageChannel<IAEFluidStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
public List<IMEInventoryHandler> getCellArray( final IStorageChannel channel )
{
if( this.getProxy().isActive() && channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
if( this.getProxy().isActive() && channel == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
final List<IMEInventoryHandler> handler = new ArrayList<>( 1 );
handler.add( this.myHandler );
@@ -225,7 +225,7 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane<IAEFluid
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().parts().fluidFormationnPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().parts().fluidFormationnPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -236,7 +236,7 @@ public class PartFluidInterface extends PartBasicState implements IGridTickable,
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().parts().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().parts().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -112,7 +112,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
@Override
public void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan )
{
if( chan == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) && fullStack.equals( this.config.getFluidInSlot( 0 ) ) )
if( chan == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) && fullStack.equals( this.config.getFluidInSlot( 0 ) ) )
{
this.lastReportedValue = fullStack.getStackSize();
this.updateState();
@@ -179,7 +179,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
{
try
{
final IStorageChannel<IAEFluidStack> channel = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
final IStorageChannel<IAEFluidStack> channel = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
final IMEMonitor<IAEFluidStack> inventory = this.getProxy().getStorage().getInventory( channel );
this.updateReportingValue( inventory );
@@ -205,7 +205,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
private void configureWatchers()
{
final IFluidStorageChannel channel = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
final IFluidStorageChannel channel = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
if( this.stackWatcher != null )
{
@@ -124,7 +124,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
IStorageMonitorable inventory = accessor.getInventory( this.source );
if( inventory != null )
{
return inventory.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
return inventory.getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) );
}
// So this could / can be a design decision. If the tile does support our custom capability,
@@ -167,7 +167,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
this.resetCacheLogic = 0;
final IMEInventory<IAEFluidStack> in = this.getInternalHandler();
IItemList<IAEFluidStack> before = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
IItemList<IAEFluidStack> before = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
if( in != null )
{
before = in.getAvailableItems( before );
@@ -183,7 +183,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
if( in != out )
{
IItemList<IAEFluidStack> after = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
IItemList<IAEFluidStack> after = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
if( out != null )
{
after = out.getAvailableItems( after );
@@ -269,7 +269,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
{
this.getProxy()
.getStorage()
.postAlterationOfStoredItems( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ), change, this.source );
.postAlterationOfStoredItems( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ), change, this.source );
}
}
catch( final GridAccessException e )
@@ -313,13 +313,13 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
{
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() );
this.handler = new MEInventoryHandler<>( inv, AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
this.handler = new MEInventoryHandler<>( inv, Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) );
this.handler.setBaseAccess( (AccessRestriction) this.getConfigManager().getSetting( Settings.ACCESS ) );
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.handler.setPriority( this.getPriority() );
final IItemList<IAEFluidStack> priorityList = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
final IItemList<IAEFluidStack> priorityList = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ).createList();
final int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
for( int x = 0; x < this.config.getSlots() && x < slotsToUse; x++ )
@@ -461,7 +461,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
@Override
public IStorageChannel getStorageChannel()
{
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
public IAEFluidTank getConfig()
@@ -490,7 +490,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().parts().fluidStorageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().parts().fluidStorageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -178,7 +178,7 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri
protected IFluidStorageChannel getChannel()
{
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
@@ -42,7 +42,7 @@ public class BasicFluidCellGuiHandler implements ICellGuiHandler
@Override
public <T extends IAEStack<T>> boolean isHandlerFor( final IStorageChannel<T> channel )
{
return channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return channel == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
@@ -179,7 +179,7 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable,
@Override
public ItemStack getItemStackRepresentation()
{
return AEApi.instance().definitions().blocks().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
return Api.INSTANCE.definitions().blocks().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
@@ -232,7 +232,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override
public IStorageChannel<IAEFluidStack> getChannel()
{
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
}
@Override
@@ -128,10 +128,10 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS );
private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS );
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), AEApi.instance()
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), Api.INSTANCE
.storage()
.getStorageChannel( IItemStorageChannel.class ) );
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), AEApi.instance()
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), Api.INSTANCE
.storage()
.getStorageChannel( IFluidStorageChannel.class ) );
private final UpgradeInventory upgrades;
@@ -419,7 +419,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
if( req == null && !stored.isEmpty() )
{
final IAEItemStack work = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
final IAEItemStack work = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
return;
}
@@ -442,7 +442,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
else
// Stored != null; dispose!
{
final IAEItemStack work = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
final IAEItemStack work = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
return;
}
@@ -507,7 +507,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
@Override
public boolean canInsert( final ItemStack stack )
{
final IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ),
final IAEItemStack out = this.destination.injectItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ),
Actionable.SIMULATE, null );
if( out == null )
{
@@ -534,8 +534,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
try
{
this.items.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) );
this.items.setInternal( this.gridProxy.getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) ) );
}
catch( final GridAccessException gae )
{
@@ -663,7 +663,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
boolean changed = false;
try
{
this.destination = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.destination = this.gridProxy.getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final IEnergySource src = this.gridProxy.getEnergy();
if( this.craftingTracker.isBusy( x ) )
@@ -790,7 +790,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
if( this.hasConfig() )
{
@@ -799,7 +799,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
return (IMEMonitor<T>) this.items;
}
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
else if( channel == Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class ) )
{
if( this.hasConfig() )
{
@@ -884,7 +884,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
return (IMEMonitor<T>) new InterfaceInventory( di );
}
@@ -61,7 +61,7 @@ public class MultiCraftingTracker
if( link != null && !link.isEmpty() )
{
this.setLink( x, AEApi.instance().storage().loadCraftingLink( link, this.owner ) );
this.setLink( x, Api.INSTANCE.storage().loadCraftingLink( link, this.owner ) );
}
}
}
@@ -104,7 +104,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
this.markItemAs( x, gs, TestStatus.ACCEPT );
}
in.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
in.add( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
this.testFrame.setInventorySlotContents( x, gs );
}
@@ -115,7 +115,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
if( this.standardRecipe != null )
{
this.correctOutput = this.standardRecipe.getCraftingResult( this.crafting );
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.correctOutput ) );
out.add( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.correctOutput ) );
}
else
{
@@ -139,7 +139,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
if( !gs.isEmpty() )
{
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
out.add( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
}
}
}
@@ -78,7 +78,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
try
{
final long encKey = Long.parseLong( this.encryptionKey );
obj = AEApi.instance().registries().locatable().getLocatableBy( encKey );
obj = Api.INSTANCE.registries().locatable().getLocatableBy( encKey );
}
catch( final NumberFormatException err )
{
@@ -96,7 +96,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
this.sg = this.targetGrid.getCache( IStorageGrid.class );
if( this.sg != null )
{
this.itemStorage = this.sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
this.itemStorage = this.sg.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
}
}
}
@@ -235,7 +235,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
{
return this.itemStorage.getChannel();
}
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
return Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class );
}
@Override
+1 -1
View File
@@ -28,7 +28,7 @@ public class AETrading
* @Override
* public void manipulateTradesForVillager( EntityVillager villager, MerchantRecipeList recipeList, Random random )
* {
* final IMaterials materials = AEApi.instance().definitions().materials();
* final IMaterials materials = Api.INSTANCE.definitions().materials();
* this.addMerchant( recipeList, materials.silicon(), 1, random, 2 );
* this.addMerchant( recipeList, materials.certusQuartzCrystal(), 2, random, 4 );
* this.addMerchant( recipeList, materials.certusQuartzDust(), 1, random, 3 );
+1 -1
View File
@@ -176,7 +176,7 @@ public class TickHandler
if( ev.type == Type.CLIENT && ev.phase == Phase.START )
{
this.tickColors( this.cliPlayerColors );
final CableRenderMode currentMode = AEApi.instance().partHelper().getCableRenderMode();
final CableRenderMode currentMode = Api.INSTANCE.partHelper().getCableRenderMode();
if( currentMode != this.crm )
{
this.crm = currentMode;
@@ -19,10 +19,10 @@
package appeng.items.contents;
import appeng.core.Api;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.Settings;
@@ -51,7 +51,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
public PortableCellViewer( final ItemStack is, final int slot )
{
super( AEApi.instance().registries().cell().getCellInventory( is, null, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
super( Api.INSTANCE.registries().cell().getCellInventory( is, null, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.ips = (IAEItemPowerStorage) is.getItem();
this.target = is;
this.inventorySlot = slot;
@@ -85,7 +85,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
@Override
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
if( channel == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
{
return (IMEMonitor<T>) this;
}
@@ -66,7 +66,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public static ResolverResult getResolver( final int certus2 )
{
return AEApi.instance()
return Api.INSTANCE
.definitions()
.items()
.crystalSeed()
@@ -109,7 +109,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public ItemStack triggerGrowth( final ItemStack is )
{
final int newDamage = getProgress( is ) + 1;
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = Api.INSTANCE.definitions().materials();
final int size = is.getCount();
if( newDamage == CERTUS + SINGLE_OFFSET )
@@ -85,7 +85,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final PlayerInventory inv = player.inventory;
ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( ItemStack.EMPTY );
ItemStack is = Api.INSTANCE.definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( ItemStack.EMPTY );
if( !is.isEmpty() )
{
for( int s = 0; s < player.inventory.getSizeInventory(); s++ )
@@ -69,7 +69,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
@Override
public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
{
return AEApi.instance().partHelper().placeBus( player.getHeldItem( hand ), pos, side, player, hand, world );
return Api.INSTANCE.partHelper().placeBus( player.getHeldItem( hand ), pos, side, player, hand, world );
}
@Override
@@ -308,7 +308,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
public ItemStack createFromIDs( final int[] ids )
{
ItemStack facadeStack = AEApi.instance()
ItemStack facadeStack = Api.INSTANCE
.definitions()
.items()
.facade()

Some files were not shown because too many files have changed in this diff Show More