Compare commits

...

31 Commits

Author SHA1 Message Date
thatsIch 1067d30264 Merge pull request #1078 from thatsIch/b-1077-hotfix-packet-size
Fixes #1077 Hotfix: Opening a terminal will not crash as fast anymore in systems with many items.
2015-03-25 12:19:49 +01:00
thatsIch 96145e75f4 Merge pull request #1075 from thatsIch/b-822-io-port
Fixes #822 Automation of IO Port works as intended again
2015-03-25 12:19:09 +01:00
thatsIch 2ba6dad3b2 Merge pull request #1092 from bakaxyf/patch-1
Update zh_CN.lang
2015-03-25 10:51:02 +01:00
bakaxyf a870393edb Update zh_CN.lang 2015-03-25 16:37:46 +08:00
thatsIch d04bc2fb3c Fixed typo in ToC 2015-03-24 18:39:44 +01:00
thatsIch 9d52e85afa Merge pull request #1083 from thatsIch/b-1076-nei-crash
Fixes #1076 Crash on shift clicking a recipe from NEI
2015-03-24 16:54:08 +01:00
thatsIch 3745e6ce8d Fixes #1076 Crash on shift clicking a recipe from NEI 2015-03-24 13:42:32 +01:00
thatsIch a4c38263d1 Merge pull request #1082 from thatsIch/e-integration-name
Renamed Integration class to upper case
2015-03-24 13:18:14 +01:00
thatsIch c1a7a35192 Renamed Integration class to upper case 2015-03-24 13:17:01 +01:00
thatsIch eb98ec891b Merge pull request #1066 from thatsIch/e-remove-deprecated-access
Removes deprecated method access of LocatableRegistry and getPickBlock
2015-03-24 12:47:55 +01:00
thatsIch 69a5507f96 Merge pull request #1064 from thatsIch/e-updated-public-dependencies
Updated public dependencies
2015-03-24 12:47:18 +01:00
thatsIch a1f43ff51a Fixes #1077 Hotfix: Opening a terminal will not crash as fast anymore in systems with many items. 2015-03-23 16:36:06 +01:00
thatsIch da91585d69 Fixes #822 Automation of IO Port works as inteded again
Top and bottom can insert into input slots 0 - 5 on the left
Sides can extract from output slots 6 - 11 on the eight
2015-03-22 11:07:25 +01:00
thatsIch f138a68f3e Merge pull request #1071 from downslope7/grid-connection-exists-coords
Add coords to duplicate connection GridException.
2015-03-22 07:48:23 +01:00
downslope7 30191eb5ba Add coords to duplicate connection GridException.
This exception isn't caught and crashes the server. Added block coordinates to aid in diagnostics.
2015-03-21 20:05:08 -05:00
thatsIch 4552394f6e Removes deprecated method access of LocatableRegistry and getPickBlock 2015-03-21 16:03:26 +01:00
thatsIch 9c3d3db3fb Updated public dependencies
- FMP
- CCL
- WAILA
- BC
2015-03-21 11:51:11 +01:00
thatsIch 9c1c9056f1 Merge pull request #1063 from KamranMackey/rv2
Fixed a couple typos in en_US.lang.
2015-03-21 11:41:06 +01:00
Kamran Mackey b5582688a3 Fixed a couple typos in en_US.lang. 2015-03-21 03:57:41 -06:00
thatsIch 34597a4e21 Merge pull request #1046 from thatsIch/b-976-version-checker
Fixes #976 Now uses GitHub to retrieve most current version
2015-03-17 20:23:14 +01:00
thatsIch e0b32d2641 Merge pull request #1044 from TheVikingWarrior/patch-1
Update it_IT.lang
2015-03-17 07:22:06 +01:00
thatsIch 6baf952904 Fixes #976 Now uses GitHub to retrieve most current version
Reworked whole Version Checker with an extensible interface to add any other service later on easier.
The version checker now has its own config file, to collect the different options and extract them from the main config file.
In that you can specify how fine the versions should be checked.
2015-03-17 07:18:49 +01:00
TheVikingWarrior f132ae3678 Update it_IT.lang 2015-03-16 20:59:01 +01:00
yueh 720b38442e Merge pull request #1034 from yueh/feature-improve-meinventoryhandler-getaccess
Improved MEInventoryHandler.getAccess()
2015-03-16 11:29:57 +01:00
yueh 136f5d7314 Merge pull request #1037 from yueh/fix-1030
Fixes #1030 IndexOutOfBoundsException caused by using wrong index
2015-03-16 11:23:49 +01:00
yueh a83e4b7c3d Fixes #1030 IndexOutOfBoundsException caused by using wrong index 2015-03-15 19:55:58 +01:00
yueh 1bb0109c45 Improved MEInventoryHandler.getAccess()
Changed the public fields to setters and getters
Added a cache for the evaluated values instead of calculating with each
access
2015-03-15 19:43:12 +01:00
thatsIch 4744dfab78 Merge pull request #1029 from thatsIch/e-1024-zinc
Fixes #1024 Added zinc to the grindstone, which is part of Flaxbeards Steam Power (FSP)
2015-03-15 18:38:03 +01:00
thatsIch 7dedd4700f Fixes #1024 Added zinc to the grindstone, which is part of Flaxbeards Steam Power (FSP)
Added zinc to the array of checked ore dictionary names, so if any mod decides to add Zinc in the future or uses it via the OreDictionary, it will be automatically added to the grindstone.

