Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 030e0c6a14 | |||
| 8e4265aa33 | |||
| 80eaa032b9 | |||
| bee9c70497 | |||
| c4fa21c193 | |||
| 8a7450168b | |||
| 7cb641cdc8 | |||
| b5b8050c4c | |||
| e65083b045 | |||
| b61219ef88 | |||
| 4f9fd1b369 | |||
| 630fae3f73 | |||
| 488ef1b544 | |||
| 098ee2f000 | |||
| 04d2b06c0d | |||
| ac48ab02fc | |||
| 9022150e38 | |||
| 65c6d2249a | |||
| 8e7f79a9ea | |||
| 95b48b9438 | |||
| cdd76b7b22 | |||
| 3e2bc0e038 | |||
| eec3e59eea | |||
| e39855b48f | |||
| cdcab7d91c | |||
| 27ad2c2b96 | |||
| 542a2e5d5a | |||
| 3b58f5e8da | |||
| 092afad4a5 | |||
| 6aa810d62a | |||
| 41d98f9944 | |||
| 1b198979fd |
+6
-3
@@ -45,6 +45,12 @@ apply from: 'gradle/scripts/optional.gradle'
|
|||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
// ensure everything uses UTF-8 and not some random codepage chosen by gradle
|
||||||
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
version = aeversion + "-" + aechannel + "-" + aebuild
|
version = aeversion + "-" + aechannel + "-" + aebuild
|
||||||
group = aegroup
|
group = aegroup
|
||||||
archivesBaseName = aebasename
|
archivesBaseName = aebasename
|
||||||
@@ -52,7 +58,6 @@ archivesBaseName = aebasename
|
|||||||
// Add Coremod Manifest
|
// Add Coremod Manifest
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
|
||||||
attributes 'FMLAT': 'appeng_at.cfg'
|
attributes 'FMLAT': 'appeng_at.cfg'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +73,6 @@ jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
coreMod = "appeng.coremod.AppEngCore"
|
|
||||||
|
|
||||||
version = minecraft_version + "-" + forge_version
|
version = minecraft_version + "-" + forge_version
|
||||||
|
|
||||||
replaceIn "AEConfig.java"
|
replaceIn "AEConfig.java"
|
||||||
|
|||||||
+7
-1
@@ -21,6 +21,12 @@ hwyla_version=1.8.19-B33_1.12
|
|||||||
#########################################################
|
#########################################################
|
||||||
jei_version=4.7.1.69
|
jei_version=4.7.1.69
|
||||||
tesla_version=1.0.61
|
tesla_version=1.0.61
|
||||||
ic2_version=2.8.7-ex112
|
ic2_version=2.8.9-ex112
|
||||||
rf_version=2.0.0.1
|
rf_version=2.0.0.1
|
||||||
top_version=1.12-1.4.8-2
|
top_version=1.12-1.4.8-2
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# Deployment #
|
||||||
|
#########################################################
|
||||||
|
website_version=1.12.x
|
||||||
|
curse_versions=1.12,1.12.1
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public enum TunnelType
|
|||||||
{
|
{
|
||||||
ME, // Network Tunnel
|
ME, // Network Tunnel
|
||||||
IC2_POWER, // EU Tunnel
|
IC2_POWER, // EU Tunnel
|
||||||
RF_POWER, // RF Tunnel
|
|
||||||
FE_POWER, // Forge Energy tunnel
|
FE_POWER, // Forge Energy tunnel
|
||||||
REDSTONE, // Redstone Tunnel
|
REDSTONE, // Redstone Tunnel
|
||||||
FLUID, // Fluid Tunnel
|
FLUID, // Fluid Tunnel
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ public interface IParts
|
|||||||
|
|
||||||
AEColoredItemDefinition cableGlass();
|
AEColoredItemDefinition cableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDense();
|
AEColoredItemDefinition cableDenseCovered();
|
||||||
|
|
||||||
|
AEColoredItemDefinition cableDenseSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableSmart();
|
AEColoredItemDefinition lumenCableSmart();
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public interface IParts
|
|||||||
|
|
||||||
AEColoredItemDefinition lumenCableGlass();
|
AEColoredItemDefinition lumenCableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableDense();
|
AEColoredItemDefinition lumenDenseCableSmart();
|
||||||
|
|
||||||
IItemDefinition quartzFiber();
|
IItemDefinition quartzFiber();
|
||||||
|
|
||||||
@@ -80,8 +82,6 @@ public interface IParts
|
|||||||
|
|
||||||
IItemDefinition p2PTunnelEU();
|
IItemDefinition p2PTunnelEU();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelRF();
|
|
||||||
|
|
||||||
IItemDefinition p2PTunnelFE();
|
IItemDefinition p2PTunnelFE();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelLight();
|
IItemDefinition p2PTunnelLight();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package appeng.api.implementations.items;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.energy.IAEPowerStorage;
|
import appeng.api.networking.energy.IAEPowerStorage;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,27 +43,27 @@ public interface IAEItemPowerStorage
|
|||||||
*
|
*
|
||||||
* @return amount unable to be stored
|
* @return amount unable to be stored
|
||||||
*/
|
*/
|
||||||
double injectAEPower( ItemStack is, double amt );
|
double injectAEPower( ItemStack stack, double amount, Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to extract power from the device, it will extract what it can and
|
* Attempt to extract power from the device, it will extract what it can and
|
||||||
* return it.
|
* return it.
|
||||||
*
|
*
|
||||||
* @param amt to be extracted power from device
|
* @param amount to be extracted power from device
|
||||||
*
|
*
|
||||||
* @return what it could extract
|
* @return what it could extract
|
||||||
*/
|
*/
|
||||||
double extractAEPower( ItemStack is, double amt );
|
double extractAEPower( ItemStack stack, double amount, Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current maximum power ( this can change :P )
|
* @return the current maximum power ( this can change :P )
|
||||||
*/
|
*/
|
||||||
double getAEMaxPower( ItemStack is );
|
double getAEMaxPower( ItemStack stack );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current AE Power Level, this may exceed getMEMaxPower()
|
* @return the current AE Power Level, this may exceed getMEMaxPower()
|
||||||
*/
|
*/
|
||||||
double getAECurrentPower( ItemStack is );
|
double getAECurrentPower( ItemStack stack );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control the power flow by telling what the network can do, either add? or
|
* Control the power flow by telling what the network can do, either add? or
|
||||||
@@ -70,5 +71,5 @@ public interface IAEItemPowerStorage
|
|||||||
*
|
*
|
||||||
* @return access restriction of network
|
* @return access restriction of network
|
||||||
*/
|
*/
|
||||||
AccessRestriction getPowerFlow( ItemStack is );
|
AccessRestriction getPowerFlow( ItemStack stack );
|
||||||
}
|
}
|
||||||
@@ -46,6 +46,11 @@ public enum AECableType
|
|||||||
*/
|
*/
|
||||||
SMART,
|
SMART,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
|
*/
|
||||||
|
DENSE_COVERED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +60,7 @@ public enum AECableType
|
|||||||
GLASS,
|
GLASS,
|
||||||
COVERED,
|
COVERED,
|
||||||
SMART,
|
SMART,
|
||||||
|
DENSE_COVERED,
|
||||||
DENSE_SMART
|
DENSE_SMART
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
import appeng.api.definitions.IBlockDefinition;
|
import appeng.api.definitions.IBlockDefinition;
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
@@ -66,67 +67,39 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
|||||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getMaxEnergyCapacity()
|
@Override
|
||||||
|
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
|
||||||
{
|
{
|
||||||
final Block blockID = Block.getBlockFromItem( this );
|
final double internalCurrentPower = this.getInternal( is );
|
||||||
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
final double internalMaxPower = this.getAEMaxPower( is );
|
||||||
return energyCell.maybeBlock().map( block ->
|
final double required = internalMaxPower - internalCurrentPower;
|
||||||
|
final double overflow = Math.max( 0, amount - required );
|
||||||
|
|
||||||
|
if( mode == Actionable.MODULATE )
|
||||||
{
|
{
|
||||||
if( blockID == block )
|
final double toAdd = Math.min( required, amount );
|
||||||
{
|
final double newPowerStored = internalCurrentPower + toAdd;
|
||||||
return 200000;
|
|
||||||
}
|
this.setInternal( is, newPowerStored );
|
||||||
else
|
}
|
||||||
{
|
|
||||||
return 8 * 200000;
|
return overflow;
|
||||||
}
|
|
||||||
} ).orElse( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double injectAEPower( final ItemStack is, double amt )
|
public double extractAEPower( final ItemStack is, double amount, Actionable mode )
|
||||||
{
|
{
|
||||||
double internalCurrentPower = this.getInternal( is );
|
final double internalCurrentPower = this.getInternal( is );
|
||||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
final double fulfillable = Math.min( amount, internalCurrentPower );
|
||||||
internalCurrentPower += amt;
|
|
||||||
if( internalCurrentPower > internalMaxPower )
|
if( mode == Actionable.MODULATE )
|
||||||
{
|
{
|
||||||
amt = internalCurrentPower - internalMaxPower;
|
final double newPowerStored = internalCurrentPower - fulfillable;
|
||||||
internalCurrentPower = internalMaxPower;
|
|
||||||
this.setInternal( is, internalCurrentPower );
|
this.setInternal( is, newPowerStored );
|
||||||
return amt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setInternal( is, internalCurrentPower );
|
return fulfillable;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getInternal( final ItemStack is )
|
|
||||||
{
|
|
||||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
|
||||||
return nbt.getDouble( "internalCurrentPower" );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setInternal( final ItemStack is, final double amt )
|
|
||||||
{
|
|
||||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
|
||||||
nbt.setDouble( "internalCurrentPower", amt );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double extractAEPower( final ItemStack is, double amt )
|
|
||||||
{
|
|
||||||
double internalCurrentPower = this.getInternal( is );
|
|
||||||
if( internalCurrentPower > amt )
|
|
||||||
{
|
|
||||||
internalCurrentPower -= amt;
|
|
||||||
this.setInternal( is, internalCurrentPower );
|
|
||||||
return amt;
|
|
||||||
}
|
|
||||||
|
|
||||||
amt = internalCurrentPower;
|
|
||||||
this.setInternal( is, 0 );
|
|
||||||
return amt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -146,4 +119,34 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
|||||||
{
|
{
|
||||||
return AccessRestriction.WRITE;
|
return AccessRestriction.WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double getMaxEnergyCapacity()
|
||||||
|
{
|
||||||
|
final Block blockID = Block.getBlockFromItem( this );
|
||||||
|
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
||||||
|
|
||||||
|
return energyCell.maybeBlock().map( block ->
|
||||||
|
{
|
||||||
|
if( blockID == block )
|
||||||
|
{
|
||||||
|
return 200000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 8 * 200000;
|
||||||
|
}
|
||||||
|
} ).orElse( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getInternal( final ItemStack is )
|
||||||
|
{
|
||||||
|
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||||
|
return nbt.getDouble( "internalCurrentPower" );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setInternal( final ItemStack is, final double amt )
|
||||||
|
{
|
||||||
|
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||||
|
nbt.setDouble( "internalCurrentPower", amt );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class BlockCableBus extends AEBaseTileBlock
|
|||||||
// this will actually be overwritten later through setupTile and the
|
// this will actually be overwritten later through setupTile and the
|
||||||
// combined layers
|
// combined layers
|
||||||
this.setTileEntity( TileCableBus.class );
|
this.setTileEntity( TileCableBus.class );
|
||||||
|
this.useNeighborBrightness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@@ -42,11 +42,13 @@ import appeng.api.definitions.IBlockDefinition;
|
|||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.block.AEBaseItemBlock;
|
import appeng.block.AEBaseItemBlock;
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IPreInitComponent;
|
||||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.CreativeTab;
|
import appeng.core.CreativeTab;
|
||||||
import appeng.core.Registration;
|
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.ActivityState;
|
import appeng.core.features.ActivityState;
|
||||||
import appeng.core.features.BlockDefinition;
|
import appeng.core.features.BlockDefinition;
|
||||||
@@ -65,13 +67,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
|
|
||||||
private final Supplier<? extends Block> blockSupplier;
|
private final Supplier<? extends Block> blockSupplier;
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> preInitCallbacks = new ArrayList<>();
|
private final List<BiFunction<Block, Item, IBootstrapComponent>> bootstrapComponents = new ArrayList<>();
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> initCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> modelRegCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> postInitCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||||
|
|
||||||
@@ -103,30 +99,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockDefinitionBuilder preInit( BiConsumer<Block, Item> callback )
|
public BlockDefinitionBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> callback )
|
||||||
{
|
{
|
||||||
this.preInitCallbacks.add( callback );
|
this.bootstrapComponents.add( callback );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockDefinitionBuilder init( BiConsumer<Block, Item> callback )
|
|
||||||
{
|
|
||||||
this.initCallbacks.add( callback );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockDefinitionBuilder modelRegInit( BiConsumer<Block, Item> callback )
|
|
||||||
{
|
|
||||||
this.modelRegCallbacks.add( callback );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockDefinitionBuilder postInit( BiConsumer<Block, Item> callback )
|
|
||||||
{
|
|
||||||
this.postInitCallbacks.add( callback );
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,22 +196,16 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Register the item and block with the game
|
// Register the item and block with the game
|
||||||
this.factory.addPreInit( side ->
|
this.factory.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( block ) );
|
||||||
|
if( item != null )
|
||||||
{
|
{
|
||||||
Registration.addBlockToRegister( block );
|
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) );
|
||||||
if( item != null )
|
}
|
||||||
{
|
|
||||||
Registration.addItemToRegister( item );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
block.setCreativeTab( this.creativeTab );
|
block.setCreativeTab( this.creativeTab );
|
||||||
|
|
||||||
// Register all extra handlers
|
// Register all extra handlers
|
||||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( block, item ) ) );
|
this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) );
|
||||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( block, item ) ) );
|
|
||||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( block, item ) ) );
|
|
||||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( block, item ) ) );
|
|
||||||
|
|
||||||
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
||||||
{
|
{
|
||||||
@@ -268,7 +237,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
|
|
||||||
if( block instanceof AEBaseTileBlock )
|
if( block instanceof AEBaseTileBlock )
|
||||||
{
|
{
|
||||||
this.factory.addPreInit( side ->
|
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
|
||||||
{
|
{
|
||||||
AEBaseTile.registerTileItem(
|
AEBaseTile.registerTileItem(
|
||||||
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ class BlockRendering implements IBlockRendering
|
|||||||
|
|
||||||
if( this.modelCustomizer != null )
|
if( this.modelCustomizer != null )
|
||||||
{
|
{
|
||||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||||
}
|
}
|
||||||
else if( block instanceof AEBaseTileBlock )
|
else if( block instanceof AEBaseTileBlock )
|
||||||
{
|
{
|
||||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||||
// extended props
|
// extended props
|
||||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : 1.12
|
// TODO : 1.12
|
||||||
|
|||||||
@@ -20,10 +20,18 @@ package appeng.bootstrap;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraftforge.client.model.IModel;
|
import net.minecraftforge.client.model.IModel;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
@@ -33,10 +41,6 @@ import appeng.api.definitions.IItemDefinition;
|
|||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEColoredItemDefinition;
|
import appeng.api.util.AEColoredItemDefinition;
|
||||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
import appeng.bootstrap.components.BuiltInModelComponent;
|
||||||
import appeng.bootstrap.components.IInitComponent;
|
|
||||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
|
||||||
import appeng.bootstrap.components.IPostInitComponent;
|
|
||||||
import appeng.bootstrap.components.IPreInitComponent;
|
|
||||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||||
import appeng.bootstrap.components.TileEntityComponent;
|
import appeng.bootstrap.components.TileEntityComponent;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
@@ -51,10 +55,10 @@ public class FeatureFactory
|
|||||||
|
|
||||||
private final AEFeature[] defaultFeatures;
|
private final AEFeature[] defaultFeatures;
|
||||||
|
|
||||||
private final List<IBootstrapComponent> bootstrapComponents;
|
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
ModelOverrideComponent modelOverrideComponent;
|
private ModelOverrideComponent modelOverrideComponent;
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
private BuiltInModelComponent builtInModelComponent;
|
private BuiltInModelComponent builtInModelComponent;
|
||||||
@@ -64,18 +68,18 @@ public class FeatureFactory
|
|||||||
public FeatureFactory()
|
public FeatureFactory()
|
||||||
{
|
{
|
||||||
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
||||||
this.bootstrapComponents = new ArrayList<>();
|
this.bootstrapComponents = new HashMap<>();
|
||||||
|
|
||||||
this.tileEntityComponent = new TileEntityComponent();
|
this.tileEntityComponent = new TileEntityComponent();
|
||||||
this.bootstrapComponents.add( this.tileEntityComponent );
|
this.addBootstrapComponent( this.tileEntityComponent );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
this.modelOverrideComponent = new ModelOverrideComponent();
|
||||||
this.bootstrapComponents.add( this.modelOverrideComponent );
|
this.addBootstrapComponent( this.modelOverrideComponent );
|
||||||
|
|
||||||
this.builtInModelComponent = new BuiltInModelComponent();
|
this.builtInModelComponent = new BuiltInModelComponent();
|
||||||
this.bootstrapComponents.add( this.builtInModelComponent );
|
this.addBootstrapComponent( this.builtInModelComponent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,29 +127,16 @@ public class FeatureFactory
|
|||||||
return new FeatureFactory( this, features );
|
return new FeatureFactory( this, features );
|
||||||
}
|
}
|
||||||
|
|
||||||
void addBootstrapComponent( IBootstrapComponent component )
|
public void addBootstrapComponent( IBootstrapComponent component )
|
||||||
{
|
{
|
||||||
this.bootstrapComponents.add( component );
|
Arrays.stream( component.getClass().getInterfaces() )
|
||||||
|
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )
|
||||||
|
.forEach( i -> this.addBootstrapComponent( (Class<? extends IBootstrapComponent>) i, component ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPreInit( IPreInitComponent component )
|
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
|
||||||
{
|
{
|
||||||
this.bootstrapComponents.add( component );
|
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||||
}
|
|
||||||
|
|
||||||
void addInit( IInitComponent component )
|
|
||||||
{
|
|
||||||
this.bootstrapComponents.add( component );
|
|
||||||
}
|
|
||||||
|
|
||||||
void addModelReg( IModelRegistrationComponent component )
|
|
||||||
{
|
|
||||||
this.bootstrapComponents.add( component );
|
|
||||||
}
|
|
||||||
|
|
||||||
void addPostInit( IPostInitComponent component )
|
|
||||||
{
|
|
||||||
this.bootstrapComponents.add( component );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
@@ -154,8 +145,14 @@ public class FeatureFactory
|
|||||||
this.builtInModelComponent.addModel( path, model );
|
this.builtInModelComponent.addModel( path, model );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IBootstrapComponent> getBootstrapComponents()
|
@SideOnly( Side.CLIENT )
|
||||||
|
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||||
{
|
{
|
||||||
return this.bootstrapComponents;
|
this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||||
|
{
|
||||||
|
return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -33,14 +33,7 @@ import appeng.core.features.AEFeature;
|
|||||||
|
|
||||||
public interface IBlockBuilder
|
public interface IBlockBuilder
|
||||||
{
|
{
|
||||||
|
IBlockBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> component );
|
||||||
IBlockBuilder preInit( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder init( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder modelRegInit( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder postInit( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder features( AEFeature... features );
|
IBlockBuilder features( AEFeature... features );
|
||||||
|
|
||||||
|
|||||||
@@ -19,28 +19,10 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
||||||
|
* See the individual subclasses for a specific forge initalization event.
|
||||||
*/
|
*/
|
||||||
public interface IBootstrapComponent
|
public interface IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
default void preInitialize( Side side )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
default void modelRegistration( Side side, IModelRegistry registry )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
default void initialize( Side side )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
default void postInitialize( Side side )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
@@ -36,12 +36,7 @@ import appeng.core.features.ItemDefinition;
|
|||||||
*/
|
*/
|
||||||
public interface IItemBuilder
|
public interface IItemBuilder
|
||||||
{
|
{
|
||||||
|
IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component );
|
||||||
IItemBuilder preInit( Consumer<Item> callback );
|
|
||||||
|
|
||||||
IItemBuilder init( Consumer<Item> callback );
|
|
||||||
|
|
||||||
IItemBuilder postInit( Consumer<Item> callback );
|
|
||||||
|
|
||||||
IItemBuilder features( AEFeature... features );
|
IItemBuilder features( AEFeature... features );
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.block.BlockDispenser;
|
import net.minecraft.block.BlockDispenser;
|
||||||
@@ -33,10 +33,11 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IPostInitComponent;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.CreativeTab;
|
import appeng.core.CreativeTab;
|
||||||
import appeng.core.Registration;
|
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.ItemDefinition;
|
import appeng.core.features.ItemDefinition;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
@@ -53,13 +54,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
|
|
||||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||||
|
|
||||||
private final List<Consumer<Item>> preInitCallbacks = new ArrayList<>();
|
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
|
||||||
|
|
||||||
private final List<Consumer<Item>> initCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<Consumer<Item>> modelRegCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<Consumer<Item>> postInitCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
||||||
|
|
||||||
@@ -80,23 +75,9 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemDefinitionBuilder preInit( Consumer<Item> callback )
|
public IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component )
|
||||||
{
|
{
|
||||||
this.preInitCallbacks.add( callback );
|
this.boostrapComponents.add( component );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemDefinitionBuilder init( Consumer<Item> callback )
|
|
||||||
{
|
|
||||||
this.initCallbacks.add( callback );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemDefinitionBuilder postInit( Consumer<Item> callback )
|
|
||||||
{
|
|
||||||
this.postInitCallbacks.add( callback );
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,22 +144,19 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
item.setCreativeTab( this.creativeTab );
|
item.setCreativeTab( this.creativeTab );
|
||||||
|
|
||||||
// Register all extra handlers
|
// Register all extra handlers
|
||||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( item ) ) );
|
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
||||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( item ) ) );
|
|
||||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( item ) ) );
|
|
||||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( item ) ) );
|
|
||||||
|
|
||||||
// Register custom dispenser behavior if requested
|
// Register custom dispenser behavior if requested
|
||||||
if( this.dispenserBehaviorSupplier != null )
|
if( this.dispenserBehaviorSupplier != null )
|
||||||
{
|
{
|
||||||
this.factory.addPostInit( side ->
|
this.factory.addBootstrapComponent( (IPostInitComponent) side ->
|
||||||
{
|
{
|
||||||
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
||||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.factory.addPreInit( side -> Registration.addItemToRegister( item ) );
|
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, reg ) -> reg.register( item ) );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
@@ -187,4 +165,5 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
|
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
|
|||||||
Block block = ( (ItemBlock) item ).getBlock();
|
Block block = ( (ItemBlock) item ).getBlock();
|
||||||
|
|
||||||
// We can only do this once the blocks are actually registered...
|
// We can only do this once the blocks are actually registered...
|
||||||
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
|
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
||||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
model = helper.getModelResourceLocation( block.getDefaultState() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||||
resources.add( model );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
|
|||||||
{
|
{
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||||
}
|
}
|
||||||
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
|
else if( this.itemMeshDefinition != null )
|
||||||
{
|
{
|
||||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||||
// case
|
// case
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||||
}
|
}
|
||||||
else if( item instanceof ItemBlock )
|
|
||||||
{
|
|
||||||
// The default for block items is to register the block model
|
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this.itemColor != null )
|
if( this.itemColor != null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IBlockRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void blockRegistration( Side side, IForgeRegistry<Block> blockRegistry );
|
||||||
|
}
|
||||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IInitComponent extends IBootstrapComponent
|
public interface IInitComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void initialize( Side side );
|
void initialize( Side side );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IItemRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void itemRegistration( Side side, IForgeRegistry<Item> itemRegistry );
|
||||||
|
}
|
||||||
@@ -32,8 +32,5 @@ import appeng.bootstrap.IModelRegistry;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IModelRegistrationComponent extends IBootstrapComponent
|
public interface IModelRegistrationComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void modelRegistration( Side side, IModelRegistry registry );
|
void modelRegistration( Side side, IModelRegistry registry );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-11
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
*
|
*
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
@@ -16,19 +16,16 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.integration.abstraction;
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
import appeng.integration.IIntegrationModule;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
@FunctionalInterface
|
||||||
* @author GuntherDW
|
public interface IOreDictComponent extends IBootstrapComponent
|
||||||
*/
|
|
||||||
public interface IRF
|
|
||||||
{
|
{
|
||||||
class Stub extends IIntegrationModule.Stub implements IRF
|
void oreRegistration( Side side );
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IPostInitComponent extends IBootstrapComponent
|
public interface IPostInitComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void postInitialize( Side side );
|
void postInitialize( Side side );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IPreInitComponent extends IBootstrapComponent
|
public interface IPreInitComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void preInitialize( Side side );
|
void preInitialize( Side side );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void recipeRegistration( Side side, IForgeRegistry<IRecipe> recipeRegistry );
|
||||||
|
}
|
||||||
@@ -62,7 +62,6 @@ import appeng.core.AppEng;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.coremod.MissingCoreMod;
|
|
||||||
import appeng.entity.EntityFloatingItem;
|
import appeng.entity.EntityFloatingItem;
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
import appeng.entity.EntityTinyTNTPrimed;
|
||||||
import appeng.entity.RenderFloatingItem;
|
import appeng.entity.RenderFloatingItem;
|
||||||
@@ -241,12 +240,6 @@ public class ClientHelper extends ServerHelper
|
|||||||
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void missingCoreMod()
|
|
||||||
{
|
|
||||||
throw new MissingCoreMod();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void postPlayerRender( final RenderLivingEvent.Pre p )
|
public void postPlayerRender( final RenderLivingEvent.Pre p )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
stack = ( (SlotME) slot ).getAEStack();
|
stack = ( (SlotME) slot ).getAEStack();
|
||||||
|
|
||||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel() )
|
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel() && player.inventory.getItemStack().isEmpty() )
|
||||||
{
|
{
|
||||||
action = InventoryAction.AUTO_CRAFT;
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ class CableBuilder
|
|||||||
case SMART:
|
case SMART:
|
||||||
textureFolder = "parts/cable/smart/";
|
textureFolder = "parts/cable/smart/";
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
textureFolder = "parts/cable/dense_covered/";
|
||||||
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
textureFolder = "parts/cable/dense_smart/";
|
textureFolder = "parts/cable/dense_smart/";
|
||||||
break;
|
break;
|
||||||
@@ -127,6 +130,7 @@ class CableBuilder
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.addCableCore( CableCoreType.COVERED, color, quadsOut );
|
this.addCableCore( CableCoreType.COVERED, color, quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
||||||
break;
|
break;
|
||||||
@@ -448,7 +452,31 @@ class CableBuilder
|
|||||||
addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder );
|
addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDenseConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
public void addDenseCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
|
||||||
|
{
|
||||||
|
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
|
||||||
|
if( connectionType == AECableType.COVERED || connectionType == AECableType.SMART || connectionType == AECableType.GLASS )
|
||||||
|
{
|
||||||
|
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
// We render all faces except the one on the connection side
|
||||||
|
cubeBuilder.setDrawFaces( EnumSet.complementOf( EnumSet.of( facing ) ) );
|
||||||
|
|
||||||
|
TextureAtlasSprite texture = this.connectionTextures.get( AECableType.DENSE_COVERED ).get( cableColor );
|
||||||
|
cubeBuilder.setTexture( texture );
|
||||||
|
|
||||||
|
addDenseCableSizedCube( facing, cubeBuilder );
|
||||||
|
|
||||||
|
// Reset back to normal rendering for the rest
|
||||||
|
cubeBuilder.setRenderFullBright( false );
|
||||||
|
cubeBuilder.setTexture( texture );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDenseSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
||||||
{
|
{
|
||||||
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
|
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
|
||||||
if( connectionType == AECableType.SMART )
|
if( connectionType == AECableType.SMART )
|
||||||
@@ -456,7 +484,7 @@ class CableBuilder
|
|||||||
this.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
this.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( connectionType != AECableType.DENSE_SMART )
|
else if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
|
||||||
{
|
{
|
||||||
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
return;
|
return;
|
||||||
@@ -495,7 +523,19 @@ class CableBuilder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStraightDenseConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
|
public void addStraightDenseCoveredConnection( EnumFacing facing, AEColor cableColor, List<BakedQuad> quadsOut )
|
||||||
|
{
|
||||||
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
TextureAtlasSprite texture = this.connectionTextures.get( AECableType.DENSE_COVERED ).get( cableColor );
|
||||||
|
cubeBuilder.setTexture( texture );
|
||||||
|
|
||||||
|
setStraightCableUVs( cubeBuilder, facing, 5, 11 );
|
||||||
|
|
||||||
|
addStraightDenseCableSizedCube( facing, cubeBuilder );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addStraightDenseSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
|
||||||
{
|
{
|
||||||
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
{
|
{
|
||||||
case GLASS:
|
case GLASS:
|
||||||
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
return firstType == AECableType.DENSE_COVERED && secondType == AECableType.DENSE_COVERED;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
||||||
}
|
}
|
||||||
@@ -200,8 +202,11 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
this.cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
this.cableBuilder.addStraightDenseCoveredConnection( facing, cableColor, quadsOut );
|
||||||
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.cableBuilder.addStraightDenseConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
this.cableBuilder.addStraightDenseSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +233,7 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.cableBuilder.addConstrainedSmartConnection( facing, cableColor, distance, channels, quadsOut );
|
this.cableBuilder.addConstrainedSmartConnection( facing, cableColor, distance, channels, quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
// Dense cables do not render connections to parts since none can be attached
|
// Dense cables do not render connections to parts since none can be attached
|
||||||
break;
|
break;
|
||||||
@@ -253,8 +259,11 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.cableBuilder.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
this.cableBuilder.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
this.cableBuilder.addDenseCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.cableBuilder.addDenseConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
this.cableBuilder.addDenseSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public enum CableCoreType
|
|||||||
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
||||||
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
||||||
result.put( AECableType.SMART, CableCoreType.COVERED );
|
result.put( AECableType.SMART, CableCoreType.COVERED );
|
||||||
|
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE_SMART );
|
||||||
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
||||||
|
|
||||||
return ImmutableMap.copyOf( result );
|
return ImmutableMap.copyOf( result );
|
||||||
|
|||||||
@@ -828,11 +828,11 @@ public abstract class AEBaseContainer extends Container
|
|||||||
|
|
||||||
if( action == InventoryAction.MOVE_REGION )
|
if( action == InventoryAction.MOVE_REGION )
|
||||||
{
|
{
|
||||||
final List<Slot> from = new LinkedList<>();
|
final List<Slot> from = new ArrayList<>();
|
||||||
|
|
||||||
for( final Object j : this.inventorySlots )
|
for( final Object j : this.inventorySlots )
|
||||||
{
|
{
|
||||||
if( j instanceof Slot && j.getClass() == s.getClass() )
|
if( j instanceof Slot && j.getClass() == s.getClass() && !( j instanceof SlotCraftingTerm ) )
|
||||||
{
|
{
|
||||||
from.add( (Slot) j );
|
from.add( (Slot) j );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
|||||||
{
|
{
|
||||||
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||||
( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
( ( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||||
|
|
||||||
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||||
( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
( ( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||||
|
|
||||||
if( matchA || matchB )
|
if( matchA || matchB )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getStack()
|
public ItemStack getStack()
|
||||||
{
|
{
|
||||||
final IItemHandler baseInv = getItemHandler();
|
final IItemHandler baseInv = this.getItemHandler();
|
||||||
final ItemStack input = baseInv.getStackInSlot( 0 );
|
final ItemStack input = baseInv.getStackInSlot( 0 );
|
||||||
if( input == ItemStack.EMPTY )
|
if( input == ItemStack.EMPTY )
|
||||||
{
|
{
|
||||||
@@ -137,10 +137,10 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack decrStackSize( int amount )
|
public ItemStack decrStackSize( int amount )
|
||||||
{
|
{
|
||||||
ItemStack ret = getStack();
|
ItemStack ret = this.getStack();
|
||||||
if( !ret.isEmpty() )
|
if( !ret.isEmpty() )
|
||||||
{
|
{
|
||||||
makePlate();
|
this.makePlate();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -150,21 +150,21 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
{
|
{
|
||||||
if( stack.isEmpty() )
|
if( stack.isEmpty() )
|
||||||
{
|
{
|
||||||
makePlate();
|
this.makePlate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makePlate()
|
private void makePlate()
|
||||||
{
|
{
|
||||||
if( !getItemHandler().extractItem( 0, 1, false ).isEmpty() )
|
if( !this.getItemHandler().extractItem( 0, 1, false ).isEmpty() )
|
||||||
{
|
{
|
||||||
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
|
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
|
||||||
item.damageItem( 1, getPlayerInv().player );
|
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
|
||||||
|
|
||||||
if( item.getCount() == 0 )
|
if( item.getCount() == 0 )
|
||||||
{
|
{
|
||||||
getPlayerInv().mainInventory.add( getPlayerInv().currentItem, ItemStack.EMPTY );
|
ContainerQuartzKnife.this.getPlayerInv().mainInventory.add( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
|
||||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( getPlayerInv().player, item, null ) );
|
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, item, null ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class AppEngSlot extends Slot
|
|||||||
|
|
||||||
public void clearStack()
|
public void clearStack()
|
||||||
{
|
{
|
||||||
super.putStack( ItemStack.EMPTY );
|
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.slotNumber, ItemStack.EMPTY );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -112,7 +112,7 @@ public class AppEngSlot extends Slot
|
|||||||
return this.getDisplayStack();
|
return this.getDisplayStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.itemHandler.getStackInSlot( index );
|
return this.itemHandler.getStackInSlot( this.index );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,7 +120,7 @@ public class AppEngSlot extends Slot
|
|||||||
{
|
{
|
||||||
if( this.isSlotEnabled() )
|
if( this.isSlotEnabled() )
|
||||||
{
|
{
|
||||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, index, stack );
|
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, stack );
|
||||||
this.onSlotChanged();
|
this.onSlotChanged();
|
||||||
|
|
||||||
if( this.getContainer() != null )
|
if( this.getContainer() != null )
|
||||||
@@ -151,7 +151,7 @@ public class AppEngSlot extends Slot
|
|||||||
@Override
|
@Override
|
||||||
public int getItemStackLimit( @Nonnull ItemStack stack )
|
public int getItemStackLimit( @Nonnull ItemStack stack )
|
||||||
{
|
{
|
||||||
return Math.min( getSlotStackLimit(), stack.getMaxStackSize() );
|
return Math.min( this.getSlotStackLimit(), stack.getMaxStackSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -159,7 +159,7 @@ public class AppEngSlot extends Slot
|
|||||||
{
|
{
|
||||||
if( this.isSlotEnabled() )
|
if( this.isSlotEnabled() )
|
||||||
{
|
{
|
||||||
return !this.itemHandler.extractItem( index, 1, true ).isEmpty();
|
return !this.itemHandler.extractItem( this.index, 1, true ).isEmpty();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ public class AppEngSlot extends Slot
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack decrStackSize( int amount )
|
public ItemStack decrStackSize( int amount )
|
||||||
{
|
{
|
||||||
return this.itemHandler.extractItem( index, amount, false );
|
return this.itemHandler.extractItem( this.index, amount, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,7 +191,7 @@ public class AppEngSlot extends Slot
|
|||||||
|
|
||||||
public ItemStack getDisplayStack()
|
public ItemStack getDisplayStack()
|
||||||
{
|
{
|
||||||
return this.itemHandler.getStackInSlot( index );
|
return this.itemHandler.getStackInSlot( this.index );
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getOpacityOfIcon()
|
public float getOpacityOfIcon()
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ import javax.annotation.Nonnull;
|
|||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
@@ -55,6 +56,7 @@ import appeng.core.sync.network.NetworkHandler;
|
|||||||
import appeng.core.worlddata.WorldData;
|
import appeng.core.worlddata.WorldData;
|
||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.integration.IntegrationRegistry;
|
import appeng.integration.IntegrationRegistry;
|
||||||
|
import appeng.integration.IntegrationType;
|
||||||
import appeng.recipes.CustomRecipeConfig;
|
import appeng.recipes.CustomRecipeConfig;
|
||||||
import appeng.recipes.CustomRecipeForgeConfiguration;
|
import appeng.recipes.CustomRecipeForgeConfiguration;
|
||||||
import appeng.server.AECommand;
|
import appeng.server.AECommand;
|
||||||
@@ -66,7 +68,7 @@ import appeng.services.version.VersionCheckerConfig;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12,1.12.1]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
||||||
public final class AppEng
|
public final class AppEng
|
||||||
{
|
{
|
||||||
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
|
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
|
||||||
@@ -114,6 +116,7 @@ public final class AppEng
|
|||||||
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
|
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
|
||||||
|
|
||||||
this.registration = new Registration();
|
this.registration = new Registration();
|
||||||
|
MinecraftForge.EVENT_BUS.register( this.registration );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@@ -123,21 +126,19 @@ public final class AppEng
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
public Biome getStorageBiome()
|
||||||
public final Registration getRegistration()
|
|
||||||
{
|
{
|
||||||
return this.registration;
|
return this.registration.storageBiome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DimensionType getStorageDimensionType()
|
||||||
|
{
|
||||||
|
return this.registration.storageDimensionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void preInit( final FMLPreInitializationEvent event )
|
private void preInit( final FMLPreInitializationEvent event )
|
||||||
{
|
{
|
||||||
if( !Loader.isModLoaded( "appliedenergistics2-core" ) )
|
|
||||||
{
|
|
||||||
AppEng.proxy.missingCoreMod();
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register( this.registration );
|
|
||||||
|
|
||||||
final Stopwatch watch = Stopwatch.createStarted();
|
final Stopwatch watch = Stopwatch.createStarted();
|
||||||
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
|
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
|
||||||
this.recipeDirectory = new File( this.configDirectory, "aerecipes" );
|
this.recipeDirectory = new File( this.configDirectory, "aerecipes" );
|
||||||
@@ -165,6 +166,11 @@ public final class AppEng
|
|||||||
CreativeTabFacade.init();
|
CreativeTabFacade.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( final IntegrationType type : IntegrationType.values() )
|
||||||
|
{
|
||||||
|
IntegrationRegistry.INSTANCE.add( type );
|
||||||
|
}
|
||||||
|
|
||||||
this.registration.preInitialize( event );
|
this.registration.preInitialize( event );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
|
|||||||
@@ -62,6 +62,4 @@ public abstract class CommonHelper
|
|||||||
|
|
||||||
public abstract void updateRenderMode( EntityPlayer player );
|
public abstract void updateRenderMode( EntityPlayer player );
|
||||||
|
|
||||||
public abstract void missingCoreMod();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ package appeng.core;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@@ -48,8 +46,8 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.RecipeSorter;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
@@ -70,7 +68,16 @@ import appeng.api.networking.spatial.ISpatialCache;
|
|||||||
import appeng.api.networking.storage.IStorageGrid;
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
import appeng.api.networking.ticking.ITickManager;
|
import appeng.api.networking.ticking.ITickManager;
|
||||||
import appeng.api.parts.IPartHelper;
|
import appeng.api.parts.IPartHelper;
|
||||||
|
import appeng.api.recipes.IRecipeHandler;
|
||||||
import appeng.bootstrap.IModelRegistry;
|
import appeng.bootstrap.IModelRegistry;
|
||||||
|
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IInitComponent;
|
||||||
|
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IOreDictComponent;
|
||||||
|
import appeng.bootstrap.components.IPostInitComponent;
|
||||||
|
import appeng.bootstrap.components.IPreInitComponent;
|
||||||
|
import appeng.bootstrap.components.IRecipeRegistrationComponent;
|
||||||
import appeng.capabilities.Capabilities;
|
import appeng.capabilities.Capabilities;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||||
@@ -100,8 +107,6 @@ import appeng.recipes.CustomRecipeConfig;
|
|||||||
import appeng.recipes.RecipeHandler;
|
import appeng.recipes.RecipeHandler;
|
||||||
import appeng.recipes.game.DisassembleRecipe;
|
import appeng.recipes.game.DisassembleRecipe;
|
||||||
import appeng.recipes.game.FacadeRecipe;
|
import appeng.recipes.game.FacadeRecipe;
|
||||||
import appeng.recipes.game.ShapedRecipe;
|
|
||||||
import appeng.recipes.game.ShapelessRecipe;
|
|
||||||
import appeng.recipes.handlers.Crusher;
|
import appeng.recipes.handlers.Crusher;
|
||||||
import appeng.recipes.handlers.Grind;
|
import appeng.recipes.handlers.Grind;
|
||||||
import appeng.recipes.handlers.HCCrusher;
|
import appeng.recipes.handlers.HCCrusher;
|
||||||
@@ -111,8 +116,6 @@ import appeng.recipes.handlers.MekCrusher;
|
|||||||
import appeng.recipes.handlers.MekEnrichment;
|
import appeng.recipes.handlers.MekEnrichment;
|
||||||
import appeng.recipes.handlers.Press;
|
import appeng.recipes.handlers.Press;
|
||||||
import appeng.recipes.handlers.Pulverizer;
|
import appeng.recipes.handlers.Pulverizer;
|
||||||
import appeng.recipes.handlers.Shaped;
|
|
||||||
import appeng.recipes.handlers.Shapeless;
|
|
||||||
import appeng.recipes.handlers.Smelt;
|
import appeng.recipes.handlers.Smelt;
|
||||||
import appeng.recipes.ores.OreDictionaryHandler;
|
import appeng.recipes.ores.OreDictionaryHandler;
|
||||||
import appeng.spatial.BiomeGenStorage;
|
import appeng.spatial.BiomeGenStorage;
|
||||||
@@ -122,16 +125,11 @@ import appeng.worldgen.MeteoriteWorldGen;
|
|||||||
import appeng.worldgen.QuartzWorldGen;
|
import appeng.worldgen.QuartzWorldGen;
|
||||||
|
|
||||||
|
|
||||||
public final class Registration
|
final class Registration
|
||||||
{
|
{
|
||||||
private final RecipeHandler recipeHandler;
|
DimensionType storageDimensionType;
|
||||||
private DimensionType storageDimensionType;
|
Biome storageBiome;
|
||||||
private Biome storageBiome;
|
|
||||||
|
|
||||||
// TODO : 1.12 Improve
|
|
||||||
private static List<Block> blocksToRegister = new ArrayList<>();
|
|
||||||
private static List<Item> itemsToRegister = new ArrayList<>();
|
|
||||||
private static List<IRecipe> recipesToRegister = new ArrayList<>();
|
|
||||||
private File recipeDirectory;
|
private File recipeDirectory;
|
||||||
private CustomRecipeConfig customRecipeConfig;
|
private CustomRecipeConfig customRecipeConfig;
|
||||||
|
|
||||||
@@ -141,68 +139,24 @@ public final class Registration
|
|||||||
this.customRecipeConfig = f2;
|
this.customRecipeConfig = f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Registration()
|
|
||||||
{
|
|
||||||
this.recipeHandler = new RecipeHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Biome getStorageBiome()
|
|
||||||
{
|
|
||||||
return this.storageBiome;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addBlockToRegister( Block b )
|
|
||||||
{
|
|
||||||
if( blocksToRegister == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Past the registration phase already!" );
|
|
||||||
}
|
|
||||||
blocksToRegister.add( b );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addRecipeToRegister( IRecipe r )
|
|
||||||
{
|
|
||||||
if( recipesToRegister == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Past the registration phase already!" );
|
|
||||||
}
|
|
||||||
recipesToRegister.add( r );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addItemToRegister( Item i )
|
|
||||||
{
|
|
||||||
if( itemsToRegister == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Past the registration phase already!" );
|
|
||||||
}
|
|
||||||
itemsToRegister.add( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DimensionType getStorageDimensionType()
|
|
||||||
{
|
|
||||||
return this.storageDimensionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void preInitialize( final FMLPreInitializationEvent event )
|
void preInitialize( final FMLPreInitializationEvent event )
|
||||||
{
|
{
|
||||||
// this.registerSpatial( false );
|
|
||||||
|
|
||||||
Capabilities.register();
|
Capabilities.register();
|
||||||
|
|
||||||
final Api api = Api.INSTANCE;
|
final Api api = Api.INSTANCE;
|
||||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||||
this.registerCraftHandlers( recipeRegistry );
|
this.registerCraftHandlers( recipeRegistry );
|
||||||
|
|
||||||
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
// RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||||
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
// RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||||
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
// RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||||
|
|
||||||
ApiDefinitions definitions = api.definitions();
|
ApiDefinitions definitions = api.definitions();
|
||||||
|
|
||||||
// Register all detected handlers and features (items, blocks) in pre-init
|
// Register
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.preInitialize( event.getSide() ) );
|
definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerSpatial( final boolean force, IForgeRegistry<Biome> registry )
|
private void registerSpatial( final boolean force, IForgeRegistry<Biome> registry )
|
||||||
@@ -216,34 +170,11 @@ public final class Registration
|
|||||||
|
|
||||||
if( this.storageBiome == null )
|
if( this.storageBiome == null )
|
||||||
{
|
{
|
||||||
// if( force && config.getStorageBiomeID() == -1 )
|
|
||||||
// {
|
|
||||||
// config.setStorageBiomeID( Platform.findEmpty( Biome.REGISTRY, 0, 256 ) );
|
|
||||||
// if( config.getStorageBiomeID() == -1 )
|
|
||||||
// {
|
|
||||||
// throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable
|
|
||||||
// spatial." );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this.storageBiome = new BiomeGenStorage();
|
|
||||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
|
||||||
// );
|
|
||||||
// config.save();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if( !force && config.getStorageBiomeID() != -1 )
|
|
||||||
// {
|
|
||||||
// this.storageBiome = new BiomeGenStorage();
|
|
||||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// TODO: 1.12, are modders allowed to even touch the ID's any more?
|
|
||||||
this.storageBiome = new BiomeGenStorage();
|
this.storageBiome = new BiomeGenStorage();
|
||||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||||
|
|
||||||
if( config.getStorageProviderID() != -1 )
|
if( config.getStorageProviderID() != -1 )
|
||||||
{
|
{
|
||||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
||||||
@@ -285,9 +216,6 @@ public final class Registration
|
|||||||
registry.addNewCraftHandler( "smelt", Smelt.class );
|
registry.addNewCraftHandler( "smelt", Smelt.class );
|
||||||
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
||||||
registry.addNewCraftHandler( "press", Press.class );
|
registry.addNewCraftHandler( "press", Press.class );
|
||||||
|
|
||||||
registry.addNewCraftHandler( "shaped", Shaped.class );
|
|
||||||
registry.addNewCraftHandler( "shapeless", Shapeless.class );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
||||||
@@ -302,7 +230,9 @@ public final class Registration
|
|||||||
final IRegistryContainer registries = api.registries();
|
final IRegistryContainer registries = api.registries();
|
||||||
|
|
||||||
ApiDefinitions definitions = api.definitions();
|
ApiDefinitions definitions = api.definitions();
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.initialize( event.getSide() ) );
|
definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( event.getSide() ) );
|
||||||
|
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||||
|
|
||||||
//
|
//
|
||||||
// // Perform ore camouflage!
|
// // Perform ore camouflage!
|
||||||
// ItemMaterial.instance.makeUnique();
|
// ItemMaterial.instance.makeUnique();
|
||||||
@@ -310,22 +240,6 @@ public final class Registration
|
|||||||
// final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
// final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
||||||
// recipeLoader.run();
|
// recipeLoader.run();
|
||||||
|
|
||||||
if( Integrations.ic2().isEnabled() )
|
|
||||||
{
|
|
||||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
|
||||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) )
|
|
||||||
{
|
|
||||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.redstoneflux.api.IEnergyReceiver" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.RF)) {
|
|
||||||
// partHelper.registerNewLayer("appeng.parts.layers.LayerIEnergyStorager",
|
|
||||||
// "net.minecraftforge.common.capabilities.ICapabilityProvider");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
||||||
// {
|
// {
|
||||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
|
||||||
@@ -361,9 +275,6 @@ public final class Registration
|
|||||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// TODO : 1.12 This is way too late for recipes
|
|
||||||
// this.recipeHandler.injectRecipes();
|
|
||||||
|
|
||||||
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance() );
|
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance() );
|
||||||
registration.registerAchievementHandlers();
|
registration.registerAchievementHandlers();
|
||||||
registration.registerAchievements();
|
registration.registerAchievements();
|
||||||
@@ -372,41 +283,36 @@ public final class Registration
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||||
{
|
{
|
||||||
IForgeRegistry<Biome> registry = event.getRegistry();
|
final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||||
this.registerSpatial( false, registry );
|
this.registerSpatial( false, registry );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||||
{
|
{
|
||||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
final IModelRegistry registry = new ModelLoaderWrapper();
|
final IModelRegistry registry = new ModelLoaderWrapper();
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.modelRegistration( FMLCommonHandler.instance().getEffectiveSide(), registry ) );
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
|
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( side, registry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||||
{
|
{
|
||||||
IForgeRegistry<Block> registry = event.getRegistry();
|
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||||
// TODO : 1.12 Improve
|
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
for( Block b : blocksToRegister )
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
{
|
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( side, registry ) );
|
||||||
registry.register( b );
|
|
||||||
}
|
|
||||||
blocksToRegister = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void registerItems( RegistryEvent.Register<Item> event )
|
public void registerItems( RegistryEvent.Register<Item> event )
|
||||||
{
|
{
|
||||||
|
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||||
IForgeRegistry<Item> registry = event.getRegistry();
|
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
// TODO : 1.12 Improve
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
for( Item i : itemsToRegister )
|
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( side, registry ) );
|
||||||
{
|
|
||||||
registry.register( i );
|
|
||||||
}
|
|
||||||
itemsToRegister = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -416,20 +322,15 @@ public final class Registration
|
|||||||
|
|
||||||
final Api api = Api.INSTANCE;
|
final Api api = Api.INSTANCE;
|
||||||
final ApiDefinitions definitions = api.definitions();
|
final ApiDefinitions definitions = api.definitions();
|
||||||
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
|
|
||||||
// Perform ore camouflage!
|
// Perform ore camouflage!
|
||||||
ItemMaterial.instance.makeUnique();
|
ItemMaterial.instance.makeUnique();
|
||||||
|
|
||||||
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, this.recipeHandler );
|
|
||||||
recipeLoader.run();
|
|
||||||
|
|
||||||
this.recipeHandler.injectRecipes();
|
|
||||||
|
|
||||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||||
{
|
{
|
||||||
DisassembleRecipe r = new DisassembleRecipe();
|
DisassembleRecipe r = new DisassembleRecipe();
|
||||||
// TODO : 1.12 Improve
|
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||||
addRecipeToRegister( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
|
||||||
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
|
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
|
||||||
// "after:minecraft:shapeless" );
|
// "after:minecraft:shapeless" );
|
||||||
}
|
}
|
||||||
@@ -438,35 +339,24 @@ public final class Registration
|
|||||||
{
|
{
|
||||||
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
||||||
{
|
{
|
||||||
// TODO : 1.12 Improve
|
|
||||||
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
||||||
addRecipeToRegister( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||||
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
|
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
|
||||||
// "after:minecraft:shaped" );
|
// "after:minecraft:shaped" );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = 0;
|
definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
|
||||||
// TODO : 1.12 Improve
|
|
||||||
for( IRecipe r : recipesToRegister )
|
|
||||||
{
|
|
||||||
// TODO : 1.12 *really* improve.
|
|
||||||
// Move to json where possible?
|
|
||||||
if( r.getRegistryName() == null )
|
|
||||||
{
|
|
||||||
r.setRegistryName( new ResourceLocation( AppEng.MOD_ID.toLowerCase(), "recipe_" + x ) );
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
registry.register( r );
|
|
||||||
}
|
|
||||||
recipesToRegister = null;
|
|
||||||
|
|
||||||
|
// load machine recipes
|
||||||
|
final IRecipeHandler recipeHandler = new RecipeHandler();
|
||||||
|
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, recipeHandler );
|
||||||
|
recipeLoader.run();
|
||||||
|
recipeHandler.injectRecipes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void postInit( final FMLPostInitializationEvent event )
|
void postInit( final FMLPostInitializationEvent event )
|
||||||
{
|
{
|
||||||
// TODO : 1.12 Improve
|
|
||||||
|
|
||||||
final IRegistryContainer registries = Api.INSTANCE.registries();
|
final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
final IParts parts = definitions.parts();
|
final IParts parts = definitions.parts();
|
||||||
@@ -480,7 +370,7 @@ public final class Registration
|
|||||||
PlayerMessages.values();
|
PlayerMessages.values();
|
||||||
GuiText.values();
|
GuiText.values();
|
||||||
|
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
|
definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||||
@@ -556,7 +446,7 @@ public final class Registration
|
|||||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||||
{
|
{
|
||||||
// TODO: VILLAGER TRADING
|
// TODO: VILLAGER TRADING
|
||||||
// VillagerRegistry.instance().getRegisteredVillagers()..registerVillageTradeHandler( 3, new AETrading() );
|
// VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
||||||
@@ -657,7 +547,6 @@ public final class Registration
|
|||||||
{
|
{
|
||||||
ModelLoader.setCustomStateMapper( block, mapper );
|
ModelLoader.setCustomStateMapper( block, mapper );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ import appeng.bootstrap.BlockRenderingCustomizer;
|
|||||||
import appeng.bootstrap.FeatureFactory;
|
import appeng.bootstrap.FeatureFactory;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
|
import appeng.bootstrap.components.IOreDictComponent;
|
||||||
|
import appeng.bootstrap.components.IPostInitComponent;
|
||||||
|
import appeng.bootstrap.components.IPreInitComponent;
|
||||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||||
import appeng.client.render.crafting.CraftingCubeRendering;
|
import appeng.client.render.crafting.CraftingCubeRendering;
|
||||||
import appeng.client.render.model.GlassModel;
|
import appeng.client.render.model.GlassModel;
|
||||||
@@ -239,17 +242,12 @@ public final class ApiBlocks implements IBlocks
|
|||||||
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
||||||
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
||||||
.features( AEFeature.CERTUS_ORE )
|
.features( AEFeature.CERTUS_ORE )
|
||||||
.postInit( ( block, item ) ->
|
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||||
{
|
|
||||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
||||||
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
||||||
.postInit( ( block, item ) ->
|
.useCustomItemModel()
|
||||||
{
|
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
||||||
|
|
||||||
@@ -308,6 +306,7 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.features( AEFeature.GRIND_STONE )
|
.features( AEFeature.GRIND_STONE )
|
||||||
.tileEntity( new TileEntityDefinition( TileCrank.class ) )
|
.tileEntity( new TileEntityDefinition( TileCrank.class ) )
|
||||||
.rendering( new CrankRendering() )
|
.rendering( new CrankRendering() )
|
||||||
|
.useCustomItemModel()
|
||||||
.build();
|
.build();
|
||||||
this.inscriber = registry.block( "inscriber", BlockInscriber::new )
|
this.inscriber = registry.block( "inscriber", BlockInscriber::new )
|
||||||
.features( AEFeature.INSCRIBER )
|
.features( AEFeature.INSCRIBER )
|
||||||
@@ -334,10 +333,8 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.build();
|
.build();
|
||||||
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||||
.features( AEFeature.TINY_TNT )
|
.features( AEFeature.TINY_TNT )
|
||||||
.postInit( ( block, item ) ->
|
.bootstrap( ( block, item ) -> (IPreInitComponent) side -> BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item,
|
||||||
{
|
new DispenserBehaviorTinyTNT() ) )
|
||||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, new DispenserBehaviorTinyTNT() );
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||||
.features( AEFeature.SECURITY )
|
.features( AEFeature.SECURITY )
|
||||||
@@ -424,7 +421,6 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.build();
|
.build();
|
||||||
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
||||||
.features( AEFeature.CREATIVE )
|
.features( AEFeature.CREATIVE )
|
||||||
.item( AEBaseItemBlockChargeable::new )
|
|
||||||
.tileEntity( new TileEntityDefinition( TileCreativeEnergyCell.class ) )
|
.tileEntity( new TileEntityDefinition( TileCreativeEnergyCell.class ) )
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -497,10 +493,8 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.rendering( new CableBusRendering( partModels ) )
|
.rendering( new CableBusRendering( partModels ) )
|
||||||
// (handled in BlockCableBus.java and its setupTile())
|
// (handled in BlockCableBus.java and its setupTile())
|
||||||
// .tileEntity( TileCableBus.class )
|
// .tileEntity( TileCableBus.class )
|
||||||
.postInit( ( block, item ) ->
|
// TODO: why the custom registration?
|
||||||
{
|
.bootstrap( ( block, item ) -> (IPostInitComponent) side -> ( (BlockCableBus) block ).setupTile() )
|
||||||
( (BlockCableBus) block ).setupTile();
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
this.skyStoneSlab = makeSlab( "sky_stone_slab", "sky_stone_double_slab", registry, this.skyStoneBlock() );
|
this.skyStoneSlab = makeSlab( "sky_stone_slab", "sky_stone_double_slab", registry, this.skyStoneBlock() );
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public final class ApiParts implements IParts
|
|||||||
private final AEColoredItemDefinition cableSmart;
|
private final AEColoredItemDefinition cableSmart;
|
||||||
private final AEColoredItemDefinition cableCovered;
|
private final AEColoredItemDefinition cableCovered;
|
||||||
private final AEColoredItemDefinition cableGlass;
|
private final AEColoredItemDefinition cableGlass;
|
||||||
private final AEColoredItemDefinition cableDense;
|
private final AEColoredItemDefinition cableDenseCovered;
|
||||||
|
private final AEColoredItemDefinition cableDenseSmart;
|
||||||
// private final AEColoredItemDefinition lumenCableSmart;
|
// private final AEColoredItemDefinition lumenCableSmart;
|
||||||
// private final AEColoredItemDefinition lumenCableCovered;
|
// private final AEColoredItemDefinition lumenCableCovered;
|
||||||
// private final AEColoredItemDefinition lumenCableGlass;
|
// private final AEColoredItemDefinition lumenCableGlass;
|
||||||
@@ -63,7 +64,6 @@ public final class ApiParts implements IParts
|
|||||||
private final IItemDefinition p2PTunnelItems;
|
private final IItemDefinition p2PTunnelItems;
|
||||||
private final IItemDefinition p2PTunnelFluids;
|
private final IItemDefinition p2PTunnelFluids;
|
||||||
private final IItemDefinition p2PTunnelEU;
|
private final IItemDefinition p2PTunnelEU;
|
||||||
private final IItemDefinition p2PTunnelRF;
|
|
||||||
private final IItemDefinition p2PTunnelFE;
|
private final IItemDefinition p2PTunnelFE;
|
||||||
private final IItemDefinition p2PTunnelLight;
|
private final IItemDefinition p2PTunnelLight;
|
||||||
// private final IItemDefinition p2PTunnelOpenComputers;
|
// private final IItemDefinition p2PTunnelOpenComputers;
|
||||||
@@ -94,7 +94,8 @@ public final class ApiParts implements IParts
|
|||||||
this.cableSmart = constructColoredDefinition( itemPart, PartType.CABLE_SMART );
|
this.cableSmart = constructColoredDefinition( itemPart, PartType.CABLE_SMART );
|
||||||
this.cableCovered = constructColoredDefinition( itemPart, PartType.CABLE_COVERED );
|
this.cableCovered = constructColoredDefinition( itemPart, PartType.CABLE_COVERED );
|
||||||
this.cableGlass = constructColoredDefinition( itemPart, PartType.CABLE_GLASS );
|
this.cableGlass = constructColoredDefinition( itemPart, PartType.CABLE_GLASS );
|
||||||
this.cableDense = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_SMART );
|
this.cableDenseCovered = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_COVERED );
|
||||||
|
this.cableDenseSmart = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_SMART );
|
||||||
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||||
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||||
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||||
@@ -116,7 +117,6 @@ public final class ApiParts implements IParts
|
|||||||
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
|
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
|
||||||
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) );
|
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) );
|
||||||
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) );
|
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) );
|
||||||
this.p2PTunnelRF = new DamagedItemDefinition( "part.tunnel.rf", itemPart.createPart( PartType.P2P_TUNNEL_RF ) );
|
|
||||||
this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2P_TUNNEL_FE ) );
|
this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2P_TUNNEL_FE ) );
|
||||||
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) );
|
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) );
|
||||||
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
||||||
@@ -166,9 +166,15 @@ public final class ApiParts implements IParts
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AEColoredItemDefinition cableDense()
|
public AEColoredItemDefinition cableDenseCovered()
|
||||||
{
|
{
|
||||||
return this.cableDense;
|
return this.cableDenseCovered;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AEColoredItemDefinition cableDenseSmart()
|
||||||
|
{
|
||||||
|
return this.cableDenseSmart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -193,7 +199,7 @@ public final class ApiParts implements IParts
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AEColoredItemDefinition lumenCableDense()
|
public AEColoredItemDefinition lumenDenseCableSmart()
|
||||||
{
|
{
|
||||||
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
||||||
// return this.lumenCableDense;
|
// return this.lumenCableDense;
|
||||||
@@ -295,12 +301,6 @@ public final class ApiParts implements IParts
|
|||||||
return this.p2PTunnelEU;
|
return this.p2PTunnelEU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IItemDefinition p2PTunnelRF()
|
|
||||||
{
|
|
||||||
return this.p2PTunnelRF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemDefinition p2PTunnelFE()
|
public IItemDefinition p2PTunnelFE()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ public enum AEFeature
|
|||||||
DENSE_ENERGY_CELLS( "DenseEnergyCells", Constants.CATEGORY_HIGHER_CAPACITY ),
|
DENSE_ENERGY_CELLS( "DenseEnergyCells", Constants.CATEGORY_HIGHER_CAPACITY ),
|
||||||
DENSE_CABLES( "DenseCables", Constants.CATEGORY_HIGHER_CAPACITY ),
|
DENSE_CABLES( "DenseCables", Constants.CATEGORY_HIGHER_CAPACITY ),
|
||||||
|
|
||||||
P2P_TUNNEL_RF( "P2PTunnelRF", Constants.CATEGORY_P2P_TUNNELS ),
|
|
||||||
P2P_TUNNEL_ME( "P2PTunnelME", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_ME( "P2PTunnelME", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
|
|||||||
@@ -73,22 +73,12 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( blocks.energyCell(), TunnelType.FE_POWER );
|
this.addNewAttunement( blocks.energyCell(), TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( blocks.energyCellCreative(), TunnelType.FE_POWER );
|
this.addNewAttunement( blocks.energyCellCreative(), TunnelType.FE_POWER );
|
||||||
|
|
||||||
/**
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER );
|
||||||
* RF tunnel items
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.FE_POWER );
|
||||||
*/
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.FE_POWER );
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.RF_POWER ); // leadstone
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.FE_POWER );
|
||||||
// fluxduct
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.RF_POWER ); // hardened
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.RF_POWER ); // redstone
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.RF_POWER ); // signalum
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.RF_POWER ); // resonant
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.RF_POWER ); // cryo-stabilized
|
|
||||||
// fluxduct
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EU tunnel items
|
* EU tunnel items
|
||||||
@@ -167,22 +157,22 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
|
||||||
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
|
||||||
this.addNewAttunement( parts.cableSmart().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableSmart().stack( c, 1 ), TunnelType.ME );
|
||||||
this.addNewAttunement( parts.cableDense().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableDenseSmart().stack( c, 1 ), TunnelType.ME );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* attune based on the ItemStack's modId
|
* attune based on the ItemStack's modId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.addNewAttunement( "thermaldynamics", TunnelType.RF_POWER );
|
this.addNewAttunement( "thermaldynamics", TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( "thermalexpansion", TunnelType.RF_POWER );
|
this.addNewAttunement( "thermalexpansion", TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( "thermalfoundation", TunnelType.RF_POWER );
|
this.addNewAttunement( "thermalfoundation", TunnelType.FE_POWER );
|
||||||
// TODO: Remove when confirmed that the official 1.12 version of EnderIO will support FE.
|
// TODO: Remove when confirmed that the official 1.12 version of EnderIO will support FE.
|
||||||
this.addNewAttunement( "enderio", TunnelType.RF_POWER );
|
this.addNewAttunement( "enderio", TunnelType.FE_POWER );
|
||||||
// TODO: Remove when confirmed that the official 1.12 version of Mekanism will support FE.
|
// TODO: Remove when confirmed that the official 1.12 version of Mekanism will support FE.
|
||||||
this.addNewAttunement( "mekanism", TunnelType.RF_POWER );
|
this.addNewAttunement( "mekanism", TunnelType.FE_POWER );
|
||||||
// TODO: Remove when support for RFTools' Powercells support is added
|
// TODO: Remove when support for RFTools' Powercells support is added
|
||||||
this.addNewAttunement( "rftools", TunnelType.RF_POWER );
|
this.addNewAttunement( "rftools", TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( "ic2", TunnelType.IC2_POWER );
|
this.addNewAttunement( "ic2", TunnelType.IC2_POWER );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ public enum GuiText
|
|||||||
FluidTunnel,
|
FluidTunnel,
|
||||||
OCTunnel,
|
OCTunnel,
|
||||||
LightTunnel,
|
LightTunnel,
|
||||||
RFTunnel,
|
|
||||||
FETunnel,
|
FETunnel,
|
||||||
PressureTunnel,
|
PressureTunnel,
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public enum Achievements
|
|||||||
Networking2( 4, 0, AEApi.instance().definitions().parts().cableSmart(), AchievementType.Custom ),
|
Networking2( 4, 0, AEApi.instance().definitions().parts().cableSmart(), AchievementType.Custom ),
|
||||||
|
|
||||||
// done
|
// done
|
||||||
Networking3( 4, 2, AEApi.instance().definitions().parts().cableDense(), AchievementType.Custom ),
|
Networking3( 4, 2, AEApi.instance().definitions().parts().cableDenseSmart(), AchievementType.Custom ),
|
||||||
|
|
||||||
// done
|
// done
|
||||||
P2P( 2, -2, AEApi.instance().definitions().parts().p2PTunnelME(), AchievementType.Craft ),
|
P2P( 2, -2, AEApi.instance().definitions().parts().p2PTunnelME(), AchievementType.Craft ),
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class PacketNewStorageDimension extends AppEngPacket
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DimensionManager.registerDimension( this.newDim, AppEng.instance().getRegistration().getStorageDimensionType() );
|
DimensionManager.registerDimension( this.newDim, AppEng.instance().getStorageDimensionType() );
|
||||||
}
|
}
|
||||||
catch( final IllegalArgumentException iae )
|
catch( final IllegalArgumentException iae )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ final class DimensionData implements IWorldDimensionData, IOnWorldStartable, IOn
|
|||||||
{
|
{
|
||||||
for( final Integer storageCellDimID : this.storageCellDimensionIDs )
|
for( final Integer storageCellDimID : this.storageCellDimensionIDs )
|
||||||
{
|
{
|
||||||
DimensionManager.registerDimension( storageCellDimID, AppEng.instance().getRegistration().getStorageDimensionType() );
|
DimensionManager.registerDimension( storageCellDimID, AppEng.instance().getStorageDimensionType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.config.save();
|
this.config.save();
|
||||||
@@ -111,7 +111,7 @@ final class DimensionData implements IWorldDimensionData, IOnWorldStartable, IOn
|
|||||||
public void addStorageCell( final int newStorageCellID )
|
public void addStorageCell( final int newStorageCellID )
|
||||||
{
|
{
|
||||||
this.storageCellDimensionIDs.add( newStorageCellID );
|
this.storageCellDimensionIDs.add( newStorageCellID );
|
||||||
DimensionManager.registerDimension( newStorageCellID, AppEng.instance().getRegistration().getStorageDimensionType() );
|
DimensionManager.registerDimension( newStorageCellID, AppEng.instance().getStorageDimensionType() );
|
||||||
|
|
||||||
NetworkHandler.instance().sendToAll( new PacketNewStorageDimension( newStorageCellID ) );
|
NetworkHandler.instance().sendToAll( new PacketNewStorageDimension( newStorageCellID ) );
|
||||||
|
|
||||||
|
|||||||
@@ -1,133 +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.coremod;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.DummyModContainer;
|
|
||||||
import net.minecraftforge.fml.common.FMLLog;
|
|
||||||
import net.minecraftforge.fml.common.LoadController;
|
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
|
||||||
import net.minecraftforge.fml.common.ModMetadata;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|
||||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
|
||||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion;
|
|
||||||
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
|
|
||||||
|
|
||||||
@MCVersion( "1.12" )
|
|
||||||
public final class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
|
|
||||||
{
|
|
||||||
private final ModMetadata metadata = new ModMetadata();
|
|
||||||
|
|
||||||
public AppEngCore()
|
|
||||||
{
|
|
||||||
FMLLog.log( "AE2-CORE", Level.INFO, "[AppEng] Core Init" );
|
|
||||||
this.metadata.autogenerated = false;
|
|
||||||
this.metadata.authorList.add( "AlgorithmX2" );
|
|
||||||
this.metadata.credits = "AlgorithmX2";
|
|
||||||
this.metadata.modId = this.getModId();
|
|
||||||
this.metadata.version = this.getVersion();
|
|
||||||
this.metadata.name = this.getName();
|
|
||||||
this.metadata.url = "http://ae2.ae-mod.info";
|
|
||||||
this.metadata.logoFile = "assets/appliedenergistics2/meta/logo.png";
|
|
||||||
this.metadata.description = "Embedded Coremod for Applied Energistics 2";
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void load( final FMLInitializationEvent event )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getASMTransformerClass()
|
|
||||||
{
|
|
||||||
return new String[] { "appeng.coremod.transformer.ASMIntegration" };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getModContainerClass()
|
|
||||||
{
|
|
||||||
return "appeng.coremod.AppEngCore";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public String getSetupClass()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void injectData( final Map<String, Object> data )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAccessTransformerClass()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModMetadata getMetadata()
|
|
||||||
{
|
|
||||||
return this.metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getModId()
|
|
||||||
{
|
|
||||||
return "appliedenergistics2-core";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return "Applied Energistics 2 Core";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
return AEConfig.VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean registerBus( final EventBus bus, final LoadController controller )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDisplayVersion()
|
|
||||||
{
|
|
||||||
return this.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,100 +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.coremod;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
|
||||||
import net.minecraft.client.gui.GuiErrorScreen;
|
|
||||||
import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
|
||||||
public final class MissingCoreMod extends CustomModLoadingErrorDisplayException
|
|
||||||
{
|
|
||||||
private static final int SHADOW_WHITE = 0xeeeeee;
|
|
||||||
private static final int COLOR_WHITE = 0xffffff;
|
|
||||||
private static final long serialVersionUID = -966774766922821652L;
|
|
||||||
private static final int SCREEN_OFFSET = 15;
|
|
||||||
|
|
||||||
private boolean deobf = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui( final GuiErrorScreen errorScreen, final FontRenderer fontRenderer )
|
|
||||||
{
|
|
||||||
final Class<?> clz = errorScreen.getClass();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
clz.getField( "mc" );
|
|
||||||
this.deobf = true;
|
|
||||||
}
|
|
||||||
catch( final Throwable ignored )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawScreen( final GuiErrorScreen errorScreen, final FontRenderer fontRenderer, final int mouseRelX, final int mouseRelY, final float tickTime )
|
|
||||||
{
|
|
||||||
int offset = 10;
|
|
||||||
this.drawCenteredString( fontRenderer, "Sorry, couldn't load AE2 properly.", errorScreen.width / 2, offset, COLOR_WHITE );
|
|
||||||
|
|
||||||
offset += SCREEN_OFFSET;
|
|
||||||
this.drawCenteredString( fontRenderer, "Please make sure that AE2 is installed into your mods folder.", errorScreen.width / 2, offset, SHADOW_WHITE );
|
|
||||||
|
|
||||||
offset += 2 * SCREEN_OFFSET;
|
|
||||||
|
|
||||||
if( this.deobf )
|
|
||||||
{
|
|
||||||
offset += SCREEN_OFFSET;
|
|
||||||
this.drawCenteredString( fontRenderer, "In a developer environment add the following too your args,", errorScreen.width / 2, offset, COLOR_WHITE );
|
|
||||||
|
|
||||||
offset += SCREEN_OFFSET;
|
|
||||||
this.drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.coremod.AppEngCore", errorScreen.width / 2, offset, SHADOW_WHITE );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.drawCenteredString( fontRenderer, "Your launcher may refer to this by different names,", errorScreen.width / 2, offset, COLOR_WHITE );
|
|
||||||
|
|
||||||
offset += SCREEN_OFFSET + 5;
|
|
||||||
|
|
||||||
this.drawCenteredString( fontRenderer, "MultiMC calls this tab \"Loader Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE );
|
|
||||||
|
|
||||||
offset += SCREEN_OFFSET;
|
|
||||||
this.drawCenteredString( fontRenderer, "Magic Launcher calls this tab \"External Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE );
|
|
||||||
|
|
||||||
offset += SCREEN_OFFSET;
|
|
||||||
this.drawCenteredString( fontRenderer, "Most other launchers refer to this tab as just \"Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE );
|
|
||||||
|
|
||||||
offset += 2 * SCREEN_OFFSET;
|
|
||||||
this.drawCenteredString( fontRenderer, "Also make sure that the AE2 file is a .jar, and not a .zip", errorScreen.width / 2, offset, COLOR_WHITE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawCenteredString( final FontRenderer fontRenderer, final String string, final int x, final int y, final int colour )
|
|
||||||
{
|
|
||||||
final String reEncoded = string.replaceAll( "\\P{InBasic_Latin}", "" );
|
|
||||||
final int reEncodedWidth = fontRenderer.getStringWidth( reEncoded );
|
|
||||||
final int centeredX = x - reEncodedWidth / 2;
|
|
||||||
|
|
||||||
fontRenderer.drawStringWithShadow( string, centeredX, y, colour );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,255 +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.coremod.transformer;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.Type;
|
|
||||||
import org.objectweb.asm.tree.AnnotationNode;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.IClassTransformer;
|
|
||||||
import net.minecraftforge.fml.common.FMLLog;
|
|
||||||
|
|
||||||
import appeng.coremod.annotations.Integration;
|
|
||||||
import appeng.helpers.Reflected;
|
|
||||||
import appeng.integration.IntegrationRegistry;
|
|
||||||
import appeng.integration.IntegrationType;
|
|
||||||
|
|
||||||
|
|
||||||
@Reflected
|
|
||||||
public final class ASMIntegration implements IClassTransformer
|
|
||||||
{
|
|
||||||
@Reflected
|
|
||||||
public ASMIntegration()
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Side, Display Name, ModID ClassPostFix
|
|
||||||
*/
|
|
||||||
|
|
||||||
for( final IntegrationType type : IntegrationType.values() )
|
|
||||||
{
|
|
||||||
IntegrationRegistry.INSTANCE.add( type );
|
|
||||||
}
|
|
||||||
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", IntegrationType.TE );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Mystcraft", "Mystcraft", IntegrationType.Mystcraft );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", IntegrationType.GT );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, IntegrationType.UE );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", IntegrationType.LP );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Better Storage", IntegrationType.betterstorage );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Forestry", "Forestry", IntegrationType.Forestry );
|
|
||||||
// integrationModules.add( IntegrationSide.BOTH, "Mekanism", "Mekanism", IntegrationType.Mekanism );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public byte[] transform( final String name, final String transformedName, final byte[] basicClass )
|
|
||||||
{
|
|
||||||
if( basicClass == null || transformedName.startsWith( "appeng.coremod" ) )
|
|
||||||
{
|
|
||||||
return basicClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( transformedName.startsWith( "appeng." ) )
|
|
||||||
{
|
|
||||||
final ClassNode classNode = new ClassNode();
|
|
||||||
final ClassReader classReader = new ClassReader( basicClass );
|
|
||||||
classReader.accept( classNode, 0 );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final boolean reWrite = this.removeOptionals( classNode );
|
|
||||||
|
|
||||||
if( reWrite )
|
|
||||||
{
|
|
||||||
final ClassWriter writer = new ClassWriter( ClassWriter.COMPUTE_MAXS );
|
|
||||||
classNode.accept( writer );
|
|
||||||
return writer.toByteArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( final Throwable t )
|
|
||||||
{
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return basicClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean removeOptionals( final ClassNode classNode )
|
|
||||||
{
|
|
||||||
boolean changed = false;
|
|
||||||
|
|
||||||
if( classNode.visibleAnnotations != null )
|
|
||||||
{
|
|
||||||
for( final AnnotationNode an : classNode.visibleAnnotations )
|
|
||||||
{
|
|
||||||
if( this.hasAnnotation( an, Integration.Interface.class ) )
|
|
||||||
{
|
|
||||||
if( this.stripInterface( classNode, Integration.Interface.class, an ) )
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( this.hasAnnotation( an, Integration.InterfaceList.class ) )
|
|
||||||
{
|
|
||||||
for( final Object o : ( (Iterable) an.values.get( 1 ) ) )
|
|
||||||
{
|
|
||||||
if( this.stripInterface( classNode, Integration.InterfaceList.class, (AnnotationNode) o ) )
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final Iterator<MethodNode> i = classNode.methods.iterator();
|
|
||||||
while( i.hasNext() )
|
|
||||||
{
|
|
||||||
final MethodNode mn = i.next();
|
|
||||||
|
|
||||||
if( mn.visibleAnnotations != null )
|
|
||||||
{
|
|
||||||
for( final AnnotationNode an : mn.visibleAnnotations )
|
|
||||||
{
|
|
||||||
if( this.hasAnnotation( an, Integration.Method.class ) )
|
|
||||||
{
|
|
||||||
if( this.stripMethod( classNode, mn, i, Integration.Method.class, an ) )
|
|
||||||
{
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( changed )
|
|
||||||
{
|
|
||||||
this.log( "Updated " + classNode.name );
|
|
||||||
}
|
|
||||||
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasAnnotation( final AnnotationNode ann, final Class<?> annotation )
|
|
||||||
{
|
|
||||||
return ann.desc.equals( Type.getDescriptor( annotation ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean stripInterface( final ClassNode classNode, final Class<?> class1, final AnnotationNode an )
|
|
||||||
{
|
|
||||||
if( an.values.size() != 4 )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "Unable to handle Interface annotation on " + classNode.name );
|
|
||||||
}
|
|
||||||
|
|
||||||
String iFace = null;
|
|
||||||
|
|
||||||
if( an.values.get( 0 ).equals( "iface" ) )
|
|
||||||
{
|
|
||||||
iFace = (String) an.values.get( 1 );
|
|
||||||
}
|
|
||||||
else if( an.values.get( 2 ).equals( "iface" ) )
|
|
||||||
{
|
|
||||||
iFace = (String) an.values.get( 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
String iName = null;
|
|
||||||
if( an.values.get( 0 ).equals( "iname" ) )
|
|
||||||
{
|
|
||||||
iName = ( (String[]) an.values.get( 1 ) )[1];
|
|
||||||
}
|
|
||||||
else if( an.values.get( 2 ).equals( "iname" ) )
|
|
||||||
{
|
|
||||||
iName = ( (String[]) an.values.get( 3 ) )[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( iName != null && iFace != null )
|
|
||||||
{
|
|
||||||
final IntegrationType type = IntegrationType.valueOf( iName );
|
|
||||||
if( !IntegrationRegistry.INSTANCE.isEnabled( type ) )
|
|
||||||
{
|
|
||||||
this.log( "Removing Interface " + iFace + " from " + classNode.name + " because " + iName + " integration is disabled." );
|
|
||||||
classNode.interfaces.remove( iFace.replace( '.', '/' ) );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.log( "Allowing Interface " + iFace + " from " + classNode.name + " because " + iName + " integration is enabled." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Unable to handle Method annotation on " + classNode.name );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean stripMethod( final ClassNode classNode, final MethodNode mn, final Iterator<MethodNode> i, final Class class1, final AnnotationNode an )
|
|
||||||
{
|
|
||||||
if( an.values.size() != 2 )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "Unable to handle Method annotation on " + classNode.name );
|
|
||||||
}
|
|
||||||
|
|
||||||
String iName = null;
|
|
||||||
|
|
||||||
if( an.values.get( 0 ).equals( "iname" ) )
|
|
||||||
{
|
|
||||||
iName = ( (String[]) an.values.get( 1 ) )[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( iName != null )
|
|
||||||
{
|
|
||||||
final IntegrationType type = IntegrationType.valueOf( iName );
|
|
||||||
if( !IntegrationRegistry.INSTANCE.isEnabled( type ) )
|
|
||||||
{
|
|
||||||
this.log( "Removing Method " + mn.name + " from " + classNode.name + " because " + iName + " integration is disabled." );
|
|
||||||
i.remove();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.log( "Allowing Method " + mn.name + " from " + classNode.name + " because " + iName + " integration is enabled." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Unable to handle Method annotation on " + classNode.name );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void log( final String string )
|
|
||||||
{
|
|
||||||
FMLLog.log( "AE2-CORE", Level.INFO, string );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -87,7 +87,7 @@ public class TileItemGen extends AEBaseTile
|
|||||||
{
|
{
|
||||||
if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability )
|
if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability )
|
||||||
{
|
{
|
||||||
return (T) handler;
|
return (T) this.handler;
|
||||||
}
|
}
|
||||||
return super.getCapability( capability, facing );
|
return super.getCapability( capability, facing );
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ public class TileItemGen extends AEBaseTile
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return simulate ? is.copy() : getNextItem();
|
return simulate ? is.copy() : this.getNextItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getNextItem()
|
private ItemStack getNextItem()
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public abstract class BlockSlabCommon extends BlockSlab
|
|||||||
|
|
||||||
this.setDefaultState( iblockstate.withProperty( VARIANT, Variant.DEFAULT ) );
|
this.setDefaultState( iblockstate.withProperty( VARIANT, Variant.DEFAULT ) );
|
||||||
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
||||||
|
this.useNeighborBrightness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1264,7 +1264,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
{
|
{
|
||||||
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
||||||
{
|
{
|
||||||
return (T) storage;
|
return (T) this.storage;
|
||||||
}
|
}
|
||||||
else if( capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
|
else if( capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class InvalidPatternHelper
|
|||||||
|
|
||||||
for( int i = 0; i < outTag.tagCount(); i++ )
|
for( int i = 0; i < outTag.tagCount(); i++ )
|
||||||
{
|
{
|
||||||
outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) );
|
this.outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 0; i < inTag.tagCount(); i++ )
|
for( int i = 0; i < inTag.tagCount(); i++ )
|
||||||
@@ -68,7 +68,7 @@ public class InvalidPatternHelper
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.add( new PatternIngredient( in ) );
|
this.inputs.add( new PatternIngredient( in ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public class InvalidPatternHelper
|
|||||||
{
|
{
|
||||||
this.stack = new ItemStack( tag );
|
this.stack = new ItemStack( tag );
|
||||||
|
|
||||||
if( stack.isEmpty() )
|
if( this.stack.isEmpty() )
|
||||||
{
|
{
|
||||||
this.id = tag.getString( "id" );
|
this.id = tag.getString( "id" );
|
||||||
this.count = tag.getByte( "Count" );
|
this.count = tag.getByte( "Count" );
|
||||||
@@ -114,39 +114,39 @@ public class InvalidPatternHelper
|
|||||||
|
|
||||||
public boolean isValid()
|
public boolean isValid()
|
||||||
{
|
{
|
||||||
return !stack.isEmpty();
|
return !this.stack.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return isValid() ? Platform.getItemDisplayName( stack ) : id + '@' + String.valueOf( getDamage() );
|
return this.isValid() ? Platform.getItemDisplayName( this.stack ) : this.id + '@' + String.valueOf( this.getDamage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDamage()
|
public int getDamage()
|
||||||
{
|
{
|
||||||
return isValid() ? stack.getItemDamage() : damage;
|
return this.isValid() ? this.stack.getItemDamage() : this.damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount()
|
public int getCount()
|
||||||
{
|
{
|
||||||
return isValid() ? stack.getCount() : count;
|
return this.isValid() ? this.stack.getCount() : this.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem()
|
public ItemStack getItem()
|
||||||
{
|
{
|
||||||
if( !isValid() )
|
if( !this.isValid() )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException( "There is no valid ItemStack for this PatternIngredient" );
|
throw new IllegalArgumentException( "There is no valid ItemStack for this PatternIngredient" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return stack;
|
return this.stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFormattedToolTip()
|
public String getFormattedToolTip()
|
||||||
{
|
{
|
||||||
String result = String.valueOf( getCount() ) + ' ' + getName();
|
String result = String.valueOf( this.getCount() ) + ' ' + this.getName();
|
||||||
|
|
||||||
if( !isValid() )
|
if( !this.isValid() )
|
||||||
{
|
{
|
||||||
result = TextFormatting.RED + ( ' ' + result );
|
result = TextFormatting.RED + ( ' ' + result );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package appeng.integration;
|
|||||||
|
|
||||||
import appeng.integration.modules.ic2.IC2Module;
|
import appeng.integration.modules.ic2.IC2Module;
|
||||||
import appeng.integration.modules.jei.JEIModule;
|
import appeng.integration.modules.jei.JEIModule;
|
||||||
import appeng.integration.modules.rf.RFModule;
|
|
||||||
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
|
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
|
||||||
import appeng.integration.modules.waila.WailaModule;
|
import appeng.integration.modules.waila.WailaModule;
|
||||||
|
|
||||||
@@ -39,24 +38,6 @@ public enum IntegrationType
|
|||||||
|
|
||||||
RC( IntegrationSide.BOTH, "Railcraft", "railcraft" ),
|
RC( IntegrationSide.BOTH, "Railcraft", "railcraft" ),
|
||||||
|
|
||||||
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "redstoneflux" )
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public IIntegrationModule createInstance()
|
|
||||||
{
|
|
||||||
return new RFModule();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "redstoneflux" )
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public IIntegrationModule createInstance()
|
|
||||||
{
|
|
||||||
return new RFModule();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "minefactoryreloaded" ),
|
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "minefactoryreloaded" ),
|
||||||
|
|
||||||
Waila( IntegrationSide.BOTH, "Waila", "waila" )
|
Waila( IntegrationSide.BOTH, "Waila", "waila" )
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import appeng.integration.abstraction.IInvTweaks;
|
|||||||
import appeng.integration.abstraction.IJEI;
|
import appeng.integration.abstraction.IJEI;
|
||||||
import appeng.integration.abstraction.IMekanism;
|
import appeng.integration.abstraction.IMekanism;
|
||||||
import appeng.integration.abstraction.IRC;
|
import appeng.integration.abstraction.IRC;
|
||||||
import appeng.integration.abstraction.IRF;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,8 +42,6 @@ public final class Integrations
|
|||||||
|
|
||||||
static IInvTweaks invTweaks = new IInvTweaks.Stub();
|
static IInvTweaks invTweaks = new IInvTweaks.Stub();
|
||||||
|
|
||||||
static IRF redstoneflux = new IRF.Stub();
|
|
||||||
|
|
||||||
private Integrations()
|
private Integrations()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -104,10 +101,4 @@ public final class Integrations
|
|||||||
return invTweaks;
|
return invTweaks;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IRF setRedstoneFlux( IRF redstoneflux )
|
|
||||||
{
|
|
||||||
Integrations.redstoneflux = redstoneflux;
|
|
||||||
return redstoneflux;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,15 @@ package appeng.integration.modules.ic2;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import ic2.api.item.ElectricItem;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.TunnelType;
|
import appeng.api.config.TunnelType;
|
||||||
import appeng.api.features.IP2PTunnelRegistry;
|
import appeng.api.features.IP2PTunnelRegistry;
|
||||||
import appeng.integration.IntegrationHelper;
|
import appeng.integration.IntegrationHelper;
|
||||||
import appeng.integration.abstraction.IC2PowerSink;
|
import appeng.integration.abstraction.IC2PowerSink;
|
||||||
import appeng.integration.abstraction.IIC2;
|
import appeng.integration.abstraction.IIC2;
|
||||||
|
import appeng.integration.modules.ic2.energy.PoweredItemManager;
|
||||||
import appeng.tile.powersink.IExternalPowerSink;
|
import appeng.tile.powersink.IExternalPowerSink;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +42,11 @@ public class IC2Module implements IIC2
|
|||||||
public IC2Module()
|
public IC2Module()
|
||||||
{
|
{
|
||||||
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
||||||
|
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyAcceptor.class );
|
||||||
|
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyEmitter.class );
|
||||||
|
IntegrationHelper.testClassExistence( this, ic2.api.energy.prefab.BasicSinkSource.class );
|
||||||
IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
|
IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
|
||||||
|
IntegrationHelper.testClassExistence( this, ic2.api.item.IBackupElectricItemManager.class );
|
||||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
|
IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
|
||||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.IRecipeInput.class );
|
IntegrationHelper.testClassExistence( this, ic2.api.recipe.IRecipeInput.class );
|
||||||
}
|
}
|
||||||
@@ -53,6 +60,8 @@ public class IC2Module implements IIC2
|
|||||||
{
|
{
|
||||||
reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER );
|
reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElectricItem.registerBackupManager( new PoweredItemManager() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getItem( final String name, String variant )
|
private ItemStack getItem( final String name, String variant )
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* 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.integration.modules.ic2.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import ic2.api.item.IBackupElectricItemManager;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerUnits;
|
||||||
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
|
|
||||||
|
|
||||||
|
public class PoweredItemManager implements IBackupElectricItemManager
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double charge( ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
||||||
|
{
|
||||||
|
final double limit = this.getTransferLimit( stack );
|
||||||
|
final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem();
|
||||||
|
final double convertedPower = PowerUnits.EU.convertTo( PowerUnits.AE, amount );
|
||||||
|
|
||||||
|
double toAdd = convertedPower;
|
||||||
|
|
||||||
|
if( !ignoreTransferLimit && amount > limit )
|
||||||
|
{
|
||||||
|
toAdd = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
final double overflow = poweredItem.injectAEPower( stack, toAdd, simulate ? Actionable.SIMULATE : Actionable.MODULATE );
|
||||||
|
final double addedAmount = toAdd - (int) overflow;
|
||||||
|
|
||||||
|
return PowerUnits.AE.convertTo( PowerUnits.EU, addedAmount );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double discharge( ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getCharge( ItemStack stack )
|
||||||
|
{
|
||||||
|
final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem();
|
||||||
|
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, poweredItem.getAECurrentPower( stack ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxCharge( ItemStack stack )
|
||||||
|
{
|
||||||
|
final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem();
|
||||||
|
return PowerUnits.AE.convertTo( PowerUnits.EU, poweredItem.getAEMaxPower( stack ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUse( ItemStack stack, double amount )
|
||||||
|
{
|
||||||
|
return this.getCharge( stack ) > amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean use( ItemStack stack, double amount, EntityLivingBase entity )
|
||||||
|
{
|
||||||
|
final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem();
|
||||||
|
|
||||||
|
if( this.canUse( stack, amount ) )
|
||||||
|
{
|
||||||
|
final double toUse = PowerUnits.EU.convertTo( PowerUnits.AE, amount );
|
||||||
|
|
||||||
|
poweredItem.extractAEPower( stack, toUse, Actionable.MODULATE );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void chargeFromArmor( ItemStack stack, EntityLivingBase entity )
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToolTip( ItemStack stack )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTier( ItemStack stack )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handles( ItemStack stack )
|
||||||
|
{
|
||||||
|
return !stack.isEmpty() && ( stack.getItem() instanceof IAEItemPowerStorage );
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getTransferLimit( ItemStack itemStack )
|
||||||
|
{
|
||||||
|
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ package appeng.integration.modules.jei;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategory;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -34,7 +35,6 @@ import mezz.jei.api.gui.IDrawableStatic;
|
|||||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.CondenserOutput;
|
import appeng.api.config.CondenserOutput;
|
||||||
@@ -44,7 +44,7 @@ import appeng.core.AppEng;
|
|||||||
import appeng.tile.misc.TileCondenser;
|
import appeng.tile.misc.TileCondenser;
|
||||||
|
|
||||||
|
|
||||||
class CondenserCategory extends BlankRecipeCategory<CondenserOutputWrapper>
|
class CondenserCategory implements IRecipeCategory<CondenserOutputWrapper>
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final String UID = "appliedenergistics2.condenser";
|
public static final String UID = "appliedenergistics2.condenser";
|
||||||
|
|||||||
@@ -19,19 +19,19 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import mezz.jei.api.IGuiHelper;
|
import mezz.jei.api.IGuiHelper;
|
||||||
import mezz.jei.api.gui.IDrawable;
|
import mezz.jei.api.gui.IDrawable;
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import appeng.api.config.CondenserOutput;
|
import appeng.api.config.CondenserOutput;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
|
|
||||||
class CondenserOutputHandler implements IRecipeHandler<CondenserOutput>
|
class CondenserOutputHandler implements IRecipeWrapperFactory<CondenserOutput>
|
||||||
{
|
{
|
||||||
|
|
||||||
private final ItemStack matterBall;
|
private final ItemStack matterBall;
|
||||||
@@ -49,18 +49,6 @@ class CondenserOutputHandler implements IRecipeHandler<CondenserOutput>
|
|||||||
this.iconButtonSingularity = guiHelper.createDrawable( statesLocation, 32, 112, 14, 14, 28, 0, 78, 0 );
|
this.iconButtonSingularity = guiHelper.createDrawable( statesLocation, 32, 112, 14, 14, 28, 0, 78, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<CondenserOutput> getRecipeClass()
|
|
||||||
{
|
|
||||||
return CondenserOutput.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid( CondenserOutput recipe )
|
|
||||||
{
|
|
||||||
return CondenserCategory.UID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper( CondenserOutput recipe )
|
public IRecipeWrapper getRecipeWrapper( CondenserOutput recipe )
|
||||||
{
|
{
|
||||||
@@ -74,18 +62,4 @@ class CondenserOutputHandler implements IRecipeHandler<CondenserOutput>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRecipeValid( CondenserOutput recipe )
|
|
||||||
{
|
|
||||||
switch( recipe )
|
|
||||||
{
|
|
||||||
case MATTER_BALLS:
|
|
||||||
return this.matterBall != null;
|
|
||||||
case SINGULARITY:
|
|
||||||
return this.singularity != null;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -33,12 +34,11 @@ import net.minecraftforge.fml.client.config.HoverChecker;
|
|||||||
|
|
||||||
import mezz.jei.api.gui.IDrawable;
|
import mezz.jei.api.gui.IDrawable;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
|
||||||
|
|
||||||
import appeng.api.config.CondenserOutput;
|
import appeng.api.config.CondenserOutput;
|
||||||
|
|
||||||
|
|
||||||
class CondenserOutputWrapper extends BlankRecipeWrapper
|
class CondenserOutputWrapper implements IRecipeWrapper
|
||||||
{
|
{
|
||||||
private final ItemStack outputItem;
|
private final ItemStack outputItem;
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,13 @@ import java.util.List;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
|
||||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts as a fake facade recipe wrapper, created by {@link FacadeRegistryPlugin}.
|
* Acts as a fake facade recipe wrapper, created by {@link FacadeRegistryPlugin}.
|
||||||
*/
|
*/
|
||||||
class FacadeRecipeWrapper extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper
|
class FacadeRecipeWrapper implements IShapedCraftingRecipeWrapper
|
||||||
{
|
{
|
||||||
|
|
||||||
private final ItemStack textureItem;
|
private final ItemStack textureItem;
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
|
import mezz.jei.api.IJeiHelpers;
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategory;
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
@@ -27,12 +30,11 @@ import mezz.jei.api.gui.IDrawable;
|
|||||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
|
||||||
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
|
|
||||||
class GrinderRecipeCategory extends BlankRecipeCategory<GrinderRecipeWrapper>
|
class GrinderRecipeCategory implements IRecipeCategory<GrinderRecipeWrapper>, IRecipeCategoryRegistration
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final String UID = "appliedenergistics2.grinder";
|
public static final String UID = "appliedenergistics2.grinder";
|
||||||
@@ -85,4 +87,14 @@ class GrinderRecipeCategory extends BlankRecipeCategory<GrinderRecipeWrapper>
|
|||||||
|
|
||||||
itemStacks.set( ingredients );
|
itemStacks.set( ingredients );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public void addRecipeCategories( IRecipeCategory... recipeCategories )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public IJeiHelpers getJeiHelpers()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,36 +19,16 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import appeng.api.features.IGrinderRecipe;
|
import appeng.api.features.IGrinderRecipe;
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||||
|
|
||||||
|
|
||||||
class GrinderRecipeHandler implements IRecipeHandler<IGrinderRecipe>
|
class GrinderRecipeHandler implements IRecipeWrapperFactory<IGrinderRecipe>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<IGrinderRecipe> getRecipeClass()
|
|
||||||
{
|
|
||||||
return IGrinderRecipe.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid( IGrinderRecipe recipe )
|
|
||||||
{
|
|
||||||
return GrinderRecipeCategory.UID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IRecipeWrapper getRecipeWrapper( IGrinderRecipe recipe )
|
public IRecipeWrapper getRecipeWrapper( IGrinderRecipe recipe )
|
||||||
{
|
{
|
||||||
return new GrinderRecipeWrapper( recipe );
|
return new GrinderRecipeWrapper( recipe );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRecipeValid( IGrinderRecipe recipe )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,18 +23,18 @@ import java.awt.Color;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
|
||||||
|
|
||||||
import appeng.api.features.IGrinderRecipe;
|
import appeng.api.features.IGrinderRecipe;
|
||||||
|
|
||||||
|
|
||||||
class GrinderRecipeWrapper extends BlankRecipeWrapper
|
class GrinderRecipeWrapper implements IRecipeWrapper
|
||||||
{
|
{
|
||||||
|
|
||||||
private final IGrinderRecipe recipe;
|
private final IGrinderRecipe recipe;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategory;
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@@ -30,12 +32,11 @@ import mezz.jei.api.gui.IDrawableStatic;
|
|||||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
|
||||||
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
|
|
||||||
class InscriberRecipeCategory extends BlankRecipeCategory<InscriberRecipeWrapper>
|
class InscriberRecipeCategory implements IRecipeCategory<InscriberRecipeWrapper>
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final int SLOT_INPUT_TOP = 0;
|
private static final int SLOT_INPUT_TOP = 0;
|
||||||
|
|||||||
@@ -19,37 +19,18 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import appeng.api.features.IInscriberRecipe;
|
import appeng.api.features.IInscriberRecipe;
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||||
|
|
||||||
|
|
||||||
class InscriberRecipeHandler implements IRecipeHandler<IInscriberRecipe>
|
class InscriberRecipeHandler implements IRecipeWrapperFactory<IInscriberRecipe>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<IInscriberRecipe> getRecipeClass()
|
|
||||||
{
|
|
||||||
return IInscriberRecipe.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid( IInscriberRecipe recipe )
|
|
||||||
{
|
|
||||||
return InscriberRecipeCategory.UID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper( IInscriberRecipe recipe )
|
public IRecipeWrapper getRecipeWrapper( IInscriberRecipe recipe )
|
||||||
{
|
{
|
||||||
return new InscriberRecipeWrapper( recipe );
|
return new InscriberRecipeWrapper( recipe );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRecipeValid( IInscriberRecipe recipe )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
|
||||||
|
|
||||||
import appeng.api.features.IInscriberRecipe;
|
import appeng.api.features.IInscriberRecipe;
|
||||||
|
|
||||||
|
|
||||||
class InscriberRecipeWrapper extends BlankRecipeWrapper
|
class InscriberRecipeWrapper implements IRecipeWrapper
|
||||||
{
|
{
|
||||||
|
|
||||||
private final IInscriberRecipe recipe;
|
private final IInscriberRecipe recipe;
|
||||||
|
|||||||
@@ -23,16 +23,19 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import appeng.integration.Integrations;
|
import appeng.api.features.IGrinderRecipe;
|
||||||
|
import appeng.recipes.game.ShapedRecipe;
|
||||||
|
import appeng.recipes.game.ShapelessRecipe;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import mezz.jei.api.BlankModPlugin;
|
|
||||||
import mezz.jei.api.IJeiRuntime;
|
import mezz.jei.api.IJeiRuntime;
|
||||||
|
import mezz.jei.api.IModPlugin;
|
||||||
import mezz.jei.api.IModRegistry;
|
import mezz.jei.api.IModRegistry;
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
@@ -46,17 +49,27 @@ import appeng.container.implementations.ContainerPatternTerm;
|
|||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.integration.Integrations;
|
||||||
import appeng.items.parts.ItemFacade;
|
import appeng.items.parts.ItemFacade;
|
||||||
|
|
||||||
|
|
||||||
@mezz.jei.api.JEIPlugin
|
@mezz.jei.api.JEIPlugin
|
||||||
public class JEIPlugin extends BlankModPlugin
|
public class JEIPlugin implements IModPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerCategories( IRecipeCategoryRegistration registry )
|
||||||
|
{
|
||||||
|
registry.addRecipeCategories( new GrinderRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
||||||
|
registry.addRecipeCategories( new CondenserCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
||||||
|
registry.addRecipeCategories( new InscriberRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register( IModRegistry registry )
|
public void register( IModRegistry registry )
|
||||||
{
|
{
|
||||||
registry.addRecipeHandlers( new ShapedRecipeHandler(), new ShapelessRecipeHandler() );
|
registry.handleRecipes( ShapedRecipe.class, new ShapedRecipeHandler(), VanillaRecipeCategoryUid.CRAFTING );
|
||||||
|
registry.handleRecipes( ShapelessRecipe.class, new ShapelessRecipeHandler(), VanillaRecipeCategoryUid.CRAFTING );
|
||||||
|
|
||||||
IDefinitions definitions = AEApi.instance().definitions();
|
IDefinitions definitions = AEApi.instance().definitions();
|
||||||
|
|
||||||
@@ -120,7 +133,7 @@ public class JEIPlugin extends BlankModPlugin
|
|||||||
|
|
||||||
private void addDescription( IModRegistry registry, IItemDefinition itemDefinition, String message )
|
private void addDescription( IModRegistry registry, IItemDefinition itemDefinition, String message )
|
||||||
{
|
{
|
||||||
itemDefinition.maybeStack( 1 ).ifPresent( itemStack -> registry.addDescription( itemStack, message ) );
|
itemDefinition.maybeStack( 1 ).ifPresent( itemStack -> registry.addIngredientInfo( itemStack, ItemStack.class, message ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerGrinderRecipes( IDefinitions definitions, IModRegistry registry )
|
private void registerGrinderRecipes( IDefinitions definitions, IModRegistry registry )
|
||||||
@@ -133,10 +146,9 @@ public class JEIPlugin extends BlankModPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
registry.addRecipes( Lists.newArrayList( AEApi.instance().registries().grinder().getRecipes() ) );
|
registry.handleRecipes( IGrinderRecipe.class, new GrinderRecipeHandler(), GrinderRecipeCategory.UID );
|
||||||
registry.addRecipeHandlers( new GrinderRecipeHandler() );
|
registry.addRecipes( Lists.newArrayList( AEApi.instance().registries().grinder().getRecipes() ), GrinderRecipeCategory.UID );
|
||||||
registry.addRecipeCategories( new GrinderRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
registry.addRecipeCatalyst( grindstone, GrinderRecipeCategory.UID );
|
||||||
registry.addRecipeCategoryCraftingItem( grindstone, GrinderRecipeCategory.UID );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCondenserRecipes( IDefinitions definitions, IModRegistry registry )
|
private void registerCondenserRecipes( IDefinitions definitions, IModRegistry registry )
|
||||||
@@ -151,38 +163,34 @@ public class JEIPlugin extends BlankModPlugin
|
|||||||
ItemStack matterBall = definitions.materials().matterBall().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
ItemStack matterBall = definitions.materials().matterBall().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
if( !matterBall.isEmpty() )
|
if( !matterBall.isEmpty() )
|
||||||
{
|
{
|
||||||
registry.addRecipes( ImmutableList.of( CondenserOutput.MATTER_BALLS ) );
|
registry.addRecipes( ImmutableList.of( CondenserOutput.MATTER_BALLS ), CondenserCategory.UID );
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack singularity = definitions.materials().singularity().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
ItemStack singularity = definitions.materials().singularity().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||||
if( !singularity.isEmpty() )
|
if( !singularity.isEmpty() )
|
||||||
{
|
{
|
||||||
registry.addRecipes( ImmutableList.of( CondenserOutput.SINGULARITY ) );
|
registry.addRecipes( ImmutableList.of( CondenserOutput.SINGULARITY ), CondenserCategory.UID );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !matterBall.isEmpty() || !singularity.isEmpty() )
|
if( !matterBall.isEmpty() || !singularity.isEmpty() )
|
||||||
{
|
{
|
||||||
registry.addRecipeCategories( new CondenserCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
registry.addRecipeCatalyst( condenser, CondenserCategory.UID );
|
||||||
registry.addRecipeCategoryCraftingItem( condenser, CondenserCategory.UID );
|
registry.handleRecipes( CondenserOutput.class, new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity) , CondenserCategory.UID );
|
||||||
registry.addRecipeHandlers( new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerInscriberRecipes( IDefinitions definitions, IModRegistry registry )
|
private void registerInscriberRecipes( IDefinitions definitions, IModRegistry registry )
|
||||||
{
|
{
|
||||||
|
registry.handleRecipes( IInscriberRecipe.class, new InscriberRecipeHandler(), InscriberRecipeCategory.UID );
|
||||||
registry.addRecipeHandlers( new InscriberRecipeHandler() );
|
|
||||||
|
|
||||||
registry.addRecipeCategories( new InscriberRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
|
||||||
|
|
||||||
// Register the inscriber as the crafting item for the inscription category
|
// Register the inscriber as the crafting item for the inscription category
|
||||||
definitions.blocks().inscriber().maybeStack( 1 ).ifPresent( inscriber ->
|
definitions.blocks().inscriber().maybeStack( 1 ).ifPresent( inscriber ->
|
||||||
{
|
{
|
||||||
registry.addRecipeCategoryCraftingItem( inscriber, InscriberRecipeCategory.UID );
|
registry.addRecipeCatalyst( inscriber, InscriberRecipeCategory.UID );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
List<IInscriberRecipe> inscriberRecipes = new ArrayList<>( AEApi.instance().registries().inscriber().getRecipes() );
|
List<IInscriberRecipe> inscriberRecipes = new ArrayList<>( AEApi.instance().registries().inscriber().getRecipes() );
|
||||||
registry.addRecipes( inscriberRecipes );
|
registry.addRecipes( inscriberRecipes, InscriberRecipeCategory.UID );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the generic crafting recipe for patterns in JEI
|
// Handle the generic crafting recipe for patterns in JEI
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ class JeiRuntimeAdapter implements IJEI
|
|||||||
@Override
|
@Override
|
||||||
public String getSearchText()
|
public String getSearchText()
|
||||||
{
|
{
|
||||||
return Strings.nullToEmpty( this.runtime.getItemListOverlay().getFilterText() );
|
return Strings.nullToEmpty( this.runtime.getIngredientFilter().getFilterText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSearchText( String searchText )
|
public void setSearchText( String searchText )
|
||||||
{
|
{
|
||||||
this.runtime.getItemListOverlay().setFilterText( Strings.nullToEmpty( searchText ) );
|
this.runtime.getIngredientFilter().setFilterText( Strings.nullToEmpty( searchText ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,37 +19,17 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||||
|
|
||||||
import appeng.recipes.game.ShapedRecipe;
|
import appeng.recipes.game.ShapedRecipe;
|
||||||
|
|
||||||
|
|
||||||
class ShapedRecipeHandler implements IRecipeHandler<ShapedRecipe>
|
class ShapedRecipeHandler implements IRecipeWrapperFactory<ShapedRecipe>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<ShapedRecipe> getRecipeClass()
|
|
||||||
{
|
|
||||||
return ShapedRecipe.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid( ShapedRecipe recipe )
|
|
||||||
{
|
|
||||||
return VanillaRecipeCategoryUid.CRAFTING;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper( ShapedRecipe recipe )
|
public IRecipeWrapper getRecipeWrapper( ShapedRecipe recipe )
|
||||||
{
|
{
|
||||||
return new ShapedRecipeWrapper( recipe );
|
return new ShapedRecipeWrapper( recipe );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRecipeValid( ShapedRecipe recipe )
|
|
||||||
{
|
|
||||||
return recipe.isEnabled();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import java.util.List;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
|
||||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||||
import scala.actors.threadpool.Arrays;
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ import appeng.recipes.game.ShapedRecipe;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
class ShapedRecipeWrapper extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper
|
class ShapedRecipeWrapper implements IShapedCraftingRecipeWrapper
|
||||||
{
|
{
|
||||||
|
|
||||||
private final ShapedRecipe recipe;
|
private final ShapedRecipe recipe;
|
||||||
|
|||||||
@@ -19,37 +19,17 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
import mezz.jei.api.recipe.IRecipeHandler;
|
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||||
|
|
||||||
import appeng.recipes.game.ShapelessRecipe;
|
import appeng.recipes.game.ShapelessRecipe;
|
||||||
|
|
||||||
|
|
||||||
class ShapelessRecipeHandler implements IRecipeHandler<ShapelessRecipe>
|
class ShapelessRecipeHandler implements IRecipeWrapperFactory<ShapelessRecipe>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<ShapelessRecipe> getRecipeClass()
|
|
||||||
{
|
|
||||||
return ShapelessRecipe.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid( ShapelessRecipe recipe )
|
|
||||||
{
|
|
||||||
return VanillaRecipeCategoryUid.CRAFTING;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper( ShapelessRecipe recipe )
|
public IRecipeWrapper getRecipeWrapper( ShapelessRecipe recipe )
|
||||||
{
|
{
|
||||||
return new ShapelessRecipeWrapper( recipe );
|
return new ShapelessRecipeWrapper( recipe );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRecipeValid( ShapelessRecipe recipe )
|
|
||||||
{
|
|
||||||
return recipe.isEnabled();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,10 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
|
||||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
|
||||||
|
|
||||||
import appeng.api.exceptions.MissingIngredientError;
|
import appeng.api.exceptions.MissingIngredientError;
|
||||||
import appeng.api.exceptions.RegistrationError;
|
import appeng.api.exceptions.RegistrationError;
|
||||||
@@ -36,7 +35,7 @@ import appeng.api.recipes.IIngredient;
|
|||||||
import appeng.recipes.game.ShapelessRecipe;
|
import appeng.recipes.game.ShapelessRecipe;
|
||||||
|
|
||||||
|
|
||||||
class ShapelessRecipeWrapper extends BlankRecipeWrapper implements ICraftingRecipeWrapper
|
class ShapelessRecipeWrapper implements IRecipeWrapper
|
||||||
{
|
{
|
||||||
|
|
||||||
private final ShapelessRecipe recipe;
|
private final ShapelessRecipe recipe;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import mcjty.theoneprobe.api.ProbeMode;
|
|||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.integration.modules.theoneprobe.TheOneProbeText;
|
import appeng.integration.modules.theoneprobe.TheOneProbeText;
|
||||||
import appeng.parts.networking.PartCableSmart;
|
import appeng.parts.networking.PartCableSmart;
|
||||||
import appeng.parts.networking.PartDenseCable;
|
import appeng.parts.networking.PartDenseCableSmart;
|
||||||
|
|
||||||
|
|
||||||
public class ChannelInfoProvider implements IPartProbInfoProvider
|
public class ChannelInfoProvider implements IPartProbInfoProvider
|
||||||
@@ -40,10 +40,10 @@ public class ChannelInfoProvider implements IPartProbInfoProvider
|
|||||||
@Override
|
@Override
|
||||||
public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
|
public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
|
||||||
{
|
{
|
||||||
if( part instanceof PartDenseCable || part instanceof PartCableSmart )
|
if( part instanceof PartDenseCableSmart || part instanceof PartCableSmart )
|
||||||
{
|
{
|
||||||
final int usedChannels;
|
final int usedChannels;
|
||||||
final int maxChannels = ( part instanceof PartDenseCable ) ? 32 : 8;
|
final int maxChannels = ( part instanceof PartDenseCableSmart ) ? 32 : 8;
|
||||||
|
|
||||||
if( part.getGridNode().isActive() )
|
if( part.getGridNode().isActive() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
|
|||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.core.localization.WailaText;
|
import appeng.core.localization.WailaText;
|
||||||
import appeng.parts.networking.PartCableSmart;
|
import appeng.parts.networking.PartCableSmart;
|
||||||
import appeng.parts.networking.PartDenseCable;
|
import appeng.parts.networking.PartDenseCableSmart;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +75,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||||
{
|
{
|
||||||
if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
if( part instanceof PartCableSmart || part instanceof PartDenseCableSmart )
|
||||||
{
|
{
|
||||||
final NBTTagCompound tag = accessor.getNBTData();
|
final NBTTagCompound tag = accessor.getNBTData();
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
|||||||
|
|
||||||
if( usedChannels >= 0 )
|
if( usedChannels >= 0 )
|
||||||
{
|
{
|
||||||
final byte maxChannels = (byte) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
final byte maxChannels = (byte) ( ( part instanceof PartDenseCableSmart ) ? 32 : 8 );
|
||||||
|
|
||||||
final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels );
|
final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels );
|
||||||
currentToolTip.add( formattedToolTip );
|
currentToolTip.add( formattedToolTip );
|
||||||
@@ -144,7 +144,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
|||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||||
{
|
{
|
||||||
if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
if( part instanceof PartCableSmart || part instanceof PartDenseCableSmart )
|
||||||
{
|
{
|
||||||
final NBTTagCompound tempTag = new NBTTagCompound();
|
final NBTTagCompound tempTag = new NBTTagCompound();
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
|
|||||||
@Override
|
@Override
|
||||||
public void saveChanges()
|
public void saveChanges()
|
||||||
{
|
{
|
||||||
inv.markDirty( -1 );
|
this.inv.markDirty( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,7 +92,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
|
|||||||
|
|
||||||
public IItemHandler getInternalInventory()
|
public IItemHandler getInternalInventory()
|
||||||
{
|
{
|
||||||
return inv;
|
return this.inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
|||||||
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.target ) ) );
|
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.target ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt ) );
|
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt, Actionable.MODULATE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -343,7 +343,16 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
|||||||
@Override
|
@Override
|
||||||
public int compare( final Entry<Integer, PartTypeWithVariant> o1, final Entry<Integer, PartTypeWithVariant> o2 )
|
public int compare( final Entry<Integer, PartTypeWithVariant> o1, final Entry<Integer, PartTypeWithVariant> o2 )
|
||||||
{
|
{
|
||||||
return o1.getValue().part.name().compareTo( o2.getValue().part.name() );
|
final String string1 = o1.getValue().part.name();
|
||||||
|
final String string2 = o2.getValue().part.name();
|
||||||
|
final int comparedString = string1.compareTo( string2 );
|
||||||
|
|
||||||
|
if( comparedString == 0 )
|
||||||
|
{
|
||||||
|
return Integer.compare( o1.getKey(), o2.getKey() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return comparedString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ import appeng.parts.misc.PartToggleBus;
|
|||||||
import appeng.parts.networking.PartCableCovered;
|
import appeng.parts.networking.PartCableCovered;
|
||||||
import appeng.parts.networking.PartCableGlass;
|
import appeng.parts.networking.PartCableGlass;
|
||||||
import appeng.parts.networking.PartCableSmart;
|
import appeng.parts.networking.PartCableSmart;
|
||||||
import appeng.parts.networking.PartDenseCable;
|
import appeng.parts.networking.PartDenseCableCovered;
|
||||||
|
import appeng.parts.networking.PartDenseCableSmart;
|
||||||
import appeng.parts.networking.PartQuartzFiber;
|
import appeng.parts.networking.PartQuartzFiber;
|
||||||
import appeng.parts.p2p.PartP2PFEPower;
|
import appeng.parts.p2p.PartP2PFEPower;
|
||||||
import appeng.parts.p2p.PartP2PFluids;
|
import appeng.parts.p2p.PartP2PFluids;
|
||||||
import appeng.parts.p2p.PartP2PIC2Power;
|
import appeng.parts.p2p.PartP2PIC2Power;
|
||||||
import appeng.parts.p2p.PartP2PItems;
|
import appeng.parts.p2p.PartP2PItems;
|
||||||
import appeng.parts.p2p.PartP2PLight;
|
import appeng.parts.p2p.PartP2PLight;
|
||||||
import appeng.parts.p2p.PartP2PRFPower;
|
|
||||||
import appeng.parts.p2p.PartP2PRedstone;
|
import appeng.parts.p2p.PartP2PRedstone;
|
||||||
import appeng.parts.p2p.PartP2PTunnelME;
|
import appeng.parts.p2p.PartP2PTunnelME;
|
||||||
import appeng.parts.reporting.PartConversionMonitor;
|
import appeng.parts.reporting.PartConversionMonitor;
|
||||||
@@ -138,7 +138,26 @@ public enum PartType
|
|||||||
},
|
},
|
||||||
|
|
||||||
CABLE_DENSE_SMART( 60, "cable_dense_smart", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
CABLE_DENSE_SMART( 60, "cable_dense_smart", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||||
.noneOf( IntegrationType.class ), PartDenseCable.class )
|
.noneOf( IntegrationType.class ), PartDenseCableSmart.class )
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean isCable()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
|
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||||
|
{
|
||||||
|
return Arrays.stream( AEColor.values() )
|
||||||
|
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||||
|
.collect( Collectors.toList() );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
CABLE_DENSE_COVERED( 500, "cable_dense_covered", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||||
|
.noneOf( IntegrationType.class ), PartDenseCableCovered.class )
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean isCable()
|
public boolean isCable()
|
||||||
@@ -250,16 +269,6 @@ public enum PartType
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
P2P_TUNNEL_RF( 466, "p2p_tunnel_rf", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_RF ), EnumSet
|
|
||||||
.of( IntegrationType.RF ), PartP2PRFPower.class, GuiText.RFTunnel )
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
String getUnlocalizedName()
|
|
||||||
{
|
|
||||||
return "p2p_tunnel";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -146,11 +146,14 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
|||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz )
|
public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz )
|
||||||
{
|
{
|
||||||
if( player.isSneaking() && !w.isRemote )
|
if( player.isSneaking() )
|
||||||
{
|
{
|
||||||
final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem();
|
if( !w.isRemote )
|
||||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
{
|
||||||
player.getHeldItem( hand ).setTagCompound( null );
|
final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem();
|
||||||
|
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||||
|
player.getHeldItem( hand ).setTagCompound( null );
|
||||||
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.packets.PacketLightning;
|
import appeng.core.sync.packets.PacketLightning;
|
||||||
@@ -44,7 +45,7 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
|||||||
{
|
{
|
||||||
if( this.getAECurrentPower( item ) > 300 )
|
if( this.getAECurrentPower( item ) > 300 )
|
||||||
{
|
{
|
||||||
this.extractAEPower( item, 300 );
|
this.extractAEPower( item, 300, Actionable.MODULATE );
|
||||||
if( Platform.isServer() )
|
if( Platform.isServer() )
|
||||||
{
|
{
|
||||||
for( int x = 0; x < 2; x++ )
|
for( int x = 0; x < 2; x++ )
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
if( ( (IColorableTile) te ).recolourBlock( side, AEColor.TRANSPARENT, p ) )
|
if( ( (IColorableTile) te ).recolourBlock( side, AEColor.TRANSPARENT, p ) )
|
||||||
{
|
{
|
||||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||||
this.extractAEPower( is, powerPerUse );
|
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
|
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
|
||||||
{
|
{
|
||||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||||
this.extractAEPower( is, powerPerUse );
|
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
|
||||||
( (TilePaint) painted ).cleanSide( side.getOpposite() );
|
( (TilePaint) painted ).cleanSide( side.getOpposite() );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
if( color != AEColor.TRANSPARENT && this.recolourBlock( blk, side, w, pos, side, color, p ) )
|
if( color != AEColor.TRANSPARENT && this.recolourBlock( blk, side, w, pos, side, color, p ) )
|
||||||
{
|
{
|
||||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||||
this.extractAEPower( is, powerPerUse );
|
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.util.DimensionalCoord;
|
import appeng.api.util.DimensionalCoord;
|
||||||
import appeng.block.misc.BlockTinyTNT;
|
import appeng.block.misc.BlockTinyTNT;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
@@ -204,7 +205,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
{
|
{
|
||||||
if( this.getAECurrentPower( item ) > 1600 )
|
if( this.getAECurrentPower( item ) > 1600 )
|
||||||
{
|
{
|
||||||
this.extractAEPower( item, 1600 );
|
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||||
target.setFire( 8 );
|
target.setFire( 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +262,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
{
|
{
|
||||||
if( this.canCool( state ) )
|
if( this.canCool( state ) )
|
||||||
{
|
{
|
||||||
this.extractAEPower( item, 1600 );
|
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||||
this.cool( state, w, pos );
|
this.cool( state, w, pos );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -284,7 +285,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
|
|
||||||
if( this.canHeat( state ) )
|
if( this.canHeat( state ) )
|
||||||
{
|
{
|
||||||
this.extractAEPower( item, 1600 );
|
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||||
this.heat( state, w, pos );
|
this.heat( state, w, pos );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -320,7 +321,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
|
|
||||||
if( hasFurnaceable && canFurnaceable )
|
if( hasFurnaceable && canFurnaceable )
|
||||||
{
|
{
|
||||||
this.extractAEPower( item, 1600 );
|
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||||
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
|
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
|
||||||
w.playSound( p, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F,
|
w.playSound( p, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F,
|
||||||
itemRand.nextFloat() * 0.4F + 0.8F );
|
itemRand.nextFloat() * 0.4F + 0.8F );
|
||||||
@@ -353,7 +354,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
|
|
||||||
if( w.isAirBlock( offsetPos ) )
|
if( w.isAirBlock( offsetPos ) )
|
||||||
{
|
{
|
||||||
this.extractAEPower( item, 1600 );
|
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||||
w.playSound( p, offsetPos.getX() + 0.5D, offsetPos.getY() + 0.5D, offsetPos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE,
|
w.playSound( p, offsetPos.getX() + 0.5D, offsetPos.getY() + 0.5D, offsetPos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE,
|
||||||
SoundCategory.PLAYERS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
SoundCategory.PLAYERS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
||||||
w.setBlockState( offsetPos, Blocks.FIRE.getDefaultState() );
|
w.setBlockState( offsetPos, Blocks.FIRE.getDefaultState() );
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
|
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
|
||||||
for( int sh = 0; sh < shots; sh++ )
|
for( int sh = 0; sh < shots; sh++ )
|
||||||
{
|
{
|
||||||
this.extractAEPower( p.getHeldItem( hand ), 1600 );
|
this.extractAEPower( p.getHeldItem( hand ), 1600, Actionable.MODULATE );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.SortDir;
|
import appeng.api.config.SortDir;
|
||||||
import appeng.api.config.SortOrder;
|
import appeng.api.config.SortOrder;
|
||||||
@@ -108,7 +109,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
|||||||
@Override
|
@Override
|
||||||
public boolean usePower( final EntityPlayer player, final double amount, final ItemStack is )
|
public boolean usePower( final EntityPlayer player, final double amount, final ItemStack is )
|
||||||
{
|
{
|
||||||
return this.extractAEPower( is, amount ) >= amount - 0.5;
|
return this.extractAEPower( is, amount, Actionable.MODULATE ) >= amount - 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||||
*
|
*
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
@@ -19,12 +19,164 @@
|
|||||||
package appeng.items.tools.powered.powersink;
|
package appeng.items.tools.powered.powersink;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEBasePoweredItem extends RedstoneFlux
|
import java.text.MessageFormat;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerUnits;
|
||||||
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.items.AEBaseItem;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPowerStorage
|
||||||
{
|
{
|
||||||
|
private static final String CURRENT_POWER_NBT_KEY = "internalCurrentPower";
|
||||||
|
private static final String MAX_POWER_NBT_KEY = "internalMaxPower";
|
||||||
|
private final double powerCapacity;
|
||||||
|
|
||||||
public AEBasePoweredItem( final double powerCapacity )
|
public AEBasePoweredItem( final double powerCapacity )
|
||||||
{
|
{
|
||||||
super( powerCapacity );
|
|
||||||
|
|
||||||
this.setMaxStackSize( 1 );
|
this.setMaxStackSize( 1 );
|
||||||
|
this.setMaxDamage( 32 );
|
||||||
|
this.hasSubtypes = false;
|
||||||
|
this.setFull3D();
|
||||||
|
|
||||||
|
this.powerCapacity = powerCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
|
@Override
|
||||||
|
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||||
|
{
|
||||||
|
final NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
double internalCurrentPower = 0;
|
||||||
|
final double internalMaxPower = this.getAEMaxPower( stack );
|
||||||
|
|
||||||
|
if( tag != null )
|
||||||
|
{
|
||||||
|
internalCurrentPower = tag.getDouble( CURRENT_POWER_NBT_KEY );
|
||||||
|
}
|
||||||
|
|
||||||
|
final double percent = internalCurrentPower / internalMaxPower;
|
||||||
|
|
||||||
|
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
||||||
|
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamageable()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||||
|
{
|
||||||
|
super.getCheckedSubItems( creativeTab, itemStacks );
|
||||||
|
|
||||||
|
final ItemStack charged = new ItemStack( this, 1 );
|
||||||
|
final NBTTagCompound tag = Platform.openNbtData( charged );
|
||||||
|
tag.setDouble( CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
|
||||||
|
tag.setDouble( MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
|
||||||
|
|
||||||
|
itemStacks.add( charged );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRepairable()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDurabilityForDisplay( final ItemStack is )
|
||||||
|
{
|
||||||
|
return 1 - this.getAECurrentPower( is ) / this.getAEMaxPower( is );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDamaged( final ItemStack stack )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDamage( final ItemStack stack, final int damage )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double injectAEPower( final ItemStack is, final double amount, Actionable mode )
|
||||||
|
{
|
||||||
|
final double maxStorage = this.getAEMaxPower( is );
|
||||||
|
final double currentStorage = this.getAECurrentPower( is );
|
||||||
|
final double required = maxStorage - currentStorage;
|
||||||
|
final double overflow = amount - required;
|
||||||
|
|
||||||
|
if( mode == Actionable.MODULATE )
|
||||||
|
{
|
||||||
|
final NBTTagCompound data = Platform.openNbtData( is );
|
||||||
|
final double toAdd = Math.min( amount, required );
|
||||||
|
|
||||||
|
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage + toAdd );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.max( 0, overflow );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double extractAEPower( final ItemStack is, final double amount, Actionable mode )
|
||||||
|
{
|
||||||
|
final double currentStorage = this.getAECurrentPower( is );
|
||||||
|
final double fulfillable = Math.min( amount, currentStorage );
|
||||||
|
|
||||||
|
if( mode == Actionable.MODULATE )
|
||||||
|
{
|
||||||
|
final NBTTagCompound data = Platform.openNbtData( is );
|
||||||
|
|
||||||
|
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage - fulfillable );
|
||||||
|
}
|
||||||
|
|
||||||
|
return fulfillable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getAEMaxPower( final ItemStack is )
|
||||||
|
{
|
||||||
|
return this.powerCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getAECurrentPower( final ItemStack is )
|
||||||
|
{
|
||||||
|
final NBTTagCompound data = Platform.openNbtData( is );
|
||||||
|
|
||||||
|
return data.getDouble( CURRENT_POWER_NBT_KEY );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessRestriction getPowerFlow( final ItemStack is )
|
||||||
|
{
|
||||||
|
return AccessRestriction.WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICapabilityProvider initCapabilities( ItemStack stack, NBTTagCompound nbt )
|
||||||
|
{
|
||||||
|
return new PoweredItemCapabilities( stack, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,215 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Applied Energistics 2.
|
|
||||||
* Copyright (c) 2013 - 2015, 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.items.tools.powered.powersink;
|
|
||||||
|
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import appeng.items.AEBaseItem;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
|
|
||||||
{
|
|
||||||
private static final String POWER_NBT_KEY = "internalCurrentPower";
|
|
||||||
private final double powerCapacity;
|
|
||||||
|
|
||||||
public AERootPoweredItem( final double powerCapacity )
|
|
||||||
{
|
|
||||||
this.setMaxDamage( 32 );
|
|
||||||
this.hasSubtypes = false;
|
|
||||||
this.setFull3D();
|
|
||||||
|
|
||||||
this.powerCapacity = powerCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
|
||||||
@Override
|
|
||||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
|
||||||
{
|
|
||||||
final NBTTagCompound tag = stack.getTagCompound();
|
|
||||||
double internalCurrentPower = 0;
|
|
||||||
final double internalMaxPower = this.getAEMaxPower( stack );
|
|
||||||
|
|
||||||
if( tag != null )
|
|
||||||
{
|
|
||||||
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
|
||||||
}
|
|
||||||
|
|
||||||
final double percent = internalCurrentPower / internalMaxPower;
|
|
||||||
|
|
||||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
|
||||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDamageable()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
|
||||||
{
|
|
||||||
super.getCheckedSubItems( creativeTab, itemStacks );
|
|
||||||
|
|
||||||
final ItemStack charged = new ItemStack( this, 1 );
|
|
||||||
final NBTTagCompound tag = Platform.openNbtData( charged );
|
|
||||||
tag.setDouble( "internalCurrentPower", this.getAEMaxPower( charged ) );
|
|
||||||
tag.setDouble( "internalMaxPower", this.getAEMaxPower( charged ) );
|
|
||||||
|
|
||||||
itemStacks.add( charged );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRepairable()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getDurabilityForDisplay( final ItemStack is )
|
|
||||||
{
|
|
||||||
return 1 - this.getAECurrentPower( is ) / this.getAEMaxPower( is );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDamaged( final ItemStack stack )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDamage( final ItemStack stack, final int damage )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getInternalBattery( final ItemStack is, final batteryOperation op, final double adjustment )
|
|
||||||
{
|
|
||||||
final NBTTagCompound data = Platform.openNbtData( is );
|
|
||||||
|
|
||||||
double currentStorage = data.getDouble( POWER_NBT_KEY );
|
|
||||||
final double maxStorage = this.getAEMaxPower( is );
|
|
||||||
|
|
||||||
switch( op )
|
|
||||||
{
|
|
||||||
case INJECT:
|
|
||||||
currentStorage += adjustment;
|
|
||||||
if( currentStorage > maxStorage )
|
|
||||||
{
|
|
||||||
final double diff = currentStorage - maxStorage;
|
|
||||||
data.setDouble( POWER_NBT_KEY, maxStorage );
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
data.setDouble( POWER_NBT_KEY, currentStorage );
|
|
||||||
return 0;
|
|
||||||
case EXTRACT:
|
|
||||||
if( currentStorage > adjustment )
|
|
||||||
{
|
|
||||||
currentStorage -= adjustment;
|
|
||||||
data.setDouble( POWER_NBT_KEY, currentStorage );
|
|
||||||
return adjustment;
|
|
||||||
}
|
|
||||||
data.setDouble( POWER_NBT_KEY, 0 );
|
|
||||||
return currentStorage;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return currentStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inject power into this item using an external unit.
|
|
||||||
*/
|
|
||||||
double injectExternalPower( PowerUnits inputUnit, final ItemStack is, final double amount, final boolean simulate )
|
|
||||||
{
|
|
||||||
if( simulate )
|
|
||||||
{
|
|
||||||
final int requiredExt = (int) PowerUnits.AE.convertTo( inputUnit, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
|
||||||
if( amount < requiredExt )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return amount - requiredExt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final double powerRemainder = this.injectAEPower( is, inputUnit.convertTo( PowerUnits.AE, amount ) );
|
|
||||||
return PowerUnits.AE.convertTo( inputUnit, powerRemainder );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double injectAEPower( final ItemStack is, final double amt )
|
|
||||||
{
|
|
||||||
return this.getInternalBattery( is, batteryOperation.INJECT, amt );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double extractAEPower( final ItemStack is, final double amt )
|
|
||||||
{
|
|
||||||
return this.getInternalBattery( is, batteryOperation.EXTRACT, amt );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getAEMaxPower( final ItemStack is )
|
|
||||||
{
|
|
||||||
return this.powerCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getAECurrentPower( final ItemStack is )
|
|
||||||
{
|
|
||||||
return this.getInternalBattery( is, batteryOperation.STORAGE, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AccessRestriction getPowerFlow( final ItemStack is )
|
|
||||||
{
|
|
||||||
return AccessRestriction.WRITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ICapabilityProvider initCapabilities( ItemStack stack, NBTTagCompound nbt )
|
|
||||||
{
|
|
||||||
return new PoweredItemCapabilities( stack, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum batteryOperation
|
|
||||||
{
|
|
||||||
STORAGE, INJECT, EXTRACT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,126 +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.items.tools.powered.powersink;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// import net.minecraft.entity.EntityLivingBase;
|
|
||||||
// import net.minecraft.item.ItemStack;
|
|
||||||
//
|
|
||||||
// import ic2.api.item.IElectricItemManager;
|
|
||||||
// import ic2.api.item.ISpecialElectricItem;
|
|
||||||
//
|
|
||||||
// import appeng.api.config.PowerUnits;
|
|
||||||
// import appeng.coremod.annotations.Integration.Interface;
|
|
||||||
// import appeng.coremod.annotations.Integration.InterfaceList;
|
|
||||||
// import appeng.coremod.annotations.Integration.Method;
|
|
||||||
// import appeng.integration.IntegrationType;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @InterfaceList( value = {
|
|
||||||
// @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
|
|
||||||
// @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
|
|
||||||
// } )
|
|
||||||
// public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
|
||||||
// {
|
|
||||||
// public IC2( double powerCapacity )
|
|
||||||
// {
|
|
||||||
// super( powerCapacity );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
|
||||||
// {
|
|
||||||
// double addedAmt = amount;
|
|
||||||
// double limit = this.getTransferLimit( is );
|
|
||||||
//
|
|
||||||
// if( !ignoreTransferLimit && amount > limit )
|
|
||||||
// {
|
|
||||||
// addedAmt = limit;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean
|
|
||||||
/// externally, boolean simulate )
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public double getCharge( ItemStack is )
|
|
||||||
// {
|
|
||||||
// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean canUse( ItemStack is, double amount )
|
|
||||||
// {
|
|
||||||
// return this.getCharge( is ) > amount;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
|
||||||
// {
|
|
||||||
// if( this.canUse( is, amount ) )
|
|
||||||
// {
|
|
||||||
// // use the power..
|
|
||||||
// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
|
||||||
// {
|
|
||||||
// // wtf?
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getToolTip( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public double getMaxCharge( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public int getTier( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return 1;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private double getTransferLimit( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// @Method( iname = IntegrationType.IC2 )
|
|
||||||
// public IElectricItemManager getManager( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -29,6 +29,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
|||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
import appeng.capabilities.Capabilities;
|
import appeng.capabilities.Capabilities;
|
||||||
@@ -96,7 +97,7 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final double powerRemainder = this.item.injectAEPower( this.is, PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ) );
|
final double powerRemainder = this.item.injectAEPower( this.is, PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ), Actionable.MODULATE );
|
||||||
return maxReceive - (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
|
return maxReceive - (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +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.items.tools.powered.powersink;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import cofh.redstoneflux.api.IEnergyContainerItem;
|
|
||||||
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.coremod.annotations.Integration.Interface;
|
|
||||||
import appeng.integration.IntegrationType;
|
|
||||||
|
|
||||||
|
|
||||||
@Interface( iface = "cofh.redstoneflux.api.IEnergyContainerItem", iname = IntegrationType.RFItem )
|
|
||||||
public abstract class RedstoneFlux extends AERootPoweredItem implements IEnergyContainerItem
|
|
||||||
{
|
|
||||||
public RedstoneFlux( final double powerCapacity )
|
|
||||||
{
|
|
||||||
super( powerCapacity );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int receiveEnergy( final ItemStack is, final int maxReceive, final boolean simulate )
|
|
||||||
{
|
|
||||||
return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int extractEnergy( final ItemStack container, final int maxExtract, final boolean simulate )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnergyStored( final ItemStack is )
|
|
||||||
{
|
|
||||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxEnergyStored( final ItemStack is )
|
|
||||||
{
|
|
||||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1179,7 +1179,8 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
TileEntity adjacentTe = this.getTile().getWorld().getTileEntity( adjacentPos );
|
TileEntity adjacentTe = this.getTile().getWorld().getTileEntity( adjacentPos );
|
||||||
if( adjacentTe instanceof IGridHost )
|
if( adjacentTe instanceof IGridHost )
|
||||||
{
|
{
|
||||||
if( !( adjacentTe instanceof IPartHost ) || cable.getCableConnectionType() == AECableType.DENSE_SMART )
|
if( !( adjacentTe instanceof IPartHost ) || cable.getCableConnectionType() == AECableType.DENSE_SMART || cable
|
||||||
|
.getCableConnectionType() == AECableType.DENSE_COVERED )
|
||||||
{
|
{
|
||||||
IGridHost gridHost = (IGridHost) adjacentTe;
|
IGridHost gridHost = (IGridHost) adjacentTe;
|
||||||
connectionType = gridHost.getCableConnectionType( AEPartLocation.fromFacing( facing.getOpposite() ) );
|
connectionType = gridHost.getCableConnectionType( AEPartLocation.fromFacing( facing.getOpposite() ) );
|
||||||
|
|||||||
@@ -349,10 +349,9 @@ public class PartPlacement
|
|||||||
if( !player.capabilities.isCreativeMode )
|
if( !player.capabilities.isCreativeMode )
|
||||||
{
|
{
|
||||||
held.grow( -1 );
|
held.grow( -1 );
|
||||||
;
|
|
||||||
if( held.getCount() == 0 )
|
if( held.getCount() == 0 )
|
||||||
{
|
{
|
||||||
player.inventory.mainInventory.set( player.inventory.currentItem, ItemStack.EMPTY );
|
player.setHeldItem( hand, ItemStack.EMPTY );
|
||||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) );
|
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
is.setCount( (int) this.itemToSend );
|
is.setCount( (int) this.itemToSend );
|
||||||
|
|
||||||
final ItemStack o = d.simulateAdd( is );
|
final ItemStack o = d.simulateAdd( is );
|
||||||
final long canFit = o == null ? this.itemToSend : this.itemToSend - o.getCount();
|
final long canFit = o.isEmpty() ? this.itemToSend : this.itemToSend - o.getCount();
|
||||||
|
|
||||||
if( canFit > 0 )
|
if( canFit > 0 )
|
||||||
{
|
{
|
||||||
@@ -321,7 +321,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
this.itemToSend -= itemsToAdd.getStackSize();
|
this.itemToSend -= itemsToAdd.getStackSize();
|
||||||
|
|
||||||
final ItemStack failed = d.addItems( itemsToAdd.getItemStack() );
|
final ItemStack failed = d.addItems( itemsToAdd.getItemStack() );
|
||||||
if( failed != null )
|
if( !failed.isEmpty() )
|
||||||
{
|
{
|
||||||
ais.setStackSize( failed.getCount() );
|
ais.setStackSize( failed.getCount() );
|
||||||
inv.injectItems( ais, Actionable.MODULATE, this.mySrc );
|
inv.injectItems( ais, Actionable.MODULATE, this.mySrc );
|
||||||
|
|||||||
@@ -80,16 +80,13 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
|||||||
@Override
|
@Override
|
||||||
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
|
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
|
||||||
{
|
{
|
||||||
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
|
this.updateState();
|
||||||
|
if( this.lastRedstone != this.getHost().hasRedstone( this.getSide() ) )
|
||||||
{
|
{
|
||||||
this.updateState();
|
this.lastRedstone = !this.lastRedstone;
|
||||||
if( this.lastRedstone != this.getHost().hasRedstone( this.getSide() ) )
|
if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
|
||||||
{
|
{
|
||||||
this.lastRedstone = !this.lastRedstone;
|
this.doBusWork();
|
||||||
if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
|
|
||||||
{
|
|
||||||
this.doBusWork();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
|
|||||||
{
|
{
|
||||||
super( is );
|
super( is );
|
||||||
this.upgrades = new StackUpgradeInventory( this.getItemStack(), this, this.getUpgradeSlots() );
|
this.upgrades = new StackUpgradeInventory( this.getItemStack(), this, this.getUpgradeSlots() );
|
||||||
this.upgrades.setMaxStackSize( 1 );
|
|
||||||
this.manager = new ConfigManager( this );
|
this.manager = new ConfigManager( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
|
|||||||
final Upgrades u = ( (IUpgradeModule) it ).getType( itemstack );
|
final Upgrades u = ( (IUpgradeModule) it ).getType( itemstack );
|
||||||
if( u != null )
|
if( u != null )
|
||||||
{
|
{
|
||||||
return getInstalledUpgrades( u ) < getMaxInstalled( u );
|
return UpgradeInventory.this.getInstalledUpgrades( u ) < UpgradeInventory.this.getMaxInstalled( u );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,95 +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.parts.layers;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
|
|
||||||
import cofh.redstoneflux.api.IEnergyConnection;
|
|
||||||
import cofh.redstoneflux.api.IEnergyHandler;
|
|
||||||
import cofh.redstoneflux.api.IEnergyProvider;
|
|
||||||
import cofh.redstoneflux.api.IEnergyReceiver;
|
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.LayerBase;
|
|
||||||
|
|
||||||
|
|
||||||
public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler, IEnergyReceiver, IEnergyProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int receiveEnergy( EnumFacing from, int maxReceive, boolean simulate )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( from );
|
|
||||||
if( part instanceof IEnergyReceiver )
|
|
||||||
{
|
|
||||||
return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int extractEnergy( EnumFacing from, int maxExtract, boolean simulate )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( from );
|
|
||||||
if( part instanceof IEnergyProvider )
|
|
||||||
{
|
|
||||||
return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnergyStored( EnumFacing from )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( from );
|
|
||||||
if( part instanceof IEnergyProvider )
|
|
||||||
{
|
|
||||||
return ( (IEnergyProvider) part ).getEnergyStored( from );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxEnergyStored( EnumFacing from )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( from );
|
|
||||||
if( part instanceof IEnergyProvider )
|
|
||||||
{
|
|
||||||
return ( (IEnergyProvider) part ).getMaxEnergyStored( from );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canConnectEnergy( EnumFacing from )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( from );
|
|
||||||
if( part instanceof IEnergyConnection )
|
|
||||||
{
|
|
||||||
return ( (IEnergyConnection) part ).canConnectEnergy( from );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,204 +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.parts.layers;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
|
|
||||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
|
||||||
import ic2.api.energy.tile.IEnergyEmitter;
|
|
||||||
import ic2.api.energy.tile.IEnergySink;
|
|
||||||
import ic2.api.energy.tile.IEnergyTile;
|
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.IPartHost;
|
|
||||||
import appeng.api.parts.LayerBase;
|
|
||||||
import appeng.api.parts.LayerFlags;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
|
|
||||||
public class LayerIEnergySink extends LayerBase implements IEnergySink
|
|
||||||
{
|
|
||||||
|
|
||||||
private TileEntity getEnergySinkTile()
|
|
||||||
{
|
|
||||||
IPartHost host = (IPartHost) this;
|
|
||||||
return host.getTile();
|
|
||||||
}
|
|
||||||
|
|
||||||
private World getEnergySinkWorld()
|
|
||||||
{
|
|
||||||
if( this.getEnergySinkTile() == null )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getEnergySinkTile().getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isTileValid()
|
|
||||||
{
|
|
||||||
TileEntity te = this.getEnergySinkTile();
|
|
||||||
|
|
||||||
if( te == null )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !te.isInvalid() && te.getWorld().isBlockLoaded( te.getPos() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addToENet()
|
|
||||||
{
|
|
||||||
if( this.getEnergySinkWorld() == null )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-add
|
|
||||||
this.removeFromENet();
|
|
||||||
|
|
||||||
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
|
||||||
{
|
|
||||||
this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
|
||||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeFromENet()
|
|
||||||
{
|
|
||||||
if( this.getEnergySinkWorld() == null )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this.isInIC2() && Platform.isServer() )
|
|
||||||
{
|
|
||||||
this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
|
||||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean interestedInIC2()
|
|
||||||
{
|
|
||||||
if( !( (IPartHost) this ).isInWorld() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int interested = 0;
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergyTile )
|
|
||||||
{
|
|
||||||
interested++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return interested == 1;// if more then one tile is interested we need to abandon...
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void partChanged()
|
|
||||||
{
|
|
||||||
super.partChanged();
|
|
||||||
|
|
||||||
if( this.interestedInIC2() )
|
|
||||||
{
|
|
||||||
this.addToENet();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.removeFromENet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction )
|
|
||||||
{
|
|
||||||
if( !this.isInIC2() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPart part = this.getPart( direction );
|
|
||||||
if( part instanceof IEnergySink )
|
|
||||||
{
|
|
||||||
return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction );
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isInIC2()
|
|
||||||
{
|
|
||||||
return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getDemandedEnergy()
|
|
||||||
{
|
|
||||||
if( !this.isInIC2() )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
|
||||||
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergySink )
|
|
||||||
{
|
|
||||||
// use lower number cause ic2 deletes power it sends that isn't received.
|
|
||||||
return ( (IEnergySink) part ).getDemandedEnergy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSinkTier()
|
|
||||||
{
|
|
||||||
return Integer.MAX_VALUE; // no real options here...
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
|
||||||
{
|
|
||||||
if( !this.isInIC2() )
|
|
||||||
{
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergySink )
|
|
||||||
{
|
|
||||||
return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,205 +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.parts.layers;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
|
|
||||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
|
||||||
import ic2.api.energy.tile.IEnergyEmitter;
|
|
||||||
import ic2.api.energy.tile.IEnergySource;
|
|
||||||
import ic2.api.energy.tile.IEnergyTile;
|
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.IPartHost;
|
|
||||||
import appeng.api.parts.LayerBase;
|
|
||||||
import appeng.api.parts.LayerFlags;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
|
|
||||||
public class LayerIEnergySource extends LayerBase implements IEnergySource
|
|
||||||
{
|
|
||||||
|
|
||||||
private TileEntity getEnergySourceTile()
|
|
||||||
{
|
|
||||||
IPartHost host = (IPartHost) this;
|
|
||||||
return host.getTile();
|
|
||||||
}
|
|
||||||
|
|
||||||
private World getEnergySourceWorld()
|
|
||||||
{
|
|
||||||
if( this.getEnergySourceTile() == null )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.getEnergySourceTile().getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isTileValid()
|
|
||||||
{
|
|
||||||
TileEntity te = this.getEnergySourceTile();
|
|
||||||
return te != null && !te.isInvalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addToENet()
|
|
||||||
{
|
|
||||||
if( this.getEnergySourceWorld() == null )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-add
|
|
||||||
this.removeFromENet();
|
|
||||||
|
|
||||||
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
|
||||||
{
|
|
||||||
this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
|
||||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeFromENet()
|
|
||||||
{
|
|
||||||
if( this.getEnergySourceWorld() == null )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this.isInIC2() && Platform.isServer() )
|
|
||||||
{
|
|
||||||
this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
|
||||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean interestedInIC2()
|
|
||||||
{
|
|
||||||
if( !( (IPartHost) this ).isInWorld() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int interested = 0;
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergyTile )
|
|
||||||
{
|
|
||||||
interested++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return interested == 1;// if more then one tile is interested we need to abandon...
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void partChanged()
|
|
||||||
{
|
|
||||||
super.partChanged();
|
|
||||||
|
|
||||||
if( this.interestedInIC2() )
|
|
||||||
{
|
|
||||||
this.addToENet();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.removeFromENet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction )
|
|
||||||
{
|
|
||||||
if( !this.isInIC2() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPart part = this.getPart( direction );
|
|
||||||
if( part instanceof IEnergyEmitter )
|
|
||||||
{
|
|
||||||
return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction );
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isInIC2()
|
|
||||||
{
|
|
||||||
return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getOfferedEnergy()
|
|
||||||
{
|
|
||||||
if( !this.isInIC2() )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
|
||||||
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergySource )
|
|
||||||
{
|
|
||||||
// use lower number cause ic2 deletes power it sends that isn't received.
|
|
||||||
return ( (IEnergySource) part ).getOfferedEnergy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawEnergy( double amount )
|
|
||||||
{
|
|
||||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
|
||||||
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergySource )
|
|
||||||
{
|
|
||||||
( (IEnergySource) part ).drawEnergy( amount );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSourceTier()
|
|
||||||
{
|
|
||||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
|
||||||
|
|
||||||
for( EnumFacing dir : EnumFacing.values() )
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( dir );
|
|
||||||
if( part instanceof IEnergySource )
|
|
||||||
{
|
|
||||||
return ( (IEnergySource) part ).getSourceTier();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -409,16 +409,21 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final EnumFacing targetSide = this.getSide().getFacing().getOpposite();
|
final EnumFacing targetSide = this.getSide().getFacing().getOpposite();
|
||||||
|
|
||||||
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) )
|
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final IItemHandler itemHandler = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
final IItemHandler itemHandler = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
||||||
if( handler != null )
|
|
||||||
|
if( itemHandler != null )
|
||||||
{
|
{
|
||||||
return Objects.hash( target, itemHandler, itemHandler.getSlots() );
|
return Objects.hash( target, itemHandler, itemHandler.getSlots() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +439,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
this.cached = true;
|
this.cached = true;
|
||||||
final TileEntity self = this.getHost().getTile();
|
final TileEntity self = this.getHost().getTile();
|
||||||
final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
|
final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
|
||||||
final int newHandlerHash = createHandlerHash( target );
|
final int newHandlerHash = this.createHandlerHash( target );
|
||||||
|
|
||||||
if( newHandlerHash != 0 && newHandlerHash == this.handlerHash )
|
if( newHandlerHash != 0 && newHandlerHash == this.handlerHash )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,9 +128,13 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
{
|
{
|
||||||
newPart = parts.cableSmart().stack( newColor, 1 );
|
newPart = parts.cableSmart().stack( newColor, 1 );
|
||||||
}
|
}
|
||||||
|
else if( this.getCableConnectionType() == AECableType.DENSE_COVERED )
|
||||||
|
{
|
||||||
|
newPart = parts.cableDenseCovered().stack( newColor, 1 );
|
||||||
|
}
|
||||||
else if( this.getCableConnectionType() == AECableType.DENSE_SMART )
|
else if( this.getCableConnectionType() == AECableType.DENSE_SMART )
|
||||||
{
|
{
|
||||||
newPart = parts.cableDense().stack( newColor, 1 );
|
newPart = parts.cableDenseSmart().stack( newColor, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasPermission = true;
|
boolean hasPermission = true;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import appeng.helpers.Reflected;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class PartDenseCable extends PartCable
|
public abstract class PartDenseCable extends PartCable
|
||||||
{
|
{
|
||||||
@Reflected
|
@Reflected
|
||||||
public PartDenseCable( final ItemStack is )
|
public PartDenseCable( final ItemStack is )
|
||||||
@@ -52,12 +52,6 @@ public class PartDenseCable extends PartCable
|
|||||||
return BusSupport.DENSE_CABLE;
|
return BusSupport.DENSE_CABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AECableType getCableConnectionType()
|
|
||||||
{
|
|
||||||
return AECableType.DENSE_SMART;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getBoxes( final IPartCollisionHelper bch )
|
public void getBoxes( final IPartCollisionHelper bch )
|
||||||
{
|
{
|
||||||
@@ -135,25 +129,16 @@ public class PartDenseCable extends PartCable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSmart( final AEPartLocation of )
|
|
||||||
{
|
|
||||||
final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( of.getFacing() ) );
|
|
||||||
if( te instanceof IGridHost )
|
|
||||||
{
|
|
||||||
final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
|
|
||||||
return t == AECableType.SMART;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isDense( final AEPartLocation of )
|
private boolean isDense( final AEPartLocation of )
|
||||||
{
|
{
|
||||||
final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( of.getFacing() ) );
|
final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( of.getFacing() ) );
|
||||||
|
|
||||||
if( te instanceof IGridHost )
|
if( te instanceof IGridHost )
|
||||||
{
|
{
|
||||||
final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
|
final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
|
||||||
return t == AECableType.DENSE_SMART;
|
return t == AECableType.DENSE_COVERED || t == AECableType.DENSE_SMART;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user