Custom Model Loader
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user