The commit also contains some scoping and code cleanup of the underlaying calls
2015-03-15 09:02:23 +01:00
thatsIch 95fb894ba3 Merge pull request #1028 from bakaxyf/patch-1
Update zh_CN.lang
2015-03-15 08:22:05 +01:00
bakaxyf 621ddc5535 Update zh_CN.lang 2015-03-15 11:05:24 +08:00
82 changed files with 2646 additions and 647 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# Applied Energistics 2
## Table of Content
## Table of Contents
* [About](#about)
* [Contacts](#contacts)
+1
View File
@@ -79,6 +79,7 @@ jar {
minecraft {
version = config.minecraft_version + "-" + config.forge_version
replaceIn "AEConfig.java"
replace "@version@", project.version
replace "@aechannel@", config.aechannel
+4 -4
View File
@@ -14,12 +14,12 @@ forge_version=10.13.2.1291
# APIs used for development #
#########################################################
cb_minecraft_version=1.7.10
fmp_version=1.1.1.321
code_chicken_lib_version=1.1.1.110
fmp_version=1.1.1.324
code_chicken_lib_version=1.1.3.127
code_chicken_core_version=1.0.4.35
nei_version=1.0.4.90
waila_version=1.5.9_1.7.10
bc_version=6.4.2
waila_version=1.5.10_1.7.10
bc_version=6.4.3
#########################################################
# API Stubs #
@@ -49,7 +49,7 @@ public interface IMEInventory<StackType extends IAEStack>
* @param src action source
* @return returns the number of items not added.
*/
public StackType injectItems(StackType input, Actionable type, BaseActionSource src);
StackType injectItems( StackType input, Actionable type, BaseActionSource src );
/**
* Extract the specified item from the ME Inventory
@@ -60,7 +60,7 @@ public interface IMEInventory<StackType extends IAEStack>
* simulate, or perform action?
* @return returns the number of items extracted, null
*/
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src);
StackType extractItems( StackType request, Actionable mode, BaseActionSource src );
/**
* request a full report of all available items, storage.
@@ -69,11 +69,11 @@ public interface IMEInventory<StackType extends IAEStack>
* the IItemList the results will be written too
* @return returns same list that was passed in, is passed out
*/
public IItemList<StackType> getAvailableItems(IItemList<StackType> out);
IItemList<StackType> getAvailableItems( IItemList<StackType> out );
/**
* @return the type of channel your handler should be part of
*/
public StorageChannel getChannel();
StorageChannel getChannel();
}
@@ -30,12 +30,12 @@ import appeng.api.storage.data.IItemList;
public interface IMEMonitor<T extends IAEStack> extends IMEInventoryHandler<T>, IBaseMonitor<T>
{
@Override
@Deprecated
/**
* This method is discouraged when accessing data via a IMEMonitor
*/
public IItemList<T> getAvailableItems(IItemList out);
@Override
@Deprecated
IItemList<T> getAvailableItems( IItemList out );
/**
* Get access to the full item list of the network, preferred over {@link IMEInventory} .getAvailableItems(...)
@@ -70,8 +70,8 @@ import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
@Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = "MFR")
@@ -25,6 +25,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -163,10 +164,11 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
ItemStack is = super.getPickBlock( target, world, x, y, z );
final ItemStack is = super.getPickBlock( target, world, x, y, z, player );
is.setItemDamage( world.getBlockMetadata( x, y, z ) );
return is;
}
@@ -87,10 +87,11 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
ItemStack is = super.getPickBlock( target, world, x, y, z );
final ItemStack is = super.getPickBlock( target, world, x, y, z, player );
is.setItemDamage( world.getBlockMetadata( x, y, z ) );
return is;
}
@@ -33,21 +33,47 @@ import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
public class ContainerIOPort extends ContainerUpgradeable
{
final TileIOPort ioPort;
@GuiSync(2)
@GuiSync( 2 )
public FullnessMode fMode = FullnessMode.EMPTY;
@GuiSync(3)
@GuiSync( 3 )
public OperationMode opMode = OperationMode.EMPTY;
public ContainerIOPort(InventoryPlayer ip, TileIOPort te) {
public ContainerIOPort( InventoryPlayer ip, TileIOPort te )
{
super( ip, te );
this.ioPort = te;
}
@Override
protected void setupConfig()
{
int offX = 19;
int offY = 17;
IInventory cells = this.upgradeable.getInventoryByName( "cells" );
for ( int y = 0; y < 3; y++ )
for ( int x = 0; x < 2; x++ )
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
offX = 122;
offY = 17;
for ( int y = 0; y < 3; y++ )
for ( int x = 0; x < 2; x++ )
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
}
@Override
protected int getHeight()
{
@@ -66,30 +92,6 @@ public class ContainerIOPort extends ContainerUpgradeable
return false;
}
@Override
protected void setupConfig()
{
int offX = 19;
int offY = 17;
IInventory cells = this.upgradeable.getInventoryByName( "cells" );
for (int y = 0; y < 3; y++)
for (int x = 0; x < 2; x++)
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
offX = 122;
offY = 17;
for (int y = 0; y < 3; y++)
for (int x = 0; x < 2; x++)
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
}
@Override
public void detectAndSendChanges()
{
@@ -104,5 +106,4 @@ public class ContainerIOPort extends ContainerUpgradeable
this.standardDetectAndSendChanges();
}
}
+6 -30
View File
@@ -55,9 +55,6 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
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 CHANNEL = "@aechannel@";
@@ -128,7 +125,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
// AE
"CertusQuartz", "Wheat", "Fluix",
// Other Mod Ores
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium" };
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium", "Zinc" };
public double oreDoublePercentage = 90.0;
@@ -149,7 +146,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
public boolean disableColoredCableRecipesInNEI = true;
public boolean updatable = false;
final private File myPath;
final private File configFile;
public double meteoriteClusterChance = 0.1;
public double meteoriteSpawnChance = 0.3;
@@ -224,22 +221,20 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
public String getFilePath()
{
return this.myPath.toString();
return this.configFile.toString();
}
public AEConfig(String path) {
super( new File( path + "AppliedEnergistics2.cfg" ) );
this.myPath = new File( path + "AppliedEnergistics2.cfg" );
public AEConfig( File configFile ) {
super( configFile );
this.configFile = configFile;
FMLCommonHandler.instance().bus().register( this );
final double DEFAULT_BC_EXCHANGE = 5.0;
final double DEFAULT_IC2_EXCHANGE = 2.0;
final double DEFAULT_RTC_EXCHANGE = 1.0 / 11256.0;
final double DEFAULT_RF_EXCHANGE = 0.5;
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.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 );
@@ -340,19 +335,6 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
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;
}
@@ -411,12 +393,6 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
@Override
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 ) )
{
this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).set( this.storageBiomeID );
+23 -13
View File
@@ -22,8 +22,6 @@ package appeng.core;
import java.io.File;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Stopwatch;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
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.network.NetworkRegistry;
import com.google.common.base.Stopwatch;
import appeng.core.crash.CrashEnhancement;
import appeng.core.crash.CrashInfo;
import appeng.core.features.AEFeature;
@@ -47,6 +47,7 @@ import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.server.AECommand;
import appeng.services.VersionChecker;
import appeng.services.version.VersionCheckerConfig;
import appeng.util.Platform;
@@ -70,7 +71,7 @@ public class AppEng
private final IMCHandler imcHandler;
private String configPath;
private File configDirectory;
public AppEng()
{
@@ -81,9 +82,9 @@ public class AppEng
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 )
@@ -104,11 +105,16 @@ public class AppEng
CommonHelper.proxy.missingCoreMod();
}
Stopwatch star = Stopwatch.createStarted();
this.configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;
Stopwatch watch = Stopwatch.createStarted();
this.configDirectory = new File(event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2");
AEConfig.instance = new AEConfig( this.configPath );
FacadeConfig.instance = new FacadeConfig( this.configPath );
final File configFile = new File( this.configDirectory, "AppliedEnergistics2.cfg");
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 )" );
@@ -121,19 +127,23 @@ public class AppEng
Registration.INSTANCE.preInitialize( event );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
if ( versionCheckerConfig.isEnabled() )
{
AELog.info( "Starting VersionChecker" );
this.startService( "AE2 VersionChecker", new Thread( new VersionChecker() ) );
final VersionChecker versionChecker = new VersionChecker( versionCheckerConfig );
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 )
{
thread.setName( serviceName );
thread.setPriority( Thread.MIN_PRIORITY );
AELog.info( "Starting " + serviceName );
thread.start();
}
+2 -2
View File
@@ -35,8 +35,8 @@ public class FacadeConfig extends Configuration
public static FacadeConfig instance;
final Pattern replacementPattern;
public FacadeConfig(String path) {
super( new File( path + "Facades.cfg" ) );
public FacadeConfig( File facadeFile ) {
super( facadeFile );
this.replacementPattern = Pattern.compile( "[^a-zA-Z0-9]" );
}
+5 -5
View File
@@ -21,10 +21,6 @@ package appeng.core;
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.util.WeightedRandomChestContent;
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.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.IAppEngApi;
import appeng.api.config.Upgrades;
@@ -546,7 +546,7 @@ public final class Registration
ItemMultiMaterial.instance.makeUnique();
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
this.recipeHandler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" );
@@ -62,7 +62,7 @@ public enum AEFeature
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),
@@ -18,6 +18,7 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -37,20 +38,20 @@ import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler;
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;
private ItemStack copy(ItemStack is)
public GrinderRecipeManager()
{
if ( is != null )
return is.copy();
return null;
}
public GrinderRecipeManager() {
this.RecipeList = new ArrayList<IGrinderEntry>();
this.recipes = new ArrayList<IGrinderEntry>();
this.ores = new HashMap<ItemStack, String>();
this.ingots = new HashMap<ItemStack, String>();
this.dusts = new HashMap<String, ItemStack>();
this.addOre( "Coal", new ItemStack( Items.coal ) );
this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) );
@@ -78,20 +79,11 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
public List<IGrinderEntry> getRecipes()
{
this.log( "API - getRecipes" );
return this.RecipeList;
}
private void injectRecipe(AppEngGrinderRecipe appEngGrinderRecipe)
{
for (IGrinderEntry gr : this.RecipeList)
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
return;
this.RecipeList.add( appEngGrinderRecipe );
return this.recipes;
}
@Override
public void addRecipe(ItemStack in, ItemStack out, int cost)
public void addRecipe( ItemStack in, ItemStack out, int cost )
{
if ( in == null || out == null )
{
@@ -104,40 +96,54 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
}
@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." );
return;
}
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
+ Platform.getItemDisplayName( optional ) + " for " + cost );
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
}
@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." );
return;
}
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
+ Platform.getItemDisplayName( optional ) + " for " + cost );
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + 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
public IGrinderEntry getRecipeForInput(ItemStack input)
public IGrinderEntry getRecipeForInput( ItemStack input )
{
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
if ( input != null )
{
for (IGrinderEntry r : this.RecipeList)
for ( IGrinderEntry r : this.recipes )
{
if ( Platform.isSameItem( input, r.getInput() ) )
{
@@ -152,12 +158,12 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return null;
}
public void log(String o)
public void log( String o )
{
AELog.grinder( o );
}
private int getDustToOreRatio(String name)
private int getDustToOreRatio( String name )
{
if ( name.equals( "Obsidian" ) )
return 1;
@@ -168,52 +174,48 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return 2;
}
public final Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
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)
private void addOre( String name, ItemStack item )
{
if ( item == null )
return;
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 );
if ( ratio > 1 )
{
ItemStack extra = is.copy();
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
this.addRecipe( item, is, 8 );
}
}
private void addIngot(String name, ItemStack item)
private void addIngot( String name, ItemStack item )
{
if ( item == null )
return;
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 )
return;
if ( this.Dusts.containsKey( name ) )
if ( this.dusts.containsKey( name ) )
{
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
return;
@@ -221,9 +223,9 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
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() ) )
{
ItemStack is = item.copy();
@@ -233,23 +235,23 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
{
ItemStack extra = is.copy();
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
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() ) )
this.addRecipe( d.getKey(), item, 4 );
}
@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" ) )
{
for (String ore : AEConfig.instance.grinderOres)
for ( String ore : AEConfig.instance.grinderOres )
{
if ( name.equals( "ore" + ore ) )
{
@@ -63,6 +63,7 @@ public final class LocatableRegistry implements ILocatableRegistry
* Find a locate-able object by its serial.
*/
@Override
@Deprecated
public Object findLocatableBySerial( long ser )
{
return this.set.get( ser );
@@ -18,6 +18,7 @@
package appeng.core.sync;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
@@ -50,101 +51,101 @@ import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketTransitionEffect;
import appeng.core.sync.packets.PacketValueConfig;
public class AppEngPacketHandlerBase
{
private static final Map<Class<? extends AppEngPacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<Class<? extends AppEngPacket>, AppEngPacketHandlerBase.PacketTypes>();
public static final Map<Class, PacketTypes> REVERSE_LOOKUP = new HashMap<Class, AppEngPacketHandlerBase.PacketTypes>();
public enum PacketTypes
{
PACKET_COMPASS_REQUEST(PacketCompassRequest.class),
PACKET_COMPASS_REQUEST( PacketCompassRequest.class ),
PACKET_COMPASS_RESPONSE(PacketCompassResponse.class),
PACKET_COMPASS_RESPONSE( PacketCompassResponse.class ),
PACKET_INVENTORY_ACTION(PacketInventoryAction.class),
PACKET_INVENTORY_ACTION( PacketInventoryAction.class ),
PACKET_ME_INVENTORY_UPDATE(PacketMEInventoryUpdate.class),
PACKET_ME_INVENTORY_UPDATE( PacketMEInventoryUpdate.class ),
PACKET_CONFIG_BUTTON(PacketConfigButton.class),
PACKET_CONFIG_BUTTON( PacketConfigButton.class ),
PACKET_MULTIPART(PacketMultiPart.class),
PACKET_MULTIPART( PacketMultiPart.class ),
PACKET_PART_PLACEMENT(PacketPartPlacement.class),
PACKET_PART_PLACEMENT( PacketPartPlacement.class ),
PACKET_LIGHTNING(PacketLightning.class),
PACKET_LIGHTNING( PacketLightning.class ),
PACKET_MATTER_CANNON(PacketMatterCannon.class),
PACKET_MATTER_CANNON( PacketMatterCannon.class ),
PACKET_MOCK_EXPLOSION(PacketMockExplosion.class),
PACKET_MOCK_EXPLOSION( PacketMockExplosion.class ),
PACKET_VALUE_CONFIG(PacketValueConfig.class),
PACKET_VALUE_CONFIG( PacketValueConfig.class ),
PACKET_TRANSITION_EFFECT(PacketTransitionEffect.class),
PACKET_TRANSITION_EFFECT( PacketTransitionEffect.class ),
PACKET_PROGRESS_VALUE(PacketProgressBar.class),
PACKET_PROGRESS_VALUE( PacketProgressBar.class ),
PACKET_CLICK(PacketClick.class),
PACKET_CLICK( PacketClick.class ),
PACKET_NEW_STORAGE_DIMENSION(PacketNewStorageDimension.class),
PACKET_NEW_STORAGE_DIMENSION( PacketNewStorageDimension.class ),
PACKET_SWITCH_GUIS(PacketSwitchGuis.class),
PACKET_SWITCH_GUIS( PacketSwitchGuis.class ),
PACKET_SWAP_SLOTS(PacketSwapSlots.class),
PACKET_SWAP_SLOTS( PacketSwapSlots.class ),
PACKET_PATTERN_SLOT(PacketPatternSlot.class),
PACKET_PATTERN_SLOT( PacketPatternSlot.class ),
PACKET_RECIPE_NEI(PacketNEIRecipe.class),
PACKET_RECIPE_NEI( PacketNEIRecipe.class ),
PACKET_PARTIAL_ITEM(PacketPartialItem.class),
PACKET_PARTIAL_ITEM( PacketPartialItem.class ),
PACKET_CRAFTING_REQUEST(PacketCraftRequest.class),
PACKET_CRAFTING_REQUEST( PacketCraftRequest.class ),
PACKET_ASSEMBLER_ANIMATION(PacketAssemblerAnimation.class),
PACKET_ASSEMBLER_ANIMATION( PacketAssemblerAnimation.class ),
PACKET_COMPRESSED_NBT(PacketCompressedNBT.class),
PACKET_COMPRESSED_NBT( PacketCompressedNBT.class ),
PACKET_PAINTED_ENTITY(PacketPaintedEntity.class);
PACKET_PAINTED_ENTITY( PacketPaintedEntity.class );
final public Class pc;
final public Constructor con;
private final Class<? extends AppEngPacket> packetClass;
private final Constructor<? extends AppEngPacket> packetConstructor;
private PacketTypes(Class c) {
this.pc = c;
PacketTypes( Class<? extends AppEngPacket> c )
{
this.packetClass = c;
Constructor x = null;
Constructor<? extends AppEngPacket> x = null;
try
{
x = this.pc.getConstructor( ByteBuf.class );
x = this.packetClass.getConstructor( ByteBuf.class );
}
catch (NoSuchMethodException ignored)
catch( NoSuchMethodException ignored )
{
}
catch (SecurityException ignored)
catch( SecurityException ignored )
{
}
this.con = x;
AppEngPacketHandlerBase.REVERSE_LOOKUP.put( this.pc, this );
this.packetConstructor = x;
REVERSE_LOOKUP.put( this.packetClass, this );
if ( this.con == null )
if( this.packetConstructor == null )
throw new RuntimeException( "Invalid Packet Class, must be constructable on DataInputStream" );
}
public AppEngPacket parsePacket(ByteBuf in) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
public static PacketTypes getPacket( int id )
{
return (AppEngPacket) this.con.newInstance( in );
return ( values() )[id];
}
public static PacketTypes getPacket(int id)
public static PacketTypes getID( Class<? extends AppEngPacket> c )
{
return (values())[id];
return REVERSE_LOOKUP.get( c );
}
public static PacketTypes getID(Class<? extends AppEngPacket> c)
public AppEngPacket parsePacket( ByteBuf in ) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
return AppEngPacketHandlerBase.REVERSE_LOOKUP.get( c );
return this.packetConstructor.newInstance( in );
}
}
}
@@ -29,7 +29,7 @@ import appeng.core.WorldSettings;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.core.sync.network.NetworkHandler;
import appeng.services.helpers.ICompassCallback;
import appeng.services.compass.ICompassCallback;
public class PacketCompassRequest extends AppEngPacket implements ICompassCallback
{
@@ -18,6 +18,7 @@
package appeng.core.sync.packets;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -26,6 +27,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -48,23 +50,31 @@ import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.util.item.AEItemStack;
public class PacketMEInventoryUpdate extends AppEngPacket
{
// output...
final private byte ref;
final private ByteBuf data;
final private GZIPOutputStream compressFrame;
int writtenBytes = 0;
boolean empty = true;
private static final int UNCOMPRESSED_PACKET_BYTE_LIMIT = 16 * 1024 * 1024;
private static final int OPERATION_BYTE_LIMIT = 2 * 1024;
private static final int TEMP_BUFFER_SIZE = 1024;
private static final int STREAM_MASK = 0xff;
// input.
final List<IAEItemStack> list;
@Nullable
private final List<IAEItemStack> list;
// output...
private final byte ref;
@Nullable
private final ByteBuf data;
@Nullable
private final GZIPOutputStream compressFrame;
private int writtenBytes = 0;
private boolean empty = true;
// automatic.
public PacketMEInventoryUpdate(final ByteBuf stream) throws IOException {
public PacketMEInventoryUpdate( final ByteBuf stream ) throws IOException
{
this.data = null;
this.compressFrame = null;
this.list = new LinkedList<IAEItemStack>();
@@ -72,25 +82,24 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// int originalBytes = stream.readableBytes();
GZIPInputStream gzReader = new GZIPInputStream( new InputStream() {
GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
{
@Override
public int read() throws IOException
{
if ( stream.readableBytes() <= 0 )
if( stream.readableBytes() <= 0 )
return -1;
return stream.readByte() & 0xff;
return stream.readByte() & STREAM_MASK;
}
} );
ByteBuf uncompressed = Unpooled.buffer( stream.readableBytes() );
byte[] tmp = new byte[1024];
while (gzReader.available() != 0)
byte[] tmp = new byte[TEMP_BUFFER_SIZE];
while( gzReader.available() != 0 )
{
int bytes = gzReader.read( tmp );
if ( bytes > 0 )
if( bytes > 0 )
uncompressed.writeBytes( tmp, 0, bytes );
}
gzReader.close();
@@ -98,32 +107,58 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// int uncompressedBytes = uncompressed.readableBytes();
// AELog.info( "Receiver: " + originalBytes + " -> " + uncompressedBytes );
while (uncompressed.readableBytes() > 0)
while( uncompressed.readableBytes() > 0 )
this.list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
this.empty = this.list.isEmpty();
}
// api
public PacketMEInventoryUpdate() throws IOException
{
this( (byte) 0 );
}
// api
public PacketMEInventoryUpdate( byte ref ) throws IOException
{
this.ref = ref;
this.data = Unpooled.buffer( OPERATION_BYTE_LIMIT );
this.data.writeInt( this.getPacketID() );
this.data.writeByte( this.ref );
this.compressFrame = new GZIPOutputStream( new OutputStream()
{
@Override
public void write( int value ) throws IOException
{
PacketMEInventoryUpdate.this.data.writeByte( value );
}
} );
this.list = null;
}
@Override
@SideOnly(Side.CLIENT)
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if ( gs instanceof GuiCraftConfirm )
((GuiCraftConfirm) gs).postUpdate( this.list, this.ref );
if( gs instanceof GuiCraftConfirm )
( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
if ( gs instanceof GuiCraftingCPU )
((GuiCraftingCPU) gs).postUpdate( this.list, this.ref );
if( gs instanceof GuiCraftingCPU )
( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
if ( gs instanceof GuiMEMonitorable )
((GuiMEMonitorable) gs).postUpdate( this.list );
if ( gs instanceof GuiNetworkStatus )
((GuiNetworkStatus) gs).postUpdate( this.list );
if( gs instanceof GuiMEMonitorable )
( (GuiMEMonitorable) gs ).postUpdate( this.list );
if( gs instanceof GuiNetworkStatus )
( (GuiNetworkStatus) gs ).postUpdate( this.list );
}
@Nullable
@Override
public FMLProxyPacket getProxy()
{
@@ -134,46 +169,24 @@ public class PacketMEInventoryUpdate extends AppEngPacket
this.configureWrite( this.data );
return super.getProxy();
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
return null;
}
// api
public PacketMEInventoryUpdate() throws IOException {
this( (byte) 0 );
}
// api
public PacketMEInventoryUpdate(byte ref) throws IOException {
this.data = Unpooled.buffer( 2048 );
this.data.writeInt( this.getPacketID() );
this.data.writeByte( this.ref = ref );
this.compressFrame = new GZIPOutputStream( new OutputStream() {
@Override
public void write(int value) throws IOException
{
PacketMEInventoryUpdate.this.data.writeByte( value );
}
} );
this.list = null;
}
public void appendItem(IAEItemStack is) throws IOException, BufferOverflowException
public void appendItem( IAEItemStack is ) throws IOException, BufferOverflowException
{
ByteBuf tmp = Unpooled.buffer( 2048 );
ByteBuf tmp = Unpooled.buffer( OPERATION_BYTE_LIMIT );
is.writeToPacket( tmp );
this.compressFrame.flush();
if ( this.writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
if( this.writtenBytes + tmp.readableBytes() > UNCOMPRESSED_PACKET_BYTE_LIMIT )
{
throw new BufferOverflowException();
}
else
{
this.writtenBytes += tmp.readableBytes();
@@ -191,5 +204,4 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
return this.empty;
}
}
@@ -195,23 +195,26 @@ public class PacketNEIRecipe extends AppEngPacket
// If that doesn't work, grab from the player's inventory
if ( whichItem == null && playerInventory != null )
{
ItemStack playerItemStack = null;
for ( int y = 0; y < playerInventory.getSizeInventory(); y++ )
for ( int y = 0; y < this.recipe[x].length; y++ )
{
// check if the item in slot y matches the required item.
playerItemStack = playerInventory.getStackInSlot( y );
if ( playerItemStack != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
ItemStack playerItemStack = null;
for ( int i = 0; i < playerInventory.getSizeInventory(); i++ )
{
if ( realForFake == Actionable.SIMULATE )
// check if the item in slot y matches the required item.
playerItemStack = playerInventory.getStackInSlot( i );
if ( playerItemStack != null && this.recipe[x][y] != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
{
whichItem = playerInventory.getStackInSlot( y ).copy();
whichItem.stackSize = 1;
if ( realForFake == Actionable.SIMULATE )
{
whichItem = playerInventory.getStackInSlot( i ).copy();
whichItem.stackSize = 1;
}
else
{
whichItem = playerInventory.decrStackSize( i, 1 );
}
break;
}
else
{
whichItem = playerInventory.decrStackSize( y, 1 );
}
break;
}
}
}
@@ -1080,7 +1080,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
if ( mop.blockX == te.xCoord && mop.blockY == te.yCoord && mop.blockZ == te.zCoord )
{
ItemStack g = blk.getPickBlock( mop, w, te.xCoord, te.yCoord, te.zCoord );
ItemStack g = blk.getPickBlock( mop, w, te.xCoord, te.yCoord, te.zCoord, null );
if ( g != null )
what = g;
}
@@ -27,6 +27,7 @@ import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.features.ILocatable;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IWirelessAccessPoint;
@@ -76,12 +77,12 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
this.myPlayer = ep;
this.wth = wh;
Object obj = null;
ILocatable obj = null;
try
{
long encKey = Long.parseLong( this.encryptionKey );
obj = AEApi.instance().registries().locatable().findLocatableBySerial( encKey );
obj = AEApi.instance().registries().locatable().getLocatableBy( encKey );
}
catch (NumberFormatException err)
{
@@ -33,7 +33,7 @@ import appeng.core.AEConfig;
import appeng.core.WorldSettings;
import appeng.core.features.registries.WorldGenRegistry;
import appeng.helpers.MeteoritePlacer;
import appeng.services.helpers.ICompassCallback;
import appeng.services.compass.ICompassCallback;
import appeng.util.Platform;
final public class MeteoriteWorldGen implements IWorldGenerator
@@ -50,7 +50,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.items.AEBaseItem;
import appeng.items.contents.NetworkToolViewer;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
import appeng.util.Platform;
@@ -29,9 +29,9 @@ import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
import appeng.api.config.PowerUnits;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.InterfaceList;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.transformer.annotations.Integration.Method;
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ),
@@ -26,7 +26,7 @@ import net.minecraft.item.ItemStack;
import cofh.api.energy.IEnergyContainerItem;
import appeng.api.config.PowerUnits;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = "RFItem" )
@@ -35,7 +35,7 @@ import appeng.api.implementations.items.IAEWrench;
import appeng.api.util.DimensionalCoord;
import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
import appeng.util.Platform;
+5 -1
View File
@@ -77,8 +77,12 @@ public class GridConnection implements IGridConnection, IPathItem
throw new GridException( "Connection Forged Between null entities." );
if ( a.hasConnection( b ) || b.hasConnection( a ) )
throw new GridException( "Connection already exists." );
{
final String aCoords = a.getGridBlock().getLocation().toString();
final String bCoords = b.getGridBlock().getLocation().toString();
throw new GridException( String.format( "Connection already exists between node at [%s] and node at [%s].", aCoords, bCoords ) );
}
this.sideA = a;
this.fromAtoB = fromAtoB;
this.sideB = b;
@@ -81,7 +81,7 @@ public class QuantumCluster implements ILocatable, IAECluster
public boolean canUseNode(long qe)
{
QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().findLocatableBySerial( qe );
QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
if ( qc != null )
{
World theWorld = qc.getCenter().getWorldObj();
@@ -147,7 +147,7 @@ public class QuantumCluster implements ILocatable, IAECluster
}
}
Object myOtherSide = this.otherSide == 0 ? null : AEApi.instance().registries().locatable().findLocatableBySerial( this.otherSide );
ILocatable myOtherSide = this.otherSide == 0 ? null : AEApi.instance().registries().locatable().getLocatableBy( this.otherSide );
boolean shutdown = false;
@@ -101,14 +101,14 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
priorityList.add( AEItemStack.create( is ) );
}
this.myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
this.setWhitelist( hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
if ( !priorityList.isEmpty() )
{
if ( hasFuzzy )
this.myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
this.setPartitionList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ) );
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
public boolean isPreformatted()
{
return ! this.myPartitionList.isEmpty();
return ! this.getPartitionList().isEmpty();
}
@Override
public boolean isFuzzy()
{
return this.myPartitionList instanceof FuzzyPriorityList;
return this.getPartitionList() instanceof FuzzyPriorityList;
}
@Override
public IncludeExclude getIncludeExcludeMode()
{
return this.myWhitelist;
return this.getWhitelist();
}
public int getStatusForCell()
@@ -18,6 +18,7 @@
package appeng.me.storage;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.IncludeExclude;
@@ -31,6 +32,7 @@ import appeng.api.storage.data.IItemList;
import appeng.util.prioitylist.DefaultPriorityList;
import appeng.util.prioitylist.IPartitionList;
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 IMEInventoryHandler<T> internal;
public int myPriority = 0;
public IncludeExclude myWhitelist = IncludeExclude.WHITELIST;
public AccessRestriction myAccess = AccessRestriction.READ_WRITE;
public IPartitionList<T> myPartitionList = new DefaultPriorityList<T>();
private int myPriority;
private IncludeExclude myWhitelist;
private AccessRestriction myAccess;
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;
if ( i instanceof IMEInventoryHandler )
this.internal = (IMEInventoryHandler<T>) i;
this.internal = ( IMEInventoryHandler<T> ) i;
else
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
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 ) )
return input;
@@ -64,18 +120,18 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@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 this.internal.extractItems( request, type, src );
}
@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 this.internal.getAvailableItems( out );
@@ -90,11 +146,11 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
@Override
public AccessRestriction getAccess()
{
return this.myAccess.restrictPermissions( this.internal.getAccess() );
return this.cachedAccessRestriction;
}
@Override
public boolean isPrioritized(T input)
public boolean isPrioritized( T input )
{
if ( this.myWhitelist == IncludeExclude.WHITELIST )
return this.myPartitionList.isListed( input ) || this.internal.isPrioritized( input );
@@ -102,9 +158,9 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean canAccept(T input)
public boolean canAccept( T input )
{
if ( !this.getAccess().hasPermission( AccessRestriction.WRITE ) )
if ( !hasWriteAccess )
return false;
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 );
}
@Override
public int getPriority()
{
return this.myPriority;
}
@Override
public int getSlot()
{
@@ -132,7 +182,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean validForPass(int i)
public boolean validForPass( int i )
{
return true;
}
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NavigableMap;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentSkipListMap;
import appeng.api.config.AccessRestriction;
@@ -64,7 +65,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
public NetworkInventoryHandler(StorageChannel chan, SecurityCache security) {
this.myChannel = chan;
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)
@@ -313,9 +313,10 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
private void updateHandler()
{
this.myHandler.myAccess = AccessRestriction.WRITE;
this.myHandler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
this.myHandler.myPriority = this.priority;
this.myHandler.setBaseAccess( AccessRestriction.WRITE );
;
this.myHandler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.myHandler.setPriority( this.priority );
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
@@ -328,9 +329,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
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
this.myHandler.myPartitionList = new PrecisePriorityList( priorityList );
this.myHandler.setPartitionList( new PrecisePriorityList( priorityList ) );
try
{
@@ -82,8 +82,8 @@ import appeng.me.storage.MEMonitorIInventory;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
import appeng.util.prioitylist.FuzzyPriorityList;
import appeng.util.prioitylist.PrecisePriorityList;
@@ -319,9 +319,9 @@ public class PartStorageBus
this.handler = new MEInventoryHandler( inv, StorageChannel.ITEMS );
this.handler.myAccess = ( AccessRestriction ) this.getConfigManager().getSetting( Settings.ACCESS );
this.handler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
this.handler.myPriority = this.priority;
this.handler.setBaseAccess( ( AccessRestriction ) this.getConfigManager().getSetting( Settings.ACCESS ) );;
this.handler.setWhitelist( this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
this.handler.setPriority( this.priority );
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
@@ -334,9 +334,9 @@ public class PartStorageBus
}
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
this.handler.myPartitionList = new PrecisePriorityList( priorityList );
this.handler.setPartitionList ( new PrecisePriorityList( priorityList ));
if ( inv instanceof IMEMonitor )
( ( IMEMonitor ) inv ).addListener( this, this.handler );
@@ -36,8 +36,8 @@ import appeng.core.AppEng;
import appeng.integration.IntegrationType;
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.Interface;
import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.util.Platform;
@InterfaceList(value = { @Interface(iface = "ic2.api.energy.tile.IEnergySink", iname = "IC2"),
@@ -53,8 +53,8 @@ import appeng.integration.abstraction.IBC;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.tile.inventory.AppEngNullInventory;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
import appeng.util.inv.WrapperBCPipe;
import appeng.util.inv.WrapperChainedInventory;
@@ -38,8 +38,8 @@ import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.modules.helpers.NullRFHandler;
import appeng.me.GridAccessException;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.InterfaceList;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.util.Platform;
@@ -18,6 +18,7 @@
package appeng.recipes.loader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -25,19 +26,21 @@ import java.io.InputStreamReader;
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(String s) {
this.rootPath = s;
public ConfigLoader( File rootDirectory )
{
this.rootDirectory = rootDirectory;
}
@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" ) );
}
}
@@ -32,8 +32,8 @@ import net.minecraft.world.chunk.Chunk;
import appeng.api.AEApi;
import appeng.api.util.DimensionalCoord;
import appeng.services.helpers.CompassReader;
import appeng.services.helpers.ICompassCallback;
import appeng.services.compass.CompassReader;
import appeng.services.compass.ICompassCallback;
public class CompassService implements ThreadFactory
{
+137 -103
View File
@@ -19,133 +19,167 @@
package appeng.services;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
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 cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import appeng.core.AEConfig;
import appeng.core.AELog;
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()
public VersionChecker( VersionCheckerConfig config )
{
final long now = new Date().getTime();
final long timeDiff = now - AEConfig.instance.latestTimeStamp;
this.delay = Math.max( 1, FOUR_HOURS - timeDiff);
this.config = config;
}
@Override
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
{
// :(
}
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 );
}
}
AELog.info( "Last check was just recently." );
}
}
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." );
}
}
}
@@ -16,7 +16,7 @@
* 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
{
@@ -16,7 +16,7 @@
* 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.util.HashMap;
@@ -16,7 +16,7 @@
* 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;
@@ -16,7 +16,7 @@
* 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
{
@@ -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>>
{
}
}
+3 -3
View File
@@ -124,13 +124,13 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
public boolean canInsertItem(int slotIndex, ItemStack insertingItem, int side)
{
return this.isItemValidForSlot( i, itemstack );
return this.isItemValidForSlot( slotIndex, insertingItem );
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side)
{
return true;
}
@@ -285,9 +285,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
return i == 9;
return slotIndex == 9;
}
@Override
@@ -72,18 +72,18 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
public boolean canInsertItem(int slotIndex, ItemStack insertingItem, int side )
{
if ( AEApi.instance().registries().grinder().getRecipeForInput( itemstack ) == null )
if ( AEApi.instance().registries().grinder().getRecipeForInput( insertingItem ) == null )
return false;
return i >= 0 && i <= 2;
return slotIndex >= 0 && slotIndex <= 2;
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
return i >= 3 && i <= 5;
return slotIndex >= 3 && slotIndex <= 5;
}
@Override
@@ -219,16 +219,16 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
if ( Platform.isChargeable( itemstack ) )
if ( Platform.isChargeable( extractedItem ) )
{
IAEItemPowerStorage ips = (IAEItemPowerStorage) itemstack.getItem();
if ( ips.getAECurrentPower( itemstack ) >= ips.getAEMaxPower( itemstack ) )
IAEItemPowerStorage ips = (IAEItemPowerStorage) extractedItem.getItem();
if ( ips.getAECurrentPower( extractedItem ) >= ips.getAEMaxPower( extractedItem ) )
return true;
}
return AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( itemstack );
return AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( extractedItem );
}
public void activate(EntityPlayer player)
@@ -168,15 +168,15 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
return i != 0;
return slotIndex != 0;
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
public boolean canInsertItem(int slotIndex, ItemStack insertingItem, int side )
{
return i == 0;
return slotIndex == 0;
}
@Override
@@ -224,12 +224,12 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
if ( this.smash )
return false;
return i == 0 || i == 1 || i == 3;
return slotIndex == 0 || slotIndex == 1 || slotIndex == 3;
}
@Override
@@ -142,7 +142,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
return false;
}
+1 -1
View File
@@ -29,7 +29,7 @@ import appeng.api.config.PowerUnits;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IIC2;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
import appeng.util.Platform;
@Interface(iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink")
@@ -23,7 +23,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import mekanism.api.energy.IStrictEnergyAcceptor;
import appeng.api.config.PowerUnits;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
@Interface(iname = "Mekanism", iface = "mekanism.api.energy.IStrictEnergyAcceptor")
public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcceptor {
@@ -24,7 +24,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
import appeng.api.config.PowerUnits;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
@Interface( iname = "RF", iface = "cofh.api.energy.IEnergyReceiver" )
@@ -25,8 +25,8 @@ import Reika.RotaryCraft.API.ShaftPowerReceiver;
import appeng.api.config.PowerUnits;
import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
@Interface(iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.ShaftPowerReceiver")
@@ -174,15 +174,15 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
public boolean canInsertItem(int slotIndex, ItemStack insertingItem, int side )
{
return this.isItemValidForSlot( i, itemstack );
return this.isItemValidForSlot( slotIndex, insertingItem );
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
return i == 1;
return slotIndex == 1;
}
@Override
@@ -427,7 +427,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return null;
MEInventoryHandler ih = new MEInventoryHandler( h, h.getChannel() );
ih.myPriority = this.priority;
ih.setPriority( this.priority );
MEMonitorHandler<StackType> g = new ChestMonitorHandler<StackType>( ih );
g.addListener( new ChestNetNotifier( h.getChannel() ), g );
@@ -548,19 +548,19 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j)
public boolean canExtractItem(int slotIndex, ItemStack extractedItem, int side )
{
return i == 1;
return slotIndex == 1;
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j)
public boolean canInsertItem(int slotIndex, ItemStack insertingItem, int side )
{
if ( i == 1 )
if ( slotIndex == 1 )
{
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, this, StorageChannel.ITEMS ) != null )
if ( AEApi.instance().registries().cell().getCellInventory( insertingItem, this, StorageChannel.ITEMS ) != null )
return true;
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, this, StorageChannel.FLUIDS ) != null )
if ( AEApi.instance().registries().cell().getCellInventory( insertingItem, this, StorageChannel.FLUIDS ) != null )
return true;
}
else
@@ -569,7 +569,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
IMEInventory<IAEItemStack> cell = this.getHandler( StorageChannel.ITEMS );
IAEItemStack returns = cell.injectItems( AEApi.instance().storage().createItemStack( this.inv.getStackInSlot( 0 ) ), Actionable.SIMULATE, this.mySrc );
return returns == null || returns.getStackSize() != itemstack.stackSize;
return returns == null || returns.getStackSize() != insertingItem.stackSize;
}
catch (ChestNoHandler ignored)
{
@@ -245,7 +245,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.myPriority = this.priority;
ih.setPriority( this.priority );
this.invBySlot[x] = ih;
this.items.add( ih );
}
@@ -258,7 +258,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
power += this.handlersBySlot[x].cellIdleDrain( is, cell );
DriveWatcher<IAEItemStack> ih = new DriveWatcher( cell, is, this.handlersBySlot[x], this );
ih.myPriority = this.priority;
ih.setPriority( this.priority );
this.invBySlot[x] = ih;
this.fluids.add( ih );
}
+166 -126
View File
@@ -18,6 +18,7 @@
package appeng.tile.storage;
import java.util.ArrayList;
import net.minecraft.inventory.IInventory;
@@ -67,51 +68,67 @@ import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.WrapperInventoryRange;
public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable
{
private static final int INPUT_SLOT_INDEX_TOP_LEFT = 0;
private static final int INPUT_SLOT_INDEX_TOP_RIGHT = 1;
private static final int INPUT_SLOT_INDEX_CENTER_LEFT = 2;
private static final int INPUT_SLOT_INDEX_CENTER_RIGHT = 3;
private static final int INPUT_SLOT_INDEX_BOTTOM_LEFT = 4;
private static final int INPUT_SLOT_INDEX_BOTTOM_RIGHT = 5;
final ConfigManager cm = new ConfigManager( this );
private static final int OUTPUT_SLOT_INDEX_TOP_LEFT = 6;
private static final int OUTPUT_SLOT_INDEX_TOP_RIGHT = 7;
private static final int OUTPUT_SLOT_INDEX_CENTER_LEFT = 8;
private static final int OUTPUT_SLOT_INDEX_CENTER_RIGHT = 9;
private static final int OUTPUT_SLOT_INDEX_BOTTOM_LEFT = 10;
private static final int OUTPUT_SLOT_INDEX_BOTTOM_RIGHT = 11;
final int[] input = { 0, 1, 2, 3, 4, 5 };
final int[] output = { 6, 7, 8, 9, 10, 11 };
private final ConfigManager manager = new ConfigManager( this );
final int[] outputSlots = { 6, 7, 8, 9, 10, 11 };
private final int[] input = { INPUT_SLOT_INDEX_TOP_LEFT, INPUT_SLOT_INDEX_TOP_RIGHT, INPUT_SLOT_INDEX_CENTER_LEFT, INPUT_SLOT_INDEX_CENTER_RIGHT, INPUT_SLOT_INDEX_BOTTOM_LEFT, INPUT_SLOT_INDEX_BOTTOM_RIGHT };
private final int[] output = { OUTPUT_SLOT_INDEX_TOP_LEFT, OUTPUT_SLOT_INDEX_TOP_RIGHT, OUTPUT_SLOT_INDEX_CENTER_LEFT, OUTPUT_SLOT_INDEX_CENTER_RIGHT, OUTPUT_SLOT_INDEX_BOTTOM_LEFT, OUTPUT_SLOT_INDEX_BOTTOM_RIGHT };
final AppEngInternalInventory cells = new AppEngInternalInventory( this, 12 );
final UpgradeInventory upgrades = new UpgradeInventory( AEApi.instance().blocks().blockIOPort.block(), this, 3 );
private final AppEngInternalInventory cells = new AppEngInternalInventory( this, 12 );
private final UpgradeInventory upgrades = new UpgradeInventory( AEApi.instance().blocks().blockIOPort.block(), this, 3 );
final BaseActionSource mySrc = new MachineSource( this );
private final BaseActionSource mySrc = new MachineSource( this );
YesNo lastRedstoneState = YesNo.UNDECIDED;
private YesNo lastRedstoneState = YesNo.UNDECIDED;
private ItemStack currentCell;
private IMEInventory<IAEFluidStack> cachedFluid;
private IMEInventory<IAEItemStack> cachedItem;
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeToNBT_TileIOPort(NBTTagCompound data)
public TileIOPort()
{
this.cm.writeToNBT( data );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.manager.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.manager.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
this.manager.registerSetting( Settings.OPERATION_MODE, OperationMode.EMPTY );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_TileIOPort( NBTTagCompound data )
{
this.manager.writeToNBT( data );
this.cells.writeToNBT( data, "cells" );
this.upgrades.writeToNBT( data, "upgrades" );
data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() );
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBT_TileIOPort(NBTTagCompound data)
@TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_TileIOPort( NBTTagCompound data )
{
this.cm.readFromNBT( data );
this.manager.readFromNBT( data );
this.cells.readFromNBT( data, "cells" );
this.upgrades.readFromNBT( data, "upgrades" );
if ( data.hasKey( "lastRedstoneState" ) )
this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )];
}
public TileIOPort() {
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.cm.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.cm.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
this.cm.registerSetting( Settings.OPERATION_MODE, OperationMode.EMPTY );
}
@Override
public AECableType getCableConnectionType(ForgeDirection dir)
public AECableType getCableConnectionType( ForgeDirection dir )
{
return AECableType.SMART;
}
@@ -122,21 +139,6 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return new DimensionalCoord( this );
}
@Override
public IInventory getInternalInventory()
{
return this.cells;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added)
{
if ( this.cells == inv )
{
this.updateTask();
}
}
private void updateTask()
{
try
@@ -146,7 +148,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
else
this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
catch (GridAccessException e)
catch ( GridAccessException e )
{
// :P
}
@@ -175,29 +177,20 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
if ( this.getInstalledUpgrades( Upgrades.REDSTONE ) == 0 )
return true;
RedstoneMode rs = (RedstoneMode) this.cm.getSetting( Settings.REDSTONE_CONTROLLED );
RedstoneMode rs = (RedstoneMode) this.manager.getSetting( Settings.REDSTONE_CONTROLLED );
if ( rs == RedstoneMode.HIGH_SIGNAL )
return this.getRedstoneState();
return !this.getRedstoneState();
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection d)
{
if ( d == ForgeDirection.UP || d == ForgeDirection.DOWN )
return this.input;
return this.output;
}
@Override
public IConfigManager getConfigManager()
{
return this.cm;
return this.manager;
}
@Override
public IInventory getInventoryByName(String name)
public IInventory getInventoryByName( String name )
{
if ( name.equals( "upgrades" ) )
return this.upgrades;
@@ -209,13 +202,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public int getInstalledUpgrades(Upgrades u)
{
return this.upgrades.getInstalledUpgrades( u );
}
@Override
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
{
this.updateTask();
}
@@ -224,7 +211,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
if ( this.isEnabled() )
{
for (int x = 0; x < 6; x++)
for ( int x = 0; x < 6; x++ )
if ( this.cells.getStackInSlot( x ) != null )
return true;
}
@@ -233,30 +220,82 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
@Override
public TickingRequest getTickingRequest(IGridNode node)
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
{
for ( int inputSlotIndex : this.input )
{
if ( inputSlotIndex == slotIndex )
{
return true;
}
}
return false;
}
@Override
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
{
for ( int outputSlotIndex : this.output )
{
if ( outputSlotIndex == slotIndex )
{
return true;
}
}
return false;
}
@Override
public IInventory getInternalInventory()
{
return this.cells;
}
@Override
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added )
{
if ( this.cells == inv )
{
this.updateTask();
}
}
@Override
public int[] getAccessibleSlotsBySide( ForgeDirection d )
{
if ( d == ForgeDirection.UP || d == ForgeDirection.DOWN )
return this.input;
return this.output;
}
@Override
public TickingRequest getTickingRequest( IGridNode node )
{
return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, this.hasWork(), false );
}
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
public TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall )
{
if ( !this.gridProxy.isActive() )
return TickRateModulation.IDLE;
long ItemsToMove = 256;
switch (this.getInstalledUpgrades( Upgrades.SPEED ))
switch ( this.getInstalledUpgrades( Upgrades.SPEED ) )
{
case 1:
ItemsToMove *= 2;
break;
case 2:
ItemsToMove *= 4;
break;
case 3:
ItemsToMove *= 8;
break;
case 1:
ItemsToMove *= 2;
break;
case 2:
ItemsToMove *= 4;
break;
case 3:
ItemsToMove *= 8;
break;
}
try
@@ -264,7 +303,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
IMEInventory<IAEItemStack> itemNet = this.gridProxy.getStorage().getItemInventory();
IMEInventory<IAEFluidStack> fluidNet = this.gridProxy.getStorage().getFluidInventory();
IEnergySource energy = this.gridProxy.getEnergy();
for (int x = 0; x < 6; x++)
for ( int x = 0; x < 6; x++ )
{
ItemStack is = this.cells.getStackInSlot( x );
if ( is != null )
@@ -274,7 +313,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
IMEInventory<IAEItemStack> itemInv = this.getInv( is, StorageChannel.ITEMS );
IMEInventory<IAEFluidStack> fluidInv = this.getInv( is, StorageChannel.FLUIDS );
if ( this.cm.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
if ( this.manager.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
{
if ( itemInv != null )
ItemsToMove = this.transferContents( energy, itemInv, itemNet, ItemsToMove, StorageChannel.ITEMS );
@@ -298,9 +337,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return TickRateModulation.URGENT;
}
}
}
catch (GridAccessException e)
catch ( GridAccessException e )
{
return TickRateModulation.IDLE;
}
@@ -309,49 +347,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return TickRateModulation.SLEEP;
}
private boolean shouldMove(IMEInventory<IAEItemStack> itemInv, IMEInventory<IAEFluidStack> fluidInv)
@Override
public int getInstalledUpgrades( Upgrades u )
{
FullnessMode fm = (FullnessMode) this.cm.getSetting( Settings.FULLNESS_MODE );
if ( itemInv != null && fluidInv != null )
return this.matches( fm, itemInv ) && this.matches( fm, fluidInv );
else if ( itemInv != null )
return this.matches( fm, itemInv );
else if ( fluidInv != null )
return this.matches( fm, fluidInv );
return true;
return this.upgrades.getInstalledUpgrades( u );
}
private boolean matches(FullnessMode fm, IMEInventory src)
{
if ( fm == FullnessMode.HALF )
return true;
IItemList<? extends IAEStack> myList;
if ( src instanceof IMEMonitor )
myList = ((IMEMonitor) src).getStorageList();
else
myList = src.getAvailableItems( src.getChannel().createList() );
if ( fm == FullnessMode.EMPTY )
return myList.isEmpty();
IAEStack test = myList.getFirstItem();
if ( test != null )
{
test.setStackSize( 1 );
return src.injectItems( test, Actionable.SIMULATE, this.mySrc ) != null;
}
return false;
}
ItemStack currentCell;
IMEInventory<IAEFluidStack> cachedFluid;
IMEInventory<IAEItemStack> cachedItem;
private IMEInventory getInv(ItemStack is, StorageChannel chan)
private IMEInventory getInv( ItemStack is, StorageChannel chan )
{
if ( this.currentCell != is )
{
@@ -366,11 +368,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return this.cachedFluid;
}
private long transferContents(IEnergySource energy, IMEInventory src, IMEInventory destination, long itemsToMove, StorageChannel chan)
private long transferContents( IEnergySource energy, IMEInventory src, IMEInventory destination, long itemsToMove, StorageChannel chan )
{
IItemList<? extends IAEStack> myList;
if ( src instanceof IMEMonitor )
myList = ((IMEMonitor) src).getStorageList();
myList = ( (IMEMonitor) src ).getStorageList();
else
myList = src.getAvailableItems( src.getChannel().createList() );
@@ -380,7 +382,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
didStuff = false;
for (IAEStack s : myList)
for ( IAEStack s : myList )
{
long totalStackSize = s.getStackSize();
if ( totalStackSize > 0 )
@@ -422,14 +424,28 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
}
}
}
while (itemsToMove > 0 && didStuff);
while ( itemsToMove > 0 && didStuff );
return itemsToMove;
}
private boolean moveSlot(int x)
private boolean shouldMove( IMEInventory<IAEItemStack> itemInv, IMEInventory<IAEFluidStack> fluidInv )
{
WrapperInventoryRange wir = new WrapperInventoryRange( this, this.outputSlots, true );
FullnessMode fm = (FullnessMode) this.manager.getSetting( Settings.FULLNESS_MODE );
if ( itemInv != null && fluidInv != null )
return this.matches( fm, itemInv ) && this.matches( fm, fluidInv );
else if ( itemInv != null )
return this.matches( fm, itemInv );
else if ( fluidInv != null )
return this.matches( fm, fluidInv );
return true;
}
private boolean moveSlot( int x )
{
WrapperInventoryRange wir = new WrapperInventoryRange( this, this.output, true );
ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( this.getStackInSlot( x ) );
if ( result == null )
@@ -441,13 +457,37 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return false;
}
private boolean matches( FullnessMode fm, IMEInventory src )
{
if ( fm == FullnessMode.HALF )
return true;
IItemList<? extends IAEStack> myList;
if ( src instanceof IMEMonitor )
myList = ( (IMEMonitor) src ).getStorageList();
else
myList = src.getAvailableItems( src.getChannel().createList() );
if ( fm == FullnessMode.EMPTY )
return myList.isEmpty();
IAEStack test = myList.getFirstItem();
if ( test != null )
{
test.setStackSize( 1 );
return src.injectItems( test, Actionable.SIMULATE, this.mySrc ) != null;
}
return false;
}
/**
* Adds the items in the upgrade slots to the drop list.
*
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param drops drops of tile entity
*/
@Override
@@ -455,9 +495,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{
super.getDrops( w, x, y, z, drops );
for (int upgradeIndex = 0; upgradeIndex < this.upgrades.getSizeInventory(); upgradeIndex++)
for ( int upgradeIndex = 0; upgradeIndex < this.upgrades.getSizeInventory(); upgradeIndex++ )
{
ItemStack stackInSlot = this.upgrades.getStackInSlot(upgradeIndex);
ItemStack stackInSlot = this.upgrades.getStackInSlot( upgradeIndex );
if ( stackInSlot != null )
{
@@ -18,36 +18,35 @@
package appeng.transformer.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public @interface integration {
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface InterfaceList {
public Interface[] value();
public @interface Integration
{
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.TYPE )
@interface InterfaceList
{
Interface[] value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Interface {
public String iface();
public String iname();
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.TYPE )
@interface Interface
{
String iface();
String iname();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Method {
public String iname();
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
@interface Method
{
String iname();
}
}
@@ -36,7 +36,7 @@ import cpw.mods.fml.relauncher.FMLRelaunchLog;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.transformer.annotations.integration;
import appeng.transformer.annotations.Integration;
public class ASMIntegration implements IClassTransformer
@@ -105,16 +105,16 @@ public class ASMIntegration implements IClassTransformer
{
for ( AnnotationNode an : classNode.visibleAnnotations )
{
if ( this.hasAnnotation( an, integration.Interface.class ) )
if ( this.hasAnnotation( an, Integration.Interface.class ) )
{
if ( this.stripInterface( classNode, integration.Interface.class, an ) )
if ( this.stripInterface( classNode, Integration.Interface.class, an ) )
changed = true;
}
else if ( this.hasAnnotation( an, integration.InterfaceList.class ) )
else if ( this.hasAnnotation( an, Integration.InterfaceList.class ) )
{
for ( Object o : ( ( List ) an.values.get( 1 ) ) )
{
if ( this.stripInterface( classNode, integration.InterfaceList.class, ( AnnotationNode ) o ) )
if ( this.stripInterface( classNode, Integration.InterfaceList.class, ( AnnotationNode ) o ) )
changed = true;
}
}
@@ -130,9 +130,9 @@ public class ASMIntegration implements IClassTransformer
{
for ( AnnotationNode an : mn.visibleAnnotations )
{
if ( this.hasAnnotation( an, integration.Method.class ) )
if ( this.hasAnnotation( an, Integration.Method.class ) )
{
if ( this.stripMethod( classNode, mn, i, integration.Method.class, an ) )
if ( this.stripMethod( classNode, mn, i, Integration.Method.class, an ) )
changed = true;
}
}
@@ -467,6 +467,7 @@ commands.ae2.ChunkLoggerOn=Chunk Logging is now on
commands.ae2.ChunkLoggerOff=Chunk Logging is now off
commands.ae2.Supporters=Displays a list of AE2 Supporters
// Achievements
achievement.ae2.Compass=Meteorite Hunter
achievement.ae2.Compass.desc=Craft a Meteorite Compass
achievement.ae2.Presses=Unknown Technology
@@ -494,13 +495,13 @@ achievement.ae2.CrystalGrowthAccelerator.desc=Craft a Crystal Growth Accelerator
achievement.ae2.GlassCable=Fluix Energy Connection
achievement.ae2.GlassCable.desc=Craft ME Glass Cable
achievement.ae2.Networking1=Network Apprentice
achievement.ae2.Networking1.desc=Reach 8 channel using devices on a network.
achievement.ae2.Networking1.desc=Reach 8 channels using devices on a network.
achievement.ae2.Controller=Networking Switchboard
achievement.ae2.Controller.desc=Craft a Controller
achievement.ae2.Networking2=Network Engineer
achievement.ae2.Networking2.desc=Reach 128 channel using devices on a network.
achievement.ae2.Networking2.desc=Reach 128 channels using devices on a network.
achievement.ae2.Networking3=Network Administrator
achievement.ae2.Networking3.desc=Reach 2048 channel using devices on a network.
achievement.ae2.Networking3.desc=Reach 2048 channels using devices on a network.
achievement.ae2.P2P=Point to Point Networking
achievement.ae2.P2P.desc=Craft a P2P Tunnel
achievement.ae2.Recursive=Recursive Networking
@@ -50,12 +50,25 @@ tile.appliedenergistics2.BlockCraftingAccelerator.name=Unità co-processore per
tile.appliedenergistics2.BlockCraftingUnit.name=Unità di fabbricazione
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.SettingCleared=Impostazioni cancellate.
chat.appliedenergistics2.OutOfRange=Wireless fuori portata.
chat.appliedenergistics2.InvalidMachine=Macchina invalida.
chat.appliedenergistics2.LoadedSettings=Impostazioni caricate con successo.
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.CommunicationError=Errore nel communicare col Sistema.
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.ReportInaccessibleItemsYes=Si: gli oggetti che non possono essere estratti 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.buildcraft=Minecraft Joules
@@ -304,6 +320,7 @@ gui.appliedenergistics2.Red=Rosso
gui.appliedenergistics2.Black=Nero
gui.appliedenergistics2.Fluix=Fluix
waila.appliedenergistics2.Crafting=Fabbricazione
waila.appliedenergistics2.DeviceOnline=Dispositivo online
waila.appliedenergistics2.DeviceOffline=Dispositivo offline
waila.appliedenergistics2.DeviceMissingChannel=Al dispositivo manca il canale
@@ -66,6 +66,9 @@ chat.appliedenergistics2.OutOfRange=超出无线信号范围.
chat.appliedenergistics2.InvalidMachine=无效机器.
chat.appliedenergistics2.LoadedSettings=成功载入设定.
chat.appliedenergistics2.DeviceNotPowered=设备供能不足.
chat.appliedenergistics2.DeviceNotWirelessTerminal=设备不是无线终端.
chat.appliedenergistics2.DeviceNotLinked=设备未连接.
chat.appliedenergistics2.StationCanNotBeLocated=无法定位安全终端.
chat.appliedenergistics2.MachineNotPowered=机器未供能.
chat.appliedenergistics2.CommunicationError=网络交互错误.
chat.appliedenergistics2.SavedSettings=成功保存设定.
@@ -194,7 +197,7 @@ gui.appliedenergistics2.NoCraftingCPUs=没有可用的合成CPU...
gui.appliedenergistics2.CalculatingWait=正在计算,请等待...
gui.appliedenergistics2.Clean=清空
gui.appliedenergistics2.InvalidPattern=无效样板
gui.appliedenergistics2.Range=Range
gui.appliedenergistics2.Range=范围
gui.appliedenergistics2.TransparentFacades=透明的伪装板
gui.appliedenergistics2.TransparentFacadesHint=控制当网络工具放在快捷栏时,伪装板显示的透明度.
gui.appliedenergistics2.CPUs=CPU
@@ -288,6 +291,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=在物品合成时发射红石
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=报告不可交互的物品
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=是: 显示无法取出的物品.
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=否: 只显示可以取出的物品.
gui.tooltips.appliedenergistics2.BlockPlacement=方块放置方式
gui.tooltips.appliedenergistics2.BlockPlacementYes=方块将被放置.
gui.tooltips.appliedenergistics2.BlockPlacementNo=方块将以物品形式掉落.
gui.appliedenergistics2.units.appliedenergstics=AE
gui.appliedenergistics2.units.buildcraft=MJ
@@ -322,6 +328,7 @@ waila.appliedenergistics2.Unlocked=未锁定
waila.appliedenergistics2.Showing=显示
waila.appliedenergistics2.Contains=容纳
waila.appliedenergistics2.Channels=频道
waila.appliedenergistics2.Crafting=合成中
item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k-ME存储元件
item.appliedenergistics2.ItemBasicStorageCell.4k.name=4k-ME存储元件
@@ -460,6 +467,7 @@ commands.ae2.ChunkLoggerOn=区块日志已打开
commands.ae2.ChunkLoggerOff=区块日志已关闭
commands.ae2.Supporters=显示ae2支持者列表
// 成就
achievement.ae2.Compass=陨石猎手
achievement.ae2.Compass.desc=制作一个陨石罗盘
achievement.ae2.Presses=未知科技
@@ -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}
*/
public class UUIDMatcherTest
public final class UUIDMatcherTest
{
private static final String IS_UUID = "03ba29a1-d6bd-32ba-90b2-375e4d65abc9";
private static final String NO_UUID = "no";
File diff suppressed because it is too large Load Diff