Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 34597a4e21 | |||
| e0b32d2641 | |||
| 6baf952904 | |||
| f132ae3678 | |||
| 720b38442e | |||
| 136f5d7314 | |||
| a83e4b7c3d | |||
| 1bb0109c45 | |||
| 4744dfab78 | |||
| 7dedd4700f | |||
| 95fb894ba3 | |||
| 621ddc5535 | |||
| ece09a956b | |||
| db5493f60b | |||
| f0482dd391 | |||
| c53b3b5dfc | |||
| ad16550a86 | |||
| 99e4928542 | |||
| 43995a4b32 | |||
| 8ec9bb8b3b | |||
| 18c8197ff4 | |||
| dd1ca1e286 | |||
| c9f0b4e489 | |||
| 63a6037ad2 | |||
| 3675f154d1 | |||
| 5e5be0e192 | |||
| e300bf93fd | |||
| cdf949a557 | |||
| 4c5aeac39f | |||
| a5f58bb22f | |||
| dddfd6dbaf | |||
| 53f448e578 | |||
| 311939c63c | |||
| d8a3556bc3 | |||
| 57e84c3039 | |||
| 1bcf7f9d52 | |||
| 2746002eb1 | |||
| ee6a3def22 | |||
| 0b15c56037 | |||
| 39c26a72e2 | |||
| d2f62ef98c | |||
| 6476a519bb | |||
| b8e2d73aa0 | |||
| 5a2b35ccd0 | |||
| 16218e46ec | |||
| 27b692823c | |||
| 68aaec16bc | |||
| ec8d393403 | |||
| 27e5eac6aa | |||
| ca521935e0 | |||
| f60798129c | |||
| 3e90f354c5 | |||
| a27ed6d9ba | |||
| b18addbf37 | |||
| 3fa501d726 |
@@ -31,7 +31,7 @@ Applied Energistics 2 API is (c) 2013 - 2014 AlgorithmX2 and licensed under MIT.
|
|||||||
Applied Energistics 2 is (c) 2013 - 2014 AlgorithmX2 and licensed under LGPL v3.
|
Applied Energistics 2 is (c) 2013 - 2014 AlgorithmX2 and licensed under LGPL v3.
|
||||||
See the LICENSE.txt for details or go to http://www.gnu.org/licenses/lgpl-3.0.txt for more information.
|
See the LICENSE.txt for details or go to http://www.gnu.org/licenses/lgpl-3.0.txt for more information.
|
||||||
|
|
||||||
Textures and Models are licensed under Creative Commons 3.
|
Textures and Models are licensed under [Creative Commons, Attribution-NonCommercial-ShareAlike 3.0]( https://creativecommons.org/licenses/by-nc-sa/3.0/).
|
||||||
|
|
||||||
## Downloads
|
## Downloads
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ jar {
|
|||||||
minecraft {
|
minecraft {
|
||||||
version = config.minecraft_version + "-" + config.forge_version
|
version = config.minecraft_version + "-" + config.forge_version
|
||||||
|
|
||||||
|
replaceIn "AEConfig.java"
|
||||||
replace "@version@", project.version
|
replace "@version@", project.version
|
||||||
replace "@aechannel@", config.aechannel
|
replace "@aechannel@", config.aechannel
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -8,17 +8,18 @@ archivesBaseName=appliedenergistics2
|
|||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
minecraft_version=1.7.10
|
minecraft_version=1.7.10
|
||||||
forge_version=10.13.2.1230
|
forge_version=10.13.2.1291
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# APIs used for development #
|
# APIs used for development #
|
||||||
#########################################################
|
#########################################################
|
||||||
cb_minecraft_version=1.7.10
|
cb_minecraft_version=1.7.10
|
||||||
fmp_version=1.1.0.311
|
fmp_version=1.1.1.321
|
||||||
code_chicken_lib_version=1.1.1.105
|
code_chicken_lib_version=1.1.1.110
|
||||||
code_chicken_core_version=1.0.4.29
|
code_chicken_core_version=1.0.4.35
|
||||||
nei_version=1.0.3.66
|
nei_version=1.0.4.90
|
||||||
waila_version=1.5.7a_1.7.10
|
waila_version=1.5.9_1.7.10
|
||||||
|
bc_version=6.4.2
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# API Stubs #
|
# API Stubs #
|
||||||
@@ -38,4 +39,3 @@ api_railcraft_version=1
|
|||||||
api_rblocks_version=1
|
api_rblocks_version=1
|
||||||
api_rf_version=2
|
api_rf_version=2
|
||||||
api_rotarycraft_version=1
|
api_rotarycraft_version=1
|
||||||
dev_buildcraft_version=1
|
|
||||||
|
|||||||
@@ -10,25 +10,3 @@ task copyChicken(type: Copy, dependsOn: "extractUserDev") {
|
|||||||
}
|
}
|
||||||
tasks.setupDevWorkspace.dependsOn copyChicken
|
tasks.setupDevWorkspace.dependsOn copyChicken
|
||||||
tasks.setupDecompWorkspace.dependsOn copyChicken
|
tasks.setupDecompWorkspace.dependsOn copyChicken
|
||||||
|
|
||||||
// same for BC hacked file
|
|
||||||
task copyBuildcraft(type: Copy, dependsOn: "extractUserDev") {
|
|
||||||
from { configurations.compile }
|
|
||||||
include "**/*buildcraft*.jar"
|
|
||||||
into file(minecraft.runDir + "/mods")
|
|
||||||
mustRunAfter "deobfBinJar"
|
|
||||||
mustRunAfter "repackMinecraft"
|
|
||||||
}
|
|
||||||
tasks.setupDevWorkspace.dependsOn copyBuildcraft
|
|
||||||
tasks.setupDecompWorkspace.dependsOn copyBuildcraft
|
|
||||||
|
|
||||||
// and for IC2 because it needs its EMLJ jar
|
|
||||||
task copyIndustrialcraft(type: Copy, dependsOn: "extractUserDev") {
|
|
||||||
from { configurations.compile }
|
|
||||||
include "**/*industrialcraft*.jar"
|
|
||||||
into file(minecraft.runDir + "/mods")
|
|
||||||
mustRunAfter "deobfBinJar"
|
|
||||||
mustRunAfter "repackMinecraft"
|
|
||||||
}
|
|
||||||
tasks.setupDevWorkspace.dependsOn copyIndustrialcraft
|
|
||||||
tasks.setupDecompWorkspace.dependsOn copyIndustrialcraft
|
|
||||||
@@ -45,6 +45,8 @@ dependencies {
|
|||||||
|
|
||||||
compile "mcp.mobius.waila:Waila:${config.waila_version}:dev"
|
compile "mcp.mobius.waila:Waila:${config.waila_version}:dev"
|
||||||
|
|
||||||
|
compile "com.mod-buildcraft:buildcraft:${config.bc_version}:dev"
|
||||||
|
|
||||||
compile(group: 'api', name: 'betterstorage', version: "${config.api_betterstorage_version}")
|
compile(group: 'api', name: 'betterstorage', version: "${config.api_betterstorage_version}")
|
||||||
compile(group: 'api', name: 'coloredlightscore', version: "${config.api_coloredlightscore_version}")
|
compile(group: 'api', name: 'coloredlightscore', version: "${config.api_coloredlightscore_version}")
|
||||||
compile(group: 'api', name: 'craftguide', version: "${config.api_craftguide_version}")
|
compile(group: 'api', name: 'craftguide', version: "${config.api_craftguide_version}")
|
||||||
@@ -57,10 +59,6 @@ dependencies {
|
|||||||
compile(group: 'api', name: 'rblocks', version: "${config.api_rblocks_version}")
|
compile(group: 'api', name: 'rblocks', version: "${config.api_rblocks_version}")
|
||||||
compile(group: 'api', name: 'rf', version: "${config.api_rf_version}")
|
compile(group: 'api', name: 'rf', version: "${config.api_rf_version}")
|
||||||
compile(group: 'api', name: 'rotarycraft', version: "${config.api_rotarycraft_version}")
|
compile(group: 'api', name: 'rotarycraft', version: "${config.api_rotarycraft_version}")
|
||||||
compile(group: 'dev', name: 'buildcraft', version: "${config.dev_buildcraft_version}")
|
|
||||||
|
|
||||||
// add hacked buildcraft jar to compile time (for facades)
|
|
||||||
compile fileTree(dir: 'libs', include: '*.jar')
|
|
||||||
|
|
||||||
testCompile "junit:junit:4.11"
|
testCompile "junit:junit:4.11"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,31 @@
|
|||||||
|
|
||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Registry for locatable items, works based on serial numbers.
|
* A Registry for locatable items, works based on serial numbers.
|
||||||
*/
|
*/
|
||||||
public interface ILocatableRegistry
|
public interface ILocatableRegistry
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to find the object with the serial specified, if it can it
|
* Attempts to find the object with the serial specified, if it can it
|
||||||
* returns the object.
|
* returns the object.
|
||||||
*
|
*
|
||||||
* @param serial serial
|
* @param serial serial
|
||||||
|
*
|
||||||
* @return requestedObject, or null
|
* @return requestedObject, or null
|
||||||
|
*
|
||||||
|
* @deprecated use {@link ILocatableRegistry#getLocatableBy(long)}
|
||||||
*/
|
*/
|
||||||
public abstract Object findLocatableBySerial(long serial);
|
@Deprecated
|
||||||
|
Object findLocatableBySerial( long serial );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link ILocatable} with the registered serial, if available
|
||||||
|
*
|
||||||
|
* @param serial serial
|
||||||
|
*
|
||||||
|
* @return requestedObject, or null, if the object does not exist anymore
|
||||||
|
*/
|
||||||
|
ILocatable getLocatableBy( long serial );
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ public class DimensionalCoord extends WorldCoord
|
|||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return this.dimId + "," + super.toString();
|
return "dimension=" + this.dimId + ", " + super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld()
|
public World getWorld()
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class WorldCoord
|
|||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "" + this.x + "," + this.y + "," + this.z;
|
return "x=" + this.x + ", y=" + this.y + ", z=" + this.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ import appeng.api.config.SortOrder;
|
|||||||
import appeng.api.config.ViewItems;
|
import appeng.api.config.ViewItems;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
import appeng.client.gui.widgets.ISortSource;
|
import appeng.client.gui.widgets.ISortSource;
|
||||||
import appeng.container.implementations.ContainerCraftingCPU;
|
import appeng.container.implementations.ContainerCraftingCPU;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -307,13 +309,30 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
|||||||
IAEItemStack pendingStack = this.pending.findPrecise( refStack );
|
IAEItemStack pendingStack = this.pending.findPrecise( refStack );
|
||||||
|
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
|
boolean active = false, scheduled = false;
|
||||||
|
|
||||||
if ( stored != null && stored.getStackSize() > 0 )
|
if ( stored != null && stored.getStackSize() > 0 )
|
||||||
|
{
|
||||||
lines++;
|
lines++;
|
||||||
|
}
|
||||||
if ( activeStack != null && activeStack.getStackSize() > 0 )
|
if ( activeStack != null && activeStack.getStackSize() > 0 )
|
||||||
|
{
|
||||||
lines++;
|
lines++;
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||||
|
{
|
||||||
lines++;
|
lines++;
|
||||||
|
scheduled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
|
||||||
|
{
|
||||||
|
int bgcol = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | 0x5A000000;
|
||||||
|
int startX = (x * (1 + sectionLength) + xo) * 2;
|
||||||
|
int startY = ((y * offY + yo) - 3) * 2;
|
||||||
|
drawRect( startX, startY, startX + (sectionLength * 2), startY + (offY * 2) - 2, bgcol);
|
||||||
|
}
|
||||||
|
|
||||||
int negY = ((lines - 1) * 5) / 2;
|
int negY = ((lines - 1) * 5) / 2;
|
||||||
int downY = 0;
|
int downY = 0;
|
||||||
|
|||||||
@@ -55,9 +55,6 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
|
|
||||||
public static final double TUNNEL_POWER_LOSS = 0.05;
|
public static final double TUNNEL_POWER_LOSS = 0.05;
|
||||||
|
|
||||||
public String latestVersion = VERSION;
|
|
||||||
public long latestTimeStamp = 0;
|
|
||||||
|
|
||||||
public static final String VERSION = "@version@";
|
public static final String VERSION = "@version@";
|
||||||
public static final String CHANNEL = "@aechannel@";
|
public static final String CHANNEL = "@aechannel@";
|
||||||
|
|
||||||
@@ -128,12 +125,13 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
// AE
|
// AE
|
||||||
"CertusQuartz", "Wheat", "Fluix",
|
"CertusQuartz", "Wheat", "Fluix",
|
||||||
// Other Mod Ores
|
// Other Mod Ores
|
||||||
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium" };
|
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium", "Zinc" };
|
||||||
|
|
||||||
public double oreDoublePercentage = 90.0;
|
public double oreDoublePercentage = 90.0;
|
||||||
|
|
||||||
public boolean enableEffects = true;
|
public boolean enableEffects = true;
|
||||||
public boolean useLargeFonts = false;
|
public boolean useLargeFonts = false;
|
||||||
|
public boolean useColoredCraftingStatus;
|
||||||
public final int[] craftByStacks = new int[] { 1, 10, 100, 1000 };
|
public final int[] craftByStacks = new int[] { 1, 10, 100, 1000 };
|
||||||
public final int[] priorityByStacks = new int[] { 1, 10, 100, 1000 };
|
public final int[] priorityByStacks = new int[] { 1, 10, 100, 1000 };
|
||||||
public final int[] levelByStacks = new int[] { 1, 10, 100, 1000 };
|
public final int[] levelByStacks = new int[] { 1, 10, 100, 1000 };
|
||||||
@@ -148,7 +146,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
public boolean disableColoredCableRecipesInNEI = true;
|
public boolean disableColoredCableRecipesInNEI = true;
|
||||||
|
|
||||||
public boolean updatable = false;
|
public boolean updatable = false;
|
||||||
final private File myPath;
|
final private File configFile;
|
||||||
|
|
||||||
public double meteoriteClusterChance = 0.1;
|
public double meteoriteClusterChance = 0.1;
|
||||||
public double meteoriteSpawnChance = 0.3;
|
public double meteoriteSpawnChance = 0.3;
|
||||||
@@ -156,6 +154,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
|
|
||||||
public int craftingCalculationTimePerTick = 5;
|
public int craftingCalculationTimePerTick = 5;
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
|
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
|
||||||
{
|
{
|
||||||
@@ -170,6 +169,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
this.disableColoredCableRecipesInNEI = this.get( "Client", "disableColoredCableRecipesInNEI", true ).getBoolean( true );
|
this.disableColoredCableRecipesInNEI = this.get( "Client", "disableColoredCableRecipesInNEI", true ).getBoolean( true );
|
||||||
this.enableEffects = this.get( "Client", "enableEffects", true ).getBoolean( true );
|
this.enableEffects = this.get( "Client", "enableEffects", true ).getBoolean( true );
|
||||||
this.useLargeFonts = this.get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
|
this.useLargeFonts = this.get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
|
||||||
|
this.useColoredCraftingStatus = this.get( "Client", "useColoredCraftingStatus", true ).getBoolean( true );
|
||||||
|
|
||||||
// load buttons..
|
// load buttons..
|
||||||
for (int btnNum = 0; btnNum < 4; btnNum++)
|
for (int btnNum = 0; btnNum < 4; btnNum++)
|
||||||
@@ -221,22 +221,20 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
|
|
||||||
public String getFilePath()
|
public String getFilePath()
|
||||||
{
|
{
|
||||||
return this.myPath.toString();
|
return this.configFile.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AEConfig(String path) {
|
public AEConfig( File configFile ) {
|
||||||
super( new File( path + "AppliedEnergistics2.cfg" ) );
|
super( configFile );
|
||||||
this.myPath = new File( path + "AppliedEnergistics2.cfg" );
|
this.configFile = configFile;
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register( this );
|
FMLCommonHandler.instance().bus().register( this );
|
||||||
|
|
||||||
final double DEFAULT_BC_EXCHANGE = 5.0;
|
|
||||||
final double DEFAULT_IC2_EXCHANGE = 2.0;
|
final double DEFAULT_IC2_EXCHANGE = 2.0;
|
||||||
final double DEFAULT_RTC_EXCHANGE = 1.0 / 11256.0;
|
final double DEFAULT_RTC_EXCHANGE = 1.0 / 11256.0;
|
||||||
final double DEFAULT_RF_EXCHANGE = 0.5;
|
final double DEFAULT_RF_EXCHANGE = 0.5;
|
||||||
final double DEFAULT_MEKANISM_EXCHANGE = 0.2;
|
final double DEFAULT_MEKANISM_EXCHANGE = 0.2;
|
||||||
|
|
||||||
PowerUnits.MJ.conversionRatio = this.get( "PowerRatios", "BuildCraft", DEFAULT_BC_EXCHANGE ).getDouble( DEFAULT_BC_EXCHANGE );
|
|
||||||
PowerUnits.MK.conversionRatio = this.get( "PowerRatios", "Mekanism", DEFAULT_MEKANISM_EXCHANGE ).getDouble( DEFAULT_MEKANISM_EXCHANGE );
|
PowerUnits.MK.conversionRatio = this.get( "PowerRatios", "Mekanism", DEFAULT_MEKANISM_EXCHANGE ).getDouble( DEFAULT_MEKANISM_EXCHANGE );
|
||||||
PowerUnits.EU.conversionRatio = this.get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE );
|
PowerUnits.EU.conversionRatio = this.get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE );
|
||||||
PowerUnits.WA.conversionRatio = this.get( "PowerRatios", "RotaryCraft", DEFAULT_RTC_EXCHANGE ).getDouble( DEFAULT_RTC_EXCHANGE );
|
PowerUnits.WA.conversionRatio = this.get( "PowerRatios", "RotaryCraft", DEFAULT_RTC_EXCHANGE ).getDouble( DEFAULT_RTC_EXCHANGE );
|
||||||
@@ -337,19 +335,6 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
this.craftingCalculationTimePerTick );
|
this.craftingCalculationTimePerTick );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.isFeatureEnabled( AEFeature.VersionChecker ) )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.latestVersion = this.get( "VersionChecker", "LatestVersion", "" ).getString();
|
|
||||||
this.latestTimeStamp = Long.parseLong( this.get( "VersionChecker", "LatestTimeStamp", "" ).getString() );
|
|
||||||
}
|
|
||||||
catch (NumberFormatException err)
|
|
||||||
{
|
|
||||||
this.latestTimeStamp = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updatable = true;
|
this.updatable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,12 +393,6 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
|||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
if ( this.isFeatureEnabled( AEFeature.VersionChecker ) )
|
|
||||||
{
|
|
||||||
this.get( "VersionChecker", "LatestVersion", this.latestVersion ).set( this.latestVersion );
|
|
||||||
this.get( "VersionChecker", "LatestTimeStamp", "" ).set( Long.toString( this.latestTimeStamp ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( this.isFeatureEnabled( AEFeature.SpatialIO ) )
|
if ( this.isFeatureEnabled( AEFeature.SpatialIO ) )
|
||||||
{
|
{
|
||||||
this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).set( this.storageBiomeID );
|
this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).set( this.storageBiomeID );
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ package appeng.core;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.google.common.base.Stopwatch;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
@@ -37,6 +35,8 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
|
import com.google.common.base.Stopwatch;
|
||||||
|
|
||||||
import appeng.core.crash.CrashEnhancement;
|
import appeng.core.crash.CrashEnhancement;
|
||||||
import appeng.core.crash.CrashInfo;
|
import appeng.core.crash.CrashInfo;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
@@ -47,6 +47,7 @@ import appeng.integration.IntegrationRegistry;
|
|||||||
import appeng.integration.IntegrationType;
|
import appeng.integration.IntegrationType;
|
||||||
import appeng.server.AECommand;
|
import appeng.server.AECommand;
|
||||||
import appeng.services.VersionChecker;
|
import appeng.services.VersionChecker;
|
||||||
|
import appeng.services.version.VersionCheckerConfig;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ public class AppEng
|
|||||||
|
|
||||||
private final IMCHandler imcHandler;
|
private final IMCHandler imcHandler;
|
||||||
|
|
||||||
private String configPath;
|
private File configDirectory;
|
||||||
|
|
||||||
public AppEng()
|
public AppEng()
|
||||||
{
|
{
|
||||||
@@ -81,9 +82,9 @@ public class AppEng
|
|||||||
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.MOD_VERSION ) );
|
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.MOD_VERSION ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConfigPath()
|
public final File getConfigDirectory()
|
||||||
{
|
{
|
||||||
return this.configPath;
|
return this.configDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIntegrationEnabled( IntegrationType integrationName )
|
public boolean isIntegrationEnabled( IntegrationType integrationName )
|
||||||
@@ -104,11 +105,16 @@ public class AppEng
|
|||||||
CommonHelper.proxy.missingCoreMod();
|
CommonHelper.proxy.missingCoreMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
Stopwatch star = Stopwatch.createStarted();
|
Stopwatch watch = Stopwatch.createStarted();
|
||||||
this.configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;
|
this.configDirectory = new File(event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2");
|
||||||
|
|
||||||
AEConfig.instance = new AEConfig( this.configPath );
|
final File configFile = new File( this.configDirectory, "AppliedEnergistics2.cfg");
|
||||||
FacadeConfig.instance = new FacadeConfig( this.configPath );
|
final File facadeFile = new File( this.configDirectory, "Facades.cfg" );
|
||||||
|
final File versionFile = new File( this.configDirectory, "VersionChecker.cfg" );
|
||||||
|
|
||||||
|
AEConfig.instance = new AEConfig( configFile );
|
||||||
|
FacadeConfig.instance = new FacadeConfig( facadeFile );
|
||||||
|
final VersionCheckerConfig versionCheckerConfig = new VersionCheckerConfig( versionFile );
|
||||||
|
|
||||||
AELog.info( "Pre Initialization ( started )" );
|
AELog.info( "Pre Initialization ( started )" );
|
||||||
|
|
||||||
@@ -121,19 +127,23 @@ public class AppEng
|
|||||||
|
|
||||||
Registration.INSTANCE.preInitialize( event );
|
Registration.INSTANCE.preInitialize( event );
|
||||||
|
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
|
if ( versionCheckerConfig.isEnabled() )
|
||||||
{
|
{
|
||||||
AELog.info( "Starting VersionChecker" );
|
final VersionChecker versionChecker = new VersionChecker( versionCheckerConfig );
|
||||||
this.startService( "AE2 VersionChecker", new Thread( new VersionChecker() ) );
|
final Thread versionCheckerThread = new Thread( versionChecker );
|
||||||
|
|
||||||
|
this.startService( "AE2 VersionChecker", versionCheckerThread );
|
||||||
}
|
}
|
||||||
|
|
||||||
AELog.info( "Pre Initialization ( ended after " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
|
AELog.info( "Pre Initialization ( ended after " + watch.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startService( String serviceName, Thread thread )
|
private void startService( String serviceName, Thread thread )
|
||||||
{
|
{
|
||||||
thread.setName( serviceName );
|
thread.setName( serviceName );
|
||||||
thread.setPriority( Thread.MIN_PRIORITY );
|
thread.setPriority( Thread.MIN_PRIORITY );
|
||||||
|
|
||||||
|
AELog.info( "Starting " + serviceName );
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public class FacadeConfig extends Configuration
|
|||||||
public static FacadeConfig instance;
|
public static FacadeConfig instance;
|
||||||
final Pattern replacementPattern;
|
final Pattern replacementPattern;
|
||||||
|
|
||||||
public FacadeConfig(String path) {
|
public FacadeConfig( File facadeFile ) {
|
||||||
super( new File( path + "Facades.cfg" ) );
|
super( facadeFile );
|
||||||
this.replacementPattern = Pattern.compile( "[^a-zA-Z0-9]" );
|
this.replacementPattern = Pattern.compile( "[^a-zA-Z0-9]" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ package appeng.core;
|
|||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
|
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.util.WeightedRandomChestContent;
|
import net.minecraft.util.WeightedRandomChestContent;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
@@ -41,6 +37,10 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.IAppEngApi;
|
import appeng.api.IAppEngApi;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
@@ -546,7 +546,7 @@ public final class Registration
|
|||||||
ItemMultiMaterial.instance.makeUnique();
|
ItemMultiMaterial.instance.makeUnique();
|
||||||
|
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CustomRecipes ) )
|
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CustomRecipes ) )
|
||||||
this.recipeHandler.parseRecipes( new ConfigLoader( AppEng.instance.getConfigPath() ), "index.recipe" );
|
this.recipeHandler.parseRecipes( new ConfigLoader( AppEng.instance.getConfigDirectory() ), "index.recipe" );
|
||||||
else
|
else
|
||||||
this.recipeHandler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" );
|
this.recipeHandler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" );
|
||||||
|
|
||||||
@@ -561,15 +561,6 @@ public final class Registration
|
|||||||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
|
||||||
{
|
|
||||||
ph.registerNewLayer( "appeng.parts.layers.LayerIPowerEmitter", "buildcraft.api.power.IPowerEmitter" );
|
|
||||||
ph.registerNewLayer( "appeng.parts.layers.LayerIPowerReceptor", "buildcraft.api.power.IPowerReceptor" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ6 ) )
|
|
||||||
ph.registerNewLayer( "appeng.parts.layers.LayerIBatteryProvider", "buildcraft.api.mj.IBatteryProvider" );
|
|
||||||
|
|
||||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
|
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
|
||||||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public enum AEFeature
|
|||||||
|
|
||||||
MassCannonBlockDamage("BlockFeatures"), TinyTNTBlockDamage("BlockFeatures"), Facades("Facades"),
|
MassCannonBlockDamage("BlockFeatures"), TinyTNTBlockDamage("BlockFeatures"), Facades("Facades"),
|
||||||
|
|
||||||
VersionChecker("Services"), UnsupportedDeveloperTools("Misc", false), Creative("Misc"),
|
UnsupportedDeveloperTools("Misc", false), Creative("Misc"),
|
||||||
|
|
||||||
GrinderLogging("Misc", false), Logging("Misc"), IntegrationLogging("Misc", false), CustomRecipes("Crafting", false), WebsiteRecipes("Misc", false),
|
GrinderLogging("Misc", false), Logging("Misc"), IntegrationLogging("Misc", false), CustomRecipes("Crafting", false), WebsiteRecipes("Misc", false),
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.core.features.registries;
|
package appeng.core.features.registries;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -37,20 +38,20 @@ import appeng.recipes.ores.IOreListener;
|
|||||||
import appeng.recipes.ores.OreDictionaryHandler;
|
import appeng.recipes.ores.OreDictionaryHandler;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|
||||||
|
public final class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
||||||
{
|
{
|
||||||
|
private final List<IGrinderEntry> recipes;
|
||||||
|
private final Map<ItemStack, String> ores;
|
||||||
|
private final Map<ItemStack, String> ingots;
|
||||||
|
private final Map<String, ItemStack> dusts;
|
||||||
|
|
||||||
public final List<IGrinderEntry> RecipeList;
|
public GrinderRecipeManager()
|
||||||
|
|
||||||
private ItemStack copy(ItemStack is)
|
|
||||||
{
|
{
|
||||||
if ( is != null )
|
this.recipes = new ArrayList<IGrinderEntry>();
|
||||||
return is.copy();
|
this.ores = new HashMap<ItemStack, String>();
|
||||||
return null;
|
this.ingots = new HashMap<ItemStack, String>();
|
||||||
}
|
this.dusts = new HashMap<String, ItemStack>();
|
||||||
|
|
||||||
public GrinderRecipeManager() {
|
|
||||||
this.RecipeList = new ArrayList<IGrinderEntry>();
|
|
||||||
|
|
||||||
this.addOre( "Coal", new ItemStack( Items.coal ) );
|
this.addOre( "Coal", new ItemStack( Items.coal ) );
|
||||||
this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) );
|
this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) );
|
||||||
@@ -78,20 +79,11 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||||||
public List<IGrinderEntry> getRecipes()
|
public List<IGrinderEntry> getRecipes()
|
||||||
{
|
{
|
||||||
this.log( "API - getRecipes" );
|
this.log( "API - getRecipes" );
|
||||||
return this.RecipeList;
|
return this.recipes;
|
||||||
}
|
|
||||||
|
|
||||||
private void injectRecipe(AppEngGrinderRecipe appEngGrinderRecipe)
|
|
||||||
{
|
|
||||||
for (IGrinderEntry gr : this.RecipeList)
|
|
||||||
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.RecipeList.add( appEngGrinderRecipe );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRecipe(ItemStack in, ItemStack out, int cost)
|
public void addRecipe( ItemStack in, ItemStack out, int cost )
|
||||||
{
|
{
|
||||||
if ( in == null || out == null )
|
if ( in == null || out == null )
|
||||||
{
|
{
|
||||||
@@ -104,40 +96,54 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, int cost)
|
public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, int cost )
|
||||||
{
|
{
|
||||||
if ( in == null || (optional == null && out == null) )
|
if ( in == null || ( optional == null && out == null ) )
|
||||||
{
|
{
|
||||||
this.log( "Invalid Grinder Recipe Specified." );
|
this.log( "Invalid Grinder Recipe Specified." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
|
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||||
+ Platform.getItemDisplayName( optional ) + " for " + cost );
|
|
||||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost)
|
public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost )
|
||||||
{
|
{
|
||||||
if ( in == null || (optional == null && out == null && optional2 == null) )
|
if ( in == null || ( optional == null && out == null && optional2 == null ) )
|
||||||
{
|
{
|
||||||
this.log( "Invalid Grinder Recipe Specified." );
|
this.log( "Invalid Grinder Recipe Specified." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
|
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||||
+ Platform.getItemDisplayName( optional ) + " for " + cost );
|
|
||||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void injectRecipe( AppEngGrinderRecipe appEngGrinderRecipe )
|
||||||
|
{
|
||||||
|
for ( IGrinderEntry gr : this.recipes )
|
||||||
|
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.recipes.add( appEngGrinderRecipe );
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack copy( ItemStack is )
|
||||||
|
{
|
||||||
|
if ( is != null )
|
||||||
|
return is.copy();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IGrinderEntry getRecipeForInput(ItemStack input)
|
public IGrinderEntry getRecipeForInput( ItemStack input )
|
||||||
{
|
{
|
||||||
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
|
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
|
||||||
if ( input != null )
|
if ( input != null )
|
||||||
{
|
{
|
||||||
for (IGrinderEntry r : this.RecipeList)
|
for ( IGrinderEntry r : this.recipes )
|
||||||
{
|
{
|
||||||
if ( Platform.isSameItem( input, r.getInput() ) )
|
if ( Platform.isSameItem( input, r.getInput() ) )
|
||||||
{
|
{
|
||||||
@@ -152,12 +158,12 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(String o)
|
public void log( String o )
|
||||||
{
|
{
|
||||||
AELog.grinder( o );
|
AELog.grinder( o );
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDustToOreRatio(String name)
|
private int getDustToOreRatio( String name )
|
||||||
{
|
{
|
||||||
if ( name.equals( "Obsidian" ) )
|
if ( name.equals( "Obsidian" ) )
|
||||||
return 1;
|
return 1;
|
||||||
@@ -168,52 +174,48 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
|
private void addOre( String name, ItemStack item )
|
||||||
public final Map<ItemStack, String> Ingots = new HashMap<ItemStack, String>();
|
|
||||||
public final Map<String, ItemStack> Dusts = new HashMap<String, ItemStack>();
|
|
||||||
|
|
||||||
private void addOre(String name, ItemStack item)
|
|
||||||
{
|
{
|
||||||
if ( item == null )
|
if ( item == null )
|
||||||
return;
|
return;
|
||||||
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
|
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||||
|
|
||||||
this.Ores.put( item, name );
|
this.ores.put( item, name );
|
||||||
|
|
||||||
if ( this.Dusts.containsKey( name ) )
|
if ( this.dusts.containsKey( name ) )
|
||||||
{
|
{
|
||||||
ItemStack is = this.Dusts.get( name ).copy();
|
ItemStack is = this.dusts.get( name ).copy();
|
||||||
int ratio = this.getDustToOreRatio( name );
|
int ratio = this.getDustToOreRatio( name );
|
||||||
if ( ratio > 1 )
|
if ( ratio > 1 )
|
||||||
{
|
{
|
||||||
ItemStack extra = is.copy();
|
ItemStack extra = is.copy();
|
||||||
extra.stackSize = ratio - 1;
|
extra.stackSize = ratio - 1;
|
||||||
this.addRecipe( item, is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 );
|
this.addRecipe( item, is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.addRecipe( item, is, 8 );
|
this.addRecipe( item, is, 8 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addIngot(String name, ItemStack item)
|
private void addIngot( String name, ItemStack item )
|
||||||
{
|
{
|
||||||
if ( item == null )
|
if ( item == null )
|
||||||
return;
|
return;
|
||||||
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
|
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||||
|
|
||||||
this.Ingots.put( item, name );
|
this.ingots.put( item, name );
|
||||||
|
|
||||||
if ( this.Dusts.containsKey( name ) )
|
if ( this.dusts.containsKey( name ) )
|
||||||
{
|
{
|
||||||
this.addRecipe( item, this.Dusts.get( name ), 4 );
|
this.addRecipe( item, this.dusts.get( name ), 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDust(String name, ItemStack item)
|
private void addDust( String name, ItemStack item )
|
||||||
{
|
{
|
||||||
if ( item == null )
|
if ( item == null )
|
||||||
return;
|
return;
|
||||||
if ( this.Dusts.containsKey( name ) )
|
if ( this.dusts.containsKey( name ) )
|
||||||
{
|
{
|
||||||
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||||
return;
|
return;
|
||||||
@@ -221,9 +223,9 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||||||
|
|
||||||
this.log( "Adding Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
this.log( "Adding Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||||
|
|
||||||
this.Dusts.put( name, item );
|
this.dusts.put( name, item );
|
||||||
|
|
||||||
for (Entry<ItemStack, String> d : this.Ores.entrySet())
|
for ( Entry<ItemStack, String> d : this.ores.entrySet() )
|
||||||
if ( name.equals( d.getValue() ) )
|
if ( name.equals( d.getValue() ) )
|
||||||
{
|
{
|
||||||
ItemStack is = item.copy();
|
ItemStack is = item.copy();
|
||||||
@@ -233,23 +235,23 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||||||
{
|
{
|
||||||
ItemStack extra = is.copy();
|
ItemStack extra = is.copy();
|
||||||
extra.stackSize = ratio - 1;
|
extra.stackSize = ratio - 1;
|
||||||
this.addRecipe( d.getKey(), is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 );
|
this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.addRecipe( d.getKey(), is, 8 );
|
this.addRecipe( d.getKey(), is, 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<ItemStack, String> d : this.Ingots.entrySet())
|
for ( Entry<ItemStack, String> d : this.ingots.entrySet() )
|
||||||
if ( name.equals( d.getValue() ) )
|
if ( name.equals( d.getValue() ) )
|
||||||
this.addRecipe( d.getKey(), item, 4 );
|
this.addRecipe( d.getKey(), item, 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void oreRegistered(String name, ItemStack item)
|
public void oreRegistered( String name, ItemStack item )
|
||||||
{
|
{
|
||||||
if ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) )
|
if ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) )
|
||||||
{
|
{
|
||||||
for (String ore : AEConfig.instance.grinderOres)
|
for ( String ore : AEConfig.instance.grinderOres )
|
||||||
{
|
{
|
||||||
if ( name.equals( "ore" + ore ) )
|
if ( name.equals( "ore" + ore ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
package appeng.core.features.registries;
|
package appeng.core.features.registries;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
@@ -30,13 +32,19 @@ import appeng.api.features.ILocatable;
|
|||||||
import appeng.api.features.ILocatableRegistry;
|
import appeng.api.features.ILocatableRegistry;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class LocatableRegistry implements ILocatableRegistry
|
|
||||||
{
|
|
||||||
|
|
||||||
private final HashMap<Long, ILocatable> set;
|
public final class LocatableRegistry implements ILocatableRegistry
|
||||||
|
{
|
||||||
|
private final Map<Long, ILocatable> set;
|
||||||
|
|
||||||
|
public LocatableRegistry()
|
||||||
|
{
|
||||||
|
this.set = new HashMap<Long, ILocatable>();
|
||||||
|
MinecraftForge.EVENT_BUS.register( this );
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void updateLocatable(LocatableEventAnnounce e)
|
public void updateLocatable( LocatableEventAnnounce e )
|
||||||
{
|
{
|
||||||
if ( Platform.isClient() )
|
if ( Platform.isClient() )
|
||||||
return; // IGNORE!
|
return; // IGNORE!
|
||||||
@@ -51,18 +59,18 @@ public class LocatableRegistry implements ILocatableRegistry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocatableRegistry() {
|
|
||||||
this.set = new HashMap<Long, ILocatable>();
|
|
||||||
MinecraftForge.EVENT_BUS.register( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a locate-able object by its serial.
|
* Find a locate-able object by its serial.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object findLocatableBySerial(long ser)
|
public Object findLocatableBySerial( long ser )
|
||||||
{
|
{
|
||||||
return this.set.get( ser );
|
return this.set.get( ser );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILocatable getLocatableBy( long serial )
|
||||||
|
{
|
||||||
|
return this.set.get( serial );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,24 +18,25 @@
|
|||||||
|
|
||||||
package appeng.core.features.registries;
|
package appeng.core.features.registries;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.features.ILocatable;
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.features.IWirelessTermRegistry;
|
import appeng.api.features.IWirelessTermRegistry;
|
||||||
import appeng.core.localization.PlayerMessages;
|
import appeng.core.localization.PlayerMessages;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class WirelessRegistry implements IWirelessTermRegistry
|
public final class WirelessRegistry implements IWirelessTermRegistry
|
||||||
{
|
{
|
||||||
|
private final List<IWirelessTermHandler> handlers;
|
||||||
final List<IWirelessTermHandler> handlers;
|
|
||||||
|
|
||||||
public WirelessRegistry() {
|
public WirelessRegistry() {
|
||||||
this.handlers = new ArrayList<IWirelessTermHandler>();
|
this.handlers = new ArrayList<IWirelessTermHandler>();
|
||||||
@@ -76,10 +77,25 @@ public class WirelessRegistry implements IWirelessTermRegistry
|
|||||||
if ( Platform.isClient() )
|
if ( Platform.isClient() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IWirelessTermHandler handler = this.getWirelessTerminalHandler( item );
|
if ( !this.isWirelessTerminal( item ) )
|
||||||
if ( handler == null )
|
|
||||||
{
|
{
|
||||||
player.addChatMessage( new ChatComponentText( "Item is not a wireless terminal." ) );
|
player.addChatMessage( PlayerMessages.DeviceNotWirelessTerminal.get() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final IWirelessTermHandler handler = this.getWirelessTerminalHandler( item );
|
||||||
|
final String unparsedKey = handler.getEncryptionKey( item );
|
||||||
|
if ( unparsedKey.length() == 0 )
|
||||||
|
{
|
||||||
|
player.addChatMessage( PlayerMessages.DeviceNotLinked.get() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final long parsedKey = Long.parseLong( unparsedKey );
|
||||||
|
final ILocatable securityStation = AEApi.instance().registries().locatable().getLocatableBy( parsedKey );
|
||||||
|
if ( securityStation == null )
|
||||||
|
{
|
||||||
|
player.addChatMessage( PlayerMessages.StationCanNotBeLocated.get() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ public enum PlayerMessages
|
|||||||
{
|
{
|
||||||
ChestCannotReadStorageCell, InvalidMachine, LoadedSettings, SavedSettings, MachineNotPowered,
|
ChestCannotReadStorageCell, InvalidMachine, LoadedSettings, SavedSettings, MachineNotPowered,
|
||||||
|
|
||||||
isNowLocked, isNowUnlocked, AmmoDepleted, CommunicationError, OutOfRange, DeviceNotPowered, SettingCleared;
|
isNowLocked, isNowUnlocked,
|
||||||
|
AmmoDepleted,
|
||||||
|
CommunicationError, OutOfRange, DeviceNotPowered, DeviceNotWirelessTerminal, DeviceNotLinked, StationCanNotBeLocated,
|
||||||
|
SettingCleared,;
|
||||||
|
|
||||||
String getName()
|
String getName()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import appeng.core.WorldSettings;
|
|||||||
import appeng.core.sync.AppEngPacket;
|
import appeng.core.sync.AppEngPacket;
|
||||||
import appeng.core.sync.network.INetworkInfo;
|
import appeng.core.sync.network.INetworkInfo;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.services.helpers.ICompassCallback;
|
import appeng.services.compass.ICompassCallback;
|
||||||
|
|
||||||
public class PacketCompassRequest extends AppEngPacket implements ICompassCallback
|
public class PacketCompassRequest extends AppEngPacket implements ICompassCallback
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.core.sync.packets;
|
package appeng.core.sync.packets;
|
||||||
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -56,13 +57,14 @@ import appeng.util.Platform;
|
|||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import appeng.util.prioitylist.IPartitionList;
|
import appeng.util.prioitylist.IPartitionList;
|
||||||
|
|
||||||
|
|
||||||
public class PacketNEIRecipe extends AppEngPacket
|
public class PacketNEIRecipe extends AppEngPacket
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack[][] recipe;
|
ItemStack[][] recipe;
|
||||||
|
|
||||||
// automatic.
|
// automatic.
|
||||||
public PacketNEIRecipe(ByteBuf stream) throws IOException
|
public PacketNEIRecipe( ByteBuf stream ) throws IOException
|
||||||
{
|
{
|
||||||
ByteArrayInputStream bytes = new ByteArrayInputStream( stream.array() );
|
ByteArrayInputStream bytes = new ByteArrayInputStream( stream.array() );
|
||||||
bytes.skip( stream.readerIndex() );
|
bytes.skip( stream.readerIndex() );
|
||||||
@@ -70,13 +72,13 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
if ( comp != null )
|
if ( comp != null )
|
||||||
{
|
{
|
||||||
this.recipe = new ItemStack[9][];
|
this.recipe = new ItemStack[9][];
|
||||||
for (int x = 0; x < this.recipe.length; x++)
|
for ( int x = 0; x < this.recipe.length; x++ )
|
||||||
{
|
{
|
||||||
NBTTagList list = comp.getTagList( "#" + x, 10 );
|
NBTTagList list = comp.getTagList( "#" + x, 10 );
|
||||||
if ( list.tagCount() > 0 )
|
if ( list.tagCount() > 0 )
|
||||||
{
|
{
|
||||||
this.recipe[x] = new ItemStack[list.tagCount()];
|
this.recipe[x] = new ItemStack[list.tagCount()];
|
||||||
for (int y = 0; y < list.tagCount(); y++)
|
for ( int y = 0; y < list.tagCount(); y++ )
|
||||||
{
|
{
|
||||||
this.recipe[x][y] = ItemStack.loadItemStackFromNBT( list.getCompoundTagAt( y ) );
|
this.recipe[x][y] = ItemStack.loadItemStackFromNBT( list.getCompoundTagAt( y ) );
|
||||||
}
|
}
|
||||||
@@ -86,14 +88,14 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
|
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
|
||||||
{
|
{
|
||||||
EntityPlayerMP pmp = (EntityPlayerMP) player;
|
EntityPlayerMP pmp = ( EntityPlayerMP ) player;
|
||||||
Container con = pmp.openContainer;
|
Container con = pmp.openContainer;
|
||||||
|
|
||||||
if ( con != null && con instanceof IContainerCraftingPacket )
|
if ( con != null && con instanceof IContainerCraftingPacket )
|
||||||
{
|
{
|
||||||
IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
|
IContainerCraftingPacket cct = ( IContainerCraftingPacket ) con;
|
||||||
IGridNode node = cct.getNetworkNode();
|
IGridNode node = cct.getNetworkNode();
|
||||||
if ( node != null )
|
if ( node != null )
|
||||||
{
|
{
|
||||||
@@ -112,11 +114,11 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
if ( inv != null && this.recipe != null && security != null )
|
if ( inv != null && this.recipe != null && security != null )
|
||||||
{
|
{
|
||||||
InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
InventoryCrafting testInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||||
for (int x = 0; x < 9; x++)
|
for ( int x = 0; x < 9; x++ )
|
||||||
{
|
{
|
||||||
if ( this.recipe[x] != null && this.recipe[x].length > 0 )
|
if ( this.recipe[x] != null && this.recipe[x].length > 0 )
|
||||||
{
|
{
|
||||||
testInv.setInventorySlotContents(x, this.recipe[x][0]);
|
testInv.setInventorySlotContents( x, this.recipe[x][0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,16 +134,16 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
IItemList all = storage.getStorageList();
|
IItemList all = storage.getStorageList();
|
||||||
IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
||||||
|
|
||||||
for (int x = 0; x < craftMatrix.getSizeInventory(); x++)
|
for ( int x = 0; x < craftMatrix.getSizeInventory(); x++ )
|
||||||
{
|
{
|
||||||
ItemStack PatternItem = testInv.getStackInSlot( x );
|
ItemStack PatternItem = testInv.getStackInSlot( x );
|
||||||
|
|
||||||
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
||||||
if ( currentItem != null )
|
if ( currentItem != null )
|
||||||
{
|
{
|
||||||
testInv.setInventorySlotContents(x, currentItem);
|
testInv.setInventorySlotContents( x, currentItem );
|
||||||
ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
|
ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
|
||||||
testInv.setInventorySlotContents(x, PatternItem);
|
testInv.setInventorySlotContents( x, PatternItem );
|
||||||
|
|
||||||
if ( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
|
if ( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
|
||||||
{
|
{
|
||||||
@@ -171,7 +173,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
// TODO see if this code is necessary
|
// TODO see if this code is necessary
|
||||||
if ( whichItem == null )
|
if ( whichItem == null )
|
||||||
{
|
{
|
||||||
for (int y = 0; y < this.recipe[x].length; y++)
|
for ( int y = 0; y < this.recipe[x].length; y++ )
|
||||||
{
|
{
|
||||||
IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
||||||
if ( request != null )
|
if ( request != null )
|
||||||
@@ -191,21 +193,28 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If that doesn't work, grab from the player's inventory
|
// If that doesn't work, grab from the player's inventory
|
||||||
if ( whichItem == null && playerInventory != null ) {
|
if ( whichItem == null && playerInventory != null )
|
||||||
for ( int y = 0; y < playerInventory.getSizeInventory(); y++ )
|
{
|
||||||
|
for ( int y = 0; y < this.recipe[x].length; y++ )
|
||||||
{
|
{
|
||||||
// Put the item in the test inventory, and check if the recipe is satisfied
|
ItemStack playerItemStack = null;
|
||||||
testInv.setInventorySlotContents(x, playerInventory.getStackInSlot(y));
|
for ( int i = 0; i < playerInventory.getSizeInventory(); i++ )
|
||||||
if ( r.matches(testInv, pmp.worldObj) )
|
|
||||||
{
|
{
|
||||||
// Take the item out.
|
// check if the item in slot y matches the required item.
|
||||||
if ( realForFake == Actionable.SIMULATE ) {
|
playerItemStack = playerInventory.getStackInSlot( i );
|
||||||
whichItem = playerInventory.getStackInSlot(y).copy();
|
if ( playerItemStack != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
|
||||||
whichItem.stackSize = 1;
|
{
|
||||||
} else {
|
if ( realForFake == Actionable.SIMULATE )
|
||||||
whichItem = playerInventory.decrStackSize(y, 1);
|
{
|
||||||
|
whichItem = playerInventory.getStackInSlot( i ).copy();
|
||||||
|
whichItem.stackSize = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
whichItem = playerInventory.decrStackSize( i, 1 );
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,7 +231,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// api
|
// api
|
||||||
public PacketNEIRecipe(NBTTagCompound recipe) throws IOException
|
public PacketNEIRecipe( NBTTagCompound recipe ) throws IOException
|
||||||
{
|
{
|
||||||
ByteBuf data = Unpooled.buffer();
|
ByteBuf data = Unpooled.buffer();
|
||||||
|
|
||||||
|
|||||||
@@ -103,23 +103,27 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
|
|
||||||
public static boolean isFacade(ItemStack is)
|
public static boolean isFacade(ItemStack is)
|
||||||
{
|
{
|
||||||
if ( is.getItem() instanceof IFacadeItem )
|
return is.getItem() instanceof IFacadeItem;
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack getTexture()
|
ItemStack getTexture()
|
||||||
{
|
{
|
||||||
if ( this.facade.getItem() instanceof IFacadeItem )
|
final Item maybeFacade = this.facade.getItem();
|
||||||
|
|
||||||
|
// AE Facade
|
||||||
|
if ( maybeFacade instanceof IFacadeItem )
|
||||||
{
|
{
|
||||||
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
|
IFacadeItem facade = (IFacadeItem) maybeFacade;
|
||||||
return fi.getTextureItem( this.facade );
|
|
||||||
|
return facade.getTextureItem( this.facade );
|
||||||
}
|
}
|
||||||
else if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
|
else if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
|
||||||
{
|
{
|
||||||
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
|
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
|
||||||
|
|
||||||
return bc.getTextureForFacade( this.facade );
|
return bc.getTextureForFacade( this.facade );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +137,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
BusRenderHelper instance = (BusRenderHelper) instance2;
|
BusRenderHelper instance = (BusRenderHelper) instance2;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemStack randomItem = this.getTexture();
|
ItemStack randomItem = this.getTexture();
|
||||||
|
|
||||||
RenderBlocksWorkaround rbw = null;
|
RenderBlocksWorkaround rbw = null;
|
||||||
@@ -204,7 +208,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||||
instance.setBounds( 0, 0, 16 - this.getFacadeThickness(), 16, 16, 16 );
|
instance.setBounds( 0, 0, 16 - this.thickness, 16, 16, 16 );
|
||||||
instance.prepareBounds( renderer );
|
instance.prepareBounds( renderer );
|
||||||
|
|
||||||
if ( rbw != null )
|
if ( rbw != null )
|
||||||
@@ -254,26 +258,38 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
else if ( this.side == ForgeDirection.NORTH || this.side == ForgeDirection.SOUTH )
|
else if ( this.side == ForgeDirection.NORTH || this.side == ForgeDirection.SOUTH )
|
||||||
{
|
{
|
||||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMaxY -= this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMinY += this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
instance.renderBlockCurrentBounds( x, y, z, renderer );
|
instance.renderBlockCurrentBounds( x, y, z, renderer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMaxY -= this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMinY += this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
|
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
|
||||||
renderer.renderMaxZ -= this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMaxZ -= this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
|
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
|
||||||
renderer.renderMinZ += this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMinZ += this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
instance.renderBlockCurrentBounds( x, y, z, renderer );
|
instance.renderBlockCurrentBounds( x, y, z, renderer );
|
||||||
}
|
}
|
||||||
@@ -290,10 +306,14 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
else if ( this.side == ForgeDirection.NORTH || this.side == ForgeDirection.SOUTH )
|
else if ( this.side == ForgeDirection.NORTH || this.side == ForgeDirection.SOUTH )
|
||||||
{
|
{
|
||||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMaxY -= this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMinY += this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, 0.0, 1.0, 1.0, 1.0 );
|
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, 0.0, 1.0, 1.0, 1.0 );
|
||||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, busBounds.minX, 1.0, 1.0 );
|
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, busBounds.minX, 1.0, 1.0 );
|
||||||
@@ -303,16 +323,24 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
if ( fc.getFacade( ForgeDirection.UP ) != null )
|
||||||
renderer.renderMaxY -= this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMaxY -= this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
|
||||||
renderer.renderMinY += this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMinY += this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
|
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
|
||||||
renderer.renderMaxZ -= this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMaxZ -= this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
|
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
|
||||||
renderer.renderMinZ += this.getFacadeThickness() / 16.0;
|
{
|
||||||
|
renderer.renderMinZ += this.thickness / 16.0;
|
||||||
|
}
|
||||||
|
|
||||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
|
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
|
||||||
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
|
this.renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
|
||||||
@@ -348,7 +376,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
|
|
||||||
for (ForgeDirection it : ForgeDirection.VALID_DIRECTIONS)
|
for (ForgeDirection it : ForgeDirection.VALID_DIRECTIONS)
|
||||||
{
|
{
|
||||||
if ( !out.contains( it ) && this.alphaDiff( blockAccess.getTileEntity( x + it.offsetX, y + it.offsetY, z + it.offsetZ ), side, facade ) )
|
if ( !out.contains( it ) && this.hasAlphaDiff( blockAccess.getTileEntity( x + it.offsetX, y + it.offsetY, z + it.offsetZ ), side, facade ) )
|
||||||
{
|
{
|
||||||
out.add( it );
|
out.add( it );
|
||||||
}
|
}
|
||||||
@@ -410,7 +438,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean alphaDiff(TileEntity tileEntity, ForgeDirection side, IFacadePart facade)
|
private boolean hasAlphaDiff( TileEntity tileEntity, ForgeDirection side, IFacadePart facade )
|
||||||
{
|
{
|
||||||
if ( tileEntity instanceof IPartHost )
|
if ( tileEntity instanceof IPartHost )
|
||||||
{
|
{
|
||||||
@@ -424,7 +452,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private void renderSegmentBlockCurrentBounds(BusRenderHelper instance, int x, int y, int z, RenderBlocks renderer, double minX, double minY, double minZ,
|
private void renderSegmentBlockCurrentBounds(IPartRenderHelper instance, int x, int y, int z, RenderBlocks renderer, double minX, double minY, double minZ,
|
||||||
double maxX, double maxY, double maxZ)
|
double maxX, double maxY, double maxZ)
|
||||||
{
|
{
|
||||||
double oldMinX = renderer.renderMinX;
|
double oldMinX = renderer.renderMinX;
|
||||||
@@ -516,15 +544,10 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
return this.side;
|
return this.side;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFacadeThickness()
|
|
||||||
{
|
|
||||||
return this.thickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getPrimaryBox()
|
public AxisAlignedBB getPrimaryBox()
|
||||||
{
|
{
|
||||||
return Platform.getPrimaryBox( this.side, this.getFacadeThickness() );
|
return Platform.getPrimaryBox( this.side, this.thickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -548,7 +571,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
@Override
|
@Override
|
||||||
public boolean isBC()
|
public boolean isBC()
|
||||||
{
|
{
|
||||||
return !(this.facade.getItem() instanceof IFacadeItem);
|
return !( this.facade.getItem() instanceof IFacadeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -565,10 +588,8 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
|||||||
|
|
||||||
ItemStack is = this.getTexture();
|
ItemStack is = this.getTexture();
|
||||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||||
if ( !blk.isOpaqueCube() )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return !blk.isOpaqueCube();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
|||||||
public Iterable<Cuboid6> getCollisionBoxes()
|
public Iterable<Cuboid6> getCollisionBoxes()
|
||||||
{
|
{
|
||||||
LinkedList<Cuboid6> l = new LinkedList<Cuboid6>();
|
LinkedList<Cuboid6> l = new LinkedList<Cuboid6>();
|
||||||
for (AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, false ))
|
for (AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, true ))
|
||||||
{
|
{
|
||||||
l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) );
|
l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import appeng.core.AEConfig;
|
|||||||
import appeng.core.WorldSettings;
|
import appeng.core.WorldSettings;
|
||||||
import appeng.core.features.registries.WorldGenRegistry;
|
import appeng.core.features.registries.WorldGenRegistry;
|
||||||
import appeng.helpers.MeteoritePlacer;
|
import appeng.helpers.MeteoritePlacer;
|
||||||
import appeng.services.helpers.ICompassCallback;
|
import appeng.services.compass.ICompassCallback;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
final public class MeteoriteWorldGen implements IWorldGenerator
|
final public class MeteoriteWorldGen implements IWorldGenerator
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.integration.abstraction;
|
package appeng.integration.abstraction;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -28,24 +29,24 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
import appeng.api.parts.IFacadePart;
|
import appeng.api.parts.IFacadePart;
|
||||||
|
|
||||||
|
|
||||||
public interface IBC
|
public interface IBC
|
||||||
{
|
{
|
||||||
|
boolean isWrench( Item eq );
|
||||||
|
|
||||||
boolean isWrench(Item eq);
|
boolean canWrench( Item i, EntityPlayer p, int x, int y, int z );
|
||||||
|
|
||||||
boolean canWrench(Item i, EntityPlayer p, int x, int y, int z);
|
void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z );
|
||||||
|
|
||||||
void wrenchUsed(Item i, EntityPlayer p, int x, int y, int z);
|
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||||
|
|
||||||
boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir);
|
boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
|
||||||
|
|
||||||
boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir);
|
boolean isFacade( ItemStack is );
|
||||||
|
|
||||||
boolean isFacade(ItemStack is);
|
boolean isPipe( TileEntity te, ForgeDirection dir );
|
||||||
|
|
||||||
boolean isPipe(TileEntity te, ForgeDirection dir);
|
void addFacade( ItemStack item );
|
||||||
|
|
||||||
void addFacade(ItemStack item);
|
|
||||||
|
|
||||||
void registerPowerP2P();
|
void registerPowerP2P();
|
||||||
|
|
||||||
@@ -53,12 +54,11 @@ public interface IBC
|
|||||||
|
|
||||||
void registerLiquidsP2P();
|
void registerLiquidsP2P();
|
||||||
|
|
||||||
IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side);
|
IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side );
|
||||||
|
|
||||||
IFacadePart createFacadePart(ItemStack held, ForgeDirection side);
|
IFacadePart createFacadePart( ItemStack held, ForgeDirection side );
|
||||||
|
|
||||||
ItemStack getTextureForFacade(ItemStack facade);
|
ItemStack getTextureForFacade( ItemStack facade );
|
||||||
|
|
||||||
IIcon getFacadeTexture();
|
IIcon getFacadeTexture();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +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.integration.abstraction;
|
|
||||||
|
|
||||||
|
|
||||||
public interface IMJ5
|
|
||||||
{
|
|
||||||
|
|
||||||
Object createPerdition(Object buildCraft);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +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.integration.abstraction;
|
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.mj.IBatteryObject;
|
|
||||||
|
|
||||||
public interface IMJ6
|
|
||||||
{
|
|
||||||
|
|
||||||
IBatteryObject provider(TileEntity te, ForgeDirection side);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,43 +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.integration.abstraction.helpers;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|
||||||
|
|
||||||
import appeng.transformer.annotations.integration.Method;
|
|
||||||
|
|
||||||
public abstract class BaseMJPerdition
|
|
||||||
{
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
public abstract PowerReceiver getPowerReceiver();
|
|
||||||
|
|
||||||
public abstract double useEnergy(double f, double required, boolean b);
|
|
||||||
|
|
||||||
public abstract void addEnergy(float failed);
|
|
||||||
|
|
||||||
public abstract void configure(int i, int j, float f, int k);
|
|
||||||
|
|
||||||
public abstract void writeToNBT(NBTTagCompound tag);
|
|
||||||
|
|
||||||
public abstract void readFromNBT(NBTTagCompound tag);
|
|
||||||
|
|
||||||
public abstract void Tick();
|
|
||||||
}
|
|
||||||
@@ -33,14 +33,15 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
|||||||
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.blueprints.SchematicRegistry;
|
import buildcraft.api.blueprints.BuilderAPI;
|
||||||
|
import buildcraft.api.blueprints.ISchematicRegistry;
|
||||||
|
import buildcraft.api.facades.IFacadeItem;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
|
import buildcraft.api.transport.IInjectable;
|
||||||
import buildcraft.api.transport.IPipeConnection;
|
import buildcraft.api.transport.IPipeConnection;
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
|
||||||
import buildcraft.transport.ItemFacade;
|
import buildcraft.transport.ItemFacade;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.TunnelType;
|
import appeng.api.config.TunnelType;
|
||||||
@@ -49,7 +50,6 @@ import appeng.api.features.IP2PTunnelRegistry;
|
|||||||
import appeng.api.parts.IFacadePart;
|
import appeng.api.parts.IFacadePart;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEItemDefinition;
|
||||||
import appeng.api.util.IOrientableBlock;
|
import appeng.api.util.IOrientableBlock;
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.facade.FacadePart;
|
import appeng.facade.FacadePart;
|
||||||
import appeng.integration.BaseModule;
|
import appeng.integration.BaseModule;
|
||||||
import appeng.integration.abstraction.IBC;
|
import appeng.integration.abstraction.IBC;
|
||||||
@@ -58,7 +58,7 @@ import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
|
|||||||
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
|
||||||
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
import appeng.integration.modules.BCHelpers.BCPipeHandler;
|
||||||
|
|
||||||
public class BC extends BaseModule implements IBC
|
public final class BC extends BaseModule implements IBC
|
||||||
{
|
{
|
||||||
|
|
||||||
public static BC instance;
|
public static BC instance;
|
||||||
@@ -87,17 +87,8 @@ public class BC extends BaseModule implements IBC
|
|||||||
{
|
{
|
||||||
if ( te instanceof IPipeTile )
|
if ( te instanceof IPipeTile )
|
||||||
{
|
{
|
||||||
try
|
final IPipeTile pipeTile = (IPipeTile) te;
|
||||||
{
|
return !pipeTile.hasPipePluggable( dir.getOpposite() );
|
||||||
if ( te instanceof TileGenericPipe )
|
|
||||||
if ( ((TileGenericPipe) te).hasPlug( dir.getOpposite() ) )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (Exception ignored)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -118,15 +109,15 @@ public class BC extends BaseModule implements IBC
|
|||||||
@Override
|
@Override
|
||||||
public boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
|
public boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
|
||||||
{
|
{
|
||||||
if ( is != null && te != null && te instanceof IPipeTile )
|
if ( is != null && te != null && te instanceof IInjectable )
|
||||||
{
|
{
|
||||||
IPipeTile pt = (IPipeTile) te;
|
IInjectable pt = (IInjectable) te;
|
||||||
if ( pt.getPipeType() == PipeType.ITEM )
|
if ( pt.canInjectItems( dir ) )
|
||||||
{
|
{
|
||||||
int amt = pt.injectItem( is, false, dir );
|
int amt = pt.injectItem( is, false, dir, null );
|
||||||
if ( amt == is.stackSize )
|
if ( amt == is.stackSize )
|
||||||
{
|
{
|
||||||
pt.injectItem( is, true, dir );
|
pt.injectItem( is, true, dir, null );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,33 +132,18 @@ public class BC extends BaseModule implements IBC
|
|||||||
if ( is == null )
|
if ( is == null )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try
|
return is.getItem() instanceof IFacadeItem;
|
||||||
{
|
|
||||||
return is.getItem() instanceof ItemFacade && ItemFacade.getType( is ) == ItemFacade.FacadeType.Basic;
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return is.getItem() instanceof ItemFacade && ItemFacade.getType( is ) == ItemFacade.TYPE_BASIC;
|
|
||||||
}
|
|
||||||
catch (Throwable g)
|
|
||||||
{
|
|
||||||
return is.getItem() instanceof ItemFacade;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
|
public boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
|
||||||
{
|
{
|
||||||
|
if ( is != null && te != null && te instanceof IInjectable )
|
||||||
if ( is != null && te != null && te instanceof IPipeTile )
|
|
||||||
{
|
{
|
||||||
IPipeTile pt = (IPipeTile) te;
|
IInjectable pt = (IInjectable) te;
|
||||||
if ( pt.getPipeType() == PipeType.ITEM )
|
if ( pt.canInjectItems( dir ) )
|
||||||
{
|
{
|
||||||
int amt = pt.injectItem( is, false, dir );
|
int amt = pt.injectItem( is, false, dir, null );
|
||||||
if ( amt == is.stackSize )
|
if ( amt == is.stackSize )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -182,15 +158,15 @@ public class BC extends BaseModule implements IBC
|
|||||||
public void registerPowerP2P()
|
public void registerPowerP2P()
|
||||||
{
|
{
|
||||||
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 0 ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 1 ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftEnergy.engineBlock, 1, 2 ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
|
||||||
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.BC_POWER );
|
reg.addNewAttunement( new ItemStack( BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -257,7 +233,7 @@ public class BC extends BaseModule implements IBC
|
|||||||
|
|
||||||
private void initBuilderSupport()
|
private void initBuilderSupport()
|
||||||
{
|
{
|
||||||
SchematicRegistry.declareBlueprintSupport( AppEng.MOD_ID );
|
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
|
||||||
|
|
||||||
Blocks blocks = AEApi.instance().blocks();
|
Blocks blocks = AEApi.instance().blocks();
|
||||||
Block cable = blocks.blockMultiPart.block();
|
Block cable = blocks.blockMultiPart.block();
|
||||||
@@ -272,15 +248,15 @@ public class BC extends BaseModule implements IBC
|
|||||||
Block myBlock = def.block();
|
Block myBlock = def.block();
|
||||||
if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null )
|
if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null )
|
||||||
{
|
{
|
||||||
SchematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
|
||||||
}
|
}
|
||||||
else if ( myBlock == cable )
|
else if ( myBlock == cable )
|
||||||
{
|
{
|
||||||
SchematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
|
||||||
}
|
}
|
||||||
else if ( def.entity() != null )
|
else if ( def.entity() != null )
|
||||||
{
|
{
|
||||||
SchematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,18 +280,10 @@ public class BC extends BaseModule implements IBC
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItemStack fs = ItemFacade.getFacade( blk, meta );
|
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
|
||||||
return new FacadePart( fs, side );
|
final ItemStack facade = ItemFacade.getFacade( state );
|
||||||
}
|
|
||||||
catch (Throwable ignored)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
return new FacadePart( facade, side );
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ItemStack fs = ItemFacade.getStack( blk, meta );
|
|
||||||
return new FacadePart( fs, side );
|
|
||||||
}
|
}
|
||||||
catch (Throwable ignored)
|
catch (Throwable ignored)
|
||||||
{
|
{
|
||||||
@@ -334,30 +302,19 @@ public class BC extends BaseModule implements IBC
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getTextureForFacade(ItemStack facade)
|
public ItemStack getTextureForFacade(ItemStack facade)
|
||||||
{
|
{
|
||||||
try
|
final Item maybeFacadeItem = facade.getItem();
|
||||||
{
|
|
||||||
Block[] blk = ItemFacade.getBlocks( facade );
|
|
||||||
int[] meta = ItemFacade.getMetaValues( facade );
|
|
||||||
if ( blk == null || blk.length < 1 )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if ( blk[0] != null )
|
if ( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem)
|
||||||
return new ItemStack( blk[0], 1, meta[0] );
|
|
||||||
}
|
|
||||||
catch (Throwable ignored)
|
|
||||||
{
|
{
|
||||||
|
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
|
||||||
|
|
||||||
}
|
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
|
||||||
|
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
|
||||||
try
|
|
||||||
{
|
|
||||||
Block blk = ItemFacade.getBlock( facade );
|
|
||||||
if ( blk != null )
|
|
||||||
return new ItemStack( blk, 1, ItemFacade.getMetaData( facade ) );
|
|
||||||
}
|
|
||||||
catch (Throwable ignored)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
if ( blocks.length > 0 && metas.length > 0 )
|
||||||
|
{
|
||||||
|
return new ItemStack( blocks[0], 1, metas[0] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -24,23 +24,23 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.api.blueprints.IBuilderContext;
|
import appeng.api.util.ICommonTile;
|
||||||
import buildcraft.api.blueprints.SchematicTile;
|
|
||||||
|
|
||||||
import appeng.tile.AEBaseTile;
|
import appeng.tile.AEBaseTile;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import buildcraft.api.blueprints.IBuilderContext;
|
||||||
|
import buildcraft.api.blueprints.SchematicTile;
|
||||||
|
|
||||||
public class AEGenericSchematicTile extends SchematicTile
|
public class AEGenericSchematicTile extends SchematicTile
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeRequirementsToBlueprint(IBuilderContext context, int x, int y, int z)
|
public void storeRequirements(IBuilderContext context, int x, int y, int z)
|
||||||
{
|
{
|
||||||
TileEntity tile = context.world().getTileEntity( x, y, z );
|
TileEntity tile = context.world().getTileEntity( x, y, z );
|
||||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||||
if ( tile instanceof AEBaseTile )
|
if ( tile instanceof AEBaseTile )
|
||||||
{
|
{
|
||||||
AEBaseTile tcb = (AEBaseTile) tile;
|
ICommonTile tcb = (AEBaseTile) tile;
|
||||||
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
|
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +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.integration.modules;
|
|
||||||
|
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
|
||||||
|
|
||||||
import appeng.integration.BaseModule;
|
|
||||||
import appeng.integration.abstraction.IMJ5;
|
|
||||||
import appeng.integration.modules.helpers.MJPerdition;
|
|
||||||
|
|
||||||
public class MJ5 extends BaseModule implements IMJ5
|
|
||||||
{
|
|
||||||
|
|
||||||
public static MJ5 instance;
|
|
||||||
|
|
||||||
public MJ5() {
|
|
||||||
this.testClassExistence( IPowerReceptor.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object createPerdition(Object buildCraft)
|
|
||||||
{
|
|
||||||
if ( buildCraft instanceof IPowerReceptor )
|
|
||||||
return new MJPerdition( (IPowerReceptor) buildCraft );
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() throws Throwable
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postInit()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,134 +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.integration.modules;
|
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.mj.IBatteryObject;
|
|
||||||
import buildcraft.api.mj.IBatteryProvider;
|
|
||||||
import buildcraft.api.mj.ISidedBatteryProvider;
|
|
||||||
import buildcraft.api.mj.MjAPI;
|
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|
||||||
import buildcraft.api.power.PowerHandler.Type;
|
|
||||||
|
|
||||||
import appeng.integration.BaseModule;
|
|
||||||
import appeng.integration.abstraction.IMJ6;
|
|
||||||
import appeng.transformer.annotations.integration.Method;
|
|
||||||
|
|
||||||
public class MJ6 extends BaseModule implements IMJ6
|
|
||||||
{
|
|
||||||
|
|
||||||
public static MJ6 instance;
|
|
||||||
|
|
||||||
public MJ6() {
|
|
||||||
this.testClassExistence( IBatteryObject.class );
|
|
||||||
this.testClassExistence( IBatteryProvider.class );
|
|
||||||
this.testClassExistence( ISidedBatteryProvider.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() throws Throwable
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
public IBatteryObject provider(final TileEntity te, final ForgeDirection side)
|
|
||||||
{
|
|
||||||
if ( te instanceof IPowerReceptor )
|
|
||||||
{
|
|
||||||
final IPowerReceptor receptor = (IPowerReceptor) te;
|
|
||||||
final PowerReceiver ph = receptor.getPowerReceiver( side );
|
|
||||||
|
|
||||||
if ( ph == null )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new IBatteryObject() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setEnergyStored(double mj)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double minimumConsumption()
|
|
||||||
{
|
|
||||||
return ph.getMinEnergyReceived();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double maxReceivedPerCycle()
|
|
||||||
{
|
|
||||||
return ph.getMaxEnergyReceived();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double maxCapacity()
|
|
||||||
{
|
|
||||||
return ph.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String kind()
|
|
||||||
{
|
|
||||||
return MjAPI.DEFAULT_POWER_FRAMEWORK;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getEnergyStored()
|
|
||||||
{
|
|
||||||
return ph.getEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getEnergyRequested()
|
|
||||||
{
|
|
||||||
return ph.getMaxEnergyStored() - ph.getEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double addEnergy(double mj, boolean ignoreCycleLimit)
|
|
||||||
{
|
|
||||||
return ph.receiveEnergy( Type.PIPE, mj, side );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double addEnergy(double mj)
|
|
||||||
{
|
|
||||||
return ph.receiveEnergy( Type.PIPE, mj, side );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -43,7 +43,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination)
|
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
|
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
|
||||||
{
|
{
|
||||||
if ( destination == null || destination.canInsert( is ) )
|
if ( destination == null || destination.canInsert( is ) )
|
||||||
{
|
{
|
||||||
@@ -65,15 +65,15 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
if ( target != null )
|
if ( target != null )
|
||||||
{
|
{
|
||||||
ItemStack f = Platform.cloneItemStack( target );
|
ItemStack f = Platform.cloneItemStack( target );
|
||||||
f.stackSize = how_many;
|
f.stackSize = amount;
|
||||||
return this.cs.extractItems( f, how_many );
|
return cs.extractItems( f, amount );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination)
|
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
{
|
{
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
|
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
|
||||||
{
|
{
|
||||||
if ( destination == null || destination.canInsert( is ) )
|
if ( destination == null || destination.canInsert( is ) )
|
||||||
{
|
{
|
||||||
@@ -97,8 +97,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
int cnt = this.cs.getItemCount( target );
|
int cnt = this.cs.getItemCount( target );
|
||||||
if ( cnt == 0 )
|
if ( cnt == 0 )
|
||||||
return null;
|
return null;
|
||||||
if ( cnt > how_many )
|
if ( cnt > amount )
|
||||||
cnt = how_many;
|
cnt = amount;
|
||||||
ItemStack c = target.copy();
|
ItemStack c = target.copy();
|
||||||
c.stackSize = cnt;
|
c.stackSize = cnt;
|
||||||
return c;
|
return c;
|
||||||
@@ -138,7 +138,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
ItemStack target = null;
|
ItemStack target = null;
|
||||||
|
|
||||||
@@ -162,8 +162,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
int cnt = this.cs.getItemCount( target );
|
int cnt = this.cs.getItemCount( target );
|
||||||
if ( cnt == 0 )
|
if ( cnt == 0 )
|
||||||
return null;
|
return null;
|
||||||
if ( cnt > how_many )
|
if ( cnt > amount )
|
||||||
cnt = how_many;
|
cnt = amount;
|
||||||
ItemStack c = target.copy();
|
ItemStack c = target.copy();
|
||||||
c.stackSize = cnt;
|
c.stackSize = cnt;
|
||||||
return c;
|
return c;
|
||||||
@@ -173,17 +173,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack addItems(ItemStack A)
|
public ItemStack addItems(ItemStack toBeAdded )
|
||||||
{
|
{
|
||||||
return this.cs.insertItems( A );
|
return this.cs.insertItems( toBeAdded );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd(ItemStack A)
|
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||||
{
|
{
|
||||||
int items = this.cs.getSpaceForItem( A );
|
int items = this.cs.getSpaceForItem( toBeSimulated );
|
||||||
ItemStack B = Platform.cloneItemStack( A );
|
ItemStack B = Platform.cloneItemStack( toBeSimulated );
|
||||||
if ( A.stackSize <= items )
|
if ( toBeSimulated.stackSize <= items )
|
||||||
return null;
|
return null;
|
||||||
B.stackSize -= items;
|
B.stackSize -= items;
|
||||||
return B;
|
return B;
|
||||||
|
|||||||
@@ -1,25 +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.integration.modules.helpers;
|
|
||||||
|
|
||||||
|
|
||||||
public class MJBattery
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,81 +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.integration.modules.helpers;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
|
||||||
import buildcraft.api.power.PowerHandler;
|
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|
||||||
import buildcraft.api.power.PowerHandler.Type;
|
|
||||||
|
|
||||||
import appeng.integration.abstraction.helpers.BaseMJPerdition;
|
|
||||||
|
|
||||||
public class MJPerdition extends BaseMJPerdition
|
|
||||||
{
|
|
||||||
|
|
||||||
final protected PowerHandler bcPowerHandler;
|
|
||||||
|
|
||||||
public MJPerdition(IPowerReceptor te) {
|
|
||||||
this.bcPowerHandler = new PowerHandler( te, Type.MACHINE );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Tick()
|
|
||||||
{
|
|
||||||
this.bcPowerHandler.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound data)
|
|
||||||
{
|
|
||||||
this.bcPowerHandler.writeToNBT( data, "bcPowerHandler" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound data)
|
|
||||||
{
|
|
||||||
this.bcPowerHandler.readFromNBT( data, "bcPowerHandler" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PowerReceiver getPowerReceiver()
|
|
||||||
{
|
|
||||||
return this.bcPowerHandler.getPowerReceiver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double useEnergy(double min, double max, boolean doUse)
|
|
||||||
{
|
|
||||||
return this.bcPowerHandler.useEnergy( min, max, doUse );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addEnergy(float failed)
|
|
||||||
{
|
|
||||||
this.bcPowerHandler.addEnergy( failed );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configure(int i, int j, float f, int k)
|
|
||||||
{
|
|
||||||
this.bcPowerHandler.configure( i, j, f, k );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.items.parts;
|
package appeng.items.parts;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
@@ -40,7 +41,6 @@ import appeng.parts.networking.PartCableGlass;
|
|||||||
import appeng.parts.networking.PartCableSmart;
|
import appeng.parts.networking.PartCableSmart;
|
||||||
import appeng.parts.networking.PartDenseCable;
|
import appeng.parts.networking.PartDenseCable;
|
||||||
import appeng.parts.networking.PartQuartzFiber;
|
import appeng.parts.networking.PartQuartzFiber;
|
||||||
import appeng.parts.p2p.PartP2PBCPower;
|
|
||||||
import appeng.parts.p2p.PartP2PIC2Power;
|
import appeng.parts.p2p.PartP2PIC2Power;
|
||||||
import appeng.parts.p2p.PartP2PItems;
|
import appeng.parts.p2p.PartP2PItems;
|
||||||
import appeng.parts.p2p.PartP2PLight;
|
import appeng.parts.p2p.PartP2PLight;
|
||||||
@@ -58,86 +58,86 @@ import appeng.parts.reporting.PartSemiDarkMonitor;
|
|||||||
import appeng.parts.reporting.PartStorageMonitor;
|
import appeng.parts.reporting.PartStorageMonitor;
|
||||||
import appeng.parts.reporting.PartTerminal;
|
import appeng.parts.reporting.PartTerminal;
|
||||||
|
|
||||||
|
|
||||||
public enum PartType
|
public enum PartType
|
||||||
{
|
{
|
||||||
InvalidType(-1, AEFeature.Core, null),
|
InvalidType( -1, AEFeature.Core, null ),
|
||||||
|
|
||||||
CableGlass(0, AEFeature.Core, PartCableGlass.class),
|
CableGlass( 0, AEFeature.Core, PartCableGlass.class ),
|
||||||
|
|
||||||
CableCovered(20, AEFeature.Core, PartCableCovered.class),
|
CableCovered( 20, AEFeature.Core, PartCableCovered.class ),
|
||||||
|
|
||||||
CableSmart(40, AEFeature.Channels, PartCableSmart.class),
|
CableSmart( 40, AEFeature.Channels, PartCableSmart.class ),
|
||||||
|
|
||||||
CableDense(60, AEFeature.Channels, PartDenseCable.class),
|
CableDense( 60, AEFeature.Channels, PartDenseCable.class ),
|
||||||
|
|
||||||
ToggleBus(80, AEFeature.Core, PartToggleBus.class),
|
ToggleBus( 80, AEFeature.Core, PartToggleBus.class ),
|
||||||
|
|
||||||
InvertedToggleBus(100, AEFeature.Core, PartInvertedToggleBus.class),
|
InvertedToggleBus( 100, AEFeature.Core, PartInvertedToggleBus.class ),
|
||||||
|
|
||||||
CableAnchor(120, AEFeature.Core, PartCableAnchor.class),
|
CableAnchor( 120, AEFeature.Core, PartCableAnchor.class ),
|
||||||
|
|
||||||
QuartzFiber(140, AEFeature.Core, PartQuartzFiber.class),
|
QuartzFiber( 140, AEFeature.Core, PartQuartzFiber.class ),
|
||||||
|
|
||||||
Monitor(160, AEFeature.Core, PartMonitor.class),
|
Monitor( 160, AEFeature.Core, PartMonitor.class ),
|
||||||
|
|
||||||
SemiDarkMonitor(180, AEFeature.Core, PartSemiDarkMonitor.class),
|
SemiDarkMonitor( 180, AEFeature.Core, PartSemiDarkMonitor.class ),
|
||||||
|
|
||||||
DarkMonitor(200, AEFeature.Core, PartDarkMonitor.class),
|
DarkMonitor( 200, AEFeature.Core, PartDarkMonitor.class ),
|
||||||
|
|
||||||
StorageBus(220, AEFeature.StorageBus, PartStorageBus.class),
|
StorageBus( 220, AEFeature.StorageBus, PartStorageBus.class ),
|
||||||
|
|
||||||
ImportBus(240, AEFeature.ImportBus, PartImportBus.class),
|
ImportBus( 240, AEFeature.ImportBus, PartImportBus.class ),
|
||||||
|
|
||||||
ExportBus(260, AEFeature.ExportBus, PartExportBus.class),
|
ExportBus( 260, AEFeature.ExportBus, PartExportBus.class ),
|
||||||
|
|
||||||
LevelEmitter(280, AEFeature.LevelEmitter, PartLevelEmitter.class),
|
LevelEmitter( 280, AEFeature.LevelEmitter, PartLevelEmitter.class ),
|
||||||
|
|
||||||
AnnihilationPlane(300, AEFeature.AnnihilationPlane, PartAnnihilationPlane.class),
|
AnnihilationPlane( 300, AEFeature.AnnihilationPlane, PartAnnihilationPlane.class ),
|
||||||
|
|
||||||
FormationPlane(320, AEFeature.FormationPlane, PartFormationPlane.class),
|
FormationPlane( 320, AEFeature.FormationPlane, PartFormationPlane.class ),
|
||||||
|
|
||||||
PatternTerminal(340, AEFeature.Patterns, PartPatternTerminal.class),
|
PatternTerminal( 340, AEFeature.Patterns, PartPatternTerminal.class ),
|
||||||
|
|
||||||
CraftingTerminal(360, AEFeature.CraftingTerminal, PartCraftingTerminal.class),
|
CraftingTerminal( 360, AEFeature.CraftingTerminal, PartCraftingTerminal.class ),
|
||||||
|
|
||||||
Terminal(380, AEFeature.Core, PartTerminal.class),
|
Terminal( 380, AEFeature.Core, PartTerminal.class ),
|
||||||
|
|
||||||
StorageMonitor(400, AEFeature.StorageMonitor, PartStorageMonitor.class),
|
StorageMonitor( 400, AEFeature.StorageMonitor, PartStorageMonitor.class ),
|
||||||
|
|
||||||
ConversionMonitor(420, AEFeature.PartConversionMonitor, PartConversionMonitor.class),
|
ConversionMonitor( 420, AEFeature.PartConversionMonitor, PartConversionMonitor.class ),
|
||||||
|
|
||||||
Interface(440, AEFeature.Core, PartInterface.class),
|
Interface( 440, AEFeature.Core, PartInterface.class ),
|
||||||
|
|
||||||
P2PTunnelME(460, AEFeature.P2PTunnelME, PartP2PTunnelME.class, GuiText.METunnel),
|
P2PTunnelME( 460, AEFeature.P2PTunnelME, PartP2PTunnelME.class, GuiText.METunnel ),
|
||||||
|
|
||||||
P2PTunnelRedstone(461, AEFeature.P2PTunnelRedstone, PartP2PRedstone.class, GuiText.RedstoneTunnel),
|
P2PTunnelRedstone( 461, AEFeature.P2PTunnelRedstone, PartP2PRedstone.class, GuiText.RedstoneTunnel ),
|
||||||
|
|
||||||
P2PTunnelItems(462, AEFeature.P2PTunnelItems, PartP2PItems.class, GuiText.ItemTunnel),
|
P2PTunnelItems( 462, AEFeature.P2PTunnelItems, PartP2PItems.class, GuiText.ItemTunnel ),
|
||||||
|
|
||||||
P2PTunnelLiquids(463, AEFeature.P2PTunnelLiquids, PartP2PLiquids.class, GuiText.FluidTunnel),
|
P2PTunnelLiquids( 463, AEFeature.P2PTunnelLiquids, PartP2PLiquids.class, GuiText.FluidTunnel ),
|
||||||
|
|
||||||
P2PTunnelMJ(464, AEFeature.P2PTunnelMJ, PartP2PBCPower.class, GuiText.MJTunnel),
|
P2PTunnelEU( 465, AEFeature.P2PTunnelEU, PartP2PIC2Power.class, GuiText.EUTunnel ),
|
||||||
|
|
||||||
P2PTunnelEU(465, AEFeature.P2PTunnelEU, PartP2PIC2Power.class, GuiText.EUTunnel),
|
P2PTunnelRF( 466, AEFeature.P2PTunnelRF, PartP2PRFPower.class, GuiText.RFTunnel ),
|
||||||
|
|
||||||
P2PTunnelRF(466, AEFeature.P2PTunnelRF, PartP2PRFPower.class, GuiText.RFTunnel),
|
P2PTunnelLight( 467, AEFeature.P2PTunnelLight, PartP2PLight.class, GuiText.LightTunnel ),
|
||||||
|
|
||||||
P2PTunnelLight(467, AEFeature.P2PTunnelLight, PartP2PLight.class, GuiText.LightTunnel),
|
InterfaceTerminal( 480, AEFeature.InterfaceTerminal, PartInterfaceTerminal.class );
|
||||||
|
|
||||||
InterfaceTerminal(480, AEFeature.InterfaceTerminal, PartInterfaceTerminal.class);
|
|
||||||
|
|
||||||
|
public final int baseDamage;
|
||||||
private final EnumSet<AEFeature> features;
|
private final EnumSet<AEFeature> features;
|
||||||
private final Class<? extends IPart> myPart;
|
private final Class<? extends IPart> myPart;
|
||||||
private final GuiText extraName;
|
private final GuiText extraName;
|
||||||
public final int baseDamage;
|
|
||||||
|
|
||||||
public Constructor<? extends IPart> constructor;
|
public Constructor<? extends IPart> constructor;
|
||||||
|
|
||||||
PartType(int baseMetaValue, AEFeature part, Class<? extends IPart> c) {
|
PartType( int baseMetaValue, AEFeature part, Class<? extends IPart> c )
|
||||||
|
{
|
||||||
this( baseMetaValue, part, c, null );
|
this( baseMetaValue, part, c, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
PartType(int baseMetaValue, AEFeature part, Class<? extends IPart> c, GuiText en) {
|
PartType( int baseMetaValue, AEFeature part, Class<? extends IPart> c, GuiText en )
|
||||||
|
{
|
||||||
this.features = EnumSet.of( part );
|
this.features = EnumSet.of( part );
|
||||||
this.myPart = c;
|
this.myPart = c;
|
||||||
this.extraName = en;
|
this.extraName = en;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import appeng.api.networking.IGridConnection;
|
|||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||||
import appeng.api.networking.pathing.IPathingGrid;
|
import appeng.api.networking.pathing.IPathingGrid;
|
||||||
|
import appeng.api.util.DimensionalCoord;
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -38,6 +39,7 @@ import appeng.me.pathfinding.IPathItem;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.ReadOnlyCollection;
|
import appeng.util.ReadOnlyCollection;
|
||||||
|
|
||||||
|
|
||||||
public class GridConnection implements IGridConnection, IPathItem
|
public class GridConnection implements IGridConnection, IPathItem
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -51,17 +53,21 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
|
|
||||||
public int channelData = 0;
|
public int channelData = 0;
|
||||||
|
|
||||||
public GridConnection(IGridNode aNode, IGridNode bNode, ForgeDirection fromAtoB) throws FailedConnection {
|
public GridConnection( IGridNode aNode, IGridNode bNode, ForgeDirection fromAtoB ) throws FailedConnection
|
||||||
|
{
|
||||||
|
|
||||||
GridNode a = (GridNode) aNode;
|
GridNode a = ( GridNode ) aNode;
|
||||||
GridNode b = (GridNode) bNode;
|
GridNode b = ( GridNode ) bNode;
|
||||||
|
|
||||||
if ( Platform.securityCheck( a, b ) )
|
if ( Platform.securityCheck( a, b ) )
|
||||||
{
|
{
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
|
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
|
||||||
{
|
{
|
||||||
AELog.info( "Audit Failed 1: " + a.getGridBlock().getLocation() );
|
final DimensionalCoord aCoordinates = a.getGridBlock().getLocation();
|
||||||
AELog.info( "Audit Failed 2: " + b.getGridBlock().getLocation() );
|
final DimensionalCoord bCoordinates = b.getGridBlock().getLocation();
|
||||||
|
|
||||||
|
AELog.info( "Security audit 1 failed at [%s] belonging to player [id=%d]", aCoordinates.toString(), a.playerID );
|
||||||
|
AELog.info( "Security audit 2 failed at [%s] belonging to player [id=%d]", bCoordinates.toString(), b.playerID );
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FailedConnection();
|
throw new FailedConnection();
|
||||||
@@ -113,7 +119,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
this.sideB.addConnection( this );
|
this.sideB.addConnection( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNetworkABetter(GridNode a, GridNode b)
|
private boolean isNetworkABetter( GridNode a, GridNode b )
|
||||||
{
|
{
|
||||||
return a.getMyGrid().getPriority() > b.getMyGrid().getPriority() || a.getMyGrid().size() > b.getMyGrid().size();
|
return a.getMyGrid().getPriority() > b.getMyGrid().getPriority() || a.getMyGrid().size() > b.getMyGrid().size();
|
||||||
}
|
}
|
||||||
@@ -139,7 +145,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeDirection getDirection(IGridNode side)
|
public ForgeDirection getDirection( IGridNode side )
|
||||||
{
|
{
|
||||||
if ( this.fromAtoB == ForgeDirection.UNKNOWN )
|
if ( this.fromAtoB == ForgeDirection.UNKNOWN )
|
||||||
return this.fromAtoB;
|
return this.fromAtoB;
|
||||||
@@ -157,7 +163,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IGridNode getOtherSide(IGridNode gridNode)
|
public IGridNode getOtherSide( IGridNode gridNode )
|
||||||
{
|
{
|
||||||
if ( gridNode == this.sideA )
|
if ( gridNode == this.sideA )
|
||||||
return this.sideB;
|
return this.sideB;
|
||||||
@@ -176,11 +182,11 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
@Override
|
@Override
|
||||||
public IReadOnlyCollection<IPathItem> getPossibleOptions()
|
public IReadOnlyCollection<IPathItem> getPossibleOptions()
|
||||||
{
|
{
|
||||||
return new ReadOnlyCollection<IPathItem>( Arrays.asList( (IPathItem) this.a(), (IPathItem) this.b() ) );
|
return new ReadOnlyCollection<IPathItem>( Arrays.asList( ( IPathItem ) this.a(), ( IPathItem ) this.b() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementChannelCount(int usedChannels)
|
public void incrementChannelCount( int usedChannels )
|
||||||
{
|
{
|
||||||
this.channelData += usedChannels;
|
this.channelData += usedChannels;
|
||||||
}
|
}
|
||||||
@@ -194,7 +200,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
@Override
|
@Override
|
||||||
public int getUsedChannels()
|
public int getUsedChannels()
|
||||||
{
|
{
|
||||||
return (this.channelData >> 8) & 0xff;
|
return ( this.channelData >> 8 ) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLastUsedChannels()
|
public int getLastUsedChannels()
|
||||||
@@ -211,7 +217,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setControllerRoute(IPathItem fast, boolean zeroOut)
|
public void setControllerRoute( IPathItem fast, boolean zeroOut )
|
||||||
{
|
{
|
||||||
if ( zeroOut )
|
if ( zeroOut )
|
||||||
this.channelData &= ~0xff;
|
this.channelData &= ~0xff;
|
||||||
@@ -230,7 +236,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
{
|
{
|
||||||
if ( this.getUsedChannels() != this.getLastUsedChannels() )
|
if ( this.getUsedChannels() != this.getLastUsedChannels() )
|
||||||
{
|
{
|
||||||
this.channelData = (this.channelData & 0xff);
|
this.channelData = ( this.channelData & 0xff );
|
||||||
this.channelData |= this.channelData << 8;
|
this.channelData |= this.channelData << 8;
|
||||||
|
|
||||||
if ( this.sideA.getInternalGrid() != null )
|
if ( this.sideA.getInternalGrid() != null )
|
||||||
|
|||||||
@@ -481,8 +481,7 @@ public class CellInventory implements ICellInventory
|
|||||||
if ( request == null )
|
if ( request == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ItemStack sharedItem = request.getItemStack();
|
long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
|
||||||
int size = sharedItem.stackSize;
|
|
||||||
|
|
||||||
IAEItemStack Results = null;
|
IAEItemStack Results = null;
|
||||||
|
|
||||||
|
|||||||
@@ -101,14 +101,14 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
|||||||
priorityList.add( AEItemStack.create( is ) );
|
priorityList.add( AEItemStack.create( is ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
this.setWhitelist( hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||||
|
|
||||||
if ( !priorityList.isEmpty() )
|
if ( !priorityList.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( hasFuzzy )
|
if ( hasFuzzy )
|
||||||
this.myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
|
this.setPartitionList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ) );
|
||||||
else
|
else
|
||||||
this.myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
|
this.setPartitionList( new PrecisePriorityList<IAEItemStack>( priorityList ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,19 +116,19 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
|||||||
@Override
|
@Override
|
||||||
public boolean isPreformatted()
|
public boolean isPreformatted()
|
||||||
{
|
{
|
||||||
return ! this.myPartitionList.isEmpty();
|
return ! this.getPartitionList().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFuzzy()
|
public boolean isFuzzy()
|
||||||
{
|
{
|
||||||
return this.myPartitionList instanceof FuzzyPriorityList;
|
return this.getPartitionList() instanceof FuzzyPriorityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IncludeExclude getIncludeExcludeMode()
|
public IncludeExclude getIncludeExcludeMode()
|
||||||
{
|
{
|
||||||
return this.myWhitelist;
|
return this.getWhitelist();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatusForCell()
|
public int getStatusForCell()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.me.storage;
|
package appeng.me.storage;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
@@ -31,6 +32,7 @@ import appeng.api.storage.data.IItemList;
|
|||||||
import appeng.util.prioitylist.DefaultPriorityList;
|
import appeng.util.prioitylist.DefaultPriorityList;
|
||||||
import appeng.util.prioitylist.IPartitionList;
|
import appeng.util.prioitylist.IPartitionList;
|
||||||
|
|
||||||
|
|
||||||
public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
|
public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -38,24 +40,78 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
final protected IMEMonitor<T> monitor;
|
final protected IMEMonitor<T> monitor;
|
||||||
final protected IMEInventoryHandler<T> internal;
|
final protected IMEInventoryHandler<T> internal;
|
||||||
|
|
||||||
public int myPriority = 0;
|
private int myPriority;
|
||||||
public IncludeExclude myWhitelist = IncludeExclude.WHITELIST;
|
private IncludeExclude myWhitelist;
|
||||||
public AccessRestriction myAccess = AccessRestriction.READ_WRITE;
|
private AccessRestriction myAccess;
|
||||||
public IPartitionList<T> myPartitionList = new DefaultPriorityList<T>();
|
private IPartitionList<T> myPartitionList;
|
||||||
|
|
||||||
public MEInventoryHandler(IMEInventory<T> i, StorageChannel channel) {
|
private AccessRestriction cachedAccessRestriction;
|
||||||
|
private boolean hasReadAccess;
|
||||||
|
private boolean hasWriteAccess;
|
||||||
|
|
||||||
|
public MEInventoryHandler( IMEInventory<T> i, StorageChannel channel )
|
||||||
|
{
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
|
||||||
if ( i instanceof IMEInventoryHandler )
|
if ( i instanceof IMEInventoryHandler )
|
||||||
this.internal = (IMEInventoryHandler<T>) i;
|
this.internal = ( IMEInventoryHandler<T> ) i;
|
||||||
else
|
else
|
||||||
this.internal = new MEPassThrough<T>( i, channel );
|
this.internal = new MEPassThrough<T>( i, channel );
|
||||||
|
|
||||||
this.monitor = this.internal instanceof IMEMonitor ? (IMEMonitor<T>) this.internal : null;
|
this.monitor = this.internal instanceof IMEMonitor ? ( IMEMonitor<T> ) this.internal : null;
|
||||||
|
|
||||||
|
this.setPriority( 0 );
|
||||||
|
this.setWhitelist( IncludeExclude.WHITELIST );
|
||||||
|
this.setBaseAccess( AccessRestriction.READ_WRITE );
|
||||||
|
this.setPartitionList( new DefaultPriorityList<T>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T injectItems(T input, Actionable type, BaseActionSource src)
|
public int getPriority()
|
||||||
|
{
|
||||||
|
return this.myPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority( int myPriority )
|
||||||
|
{
|
||||||
|
this.myPriority = myPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IncludeExclude getWhitelist()
|
||||||
|
{
|
||||||
|
return this.myWhitelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWhitelist( IncludeExclude myWhitelist )
|
||||||
|
{
|
||||||
|
this.myWhitelist = myWhitelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccessRestriction getBaseAccess()
|
||||||
|
{
|
||||||
|
return this.myAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseAccess( AccessRestriction myAccess )
|
||||||
|
{
|
||||||
|
this.myAccess = myAccess;
|
||||||
|
this.cachedAccessRestriction = this.myAccess.restrictPermissions( this.internal.getAccess() );
|
||||||
|
this.hasReadAccess = this.getAccess().hasPermission( AccessRestriction.READ );
|
||||||
|
this.hasWriteAccess = this.getAccess().hasPermission( AccessRestriction.WRITE );
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPartitionList<T> getPartitionList()
|
||||||
|
{
|
||||||
|
return this.myPartitionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartitionList( IPartitionList<T> myPartitionList )
|
||||||
|
{
|
||||||
|
this.myPartitionList = myPartitionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T injectItems( T input, Actionable type, BaseActionSource src )
|
||||||
{
|
{
|
||||||
if ( !this.canAccept( input ) )
|
if ( !this.canAccept( input ) )
|
||||||
return input;
|
return input;
|
||||||
@@ -64,18 +120,18 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T extractItems(T request, Actionable type, BaseActionSource src)
|
public T extractItems( T request, Actionable type, BaseActionSource src )
|
||||||
{
|
{
|
||||||
if ( !this.getAccess().hasPermission( AccessRestriction.READ ) )
|
if ( !hasReadAccess )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return this.internal.extractItems( request, type, src );
|
return this.internal.extractItems( request, type, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemList<T> getAvailableItems(IItemList<T> out)
|
public IItemList<T> getAvailableItems( IItemList<T> out )
|
||||||
{
|
{
|
||||||
if ( !this.getAccess().hasPermission( AccessRestriction.READ ) )
|
if ( !hasReadAccess )
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
return this.internal.getAvailableItems( out );
|
return this.internal.getAvailableItems( out );
|
||||||
@@ -90,11 +146,11 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
@Override
|
@Override
|
||||||
public AccessRestriction getAccess()
|
public AccessRestriction getAccess()
|
||||||
{
|
{
|
||||||
return this.myAccess.restrictPermissions( this.internal.getAccess() );
|
return this.cachedAccessRestriction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPrioritized(T input)
|
public boolean isPrioritized( T input )
|
||||||
{
|
{
|
||||||
if ( this.myWhitelist == IncludeExclude.WHITELIST )
|
if ( this.myWhitelist == IncludeExclude.WHITELIST )
|
||||||
return this.myPartitionList.isListed( input ) || this.internal.isPrioritized( input );
|
return this.myPartitionList.isListed( input ) || this.internal.isPrioritized( input );
|
||||||
@@ -102,9 +158,9 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAccept(T input)
|
public boolean canAccept( T input )
|
||||||
{
|
{
|
||||||
if ( !this.getAccess().hasPermission( AccessRestriction.WRITE ) )
|
if ( !hasWriteAccess )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( this.myWhitelist == IncludeExclude.BLACKLIST && this.myPartitionList.isListed( input ) )
|
if ( this.myWhitelist == IncludeExclude.BLACKLIST && this.myPartitionList.isListed( input ) )
|
||||||
@@ -114,12 +170,6 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
return this.myPartitionList.isListed( input ) && this.internal.canAccept( input );
|
return this.myPartitionList.isListed( input ) && this.internal.canAccept( input );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPriority()
|
|
||||||
{
|
|
||||||
return this.myPriority;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSlot()
|
public int getSlot()
|
||||||
{
|
{
|
||||||
@@ -132,7 +182,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean validForPass(int i)
|
public boolean validForPass( int i )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.Iterator;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
@@ -64,7 +65,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
|||||||
public NetworkInventoryHandler(StorageChannel chan, SecurityCache security) {
|
public NetworkInventoryHandler(StorageChannel chan, SecurityCache security) {
|
||||||
this.myChannel = chan;
|
this.myChannel = chan;
|
||||||
this.security = security;
|
this.security = security;
|
||||||
this.priorityInventory = new ConcurrentSkipListMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
|
this.priorityInventory = new TreeMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNewStorage(IMEInventoryHandler<T> h)
|
public void addNewStorage(IMEInventoryHandler<T> h)
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
package appeng.parts.automation;
|
package appeng.parts.automation;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -57,6 +59,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.client.texture.CableBusTextures;
|
import appeng.client.texture.CableBusTextures;
|
||||||
import appeng.core.settings.TickRates;
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||||
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.parts.PartBasicState;
|
import appeng.parts.PartBasicState;
|
||||||
import appeng.server.ServerHelper;
|
import appeng.server.ServerHelper;
|
||||||
@@ -64,17 +67,25 @@ import appeng.util.Platform;
|
|||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable
|
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable, Callable<TickRateModulation>
|
||||||
{
|
{
|
||||||
|
|
||||||
private boolean isAccepting = true;
|
private boolean isAccepting = true;
|
||||||
private final BaseActionSource mySrc = new MachineSource( this );
|
private final BaseActionSource mySrc = new MachineSource( this );
|
||||||
|
private boolean breaking = false;
|
||||||
|
|
||||||
public PartAnnihilationPlane( ItemStack is )
|
public PartAnnihilationPlane( ItemStack is )
|
||||||
{
|
{
|
||||||
super( PartAnnihilationPlane.class, is );
|
super( PartAnnihilationPlane.class, is );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TickRateModulation call() throws Exception
|
||||||
|
{
|
||||||
|
this.breaking = false;
|
||||||
|
return this.breakblock( true );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||||
@@ -233,7 +244,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
this.getHost().markForUpdate();
|
this.getHost().markForUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TickRateModulation breakblock()
|
public TickRateModulation breakblock( boolean modulate )
|
||||||
{
|
{
|
||||||
if ( this.isAccepting() && this.proxy.isActive() )
|
if ( this.isAccepting() && this.proxy.isActive() )
|
||||||
{
|
{
|
||||||
@@ -273,29 +284,34 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
|
|
||||||
if ( hasPower && canStore )
|
if ( hasPower && canStore )
|
||||||
{
|
{
|
||||||
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
if ( modulate )
|
||||||
energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
|
||||||
|
|
||||||
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
|
|
||||||
for ( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
|
|
||||||
{
|
{
|
||||||
if ( ei instanceof EntityItem )
|
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
||||||
{
|
energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||||
final EntityItem entityItem = ( EntityItem ) ei;
|
|
||||||
this.storeEntityItem( entityItem );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( final ItemStack snaggedItem : out )
|
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
|
||||||
|
for ( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
|
||||||
|
{
|
||||||
|
if ( ei instanceof EntityItem )
|
||||||
|
{
|
||||||
|
final EntityItem entityItem = ( EntityItem ) ei;
|
||||||
|
this.storeEntityItem( entityItem );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( final ItemStack snaggedItem : out )
|
||||||
|
{
|
||||||
|
this.storeItemStack( snaggedItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ( this.storeItemStack( snaggedItem ) )
|
this.breaking = true;
|
||||||
{
|
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this );
|
||||||
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TickRateModulation.URGENT;
|
return TickRateModulation.URGENT;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,8 +413,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
@Override
|
@Override
|
||||||
public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall )
|
public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall )
|
||||||
{
|
{
|
||||||
|
if ( this.breaking )
|
||||||
|
{
|
||||||
|
return TickRateModulation.URGENT;
|
||||||
|
}
|
||||||
|
|
||||||
this.isAccepting = true;
|
this.isAccepting = true;
|
||||||
return this.breakblock();
|
return this.breakblock( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -313,9 +313,10 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
|||||||
|
|
||||||
private void updateHandler()
|
private void updateHandler()
|
||||||
{
|
{
|
||||||
this.myHandler.myAccess = AccessRestriction.WRITE;
|
this.myHandler.setBaseAccess( AccessRestriction.WRITE );
|
||||||
this.myHandler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
;
|
||||||
this.myHandler.myPriority = this.priority;
|
this.myHandler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||||
|
this.myHandler.setPriority( this.priority );
|
||||||
|
|
||||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||||
|
|
||||||
@@ -328,9 +329,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||||
this.myHandler.myPartitionList = new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
this.myHandler.setPartitionList( new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
|
||||||
else
|
else
|
||||||
this.myHandler.myPartitionList = new PrecisePriorityList( priorityList );
|
this.myHandler.setPartitionList( new PrecisePriorityList( priorityList ) );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Applied Energistics 2.
|
|
||||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.parts.layers;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.mj.IBatteryObject;
|
|
||||||
import buildcraft.api.mj.ISidedBatteryProvider;
|
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.LayerBase;
|
|
||||||
|
|
||||||
public class LayerIBatteryProvider extends LayerBase implements ISidedBatteryProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBatteryObject getMjBattery(String kind, ForgeDirection direction)
|
|
||||||
{
|
|
||||||
IPart p = this.getPart( direction );
|
|
||||||
|
|
||||||
if ( p instanceof ISidedBatteryProvider )
|
|
||||||
return ((ISidedBatteryProvider) p).getMjBattery( kind, direction );
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Applied Energistics 2.
|
|
||||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.parts.layers;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.power.IPowerEmitter;
|
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.LayerBase;
|
|
||||||
|
|
||||||
public class LayerIPowerEmitter extends LayerBase implements IPowerEmitter
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canEmitPowerFrom(ForgeDirection side)
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( side );
|
|
||||||
if ( part instanceof IPowerEmitter )
|
|
||||||
return ((IPowerEmitter) part).canEmitPowerFrom( side );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Applied Energistics 2.
|
|
||||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.parts.layers;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
|
||||||
import buildcraft.api.power.PowerHandler;
|
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.parts.IPartHost;
|
|
||||||
import appeng.api.parts.LayerBase;
|
|
||||||
|
|
||||||
public class LayerIPowerReceptor extends LayerBase implements IPowerReceptor
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
|
||||||
{
|
|
||||||
IPart part = this.getPart( side );
|
|
||||||
if ( part instanceof IPowerReceptor )
|
|
||||||
return ((IPowerReceptor) part).getPowerReceiver( side );
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doWork(PowerHandler workProvider)
|
|
||||||
{
|
|
||||||
// do nothing, this seems pointless.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public World getWorld()
|
|
||||||
{
|
|
||||||
return ((IPartHost) this).getTile().getWorldObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -319,9 +319,9 @@ public class PartStorageBus
|
|||||||
|
|
||||||
this.handler = new MEInventoryHandler( inv, StorageChannel.ITEMS );
|
this.handler = new MEInventoryHandler( inv, StorageChannel.ITEMS );
|
||||||
|
|
||||||
this.handler.myAccess = ( AccessRestriction ) this.getConfigManager().getSetting( Settings.ACCESS );
|
this.handler.setBaseAccess( ( AccessRestriction ) this.getConfigManager().getSetting( Settings.ACCESS ) );;
|
||||||
this.handler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
|
||||||
this.handler.myPriority = this.priority;
|
this.handler.setPriority( this.priority );
|
||||||
|
|
||||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||||
|
|
||||||
@@ -334,9 +334,9 @@ public class PartStorageBus
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||||
this.handler.myPartitionList = new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
this.handler.setPartitionList( new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
|
||||||
else
|
else
|
||||||
this.handler.myPartitionList = new PrecisePriorityList( priorityList );
|
this.handler.setPartitionList ( new PrecisePriorityList( priorityList ));
|
||||||
|
|
||||||
if ( inv instanceof IMEMonitor )
|
if ( inv instanceof IMEMonitor )
|
||||||
( ( IMEMonitor ) inv ).addListener( this, this.handler );
|
( ( IMEMonitor ) inv ).addListener( this, this.handler );
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,464 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Applied Energistics 2.
|
|
||||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.parts.p2p;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import buildcraft.api.mj.IBatteryObject;
|
|
||||||
import buildcraft.api.mj.ISidedBatteryProvider;
|
|
||||||
import buildcraft.api.mj.MjAPI;
|
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
|
||||||
import buildcraft.api.power.PowerHandler;
|
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|
||||||
import buildcraft.api.power.PowerHandler.Type;
|
|
||||||
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.api.config.TunnelType;
|
|
||||||
import appeng.api.networking.IGridNode;
|
|
||||||
import appeng.api.networking.ticking.IGridTickable;
|
|
||||||
import appeng.api.networking.ticking.TickRateModulation;
|
|
||||||
import appeng.api.networking.ticking.TickingRequest;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.core.settings.TickRates;
|
|
||||||
import appeng.integration.IntegrationType;
|
|
||||||
import appeng.integration.abstraction.IMJ5;
|
|
||||||
import appeng.integration.abstraction.IMJ6;
|
|
||||||
import appeng.integration.abstraction.helpers.BaseMJPerdition;
|
|
||||||
import appeng.me.GridAccessException;
|
|
||||||
import appeng.me.cache.helpers.TunnelCollection;
|
|
||||||
import appeng.transformer.annotations.integration.Interface;
|
|
||||||
import appeng.transformer.annotations.integration.InterfaceList;
|
|
||||||
import appeng.transformer.annotations.integration.Method;
|
|
||||||
|
|
||||||
@InterfaceList(value = { @Interface(iface = "buildcraft.api.mj.ISidedBatteryProvider", iname = "MJ6"),
|
|
||||||
@Interface(iface = "buildcraft.api.mj.IBatteryObject", iname = "MJ6"), @Interface(iface = "buildcraft.api.power.IPowerReceptor", iname = "MJ5"),
|
|
||||||
@Interface(iface = "appeng.api.networking.ticking.IGridTickable", iname = "MJ5") })
|
|
||||||
public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPowerReceptor, ISidedBatteryProvider, IBatteryObject, IGridTickable
|
|
||||||
{
|
|
||||||
|
|
||||||
BaseMJPerdition pp;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TunnelType getTunnelType()
|
|
||||||
{
|
|
||||||
return TunnelType.BC_POWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PartP2PBCPower(ItemStack is) {
|
|
||||||
super( is );
|
|
||||||
|
|
||||||
if ( !AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) && !AppEng.instance.isIntegrationEnabled( IntegrationType.MJ6 ) )
|
|
||||||
throw new RuntimeException( "MJ Not installed!" );
|
|
||||||
|
|
||||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
|
||||||
{
|
|
||||||
this.pp = (BaseMJPerdition) ((IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 )).createPerdition( this );
|
|
||||||
if ( this.pp != null )
|
|
||||||
this.pp.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
public TickingRequest getTickingRequest(IGridNode node)
|
|
||||||
{
|
|
||||||
return new TickingRequest( TickRates.MJTunnel.min, TickRates.MJTunnel.max, false, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
|
||||||
{
|
|
||||||
if ( !this.output && this.proxy.isActive() )
|
|
||||||
{
|
|
||||||
float totalRequiredPower = 0.0f;
|
|
||||||
TunnelCollection<PartP2PBCPower> tunnels;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tunnels = this.getOutputs();
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return TickRateModulation.IDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (PartP2PBCPower o : tunnels)
|
|
||||||
{
|
|
||||||
IPowerReceptor target = o.getPowerTarget();
|
|
||||||
if ( target != null )
|
|
||||||
{
|
|
||||||
PowerReceiver tp = target.getPowerReceiver( this.side.getOpposite() );
|
|
||||||
if ( tp != null )
|
|
||||||
{
|
|
||||||
double request = tp.powerRequest();
|
|
||||||
|
|
||||||
if ( request > tp.getMaxEnergyReceived() )
|
|
||||||
request = tp.getMaxEnergyReceived();
|
|
||||||
|
|
||||||
if ( request > 0.01 && request > tp.getMinEnergyReceived() )
|
|
||||||
{
|
|
||||||
totalRequiredPower += request;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( totalRequiredPower < 0.1 )
|
|
||||||
return TickRateModulation.SLOWER;
|
|
||||||
|
|
||||||
double currentTotal = this.pp.getPowerReceiver().getEnergyStored();
|
|
||||||
if ( currentTotal < 0.01 )
|
|
||||||
return TickRateModulation.SLOWER;
|
|
||||||
|
|
||||||
for (PartP2PBCPower o : tunnels)
|
|
||||||
{
|
|
||||||
IPowerReceptor target = o.getPowerTarget();
|
|
||||||
if ( target != null )
|
|
||||||
{
|
|
||||||
PowerReceiver tp = target.getPowerReceiver( this.side.getOpposite() );
|
|
||||||
if ( tp != null )
|
|
||||||
{
|
|
||||||
double request = tp.powerRequest();
|
|
||||||
|
|
||||||
if ( request > tp.getMaxEnergyReceived() )
|
|
||||||
request = tp.getMaxEnergyReceived();
|
|
||||||
|
|
||||||
if ( request > 0.01 && request > tp.getMinEnergyReceived() )
|
|
||||||
{
|
|
||||||
double toPull = currentTotal * (request / totalRequiredPower);
|
|
||||||
double pulled = this.pp.useEnergy( 0, toPull, true );
|
|
||||||
this.QueueTunnelDrain( PowerUnits.MJ, pulled );
|
|
||||||
|
|
||||||
tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TickRateModulation.FASTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TickRateModulation.SLOWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPowerDrainPerTick()
|
|
||||||
{
|
|
||||||
return 0.5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
private IBatteryObject getTargetBattery()
|
|
||||||
{
|
|
||||||
TileEntity te = this.getWorld().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
|
||||||
if ( te != null )
|
|
||||||
{
|
|
||||||
IBatteryObject bo = MjAPI.getMjBattery( te, MjAPI.DEFAULT_POWER_FRAMEWORK, this.side.getOpposite() );
|
|
||||||
if ( bo != null )
|
|
||||||
return bo;
|
|
||||||
|
|
||||||
return ((IMJ6) AppEng.instance.getIntegration( IntegrationType.MJ6 )).provider( te, this.side.getOpposite() );
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
private IPowerReceptor getPowerTarget()
|
|
||||||
{
|
|
||||||
TileEntity te = this.getWorld().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
|
||||||
if ( te != null )
|
|
||||||
{
|
|
||||||
if ( te instanceof IPowerReceptor )
|
|
||||||
return (IPowerReceptor) te;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound tag)
|
|
||||||
{
|
|
||||||
super.writeToNBT( tag );
|
|
||||||
if ( this.pp != null )
|
|
||||||
this.pp.writeToNBT( tag );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNBT(NBTTagCompound tag)
|
|
||||||
{
|
|
||||||
super.readFromNBT( tag );
|
|
||||||
if ( this.pp != null )
|
|
||||||
this.pp.readFromNBT( tag );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getTypeTexture()
|
|
||||||
{
|
|
||||||
return Blocks.emerald_block.getBlockTextureFromSide( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
public PowerReceiver getPowerReceiver(ForgeDirection side)
|
|
||||||
{
|
|
||||||
return this.pp.getPowerReceiver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
public void doWork(PowerHandler workProvider)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public World getWorld()
|
|
||||||
{
|
|
||||||
return this.tile.getWorldObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public IBatteryObject getMjBattery(String kind, ForgeDirection direction)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double getEnergyRequested()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
double totalRequiredPower = 0.0f;
|
|
||||||
|
|
||||||
for (PartP2PBCPower g : this.getOutputs())
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
totalRequiredPower += o.getEnergyRequested();
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalRequiredPower;
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double addEnergy(double mj)
|
|
||||||
{
|
|
||||||
return this.addEnergyInternal( mj, false, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double addEnergy(double mj, boolean ignoreCycleLimit)
|
|
||||||
{
|
|
||||||
return this.addEnergyInternal( mj, true, ignoreCycleLimit );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
private double addEnergyInternal(double mj, boolean cycleLimitMode, boolean ignoreCycleLimit)
|
|
||||||
{
|
|
||||||
if ( this.output || !this.proxy.isActive() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
double originalInput = mj;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
TunnelCollection<PartP2PBCPower> outs = this.getOutputs();
|
|
||||||
|
|
||||||
double outputs = 0;
|
|
||||||
for (PartP2PBCPower g : outs)
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
{
|
|
||||||
outputs = outputs + 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( outputs < 0.0000001 )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (PartP2PBCPower g : outs)
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
{
|
|
||||||
double fraction = originalInput / outputs;
|
|
||||||
if ( cycleLimitMode )
|
|
||||||
fraction = o.addEnergy( fraction );
|
|
||||||
else
|
|
||||||
fraction = o.addEnergy( fraction, ignoreCycleLimit );
|
|
||||||
mj -= fraction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mj > 0 )
|
|
||||||
{
|
|
||||||
for (PartP2PBCPower g : outs)
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
{
|
|
||||||
if ( cycleLimitMode )
|
|
||||||
mj = mj - o.addEnergy( mj );
|
|
||||||
else
|
|
||||||
mj = mj - o.addEnergy( mj, ignoreCycleLimit );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return originalInput - mj;
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double getEnergyStored()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
double totalRequiredPower = 0.0f;
|
|
||||||
|
|
||||||
for (PartP2PBCPower g : this.getOutputs())
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
totalRequiredPower += o.getEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalRequiredPower;
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public void setEnergyStored(double mj)
|
|
||||||
{
|
|
||||||
// EHh?!
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double maxCapacity()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
double totalRequiredPower = 0.0f;
|
|
||||||
|
|
||||||
for (PartP2PBCPower g : this.getOutputs())
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
totalRequiredPower += o.maxCapacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalRequiredPower;
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double minimumConsumption()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
double totalRequiredPower = 1000000000000.0;
|
|
||||||
|
|
||||||
for (PartP2PBCPower g : this.getOutputs())
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
totalRequiredPower = Math.min( totalRequiredPower, o.minimumConsumption() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalRequiredPower;
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double maxReceivedPerCycle()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
double totalRequiredPower = 1000000.0;
|
|
||||||
|
|
||||||
for (PartP2PBCPower g : this.getOutputs())
|
|
||||||
{
|
|
||||||
IBatteryObject o = g.getTargetBattery();
|
|
||||||
if ( o != null )
|
|
||||||
totalRequiredPower = Math.min( totalRequiredPower, o.maxReceivedPerCycle() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalRequiredPower;
|
|
||||||
}
|
|
||||||
catch (GridAccessException e)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public String kind()
|
|
||||||
{
|
|
||||||
return "tunnel";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.recipes.loader;
|
package appeng.recipes.loader;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -25,19 +26,21 @@ import java.io.InputStreamReader;
|
|||||||
|
|
||||||
import appeng.api.recipes.IRecipeLoader;
|
import appeng.api.recipes.IRecipeLoader;
|
||||||
|
|
||||||
public class ConfigLoader implements IRecipeLoader
|
|
||||||
|
public final class ConfigLoader implements IRecipeLoader
|
||||||
{
|
{
|
||||||
|
private final File rootDirectory;
|
||||||
|
|
||||||
private final String rootPath;
|
public ConfigLoader( File rootDirectory )
|
||||||
|
{
|
||||||
public ConfigLoader(String s) {
|
this.rootDirectory = rootDirectory;
|
||||||
this.rootPath = s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BufferedReader getFile(String s) throws Exception
|
public BufferedReader getFile( String s ) throws Exception
|
||||||
{
|
{
|
||||||
File f = new File( this.rootPath + s );
|
final File f = new File( this.rootDirectory, s );
|
||||||
|
|
||||||
return new BufferedReader( new InputStreamReader( new FileInputStream( f ), "UTF-8" ) );
|
return new BufferedReader( new InputStreamReader( new FileInputStream( f ), "UTF-8" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.util.DimensionalCoord;
|
import appeng.api.util.DimensionalCoord;
|
||||||
import appeng.services.helpers.CompassReader;
|
import appeng.services.compass.CompassReader;
|
||||||
import appeng.services.helpers.ICompassCallback;
|
import appeng.services.compass.ICompassCallback;
|
||||||
|
|
||||||
public class CompassService implements ThreadFactory
|
public class CompassService implements ThreadFactory
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,133 +19,167 @@
|
|||||||
package appeng.services;
|
package appeng.services;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
import appeng.services.version.github.FormattedRelease;
|
||||||
|
import appeng.services.version.github.ReleaseFetcher;
|
||||||
|
import appeng.services.version.ModVersionFetcher;
|
||||||
|
import appeng.services.version.Version;
|
||||||
|
import appeng.services.version.VersionCheckerConfig;
|
||||||
|
import appeng.services.version.VersionFetcher;
|
||||||
|
import appeng.services.version.VersionParser;
|
||||||
|
|
||||||
public class VersionChecker implements Runnable
|
|
||||||
|
/**
|
||||||
|
* Tries to connect to GitHub to retrieve the most current build.
|
||||||
|
* After comparison with the local version, several path can be chosen.
|
||||||
|
*
|
||||||
|
* If the local version is invalid, somebody might have build that version themselves
|
||||||
|
* or it is run in a developer environment, then nothing needs to be done.
|
||||||
|
*
|
||||||
|
* If GitHub can not be reached, then either is GitHub down
|
||||||
|
* or the connection to GitHub disturbed, then nothing needs to be done,
|
||||||
|
* since no comparison can be reached
|
||||||
|
*
|
||||||
|
* If the version was just recently checked, then no need to poll again.
|
||||||
|
* Nobody wants to bother to update several times a day.
|
||||||
|
*
|
||||||
|
* Config enables to fine-tune when a version is considered newer
|
||||||
|
*
|
||||||
|
* If the local version is newer or equal to the GitHub version,
|
||||||
|
* then no update needs to be posted
|
||||||
|
*
|
||||||
|
* Only after all that cases, if the external version is higher than the local,
|
||||||
|
* use Version Checker Mod and post several information needed for it to update the mod.
|
||||||
|
*/
|
||||||
|
public final class VersionChecker implements Runnable
|
||||||
{
|
{
|
||||||
private static final int FOUR_HOURS = 1000 * 3600 * 4;
|
private static final int SEC_TO_HOUR = 3600;
|
||||||
|
private static final int MS_TO_SEC = 1000;
|
||||||
|
private final VersionCheckerConfig config;
|
||||||
|
|
||||||
private final long delay;
|
public VersionChecker( VersionCheckerConfig config )
|
||||||
|
|
||||||
public VersionChecker()
|
|
||||||
{
|
{
|
||||||
final long now = new Date().getTime();
|
this.config = config;
|
||||||
final long timeDiff = now - AEConfig.instance.latestTimeStamp;
|
|
||||||
|
|
||||||
this.delay = Math.max( 1, FOUR_HOURS - timeDiff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try
|
Thread.yield();
|
||||||
|
|
||||||
|
final String rawLastCheck = this.config.lastCheck();
|
||||||
|
final long lastCheck = Long.parseLong( rawLastCheck );
|
||||||
|
final Date now = new Date();
|
||||||
|
final long nowInMs = now.getTime();
|
||||||
|
final long intervalInMs = this.config.interval() * SEC_TO_HOUR * MS_TO_SEC;
|
||||||
|
final long lastAfterInterval = lastCheck + intervalInMs;
|
||||||
|
|
||||||
|
this.processInterval( nowInMs, lastAfterInterval );
|
||||||
|
|
||||||
|
AELog.info( "Stopping AE2 VersionChecker" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if enough time since last check has expired
|
||||||
|
*
|
||||||
|
* @param nowInMs now in milli seconds
|
||||||
|
* @param lastAfterInterval last version check including the interval defined in the config
|
||||||
|
*/
|
||||||
|
private void processInterval( long nowInMs, long lastAfterInterval )
|
||||||
|
{
|
||||||
|
if ( nowInMs > lastAfterInterval )
|
||||||
{
|
{
|
||||||
this.sleep( this.delay );
|
final String rawModVersion = AEConfig.VERSION;
|
||||||
|
final VersionParser parser = new VersionParser();
|
||||||
|
final VersionFetcher modFetcher = new ModVersionFetcher( rawModVersion, parser );
|
||||||
|
final ReleaseFetcher githubFetcher = new ReleaseFetcher( this.config, parser );
|
||||||
|
|
||||||
|
final Version modVersion = modFetcher.get();
|
||||||
|
final FormattedRelease githubRelease = githubFetcher.get();
|
||||||
|
|
||||||
|
this.processVersions( modVersion, githubRelease );
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
else
|
||||||
{
|
{
|
||||||
// :(
|
AELog.info( "Last check was just recently." );
|
||||||
}
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
Thread.yield();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String MCVersion = cpw.mods.fml.common.Loader.instance().getMCVersionString().replace( "Minecraft ", "" );
|
|
||||||
URL url = new URL( "http://feeds.ae-mod.info/latest.json?VersionMC=" + MCVersion + "&Channel=" + AEConfig.CHANNEL + "&CurrentVersion="
|
|
||||||
+ AEConfig.VERSION );
|
|
||||||
|
|
||||||
URLConnection yc = url.openConnection();
|
|
||||||
yc.setRequestProperty( "User-Agent", "AE2/" + AEConfig.VERSION + " (Channel:" + AEConfig.CHANNEL + ',' + MCVersion.replace( " ", ":" ) + ')' );
|
|
||||||
BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream() ) );
|
|
||||||
|
|
||||||
StringBuilder Version = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null)
|
|
||||||
Version.append( inputLine );
|
|
||||||
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
if ( Version.length() > 2 )
|
|
||||||
{
|
|
||||||
JsonElement element = (new JsonParser()).parse( Version.toString() );
|
|
||||||
|
|
||||||
int version = element.getAsJsonObject().get( "FormatVersion" ).getAsInt();
|
|
||||||
if ( version == 1 )
|
|
||||||
{
|
|
||||||
JsonObject Meta = element.getAsJsonObject().get( "Meta" ).getAsJsonObject();
|
|
||||||
JsonArray Versions = element.getAsJsonObject().get( "Versions" ).getAsJsonArray();
|
|
||||||
if ( Versions.size() > 0 )
|
|
||||||
{
|
|
||||||
JsonObject Latest = Versions.get( 0 ).getAsJsonObject();
|
|
||||||
|
|
||||||
AEConfig.instance.latestVersion = Latest.get( "Version" ).getAsString();
|
|
||||||
AEConfig.instance.latestTimeStamp = (new Date()).getTime();
|
|
||||||
AEConfig.instance.save();
|
|
||||||
|
|
||||||
if ( !AEConfig.VERSION.equals( AEConfig.instance.latestVersion ) )
|
|
||||||
{
|
|
||||||
NBTTagCompound versionInf = new NBTTagCompound();
|
|
||||||
versionInf.setString( "modDisplayName", "Applied Energistics 2" );
|
|
||||||
versionInf.setString( "oldVersion", AEConfig.VERSION );
|
|
||||||
versionInf.setString( "newVersion", AEConfig.instance.latestVersion );
|
|
||||||
versionInf.setString( "updateUrl", Latest.get( "UserBuild" ).getAsString() );
|
|
||||||
versionInf.setBoolean( "isDirectLink", true );
|
|
||||||
|
|
||||||
JsonElement changeLog = Latest.get( "ChangeLog" );
|
|
||||||
if ( changeLog == null )
|
|
||||||
versionInf.setString( "changeLog", "For full change log please see: " + Meta.get( "DownloadLink" ).getAsString() );
|
|
||||||
else
|
|
||||||
versionInf.setString( "changeLog", changeLog.getAsString() );
|
|
||||||
|
|
||||||
versionInf.setString( "newFileName", "appliedenergistics2-" + AEConfig.instance.latestVersion + ".jar" );
|
|
||||||
FMLInterModComms.sendRuntimeMessage( AppEng.instance, "VersionChecker", "addUpdate", versionInf );
|
|
||||||
|
|
||||||
AELog.info( "Stopping VersionChecker" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sleep( FOUR_HOURS );
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.sleep( FOUR_HOURS );
|
|
||||||
}
|
|
||||||
catch (InterruptedException e1)
|
|
||||||
{
|
|
||||||
AELog.error( e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sleep(long i) throws InterruptedException
|
/**
|
||||||
|
* Checks if the retrieved version is newer as the current mod version.
|
||||||
|
* Will notify player if config is enabled.
|
||||||
|
*
|
||||||
|
* @param modVersion version of mod
|
||||||
|
* @param githubRelease release retrieved through github
|
||||||
|
*/
|
||||||
|
private void processVersions( Version modVersion, FormattedRelease githubRelease )
|
||||||
{
|
{
|
||||||
Thread.sleep( i );
|
final Version githubVersion = githubRelease.version();
|
||||||
|
final String modFormatted = modVersion.formatted();
|
||||||
|
final String ghFormatted = githubVersion.formatted();
|
||||||
|
|
||||||
|
if ( githubVersion.isNewerAs( modVersion ) )
|
||||||
|
{
|
||||||
|
final String changelog = githubRelease.changelog();
|
||||||
|
|
||||||
|
if ( this.config.shouldNotifyPlayer() )
|
||||||
|
{
|
||||||
|
AELog.info( "Newer version is available: " + ghFormatted + " (found) > " + modFormatted + " (current)" );
|
||||||
|
|
||||||
|
if ( this.config.shouldPostChangelog() )
|
||||||
|
{
|
||||||
|
AELog.info( "Changelog: " + changelog );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.interactWithVersionCheckerMod( modFormatted, ghFormatted, changelog );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AELog.info( "No newer version is available: " + ghFormatted + "(found) < " + modFormatted + " (current)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the version checker mod is installed and handles it depending on that information
|
||||||
|
*
|
||||||
|
* @param modFormatted mod version formatted as rv2-beta-8
|
||||||
|
* @param ghFormatted retrieved github version formatted as rv2-beta-8
|
||||||
|
* @param changelog retrieved github changelog
|
||||||
|
*/
|
||||||
|
private void interactWithVersionCheckerMod( String modFormatted, String ghFormatted, String changelog )
|
||||||
|
{
|
||||||
|
if ( Loader.isModLoaded( "VersionChecker" ) )
|
||||||
|
{
|
||||||
|
final NBTTagCompound versionInf = new NBTTagCompound();
|
||||||
|
versionInf.setString( "modDisplayName", AppEng.MOD_NAME );
|
||||||
|
versionInf.setString( "oldVersion", modFormatted );
|
||||||
|
versionInf.setString( "newVersion", ghFormatted );
|
||||||
|
versionInf.setString( "updateUrl", "http://ae-mod.info/builds/appliedenergistics2-" + ghFormatted + ".jar" );
|
||||||
|
versionInf.setBoolean( "isDirectLink", true );
|
||||||
|
|
||||||
|
if ( !changelog.isEmpty() )
|
||||||
|
{
|
||||||
|
versionInf.setString( "changeLog", changelog );
|
||||||
|
}
|
||||||
|
|
||||||
|
versionInf.setString( "newFileName", "appliedenergistics2-" + ghFormatted + ".jar" );
|
||||||
|
FMLInterModComms.sendRuntimeMessage( AppEng.instance, "VersionChecker", "addUpdate", versionInf );
|
||||||
|
|
||||||
|
AELog.info( "Reported new version to VersionChecker mod." );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AELog.info( "VersionChecker mod is not installed; Proceeding." );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.services.helpers;
|
package appeng.services.compass;
|
||||||
|
|
||||||
public class CompassException extends RuntimeException
|
public class CompassException extends RuntimeException
|
||||||
{
|
{
|
||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.services.helpers;
|
package appeng.services.compass;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.services.helpers;
|
package appeng.services.compass;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.services.helpers;
|
package appeng.services.compass;
|
||||||
|
|
||||||
public interface ICompassCallback
|
public interface ICompassCallback
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base version of {@link Version}.
|
||||||
|
*
|
||||||
|
* Provides a unified way to test for equality and print a formatted string
|
||||||
|
*/
|
||||||
|
public abstract class BaseVersion implements Version
|
||||||
|
{
|
||||||
|
private final int revision;
|
||||||
|
private final Channel channel;
|
||||||
|
private final int build;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param revision revision in natural number
|
||||||
|
* @param channel channel
|
||||||
|
* @param build build in natural number
|
||||||
|
*
|
||||||
|
* @throws AssertionError if assertion are enabled and revision or build are not natural numbers
|
||||||
|
*/
|
||||||
|
public BaseVersion( int revision, Channel channel, int build )
|
||||||
|
{
|
||||||
|
assert revision >= 0;
|
||||||
|
assert build >= 0;
|
||||||
|
|
||||||
|
this.revision = revision;
|
||||||
|
this.channel = channel;
|
||||||
|
this.build = build;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int revision()
|
||||||
|
{
|
||||||
|
return this.revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Channel channel()
|
||||||
|
{
|
||||||
|
return this.channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int build()
|
||||||
|
{
|
||||||
|
return this.build;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatted()
|
||||||
|
{
|
||||||
|
return "rv" + this.revision + '-' + this.channel.name().toLowerCase() + '-' + this.build;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int hashCode()
|
||||||
|
{
|
||||||
|
int result = this.revision;
|
||||||
|
result = 31 * result + ( this.channel != null ? this.channel.hashCode() : 0 );
|
||||||
|
result = 31 * result + this.build;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean equals( Object o )
|
||||||
|
{
|
||||||
|
if ( this == o )
|
||||||
|
return true;
|
||||||
|
if ( !( o instanceof Version ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Version that = (Version) o;
|
||||||
|
|
||||||
|
if ( this.revision != that.revision() )
|
||||||
|
return false;
|
||||||
|
if ( this.build != that.build() )
|
||||||
|
return false;
|
||||||
|
return this.channel == that.channel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString()
|
||||||
|
{
|
||||||
|
return "Version{" +
|
||||||
|
"revision=" + this.revision +
|
||||||
|
", channel=" + this.channel +
|
||||||
|
", build=" + this.build +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the release channel of Applied Energistics. The mod is either in Alpha, Beta or Release channel.
|
||||||
|
* Any more might be confusing to the end-user
|
||||||
|
*/
|
||||||
|
public enum Channel
|
||||||
|
{
|
||||||
|
Alpha,
|
||||||
|
Beta,
|
||||||
|
Release
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AE prints version like rv2-beta-8
|
||||||
|
* GitHub prints version like rv2.beta.8
|
||||||
|
*/
|
||||||
|
public final class DefaultVersion extends BaseVersion
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param revision natural number
|
||||||
|
* @param channel either alpha, beta or release
|
||||||
|
* @param build natural number
|
||||||
|
*/
|
||||||
|
public DefaultVersion( int revision, Channel channel, int build )
|
||||||
|
{
|
||||||
|
super( revision, channel, build );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNewerAs( Version maybeOlder )
|
||||||
|
{
|
||||||
|
if ( this.revision() > maybeOlder.revision() )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( this.channel().compareTo( maybeOlder.channel() ) > 0 )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.build() > maybeOlder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional template for {@link Version}, when the mod does not want a check
|
||||||
|
*/
|
||||||
|
public final class DoNotCheckVersion extends BaseVersion
|
||||||
|
{
|
||||||
|
public DoNotCheckVersion()
|
||||||
|
{
|
||||||
|
super( Integer.MAX_VALUE, Channel.Release, Integer.MAX_VALUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNewerAs( Version maybeOlder )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatted()
|
||||||
|
{
|
||||||
|
return "dev build";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional template when the {@link Version} could not be retrieved
|
||||||
|
*/
|
||||||
|
public final class MissingVersion extends BaseVersion
|
||||||
|
{
|
||||||
|
public MissingVersion()
|
||||||
|
{
|
||||||
|
super( 0, Channel.Alpha, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param maybeOlder ignored
|
||||||
|
*
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isNewerAs( Version maybeOlder )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatted()
|
||||||
|
{
|
||||||
|
return "missing";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for {@link VersionParser} to check if the check is happening in developer environment or in a pull request.
|
||||||
|
*
|
||||||
|
* In that case ignore the check.
|
||||||
|
*/
|
||||||
|
public final class ModVersionFetcher implements VersionFetcher
|
||||||
|
{
|
||||||
|
private final String rawModVersion;
|
||||||
|
private final VersionParser parser;
|
||||||
|
|
||||||
|
public ModVersionFetcher( String rawModVersion, VersionParser parser )
|
||||||
|
{
|
||||||
|
this.rawModVersion = rawModVersion;
|
||||||
|
this.parser = parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses only, if not checked in developer environment or in a pull request
|
||||||
|
*
|
||||||
|
* @return {@link DoNotCheckVersion} if in developer environment or pull request, else the parsed {@link Version}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Version get()
|
||||||
|
{
|
||||||
|
if ( this.rawModVersion.equals( "@version@" ) || this.rawModVersion.contains( "pr" ) )
|
||||||
|
{
|
||||||
|
return new DoNotCheckVersion();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final Version version = this.parser.parse( this.rawModVersion );
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores version information, which are easily compared
|
||||||
|
*/
|
||||||
|
public interface Version
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return revision of this version
|
||||||
|
*/
|
||||||
|
int revision();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return channel of this version
|
||||||
|
*/
|
||||||
|
Channel channel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return build of this version
|
||||||
|
*/
|
||||||
|
int build();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version is never if these criteria are met:
|
||||||
|
* if the current revision is higher than the compared revision OR
|
||||||
|
* if revision are equal and the current channel is higher than the compared channel (Release > Beta > Alpha) OR
|
||||||
|
* if revision, channel are equal and the build is higher than the compared build
|
||||||
|
*
|
||||||
|
* @return true if criteria are met
|
||||||
|
*/
|
||||||
|
boolean isNewerAs( Version maybeOlder );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the revision, channel and build into a common displayed way
|
||||||
|
*
|
||||||
|
* rv2-beta-8
|
||||||
|
*
|
||||||
|
* @return formatted version
|
||||||
|
*/
|
||||||
|
String formatted();
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seperate config file to handle the version checker
|
||||||
|
*/
|
||||||
|
public final class VersionCheckerConfig
|
||||||
|
{
|
||||||
|
private static final int DEFAULT_INTERVAL_HOURS = 24;
|
||||||
|
private static final int MIN_INTERVAL_HOURS = 0;
|
||||||
|
private static final int MAX_INTERVAL_HOURS = 7 * 24;
|
||||||
|
|
||||||
|
private final Configuration config;
|
||||||
|
|
||||||
|
private final boolean isEnabled;
|
||||||
|
|
||||||
|
private final String lastCheck;
|
||||||
|
private final int interval;
|
||||||
|
|
||||||
|
private final String level;
|
||||||
|
|
||||||
|
private final boolean shouldNotifyPlayer;
|
||||||
|
private final boolean shouldPostChangelog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param file requires fully qualified file in which the config is saved
|
||||||
|
*/
|
||||||
|
public VersionCheckerConfig( File file )
|
||||||
|
{
|
||||||
|
this.config = new Configuration( file );
|
||||||
|
|
||||||
|
// initializes default values by caching
|
||||||
|
this.isEnabled = this.config.getBoolean( "enabled", "general", true, "If true, the version checker is enabled. Acts as a master switch." );
|
||||||
|
|
||||||
|
this.lastCheck = this.config.getString( "lastCheck", "cache", "0", "The number of milliseconds since January 1, 1970, 00:00:00 GMT of the last successful check." );
|
||||||
|
this.interval = this.config.getInt( "interval", "cache", DEFAULT_INTERVAL_HOURS, MIN_INTERVAL_HOURS, MAX_INTERVAL_HOURS, "Waits as many hours, until it checks again." );
|
||||||
|
|
||||||
|
this.level = this.config.getString( "level", "channel", "Beta", "Determines the channel level which should be checked for updates. Can be either Release, Beta or Alpha." );
|
||||||
|
|
||||||
|
this.shouldNotifyPlayer = this.config.getBoolean( "notify", "client", true, "If true, the player is getting a notification, that a new version is available." );
|
||||||
|
this.shouldPostChangelog = this.config.getBoolean( "changelog", "client", true, "If true, the player is getting a notification including changelog. Only happens if notification are enabled." );
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled()
|
||||||
|
{
|
||||||
|
return this.isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String lastCheck()
|
||||||
|
{
|
||||||
|
return this.lastCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the current date in milli seconds into the "lastCheck" field of the config
|
||||||
|
* and makes it persistent.
|
||||||
|
*/
|
||||||
|
public void updateLastCheck()
|
||||||
|
{
|
||||||
|
final Date now = new Date();
|
||||||
|
final long nowInMs = now.getTime();
|
||||||
|
final String nowAsString = Long.toString( nowInMs );
|
||||||
|
|
||||||
|
this.config.get( "cache", "lastCheck", "0" ).set( nowAsString );
|
||||||
|
|
||||||
|
this.config.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int interval()
|
||||||
|
{
|
||||||
|
return this.interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String level()
|
||||||
|
{
|
||||||
|
return this.level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldNotifyPlayer()
|
||||||
|
{
|
||||||
|
return this.shouldNotifyPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldPostChangelog()
|
||||||
|
{
|
||||||
|
return this.shouldPostChangelog;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes base information to retrieve a {@link Version}
|
||||||
|
*/
|
||||||
|
public interface VersionFetcher
|
||||||
|
{
|
||||||
|
Version get();
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* can parse a version in form of rv2-beta-8 or rv2.beta.8
|
||||||
|
*/
|
||||||
|
public final class VersionParser
|
||||||
|
{
|
||||||
|
private static final Pattern PATTERN_DOT = Pattern.compile( "\\." );
|
||||||
|
private static final Pattern PATTERN_DASH = Pattern.compile( "-" );
|
||||||
|
private static final Pattern PATTERN_REVISION = Pattern.compile( "[^0-9]+" );
|
||||||
|
private static final Pattern PATTERN_BUILD = Pattern.compile( "[^0-9]+" );
|
||||||
|
private static final Pattern PATTERN_NATURAL = Pattern.compile( "[0-9]+" );
|
||||||
|
private static final Pattern PATTERN_VALID_REVISION = Pattern.compile( "^rv\\d+$" );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the {@link Version} out of a String
|
||||||
|
*
|
||||||
|
* @param raw String in form of rv2-beta-8 or rv2.beta.8
|
||||||
|
*
|
||||||
|
* @return {@link Version} encoded in the raw String
|
||||||
|
*
|
||||||
|
* @throws AssertionError if raw String does not match pattern of a {@link Version}
|
||||||
|
*/
|
||||||
|
public Version parse( String raw )
|
||||||
|
{
|
||||||
|
final String transformed = this.transformDelimiter( raw );
|
||||||
|
final String[] split = transformed.split( "_" );
|
||||||
|
|
||||||
|
return this.parseVersion( split );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces all "." and "-" into "_" to make them uniform
|
||||||
|
*
|
||||||
|
* @param raw raw version string containing "." or "-"
|
||||||
|
*
|
||||||
|
* @return transformed raw, where "." and "-" are replaced by "_"
|
||||||
|
*/
|
||||||
|
private String transformDelimiter( String raw )
|
||||||
|
{
|
||||||
|
assert raw.contains( "." ) || raw.contains( "-" );
|
||||||
|
|
||||||
|
final String withoutDot = PATTERN_DOT.matcher( raw ).replaceAll( "_" );
|
||||||
|
final String withoutDash = PATTERN_DASH.matcher( withoutDot ).replaceAll( "_" );
|
||||||
|
|
||||||
|
return withoutDash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parses the {@link Version} out of the split.
|
||||||
|
* The split must have a length of 3,
|
||||||
|
* representing revision, channel and build.
|
||||||
|
*
|
||||||
|
* @param splitRaw raw version split with length of 3
|
||||||
|
*
|
||||||
|
* @return {@link Version} represented by the splitRaw
|
||||||
|
*/
|
||||||
|
private Version parseVersion( String[] splitRaw )
|
||||||
|
{
|
||||||
|
assert splitRaw.length == 3;
|
||||||
|
|
||||||
|
final String rawRevision = splitRaw[0];
|
||||||
|
final String rawChannel = splitRaw[1];
|
||||||
|
final String rawBuild = splitRaw[2];
|
||||||
|
|
||||||
|
final int revision = this.parseRevision( rawRevision );
|
||||||
|
final Channel channel = this.parseChannel( rawChannel );
|
||||||
|
final int build = this.parseBuild( rawBuild );
|
||||||
|
|
||||||
|
return new DefaultVersion( revision, channel, build );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A revision starts with the keyword "rv", followed by a natural number
|
||||||
|
*
|
||||||
|
* @param rawRevision String containing the revision number
|
||||||
|
*
|
||||||
|
* @return revision number
|
||||||
|
*/
|
||||||
|
private int parseRevision( String rawRevision )
|
||||||
|
{
|
||||||
|
assert PATTERN_VALID_REVISION.matcher( rawRevision ).matches();
|
||||||
|
|
||||||
|
final int revision = new Scanner( rawRevision ).useDelimiter( PATTERN_REVISION ).nextInt();
|
||||||
|
|
||||||
|
return revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A channel is atm either one of {@link Channel#Alpha}, {@link Channel#Beta} or {@link Channel#Release}
|
||||||
|
*
|
||||||
|
* @param rawChannel String containing the channel
|
||||||
|
*
|
||||||
|
* @return matching {@link Channel} to the String
|
||||||
|
*/
|
||||||
|
private Channel parseChannel( String rawChannel )
|
||||||
|
{
|
||||||
|
assert rawChannel.equalsIgnoreCase( Channel.Alpha.name() ) || rawChannel.equalsIgnoreCase( Channel.Beta.name() ) || rawChannel.equalsIgnoreCase( Channel.Release.name() );
|
||||||
|
|
||||||
|
for ( Channel channel : Channel.values() )
|
||||||
|
{
|
||||||
|
if ( channel.name().equalsIgnoreCase( rawChannel ) )
|
||||||
|
{
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidParameterException( "Raw channel did not contain any of the pre-programmed types." );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A build is just a natural number
|
||||||
|
*
|
||||||
|
* @param rawBuild String containing the build number
|
||||||
|
*
|
||||||
|
* @return build number
|
||||||
|
*/
|
||||||
|
private int parseBuild( String rawBuild )
|
||||||
|
{
|
||||||
|
assert PATTERN_NATURAL.matcher( rawBuild ).matches();
|
||||||
|
|
||||||
|
final int build = new Scanner( rawBuild ).useDelimiter( PATTERN_BUILD ).nextInt();
|
||||||
|
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package appeng.services.version.github;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.services.version.Version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default template when a {@link FormattedRelease} is needed.
|
||||||
|
*/
|
||||||
|
public final class DefaultFormattedRelease implements FormattedRelease
|
||||||
|
{
|
||||||
|
private final Version version;
|
||||||
|
private final String changelog;
|
||||||
|
|
||||||
|
public DefaultFormattedRelease( Version version, String changelog )
|
||||||
|
{
|
||||||
|
this.version = version;
|
||||||
|
this.changelog = changelog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String changelog()
|
||||||
|
{
|
||||||
|
return this.changelog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Version version()
|
||||||
|
{
|
||||||
|
return this.version;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package appeng.services.version.github;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.services.version.Version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the acquired, processed information through github about a release of Applied Energistics 2
|
||||||
|
*/
|
||||||
|
public interface FormattedRelease
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return changelog
|
||||||
|
*/
|
||||||
|
String changelog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return processed version
|
||||||
|
*/
|
||||||
|
Version version();
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package appeng.services.version.github;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.services.version.MissingVersion;
|
||||||
|
import appeng.services.version.Version;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional template, when no meaningful {@link FormattedRelease} could be obtained
|
||||||
|
*/
|
||||||
|
public final class MissingFormattedRelease implements FormattedRelease
|
||||||
|
{
|
||||||
|
private final Version version;
|
||||||
|
|
||||||
|
public MissingFormattedRelease()
|
||||||
|
{
|
||||||
|
this.version = new MissingVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return empty string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String changelog()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link MissingVersion}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Version version()
|
||||||
|
{
|
||||||
|
return this.version;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package appeng.services.version.github;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template class for Gson to write values from the Json Object into an actual class
|
||||||
|
*/
|
||||||
|
@SuppressWarnings( "ALL" )
|
||||||
|
public class Release
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* name of the tag it is saved
|
||||||
|
*/
|
||||||
|
public String tag_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the changelog
|
||||||
|
*/
|
||||||
|
public String body;
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package appeng.services.version.github;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.services.version.Channel;
|
||||||
|
import appeng.services.version.Version;
|
||||||
|
import appeng.services.version.VersionCheckerConfig;
|
||||||
|
import appeng.services.version.VersionParser;
|
||||||
|
|
||||||
|
|
||||||
|
public final class ReleaseFetcher
|
||||||
|
{
|
||||||
|
private static final String GITHUB_RELEASES_URL = "https://api.github.com/repos/AppliedEnergistics/Applied-Energistics-2/releases";
|
||||||
|
private static final FormattedRelease EXCEPTIONAL_RELEASE = new MissingFormattedRelease();
|
||||||
|
|
||||||
|
private final VersionCheckerConfig config;
|
||||||
|
private final VersionParser parser;
|
||||||
|
|
||||||
|
public ReleaseFetcher( VersionCheckerConfig config, VersionParser parser )
|
||||||
|
{
|
||||||
|
this.config = config;
|
||||||
|
this.parser = parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormattedRelease get()
|
||||||
|
{
|
||||||
|
final Gson gson = new Gson();
|
||||||
|
final Type type = new ReleasesTypeToken().getType();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final URL releasesURL = new URL( GITHUB_RELEASES_URL );
|
||||||
|
final String rawReleases = this.getRawReleases( releasesURL );
|
||||||
|
|
||||||
|
this.config.updateLastCheck();
|
||||||
|
|
||||||
|
final List<Release> releases = gson.fromJson( rawReleases, type );
|
||||||
|
final FormattedRelease latestFitRelease = this.getLatestFitRelease( releases );
|
||||||
|
|
||||||
|
return latestFitRelease;
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
AELog.error( e );
|
||||||
|
|
||||||
|
return EXCEPTIONAL_RELEASE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRawReleases( URL url ) throws IOException
|
||||||
|
{
|
||||||
|
return IOUtils.toString( url );
|
||||||
|
}
|
||||||
|
|
||||||
|
private FormattedRelease getLatestFitRelease( Iterable<Release> releases )
|
||||||
|
{
|
||||||
|
final String levelInConfig = this.config.level();
|
||||||
|
final Channel level = Channel.valueOf( levelInConfig );
|
||||||
|
final int levelOrdinal = level.ordinal();
|
||||||
|
|
||||||
|
for ( Release release : releases )
|
||||||
|
{
|
||||||
|
final String rawVersion = release.tag_name;
|
||||||
|
final String changelog = release.body;
|
||||||
|
|
||||||
|
final Version version = this.parser.parse( rawVersion );
|
||||||
|
|
||||||
|
if ( version.channel().ordinal() >= levelOrdinal )
|
||||||
|
{
|
||||||
|
return new DefaultFormattedRelease( version, changelog );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXCEPTIONAL_RELEASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class ReleasesTypeToken extends TypeToken<List<Release>>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -111,8 +111,10 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
|||||||
@Override
|
@Override
|
||||||
public boolean isUseableByPlayer(EntityPlayer p)
|
public boolean isUseableByPlayer(EntityPlayer p)
|
||||||
{
|
{
|
||||||
|
final double squaredMCReach = 64.0D;
|
||||||
|
|
||||||
return this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this && p.getDistanceSq( this.xCoord + 0.5D,
|
return this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this && p.getDistanceSq( this.xCoord + 0.5D,
|
||||||
this.yCoord + 0.5D, this.zCoord + 0.5D ) <= 32.0D;
|
this.yCoord + 0.5D, this.zCoord + 0.5D ) <= squaredMCReach;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import appeng.transformer.annotations.integration.Interface;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
@Interface(iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink")
|
@Interface(iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink")
|
||||||
public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
|
public abstract class IC2 extends AERootPoweredTile implements IEnergySink
|
||||||
{
|
{
|
||||||
|
|
||||||
boolean isInIC2 = false;
|
boolean isInIC2 = false;
|
||||||
|
|||||||
@@ -1,102 +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.tile.powersink;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
|
||||||
import buildcraft.api.power.PowerHandler;
|
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
|
||||||
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.integration.IntegrationType;
|
|
||||||
import appeng.integration.abstraction.IMJ5;
|
|
||||||
import appeng.integration.abstraction.helpers.BaseMJPerdition;
|
|
||||||
import appeng.tile.TileEvent;
|
|
||||||
import appeng.tile.events.TileEventType;
|
|
||||||
import appeng.transformer.annotations.integration.Interface;
|
|
||||||
import appeng.transformer.annotations.integration.Method;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
@Interface(iname = "MJ5", iface = "buildcraft.api.power.IPowerReceptor")
|
|
||||||
public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPowerReceptor
|
|
||||||
{
|
|
||||||
|
|
||||||
BaseMJPerdition bcPowerWrapper;
|
|
||||||
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
@TileEvent(TileEventType.TICK)
|
|
||||||
public void Tick_MinecraftJoules5()
|
|
||||||
{
|
|
||||||
if ( this.bcPowerWrapper != null )
|
|
||||||
this.bcPowerWrapper.Tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MinecraftJoules5() {
|
|
||||||
if ( Platform.isServer() )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
|
|
||||||
{
|
|
||||||
IMJ5 mjIntegration = (IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 );
|
|
||||||
if ( mjIntegration != null )
|
|
||||||
{
|
|
||||||
this.bcPowerWrapper = (BaseMJPerdition) mjIntegration.createPerdition( this );
|
|
||||||
if ( this.bcPowerWrapper != null )
|
|
||||||
this.bcPowerWrapper.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
// ignore.. no bc?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
final public PowerReceiver getPowerReceiver(ForgeDirection side)
|
|
||||||
{
|
|
||||||
if ( this.getPowerSides().contains( side ) && this.bcPowerWrapper != null )
|
|
||||||
return this.bcPowerWrapper.getPowerReceiver();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
final public void doWork(PowerHandler workProvider)
|
|
||||||
{
|
|
||||||
float required = (float) this.getExternalPowerDemand( PowerUnits.MJ, this.bcPowerWrapper.getPowerReceiver().getEnergyStored() );
|
|
||||||
double failed = this.injectExternalPower( PowerUnits.MJ, this.bcPowerWrapper.useEnergy( 0.0f, required, true ) );
|
|
||||||
if ( failed > 0.01 )
|
|
||||||
this.bcPowerWrapper.addEnergy( (float) failed );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ5")
|
|
||||||
final public World getWorld()
|
|
||||||
{
|
|
||||||
return this.worldObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,117 +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.tile.powersink;
|
|
||||||
|
|
||||||
import buildcraft.api.mj.IBatteryObject;
|
|
||||||
import buildcraft.api.mj.IBatteryProvider;
|
|
||||||
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.transformer.annotations.integration.Interface;
|
|
||||||
import appeng.transformer.annotations.integration.InterfaceList;
|
|
||||||
import appeng.transformer.annotations.integration.Method;
|
|
||||||
|
|
||||||
@InterfaceList(value = { @Interface(iname = "MJ6", iface = "buildcraft.api.mj.IBatteryProvider"),
|
|
||||||
@Interface(iname = "MJ6", iface = "buildcraft.api.mj.IBatteryObject") })
|
|
||||||
public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatteryProvider, IBatteryObject
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public String kind()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double getEnergyRequested()
|
|
||||||
{
|
|
||||||
return this.getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double addEnergy(double amount)
|
|
||||||
{
|
|
||||||
double demand = this.getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
|
|
||||||
if ( amount > demand )
|
|
||||||
amount = demand;
|
|
||||||
|
|
||||||
double overflow = this.injectExternalPower( PowerUnits.MJ, amount );
|
|
||||||
return amount - overflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double addEnergy(double amount, boolean ignoreCycleLimit)
|
|
||||||
{
|
|
||||||
double overflow = this.injectExternalPower( PowerUnits.MJ, amount );
|
|
||||||
return amount - overflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double getEnergyStored()
|
|
||||||
{
|
|
||||||
return PowerUnits.AE.convertTo( PowerUnits.MJ, this.internalCurrentPower );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public void setEnergyStored(double mj)
|
|
||||||
{
|
|
||||||
this.internalCurrentPower = PowerUnits.MJ.convertTo( PowerUnits.AE, mj );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double maxCapacity()
|
|
||||||
{
|
|
||||||
return PowerUnits.AE.convertTo( PowerUnits.MJ, this.internalMaxPower );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double minimumConsumption()
|
|
||||||
{
|
|
||||||
return 0.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public double maxReceivedPerCycle()
|
|
||||||
{
|
|
||||||
return 999999.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public IBatteryObject reconfigure(double maxCapacity, double maxReceivedPerCycle, double minimumConsumption)
|
|
||||||
{
|
|
||||||
return this.getMjBattery( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(iname = "MJ6")
|
|
||||||
public IBatteryObject getMjBattery(String kind)
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -427,7 +427,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
|
MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
|
||||||
ih.myPriority = this.priority;
|
ih.setPriority( this.priority );
|
||||||
|
|
||||||
MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
|
MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
|
||||||
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
|
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
|||||||
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
|
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
|
||||||
|
|
||||||
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
|
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
|
||||||
ih.myPriority = this.priority;
|
ih.setPriority( this.priority );
|
||||||
this.invBySlot[x] = ih;
|
this.invBySlot[x] = ih;
|
||||||
this.items.add( ih );
|
this.items.add( ih );
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
|||||||
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
|
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
|
||||||
|
|
||||||
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
|
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
|
||||||
ih.myPriority = this.priority;
|
ih.setPriority( this.priority );
|
||||||
this.invBySlot[x] = ih;
|
this.invBySlot[x] = ih;
|
||||||
this.fluids.add( ih );
|
this.fluids.add( ih );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,14 +27,11 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntityChest;
|
import net.minecraft.tileentity.TileEntityChest;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.api.inventory.ISpecialInventory;
|
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.integration.IntegrationType;
|
import appeng.integration.IntegrationType;
|
||||||
import appeng.integration.abstraction.IBetterStorage;
|
import appeng.integration.abstraction.IBetterStorage;
|
||||||
import appeng.util.inv.AdaptorIInventory;
|
import appeng.util.inv.AdaptorIInventory;
|
||||||
import appeng.util.inv.AdaptorISpecialInventory;
|
|
||||||
import appeng.util.inv.AdaptorList;
|
import appeng.util.inv.AdaptorList;
|
||||||
import appeng.util.inv.AdaptorPlayerInventory;
|
import appeng.util.inv.AdaptorPlayerInventory;
|
||||||
import appeng.util.inv.IInventoryDestination;
|
import appeng.util.inv.IInventoryDestination;
|
||||||
@@ -45,19 +42,19 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||||||
{
|
{
|
||||||
|
|
||||||
// return what was extracted.
|
// return what was extracted.
|
||||||
public abstract ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination);
|
public abstract ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination);
|
||||||
|
|
||||||
public abstract ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination);
|
public abstract ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination);
|
||||||
|
|
||||||
// return what was extracted.
|
// return what was extracted.
|
||||||
public abstract ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
public abstract ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||||
|
|
||||||
public abstract ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
public abstract ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||||
|
|
||||||
// return what isn't used...
|
// return what isn't used...
|
||||||
public abstract ItemStack addItems(ItemStack A);
|
public abstract ItemStack addItems(ItemStack toBeAdded);
|
||||||
|
|
||||||
public abstract ItemStack simulateAdd(ItemStack A);
|
public abstract ItemStack simulateAdd(ItemStack toBeSimulated);
|
||||||
|
|
||||||
public abstract boolean containsItems();
|
public abstract boolean containsItems();
|
||||||
|
|
||||||
@@ -75,7 +72,10 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||||||
}
|
}
|
||||||
else if ( te instanceof ArrayList )
|
else if ( te instanceof ArrayList )
|
||||||
{
|
{
|
||||||
return new AdaptorList( (ArrayList<ItemStack>) te );
|
@SuppressWarnings( "unchecked" )
|
||||||
|
final ArrayList<ItemStack> list = ( ArrayList<ItemStack> ) te;
|
||||||
|
|
||||||
|
return new AdaptorList( list );
|
||||||
}
|
}
|
||||||
else if ( bs != null && bs.isStorageCrate( te ) )
|
else if ( bs != null && bs.isStorageCrate( te ) )
|
||||||
{
|
{
|
||||||
@@ -85,10 +85,6 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||||||
{
|
{
|
||||||
return new AdaptorIInventory( Platform.GetChestInv( te ) );
|
return new AdaptorIInventory( Platform.GetChestInv( te ) );
|
||||||
}
|
}
|
||||||
else if ( isSpecialInventory( te ) )
|
|
||||||
{
|
|
||||||
return new AdaptorISpecialInventory( (ISpecialInventory) te, d );
|
|
||||||
}
|
|
||||||
else if ( te instanceof ISidedInventory )
|
else if ( te instanceof ISidedInventory )
|
||||||
{
|
{
|
||||||
ISidedInventory si =(ISidedInventory)te;
|
ISidedInventory si =(ISidedInventory)te;
|
||||||
@@ -105,22 +101,4 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean canBeSpecial = true;
|
|
||||||
|
|
||||||
private static boolean isSpecialInventory(Object a)
|
|
||||||
{
|
|
||||||
if ( canBeSpecial )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return a instanceof ISpecialInventory;
|
|
||||||
}
|
|
||||||
catch (Throwable e)
|
|
||||||
{
|
|
||||||
canBeSpecial = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,43 +60,43 @@ public class AdaptorBCPipe extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItems(int how_many, ItemStack filter, IInventoryDestination destination)
|
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination destination)
|
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack addItems(ItemStack A)
|
public ItemStack addItems(ItemStack toBeAdded )
|
||||||
{
|
{
|
||||||
if ( this.i == null )
|
if ( this.i == null )
|
||||||
return A;
|
return toBeAdded;
|
||||||
if ( A == null )
|
if ( toBeAdded == null )
|
||||||
return null;
|
return null;
|
||||||
if ( A.stackSize == 0 )
|
if ( toBeAdded.stackSize == 0 )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if ( this.bc.addItemsToPipe( this.i, A, this.d ) )
|
if ( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
|
||||||
return null;
|
return null;
|
||||||
return A;
|
return toBeAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd(ItemStack A)
|
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||||
{
|
{
|
||||||
if ( this.i == null )
|
if ( this.i == null )
|
||||||
return A;
|
return toBeSimulated;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,15 +224,15 @@ public class AdaptorIInventory extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack addItems( ItemStack itemsToAdd )
|
public ItemStack addItems( ItemStack toBeAdded )
|
||||||
{
|
{
|
||||||
return this.addItems( itemsToAdd, true );
|
return this.addItems( toBeAdded, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd( ItemStack itemsToAdd )
|
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||||
{
|
{
|
||||||
return this.addItems( itemsToAdd, false );
|
return this.addItems( toBeSimulated, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,136 +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.util.inv;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.inventory.ISpecialInventory;
|
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
|
||||||
import appeng.util.InventoryAdaptor;
|
|
||||||
|
|
||||||
public class AdaptorISpecialInventory extends InventoryAdaptor
|
|
||||||
{
|
|
||||||
|
|
||||||
private final AdaptorIInventory remover;
|
|
||||||
|
|
||||||
private final ISpecialInventory i;
|
|
||||||
private final ForgeDirection d;
|
|
||||||
|
|
||||||
public AdaptorISpecialInventory(ISpecialInventory s, ForgeDirection dd) {
|
|
||||||
this.i = s;
|
|
||||||
this.d = dd;
|
|
||||||
|
|
||||||
if ( s instanceof ISidedInventory )
|
|
||||||
this.remover = new AdaptorIInventory( new WrapperMCISidedInventory( (ISidedInventory) s, this.d ) );
|
|
||||||
else
|
|
||||||
this.remover = new AdaptorIInventory( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack removeSimilarItems(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
|
||||||
{
|
|
||||||
return this.remover.removeSimilarItems( how_many, filter, fuzzyMode, destination );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
|
||||||
{
|
|
||||||
return this.remover.simulateSimilarRemove( how_many, filter, fuzzyMode, destination );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack removeItems(int how_many, ItemStack filter, IInventoryDestination destination)
|
|
||||||
{
|
|
||||||
return this.remover.removeItems( how_many, filter, destination );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination destination)
|
|
||||||
{
|
|
||||||
return this.remover.simulateRemove( how_many, filter, destination );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack addItems(ItemStack A)
|
|
||||||
{
|
|
||||||
if ( A == null )
|
|
||||||
return null;
|
|
||||||
if ( A.stackSize == 0 )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
int used = this.i.addItem( A, true, this.d );
|
|
||||||
ItemStack out = A.copy();
|
|
||||||
out.stackSize -= used;
|
|
||||||
if ( out.stackSize > 0 )
|
|
||||||
return out;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack simulateAdd(ItemStack A)
|
|
||||||
{
|
|
||||||
int used = this.i.addItem( A, false, this.d );
|
|
||||||
ItemStack out = A.copy();
|
|
||||||
out.stackSize -= used;
|
|
||||||
if ( out.stackSize > 0 )
|
|
||||||
return out;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean containsItems()
|
|
||||||
{
|
|
||||||
if ( this.i instanceof ISidedInventory )
|
|
||||||
{
|
|
||||||
ISidedInventory sided = (ISidedInventory) this.i;
|
|
||||||
int[] slots = sided.getAccessibleSlotsFromSide( this.d.ordinal() );
|
|
||||||
|
|
||||||
if ( slots == null )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (int slot : slots)
|
|
||||||
{
|
|
||||||
if ( this.i.getStackInSlot( slot ) != null )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int s = this.i.getSizeInventory();
|
|
||||||
for (int x = 0; x < s; x++)
|
|
||||||
if ( this.i.getStackInSlot( x ) != null )
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<ItemSlot> iterator()
|
|
||||||
{
|
|
||||||
return this.remover.iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -69,25 +69,25 @@ public class AdaptorList extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
for (ItemStack is : this.i)
|
for (ItemStack is : this.i)
|
||||||
{
|
{
|
||||||
if ( is != null && (filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode )) )
|
if ( is != null && (filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode )) )
|
||||||
{
|
{
|
||||||
if ( how_many > is.stackSize )
|
if ( amount > is.stackSize )
|
||||||
{
|
{
|
||||||
how_many = is.stackSize;
|
amount = is.stackSize;
|
||||||
}
|
}
|
||||||
if ( destination != null && !destination.canInsert( is ) )
|
if ( destination != null && !destination.canInsert( is ) )
|
||||||
{
|
{
|
||||||
how_many = 0;
|
amount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( how_many > 0 )
|
if ( amount > 0 )
|
||||||
{
|
{
|
||||||
ItemStack rv = is.copy();
|
ItemStack rv = is.copy();
|
||||||
rv.stackSize = how_many;
|
rv.stackSize = amount;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ public class AdaptorList extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItems(int how_many, ItemStack filter, IInventoryDestination destination)
|
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
int s = this.i.size();
|
int s = this.i.size();
|
||||||
for (int x = 0; x < s; x++)
|
for (int x = 0; x < s; x++)
|
||||||
@@ -105,16 +105,16 @@ public class AdaptorList extends InventoryAdaptor
|
|||||||
ItemStack is = this.i.get( x );
|
ItemStack is = this.i.get( x );
|
||||||
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
||||||
{
|
{
|
||||||
if ( how_many > is.stackSize )
|
if ( amount > is.stackSize )
|
||||||
how_many = is.stackSize;
|
amount = is.stackSize;
|
||||||
if ( destination != null && !destination.canInsert( is ) )
|
if ( destination != null && !destination.canInsert( is ) )
|
||||||
how_many = 0;
|
amount = 0;
|
||||||
|
|
||||||
if ( how_many > 0 )
|
if ( amount > 0 )
|
||||||
{
|
{
|
||||||
ItemStack rv = is.copy();
|
ItemStack rv = is.copy();
|
||||||
rv.stackSize = how_many;
|
rv.stackSize = amount;
|
||||||
is.stackSize -= how_many;
|
is.stackSize -= amount;
|
||||||
|
|
||||||
// remove it..
|
// remove it..
|
||||||
if ( is.stackSize <= 0 )
|
if ( is.stackSize <= 0 )
|
||||||
@@ -128,25 +128,25 @@ public class AdaptorList extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination destination)
|
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
for (ItemStack is : this.i)
|
for (ItemStack is : this.i)
|
||||||
{
|
{
|
||||||
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
||||||
{
|
{
|
||||||
if ( how_many > is.stackSize )
|
if ( amount > is.stackSize )
|
||||||
{
|
{
|
||||||
how_many = is.stackSize;
|
amount = is.stackSize;
|
||||||
}
|
}
|
||||||
if ( destination != null && !destination.canInsert( is ) )
|
if ( destination != null && !destination.canInsert( is ) )
|
||||||
{
|
{
|
||||||
how_many = 0;
|
amount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( how_many > 0 )
|
if ( amount > 0 )
|
||||||
{
|
{
|
||||||
ItemStack rv = is.copy();
|
ItemStack rv = is.copy();
|
||||||
rv.stackSize = how_many;
|
rv.stackSize = amount;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,14 +156,14 @@ public class AdaptorList extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack addItems(ItemStack A)
|
public ItemStack addItems(ItemStack toBeAdded )
|
||||||
{
|
{
|
||||||
if ( A == null )
|
if ( toBeAdded == null )
|
||||||
return null;
|
return null;
|
||||||
if ( A.stackSize == 0 )
|
if ( toBeAdded.stackSize == 0 )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ItemStack left = A.copy();
|
ItemStack left = toBeAdded.copy();
|
||||||
|
|
||||||
for (ItemStack is : this.i)
|
for (ItemStack is : this.i)
|
||||||
{
|
{
|
||||||
@@ -179,7 +179,7 @@ public class AdaptorList extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd(ItemStack A)
|
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateSimilarRemove( int how_many, ItemStack Filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
public ItemStack simulateSimilarRemove( int amount, ItemStack Filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack hand = this.p.inventory.getItemStack();
|
ItemStack hand = this.p.inventory.getItemStack();
|
||||||
@@ -75,7 +75,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||||||
if ( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
|
if ( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
|
||||||
{
|
{
|
||||||
ItemStack result = hand.copy();
|
ItemStack result = hand.copy();
|
||||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,17 +83,17 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItems( int how_many, ItemStack Filter, IInventoryDestination destination )
|
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
|
||||||
{
|
{
|
||||||
ItemStack hand = this.p.inventory.getItemStack();
|
ItemStack hand = this.p.inventory.getItemStack();
|
||||||
if ( hand == null )
|
if ( hand == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if ( Filter == null || Platform.isSameItemPrecise( Filter, hand ) )
|
if ( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||||
{
|
{
|
||||||
ItemStack result = hand.copy();
|
ItemStack result = hand.copy();
|
||||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||||
hand.stackSize -= how_many;
|
hand.stackSize -= amount;
|
||||||
if ( hand.stackSize <= 0 )
|
if ( hand.stackSize <= 0 )
|
||||||
this.p.inventory.setItemStack( null );
|
this.p.inventory.setItemStack( null );
|
||||||
return result;
|
return result;
|
||||||
@@ -103,17 +103,17 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateRemove( int how_many, ItemStack Filter, IInventoryDestination destination )
|
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack hand = this.p.inventory.getItemStack();
|
ItemStack hand = this.p.inventory.getItemStack();
|
||||||
if ( hand == null )
|
if ( hand == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if ( Filter == null || Platform.isSameItemPrecise( Filter, hand ) )
|
if ( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||||
{
|
{
|
||||||
ItemStack result = hand.copy();
|
ItemStack result = hand.copy();
|
||||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,38 +121,38 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack addItems( ItemStack A )
|
public ItemStack addItems( ItemStack toBeAdded )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( A == null )
|
if ( toBeAdded == null )
|
||||||
return null;
|
return null;
|
||||||
if ( A.stackSize == 0 )
|
if ( toBeAdded.stackSize == 0 )
|
||||||
return null;
|
return null;
|
||||||
if ( this.p == null )
|
if ( this.p == null )
|
||||||
return A;
|
return toBeAdded;
|
||||||
if ( this.p.inventory == null )
|
if ( this.p.inventory == null )
|
||||||
return A;
|
return toBeAdded;
|
||||||
|
|
||||||
ItemStack hand = this.p.inventory.getItemStack();
|
ItemStack hand = this.p.inventory.getItemStack();
|
||||||
|
|
||||||
if ( hand != null && !Platform.isSameItemPrecise( A, hand ) )
|
if ( hand != null && !Platform.isSameItemPrecise( toBeAdded, hand ) )
|
||||||
return A;
|
return toBeAdded;
|
||||||
|
|
||||||
int original = 0;
|
int original = 0;
|
||||||
ItemStack newHand = null;
|
ItemStack newHand = null;
|
||||||
if ( hand == null )
|
if ( hand == null )
|
||||||
newHand = A.copy();
|
newHand = toBeAdded.copy();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newHand = hand;
|
newHand = hand;
|
||||||
original = hand.stackSize;
|
original = hand.stackSize;
|
||||||
newHand.stackSize += A.stackSize;
|
newHand.stackSize += toBeAdded.stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( newHand.stackSize > newHand.getMaxStackSize() )
|
if ( newHand.stackSize > newHand.getMaxStackSize() )
|
||||||
{
|
{
|
||||||
newHand.stackSize = newHand.getMaxStackSize();
|
newHand.stackSize = newHand.getMaxStackSize();
|
||||||
ItemStack B = A.copy();
|
ItemStack B = toBeAdded.copy();
|
||||||
B.stackSize -= newHand.stackSize - original;
|
B.stackSize -= newHand.stackSize - original;
|
||||||
this.p.inventory.setItemStack( newHand );
|
this.p.inventory.setItemStack( newHand );
|
||||||
return B;
|
return B;
|
||||||
@@ -163,30 +163,30 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd( ItemStack A )
|
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||||
{
|
{
|
||||||
ItemStack hand = this.p.inventory.getItemStack();
|
ItemStack hand = this.p.inventory.getItemStack();
|
||||||
if ( A == null )
|
if ( toBeSimulated == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if ( hand != null && !Platform.isSameItem( A, hand ) )
|
if ( hand != null && !Platform.isSameItem( toBeSimulated, hand ) )
|
||||||
return A;
|
return toBeSimulated;
|
||||||
|
|
||||||
int original = 0;
|
int original = 0;
|
||||||
ItemStack newHand = null;
|
ItemStack newHand = null;
|
||||||
if ( hand == null )
|
if ( hand == null )
|
||||||
newHand = A.copy();
|
newHand = toBeSimulated.copy();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newHand = hand.copy();
|
newHand = hand.copy();
|
||||||
original = hand.stackSize;
|
original = hand.stackSize;
|
||||||
newHand.stackSize += A.stackSize;
|
newHand.stackSize += toBeSimulated.stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( newHand.stackSize > newHand.getMaxStackSize() )
|
if ( newHand.stackSize > newHand.getMaxStackSize() )
|
||||||
{
|
{
|
||||||
newHand.stackSize = newHand.getMaxStackSize();
|
newHand.stackSize = newHand.getMaxStackSize();
|
||||||
ItemStack B = A.copy();
|
ItemStack B = toBeSimulated.copy();
|
||||||
B.stackSize -= newHand.stackSize - original;
|
B.stackSize -= newHand.stackSize - original;
|
||||||
return B;
|
return B;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,15 +107,15 @@ public class IMEAdaptor extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination)
|
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
return this.doRemoveItems( how_many, Filter, destination, Actionable.MODULATE );
|
return this.doRemoveItems( amount, filter, destination, Actionable.MODULATE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination)
|
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
return this.doRemoveItems( how_many, Filter, destination, Actionable.SIMULATE );
|
return this.doRemoveItems( amount, filter, destination, Actionable.SIMULATE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,17 +127,17 @@ public class IMEAdaptor extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
|
||||||
{
|
{
|
||||||
if ( filter == null )
|
if ( filter == null )
|
||||||
return this.doRemoveItems( how_many, null, destination, Actionable.SIMULATE );
|
return this.doRemoveItems( amount, null, destination, Actionable.SIMULATE );
|
||||||
return this.doRemoveItemsFuzzy( how_many, filter, destination, Actionable.SIMULATE, fuzzyMode );
|
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.SIMULATE, fuzzyMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack addItems(ItemStack A)
|
public ItemStack addItems(ItemStack toBeAdded )
|
||||||
{
|
{
|
||||||
IAEItemStack in = AEItemStack.create( A );
|
IAEItemStack in = AEItemStack.create( toBeAdded );
|
||||||
if ( in != null )
|
if ( in != null )
|
||||||
{
|
{
|
||||||
IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
|
IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
|
||||||
@@ -148,9 +148,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack simulateAdd(ItemStack A)
|
public ItemStack simulateAdd(ItemStack toBeSimulated )
|
||||||
{
|
{
|
||||||
IAEItemStack in = AEItemStack.create( A );
|
IAEItemStack in = AEItemStack.create( toBeSimulated );
|
||||||
if ( in != null )
|
if ( in != null )
|
||||||
{
|
{
|
||||||
IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
|
IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class AEItemDef
|
|||||||
|
|
||||||
public int def;
|
public int def;
|
||||||
|
|
||||||
private final int itemID;
|
public final int itemID;
|
||||||
public final Item item;
|
public final Item item;
|
||||||
public int damageValue;
|
public int damageValue;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public class AEItemDef
|
|||||||
|
|
||||||
public AEItemDef(Item it) {
|
public AEItemDef(Item it) {
|
||||||
this.item = it;
|
this.item = it;
|
||||||
this.itemID = System.identityHashCode( this.item );
|
this.itemID = Item.getIdFromItem( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
public AEItemDef copy()
|
public AEItemDef copy()
|
||||||
|
|||||||
@@ -261,11 +261,19 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
@Override
|
@Override
|
||||||
public int compareTo(AEItemStack b)
|
public int compareTo(AEItemStack b)
|
||||||
{
|
{
|
||||||
int id = this.compare( this.def.item.hashCode(), b.def.item.hashCode() );
|
int id = this.def.itemID - b.def.itemID;
|
||||||
int damageValue = this.compare( this.def.damageValue, b.def.damageValue );
|
if (id != 0)
|
||||||
int displayDamage = this.compare( this.def.displayDamage, b.def.displayDamage );
|
return id;
|
||||||
// AELog.info( "NBT: " + nbt );
|
|
||||||
return id == 0 ? (damageValue == 0 ? (displayDamage == 0 ? this.compareNBT( b.def ) : displayDamage) : damageValue) : id;
|
int damageValue = this.def.damageValue - b.def.damageValue ;
|
||||||
|
if (damageValue != 0)
|
||||||
|
return damageValue;
|
||||||
|
|
||||||
|
int displayDamage = this.def.displayDamage - b.def.displayDamage;
|
||||||
|
if (displayDamage != 0)
|
||||||
|
return displayDamage;
|
||||||
|
|
||||||
|
return (this.def.tagCompound == b.def.tagCompound) ? 0 : this.compareNBT( b.def );
|
||||||
}
|
}
|
||||||
|
|
||||||
private int compareNBT(AEItemDef b)
|
private int compareNBT(AEItemDef b)
|
||||||
@@ -276,7 +284,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int compare(int l, long m)
|
private int compare(int l, int m)
|
||||||
{
|
{
|
||||||
return l < m ? -1 : (l > m ? 1 : 0);
|
return l < m ? -1 : (l > m ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,18 @@
|
|||||||
|
|
||||||
package appeng.util.item;
|
package appeng.util.item;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.cache.CacheLoader;
|
||||||
|
import com.google.common.cache.LoadingCache;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -27,15 +37,129 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class OreHelper
|
public class OreHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final OreHelper INSTANCE = new OreHelper();
|
public static final OreHelper INSTANCE = new OreHelper();
|
||||||
|
|
||||||
static class ItemRef
|
/**
|
||||||
|
* A local cache to speed up OreDictionary lookups.
|
||||||
|
*/
|
||||||
|
private final LoadingCache<String, List<ItemStack>> oreDictCache = CacheBuilder
|
||||||
|
.newBuilder().build( new CacheLoader<String, List<ItemStack>>(){
|
||||||
|
public List<ItemStack> load( String oreName )
|
||||||
|
{
|
||||||
|
return OreDictionary.getOres( oreName );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
private final Map<ItemRef, OreReference> references = new HashMap<ItemRef, OreReference>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if the passed {@link ItemStack} is an ore.
|
||||||
|
*
|
||||||
|
* @param ItemStack the itemstack to test
|
||||||
|
* @return true if an ore entry exists, false otherwise
|
||||||
|
*/
|
||||||
|
public OreReference isOre( ItemStack ItemStack )
|
||||||
|
{
|
||||||
|
ItemRef ir = new ItemRef( ItemStack );
|
||||||
|
|
||||||
|
if ( !this.references.containsKey( ir ) )
|
||||||
|
{
|
||||||
|
final OreReference ref = new OreReference();
|
||||||
|
final Collection<Integer> ores = ref.getOres();
|
||||||
|
final Collection<String> set = ref.getEquivalents();
|
||||||
|
|
||||||
|
Set<String> toAdd = new HashSet<String>();
|
||||||
|
|
||||||
|
for ( String ore : OreDictionary.getOreNames() )
|
||||||
|
{
|
||||||
|
// skip ore if it is a match already or null.
|
||||||
|
if ( ore == null || toAdd.contains( ore ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( ItemStack oreItem : oreDictCache.getUnchecked( ore ) )
|
||||||
|
{
|
||||||
|
if ( OreDictionary.itemMatches( oreItem, ItemStack, false ) )
|
||||||
|
{
|
||||||
|
toAdd.add( ore );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( String ore : toAdd )
|
||||||
|
{
|
||||||
|
set.add( ore );
|
||||||
|
ores.add( OreDictionary.getOreID( ore ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !set.isEmpty() )
|
||||||
|
this.references.put( ir, ref );
|
||||||
|
else
|
||||||
|
this.references.put( ir, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.references.get( ir );
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sameOre( AEItemStack aeItemStack, IAEItemStack is )
|
||||||
|
{
|
||||||
|
OreReference a = aeItemStack.def.isOre;
|
||||||
|
OreReference b = aeItemStack.def.isOre;
|
||||||
|
|
||||||
|
return this.sameOre( a, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sameOre( OreReference a, OreReference b )
|
||||||
|
{
|
||||||
|
if ( a == null || b == null )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( a == b )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Collection<Integer> bOres = b.getOres();
|
||||||
|
for ( Integer ore : a.getOres() )
|
||||||
|
{
|
||||||
|
if ( bOres.contains( ore ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sameOre( AEItemStack aeItemStack, ItemStack o )
|
||||||
|
{
|
||||||
|
OreReference a = aeItemStack.def.isOre;
|
||||||
|
if ( a == null )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for ( String oreName : a.getEquivalents() )
|
||||||
|
{
|
||||||
|
for ( ItemStack oreItem : oreDictCache.getUnchecked( oreName ) )
|
||||||
|
{
|
||||||
|
if ( OreDictionary.itemMatches( oreItem, o, false ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> getCachedOres( String oreName )
|
||||||
|
{
|
||||||
|
return oreDictCache.getUnchecked( oreName );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ItemRef
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemRef(ItemStack stack)
|
ItemRef( ItemStack stack )
|
||||||
{
|
{
|
||||||
this.ref = stack.getItem();
|
this.ref = stack.getItem();
|
||||||
|
|
||||||
@@ -47,18 +171,18 @@ public class OreHelper
|
|||||||
this.hash = this.ref.hashCode() ^ this.damage;
|
this.hash = this.ref.hashCode() ^ this.damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Item ref;
|
private final Item ref;
|
||||||
final int damage;
|
private final int damage;
|
||||||
final int hash;
|
private final int hash;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals( Object obj )
|
||||||
{
|
{
|
||||||
if ( obj == null )
|
if ( obj == null )
|
||||||
return false;
|
return false;
|
||||||
if ( this.getClass() != obj.getClass() )
|
if ( this.getClass() != obj.getClass() )
|
||||||
return false;
|
return false;
|
||||||
ItemRef other = (ItemRef) obj;
|
ItemRef other = ( ItemRef ) obj;
|
||||||
return this.damage == other.damage && this.ref == other.ref;
|
return this.damage == other.damage && this.ref == other.ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,111 +192,15 @@ public class OreHelper
|
|||||||
return this.hash;
|
return this.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public String toString()
|
||||||
static class OreResult
|
|
||||||
{
|
|
||||||
|
|
||||||
public OreReference oreValue = null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
final HashMap<ItemRef, OreResult> references = new HashMap<ItemRef, OreResult>();
|
|
||||||
|
|
||||||
public OreReference isOre(ItemStack ItemStack)
|
|
||||||
{
|
|
||||||
ItemRef ir = new ItemRef( ItemStack );
|
|
||||||
OreResult or = this.references.get( ir );
|
|
||||||
|
|
||||||
if ( or == null )
|
|
||||||
{
|
{
|
||||||
or = new OreResult();
|
StringBuilder builder = new StringBuilder();
|
||||||
this.references.put( ir, or );
|
builder.append( "ItemRef [ref=" ).append( ref.getUnlocalizedName() )
|
||||||
|
.append( ", damage=" ).append( damage ).append( ", hash=" )
|
||||||
OreReference ref = new OreReference();
|
.append( hash ).append( "]" );
|
||||||
Collection<Integer> ores = ref.getOres();
|
return builder.toString();
|
||||||
Collection<ItemStack> set = ref.getEquivalents();
|
|
||||||
|
|
||||||
for (String ore : OreDictionary.getOreNames())
|
|
||||||
{
|
|
||||||
boolean add = false;
|
|
||||||
|
|
||||||
for (ItemStack oreItem : OreDictionary.getOres( ore ))
|
|
||||||
{
|
|
||||||
if ( OreDictionary.itemMatches( oreItem, ItemStack, false ) )
|
|
||||||
{
|
|
||||||
add = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( add )
|
|
||||||
{
|
|
||||||
for (ItemStack oreItem : OreDictionary.getOres( ore ))
|
|
||||||
set.add( oreItem.copy() );
|
|
||||||
|
|
||||||
ores.add( OreDictionary.getOreID( ore ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !set.isEmpty() )
|
|
||||||
or.oreValue = ref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return or.oreValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean sameOre(AEItemStack aeItemStack, IAEItemStack is)
|
|
||||||
{
|
|
||||||
OreReference a = aeItemStack.def.isOre;
|
|
||||||
OreReference b = aeItemStack.def.isOre;
|
|
||||||
|
|
||||||
if ( a == null || b == null )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( a == b )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
Collection<Integer> bOres = b.getOres();
|
|
||||||
for (Integer ore : a.getOres())
|
|
||||||
{
|
|
||||||
if ( bOres.contains( ore ) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean sameOre(OreReference a, OreReference b)
|
|
||||||
{
|
|
||||||
if ( a == null || b == null )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( a == b )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
Collection<Integer> bOres = b.getOres();
|
|
||||||
for (Integer ore : a.getOres())
|
|
||||||
{
|
|
||||||
if ( bOres.contains( ore ) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean sameOre(AEItemStack aeItemStack, ItemStack o)
|
|
||||||
{
|
|
||||||
OreReference a = aeItemStack.def.isOre;
|
|
||||||
if ( a == null )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (ItemStack oreItem : a.getEquivalents())
|
|
||||||
{
|
|
||||||
if ( OreDictionary.itemMatches( oreItem, o, false ) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,24 +18,27 @@
|
|||||||
|
|
||||||
package appeng.util.item;
|
package appeng.util.item;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class OreReference
|
public class OreReference
|
||||||
{
|
{
|
||||||
|
|
||||||
private final LinkedList<ItemStack> otherOptions = new LinkedList<ItemStack>();
|
private final List<String> otherOptions = new LinkedList<String>();
|
||||||
private ArrayList<IAEItemStack> aeOtherOptions = null;
|
private List<IAEItemStack> aeOtherOptions = null;
|
||||||
private final HashSet<Integer> ores = new HashSet<Integer>();
|
private final Set<Integer> ores = new HashSet<Integer>();
|
||||||
|
|
||||||
public Collection<ItemStack> getEquivalents()
|
public Collection<String> getEquivalents()
|
||||||
{
|
{
|
||||||
return this.otherOptions;
|
return this.otherOptions;
|
||||||
}
|
}
|
||||||
@@ -47,9 +50,17 @@ public class OreReference
|
|||||||
this.aeOtherOptions = new ArrayList<IAEItemStack>( this.otherOptions.size() );
|
this.aeOtherOptions = new ArrayList<IAEItemStack>( this.otherOptions.size() );
|
||||||
|
|
||||||
// SUMMON AE STACKS!
|
// SUMMON AE STACKS!
|
||||||
for (ItemStack is : this.otherOptions)
|
for ( String oreName : this.otherOptions )
|
||||||
if ( is.getItem() != null )
|
{
|
||||||
this.aeOtherOptions.add( AEItemStack.create( is ) );
|
for ( ItemStack is : OreHelper.INSTANCE.getCachedOres( oreName ) )
|
||||||
|
{
|
||||||
|
if ( is.getItem() != null )
|
||||||
|
{
|
||||||
|
this.aeOtherOptions.add( AEItemStack.create( is ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.aeOtherOptions;
|
return this.aeOtherOptions;
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ chat.appliedenergistics2.OutOfRange=Wireless Out Of Range.
|
|||||||
chat.appliedenergistics2.InvalidMachine=Invalid Machine.
|
chat.appliedenergistics2.InvalidMachine=Invalid Machine.
|
||||||
chat.appliedenergistics2.LoadedSettings=Successfully loaded settings.
|
chat.appliedenergistics2.LoadedSettings=Successfully loaded settings.
|
||||||
chat.appliedenergistics2.DeviceNotPowered=Device is low on power.
|
chat.appliedenergistics2.DeviceNotPowered=Device is low on power.
|
||||||
|
chat.appliedenergistics2.DeviceNotWirelessTerminal=Device is not a wireless terminal.
|
||||||
|
chat.appliedenergistics2.DeviceNotLinked=Device is not linked.
|
||||||
|
chat.appliedenergistics2.StationCanNotBeLocated=Station can not be located.
|
||||||
chat.appliedenergistics2.MachineNotPowered=Machine is not powered.
|
chat.appliedenergistics2.MachineNotPowered=Machine is not powered.
|
||||||
chat.appliedenergistics2.CommunicationError=Error Communicating with Network.
|
chat.appliedenergistics2.CommunicationError=Error Communicating with Network.
|
||||||
chat.appliedenergistics2.SavedSettings=Successfully saved settings.
|
chat.appliedenergistics2.SavedSettings=Successfully saved settings.
|
||||||
@@ -252,7 +255,7 @@ gui.tooltips.appliedenergistics2.AlwaysActive=Always active
|
|||||||
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Active without signal
|
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Active without signal
|
||||||
gui.tooltips.appliedenergistics2.ActiveWithSignal=Active with signal
|
gui.tooltips.appliedenergistics2.ActiveWithSignal=Active with signal
|
||||||
gui.tooltips.appliedenergistics2.ActiveOnPulse=Activate once per pulse
|
gui.tooltips.appliedenergistics2.ActiveOnPulse=Activate once per pulse
|
||||||
gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emit when levels are below or equal to limit.
|
gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emit when levels are below limit.
|
||||||
gui.tooltips.appliedenergistics2.EmitLevelAbove=Emit when levels are above or equal to limit.
|
gui.tooltips.appliedenergistics2.EmitLevelAbove=Emit when levels are above or equal to limit.
|
||||||
gui.tooltips.appliedenergistics2.SearchMode_Auto=Auto Search
|
gui.tooltips.appliedenergistics2.SearchMode_Auto=Auto Search
|
||||||
gui.tooltips.appliedenergistics2.SearchMode_Standard=Standard Search
|
gui.tooltips.appliedenergistics2.SearchMode_Standard=Standard Search
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ tile.appliedenergistics2.BlockCraftingAccelerator.name=Unité de co-traitement
|
|||||||
tile.appliedenergistics2.BlockCraftingUnit.name=Unité de craft
|
tile.appliedenergistics2.BlockCraftingUnit.name=Unité de craft
|
||||||
tile.appliedenergistics2.BlockMolecularAssembler.name=Assembleur moléculaire
|
tile.appliedenergistics2.BlockMolecularAssembler.name=Assembleur moléculaire
|
||||||
|
|
||||||
|
// Stairs
|
||||||
|
tile.appliedenergistics2.ChiseledQuartzStairBlock.name=Escaliers de Quartz Certus ciselé
|
||||||
|
tile.appliedenergistics2.FluixStairBlock.name=Escaliers de Fluix
|
||||||
|
tile.appliedenergistics2.QuartzPillarStairBlock.name=Escaliers de pilier de Quartz Certus
|
||||||
|
tile.appliedenergistics2.QuartzStairBlock.name=Escaliers de Quartz Certus
|
||||||
|
tile.appliedenergistics2.SkyStoneBlockStairBlock.name=Escaliers de bloc de pierre de ciel
|
||||||
|
tile.appliedenergistics2.SkyStoneBrickStairBlock.name=Escaliers de briques de pierre de ciel
|
||||||
|
tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Escaliers de petites briques de pierre de ciel
|
||||||
|
tile.appliedenergistics2.SkyStoneStairBlock.name=Escaliers de pierre de ciel
|
||||||
|
|
||||||
chat.appliedenergistics2.ChestCannotReadStorageCell=Le coffre ME Chest ne peut pas lire la cellule de stockage.
|
chat.appliedenergistics2.ChestCannotReadStorageCell=Le coffre ME Chest ne peut pas lire la cellule de stockage.
|
||||||
chat.appliedenergistics2.SettingCleared=Paramètres effacés.
|
chat.appliedenergistics2.SettingCleared=Paramètres effacés.
|
||||||
chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée.
|
chat.appliedenergistics2.OutOfRange=Réseau sans-fil hors de portée.
|
||||||
@@ -242,7 +252,7 @@ gui.tooltips.appliedenergistics2.AlwaysActive=Toujours actif
|
|||||||
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Actif sans signal
|
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=Actif sans signal
|
||||||
gui.tooltips.appliedenergistics2.ActiveWithSignal=Actif avec un signal
|
gui.tooltips.appliedenergistics2.ActiveWithSignal=Actif avec un signal
|
||||||
gui.tooltips.appliedenergistics2.ActiveOnPulse=Activer une fois par impulsion
|
gui.tooltips.appliedenergistics2.ActiveOnPulse=Activer une fois par impulsion
|
||||||
gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emettre quand les niveaux sont inférieurs ou égaux à la limite.
|
gui.tooltips.appliedenergistics2.EmitLevelsBelow=Emettre quand les niveaux sont inférieurs à la limite.
|
||||||
gui.tooltips.appliedenergistics2.EmitLevelAbove=Emettre quand les niveaux sont supérieurs ou égaux à la limite.
|
gui.tooltips.appliedenergistics2.EmitLevelAbove=Emettre quand les niveaux sont supérieurs ou égaux à la limite.
|
||||||
gui.tooltips.appliedenergistics2.SearchMode_Auto=Recherche auto
|
gui.tooltips.appliedenergistics2.SearchMode_Auto=Recherche auto
|
||||||
gui.tooltips.appliedenergistics2.SearchMode_Standard=Recharche standard
|
gui.tooltips.appliedenergistics2.SearchMode_Standard=Recharche standard
|
||||||
@@ -278,6 +288,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=Emettre un signal Redstone qua
|
|||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Rapport d'éléments inaccessibles
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Rapport d'éléments inaccessibles
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Oui: Les éléments ne pouvant pas être extraits seront visibles.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Oui: Les éléments ne pouvant pas être extraits seront visibles.
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=Non: Seuls les éléments extractibles seront visibles.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=Non: Seuls les éléments extractibles seront visibles.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacement=Placement de bloc
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementYes=Les blocs seront placés comme un bloc.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementNo=Les blocs seront jettés comme un élément.
|
||||||
|
|
||||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||||
gui.appliedenergistics2.units.buildcraft=Minecraft Joules
|
gui.appliedenergistics2.units.buildcraft=Minecraft Joules
|
||||||
@@ -304,6 +317,7 @@ gui.appliedenergistics2.Red=Rouge
|
|||||||
gui.appliedenergistics2.Black=Noir
|
gui.appliedenergistics2.Black=Noir
|
||||||
gui.appliedenergistics2.Fluix=Fluix
|
gui.appliedenergistics2.Fluix=Fluix
|
||||||
|
|
||||||
|
waila.appliedenergistics2.Crafting=Fabrication
|
||||||
waila.appliedenergistics2.DeviceOnline=Dispositif en ligne
|
waila.appliedenergistics2.DeviceOnline=Dispositif en ligne
|
||||||
waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne
|
waila.appliedenergistics2.DeviceOffline=Dispositif hors ligne
|
||||||
waila.appliedenergistics2.DeviceMissingChannel=Appareil sans canal
|
waila.appliedenergistics2.DeviceMissingChannel=Appareil sans canal
|
||||||
@@ -380,7 +394,7 @@ item.appliedenergistics2.ItemMaterial.SiliconPress.name=Matrice de presse de sil
|
|||||||
item.appliedenergistics2.ItemMaterial.SiliconPrint.name=Silicone imprimé
|
item.appliedenergistics2.ItemMaterial.SiliconPrint.name=Silicone imprimé
|
||||||
item.appliedenergistics2.ItemMaterial.NamePress.name=Matrice de presse de nommage
|
item.appliedenergistics2.ItemMaterial.NamePress.name=Matrice de presse de nommage
|
||||||
item.appliedenergistics2.ItemMaterial.SkyDust.name=Poussière de pierre du ciel
|
item.appliedenergistics2.ItemMaterial.SkyDust.name=Poussière de pierre du ciel
|
||||||
item.appliedenergistics2.ItemMaterial.CardCrafting.name=Carte de craft
|
item.appliedenergistics2.ItemMaterial.CardCrafting.name=Carte de fabrication
|
||||||
|
|
||||||
item.appliedenergistics2.ItemPart.AnnihilationPlane.name=Plan de dématérialisation ME
|
item.appliedenergistics2.ItemPart.AnnihilationPlane.name=Plan de dématérialisation ME
|
||||||
item.appliedenergistics2.ItemPart.CableAnchor.name=Ancre de câble
|
item.appliedenergistics2.ItemPart.CableAnchor.name=Ancre de câble
|
||||||
|
|||||||
@@ -50,12 +50,25 @@ tile.appliedenergistics2.BlockCraftingAccelerator.name=Unità co-processore per
|
|||||||
tile.appliedenergistics2.BlockCraftingUnit.name=Unità di fabbricazione
|
tile.appliedenergistics2.BlockCraftingUnit.name=Unità di fabbricazione
|
||||||
tile.appliedenergistics2.BlockMolecularAssembler.name=Assemblatore moleculare
|
tile.appliedenergistics2.BlockMolecularAssembler.name=Assemblatore moleculare
|
||||||
|
|
||||||
|
// Stairs
|
||||||
|
tile.appliedenergistics2.ChiseledQuartzStairBlock.name=Scalini di quarzo certus intagliato
|
||||||
|
tile.appliedenergistics2.FluixStairBlock.name=Scalini di fluix
|
||||||
|
tile.appliedenergistics2.QuartzPillarStairBlock.name=Scalini di pilastro di quarzo certus
|
||||||
|
tile.appliedenergistics2.QuartzStairBlock.name=Scalini di quarzo certus
|
||||||
|
tile.appliedenergistics2.SkyStoneBlockStairBlock.name=Scalini di blocco di roccia del cielo
|
||||||
|
tile.appliedenergistics2.SkyStoneBrickStairBlock.name=Scalini di roccia del cielo concia
|
||||||
|
tile.appliedenergistics2.SkyStoneSmallBrickStairBlock.name=Scalini di mattoni di roccia del cielo
|
||||||
|
tile.appliedenergistics2.SkyStoneStairBlock.name=Scalini di roccia del cielo
|
||||||
|
|
||||||
chat.appliedenergistics2.ChestCannotReadStorageCell=Baule ME non riesce a leggere cella di immagazzinaggio.
|
chat.appliedenergistics2.ChestCannotReadStorageCell=Baule ME non riesce a leggere cella di immagazzinaggio.
|
||||||
chat.appliedenergistics2.SettingCleared=Impostazioni cancellate.
|
chat.appliedenergistics2.SettingCleared=Impostazioni cancellate.
|
||||||
chat.appliedenergistics2.OutOfRange=Wireless fuori portata.
|
chat.appliedenergistics2.OutOfRange=Wireless fuori portata.
|
||||||
chat.appliedenergistics2.InvalidMachine=Macchina invalida.
|
chat.appliedenergistics2.InvalidMachine=Macchina invalida.
|
||||||
chat.appliedenergistics2.LoadedSettings=Impostazioni caricate con successo.
|
chat.appliedenergistics2.LoadedSettings=Impostazioni caricate con successo.
|
||||||
chat.appliedenergistics2.DeviceNotPowered=Dispositivo a corto di energia.
|
chat.appliedenergistics2.DeviceNotPowered=Dispositivo a corto di energia.
|
||||||
|
chat.appliedenergistics2.DeviceNotWirelessTerminal=Dispositivo non è un terminale wireless.
|
||||||
|
chat.appliedenergistics2.DeviceNotLinked=Dispositivo non è collegato is not linked.
|
||||||
|
chat.appliedenergistics2.StationCanNotBeLocated=Emittente non può essere trovato.
|
||||||
chat.appliedenergistics2.MachineNotPowered=Macchina non alimentata.
|
chat.appliedenergistics2.MachineNotPowered=Macchina non alimentata.
|
||||||
chat.appliedenergistics2.CommunicationError=Errore nel communicare col Sistema.
|
chat.appliedenergistics2.CommunicationError=Errore nel communicare col Sistema.
|
||||||
chat.appliedenergistics2.SavedSettings=Impostazioni salvate con successo.
|
chat.appliedenergistics2.SavedSettings=Impostazioni salvate con successo.
|
||||||
@@ -278,6 +291,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=Emette pietrarossa mentre fabb
|
|||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Riporta oggetti inaccessibili
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Riporta oggetti inaccessibili
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Si: gli oggetti che non possono essere estratti sono visibili.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Si: gli oggetti che non possono essere estratti sono visibili.
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=No: Solo oggetti estrabili sono visibili.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=No: Solo oggetti estrabili sono visibili.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacement=Piazzamento di blocco
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementYes=I blocchi saranno piazzati come blocco.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementNo=I blocchi saranno fatti cadere come oggetti.
|
||||||
|
|
||||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||||
gui.appliedenergistics2.units.buildcraft=Minecraft Joules
|
gui.appliedenergistics2.units.buildcraft=Minecraft Joules
|
||||||
@@ -304,6 +320,7 @@ gui.appliedenergistics2.Red=Rosso
|
|||||||
gui.appliedenergistics2.Black=Nero
|
gui.appliedenergistics2.Black=Nero
|
||||||
gui.appliedenergistics2.Fluix=Fluix
|
gui.appliedenergistics2.Fluix=Fluix
|
||||||
|
|
||||||
|
waila.appliedenergistics2.Crafting=Fabbricazione
|
||||||
waila.appliedenergistics2.DeviceOnline=Dispositivo online
|
waila.appliedenergistics2.DeviceOnline=Dispositivo online
|
||||||
waila.appliedenergistics2.DeviceOffline=Dispositivo offline
|
waila.appliedenergistics2.DeviceOffline=Dispositivo offline
|
||||||
waila.appliedenergistics2.DeviceMissingChannel=Al dispositivo manca il canale
|
waila.appliedenergistics2.DeviceMissingChannel=Al dispositivo manca il canale
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ chat.appliedenergistics2.OutOfRange=超出无线信号范围.
|
|||||||
chat.appliedenergistics2.InvalidMachine=无效机器.
|
chat.appliedenergistics2.InvalidMachine=无效机器.
|
||||||
chat.appliedenergistics2.LoadedSettings=成功载入设定.
|
chat.appliedenergistics2.LoadedSettings=成功载入设定.
|
||||||
chat.appliedenergistics2.DeviceNotPowered=设备供能不足.
|
chat.appliedenergistics2.DeviceNotPowered=设备供能不足.
|
||||||
|
chat.appliedenergistics2.DeviceNotWirelessTerminal=设备不是无线终端.
|
||||||
|
chat.appliedenergistics2.DeviceNotLinked=设备未连接.
|
||||||
|
chat.appliedenergistics2.StationCanNotBeLocated=无法定位安全终端.
|
||||||
chat.appliedenergistics2.MachineNotPowered=机器未供能.
|
chat.appliedenergistics2.MachineNotPowered=机器未供能.
|
||||||
chat.appliedenergistics2.CommunicationError=网络交互错误.
|
chat.appliedenergistics2.CommunicationError=网络交互错误.
|
||||||
chat.appliedenergistics2.SavedSettings=成功保存设定.
|
chat.appliedenergistics2.SavedSettings=成功保存设定.
|
||||||
@@ -194,7 +197,7 @@ gui.appliedenergistics2.NoCraftingCPUs=没有可用的合成CPU...
|
|||||||
gui.appliedenergistics2.CalculatingWait=正在计算,请等待...
|
gui.appliedenergistics2.CalculatingWait=正在计算,请等待...
|
||||||
gui.appliedenergistics2.Clean=清空
|
gui.appliedenergistics2.Clean=清空
|
||||||
gui.appliedenergistics2.InvalidPattern=无效样板
|
gui.appliedenergistics2.InvalidPattern=无效样板
|
||||||
gui.appliedenergistics2.Range=Range
|
gui.appliedenergistics2.Range=范围
|
||||||
gui.appliedenergistics2.TransparentFacades=透明的伪装板
|
gui.appliedenergistics2.TransparentFacades=透明的伪装板
|
||||||
gui.appliedenergistics2.TransparentFacadesHint=控制当网络工具放在快捷栏时,伪装板显示的透明度.
|
gui.appliedenergistics2.TransparentFacadesHint=控制当网络工具放在快捷栏时,伪装板显示的透明度.
|
||||||
gui.appliedenergistics2.CPUs=CPU
|
gui.appliedenergistics2.CPUs=CPU
|
||||||
@@ -252,7 +255,7 @@ gui.tooltips.appliedenergistics2.AlwaysActive=总是激活
|
|||||||
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=无信号时激活
|
gui.tooltips.appliedenergistics2.ActiveWithoutSignal=无信号时激活
|
||||||
gui.tooltips.appliedenergistics2.ActiveWithSignal=有信号时激活
|
gui.tooltips.appliedenergistics2.ActiveWithSignal=有信号时激活
|
||||||
gui.tooltips.appliedenergistics2.ActiveOnPulse=有脉冲信号时激活
|
gui.tooltips.appliedenergistics2.ActiveOnPulse=有脉冲信号时激活
|
||||||
gui.tooltips.appliedenergistics2.EmitLevelsBelow=当容量标准小于等于设定限制时发出信号.
|
gui.tooltips.appliedenergistics2.EmitLevelsBelow=当容量标准小于设定限制时发出信号.
|
||||||
gui.tooltips.appliedenergistics2.EmitLevelAbove=当容量标准大于等于设定限制时发出信号.
|
gui.tooltips.appliedenergistics2.EmitLevelAbove=当容量标准大于等于设定限制时发出信号.
|
||||||
gui.tooltips.appliedenergistics2.SearchMode_Auto=自动搜索
|
gui.tooltips.appliedenergistics2.SearchMode_Auto=自动搜索
|
||||||
gui.tooltips.appliedenergistics2.SearchMode_Standard=标准搜索
|
gui.tooltips.appliedenergistics2.SearchMode_Standard=标准搜索
|
||||||
@@ -288,6 +291,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=在物品合成时发射红石
|
|||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=报告不可交互的物品
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=报告不可交互的物品
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=是: 显示无法取出的物品.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=是: 显示无法取出的物品.
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=否: 只显示可以取出的物品.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=否: 只显示可以取出的物品.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacement=方块放置方式
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementYes=方块将被放置.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementNo=方块将以物品形式掉落.
|
||||||
|
|
||||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||||
gui.appliedenergistics2.units.buildcraft=MJ
|
gui.appliedenergistics2.units.buildcraft=MJ
|
||||||
@@ -322,6 +328,7 @@ waila.appliedenergistics2.Unlocked=未锁定
|
|||||||
waila.appliedenergistics2.Showing=显示
|
waila.appliedenergistics2.Showing=显示
|
||||||
waila.appliedenergistics2.Contains=容纳
|
waila.appliedenergistics2.Contains=容纳
|
||||||
waila.appliedenergistics2.Channels=频道
|
waila.appliedenergistics2.Channels=频道
|
||||||
|
waila.appliedenergistics2.Crafting=合成中
|
||||||
|
|
||||||
item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k-ME存储元件
|
item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k-ME存储元件
|
||||||
item.appliedenergistics2.ItemBasicStorageCell.4k.name=4k-ME存储元件
|
item.appliedenergistics2.ItemBasicStorageCell.4k.name=4k-ME存储元件
|
||||||
@@ -333,7 +340,7 @@ item.appliedenergistics2.ItemViewCell.name=显示元件
|
|||||||
item.appliedenergistics2.ItemFacade.name=线缆伪装板
|
item.appliedenergistics2.ItemFacade.name=线缆伪装板
|
||||||
|
|
||||||
item.appliedenergistics2.ItemCrystalSeed.Certus.name=赛特斯石英种子
|
item.appliedenergistics2.ItemCrystalSeed.Certus.name=赛特斯石英种子
|
||||||
item.appliedenergistics2.ItemCrystalSeed.Nether.name=下界石英钟子
|
item.appliedenergistics2.ItemCrystalSeed.Nether.name=下界石英种子
|
||||||
item.appliedenergistics2.ItemCrystalSeed.Fluix.name=福鲁伊克斯种子
|
item.appliedenergistics2.ItemCrystalSeed.Fluix.name=福鲁伊克斯种子
|
||||||
item.appliedenergistics2.ItemMaterial.InvalidType.name=该物品被禁用.
|
item.appliedenergistics2.ItemMaterial.InvalidType.name=该物品被禁用.
|
||||||
item.appliedenergistics2.ItemMaterial.AdvCard.name=高级卡
|
item.appliedenergistics2.ItemMaterial.AdvCard.name=高级卡
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package appeng.services.version;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for {@link VersionParser}
|
||||||
|
*/
|
||||||
|
public final class VersionParserTest
|
||||||
|
{
|
||||||
|
private static final String GITHUB_VERSION = "rv2.beta.8";
|
||||||
|
private static final String GITHUB_INVALID_REVISION = "2.beta.8";
|
||||||
|
private static final String GITHUB_INVALID_CHANNEL = "rv2.gamma.8";
|
||||||
|
private static final String GITHUB_INVALID_BUILD = "rv2.beta.b8";
|
||||||
|
private static final String MOD_VERSION = "rv2-beta-8";
|
||||||
|
private static final String MOD_INVALID_REVISION = "2-beta-8";
|
||||||
|
private static final String MOD_INVALID_CHANNEL = "rv2-gamma-8";
|
||||||
|
private static final String MOD_INVALID_BUILD = "rv2-beta-b8";
|
||||||
|
|
||||||
|
private static final DefaultVersion VERSION = new DefaultVersion( 2, Channel.Beta, 8 );
|
||||||
|
|
||||||
|
private final VersionParser parser;
|
||||||
|
|
||||||
|
public VersionParserTest()
|
||||||
|
{
|
||||||
|
this.parser = new VersionParser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParseGitHub_shouldPass()
|
||||||
|
{
|
||||||
|
assertTrue( this.parser.parse( GITHUB_VERSION ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = AssertionError.class )
|
||||||
|
public void parseGH_InvalidRevision_NotPass()
|
||||||
|
{
|
||||||
|
assertFalse( this.parser.parse( GITHUB_INVALID_REVISION ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = AssertionError.class )
|
||||||
|
public void parseGH_InvalidChannel_NotPass()
|
||||||
|
{
|
||||||
|
assertFalse( this.parser.parse( GITHUB_INVALID_CHANNEL ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = AssertionError.class )
|
||||||
|
public void parseGH_InvalidBuild_NotPass()
|
||||||
|
{
|
||||||
|
assertFalse( this.parser.parse( GITHUB_INVALID_BUILD ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParseMod_shouldPass()
|
||||||
|
{
|
||||||
|
assertTrue( this.parser.parse( MOD_VERSION ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = AssertionError.class )
|
||||||
|
public void parseMod_InvalidRevision_NotPass()
|
||||||
|
{
|
||||||
|
assertFalse( this.parser.parse( MOD_INVALID_REVISION ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = AssertionError.class )
|
||||||
|
public void parseMod_InvalidChannel_NotPass()
|
||||||
|
{
|
||||||
|
assertFalse( this.parser.parse( MOD_INVALID_CHANNEL ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = AssertionError.class )
|
||||||
|
public void parseMod_InvalidBuild_NotPass()
|
||||||
|
{
|
||||||
|
assertFalse( this.parser.parse( MOD_INVALID_BUILD ).equals( VERSION ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
/**
|
/**
|
||||||
* Tests for {@link UUIDMatcher}
|
* Tests for {@link UUIDMatcher}
|
||||||
*/
|
*/
|
||||||
public class UUIDMatcherTest
|
public final class UUIDMatcherTest
|
||||||
{
|
{
|
||||||
private static final String IS_UUID = "03ba29a1-d6bd-32ba-90b2-375e4d65abc9";
|
private static final String IS_UUID = "03ba29a1-d6bd-32ba-90b2-375e4d65abc9";
|
||||||
private static final String NO_UUID = "no";
|
private static final String NO_UUID = "no";
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user