Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 548af3c6cc | |||
| 98b9380494 | |||
| bbf4d4a9ce | |||
| 1513ba3f6a | |||
| f03f8ec432 | |||
| e1dcd588b7 | |||
| 8338a7d13e | |||
| b8e685b1b6 | |||
| d84500c5b7 | |||
| a1679c944b | |||
| a3a39201d1 | |||
| d788da687e | |||
| 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
|
||||
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
|
||||
group = aegroup
|
||||
archivesBaseName = aebasename
|
||||
@@ -52,7 +58,6 @@ archivesBaseName = aebasename
|
||||
// Add Coremod Manifest
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
||||
attributes 'FMLAT': 'appeng_at.cfg'
|
||||
}
|
||||
|
||||
@@ -68,8 +73,6 @@ jar {
|
||||
}
|
||||
|
||||
minecraft {
|
||||
coreMod = "appeng.coremod.AppEngCore"
|
||||
|
||||
version = minecraft_version + "-" + forge_version
|
||||
|
||||
replaceIn "AEConfig.java"
|
||||
|
||||
+7
-2
@@ -21,6 +21,11 @@ hwyla_version=1.8.19-B33_1.12
|
||||
#########################################################
|
||||
jei_version=4.7.1.69
|
||||
tesla_version=1.0.61
|
||||
ic2_version=2.8.7-ex112
|
||||
rf_version=2.0.0.1
|
||||
ic2_version=2.8.9-ex112
|
||||
top_version=1.12-1.4.8-2
|
||||
|
||||
#########################################################
|
||||
# Deployment #
|
||||
#########################################################
|
||||
website_version=1.12.x
|
||||
curse_versions=1.12,1.12.1
|
||||
|
||||
@@ -78,8 +78,7 @@ dependencies {
|
||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
|
||||
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
deobfCompile "cofh:RedstoneFlux:${minecraft_version}-${rf_version}:universal"
|
||||
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
|
||||
// at runtime, use the full JEI jar
|
||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
|
||||
@@ -28,7 +28,6 @@ public enum TunnelType
|
||||
{
|
||||
ME, // Network Tunnel
|
||||
IC2_POWER, // EU Tunnel
|
||||
RF_POWER, // RF Tunnel
|
||||
FE_POWER, // Forge Energy tunnel
|
||||
REDSTONE, // Redstone Tunnel
|
||||
FLUID, // Fluid Tunnel
|
||||
|
||||
@@ -38,7 +38,9 @@ public interface IParts
|
||||
|
||||
AEColoredItemDefinition cableGlass();
|
||||
|
||||
AEColoredItemDefinition cableDense();
|
||||
AEColoredItemDefinition cableDenseCovered();
|
||||
|
||||
AEColoredItemDefinition cableDenseSmart();
|
||||
|
||||
AEColoredItemDefinition lumenCableSmart();
|
||||
|
||||
@@ -46,7 +48,7 @@ public interface IParts
|
||||
|
||||
AEColoredItemDefinition lumenCableGlass();
|
||||
|
||||
AEColoredItemDefinition lumenCableDense();
|
||||
AEColoredItemDefinition lumenDenseCableSmart();
|
||||
|
||||
IItemDefinition quartzFiber();
|
||||
|
||||
@@ -80,8 +82,6 @@ public interface IParts
|
||||
|
||||
IItemDefinition p2PTunnelEU();
|
||||
|
||||
IItemDefinition p2PTunnelRF();
|
||||
|
||||
IItemDefinition p2PTunnelFE();
|
||||
|
||||
IItemDefinition p2PTunnelLight();
|
||||
|
||||
@@ -27,6 +27,7 @@ package appeng.api.implementations.items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
|
||||
|
||||
@@ -42,27 +43,27 @@ public interface IAEItemPowerStorage
|
||||
*
|
||||
* @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
|
||||
* return it.
|
||||
*
|
||||
* @param amt to be extracted power from device
|
||||
* @param amount to be extracted power from device
|
||||
*
|
||||
* @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 )
|
||||
*/
|
||||
double getAEMaxPower( ItemStack is );
|
||||
double getAEMaxPower( ItemStack stack );
|
||||
|
||||
/**
|
||||
* @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
|
||||
@@ -70,5 +71,5 @@ public interface IAEItemPowerStorage
|
||||
*
|
||||
* @return access restriction of network
|
||||
*/
|
||||
AccessRestriction getPowerFlow( ItemStack is );
|
||||
AccessRestriction getPowerFlow( ItemStack stack );
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.TransitionResult;
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.api.util.WorldCoord;
|
||||
|
||||
|
||||
@@ -57,7 +58,7 @@ public interface ISpatialStorageCell
|
||||
*
|
||||
* @return the world for this cell
|
||||
*/
|
||||
World getWorld( ItemStack is );
|
||||
ISpatialDimension getSpatialDimension();
|
||||
|
||||
/**
|
||||
* get the currently stored size.
|
||||
@@ -69,22 +70,13 @@ public interface ISpatialStorageCell
|
||||
WorldCoord getStoredSize( ItemStack is );
|
||||
|
||||
/**
|
||||
* Minimum coordinates in its world for the storage cell.
|
||||
* get the currently stored Dimension id.
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
*
|
||||
* @return minimum coordinate of dimension
|
||||
* @return dimension id or -1
|
||||
*/
|
||||
WorldCoord getMin( ItemStack is );
|
||||
|
||||
/**
|
||||
* Maximum coordinates in its world for the storage cell.
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
*
|
||||
* @return maximum coordinate of dimension
|
||||
*/
|
||||
WorldCoord getMax( ItemStack is );
|
||||
int getStoredDimensionID( ItemStack is );
|
||||
|
||||
/**
|
||||
* Perform a spatial swap with the contents of the cell, and the world.
|
||||
@@ -93,9 +85,9 @@ public interface ISpatialStorageCell
|
||||
* @param w world of spatial
|
||||
* @param min min coord
|
||||
* @param max max coord
|
||||
* @param doTransition transition
|
||||
* @param playerId owner of current grid or -1
|
||||
*
|
||||
* @return result of transition
|
||||
*/
|
||||
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition );
|
||||
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, int playerId );
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -37,15 +38,30 @@ public interface IEnergyGridProvider
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
||||
Collection<IEnergyGridProvider> providers();
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
||||
double extractProviderPower( double amt, Actionable mode, Set<IEnergyGridProvider> seen );
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double getEnergyDemand( double d, Set<IEnergyGrid> seen );
|
||||
double injectProviderPower( double amt, Actionable mode, Set<IEnergyGridProvider> seen );
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double getProviderEnergyDemand( double d, Set<IEnergyGridProvider> seen );
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double getProviderStoredEnergy();
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double getProviderMaxEnergy();
|
||||
}
|
||||
|
||||
+16
-14
@@ -16,24 +16,26 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.rf;
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
/**
|
||||
* @author GuntherDW
|
||||
*/
|
||||
public class RFModule implements IIntegrationModule
|
||||
public interface ISpatialDimension
|
||||
{
|
||||
public RFModule()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class );
|
||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyProvider.class );
|
||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyConnection.class );
|
||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class );
|
||||
}
|
||||
World getWorld();
|
||||
|
||||
int createNewCellDimension( BlockPos contentSize, int playerId );
|
||||
|
||||
void deleteCellDimension( int cellDimId );
|
||||
|
||||
boolean isCellDimension( int cellDimID );
|
||||
|
||||
int getCellDimensionOwner( int cellDimId );
|
||||
|
||||
BlockPos getCellDimensionOrigin( int cellDimId );
|
||||
|
||||
BlockPos getCellContentSize( int cellDimId );
|
||||
}
|
||||
@@ -46,6 +46,11 @@ public enum AECableType
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -55,6 +60,7 @@ public enum AECableType
|
||||
GLASS,
|
||||
COVERED,
|
||||
SMART,
|
||||
DENSE_COVERED,
|
||||
DENSE_SMART
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ 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.definitions.IBlockDefinition;
|
||||
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 ) );
|
||||
}
|
||||
|
||||
private double getMaxEnergyCapacity()
|
||||
@Override
|
||||
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
|
||||
{
|
||||
final Block blockID = Block.getBlockFromItem( this );
|
||||
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
||||
return energyCell.maybeBlock().map( block ->
|
||||
final double internalCurrentPower = this.getInternal( is );
|
||||
final double internalMaxPower = this.getAEMaxPower( is );
|
||||
final double required = internalMaxPower - internalCurrentPower;
|
||||
final double overflow = Math.max( 0, amount - required );
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
if( blockID == block )
|
||||
{
|
||||
return 200000;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 8 * 200000;
|
||||
}
|
||||
} ).orElse( 0 );
|
||||
final double toAdd = Math.min( required, amount );
|
||||
final double newPowerStored = internalCurrentPower + toAdd;
|
||||
|
||||
this.setInternal( is, newPowerStored );
|
||||
}
|
||||
|
||||
return overflow;
|
||||
}
|
||||
|
||||
@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 internalMaxPower = this.getMaxEnergyCapacity();
|
||||
internalCurrentPower += amt;
|
||||
if( internalCurrentPower > internalMaxPower )
|
||||
final double internalCurrentPower = this.getInternal( is );
|
||||
final double fulfillable = Math.min( amount, internalCurrentPower );
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
amt = internalCurrentPower - internalMaxPower;
|
||||
internalCurrentPower = internalMaxPower;
|
||||
this.setInternal( is, internalCurrentPower );
|
||||
return amt;
|
||||
final double newPowerStored = internalCurrentPower - fulfillable;
|
||||
|
||||
this.setInternal( is, newPowerStored );
|
||||
}
|
||||
|
||||
this.setInternal( is, internalCurrentPower );
|
||||
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;
|
||||
return fulfillable;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,4 +119,34 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
||||
{
|
||||
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
|
||||
// combined layers
|
||||
this.setTileEntity( TileCableBus.class );
|
||||
this.useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -42,11 +42,13 @@ import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.Registration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockDefinition;
|
||||
@@ -65,13 +67,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
private final Supplier<? extends Block> blockSupplier;
|
||||
|
||||
private final List<BiConsumer<Block, Item>> preInitCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> initCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> modelRegCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> postInitCallbacks = new ArrayList<>();
|
||||
private final List<BiFunction<Block, Item, IBootstrapComponent>> bootstrapComponents = new ArrayList<>();
|
||||
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||
|
||||
@@ -103,30 +99,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder preInit( BiConsumer<Block, Item> callback )
|
||||
public BlockDefinitionBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> callback )
|
||||
{
|
||||
this.preInitCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder init( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.initCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder modelRegInit( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.modelRegCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder postInit( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.postInitCallbacks.add( callback );
|
||||
this.bootstrapComponents.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -221,22 +196,16 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
|
||||
// Register the item and block with the game
|
||||
this.factory.addPreInit( side ->
|
||||
this.factory.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( block ) );
|
||||
if( item != null )
|
||||
{
|
||||
Registration.addBlockToRegister( block );
|
||||
if( item != null )
|
||||
{
|
||||
Registration.addItemToRegister( item );
|
||||
}
|
||||
} );
|
||||
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) );
|
||||
}
|
||||
|
||||
block.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( block, item ) ) );
|
||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( block, item ) ) );
|
||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( block, item ) ) );
|
||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( block, item ) ) );
|
||||
this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) );
|
||||
|
||||
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
||||
{
|
||||
@@ -268,7 +237,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
this.factory.addPreInit( side ->
|
||||
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
|
||||
{
|
||||
AEBaseTile.registerTileItem(
|
||||
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
||||
|
||||
@@ -110,13 +110,13 @@ class BlockRendering implements IBlockRendering
|
||||
|
||||
if( this.modelCustomizer != null )
|
||||
{
|
||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
}
|
||||
else if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||
// extended props
|
||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
}
|
||||
|
||||
// TODO : 1.12
|
||||
|
||||
@@ -20,10 +20,18 @@ package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -33,10 +41,6 @@ import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||
import appeng.bootstrap.components.TileEntityComponent;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -51,10 +55,10 @@ public class FeatureFactory
|
||||
|
||||
private final AEFeature[] defaultFeatures;
|
||||
|
||||
private final List<IBootstrapComponent> bootstrapComponents;
|
||||
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
ModelOverrideComponent modelOverrideComponent;
|
||||
private ModelOverrideComponent modelOverrideComponent;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
private BuiltInModelComponent builtInModelComponent;
|
||||
@@ -64,18 +68,18 @@ public class FeatureFactory
|
||||
public FeatureFactory()
|
||||
{
|
||||
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
||||
this.bootstrapComponents = new ArrayList<>();
|
||||
this.bootstrapComponents = new HashMap<>();
|
||||
|
||||
this.tileEntityComponent = new TileEntityComponent();
|
||||
this.bootstrapComponents.add( this.tileEntityComponent );
|
||||
this.addBootstrapComponent( this.tileEntityComponent );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
||||
this.bootstrapComponents.add( this.modelOverrideComponent );
|
||||
this.addBootstrapComponent( this.modelOverrideComponent );
|
||||
|
||||
this.builtInModelComponent = new BuiltInModelComponent();
|
||||
this.bootstrapComponents.add( this.builtInModelComponent );
|
||||
this.addBootstrapComponent( this.builtInModelComponent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,29 +127,16 @@ public class FeatureFactory
|
||||
return new FeatureFactory( this, features );
|
||||
}
|
||||
|
||||
void addBootstrapComponent( IBootstrapComponent component )
|
||||
public void addBootstrapComponent( IBootstrapComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
Arrays.stream( component.getClass().getInterfaces() )
|
||||
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )
|
||||
.forEach( i -> this.addBootstrapComponent( (Class<? extends IBootstrapComponent>) i, component ) );
|
||||
}
|
||||
|
||||
void addPreInit( IPreInitComponent component )
|
||||
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addInit( IInitComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addModelReg( IModelRegistrationComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addPostInit( IPostInitComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@@ -154,8 +145,14 @@ public class FeatureFactory
|
||||
this.builtInModelComponent.addModel( path, model );
|
||||
}
|
||||
|
||||
public List<IBootstrapComponent> getBootstrapComponents()
|
||||
@SideOnly( Side.CLIENT )
|
||||
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
{
|
||||
return this.bootstrapComponents;
|
||||
this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||
}
|
||||
|
||||
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||
{
|
||||
return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -33,14 +33,7 @@ import appeng.core.features.AEFeature;
|
||||
|
||||
public interface IBlockBuilder
|
||||
{
|
||||
|
||||
IBlockBuilder preInit( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder init( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder modelRegInit( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder postInit( BiConsumer<Block, Item> callback );
|
||||
IBlockBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> component );
|
||||
|
||||
IBlockBuilder features( AEFeature... features );
|
||||
|
||||
|
||||
@@ -19,28 +19,10 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
||||
* See the individual subclasses for a specific forge initalization event.
|
||||
*/
|
||||
public interface IBootstrapComponent
|
||||
{
|
||||
|
||||
default void preInitialize( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
}
|
||||
|
||||
default void initialize( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void postInitialize( Side side )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -36,12 +36,7 @@ import appeng.core.features.ItemDefinition;
|
||||
*/
|
||||
public interface IItemBuilder
|
||||
{
|
||||
|
||||
IItemBuilder preInit( Consumer<Item> callback );
|
||||
|
||||
IItemBuilder init( Consumer<Item> callback );
|
||||
|
||||
IItemBuilder postInit( Consumer<Item> callback );
|
||||
IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component );
|
||||
|
||||
IItemBuilder features( AEFeature... features );
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
@@ -33,10 +33,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.Registration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
@@ -53,13 +54,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||
|
||||
private final List<Consumer<Item>> preInitCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> initCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> modelRegCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> postInitCallbacks = new ArrayList<>();
|
||||
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
|
||||
|
||||
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
||||
|
||||
@@ -80,23 +75,9 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder preInit( Consumer<Item> callback )
|
||||
public IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component )
|
||||
{
|
||||
this.preInitCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder init( Consumer<Item> callback )
|
||||
{
|
||||
this.initCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder postInit( Consumer<Item> callback )
|
||||
{
|
||||
this.postInitCallbacks.add( callback );
|
||||
this.boostrapComponents.add( component );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -163,22 +144,19 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
item.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( item ) ) );
|
||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( item ) ) );
|
||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( item ) ) );
|
||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( item ) ) );
|
||||
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
||||
|
||||
// Register custom dispenser behavior if requested
|
||||
if( this.dispenserBehaviorSupplier != null )
|
||||
{
|
||||
this.factory.addPostInit( side ->
|
||||
this.factory.addBootstrapComponent( (IPostInitComponent) side ->
|
||||
{
|
||||
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
||||
} );
|
||||
}
|
||||
|
||||
this.factory.addPreInit( side -> Registration.addItemToRegister( item ) );
|
||||
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, reg ) -> reg.register( item ) );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -187,4 +165,5 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
|
||||
Block block = ( (ItemBlock) item ).getBlock();
|
||||
|
||||
// We can only do this once the blocks are actually registered...
|
||||
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
|
||||
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||
resources.add( model );
|
||||
}
|
||||
|
||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||
}
|
||||
|
||||
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
|
||||
{
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||
}
|
||||
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
|
||||
else if( this.itemMeshDefinition != null )
|
||||
{
|
||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||
// case
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
else if( item instanceof ItemBlock )
|
||||
{
|
||||
// The default for block items is to register the block model
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
|
||||
if( this.itemColor != null )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IBlockRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void blockRegistration( Side side, IForgeRegistry<Block> blockRegistry );
|
||||
}
|
||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void initialize( Side side );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IItemRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void itemRegistration( Side side, IForgeRegistry<Item> itemRegistry );
|
||||
}
|
||||
@@ -32,8 +32,5 @@ import appeng.bootstrap.IModelRegistry;
|
||||
@FunctionalInterface
|
||||
public interface IModelRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void modelRegistration( Side side, IModelRegistry registry );
|
||||
|
||||
}
|
||||
|
||||
+6
-8
@@ -16,18 +16,16 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.tile;
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@Retention( RetentionPolicy.RUNTIME )
|
||||
public @interface TileEvent
|
||||
@FunctionalInterface
|
||||
public interface IOreDictComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
TileEventType value();
|
||||
void oreRegistration( Side side );
|
||||
}
|
||||
@@ -27,7 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IPostInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void postInitialize( Side side );
|
||||
}
|
||||
|
||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IPreInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void preInitialize( Side side );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void recipeRegistration( Side side, IForgeRegistry<IRecipe> recipeRegistry );
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
@@ -45,6 +46,8 @@ public final class Capabilities
|
||||
|
||||
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
|
||||
|
||||
public static Capability<ISpatialDimension> SPATIAL_DIMENSION;
|
||||
|
||||
public static Capability<ITeslaConsumer> TESLA_CONSUMER;
|
||||
|
||||
public static Capability<ITeslaHolder> TESLA_HOLDER;
|
||||
@@ -57,6 +60,7 @@ public final class Capabilities
|
||||
public static void register()
|
||||
{
|
||||
CapabilityManager.INSTANCE.register( IStorageMonitorableAccessor.class, createNullStorage(), NullMENetworkAccessor::new );
|
||||
CapabilityManager.INSTANCE.register( ISpatialDimension.class, createNullStorage(), NullSpatialDimension::new );
|
||||
}
|
||||
|
||||
@CapabilityInject( IStorageMonitorableAccessor.class )
|
||||
@@ -65,6 +69,12 @@ public final class Capabilities
|
||||
STORAGE_MONITORABLE_ACCESSOR = cap;
|
||||
}
|
||||
|
||||
@CapabilityInject( ISpatialDimension.class )
|
||||
private static void capISpatialDimensionRegistered( Capability<ISpatialDimension> cap )
|
||||
{
|
||||
SPATIAL_DIMENSION = cap;
|
||||
}
|
||||
|
||||
@CapabilityInject( ITeslaConsumer.class )
|
||||
private static void capITeslaConsumerRegistered( Capability<ITeslaConsumer> cap )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, 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.capabilities;
|
||||
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
|
||||
|
||||
class NullSpatialDimension implements ISpatialDimension
|
||||
{
|
||||
@Override
|
||||
public int createNewCellDimension( BlockPos size, int owner )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCellDimension( int cellStorageId )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCellDimensionOwner( int cellStorageId )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCellDimensionOrigin( int cellStorageId )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellDimension( int cellDimID )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCellContentSize( int cellDimId )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,6 @@ import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.coremod.MissingCoreMod;
|
||||
import appeng.entity.EntityFloatingItem;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
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 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void missingCoreMod()
|
||||
{
|
||||
throw new MissingCoreMod();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -78,12 +78,23 @@ public class GuiSpatialIOPort extends AEBaseGui
|
||||
this.fontRenderer.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21,
|
||||
4210752 );
|
||||
this.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 78,
|
||||
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 73,
|
||||
4210752 );
|
||||
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 88, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 83, 4210752 );
|
||||
|
||||
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
|
||||
|
||||
if( this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0 )
|
||||
{
|
||||
final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize + "x" + this.container.zSize;
|
||||
this.fontRenderer.drawString( text, 13, 93, 4210752 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSSInvalid.getLocal(), 13, 93, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,6 +101,9 @@ class CableBuilder
|
||||
case SMART:
|
||||
textureFolder = "parts/cable/smart/";
|
||||
break;
|
||||
case DENSE_COVERED:
|
||||
textureFolder = "parts/cable/dense_covered/";
|
||||
break;
|
||||
case DENSE_SMART:
|
||||
textureFolder = "parts/cable/dense_smart/";
|
||||
break;
|
||||
@@ -127,6 +130,7 @@ class CableBuilder
|
||||
case SMART:
|
||||
this.addCableCore( CableCoreType.COVERED, color, quadsOut );
|
||||
break;
|
||||
case DENSE_COVERED:
|
||||
case DENSE_SMART:
|
||||
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
||||
break;
|
||||
@@ -448,7 +452,31 @@ class CableBuilder
|
||||
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
|
||||
if( connectionType == AECableType.SMART )
|
||||
@@ -456,7 +484,7 @@ class CableBuilder
|
||||
this.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||
return;
|
||||
}
|
||||
else if( connectionType != AECableType.DENSE_SMART )
|
||||
else if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
|
||||
{
|
||||
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||
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 );
|
||||
|
||||
|
||||
@@ -164,6 +164,8 @@ public class CableBusBakedModel implements IBakedModel
|
||||
{
|
||||
case GLASS:
|
||||
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
||||
case DENSE_COVERED:
|
||||
return firstType == AECableType.DENSE_COVERED && secondType == AECableType.DENSE_COVERED;
|
||||
case DENSE_SMART:
|
||||
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
||||
}
|
||||
@@ -200,8 +202,11 @@ public class CableBusBakedModel implements IBakedModel
|
||||
case SMART:
|
||||
this.cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||
break;
|
||||
case DENSE_COVERED:
|
||||
this.cableBuilder.addStraightDenseCoveredConnection( facing, cableColor, quadsOut );
|
||||
break;
|
||||
case DENSE_SMART:
|
||||
this.cableBuilder.addStraightDenseConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||
this.cableBuilder.addStraightDenseSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -228,6 +233,7 @@ public class CableBusBakedModel implements IBakedModel
|
||||
case SMART:
|
||||
this.cableBuilder.addConstrainedSmartConnection( facing, cableColor, distance, channels, quadsOut );
|
||||
break;
|
||||
case DENSE_COVERED:
|
||||
case DENSE_SMART:
|
||||
// Dense cables do not render connections to parts since none can be attached
|
||||
break;
|
||||
@@ -253,8 +259,11 @@ public class CableBusBakedModel implements IBakedModel
|
||||
case SMART:
|
||||
this.cableBuilder.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||
break;
|
||||
case DENSE_COVERED:
|
||||
this.cableBuilder.addDenseCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||
break;
|
||||
case DENSE_SMART:
|
||||
this.cableBuilder.addDenseConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||
this.cableBuilder.addDenseSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public enum CableCoreType
|
||||
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
||||
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
||||
result.put( AECableType.SMART, CableCoreType.COVERED );
|
||||
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE_SMART );
|
||||
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
||||
|
||||
return ImmutableMap.copyOf( result );
|
||||
|
||||
@@ -828,11 +828,11 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( action == InventoryAction.MOVE_REGION )
|
||||
{
|
||||
final List<Slot> from = new LinkedList<>();
|
||||
final List<Slot> from = new ArrayList<>();
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
|
||||
@@ -46,6 +47,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
||||
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
|
||||
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
|
||||
private final SlotCraftingTerm outputSlot;
|
||||
private IRecipe currentRecipe;
|
||||
|
||||
public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
@@ -85,7 +87,21 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
||||
ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() );
|
||||
}
|
||||
|
||||
this.outputSlot.putStack( CraftingManager.findMatchingResult( ic, this.getPlayerInv().player.world ) );
|
||||
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, this.getPlayerInv().player.world ) )
|
||||
{
|
||||
this.currentRecipe = CraftingManager.findMatchingRecipe( ic, this.getPlayerInv().player.world );
|
||||
}
|
||||
|
||||
if( this.currentRecipe == null )
|
||||
{
|
||||
this.outputSlot.putStack( ItemStack.EMPTY );
|
||||
}
|
||||
else
|
||||
{
|
||||
final ItemStack craftingResult = this.currentRecipe.getCraftingResult( ic );
|
||||
|
||||
this.outputSlot.putStack( craftingResult );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,4 +131,9 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public IRecipe getCurrentRecipe()
|
||||
{
|
||||
return this.currentRecipe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,13 +135,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
{
|
||||
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
( ( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||
|
||||
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
( ( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
|
||||
@@ -391,7 +391,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].getItemStack() );
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
|
||||
final IRecipe r = CraftingManager.findMatchingRecipe( ic, p.world );
|
||||
|
||||
if( r == null )
|
||||
{
|
||||
@@ -413,7 +413,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
}
|
||||
}
|
||||
|
||||
final IRecipe rr = Platform.findMatchingRecipe( real, p.world );
|
||||
final IRecipe rr = CraftingManager.findMatchingRecipe( real, p.world );
|
||||
|
||||
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
||||
@Override
|
||||
public ItemStack getStack()
|
||||
{
|
||||
final IItemHandler baseInv = getItemHandler();
|
||||
final IItemHandler baseInv = this.getItemHandler();
|
||||
final ItemStack input = baseInv.getStackInSlot( 0 );
|
||||
if( input == ItemStack.EMPTY )
|
||||
{
|
||||
@@ -137,10 +137,10 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
||||
@Nonnull
|
||||
public ItemStack decrStackSize( int amount )
|
||||
{
|
||||
ItemStack ret = getStack();
|
||||
ItemStack ret = this.getStack();
|
||||
if( !ret.isEmpty() )
|
||||
{
|
||||
makePlate();
|
||||
this.makePlate();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -150,21 +150,21 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
||||
{
|
||||
if( stack.isEmpty() )
|
||||
{
|
||||
makePlate();
|
||||
this.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();
|
||||
item.damageItem( 1, getPlayerInv().player );
|
||||
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
|
||||
|
||||
if( item.getCount() == 0 )
|
||||
{
|
||||
getPlayerInv().mainInventory.add( getPlayerInv().currentItem, ItemStack.EMPTY );
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( getPlayerInv().player, item, null ) );
|
||||
ContainerQuartzKnife.this.getPlayerInv().mainInventory.add( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, item, null ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
@@ -48,6 +49,13 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
private IGrid network;
|
||||
private int delay = 40;
|
||||
|
||||
@GuiSync( 31 )
|
||||
public int xSize;
|
||||
@GuiSync( 32 )
|
||||
public int ySize;
|
||||
@GuiSync( 33 )
|
||||
public int zSize;
|
||||
|
||||
public ContainerSpatialIOPort( final InventoryPlayer ip, final TileSpatialIOPort spatialIOPort )
|
||||
{
|
||||
super( ip, spatialIOPort, null );
|
||||
@@ -85,6 +93,22 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
|
||||
this.setRequiredPower( (long) ( 100.0 * sc.requiredPower() ) );
|
||||
this.setEfficency( (long) ( 100.0f * sc.currentEfficiency() ) );
|
||||
|
||||
final DimensionalCoord min = sc.getMin();
|
||||
final DimensionalCoord max = sc.getMax();
|
||||
|
||||
if( min != null && max != null && sc.isValidRegion() )
|
||||
{
|
||||
this.xSize = sc.getMax().x - sc.getMin().x - 1;
|
||||
this.ySize = sc.getMax().y - sc.getMin().y - 1;
|
||||
this.zSize = sc.getMax().z - sc.getMin().z - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.xSize = 0;
|
||||
this.ySize = 0;
|
||||
this.zSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
@@ -149,7 +150,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
final NonNullList<ItemStack> aitemstack = CraftingManager.getRemainingItems( ic, playerIn.world );
|
||||
final NonNullList<ItemStack> aitemstack = this.getRemainingItems( ic, playerIn.world );
|
||||
|
||||
ItemHandlerUtil.copy( ic, this.craftMatrix, false );
|
||||
|
||||
@@ -195,4 +196,10 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
|
||||
return super.decrStackSize( par1 );
|
||||
}
|
||||
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||
protected NonNullList<ItemStack> getRemainingItems( InventoryCrafting ic, World world )
|
||||
{
|
||||
return CraftingManager.getRemainingItems( ic, world );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public void clearStack()
|
||||
{
|
||||
super.putStack( ItemStack.EMPTY );
|
||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.slotNumber, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,7 +112,7 @@ public class AppEngSlot extends Slot
|
||||
return this.getDisplayStack();
|
||||
}
|
||||
|
||||
return this.itemHandler.getStackInSlot( index );
|
||||
return this.itemHandler.getStackInSlot( this.index );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,7 +120,7 @@ public class AppEngSlot extends Slot
|
||||
{
|
||||
if( this.isSlotEnabled() )
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, index, stack );
|
||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, stack );
|
||||
this.onSlotChanged();
|
||||
|
||||
if( this.getContainer() != null )
|
||||
@@ -151,7 +151,7 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public int getItemStackLimit( @Nonnull ItemStack stack )
|
||||
{
|
||||
return Math.min( getSlotStackLimit(), stack.getMaxStackSize() );
|
||||
return Math.min( this.getSlotStackLimit(), stack.getMaxStackSize() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +159,7 @@ public class AppEngSlot extends Slot
|
||||
{
|
||||
if( this.isSlotEnabled() )
|
||||
{
|
||||
return !this.itemHandler.extractItem( index, 1, true ).isEmpty();
|
||||
return !this.itemHandler.extractItem( this.index, 1, true ).isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class AppEngSlot extends Slot
|
||||
@Nonnull
|
||||
public ItemStack decrStackSize( int amount )
|
||||
{
|
||||
return this.itemHandler.extractItem( index, amount, false );
|
||||
return this.itemHandler.extractItem( this.index, amount, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,7 +191,7 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public ItemStack getDisplayStack()
|
||||
{
|
||||
return this.itemHandler.getStackInSlot( index );
|
||||
return this.itemHandler.getStackInSlot( this.index );
|
||||
}
|
||||
|
||||
public float getOpacityOfIcon()
|
||||
|
||||
@@ -27,8 +27,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -39,6 +42,7 @@ import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
@@ -153,6 +157,41 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||
protected IRecipe findRecipe( InventoryCrafting ic, World world )
|
||||
{
|
||||
if( this.container instanceof ContainerCraftingTerm )
|
||||
{
|
||||
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||
|
||||
if( recipe != null && recipe.matches( ic, world ) )
|
||||
{
|
||||
return containerTerminal.getCurrentRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
return CraftingManager.findMatchingRecipe( ic, world );
|
||||
}
|
||||
|
||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||
@Override
|
||||
protected NonNullList<ItemStack> getRemainingItems( InventoryCrafting ic, World world )
|
||||
{
|
||||
if( this.container instanceof ContainerCraftingTerm )
|
||||
{
|
||||
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||
|
||||
if( recipe != null && recipe.matches( ic, world ) )
|
||||
{
|
||||
return containerTerminal.getCurrentRecipe().getRemainingItems( ic );
|
||||
}
|
||||
}
|
||||
|
||||
return CraftingManager.getRemainingItems( ic, world );
|
||||
}
|
||||
|
||||
private int capCraftingAttempts( final int maxTimesToCraft )
|
||||
{
|
||||
return maxTimesToCraft;
|
||||
@@ -178,7 +217,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
|
||||
final IRecipe r = this.findRecipe( ic, p.world );
|
||||
|
||||
if( r == null )
|
||||
{
|
||||
|
||||
@@ -95,8 +95,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
private final int[] levelByStacks = { 1, 10, 100, 1000 };
|
||||
|
||||
// Spatial IO/Dimension
|
||||
private int storageBiomeID = -1;
|
||||
private int storageProviderID = -1;
|
||||
private int storageDimensionID = -1;
|
||||
private double spatialPowerExponent = 1.35;
|
||||
private double spatialPowerMultiplier = 1250.0;
|
||||
|
||||
@@ -251,8 +251,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
|
||||
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
{
|
||||
this.storageBiomeID = this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).getInt( this.storageBiomeID );
|
||||
this.storageProviderID = this.get( "spatialio", "storageProviderID", this.storageProviderID ).getInt( this.storageProviderID );
|
||||
this.storageDimensionID = this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).getInt( this.storageDimensionID );
|
||||
this.spatialPowerMultiplier = this.get( "spatialio", "spatialPowerMultiplier", this.spatialPowerMultiplier ).getDouble(
|
||||
this.spatialPowerMultiplier );
|
||||
this.spatialPowerExponent = this.get( "spatialio", "spatialPowerExponent", this.spatialPowerExponent ).getDouble( this.spatialPowerExponent );
|
||||
@@ -397,8 +397,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
{
|
||||
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
{
|
||||
this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).set( this.storageBiomeID );
|
||||
this.get( "spatialio", "storageProviderID", this.storageProviderID ).set( this.storageProviderID );
|
||||
this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).set( this.storageDimensionID );
|
||||
}
|
||||
|
||||
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).set( this.selectedPowerUnit.name() );
|
||||
@@ -619,16 +619,16 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
return this.levelByStacks;
|
||||
}
|
||||
|
||||
public int getStorageBiomeID()
|
||||
{
|
||||
return this.storageBiomeID;
|
||||
}
|
||||
|
||||
public int getStorageProviderID()
|
||||
{
|
||||
return this.storageProviderID;
|
||||
}
|
||||
|
||||
public int getStorageDimensionID()
|
||||
{
|
||||
return this.storageDimensionID;
|
||||
}
|
||||
|
||||
public double getSpatialPowerExponent()
|
||||
{
|
||||
return this.spatialPowerExponent;
|
||||
@@ -766,13 +766,13 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
|
||||
// Setters keep visibility as low as possible.
|
||||
|
||||
void setStorageBiomeID( int id )
|
||||
{
|
||||
this.storageBiomeID = id;
|
||||
}
|
||||
|
||||
void setStorageProviderID( int id )
|
||||
{
|
||||
this.storageProviderID = id;
|
||||
}
|
||||
|
||||
void setStorageDimensionID( int id )
|
||||
{
|
||||
this.storageDimensionID = id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,10 +28,11 @@ import javax.annotation.Nonnull;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -55,6 +56,7 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.recipes.CustomRecipeConfig;
|
||||
import appeng.recipes.CustomRecipeForgeConfiguration;
|
||||
import appeng.server.AECommand;
|
||||
@@ -66,7 +68,7 @@ import appeng.services.version.VersionCheckerConfig;
|
||||
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
|
||||
{
|
||||
@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 ) );
|
||||
|
||||
this.registration = new Registration();
|
||||
MinecraftForge.EVENT_BUS.register( this.registration );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -123,21 +126,24 @@ public final class AppEng
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Registration getRegistration()
|
||||
public Biome getStorageBiome()
|
||||
{
|
||||
return this.registration;
|
||||
return this.registration.storageBiome;
|
||||
}
|
||||
|
||||
public DimensionType getStorageDimensionType()
|
||||
{
|
||||
return this.registration.storageDimensionType;
|
||||
}
|
||||
|
||||
public int getStorageDimensionID()
|
||||
{
|
||||
return this.registration.storageDimensionID;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
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();
|
||||
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
|
||||
this.recipeDirectory = new File( this.configDirectory, "aerecipes" );
|
||||
@@ -165,6 +171,11 @@ public final class AppEng
|
||||
CreativeTabFacade.init();
|
||||
}
|
||||
|
||||
for( final IntegrationType type : IntegrationType.values() )
|
||||
{
|
||||
IntegrationRegistry.INSTANCE.add( type );
|
||||
}
|
||||
|
||||
this.registration.preInitialize( event );
|
||||
|
||||
if( Platform.isClient() )
|
||||
|
||||
@@ -62,6 +62,4 @@ public abstract class CommonHelper
|
||||
|
||||
public abstract void updateRenderMode( EntityPlayer player );
|
||||
|
||||
public abstract void missingCoreMod();
|
||||
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ package appeng.core;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -37,10 +35,13 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
@@ -48,8 +49,8 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -70,7 +71,16 @@ import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.recipes.IRecipeHandler;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.IOreDictComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.components.IRecipeRegistrationComponent;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
@@ -79,10 +89,8 @@ import appeng.core.features.registries.cell.CreativeCellHandler;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.stats.PlayerStatsRegistration;
|
||||
import appeng.core.worlddata.SpatialDimensionManager;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.items.materials.ItemMaterial;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.loot.ChestLoot;
|
||||
@@ -100,8 +108,6 @@ import appeng.recipes.CustomRecipeConfig;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.recipes.game.DisassembleRecipe;
|
||||
import appeng.recipes.game.FacadeRecipe;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.recipes.handlers.Crusher;
|
||||
import appeng.recipes.handlers.Grind;
|
||||
import appeng.recipes.handlers.HCCrusher;
|
||||
@@ -111,8 +117,6 @@ import appeng.recipes.handlers.MekCrusher;
|
||||
import appeng.recipes.handlers.MekEnrichment;
|
||||
import appeng.recipes.handlers.Press;
|
||||
import appeng.recipes.handlers.Pulverizer;
|
||||
import appeng.recipes.handlers.Shaped;
|
||||
import appeng.recipes.handlers.Shapeless;
|
||||
import appeng.recipes.handlers.Smelt;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.spatial.BiomeGenStorage;
|
||||
@@ -122,16 +126,12 @@ import appeng.worldgen.MeteoriteWorldGen;
|
||||
import appeng.worldgen.QuartzWorldGen;
|
||||
|
||||
|
||||
public final class Registration
|
||||
final class Registration
|
||||
{
|
||||
private final RecipeHandler recipeHandler;
|
||||
private DimensionType storageDimensionType;
|
||||
private Biome storageBiome;
|
||||
DimensionType storageDimensionType;
|
||||
int storageDimensionID;
|
||||
Biome storageBiome;
|
||||
|
||||
// TODO : 1.12 Improve
|
||||
private static List<Block> blocksToRegister = new ArrayList<>();
|
||||
private static List<Item> itemsToRegister = new ArrayList<>();
|
||||
private static List<IRecipe> recipesToRegister = new ArrayList<>();
|
||||
private File recipeDirectory;
|
||||
private CustomRecipeConfig customRecipeConfig;
|
||||
|
||||
@@ -141,115 +141,49 @@ public final class Registration
|
||||
this.customRecipeConfig = f2;
|
||||
}
|
||||
|
||||
Registration()
|
||||
{
|
||||
this.recipeHandler = new RecipeHandler();
|
||||
}
|
||||
|
||||
public Biome getStorageBiome()
|
||||
{
|
||||
return this.storageBiome;
|
||||
}
|
||||
|
||||
public static void addBlockToRegister( Block b )
|
||||
{
|
||||
if( blocksToRegister == null )
|
||||
{
|
||||
throw new IllegalStateException( "Past the registration phase already!" );
|
||||
}
|
||||
blocksToRegister.add( b );
|
||||
}
|
||||
|
||||
public static void addRecipeToRegister( IRecipe r )
|
||||
{
|
||||
if( recipesToRegister == null )
|
||||
{
|
||||
throw new IllegalStateException( "Past the registration phase already!" );
|
||||
}
|
||||
recipesToRegister.add( r );
|
||||
}
|
||||
|
||||
public static void addItemToRegister( Item i )
|
||||
{
|
||||
if( itemsToRegister == null )
|
||||
{
|
||||
throw new IllegalStateException( "Past the registration phase already!" );
|
||||
}
|
||||
itemsToRegister.add( i );
|
||||
}
|
||||
|
||||
public DimensionType getStorageDimensionType()
|
||||
{
|
||||
return this.storageDimensionType;
|
||||
}
|
||||
|
||||
void preInitialize( final FMLPreInitializationEvent event )
|
||||
{
|
||||
// this.registerSpatial( false );
|
||||
|
||||
Capabilities.register();
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||
this.registerCraftHandlers( recipeRegistry );
|
||||
|
||||
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
||||
// RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||
// RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||
// RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||
|
||||
ApiDefinitions definitions = api.definitions();
|
||||
|
||||
// Register all detected handlers and features (items, blocks) in pre-init
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.preInitialize( event.getSide() ) );
|
||||
// Register
|
||||
definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||
}
|
||||
|
||||
private void registerSpatial( final boolean force, IForgeRegistry<Biome> registry )
|
||||
private void registerSpatialBiome( IForgeRegistry<Biome> registry )
|
||||
{
|
||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final AEConfig config = AEConfig.instance();
|
||||
|
||||
if( this.storageBiome == null )
|
||||
{
|
||||
// if( force && config.getStorageBiomeID() == -1 )
|
||||
// {
|
||||
// config.setStorageBiomeID( Platform.findEmpty( Biome.REGISTRY, 0, 256 ) );
|
||||
// if( config.getStorageBiomeID() == -1 )
|
||||
// {
|
||||
// throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable
|
||||
// spatial." );
|
||||
// }
|
||||
//
|
||||
// this.storageBiome = new BiomeGenStorage();
|
||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
||||
// );
|
||||
// config.save();
|
||||
// }
|
||||
//
|
||||
// if( !force && config.getStorageBiomeID() != -1 )
|
||||
// {
|
||||
// this.storageBiome = new BiomeGenStorage();
|
||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
||||
// );
|
||||
// }
|
||||
|
||||
// TODO: 1.12, are modders allowed to even touch the ID's any more?
|
||||
this.storageBiome = new BiomeGenStorage();
|
||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||
|
||||
}
|
||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||
}
|
||||
|
||||
if( config.getStorageProviderID() != -1 )
|
||||
private void registerSpatialDimension()
|
||||
{
|
||||
final AEConfig config = AEConfig.instance();
|
||||
if( !config.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
{
|
||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
||||
return;
|
||||
}
|
||||
|
||||
if( config.getStorageProviderID() == -1 && force )
|
||||
if( config.getStorageProviderID() == -1 )
|
||||
{
|
||||
final Set<Integer> ids = new HashSet<>();
|
||||
for( DimensionType type : DimensionType.values() )
|
||||
@@ -257,17 +191,25 @@ public final class Registration
|
||||
ids.add( type.getId() );
|
||||
}
|
||||
|
||||
config.setStorageProviderID( -11 );
|
||||
|
||||
while( ids.contains( config.getStorageProviderID() ) )
|
||||
int newId = -11;
|
||||
while( ids.contains( newId ) )
|
||||
{
|
||||
config.setStorageProviderID( config.getStorageProviderID() - 1 );
|
||||
--newId;
|
||||
}
|
||||
|
||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
||||
|
||||
config.setStorageProviderID( newId );
|
||||
config.save();
|
||||
}
|
||||
|
||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, true );
|
||||
|
||||
if( config.getStorageDimensionID() == -1 )
|
||||
{
|
||||
config.setStorageDimensionID( DimensionManager.getNextFreeDimId() );
|
||||
config.save();
|
||||
}
|
||||
this.storageDimensionID = config.getStorageDimensionID();
|
||||
|
||||
DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
|
||||
}
|
||||
|
||||
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
||||
@@ -285,9 +227,6 @@ public final class Registration
|
||||
registry.addNewCraftHandler( "smelt", Smelt.class );
|
||||
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
||||
registry.addNewCraftHandler( "press", Press.class );
|
||||
|
||||
registry.addNewCraftHandler( "shaped", Shaped.class );
|
||||
registry.addNewCraftHandler( "shapeless", Shapeless.class );
|
||||
}
|
||||
|
||||
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
||||
@@ -302,7 +241,9 @@ public final class Registration
|
||||
final IRegistryContainer registries = api.registries();
|
||||
|
||||
ApiDefinitions definitions = api.definitions();
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.initialize( event.getSide() ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( event.getSide() ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||
|
||||
//
|
||||
// // Perform ore camouflage!
|
||||
// ItemMaterial.instance.makeUnique();
|
||||
@@ -310,22 +251,6 @@ public final class Registration
|
||||
// final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
||||
// 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 ) )
|
||||
// {
|
||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
|
||||
@@ -361,9 +286,6 @@ public final class Registration
|
||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||
} );
|
||||
|
||||
// TODO : 1.12 This is way too late for recipes
|
||||
// this.recipeHandler.injectRecipes();
|
||||
|
||||
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance() );
|
||||
registration.registerAchievementHandlers();
|
||||
registration.registerAchievements();
|
||||
@@ -372,41 +294,36 @@ public final class Registration
|
||||
@SubscribeEvent
|
||||
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||
{
|
||||
IForgeRegistry<Biome> registry = event.getRegistry();
|
||||
this.registerSpatial( false, registry );
|
||||
final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||
this.registerSpatialBiome( registry );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||
{
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IModelRegistry registry = new ModelLoaderWrapper();
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.modelRegistration( FMLCommonHandler.instance().getEffectiveSide(), registry ) );
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( side, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||
{
|
||||
IForgeRegistry<Block> registry = event.getRegistry();
|
||||
// TODO : 1.12 Improve
|
||||
for( Block b : blocksToRegister )
|
||||
{
|
||||
registry.register( b );
|
||||
}
|
||||
blocksToRegister = null;
|
||||
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( side, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerItems( RegistryEvent.Register<Item> event )
|
||||
{
|
||||
|
||||
IForgeRegistry<Item> registry = event.getRegistry();
|
||||
// TODO : 1.12 Improve
|
||||
for( Item i : itemsToRegister )
|
||||
{
|
||||
registry.register( i );
|
||||
}
|
||||
itemsToRegister = null;
|
||||
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( side, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -416,20 +333,15 @@ public final class Registration
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final ApiDefinitions definitions = api.definitions();
|
||||
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
// Perform ore camouflage!
|
||||
ItemMaterial.instance.makeUnique();
|
||||
|
||||
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, this.recipeHandler );
|
||||
recipeLoader.run();
|
||||
|
||||
this.recipeHandler.injectRecipes();
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||
{
|
||||
DisassembleRecipe r = new DisassembleRecipe();
|
||||
// TODO : 1.12 Improve
|
||||
addRecipeToRegister( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
|
||||
// "after:minecraft:shapeless" );
|
||||
}
|
||||
@@ -438,41 +350,42 @@ public final class Registration
|
||||
{
|
||||
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
||||
{
|
||||
// TODO : 1.12 Improve
|
||||
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
||||
addRecipeToRegister( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||
registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
|
||||
// "after:minecraft:shaped" );
|
||||
} );
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
// TODO : 1.12 Improve
|
||||
for( IRecipe r : recipesToRegister )
|
||||
{
|
||||
// TODO : 1.12 *really* improve.
|
||||
// Move to json where possible?
|
||||
if( r.getRegistryName() == null )
|
||||
{
|
||||
r.setRegistryName( new ResourceLocation( AppEng.MOD_ID.toLowerCase(), "recipe_" + x ) );
|
||||
x++;
|
||||
}
|
||||
registry.register( r );
|
||||
}
|
||||
recipesToRegister = null;
|
||||
definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
|
||||
|
||||
// load machine recipes
|
||||
final IRecipeHandler recipeHandler = new RecipeHandler();
|
||||
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, recipeHandler );
|
||||
recipeLoader.run();
|
||||
recipeHandler.injectRecipes();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
||||
{
|
||||
if( AEConfig.instance()
|
||||
.isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
||||
{
|
||||
event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void postInit( final FMLPostInitializationEvent event )
|
||||
{
|
||||
// TODO : 1.12 Improve
|
||||
|
||||
final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
|
||||
registerSpatialDimension();
|
||||
|
||||
// default settings..
|
||||
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
||||
|
||||
@@ -480,7 +393,7 @@ public final class Registration
|
||||
PlayerMessages.values();
|
||||
GuiText.values();
|
||||
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||
|
||||
// Interface
|
||||
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||
@@ -556,7 +469,7 @@ public final class Registration
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||
{
|
||||
// TODO: VILLAGER TRADING
|
||||
// VillagerRegistry.instance().getRegisteredVillagers()..registerVillageTradeHandler( 3, new AETrading() );
|
||||
// VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
||||
@@ -579,6 +492,7 @@ public final class Registration
|
||||
/*
|
||||
* White List Vanilla...
|
||||
*/
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBanner.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBeacon.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBrewingStand.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityChest.class );
|
||||
@@ -590,15 +504,15 @@ public final class Registration
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnchantmentTable.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnderChest.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEndPortal.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFlowerPot.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityHopper.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityShulkerBox.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class );
|
||||
|
||||
/*
|
||||
* Whitelist AE2
|
||||
@@ -657,7 +571,6 @@ public final class Registration
|
||||
{
|
||||
ModelLoader.setCustomStateMapper( block, mapper );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,9 @@ import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.components.IOreDictComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.client.render.crafting.CraftingCubeRendering;
|
||||
import appeng.client.render.model.GlassModel;
|
||||
@@ -239,17 +242,12 @@ public final class ApiBlocks implements IBlocks
|
||||
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
||||
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
||||
.features( AEFeature.CERTUS_ORE )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
||||
} )
|
||||
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||
.build();
|
||||
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
||||
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
||||
} )
|
||||
.useCustomItemModel()
|
||||
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||
.build();
|
||||
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
||||
|
||||
@@ -308,6 +306,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.features( AEFeature.GRIND_STONE )
|
||||
.tileEntity( new TileEntityDefinition( TileCrank.class ) )
|
||||
.rendering( new CrankRendering() )
|
||||
.useCustomItemModel()
|
||||
.build();
|
||||
this.inscriber = registry.block( "inscriber", BlockInscriber::new )
|
||||
.features( AEFeature.INSCRIBER )
|
||||
@@ -334,10 +333,8 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||
.features( AEFeature.TINY_TNT )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, new DispenserBehaviorTinyTNT() );
|
||||
} )
|
||||
.bootstrap( ( block, item ) -> (IPreInitComponent) side -> BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item,
|
||||
new DispenserBehaviorTinyTNT() ) )
|
||||
.build();
|
||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||
.features( AEFeature.SECURITY )
|
||||
@@ -424,7 +421,6 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
||||
.features( AEFeature.CREATIVE )
|
||||
.item( AEBaseItemBlockChargeable::new )
|
||||
.tileEntity( new TileEntityDefinition( TileCreativeEnergyCell.class ) )
|
||||
.build();
|
||||
|
||||
@@ -497,10 +493,8 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering( new CableBusRendering( partModels ) )
|
||||
// (handled in BlockCableBus.java and its setupTile())
|
||||
// .tileEntity( TileCableBus.class )
|
||||
.postInit( ( block, item ) ->
|
||||
{
|
||||
( (BlockCableBus) block ).setupTile();
|
||||
} )
|
||||
// TODO: why the custom registration?
|
||||
.bootstrap( ( block, item ) -> (IPostInitComponent) side -> ( (BlockCableBus) block ).setupTile() )
|
||||
.build();
|
||||
|
||||
this.skyStoneSlab = makeSlab( "sky_stone_slab", "sky_stone_double_slab", registry, this.skyStoneBlock() );
|
||||
|
||||
@@ -42,7 +42,8 @@ public final class ApiParts implements IParts
|
||||
private final AEColoredItemDefinition cableSmart;
|
||||
private final AEColoredItemDefinition cableCovered;
|
||||
private final AEColoredItemDefinition cableGlass;
|
||||
private final AEColoredItemDefinition cableDense;
|
||||
private final AEColoredItemDefinition cableDenseCovered;
|
||||
private final AEColoredItemDefinition cableDenseSmart;
|
||||
// private final AEColoredItemDefinition lumenCableSmart;
|
||||
// private final AEColoredItemDefinition lumenCableCovered;
|
||||
// private final AEColoredItemDefinition lumenCableGlass;
|
||||
@@ -63,7 +64,6 @@ public final class ApiParts implements IParts
|
||||
private final IItemDefinition p2PTunnelItems;
|
||||
private final IItemDefinition p2PTunnelFluids;
|
||||
private final IItemDefinition p2PTunnelEU;
|
||||
private final IItemDefinition p2PTunnelRF;
|
||||
private final IItemDefinition p2PTunnelFE;
|
||||
private final IItemDefinition p2PTunnelLight;
|
||||
// private final IItemDefinition p2PTunnelOpenComputers;
|
||||
@@ -94,7 +94,8 @@ public final class ApiParts implements IParts
|
||||
this.cableSmart = constructColoredDefinition( itemPart, PartType.CABLE_SMART );
|
||||
this.cableCovered = constructColoredDefinition( itemPart, PartType.CABLE_COVERED );
|
||||
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.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
|
||||
@@ -116,7 +117,6 @@ public final class ApiParts implements IParts
|
||||
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.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.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) );
|
||||
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
||||
@@ -166,9 +166,15 @@ public final class ApiParts implements IParts
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition cableDense()
|
||||
public AEColoredItemDefinition cableDenseCovered()
|
||||
{
|
||||
return this.cableDense;
|
||||
return this.cableDenseCovered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition cableDenseSmart()
|
||||
{
|
||||
return this.cableDenseSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,7 +199,7 @@ public final class ApiParts implements IParts
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableDense()
|
||||
public AEColoredItemDefinition lumenDenseCableSmart()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
||||
// return this.lumenCableDense;
|
||||
@@ -295,12 +301,6 @@ public final class ApiParts implements IParts
|
||||
return this.p2PTunnelEU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelRF()
|
||||
{
|
||||
return this.p2PTunnelRF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelFE()
|
||||
{
|
||||
|
||||
@@ -113,7 +113,6 @@ public enum AEFeature
|
||||
DENSE_ENERGY_CELLS( "DenseEnergyCells", 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_ITEMS( "P2PTunnelItems", 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.energyCellCreative(), TunnelType.FE_POWER );
|
||||
|
||||
/**
|
||||
* RF tunnel items
|
||||
*/
|
||||
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.RF_POWER ); // leadstone
|
||||
// fluxduct
|
||||
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
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER );
|
||||
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", 4 ), TunnelType.FE_POWER );
|
||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER );
|
||||
|
||||
/**
|
||||
* 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.cableCovered().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
|
||||
*/
|
||||
|
||||
this.addNewAttunement( "thermaldynamics", TunnelType.RF_POWER );
|
||||
this.addNewAttunement( "thermalexpansion", TunnelType.RF_POWER );
|
||||
this.addNewAttunement( "thermalfoundation", TunnelType.RF_POWER );
|
||||
this.addNewAttunement( "thermaldynamics", TunnelType.FE_POWER );
|
||||
this.addNewAttunement( "thermalexpansion", TunnelType.FE_POWER );
|
||||
this.addNewAttunement( "thermalfoundation", TunnelType.FE_POWER );
|
||||
// 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.
|
||||
this.addNewAttunement( "mekanism", TunnelType.RF_POWER );
|
||||
this.addNewAttunement( "mekanism", TunnelType.FE_POWER );
|
||||
// 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 );
|
||||
|
||||
}
|
||||
|
||||
@@ -89,11 +89,13 @@ public enum GuiText
|
||||
FluidTunnel,
|
||||
OCTunnel,
|
||||
LightTunnel,
|
||||
RFTunnel,
|
||||
FETunnel,
|
||||
PressureTunnel,
|
||||
|
||||
// spatial
|
||||
StoredSize,
|
||||
CellId,
|
||||
|
||||
CopyMode,
|
||||
CopyModeDesc,
|
||||
PatternTerminal,
|
||||
@@ -115,6 +117,8 @@ public enum GuiText
|
||||
MaxPower,
|
||||
RequiredPower,
|
||||
Efficiency,
|
||||
SCSSize,
|
||||
SCSSInvalid,
|
||||
InWorldCrafting,
|
||||
|
||||
inWorldFluix,
|
||||
|
||||
@@ -80,7 +80,7 @@ public enum Achievements
|
||||
Networking2( 4, 0, AEApi.instance().definitions().parts().cableSmart(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
Networking3( 4, 2, AEApi.instance().definitions().parts().cableDense(), AchievementType.Custom ),
|
||||
Networking3( 4, 2, AEApi.instance().definitions().parts().cableDenseSmart(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
P2P( 2, -2, AEApi.instance().definitions().parts().p2PTunnelME(), AchievementType.Craft ),
|
||||
|
||||
@@ -39,7 +39,6 @@ import appeng.core.sync.packets.PacketLightning;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.core.sync.packets.PacketMatterCannon;
|
||||
import appeng.core.sync.packets.PacketMockExplosion;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.core.sync.packets.PacketPaintedEntity;
|
||||
import appeng.core.sync.packets.PacketPartPlacement;
|
||||
import appeng.core.sync.packets.PacketPartialItem;
|
||||
@@ -83,8 +82,6 @@ public class AppEngPacketHandlerBase
|
||||
|
||||
PACKET_CLICK( PacketClick.class ),
|
||||
|
||||
PACKET_NEW_STORAGE_DIMENSION( PacketNewStorageDimension.class ),
|
||||
|
||||
PACKET_SWITCH_GUIS( PacketSwitchGuis.class ),
|
||||
|
||||
PACKET_SWAP_SLOTS( PacketSwapSlots.class ),
|
||||
|
||||
@@ -24,15 +24,12 @@ import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.ThreadQuickExitException;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import net.minecraftforge.fml.common.network.FMLEventChannel;
|
||||
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEvent;
|
||||
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
|
||||
|
||||
public class NetworkHandler
|
||||
@@ -89,21 +86,6 @@ public class NetworkHandler
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void newConnection( final ServerConnectionFromClientEvent ev )
|
||||
{
|
||||
WorldData.instance().dimensionData().sendToPlayer( ev.getManager() );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void newConnection( final PlayerLoggedInEvent loginEvent )
|
||||
{
|
||||
if( loginEvent.player instanceof EntityPlayerMP )
|
||||
{
|
||||
WorldData.instance().dimensionData().sendToPlayer( null );
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverPacket( final ServerCustomPacketEvent ev )
|
||||
{
|
||||
|
||||
@@ -30,17 +30,13 @@ import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -49,15 +45,13 @@ import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.WrapperInvItemHandler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
@@ -114,165 +108,132 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
final EntityPlayerMP pmp = (EntityPlayerMP) player;
|
||||
final Container con = pmp.openContainer;
|
||||
|
||||
if( con instanceof IContainerCraftingPacket )
|
||||
if( !( con instanceof IContainerCraftingPacket ) )
|
||||
{
|
||||
final IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
|
||||
final IGridNode node = cct.getNetworkNode();
|
||||
if( node != null )
|
||||
return;
|
||||
}
|
||||
|
||||
final IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
|
||||
final IGridNode node = cct.getNetworkNode();
|
||||
|
||||
if( node == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final IGrid grid = node.getGrid();
|
||||
if( grid == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final IStorageGrid inv = grid.getCache( IStorageGrid.class );
|
||||
final IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
|
||||
final ISecurityGrid security = grid.getCache( ISecurityGrid.class );
|
||||
final IItemHandler craftMatrix = cct.getInventoryByName( "crafting" );
|
||||
final IItemHandler playerInventory = cct.getInventoryByName( "player" );
|
||||
|
||||
if( inv != null && this.recipe != null && security != null )
|
||||
{
|
||||
final IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
|
||||
final IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
||||
|
||||
for( int x = 0; x < craftMatrix.getSlots(); x++ )
|
||||
{
|
||||
final IGrid grid = node.getGrid();
|
||||
if( grid == null )
|
||||
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
||||
|
||||
// prepare slots
|
||||
if( !currentItem.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// already the correct item?
|
||||
ItemStack newItem = canUseInSlot( x, currentItem );
|
||||
|
||||
final IStorageGrid inv = grid.getCache( IStorageGrid.class );
|
||||
final IEnergyGrid energy = grid.getCache( IEnergyGrid.class );
|
||||
final ISecurityGrid security = grid.getCache( ISecurityGrid.class );
|
||||
final IItemHandler craftMatrix = cct.getInventoryByName( "crafting" );
|
||||
final IItemHandler playerInventory = cct.getInventoryByName( "player" );
|
||||
|
||||
final Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;
|
||||
|
||||
if( inv != null && this.recipe != null && security != null )
|
||||
{
|
||||
final InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
for( int x = 0; x < 9; x++ )
|
||||
// put away old item
|
||||
if( newItem != currentItem && security.hasPermission( player, SecurityPermissions.INJECT ) )
|
||||
{
|
||||
if( this.recipe[x] != null && this.recipe[x].length > 0 )
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
final IAEItemStack out = cct.useRealItems() ? Platform.poweredInsert( energy, storage, in, cct.getActionSource() ) : null;
|
||||
if( out != null )
|
||||
{
|
||||
testInv.setInventorySlotContents( x, this.recipe[x][0] );
|
||||
currentItem = out.getItemStack();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentItem = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( testInv, pmp.world );
|
||||
|
||||
if( r != null && security.hasPermission( player, SecurityPermissions.EXTRACT ) )
|
||||
if( currentItem.isEmpty() && this.recipe[x] != null )
|
||||
{
|
||||
// for each variant
|
||||
for( int y = 0; y < this.recipe[x].length && currentItem.isEmpty(); y++ )
|
||||
{
|
||||
final ItemStack is = r.getCraftingResult( testInv );
|
||||
|
||||
if( !is.isEmpty() )
|
||||
final IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
||||
if( request != null )
|
||||
{
|
||||
final IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
|
||||
final IItemList all = storage.getStorageList();
|
||||
final IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
||||
|
||||
for( int x = 0; x < craftMatrix.getSlots(); x++ )
|
||||
// try ae
|
||||
if( ( filter == null || filter.isListed( request ) ) && security.hasPermission( player, SecurityPermissions.EXTRACT ) )
|
||||
{
|
||||
final ItemStack patternItem = testInv.getStackInSlot( x );
|
||||
|
||||
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
||||
if( !currentItem.isEmpty() )
|
||||
request.setStackSize( 1 );
|
||||
IAEItemStack out;
|
||||
if( cct.useRealItems() )
|
||||
{
|
||||
testInv.setInventorySlotContents( x, currentItem );
|
||||
final ItemStack newItemStack = r.matches( testInv, pmp.world ) ? r.getCraftingResult( testInv ) : ItemStack.EMPTY;
|
||||
testInv.setInventorySlotContents( x, patternItem );
|
||||
|
||||
if( newItemStack.isEmpty() || !Platform.itemComparisons().isSameItem( newItemStack, is ) )
|
||||
{
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
if( in != null )
|
||||
{
|
||||
final IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in,
|
||||
cct.getActionSource() );
|
||||
if( out != null )
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( craftMatrix, x, out.getItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( craftMatrix, x, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
currentItem = craftMatrix.getStackInSlot( x );
|
||||
}
|
||||
}
|
||||
out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() );
|
||||
}
|
||||
else
|
||||
{
|
||||
out = storage.extractItems( request, Actionable.SIMULATE, cct.getActionSource() );
|
||||
}
|
||||
|
||||
// True if we need to fetch an item for the recipe
|
||||
if( !patternItem.isEmpty() && currentItem.isEmpty() )
|
||||
if( out != null )
|
||||
{
|
||||
// Grab from network by recipe
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.world, r, is, testInv,
|
||||
patternItem, x, all, realForFake, filter );
|
||||
|
||||
// If that doesn't get it, grab exact items from network (?)
|
||||
// TODO see if this code is necessary
|
||||
if( whichItem.isEmpty() )
|
||||
{
|
||||
for( int y = 0; y < this.recipe[x].length; y++ )
|
||||
{
|
||||
final IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
||||
if( request != null )
|
||||
{
|
||||
if( filter == null || filter.isListed( request ) )
|
||||
{
|
||||
request.setStackSize( 1 );
|
||||
final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() );
|
||||
if( out != null )
|
||||
{
|
||||
whichItem = out.getItemStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If that doesn't work, grab from the player's inventory
|
||||
if( whichItem.isEmpty() && playerInventory != null )
|
||||
{
|
||||
whichItem = this.extractItemFromPlayerInventory( player, realForFake, patternItem );
|
||||
}
|
||||
|
||||
ItemHandlerUtil.setStackInSlot( craftMatrix, x, whichItem );
|
||||
currentItem = out.getItemStack();
|
||||
}
|
||||
}
|
||||
|
||||
// try inventory
|
||||
if( currentItem.isEmpty() )
|
||||
{
|
||||
AdaptorItemHandler ad = new AdaptorItemHandler( playerInventory );
|
||||
|
||||
if( cct.useRealItems() )
|
||||
{
|
||||
currentItem = ad.removeItems( 1, this.recipe[x][y], null );
|
||||
}
|
||||
else
|
||||
{
|
||||
currentItem = ad.simulateRemove( 1, this.recipe[x][y], null );
|
||||
}
|
||||
}
|
||||
con.onCraftMatrixChanged( new WrapperInvItemHandler( craftMatrix ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemHandlerUtil.setStackInSlot( craftMatrix, x, currentItem );
|
||||
}
|
||||
con.onCraftMatrixChanged( new WrapperInvItemHandler( craftMatrix ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to extract an item from the player inventory. Does account for fuzzy items.
|
||||
*
|
||||
* @param player the {@link EntityPlayer} to extract from
|
||||
* @param mode the {@link Actionable} to simulate or modulate the operation
|
||||
* @param patternItem which {@link ItemStack} to extract
|
||||
* @return null or a found {@link ItemStack}
|
||||
*
|
||||
* @param slot
|
||||
* @param is itemstack
|
||||
* @return is if it can be used, else EMPTY
|
||||
*/
|
||||
private ItemStack extractItemFromPlayerInventory( final EntityPlayer player, final Actionable mode, final ItemStack patternItem )
|
||||
private ItemStack canUseInSlot( int slot, ItemStack is )
|
||||
{
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player );
|
||||
final AEItemStack request = AEItemStack.create( patternItem );
|
||||
final boolean isSimulated = mode == Actionable.SIMULATE;
|
||||
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || patternItem.hasTagCompound() || patternItem
|
||||
.isItemStackDamageable();
|
||||
|
||||
if( !checkFuzzy )
|
||||
if( this.recipe[slot] != null )
|
||||
{
|
||||
if( isSimulated )
|
||||
for( ItemStack option : this.recipe[slot] )
|
||||
{
|
||||
return ia.simulateRemove( 1, patternItem, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ia.removeItems( 1, patternItem, null );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isSimulated )
|
||||
{
|
||||
return ia.simulateSimilarRemove( 1, patternItem, FuzzyMode.IGNORE_ALL, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ia.removeSimilarItems( 1, patternItem, FuzzyMode.IGNORE_ALL, null );
|
||||
if( is.isItemEqual( option ) )
|
||||
{
|
||||
return is;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,72 +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.core.sync.packets;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
|
||||
|
||||
public class PacketNewStorageDimension extends AppEngPacket
|
||||
{
|
||||
|
||||
private final int newDim;
|
||||
|
||||
// automatic.
|
||||
public PacketNewStorageDimension( final ByteBuf stream )
|
||||
{
|
||||
this.newDim = stream.readInt();
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketNewStorageDimension( final int newDim )
|
||||
{
|
||||
this.newDim = newDim;
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( this.getPacketID() );
|
||||
data.writeInt( newDim );
|
||||
|
||||
this.configureWrite( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
{
|
||||
try
|
||||
{
|
||||
DimensionManager.registerDimension( this.newDim, AppEng.instance().getRegistration().getStorageDimensionType() );
|
||||
}
|
||||
catch( final IllegalArgumentException iae )
|
||||
{
|
||||
// ok!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,171 +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.core.worlddata;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.hooks.TickHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 30.05.2015
|
||||
* @since rv3 30.05.2015
|
||||
*/
|
||||
final class DimensionData implements IWorldDimensionData, IOnWorldStartable, IOnWorldStoppable
|
||||
{
|
||||
private static final String CONFIG_CATEGORY = "DimensionManager";
|
||||
private static final String CONFIG_KEY = "StorageCells";
|
||||
private static final int[] STORAGE_CELLS_DEFAULT = new int[0];
|
||||
|
||||
private static final String STORAGE_CELL_CATEGORY = "StorageCell";
|
||||
|
||||
private static final String STORAGE_CELL_SCALE_X_KEY = "scaleX";
|
||||
private static final String STORAGE_CELL_SCALE_Y_KEY = "scaleY";
|
||||
private static final String STORAGE_CELL_SCALE_Z_KEY = "scaleZ";
|
||||
|
||||
private static final String PACKAGE_DEST_CATEGORY = "DimensionManager";
|
||||
private static final String PACKAGE_KEY_CATEGORY = "StorageCells";
|
||||
private static final int[] PACKAGE_DEF_CATEGORY = new int[0];
|
||||
|
||||
private final Configuration config;
|
||||
private final List<Integer> storageCellDimensionIDs;
|
||||
|
||||
DimensionData( @Nonnull final Configuration parentFile )
|
||||
{
|
||||
Preconditions.checkNotNull( parentFile );
|
||||
|
||||
this.config = parentFile;
|
||||
|
||||
final int[] storageCellIDs = this.storageCellIDsProperty().getIntList();
|
||||
|
||||
this.storageCellDimensionIDs = Lists.newArrayList();
|
||||
for( final int storageCellID : storageCellIDs )
|
||||
{
|
||||
this.storageCellDimensionIDs.add( storageCellID );
|
||||
}
|
||||
}
|
||||
|
||||
private Property storageCellIDsProperty()
|
||||
{
|
||||
return this.config.get( CONFIG_CATEGORY, CONFIG_KEY, STORAGE_CELLS_DEFAULT );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStart()
|
||||
{
|
||||
for( final Integer storageCellDimID : this.storageCellDimensionIDs )
|
||||
{
|
||||
DimensionManager.registerDimension( storageCellDimID, AppEng.instance().getRegistration().getStorageDimensionType() );
|
||||
}
|
||||
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldStop()
|
||||
{
|
||||
this.config.save();
|
||||
|
||||
for( final Integer storageCellDimID : this.storageCellDimensionIDs )
|
||||
{
|
||||
DimensionManager.unregisterDimension( storageCellDimID );
|
||||
}
|
||||
|
||||
this.storageCellDimensionIDs.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStorageCell( final int newStorageCellID )
|
||||
{
|
||||
this.storageCellDimensionIDs.add( newStorageCellID );
|
||||
DimensionManager.registerDimension( newStorageCellID, AppEng.instance().getRegistration().getStorageDimensionType() );
|
||||
|
||||
NetworkHandler.instance().sendToAll( new PacketNewStorageDimension( newStorageCellID ) );
|
||||
|
||||
final String[] values = new String[this.storageCellDimensionIDs.size()];
|
||||
|
||||
for( int x = 0; x < values.length; x++ )
|
||||
{
|
||||
values[x] = String.valueOf( this.storageCellDimensionIDs.get( x ) );
|
||||
}
|
||||
|
||||
this.storageCellIDsProperty().set( values );
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldCoord getStoredSize( final int dim )
|
||||
{
|
||||
final String category = STORAGE_CELL_CATEGORY + dim;
|
||||
|
||||
final int x = this.config.get( category, STORAGE_CELL_SCALE_X_KEY, 0 ).getInt();
|
||||
final int y = this.config.get( category, STORAGE_CELL_SCALE_Y_KEY, 0 ).getInt();
|
||||
final int z = this.config.get( category, STORAGE_CELL_SCALE_Z_KEY, 0 ).getInt();
|
||||
|
||||
return new WorldCoord( x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStoredSize( final int dim, final int targetX, final int targetY, final int targetZ )
|
||||
{
|
||||
final String category = STORAGE_CELL_CATEGORY + dim;
|
||||
|
||||
this.config.get( category, STORAGE_CELL_SCALE_X_KEY, 0 ).set( targetX );
|
||||
this.config.get( category, STORAGE_CELL_SCALE_Y_KEY, 0 ).set( targetY );
|
||||
this.config.get( category, STORAGE_CELL_SCALE_Z_KEY, 0 ).set( targetZ );
|
||||
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToPlayer( @Nullable final NetworkManager manager )
|
||||
{
|
||||
if( manager != null )
|
||||
{
|
||||
for( final int newDim : this.config.get( PACKAGE_DEST_CATEGORY, PACKAGE_KEY_CATEGORY, PACKAGE_DEF_CATEGORY ).getIntList() )
|
||||
{
|
||||
manager.sendPacket( ( new PacketNewStorageDimension( newDim ) ).getProxy() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( final TickHandler.PlayerColor pc : TickHandler.INSTANCE.getPlayerColors().values() )
|
||||
{
|
||||
NetworkHandler.instance().sendToAll( pc.getPacket() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,9 +39,6 @@ public interface IWorldData
|
||||
@Nonnull
|
||||
IWorldPlayerData playerData();
|
||||
|
||||
@Nonnull
|
||||
IWorldDimensionData dimensionData();
|
||||
|
||||
@Nonnull
|
||||
IWorldCompassData compassData();
|
||||
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, 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.core.worlddata;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||
import net.minecraftforge.common.util.INBTSerializable;
|
||||
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.capabilities.Capabilities;
|
||||
|
||||
|
||||
public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable<NBTTagCompound>
|
||||
{
|
||||
private static final String NBT_SPATIAL_DATA_KEY = "spatial_data";
|
||||
private static final String NBT_SPATIAL_ID_KEY = "id";
|
||||
|
||||
private World world;
|
||||
private Map<Integer, StorageCellData> spatialData = new HashMap<>();
|
||||
|
||||
private static final int MAX_CELL_DIMENSION = 512;
|
||||
|
||||
public SpatialDimensionManager( World world )
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return this.world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createNewCellDimension( BlockPos contentSize, int owner )
|
||||
{
|
||||
int newId = this.getNextId();
|
||||
|
||||
StorageCellData data = new StorageCellData();
|
||||
data.contentDimension = contentSize;
|
||||
data.owner = owner;
|
||||
|
||||
this.spatialData.put( newId, data );
|
||||
|
||||
return newId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCellDimension( int cellStorageId )
|
||||
{
|
||||
StorageCellData removed = spatialData.remove( cellStorageId );
|
||||
if( removed != null )
|
||||
{
|
||||
this.clearCellArea( cellStorageId, removed );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellDimension( int cellStorageId )
|
||||
{
|
||||
return this.spatialData.containsKey( cellStorageId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCellDimensionOwner( int cellStorageId )
|
||||
{
|
||||
StorageCellData cell = this.spatialData.get( cellStorageId );
|
||||
if( cell != null )
|
||||
{
|
||||
return cell.owner;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCellDimensionOrigin( int cellStorageId )
|
||||
{
|
||||
if( this.isCellDimension( cellStorageId ) )
|
||||
{
|
||||
return getBlockPosFromId( cellStorageId );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCellContentSize( int cellStorageId )
|
||||
{
|
||||
StorageCellData cell = this.spatialData.get( cellStorageId );
|
||||
if( cell != null )
|
||||
{
|
||||
return cell.contentDimension;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, EnumFacing facing )
|
||||
{
|
||||
return capability == Capabilities.SPATIAL_DIMENSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability( Capability<T> capability, EnumFacing facing )
|
||||
{
|
||||
if( capability == Capabilities.SPATIAL_DIMENSION )
|
||||
{
|
||||
return (T) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT()
|
||||
{
|
||||
final NBTTagCompound ret = new NBTTagCompound();
|
||||
final NBTTagList list = new NBTTagList();
|
||||
|
||||
for( Map.Entry<Integer, StorageCellData> entry : this.spatialData.entrySet() )
|
||||
{
|
||||
final NBTTagCompound nbt = entry.getValue().serializeNBT();
|
||||
nbt.setInteger( NBT_SPATIAL_ID_KEY, entry.getKey() );
|
||||
list.appendTag( nbt );
|
||||
}
|
||||
ret.setTag( NBT_SPATIAL_DATA_KEY, list );
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT( NBTTagCompound nbt )
|
||||
{
|
||||
if( nbt.hasKey( NBT_SPATIAL_DATA_KEY ) )
|
||||
{
|
||||
final NBTTagList list = (NBTTagList) nbt.getTag( NBT_SPATIAL_DATA_KEY );
|
||||
|
||||
this.spatialData.clear();
|
||||
for( int i = 0; i < list.tagCount(); ++i )
|
||||
{
|
||||
final NBTTagCompound entry = list.getCompoundTagAt( i );
|
||||
final StorageCellData data = new StorageCellData();
|
||||
final int id = entry.getInteger( NBT_SPATIAL_ID_KEY );
|
||||
data.deserializeNBT( entry );
|
||||
this.spatialData.put( id, data );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getNextId()
|
||||
{
|
||||
return this.spatialData.keySet().stream().max( Integer::compare ).orElse( -1 ) + 1;
|
||||
}
|
||||
|
||||
private BlockPos getBlockPosFromId( int id )
|
||||
{
|
||||
int signBits = id & 0b11;
|
||||
int offsetBits = id >> 2;
|
||||
int offsetScale = 1;
|
||||
int posx = MAX_CELL_DIMENSION / 2;
|
||||
int posz = MAX_CELL_DIMENSION / 2;
|
||||
|
||||
// find quadrant
|
||||
while( offsetBits != 0 )
|
||||
{
|
||||
posx += MAX_CELL_DIMENSION * offsetScale * ( offsetBits & 0b01 );
|
||||
posz += MAX_CELL_DIMENSION * offsetScale * ( offsetBits >> 1 & 0b01 );
|
||||
|
||||
offsetBits >>= 2;
|
||||
offsetScale <<= 1;
|
||||
}
|
||||
|
||||
// mirror in one of 4 directions
|
||||
if( ( signBits & 0b01 ) == 0 )
|
||||
{
|
||||
posx *= -1;
|
||||
}
|
||||
if( ( signBits & 0b10 ) == 0 )
|
||||
{
|
||||
posz *= -1;
|
||||
}
|
||||
|
||||
// offset from cell center
|
||||
posx -= 64;
|
||||
posz -= 64;
|
||||
|
||||
return new BlockPos( posx, 64, posz );
|
||||
}
|
||||
|
||||
private void clearCellArea( int cellId, StorageCellData cell )
|
||||
{
|
||||
// TODO reset chunks?
|
||||
}
|
||||
|
||||
private static class StorageCellData implements INBTSerializable<NBTTagCompound>
|
||||
{
|
||||
private static final String NBT_OWNER_KEY = "owner";
|
||||
private static final String NBT_DIM_X_KEY = "dim_x";
|
||||
private static final String NBT_DIM_Y_KEY = "dim_y";
|
||||
private static final String NBT_DIM_Z_KEY = "dim_z";
|
||||
|
||||
public BlockPos contentDimension;
|
||||
public int owner;
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setInteger( NBT_DIM_X_KEY, contentDimension.getX() );
|
||||
nbt.setInteger( NBT_DIM_Y_KEY, contentDimension.getY() );
|
||||
nbt.setInteger( NBT_DIM_Z_KEY, contentDimension.getZ() );
|
||||
nbt.setInteger( NBT_OWNER_KEY, owner );
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT( NBTTagCompound nbt )
|
||||
{
|
||||
contentDimension = new BlockPos( nbt.getInteger( NBT_DIM_X_KEY ), nbt.getInteger( NBT_DIM_Y_KEY ), nbt.getInteger( NBT_DIM_Z_KEY ) );
|
||||
owner = nbt.getInteger( NBT_OWNER_KEY );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@ public final class WorldData implements IWorldData
|
||||
private static IWorldData instance;
|
||||
|
||||
private final IWorldPlayerData playerData;
|
||||
private final IWorldDimensionData dimensionData;
|
||||
private final IWorldGridStorageData storageData;
|
||||
private final IWorldCompassData compassData;
|
||||
private final IWorldSpawnData spawnData;
|
||||
@@ -87,7 +86,6 @@ public final class WorldData implements IWorldData
|
||||
this.sharedConfig = new Configuration( settingsFile, AEConfig.VERSION );
|
||||
|
||||
final PlayerData playerData = new PlayerData( this.sharedConfig );
|
||||
final DimensionData dimensionData = new DimensionData( this.sharedConfig );
|
||||
final StorageData storageData = new StorageData( this.sharedConfig );
|
||||
|
||||
final ThreadFactory compassThreadFactory = new CompassThreadFactory();
|
||||
@@ -97,13 +95,12 @@ public final class WorldData implements IWorldData
|
||||
final IWorldSpawnData spawnData = new SpawnData( this.spawnDirectory );
|
||||
|
||||
this.playerData = playerData;
|
||||
this.dimensionData = dimensionData;
|
||||
this.storageData = storageData;
|
||||
this.compassData = compassData;
|
||||
this.spawnData = spawnData;
|
||||
|
||||
this.startables = Lists.<IOnWorldStartable>newArrayList( playerData, dimensionData, storageData );
|
||||
this.stoppables = Lists.<IOnWorldStoppable>newArrayList( playerData, dimensionData, storageData, compassData );
|
||||
this.startables = Lists.<IOnWorldStartable>newArrayList( playerData, storageData );
|
||||
this.stoppables = Lists.<IOnWorldStoppable>newArrayList( playerData, storageData, compassData );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,13 +195,6 @@ public final class WorldData implements IWorldData
|
||||
return this.playerData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldDimensionData dimensionData()
|
||||
{
|
||||
return this.dimensionData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IWorldCompassData compassData()
|
||||
|
||||
@@ -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,54 +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.annotations;
|
||||
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import appeng.integration.IntegrationType;
|
||||
|
||||
|
||||
public @interface Integration
|
||||
{
|
||||
@Retention( RetentionPolicy.RUNTIME )
|
||||
@Target( ElementType.TYPE )
|
||||
@interface InterfaceList
|
||||
{
|
||||
Interface[] value();
|
||||
}
|
||||
|
||||
@Retention( RetentionPolicy.RUNTIME )
|
||||
@Target( ElementType.TYPE )
|
||||
@interface Interface
|
||||
{
|
||||
String iface();
|
||||
|
||||
IntegrationType iname();
|
||||
}
|
||||
|
||||
@Retention( RetentionPolicy.RUNTIME )
|
||||
@Target( ElementType.METHOD )
|
||||
@interface Method
|
||||
{
|
||||
IntegrationType iname();
|
||||
}
|
||||
}
|
||||
@@ -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 )
|
||||
{
|
||||
return (T) handler;
|
||||
return (T) this.handler;
|
||||
}
|
||||
return super.getCapability( capability, facing );
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class TileItemGen extends AEBaseTile
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return simulate ? is.copy() : getNextItem();
|
||||
return simulate ? is.copy() : this.getNextItem();
|
||||
}
|
||||
|
||||
private ItemStack getNextItem()
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class BlockSlabCommon extends BlockSlab
|
||||
|
||||
this.setDefaultState( iblockstate.withProperty( VARIANT, Variant.DEFAULT ) );
|
||||
this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS );
|
||||
this.useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1264,7 +1264,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
||||
{
|
||||
return (T) storage;
|
||||
return (T) this.storage;
|
||||
}
|
||||
else if( capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ public class InvalidPatternHelper
|
||||
|
||||
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++ )
|
||||
@@ -68,7 +68,7 @@ public class InvalidPatternHelper
|
||||
continue;
|
||||
}
|
||||
|
||||
inputs.add( new PatternIngredient( in ) );
|
||||
this.inputs.add( new PatternIngredient( in ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class InvalidPatternHelper
|
||||
{
|
||||
this.stack = new ItemStack( tag );
|
||||
|
||||
if( stack.isEmpty() )
|
||||
if( this.stack.isEmpty() )
|
||||
{
|
||||
this.id = tag.getString( "id" );
|
||||
this.count = tag.getByte( "Count" );
|
||||
@@ -114,39 +114,39 @@ public class InvalidPatternHelper
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return !stack.isEmpty();
|
||||
return !this.stack.isEmpty();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
return isValid() ? stack.getItemDamage() : damage;
|
||||
return this.isValid() ? this.stack.getItemDamage() : this.damage;
|
||||
}
|
||||
|
||||
public int getCount()
|
||||
{
|
||||
return isValid() ? stack.getCount() : count;
|
||||
return this.isValid() ? this.stack.getCount() : this.count;
|
||||
}
|
||||
|
||||
public ItemStack getItem()
|
||||
{
|
||||
if( !isValid() )
|
||||
if( !this.isValid() )
|
||||
{
|
||||
throw new IllegalArgumentException( "There is no valid ItemStack for this PatternIngredient" );
|
||||
}
|
||||
|
||||
return stack;
|
||||
return this.stack;
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
if( this.isCrafting )
|
||||
{
|
||||
this.standardRecipe = Platform.findMatchingRecipe( this.crafting, w );
|
||||
this.standardRecipe = CraftingManager.findMatchingRecipe( this.crafting, w );
|
||||
|
||||
if( this.standardRecipe != null )
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.google.common.collect.LinkedListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
@@ -166,18 +165,6 @@ public class TickHandler
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkLoad( final ChunkEvent.Load load )
|
||||
{
|
||||
for( final Object te : load.getChunk().getTileEntityMap().values() )
|
||||
{
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
( (AEBaseTile) te ).onChunkLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick( final TickEvent ev )
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.integration;
|
||||
|
||||
import appeng.integration.modules.ic2.IC2Module;
|
||||
import appeng.integration.modules.jei.JEIModule;
|
||||
import appeng.integration.modules.rf.RFModule;
|
||||
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
|
||||
import appeng.integration.modules.waila.WailaModule;
|
||||
|
||||
@@ -39,24 +38,6 @@ public enum IntegrationType
|
||||
|
||||
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" ),
|
||||
|
||||
Waila( IntegrationSide.BOTH, "Waila", "waila" )
|
||||
|
||||
@@ -24,7 +24,6 @@ import appeng.integration.abstraction.IInvTweaks;
|
||||
import appeng.integration.abstraction.IJEI;
|
||||
import appeng.integration.abstraction.IMekanism;
|
||||
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 IRF redstoneflux = new IRF.Stub();
|
||||
|
||||
private Integrations()
|
||||
{
|
||||
}
|
||||
@@ -104,10 +101,4 @@ public final class Integrations
|
||||
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.tileentity.TileEntity;
|
||||
|
||||
import ic2.api.item.ElectricItem;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
import appeng.integration.modules.ic2.energy.PoweredItemManager;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
@@ -39,7 +42,11 @@ public class IC2Module implements IIC2
|
||||
public IC2Module()
|
||||
{
|
||||
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.IBackupElectricItemManager.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.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 );
|
||||
}
|
||||
|
||||
ElectricItem.registerBackupManager( new PoweredItemManager() );
|
||||
}
|
||||
|
||||
private ItemStack getItem( final String name, String variant )
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import ic2.api.energy.prefab.BasicSink;
|
||||
import ic2.api.energy.tile.IEnergyEmitter;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
@@ -76,7 +77,7 @@ public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
|
||||
@Override
|
||||
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||
{
|
||||
return PowerUnits.EU.convertTo( PowerUnits.AE, this.powerSink.injectExternalPower( PowerUnits.EU, amount ) );
|
||||
return PowerUnits.EU.convertTo( PowerUnits.AE, this.powerSink.injectExternalPower( PowerUnits.EU, amount, Actionable.MODULATE ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.List;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.CondenserOutput;
|
||||
@@ -44,7 +44,7 @@ import appeng.core.AppEng;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
|
||||
|
||||
class CondenserCategory extends BlankRecipeCategory<CondenserOutputWrapper>
|
||||
class CondenserCategory implements IRecipeCategory<CondenserOutputWrapper>
|
||||
{
|
||||
|
||||
public static final String UID = "appliedenergistics2.condenser";
|
||||
|
||||
@@ -19,19 +19,19 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
class CondenserOutputHandler implements IRecipeHandler<CondenserOutput>
|
||||
class CondenserOutputHandler implements IRecipeWrapperFactory<CondenserOutput>
|
||||
{
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<CondenserOutput> getRecipeClass()
|
||||
{
|
||||
return CondenserOutput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid( CondenserOutput recipe )
|
||||
{
|
||||
return CondenserCategory.UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper( CondenserOutput recipe )
|
||||
{
|
||||
@@ -74,18 +62,4 @@ class CondenserOutputHandler implements IRecipeHandler<CondenserOutput>
|
||||
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 mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
|
||||
|
||||
class CondenserOutputWrapper extends BlankRecipeWrapper
|
||||
class CondenserOutputWrapper implements IRecipeWrapper
|
||||
{
|
||||
private final ItemStack outputItem;
|
||||
|
||||
|
||||
@@ -25,14 +25,13 @@ import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
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.util.ResourceLocation;
|
||||
|
||||
@@ -27,12 +30,11 @@ import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
class GrinderRecipeCategory extends BlankRecipeCategory<GrinderRecipeWrapper>
|
||||
class GrinderRecipeCategory implements IRecipeCategory<GrinderRecipeWrapper>, IRecipeCategoryRegistration
|
||||
{
|
||||
|
||||
public static final String UID = "appliedenergistics2.grinder";
|
||||
@@ -85,4 +87,14 @@ class GrinderRecipeCategory extends BlankRecipeCategory<GrinderRecipeWrapper>
|
||||
|
||||
itemStacks.set( ingredients );
|
||||
}
|
||||
|
||||
@Override public void addRecipeCategories( IRecipeCategory... recipeCategories )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override public IJeiHelpers getJeiHelpers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,36 +19,16 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
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 )
|
||||
{
|
||||
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.List;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
|
||||
|
||||
class GrinderRecipeWrapper extends BlankRecipeWrapper
|
||||
class GrinderRecipeWrapper implements IRecipeWrapper
|
||||
{
|
||||
|
||||
private final IGrinderRecipe recipe;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
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.resources.I18n;
|
||||
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.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
class InscriberRecipeCategory extends BlankRecipeCategory<InscriberRecipeWrapper>
|
||||
class InscriberRecipeCategory implements IRecipeCategory<InscriberRecipeWrapper>
|
||||
{
|
||||
|
||||
private static final int SLOT_INPUT_TOP = 0;
|
||||
|
||||
@@ -19,37 +19,18 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
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
|
||||
public IRecipeWrapper getRecipeWrapper( IInscriberRecipe 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.List;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
|
||||
|
||||
class InscriberRecipeWrapper extends BlankRecipeWrapper
|
||||
class InscriberRecipeWrapper implements IRecipeWrapper
|
||||
{
|
||||
|
||||
private final IInscriberRecipe recipe;
|
||||
|
||||
@@ -23,16 +23,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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.Lists;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -46,17 +49,27 @@ import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
|
||||
|
||||
@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
|
||||
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();
|
||||
|
||||
@@ -120,7 +133,7 @@ public class JEIPlugin extends BlankModPlugin
|
||||
|
||||
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 )
|
||||
@@ -133,10 +146,9 @@ public class JEIPlugin extends BlankModPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
registry.addRecipes( Lists.newArrayList( AEApi.instance().registries().grinder().getRecipes() ) );
|
||||
registry.addRecipeHandlers( new GrinderRecipeHandler() );
|
||||
registry.addRecipeCategories( new GrinderRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
||||
registry.addRecipeCategoryCraftingItem( grindstone, GrinderRecipeCategory.UID );
|
||||
registry.handleRecipes( IGrinderRecipe.class, new GrinderRecipeHandler(), GrinderRecipeCategory.UID );
|
||||
registry.addRecipes( Lists.newArrayList( AEApi.instance().registries().grinder().getRecipes() ), GrinderRecipeCategory.UID );
|
||||
registry.addRecipeCatalyst( grindstone, GrinderRecipeCategory.UID );
|
||||
}
|
||||
|
||||
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 );
|
||||
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 );
|
||||
if( !singularity.isEmpty() )
|
||||
{
|
||||
registry.addRecipes( ImmutableList.of( CondenserOutput.SINGULARITY ) );
|
||||
registry.addRecipes( ImmutableList.of( CondenserOutput.SINGULARITY ), CondenserCategory.UID );
|
||||
}
|
||||
|
||||
if( !matterBall.isEmpty() || !singularity.isEmpty() )
|
||||
{
|
||||
registry.addRecipeCategories( new CondenserCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
||||
registry.addRecipeCategoryCraftingItem( condenser, CondenserCategory.UID );
|
||||
registry.addRecipeHandlers( new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity ) );
|
||||
registry.addRecipeCatalyst( condenser, CondenserCategory.UID );
|
||||
registry.handleRecipes( CondenserOutput.class, new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity) , CondenserCategory.UID );
|
||||
}
|
||||
}
|
||||
|
||||
private void registerInscriberRecipes( IDefinitions definitions, IModRegistry registry )
|
||||
{
|
||||
|
||||
registry.addRecipeHandlers( new InscriberRecipeHandler() );
|
||||
|
||||
registry.addRecipeCategories( new InscriberRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) );
|
||||
registry.handleRecipes( IInscriberRecipe.class, new InscriberRecipeHandler(), InscriberRecipeCategory.UID );
|
||||
|
||||
// Register the inscriber as the crafting item for the inscription category
|
||||
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() );
|
||||
registry.addRecipes( inscriberRecipes );
|
||||
registry.addRecipes( inscriberRecipes, InscriberRecipeCategory.UID );
|
||||
}
|
||||
|
||||
// Handle the generic crafting recipe for patterns in JEI
|
||||
|
||||
@@ -45,12 +45,12 @@ class JeiRuntimeAdapter implements IJEI
|
||||
@Override
|
||||
public String getSearchText()
|
||||
{
|
||||
return Strings.nullToEmpty( this.runtime.getItemListOverlay().getFilterText() );
|
||||
return Strings.nullToEmpty( this.runtime.getIngredientFilter().getFilterText() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchText( String searchText )
|
||||
{
|
||||
this.runtime.getItemListOverlay().setFilterText( Strings.nullToEmpty( searchText ) );
|
||||
this.runtime.getIngredientFilter().setFilterText( Strings.nullToEmpty( searchText ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,13 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
{
|
||||
final NBTTagList tags = new NBTTagList();
|
||||
final List<ItemStack> list = new LinkedList<>();
|
||||
final ItemStack displayed = ingredient.getDisplayedIngredient();
|
||||
|
||||
// prefer currently displayed item
|
||||
if( displayed != null && !displayed.isEmpty() )
|
||||
{
|
||||
list.add( displayed );
|
||||
}
|
||||
|
||||
// prefer pure crystals.
|
||||
for( ItemStack stack : ingredient.getAllIngredients() )
|
||||
|
||||
@@ -19,37 +19,17 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
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
|
||||
public IRecipeWrapper getRecipeWrapper( ShapedRecipe 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 mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
@@ -38,7 +37,7 @@ import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
class ShapedRecipeWrapper extends BlankRecipeWrapper implements IShapedCraftingRecipeWrapper
|
||||
class ShapedRecipeWrapper implements IShapedCraftingRecipeWrapper
|
||||
{
|
||||
|
||||
private final ShapedRecipe recipe;
|
||||
|
||||
@@ -19,37 +19,17 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
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
|
||||
public IRecipeWrapper getRecipeWrapper( ShapelessRecipe 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 mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
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.RegistrationError;
|
||||
@@ -36,7 +35,7 @@ import appeng.api.recipes.IIngredient;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
|
||||
|
||||
class ShapelessRecipeWrapper extends BlankRecipeWrapper implements ICraftingRecipeWrapper
|
||||
class ShapelessRecipeWrapper implements IRecipeWrapper
|
||||
{
|
||||
|
||||
private final ShapelessRecipe recipe;
|
||||
|
||||
@@ -31,7 +31,7 @@ import mcjty.theoneprobe.api.ProbeMode;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.theoneprobe.TheOneProbeText;
|
||||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCable;
|
||||
import appeng.parts.networking.PartDenseCableSmart;
|
||||
|
||||
|
||||
public class ChannelInfoProvider implements IPartProbInfoProvider
|
||||
@@ -40,10 +40,10 @@ public class ChannelInfoProvider implements IPartProbInfoProvider
|
||||
@Override
|
||||
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 maxChannels = ( part instanceof PartDenseCable ) ? 32 : 8;
|
||||
final int maxChannels = ( part instanceof PartDenseCableSmart ) ? 32 : 8;
|
||||
|
||||
if( part.getGridNode().isActive() )
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
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
|
||||
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();
|
||||
|
||||
@@ -83,7 +83,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
|
||||
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 );
|
||||
currentToolTip.add( formattedToolTip );
|
||||
@@ -144,7 +144,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
@Override
|
||||
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();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
inv.markDirty( -1 );
|
||||
this.inv.markDirty( -1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,7 +92,7 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
|
||||
|
||||
public IItemHandler getInternalInventory()
|
||||
{
|
||||
return inv;
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@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( this.ips.extractAEPower( this.target, amt ) );
|
||||
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt, Actionable.MODULATE ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -343,7 +343,16 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user