Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2adc055536 | |||
| 399934ac2b | |||
| 9451106c81 | |||
| 8e75de8fb9 | |||
| eca598516e | |||
| 2c5a54c210 | |||
| 1ac2ab0c10 | |||
| 199b17b9c6 | |||
| f582c8081b | |||
| 77d66b1817 | |||
| df370396b1 | |||
| ceeb84a439 | |||
| 9af6b50347 | |||
| d151313253 | |||
| 6d935cc8ae | |||
| 1396dbf600 | |||
| 8087a43df5 | |||
| c2cd395ca1 | |||
| a6e2975677 | |||
| 3783ae8619 | |||
| be17616836 | |||
| 36c72d641f | |||
| f878a7598d | |||
| 071ae6d680 | |||
| cc29230ce5 | |||
| b282e5d968 | |||
| 3410db7b45 | |||
| 800c30e91c | |||
| 817163dbf6 | |||
| d164e279ef | |||
| 4f9b8db6fc | |||
| b58c92ebb6 | |||
| 2667b8eac6 | |||
| 235fad439d | |||
| fcea444041 | |||
| 80f56d4359 | |||
| f14bfa7d53 | |||
| a7d55ee520 | |||
| 7382897e8e | |||
| aac2b598ea | |||
| 0f31cd43d2 | |||
| 788de6d432 | |||
| 04a6a683bc | |||
| 25e433f7bd | |||
| fbc44f47c8 | |||
| 06bca227d0 | |||
| 8321a5fe1c | |||
| 1bb8de3570 | |||
| 8666937117 | |||
| eaf57bedf6 | |||
| a30ef4679c | |||
| 5416ea2365 |
+2
-3
@@ -22,6 +22,7 @@ apply from: 'gradle/scripts/propertyloader.gradle'
|
||||
apply from: 'gradle/scripts/dependencies.gradle'
|
||||
apply from: 'gradle/scripts/artifacts.gradle'
|
||||
apply from: 'gradle/scripts/autoinstallruntime.gradle'
|
||||
apply from: 'gradle/scripts/integration.gradle'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
@@ -103,9 +104,6 @@ sourceSets {
|
||||
"assets/appliedenergistics2/textures/models/*",
|
||||
"assets/appliedenergistics2/textures/items/*"
|
||||
}
|
||||
|
||||
// IntelliJ and Gradle interaction bug
|
||||
output.resourcesDir = output.classesDir
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,5 +112,6 @@ processResources {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
expand 'version': project.version, 'mcversion': config.minecraft_version
|
||||
include 'pack.mcmeta'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
apply plugin: 'idea'
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ public enum FuzzyMode
|
||||
// Note that percentage damaged, is the inverse of percentage durability.
|
||||
IGNORE_ALL( -1 ), PERCENT_99( 0 ), PERCENT_75( 25 ), PERCENT_50( 50 ), PERCENT_25( 75 );
|
||||
|
||||
final public float breakPoint;
|
||||
final public float percentage;
|
||||
public final float breakPoint;
|
||||
public final float percentage;
|
||||
|
||||
FuzzyMode( float p )
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ public enum PowerUnits
|
||||
/**
|
||||
* unlocalized name for the power unit.
|
||||
*/
|
||||
final public String unlocalizedName;
|
||||
public final String unlocalizedName;
|
||||
/**
|
||||
* please do not edit this value, it is set when AE loads its config files.
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ public enum SecurityPermissions
|
||||
*/
|
||||
SECURITY;
|
||||
|
||||
final private String unlocalizedName = "gui.appliedenergistics2.security." + this.name().toLowerCase();
|
||||
private final String unlocalizedName = "gui.appliedenergistics2.security." + this.name().toLowerCase();
|
||||
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ package appeng.api.config;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public enum Settings
|
||||
@@ -55,16 +56,19 @@ public enum Settings
|
||||
|
||||
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ), PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) );
|
||||
|
||||
private final EnumSet values;
|
||||
private final EnumSet<? extends Enum<?>> values;
|
||||
|
||||
Settings( EnumSet set )
|
||||
Settings( @Nonnull EnumSet<? extends Enum<?>> possibleOptions )
|
||||
{
|
||||
if( set == null || set.isEmpty() )
|
||||
throw new RuntimeException( "Invalid configuration." );
|
||||
this.values = set;
|
||||
if ( possibleOptions.isEmpty() )
|
||||
{
|
||||
throw new IllegalArgumentException( "Tried to instantiate an empty setting." );
|
||||
}
|
||||
|
||||
this.values = possibleOptions;
|
||||
}
|
||||
|
||||
public EnumSet getPossibleValues()
|
||||
public EnumSet<? extends Enum<?>> getPossibleValues()
|
||||
{
|
||||
return this.values;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ import appeng.api.features.ILocatable;
|
||||
public class LocatableEventAnnounce extends Event
|
||||
{
|
||||
|
||||
final public ILocatable target;
|
||||
final public LocatableEvent change;
|
||||
public final ILocatable target;
|
||||
public final LocatableEvent change;
|
||||
|
||||
public LocatableEventAnnounce( ILocatable o, LocatableEvent ev )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package appeng.api.features;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* Registration Records for {@link IInscriberRegistry}
|
||||
*
|
||||
* You have to pay attention though, that recipes are not mirrored,
|
||||
* where the top and bottom slots are switching places.
|
||||
*
|
||||
* This is applied on runtime.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IInscriberRecipe
|
||||
{
|
||||
/**
|
||||
* the current inputs
|
||||
*
|
||||
* @return inputs the inscriber will accept
|
||||
*/
|
||||
@Nonnull
|
||||
List<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* gets the current output
|
||||
*
|
||||
* @return output that the recipe will produce
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getOutput();
|
||||
|
||||
/**
|
||||
* gets the top optional
|
||||
*
|
||||
* @return item which is used top
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<ItemStack> getTopOptional();
|
||||
|
||||
/**
|
||||
* gets the bottom optional
|
||||
*
|
||||
* @return item which is used bottom
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<ItemStack> getBottomOptional();
|
||||
|
||||
/**
|
||||
* type of inscriber process
|
||||
*
|
||||
* @return type of process the inscriber is doing
|
||||
*/
|
||||
@Nonnull
|
||||
InscriberProcessType getProcessType();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package appeng.api.features;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Builder for an inscriber recipe
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IInscriberRecipeBuilder
|
||||
{
|
||||
/**
|
||||
* Creates an inscriber recipe with inputs.
|
||||
* Needs to be invoked.
|
||||
*
|
||||
* @param inputs new inputs for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder withInputs( @Nonnull Collection<ItemStack> inputs );
|
||||
|
||||
/**
|
||||
* Creates an inscriber recipe with output.
|
||||
* Needs to be invoked.
|
||||
*
|
||||
* @param output new output for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder withOutput( @Nonnull ItemStack output );
|
||||
|
||||
/**
|
||||
* Creates an inscriber recipe with top.
|
||||
* Either this or bot needs to be invoked.
|
||||
*
|
||||
* @param topOptional new top for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder withTopOptional( @Nonnull ItemStack topOptional );
|
||||
|
||||
/**
|
||||
* Creates an inscriber recipe with bot.
|
||||
* Either this or top needs to be invoked.
|
||||
*
|
||||
* @param bottomOptional new bot for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder withBottomOptional( @Nonnull ItemStack bottomOptional );
|
||||
|
||||
/**
|
||||
* Creates an inscriber recipe with type.
|
||||
* Needs to be invoked.
|
||||
*
|
||||
* @param type new type for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder withProcessType( @Nonnull InscriberProcessType type );
|
||||
|
||||
/**
|
||||
* Finalizes the process of making the recipe.
|
||||
* Needs to be invoked to fetch inscriber recipe.
|
||||
*
|
||||
* @return legal inscriber recipe
|
||||
*
|
||||
* @throws IllegalStateException when input is not defined
|
||||
* @throws IllegalStateException when input has no size
|
||||
* @throws IllegalStateException when output is not defined
|
||||
* @throws IllegalStateException when both optionals are not defined
|
||||
* @throws IllegalStateException when process type is not defined
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipe build();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package appeng.api.features;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IInscriberRegistry
|
||||
{
|
||||
/**
|
||||
* Current list of registered recipes, you can modify this if you want too.
|
||||
* Will never contain a null recipe
|
||||
*
|
||||
* @return currentlyRegisteredRecipes
|
||||
*/
|
||||
@Nonnull
|
||||
List<IInscriberRecipe> getRecipes();
|
||||
|
||||
/**
|
||||
* Optional items which are used in the top or bottom slot
|
||||
*
|
||||
* @return set of all optional items
|
||||
*/
|
||||
@Nonnull
|
||||
Set<ItemStack> getOptionals();
|
||||
|
||||
/**
|
||||
* Get all registered items which are valid inputs
|
||||
*
|
||||
* @return set of all input items
|
||||
*/
|
||||
@Nonnull
|
||||
Set<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* Extensible way to create an inscriber recipe
|
||||
*
|
||||
* @return builder for inscriber recipes
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder builder();
|
||||
|
||||
/**
|
||||
* add a new recipe the easy way, duplicates will not be added.
|
||||
* Added recipes will be automatically added to the optionals and inputs.
|
||||
*
|
||||
* @param recipe new recipe
|
||||
*
|
||||
* @throws IllegalArgumentException if null is added
|
||||
*/
|
||||
void addRecipe( IInscriberRecipe recipe );
|
||||
|
||||
/**
|
||||
* Removes a recipe from the registry
|
||||
*
|
||||
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense
|
||||
*/
|
||||
void removeRecipe( IInscriberRecipe toBeRemovedRecipe );
|
||||
}
|
||||
@@ -30,6 +30,12 @@ import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public interface IRegistryContainer
|
||||
{
|
||||
|
||||
@@ -69,6 +75,11 @@ public interface IRegistryContainer
|
||||
*/
|
||||
IGrinderRegistry grinder();
|
||||
|
||||
/**
|
||||
* Manage inscriber recipes via API
|
||||
*/
|
||||
IInscriberRegistry inscriber();
|
||||
|
||||
/**
|
||||
* get access to the locatable registry
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package appeng.api.features;
|
||||
|
||||
|
||||
public enum InscriberProcessType
|
||||
{
|
||||
/**
|
||||
* uses the optionals as catalyst
|
||||
*/
|
||||
Inscribe,
|
||||
|
||||
/**
|
||||
* spends the optionals
|
||||
*/
|
||||
Press
|
||||
}
|
||||
@@ -59,9 +59,21 @@ public interface IStorageCell extends ICellWorkbenchItem
|
||||
* @param cellItem item
|
||||
*
|
||||
* @return number of bytes
|
||||
*
|
||||
* @deprecated use {@link IStorageCell#getBytesPerType(ItemStack)}
|
||||
*/
|
||||
@Deprecated
|
||||
int BytePerType( ItemStack cellItem );
|
||||
|
||||
/**
|
||||
* Determines the number of bytes used for any type included on the cell.
|
||||
*
|
||||
* @param cellItem item
|
||||
*
|
||||
* @return number of bytes
|
||||
*/
|
||||
int getBytesPerType( ItemStack cellItem );
|
||||
|
||||
/**
|
||||
* Must be between 1 and 63, indicates how many types you want to store on
|
||||
* the item.
|
||||
|
||||
@@ -94,4 +94,4 @@ public interface IGrid
|
||||
* @return the node considered the pivot point of the grid.
|
||||
*/
|
||||
IGridNode getPivot();
|
||||
}
|
||||
}
|
||||
@@ -30,9 +30,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
public class ResolverResult
|
||||
{
|
||||
|
||||
final public String itemName;
|
||||
final public int damageValue;
|
||||
final public NBTTagCompound compound;
|
||||
public final String itemName;
|
||||
public final int damageValue;
|
||||
public final NBTTagCompound compound;
|
||||
|
||||
public ResolverResult( String name, int damage )
|
||||
{
|
||||
|
||||
@@ -77,22 +77,22 @@ public enum AEColor
|
||||
/**
|
||||
* Unlocalized name for color.
|
||||
*/
|
||||
final public String unlocalizedName;
|
||||
public final String unlocalizedName;
|
||||
|
||||
/**
|
||||
* Darkest Variant of the color, nearly black; as a RGB HEX Integer
|
||||
*/
|
||||
final public int blackVariant;
|
||||
public final int blackVariant;
|
||||
|
||||
/**
|
||||
* The Variant of the color that is used to represent the color normally; as a RGB HEX Integer
|
||||
*/
|
||||
final public int mediumVariant;
|
||||
public final int mediumVariant;
|
||||
|
||||
/**
|
||||
* Lightest Variant of the color, nearly white; as a RGB HEX Integer
|
||||
*/
|
||||
final public int whiteVariant;
|
||||
public final int whiteVariant;
|
||||
|
||||
AEColor( String unlocalizedName, int blackHex, int medHex, int whiteHex )
|
||||
{
|
||||
|
||||
@@ -156,11 +156,18 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
|
||||
try
|
||||
{
|
||||
return this.renderInfo = new BlockRenderInfo( this.getRenderer().newInstance() );
|
||||
final BaseBlockRender renderer = this.getRenderer().newInstance();
|
||||
this.renderInfo = new BlockRenderInfo( renderer );
|
||||
|
||||
return this.renderInfo;
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch ( InstantiationException e )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.getRenderer(), e );
|
||||
}
|
||||
catch( IllegalAccessException e )
|
||||
{
|
||||
throw new IllegalStateException( "Failed to create a new instance of " + this.getRenderer() + " because of permissions.", e );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +203,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
final public IFeatureHandler handler()
|
||||
public final IFeatureHandler handler()
|
||||
{
|
||||
return this.handler;
|
||||
}
|
||||
@@ -279,7 +286,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
final public AxisAlignedBB getSelectedBoundingBoxFromPool( World w, int x, int y, int z )
|
||||
public final AxisAlignedBB getSelectedBoundingBoxFromPool( World w, int x, int y, int z )
|
||||
{
|
||||
ICustomCollision collisionHandler = null;
|
||||
AxisAlignedBB b = null;
|
||||
@@ -360,7 +367,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean isOpaqueCube()
|
||||
public final boolean isOpaqueCube()
|
||||
{
|
||||
return this.isOpaque;
|
||||
}
|
||||
@@ -421,7 +428,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean onBlockActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
|
||||
public final boolean onBlockActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if( player != null )
|
||||
{
|
||||
@@ -566,13 +573,13 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean isNormalCube( IBlockAccess world, int x, int y, int z )
|
||||
public final boolean isNormalCube( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.isFullSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean rotateBlock( World w, int x, int y, int z, ForgeDirection axis )
|
||||
public final boolean rotateBlock( World w, int x, int y, int z, ForgeDirection axis )
|
||||
{
|
||||
IOrientable rotatable = null;
|
||||
|
||||
@@ -630,7 +637,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
final public ForgeDirection[] getValidRotations( World w, int x, int y, int z )
|
||||
public final ForgeDirection[] getValidRotations( World w, int x, int y, int z )
|
||||
{
|
||||
if( this.hasBlockTileEntity() )
|
||||
{
|
||||
@@ -787,7 +794,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
final public TileEntity createNewTileEntity( World var1, int var2 )
|
||||
public final TileEntity createNewTileEntity( World var1, int var2 )
|
||||
{
|
||||
if( this.hasBlockTileEntity() )
|
||||
{
|
||||
@@ -797,13 +804,11 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
}
|
||||
catch( InstantiationException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException( e );
|
||||
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.tileEntityType , e );
|
||||
}
|
||||
catch( IllegalAccessException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException( e );
|
||||
throw new IllegalStateException( "Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
|
||||
{
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
static public Class<? extends TileEntity> noTesrTile;
|
||||
static public Class<? extends TileEntity> tesrTile;
|
||||
public static Class<? extends TileEntity> noTesrTile;
|
||||
public static Class<? extends TileEntity> tesrTile;
|
||||
/**
|
||||
* Immibis MB Support.
|
||||
*/
|
||||
@@ -230,7 +230,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
Vec3 v3 = target.hitVec.addVector( -x, -y, -z );
|
||||
SelectedPart sp = this.cb( world, x, y, z ).selectPart( v3 );
|
||||
@@ -450,10 +450,10 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
|
||||
|
||||
public void setupTile()
|
||||
{
|
||||
this.setTileEntity( noTesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBus.class.getName() ) );
|
||||
this.setTileEntity( noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() ) );
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
tesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
|
||||
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
|
||||
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this );
|
||||
}
|
||||
|
||||
@@ -364,9 +364,6 @@ public class ClientHelper extends ServerHelper
|
||||
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
if( player == null )
|
||||
return;
|
||||
|
||||
int x = (int) player.posX;
|
||||
int y = (int) player.posY;
|
||||
int z = (int) player.posZ;
|
||||
|
||||
@@ -79,7 +79,6 @@ import appeng.core.sync.packets.PacketSwapSlots;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.INEI;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public abstract class AEBaseGui extends GuiContainer
|
||||
@@ -270,7 +269,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
final protected void drawGuiContainerForegroundLayer( int x, int y )
|
||||
protected final void drawGuiContainerForegroundLayer( int x, int y )
|
||||
{
|
||||
int ox = this.guiLeft; // (width - xSize) / 2;
|
||||
int oy = this.guiTop; // (height - ySize) / 2;
|
||||
@@ -285,7 +284,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
public abstract void drawFG( int offsetX, int offsetY, int mouseX, int mouseY );
|
||||
|
||||
@Override
|
||||
final protected void drawGuiContainerBackgroundLayer( float f, int x, int y )
|
||||
protected final void drawGuiContainerBackgroundLayer( float f, int x, int y )
|
||||
{
|
||||
int ox = this.guiLeft; // (width - xSize) / 2;
|
||||
int oy = this.guiTop; // (height - ySize) / 2;
|
||||
@@ -744,8 +743,6 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
catch( Exception err )
|
||||
{
|
||||
AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() );
|
||||
if( Platform.isDrawing( Tessellator.instance ) )
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
this.setItemRender( pIR );
|
||||
return;
|
||||
@@ -794,8 +791,6 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
catch( Exception err )
|
||||
{
|
||||
if( Platform.isDrawing( tessellator ) )
|
||||
tessellator.draw();
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
@@ -876,15 +871,10 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
try
|
||||
{
|
||||
// drawSlotInventory
|
||||
// super.func_146977_a( s );r
|
||||
GuiContainer.class.getDeclaredMethod( "func_146977_a_original", Slot.class ).invoke( this, s );
|
||||
}
|
||||
catch( Exception err )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if( Platform.isDrawing( tessellator ) )
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
|
||||
|
||||
public abstract class AEBaseMEGui extends AEBaseGui
|
||||
@@ -63,14 +64,30 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
||||
if( myStack != null )
|
||||
{
|
||||
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
|
||||
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
|
||||
{
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() );
|
||||
final String format = String.format( local, formattedAmount );
|
||||
|
||||
currentToolTip.add( "\u00a77" + format );
|
||||
}
|
||||
|
||||
if( myStack.getCountRequestable() > 0 )
|
||||
currentToolTip.add( "\u00a77Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
|
||||
{
|
||||
final String local = ButtonToolTips.ItemsRequestable.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() );
|
||||
final String format = String.format( local, formattedAmount );
|
||||
|
||||
currentToolTip.add( "\u00a77" + format );
|
||||
}
|
||||
}
|
||||
else if( stack.stackSize > BigNumber || ( stack.stackSize > 1 && stack.isItemDamaged() ) )
|
||||
{
|
||||
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize );
|
||||
final String format = String.format( local, formattedAmount );
|
||||
|
||||
currentToolTip.add( "\u00a77" + format );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GuiMEPortableCell extends GuiMEMonitorable
|
||||
|
||||
public GuiMEPortableCell( InventoryPlayer inventoryPlayer, IPortableCell te )
|
||||
{
|
||||
super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, null ) );
|
||||
super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
int defaultGetMaxRows()
|
||||
|
||||
@@ -28,10 +28,10 @@ import appeng.util.ItemSorters;
|
||||
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
||||
{
|
||||
|
||||
final public String unlocalizedName;
|
||||
final public AppEngInternalInventory inv;
|
||||
final public long id;
|
||||
final public long sortBy;
|
||||
public final String unlocalizedName;
|
||||
public final AppEngInternalInventory inv;
|
||||
public final long id;
|
||||
public final long sortBy;
|
||||
|
||||
public ClientDCInternalInv( int size, long id, long sortBy, String unlocalizedName )
|
||||
{
|
||||
|
||||
@@ -49,11 +49,11 @@ import appeng.util.prioitylist.IPartitionList;
|
||||
public class ItemRepo
|
||||
{
|
||||
|
||||
final private IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
final private ArrayList<IAEItemStack> view = new ArrayList<IAEItemStack>();
|
||||
final private ArrayList<ItemStack> dsp = new ArrayList<ItemStack>();
|
||||
final private IScrollSource src;
|
||||
final private ISortSource sortSrc;
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final ArrayList<IAEItemStack> view = new ArrayList<IAEItemStack>();
|
||||
private final ArrayList<ItemStack> dsp = new ArrayList<ItemStack>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
|
||||
public int rowSize = 9;
|
||||
|
||||
|
||||
@@ -29,12 +29,22 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.ISlimReadableNumberConverter;
|
||||
import appeng.util.IWideReadableNumberConverter;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public class AppEngRenderItem extends RenderItem
|
||||
{
|
||||
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
public IAEItemStack aeStack;
|
||||
|
||||
@@ -75,7 +85,7 @@ public class AppEngRenderItem extends RenderItem
|
||||
|
||||
if( is.stackSize == 0 )
|
||||
{
|
||||
String craftLabelText = AEConfig.instance.useTerminalUseLargeFont() ? "+" : "Craft";
|
||||
String craftLabelText = AEConfig.instance.useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft.getLocal();
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
@@ -124,11 +134,11 @@ public class AppEngRenderItem extends RenderItem
|
||||
{
|
||||
if( AEConfig.instance.useTerminalUseLargeFont() )
|
||||
{
|
||||
return NUMBER_CONVERTER.toShortHumanReadableForm( originalSize );
|
||||
return SLIM_CONVERTER.toSlimReadableForm( originalSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
return NUMBER_CONVERTER.toHumanReadableForm( originalSize );
|
||||
return WIDE_CONVERTER.toWideReadableForm( originalSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BaseBlockRender
|
||||
setOriMap();
|
||||
}
|
||||
|
||||
static public void setOriMap()
|
||||
public static void setOriMap()
|
||||
{
|
||||
// pointed up...
|
||||
ORIENTATION_MAP[0][3][1] = 0;
|
||||
@@ -309,7 +309,7 @@ public class BaseBlockRender
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
|
||||
static public int getOrientation( ForgeDirection in, ForgeDirection forward, ForgeDirection up )
|
||||
public static int getOrientation( ForgeDirection in, ForgeDirection forward, ForgeDirection up )
|
||||
{
|
||||
if( in == null || in == ForgeDirection.UNKNOWN // 1
|
||||
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
|
||||
@@ -325,9 +325,6 @@ public class BaseBlockRender
|
||||
|
||||
public void renderInvBlock( EnumSet<ForgeDirection> sides, AEBaseBlock block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer )
|
||||
{
|
||||
if( Platform.isDrawing( tess ) )
|
||||
tess.draw();
|
||||
|
||||
int meta = 0;
|
||||
if( block != null && block.hasSubtypes() && item != null )
|
||||
meta = item.getItemDamage();
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.client.texture.TmpFlippableIcon;
|
||||
public class BlockRenderInfo
|
||||
{
|
||||
|
||||
final public BaseBlockRender rendererInstance;
|
||||
public final BaseBlockRender rendererInstance;
|
||||
private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
|
||||
|
||||
@@ -472,7 +472,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
return block;
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to access the multi part block." );
|
||||
throw new MissingDefinition( "Tried to access the multi part block without it being defined." );
|
||||
}
|
||||
|
||||
public void prepareBounds( RenderBlocks renderer )
|
||||
|
||||
@@ -33,14 +33,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
final public RenderBlocks renderBlocksInstance = new RenderBlocks();
|
||||
public final RenderBlocks renderBlocksInstance = new RenderBlocks();
|
||||
|
||||
final BaseBlockRender blkRender;
|
||||
final double MAX_DISTANCE;
|
||||
@@ -52,7 +51,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void renderTileEntityAt( TileEntity te, double x, double y, double z, float f )
|
||||
public final void renderTileEntityAt( TileEntity te, double x, double y, double z, float f )
|
||||
{
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
@@ -65,9 +64,6 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
if( Platform.isDrawing( tess ) )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
@@ -76,9 +72,6 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
this.renderBlocksInstance.blockAccess = te.getWorldObj();
|
||||
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, this.renderBlocksInstance );
|
||||
|
||||
if( Platform.isDrawing( tess ) )
|
||||
throw new RuntimeException( "Error during rendering." );
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -87,7 +80,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
AELog.severe( "Hi, Looks like there was a crash while rendering something..." );
|
||||
t.printStackTrace();
|
||||
AELog.severe( "MC will now crash ( probably )!" );
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,20 @@ import appeng.client.ClientHelper;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.util.IWideReadableNumberConverter;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv1
|
||||
*/
|
||||
public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
{
|
||||
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
private static final IWideReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
public RenderBlockCraftingCPUMonitor()
|
||||
{
|
||||
@@ -53,9 +60,6 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
@Override
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
{
|
||||
if( Platform.isDrawing( tess ) )
|
||||
return;
|
||||
|
||||
if( tile instanceof TileCraftingMonitorTile )
|
||||
{
|
||||
TileCraftingMonitorTile cmt = (TileCraftingMonitorTile) tile;
|
||||
@@ -177,7 +181,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
|
||||
|
||||
final long stackSize = ais.getStackSize();
|
||||
final String renderedStackSize = NUMBER_CONVERTER.toHumanReadableForm( stackSize );
|
||||
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( renderedStackSize );
|
||||
|
||||
@@ -36,18 +36,24 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.recipes.handlers.Inscribe.InscriberRecipe;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public class RenderBlockInscriber extends BaseBlockRender
|
||||
{
|
||||
|
||||
@@ -225,9 +231,9 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
|
||||
if( is == null )
|
||||
{
|
||||
InscriberRecipe ir = inv.getTask();
|
||||
IInscriberRecipe ir = inv.getTask();
|
||||
if( ir != null )
|
||||
is = ir.output.copy();
|
||||
is = ir.getOutput().copy();
|
||||
}
|
||||
|
||||
this.renderItem( is, 0.0f, block, tile, tess, x, y, z, f, renderer );
|
||||
|
||||
@@ -75,7 +75,7 @@ public enum CableBusTextures
|
||||
|
||||
PartWirelessSides( "PartWirelessSides" ), PartStorageSides( "PartStorageSides" ), PartStorageBack( "PartStorageBack" );
|
||||
|
||||
final private String name;
|
||||
private final String name;
|
||||
public IIcon IIcon;
|
||||
|
||||
CableBusTextures( String name )
|
||||
|
||||
@@ -88,7 +88,7 @@ public enum ExtraBlockTextures
|
||||
|
||||
BlockPaint2( "BlockPaint2" ), BlockPaint3( "BlockPaint3" );
|
||||
|
||||
final private String name;
|
||||
private final String name;
|
||||
public IIcon IIcon;
|
||||
|
||||
ExtraBlockTextures( String name )
|
||||
|
||||
@@ -38,7 +38,7 @@ public enum ExtraItemTextures
|
||||
|
||||
ToolColorApplicatorTip_Light( "ToolColorApplicatorTip_Light" );
|
||||
|
||||
final private String name;
|
||||
private final String name;
|
||||
public IIcon IIcon;
|
||||
|
||||
ExtraItemTextures( String name )
|
||||
|
||||
@@ -31,9 +31,8 @@ public class FlippableIcon implements IIcon
|
||||
|
||||
public FlippableIcon( IIcon o )
|
||||
{
|
||||
|
||||
if( o == null )
|
||||
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
|
||||
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
|
||||
|
||||
this.original = o;
|
||||
this.flip_u = false;
|
||||
|
||||
@@ -32,9 +32,8 @@ public class FullIcon implements IIcon
|
||||
|
||||
public FullIcon( IIcon o )
|
||||
{
|
||||
|
||||
if( o == null )
|
||||
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
|
||||
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
|
||||
|
||||
this.p = o;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,8 @@ public class OffsetIcon implements IIcon
|
||||
|
||||
public OffsetIcon( IIcon o, float x, float y )
|
||||
{
|
||||
|
||||
if( o == null )
|
||||
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
|
||||
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
|
||||
|
||||
this.p = o;
|
||||
this.offsetX = x;
|
||||
|
||||
@@ -30,28 +30,27 @@ public class TaughtIcon implements IIcon
|
||||
|
||||
final float tightness;
|
||||
|
||||
private final IIcon p;
|
||||
private final IIcon icon;
|
||||
|
||||
public TaughtIcon( IIcon o, float tightness )
|
||||
public TaughtIcon( IIcon icon, float tightness )
|
||||
{
|
||||
if( icon == null )
|
||||
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
|
||||
|
||||
if( o == null )
|
||||
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
|
||||
|
||||
this.p = o;
|
||||
this.icon = icon;
|
||||
this.tightness = tightness * 0.4f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth()
|
||||
{
|
||||
return this.p.getIconWidth();
|
||||
return this.icon.getIconWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight()
|
||||
{
|
||||
return this.p.getIconHeight();
|
||||
return this.icon.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +99,7 @@ public class TaughtIcon implements IIcon
|
||||
@SideOnly( Side.CLIENT )
|
||||
public String getIconName()
|
||||
{
|
||||
return this.p.getIconName();
|
||||
return this.icon.getIconName();
|
||||
}
|
||||
|
||||
private float v( double d )
|
||||
@@ -109,7 +108,7 @@ public class TaughtIcon implements IIcon
|
||||
d -= this.tightness;
|
||||
if( d > 8 )
|
||||
d += this.tightness;
|
||||
return this.p.getInterpolatedV( Math.min( 16.0, Math.max( 0.0, d ) ) );
|
||||
return this.icon.getInterpolatedV( Math.min( 16.0, Math.max( 0.0, d ) ) );
|
||||
}
|
||||
|
||||
private float u( double d )
|
||||
@@ -118,6 +117,6 @@ public class TaughtIcon implements IIcon
|
||||
d -= this.tightness;
|
||||
if( d > 8 )
|
||||
d += this.tightness;
|
||||
return this.p.getInterpolatedU( Math.min( 16.0, Math.max( 0.0, d ) ) );
|
||||
return this.icon.getInterpolatedU( Math.min( 16.0, Math.max( 0.0, d ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
|
||||
protected final InventoryPlayer invPlayer;
|
||||
final protected BaseActionSource mySrc;
|
||||
protected final BaseActionSource mySrc;
|
||||
protected final HashSet<Integer> locked = new HashSet<Integer>();
|
||||
final TileEntity tileEntity;
|
||||
final IPart part;
|
||||
@@ -154,7 +154,7 @@ public abstract class AEBaseContainer extends Container
|
||||
this.obj = anchor instanceof IGuiItemObject ? (IGuiItemObject) anchor : null;
|
||||
|
||||
if( this.tileEntity == null && this.part == null && this.obj == null )
|
||||
throw new RuntimeException( "Must have a valid anchor" );
|
||||
throw new IllegalArgumentException( "Must have a valid anchor, instead " + anchor + " in " + ip );
|
||||
|
||||
this.mySrc = new PlayerSource( ip.player, this.getActionHost() );
|
||||
|
||||
@@ -327,7 +327,7 @@ public abstract class AEBaseContainer extends Container
|
||||
return this.tileEntity;
|
||||
}
|
||||
|
||||
final public void updateFullProgressBar( int idx, long value )
|
||||
public final void updateFullProgressBar( int idx, long value )
|
||||
{
|
||||
if( this.syncData.containsKey( idx ) )
|
||||
{
|
||||
@@ -380,7 +380,7 @@ public abstract class AEBaseContainer extends Container
|
||||
return super.addSlotToContainer( newSlot );
|
||||
}
|
||||
else
|
||||
throw new RuntimeException( "Invalid Slot for AE Container." );
|
||||
throw new IllegalArgumentException( "Invalid Slot [" + newSlot + "]for AE Container instead of AppEngSlot." );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -640,7 +640,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void updateProgressBar( int idx, int value )
|
||||
public final void updateProgressBar( int idx, int value )
|
||||
{
|
||||
if( this.syncData.containsKey( idx ) )
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.api.parts.IPart;
|
||||
public class ContainerOpenContext
|
||||
{
|
||||
|
||||
final public boolean isItem;
|
||||
public final boolean isItem;
|
||||
public World w;
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
@@ -49,15 +49,13 @@ import appeng.util.iterators.NullIterator;
|
||||
|
||||
public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
final TileCellWorkbench workBench;
|
||||
final AppEngNullInventory ni = new AppEngNullInventory();
|
||||
private final TileCellWorkbench workBench;
|
||||
private final AppEngNullInventory nullInventory = new AppEngNullInventory();
|
||||
@GuiSync( 2 )
|
||||
public CopyMode copyMode = CopyMode.CLEAR_ON_REMOVE;
|
||||
IInventory UpgradeInventoryWrapper;
|
||||
ItemStack prevStack = null;
|
||||
int lastUpgrades = 0;
|
||||
ItemStack LastCell;
|
||||
private ItemStack prevStack = null;
|
||||
private int lastUpgrades = 0;
|
||||
private ItemStack LastCell;
|
||||
|
||||
public ContainerCellWorkbench( InventoryPlayer ip, TileCellWorkbench te )
|
||||
{
|
||||
@@ -99,7 +97,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) );
|
||||
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
this.UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
|
||||
IInventory upgradeInventory = new Upgrades();
|
||||
// null, 3 * 8 );
|
||||
|
||||
for( int w = 0; w < 7; w++ )
|
||||
@@ -113,7 +111,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
for( int z = 0; z < 8; z++ )
|
||||
{
|
||||
int iSLot = zz * 8 + z;
|
||||
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) );
|
||||
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) );
|
||||
}
|
||||
/*
|
||||
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
|
||||
@@ -134,7 +132,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
if( this.prevStack != is )
|
||||
{
|
||||
this.prevStack = is;
|
||||
return this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
|
||||
this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
return this.lastUpgrades;
|
||||
}
|
||||
@@ -180,8 +178,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
|
||||
public IInventory getCellUpgradeInventory()
|
||||
{
|
||||
IInventory ri = this.workBench.getCellUpgradeInventory();
|
||||
return ri == null ? this.ni : ri;
|
||||
final IInventory upgradeInventory = this.workBench.getCellUpgradeInventory();
|
||||
|
||||
return upgradeInventory == null ? this.nullInventory : upgradeInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -237,7 +236,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
class Upgrades implements IInventory
|
||||
private class Upgrades implements IInventory
|
||||
{
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,16 +25,21 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.interfaces.IProgressProvider;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.recipes.handlers.Inscribe.InscriberRecipe;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public class ContainerInscriber extends ContainerUpgradeable implements IProgressProvider
|
||||
{
|
||||
|
||||
@@ -105,32 +110,32 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
@Override
|
||||
public boolean isValidForSlot( Slot s, ItemStack is )
|
||||
{
|
||||
ItemStack PlateA = this.ti.getStackInSlot( 0 );
|
||||
ItemStack PlateB = this.ti.getStackInSlot( 1 );
|
||||
ItemStack top = this.ti.getStackInSlot( 0 );
|
||||
ItemStack bot = this.ti.getStackInSlot( 1 );
|
||||
|
||||
if( s == this.middle )
|
||||
{
|
||||
for( ItemStack i : Inscribe.PLATES )
|
||||
for( ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( i, is ) )
|
||||
if( Platform.isSameItemPrecise( optional, is ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean matches = false;
|
||||
boolean found = false;
|
||||
|
||||
for( InscriberRecipe i : Inscribe.RECIPES )
|
||||
for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
boolean matchA = ( PlateA == null && i.plateA == null ) || ( Platform.isSameItemPrecise( PlateA, i.plateA ) ) && // and...
|
||||
( PlateB == null && i.plateB == null ) | ( Platform.isSameItemPrecise( PlateB, i.plateB ) );
|
||||
boolean matchA = ( top == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( top, recipe.getTopOptional().orNull() ) ) && // and...
|
||||
( bot == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( bot, recipe.getBottomOptional().orNull() ) );
|
||||
|
||||
boolean matchB = ( PlateB == null && i.plateA == null ) || ( Platform.isSameItemPrecise( PlateB, i.plateA ) ) && // and...
|
||||
( PlateA == null && i.plateB == null ) | ( Platform.isSameItemPrecise( PlateA, i.plateB ) );
|
||||
boolean matchB = ( bot == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( bot, recipe.getTopOptional().orNull() ) ) && // and...
|
||||
( top == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( top, recipe.getBottomOptional().orNull() ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
matches = true;
|
||||
for( ItemStack option : i.imprintable )
|
||||
for( ItemStack option : recipe.getInputs() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( is, option ) )
|
||||
found = true;
|
||||
@@ -142,7 +147,7 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
return false;
|
||||
}
|
||||
|
||||
if( ( s == this.top && PlateB != null ) || ( s == this.bottom && PlateA != null ) )
|
||||
if( ( s == this.top && bot != null ) || ( s == this.bottom && top != null ) )
|
||||
{
|
||||
boolean isValid = false;
|
||||
ItemStack otherSlot = null;
|
||||
@@ -159,15 +164,15 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
}
|
||||
|
||||
// everything else
|
||||
for( InscriberRecipe i : Inscribe.RECIPES )
|
||||
for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( i.plateA, otherSlot ) )
|
||||
if( Platform.isSameItemPrecise( recipe.getTopOptional().orNull(), otherSlot ) )
|
||||
{
|
||||
isValid = Platform.isSameItemPrecise( is, i.plateB );
|
||||
isValid = Platform.isSameItemPrecise( is, recipe.getBottomOptional().orNull() );
|
||||
}
|
||||
else if( Platform.isSameItemPrecise( i.plateB, otherSlot ) )
|
||||
else if( Platform.isSameItemPrecise( recipe.getBottomOptional().orNull(), otherSlot ) )
|
||||
{
|
||||
isValid = Platform.isSameItemPrecise( is, i.plateA );
|
||||
isValid = Platform.isSameItemPrecise( is, recipe.getTopOptional().orNull() );
|
||||
}
|
||||
|
||||
if( isValid )
|
||||
|
||||
@@ -25,20 +25,33 @@ import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
{
|
||||
|
||||
final IPortableCell civ;
|
||||
double powerMultiplier = 0.5;
|
||||
int ticks = 0;
|
||||
public double powerMultiplier = 0.5;
|
||||
|
||||
private final IPortableCell civ;
|
||||
private int ticks = 0;
|
||||
private final int slot;
|
||||
|
||||
public ContainerMEPortableCell( InventoryPlayer ip, IPortableCell monitorable )
|
||||
{
|
||||
super( ip, monitorable, false );
|
||||
this.lockPlayerInventorySlot( ip.currentItem );
|
||||
if( monitorable instanceof IInventorySlotAware )
|
||||
{
|
||||
int slotIndex = ( (IInventorySlotAware) monitorable ).getInventorySlot();
|
||||
this.lockPlayerInventorySlot( slotIndex );
|
||||
this.slot = slotIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.slot = -1;
|
||||
this.lockPlayerInventorySlot( ip.currentItem );
|
||||
}
|
||||
this.civ = monitorable;
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
}
|
||||
@@ -46,7 +59,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = this.getPlayerInv().getCurrentItem();
|
||||
ItemStack currentItem = slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot( slot );
|
||||
|
||||
if( this.civ != null )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.container.interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Any item providing a GUI and depending on an exact inventory slot.
|
||||
*
|
||||
* This interface is likely a volatile one until a general GUI refactoring occurred.
|
||||
* Use it with care and expect changes.
|
||||
*
|
||||
*/
|
||||
public interface IInventorySlotAware
|
||||
{
|
||||
/**
|
||||
* This is needed to select the correct slot index.
|
||||
*
|
||||
* @return the inventory index of this portable cell.
|
||||
*/
|
||||
int getInventorySlot();
|
||||
}
|
||||
@@ -42,10 +42,15 @@ import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public class SlotRestrictedInput extends AppEngSlot
|
||||
{
|
||||
|
||||
@@ -144,8 +149,8 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
return true;
|
||||
}
|
||||
|
||||
for( ItemStack is : Inscribe.PLATES )
|
||||
if( Platform.isSameItemPrecise( is, i ) )
|
||||
for( ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
if( Platform.isSameItemPrecise( optional, i ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -224,7 +229,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
return super.getStack();
|
||||
}
|
||||
|
||||
static public boolean isMetalIngot( ItemStack i )
|
||||
public static boolean isMetalIngot( ItemStack i )
|
||||
{
|
||||
if( Platform.isSameItemPrecise( i, new ItemStack( Items.iron_ingot ) ) )
|
||||
return true;
|
||||
|
||||
@@ -49,13 +49,13 @@ import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
|
||||
public final class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
|
||||
{
|
||||
|
||||
public static final double TUNNEL_POWER_LOSS = 0.05;
|
||||
public static final String VERSION = "@version@";
|
||||
public static final String CHANNEL = "@aechannel@";
|
||||
public final static String PACKET_CHANNEL = "AE";
|
||||
public static final String PACKET_CHANNEL = "AE";
|
||||
public static AEConfig instance;
|
||||
public final IConfigManager settings = new ConfigManager( this );
|
||||
public final EnumSet<AEFeature> featureFlags = EnumSet.noneOf( AEFeature.class );
|
||||
@@ -63,7 +63,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
||||
public final int[] priorityByStacks = new int[] { 1, 10, 100, 1000 };
|
||||
public final int[] levelByStacks = new int[] { 1, 10, 100, 1000 };
|
||||
private final double WirelessHighWirelessCount = 64;
|
||||
final private File configFile;
|
||||
private final File configFile;
|
||||
public int storageBiomeID = -1;
|
||||
public int storageProviderID = -1;
|
||||
public int formationPlaneEntityLimit = 128;
|
||||
|
||||
@@ -31,7 +31,6 @@ import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.core.api.ApiPart;
|
||||
import appeng.core.api.ApiStorage;
|
||||
@@ -81,7 +80,7 @@ public final class Api implements IAppEngApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHelper partHelper()
|
||||
public ApiPart partHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
@@ -119,8 +118,9 @@ public final class Api implements IAppEngApi
|
||||
@Override
|
||||
public IGridNode createGridNode( IGridBlock blk )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
throw new RuntimeException( "Grid Features are Server Side Only." );
|
||||
if ( Platform.isClient() )
|
||||
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
|
||||
|
||||
return new GridNode( blk );
|
||||
}
|
||||
|
||||
@@ -129,9 +129,4 @@ public final class Api implements IAppEngApi
|
||||
{
|
||||
return new GridConnection( a, b, ForgeDirection.UNKNOWN );
|
||||
}
|
||||
|
||||
public ApiPart getPartHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ import appeng.util.Platform;
|
||||
|
||||
|
||||
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
||||
public class AppEng
|
||||
public final class AppEng
|
||||
{
|
||||
public final static String MOD_ID = "appliedenergistics2";
|
||||
public final static String MOD_NAME = "Applied Energistics 2";
|
||||
public final static String MOD_DEPENDENCIES =
|
||||
public static final String MOD_ID = "appliedenergistics2";
|
||||
public static final String MOD_NAME = "Applied Energistics 2";
|
||||
public static final String MOD_DEPENDENCIES =
|
||||
// a few mods, AE should load after, probably.
|
||||
// required-after:AppliedEnergistics2API|all;
|
||||
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
@@ -27,7 +27,7 @@ import appeng.core.features.IFeatureHandler;
|
||||
|
||||
public final class FeatureHandlerRegistry
|
||||
{
|
||||
private final Set<IFeatureHandler> registry = new HashSet<IFeatureHandler>();
|
||||
private final Set<IFeatureHandler> registry = new LinkedHashSet<IFeatureHandler>();
|
||||
|
||||
public void addFeatureHandler( IFeatureHandler feature )
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.core.features.IAEFeature;
|
||||
@@ -27,7 +27,7 @@ import appeng.core.features.IAEFeature;
|
||||
|
||||
public final class FeatureRegistry
|
||||
{
|
||||
private final Set<IAEFeature> registry = new HashSet<IAEFeature>();
|
||||
private final Set<IAEFeature> registry = new LinkedHashSet<IAEFeature>();
|
||||
|
||||
public void addFeature( IAEFeature feature )
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ public class IMCHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException( "Invalid IMC Called: " + key );
|
||||
throw new IllegalStateException( "Invalid IMC Called: " + key );
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
|
||||
@@ -121,7 +121,7 @@ import appeng.worldgen.QuartzWorldGen;
|
||||
|
||||
public final class Registration
|
||||
{
|
||||
final public static Registration INSTANCE = new Registration();
|
||||
public static final Registration INSTANCE = new Registration();
|
||||
|
||||
private final RecipeHandler recipeHandler;
|
||||
private final DefinitionConverter converter;
|
||||
@@ -189,7 +189,7 @@ public final class Registration
|
||||
{
|
||||
config.storageBiomeID = Platform.findEmpty( BiomeGenBase.getBiomeGenArray() );
|
||||
if( config.storageBiomeID == -1 )
|
||||
throw new RuntimeException( "Biome Array is full, please free up some Biome ID's or disable spatial." );
|
||||
throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable spatial." );
|
||||
|
||||
this.storageBiome = new BiomeGenStorage( config.storageBiomeID );
|
||||
config.save();
|
||||
@@ -586,7 +586,7 @@ public final class Registration
|
||||
PlayerMessages.values();
|
||||
GuiText.values();
|
||||
|
||||
Api.INSTANCE.getPartHelper().initFMPSupport();
|
||||
Api.INSTANCE.partHelper().initFMPSupport();
|
||||
for( Block block : blocks.multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
( (BlockCableBus) block ).setupTile();
|
||||
|
||||
@@ -105,19 +105,19 @@ public class WorldSettings extends Configuration
|
||||
|
||||
if( !aeBaseFolder.isDirectory() && !aeBaseFolder.mkdir() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
|
||||
throw new IllegalStateException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File compass = new File( aeBaseFolder, COMPASS_FOLDER );
|
||||
if( !compass.isDirectory() && !compass.mkdir() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
|
||||
throw new IllegalStateException( "Failed to create " + compass.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File spawnData = new File( aeBaseFolder, SPAWNDATA_FOLDER );
|
||||
if( !spawnData.isDirectory() && !spawnData.mkdir() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + spawnData.getAbsolutePath() );
|
||||
throw new IllegalStateException( "Failed to create " + spawnData.getAbsolutePath() );
|
||||
}
|
||||
|
||||
instance = new WorldSettings( aeBaseFolder );
|
||||
@@ -158,7 +158,7 @@ public class WorldSettings extends Configuration
|
||||
NBTTagCompound loadSpawnData( int dim, int chunkX, int chunkZ )
|
||||
{
|
||||
if( !Thread.holdsLock( WorldSettings.class ) )
|
||||
throw new RuntimeException( "Invalid Request" );
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
|
||||
NBTTagCompound data = null;
|
||||
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
|
||||
@@ -225,7 +225,7 @@ public class WorldSettings extends Configuration
|
||||
void writeSpawnData( int dim, int chunkX, int chunkZ, NBTTagCompound data )
|
||||
{
|
||||
if( !Thread.holdsLock( WorldSettings.class ) )
|
||||
throw new RuntimeException( "Invalid Request" );
|
||||
throw new IllegalStateException( "Invalid Request" );
|
||||
|
||||
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
|
||||
FileOutputStream fileOutputStream = null;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
@@ -85,9 +86,9 @@ public class ApiPart implements IPartHelper
|
||||
{
|
||||
return Class.forName( base );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( ClassNotFoundException e )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,14 +96,7 @@ public class ApiPart implements IPartHelper
|
||||
|
||||
if( this.tileImplementations.get( description ) != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.tileImplementations.get( description );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
return this.tileImplementations.get( description );
|
||||
}
|
||||
|
||||
String f = base;// TileCableBus.class.getName();
|
||||
@@ -121,9 +115,9 @@ public class ApiPart implements IPartHelper
|
||||
{
|
||||
myCLass = Class.forName( f );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( ClassNotFoundException e )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
|
||||
String path = f;
|
||||
@@ -147,14 +141,7 @@ public class ApiPart implements IPartHelper
|
||||
|
||||
this.tileImplementations.put( description, myCLass );
|
||||
|
||||
try
|
||||
{
|
||||
return myCLass;
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
return myCLass;
|
||||
}
|
||||
|
||||
public Class getClassByDesc( String Addendum, String fullPath, String root, String next )
|
||||
@@ -247,19 +234,21 @@ public class ApiPart implements IPartHelper
|
||||
|
||||
public ClassNode getReader( String name )
|
||||
{
|
||||
ClassReader cr;
|
||||
String path = '/' + name.replace( ".", "/" ) + ".class";
|
||||
InputStream is = this.getClass().getResourceAsStream( path );
|
||||
try
|
||||
{
|
||||
ClassReader cr;
|
||||
String path = '/' + name.replace( ".", "/" ) + ".class";
|
||||
InputStream is = this.getClass().getResourceAsStream( path );
|
||||
cr = new ClassReader( is );
|
||||
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept( cn, ClassReader.EXPAND_FRAMES );
|
||||
|
||||
return cn;
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( IOException e )
|
||||
{
|
||||
throw new RuntimeException( "Error loading " + name, t );
|
||||
throw new IllegalStateException( "Error loading " + name, e );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +295,7 @@ public class ApiPart implements IPartHelper
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
throw new RuntimeException( "Unable to manage part API.", e );
|
||||
throw new IllegalStateException( "Unable to manage part API.", e );
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DefinitionConstructor
|
||||
return ( (ITileDefinition) definition );
|
||||
}
|
||||
|
||||
throw new RuntimeException( "No tile definition" );
|
||||
throw new IllegalStateException( "No tile definition for " + feature );
|
||||
}
|
||||
|
||||
public final IBlockDefinition registerBlockDefinition( IAEFeature feature )
|
||||
@@ -52,7 +52,7 @@ public class DefinitionConstructor
|
||||
return ( (IBlockDefinition) definition );
|
||||
}
|
||||
|
||||
throw new RuntimeException( "No block definition" );
|
||||
throw new IllegalStateException( "No block definition for " + feature );
|
||||
}
|
||||
|
||||
public final IItemDefinition registerItemDefinition( IAEFeature feature )
|
||||
|
||||
@@ -77,10 +77,10 @@ public class IMCGrinder implements IIMCProcessor
|
||||
int turns = msg.getInteger( "turns" );
|
||||
|
||||
if( in == null )
|
||||
throw new RuntimeException( "invalid input" );
|
||||
throw new IllegalStateException( "invalid input" );
|
||||
|
||||
if( out == null )
|
||||
throw new RuntimeException( "invalid output" );
|
||||
throw new IllegalStateException( "invalid output" );
|
||||
|
||||
if( msg.hasKey( "optional" ) )
|
||||
{
|
||||
@@ -88,7 +88,7 @@ public class IMCGrinder implements IIMCProcessor
|
||||
ItemStack optional = ItemStack.loadItemStackFromNBT( optionalTag );
|
||||
|
||||
if( optional == null )
|
||||
throw new RuntimeException( "invalid optional" );
|
||||
throw new IllegalStateException( "invalid optional" );
|
||||
|
||||
float chance = msg.getFloat( "chance" );
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class IMCMatterCannon implements IIMCProcessor
|
||||
double weight = msg.getDouble( "weight" );
|
||||
|
||||
if( ammo == null )
|
||||
throw new RuntimeException( "invalid item" );
|
||||
throw new IllegalStateException( "invalid item in message " + m );
|
||||
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight );
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-item",
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
@@ -55,9 +57,9 @@ public class IMCP2PAttunement implements IIMCProcessor
|
||||
if( is != null )
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type );
|
||||
else
|
||||
throw new RuntimeException( "invalid item" );
|
||||
throw new IllegalStateException( "invalid item in message " + m );
|
||||
}
|
||||
else
|
||||
throw new RuntimeException( "invalid type" );
|
||||
throw new IllegalStateException( "invalid type in message " + m + " is not contained in " + Arrays.toString( TunnelType.values() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public enum AEFeature
|
||||
|
||||
DenseEnergyCells( "HigherCapacity" ), DenseCables( "HigherCapacity" ),
|
||||
|
||||
P2PTunnelRF( "P2PTunnels" ), P2PTunnelME( "P2PTunnels" ), P2PTunnelItems( "P2PTunnels" ), P2PTunnelRedstone( "P2PTunnels" ), P2PTunnelEU( "P2PTunnels" ), P2PTunnelMJ( "P2PTunnels" ), P2PTunnelLiquids( "P2PTunnels" ), P2PTunnelLight( "P2PTunnels" ),
|
||||
P2PTunnelRF( "P2PTunnels" ), P2PTunnelME( "P2PTunnels" ), P2PTunnelItems( "P2PTunnels" ), P2PTunnelRedstone( "P2PTunnels" ), P2PTunnelEU( "P2PTunnels" ), P2PTunnelLiquids( "P2PTunnels" ), P2PTunnelLight( "P2PTunnels" ),
|
||||
|
||||
MassCannonBlockDamage( "BlockFeatures" ), TinyTNTBlockDamage( "BlockFeatures" ), Facades( "Facades" ),
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Set;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
|
||||
public class FeaturedActiveChecker
|
||||
public final class FeaturedActiveChecker
|
||||
{
|
||||
private final Set<AEFeature> features;
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridCache;
|
||||
@@ -28,10 +30,9 @@ import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.core.AELog;
|
||||
|
||||
|
||||
public class GridCacheRegistry implements IGridCacheRegistry
|
||||
public final class GridCacheRegistry implements IGridCacheRegistry
|
||||
{
|
||||
|
||||
final private HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>>();
|
||||
private final Map<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>>();
|
||||
|
||||
@Override
|
||||
public void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation )
|
||||
@@ -39,7 +40,7 @@ public class GridCacheRegistry implements IGridCacheRegistry
|
||||
if( iface.isAssignableFrom( implementation ) )
|
||||
this.caches.put( iface, implementation );
|
||||
else
|
||||
throw new RuntimeException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements" );
|
||||
throw new IllegalArgumentException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements. Gotten: " + iface + " and " + implementation );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,15 +50,31 @@ public class GridCacheRegistry implements IGridCacheRegistry
|
||||
|
||||
for( Class<? extends IGridCache> iface : this.caches.keySet() )
|
||||
{
|
||||
Constructor<? extends IGridCache> c;
|
||||
try
|
||||
{
|
||||
Constructor<? extends IGridCache> c = this.caches.get( iface ).getConstructor( IGrid.class );
|
||||
c = this.caches.get( iface ).getConstructor( IGrid.class );
|
||||
map.put( iface, c.newInstance( g ) );
|
||||
}
|
||||
catch( Throwable e )
|
||||
catch( NoSuchMethodException e )
|
||||
{
|
||||
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
|
||||
throw new RuntimeException( e );
|
||||
throw new IllegalArgumentException( e );
|
||||
}
|
||||
catch( InvocationTargetException e )
|
||||
{
|
||||
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
catch( InstantiationException e )
|
||||
{
|
||||
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
catch( IllegalAccessException e )
|
||||
{
|
||||
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
|
||||
throw new IllegalStateException( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.IInscriberRecipeBuilder;
|
||||
import appeng.api.features.IInscriberRegistry;
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
import appeng.core.features.registries.entries.InscriberRecipe;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class InscriberRegistry implements IInscriberRegistry
|
||||
{
|
||||
private final List<IInscriberRecipe> recipes;
|
||||
private final Set<ItemStack> optionals;
|
||||
private final Set<ItemStack> inputs;
|
||||
|
||||
public InscriberRegistry()
|
||||
{
|
||||
this.inputs = new HashSet<ItemStack>();
|
||||
this.optionals = new HashSet<ItemStack>();
|
||||
this.recipes = new ArrayList<IInscriberRecipe>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<IInscriberRecipe> getRecipes()
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<ItemStack> getOptionals()
|
||||
{
|
||||
return this.optionals;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<ItemStack> getInputs()
|
||||
{
|
||||
return this.inputs;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IInscriberRecipeBuilder builder()
|
||||
{
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( IInscriberRecipe recipe )
|
||||
{
|
||||
if( recipe == null )
|
||||
throw new IllegalArgumentException( "Tried to add an invalid (null) inscriber recipe to the registry." );
|
||||
|
||||
this.recipes.add( recipe );
|
||||
|
||||
this.optionals.addAll( recipe.getTopOptional().asSet() );
|
||||
this.optionals.addAll( recipe.getBottomOptional().asSet() );
|
||||
|
||||
this.inputs.addAll( recipe.getInputs() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRecipe( IInscriberRecipe toBeRemovedRecipe )
|
||||
{
|
||||
for( final Iterator<IInscriberRecipe> iterator = this.recipes.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
final IInscriberRecipe recipe = iterator.next();
|
||||
if( recipe.equals( toBeRemovedRecipe ) )
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal {@link IInscriberRecipeBuilder} implementation.
|
||||
* Needs to be adapted to represent a correct {@link IInscriberRecipe}
|
||||
*/
|
||||
private static final class Builder implements IInscriberRecipeBuilder
|
||||
{
|
||||
private List<ItemStack> inputs;
|
||||
private ItemStack output;
|
||||
private ItemStack topOptional;
|
||||
private ItemStack bottomOptional;
|
||||
private InscriberProcessType type;
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Builder withInputs( @Nonnull Collection<ItemStack> inputs )
|
||||
{
|
||||
this.inputs = new ArrayList<ItemStack>( inputs.size() );
|
||||
this.inputs.addAll( inputs );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Builder withOutput( @Nonnull ItemStack output )
|
||||
{
|
||||
this.output = output;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Builder withTopOptional( @Nonnull ItemStack topOptional )
|
||||
{
|
||||
this.topOptional = topOptional;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Builder withBottomOptional( @Nonnull ItemStack bottomOptional )
|
||||
{
|
||||
this.bottomOptional = bottomOptional;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Builder withProcessType( @Nonnull InscriberProcessType type )
|
||||
{
|
||||
this.type = type;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IInscriberRecipe build()
|
||||
{
|
||||
if( this.inputs == null )
|
||||
throw new IllegalStateException( "Input must be defined." );
|
||||
if( this.inputs.size() == 0 )
|
||||
throw new IllegalStateException( "Input must have a size." );
|
||||
if( this.output == null )
|
||||
throw new IllegalStateException( "Output must be defined." );
|
||||
if ( this.topOptional == null && this.bottomOptional == null )
|
||||
throw new IllegalStateException( "One optional must be defined." );
|
||||
if ( this.type == null )
|
||||
throw new IllegalStateException( "Process type must be defined." );
|
||||
|
||||
return new InscriberRecipe( this.inputs, this.output, this.topOptional, this.bottomOptional, this.type );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,10 +54,9 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
@Override
|
||||
public void whiteListTileEntity( Class<? extends TileEntity> c )
|
||||
{
|
||||
|
||||
if( c.getName().equals( TileEntity.class.getName() ) )
|
||||
{
|
||||
throw new RuntimeException( new AppEngException( "Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) );
|
||||
throw new IllegalArgumentException( new AppEngException( "Someone tried to make all tiles movable with " + c + ", this is a clear violation of the purpose of the white list." ) );
|
||||
}
|
||||
|
||||
this.test.add( c );
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.core.features.registries;
|
||||
|
||||
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.IInscriberRegistry;
|
||||
import appeng.api.features.ILocatableRegistry;
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
@@ -35,74 +36,88 @@ import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* represents all registries
|
||||
*
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public class RegistryContainer implements IRegistryContainer
|
||||
{
|
||||
|
||||
private final GrinderRecipeManager GrinderRecipes = new GrinderRecipeManager();
|
||||
private final ExternalStorageRegistry ExternalStorageHandlers = new ExternalStorageRegistry();
|
||||
private final CellRegistry CellRegistry = new CellRegistry();
|
||||
private final LocatableRegistry LocatableRegistry = new LocatableRegistry();
|
||||
private final SpecialComparisonRegistry SpecialComparisonRegistry = new SpecialComparisonRegistry();
|
||||
private final WirelessRegistry WirelessRegistry = new WirelessRegistry();
|
||||
private final GridCacheRegistry GridCacheRegistry = new GridCacheRegistry();
|
||||
private final P2PTunnelRegistry P2PRegistry = new P2PTunnelRegistry();
|
||||
private final MovableTileRegistry MovableReg = new MovableTileRegistry();
|
||||
private final MatterCannonAmmoRegistry matterCannonReg = new MatterCannonAmmoRegistry();
|
||||
private final PlayerRegistry playerRegistry = new PlayerRegistry();
|
||||
private final IGrinderRegistry grinder = new GrinderRecipeManager();
|
||||
private final IInscriberRegistry inscriber = new InscriberRegistry();
|
||||
private final IExternalStorageRegistry storage = new ExternalStorageRegistry();
|
||||
private final ICellRegistry cell = new CellRegistry();
|
||||
private final ILocatableRegistry locatable = new LocatableRegistry();
|
||||
private final ISpecialComparisonRegistry comparison = new SpecialComparisonRegistry();
|
||||
private final IWirelessTermRegistry wireless = new WirelessRegistry();
|
||||
private final IGridCacheRegistry gridCache = new GridCacheRegistry();
|
||||
private final IP2PTunnelRegistry p2ptunnel = new P2PTunnelRegistry();
|
||||
private final IMovableRegistry movable = new MovableTileRegistry();
|
||||
private final IMatterCannonAmmoRegistry matterCannonReg = new MatterCannonAmmoRegistry();
|
||||
private final IPlayerRegistry playerRegistry = new PlayerRegistry();
|
||||
private final IRecipeHandlerRegistry recipeReg = new RecipeHandlerRegistry();
|
||||
|
||||
@Override
|
||||
public IMovableRegistry movable()
|
||||
{
|
||||
return this.MovableReg;
|
||||
return this.movable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridCacheRegistry gridCache()
|
||||
{
|
||||
return this.GridCacheRegistry;
|
||||
return this.gridCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageRegistry externalStorage()
|
||||
{
|
||||
return this.ExternalStorageHandlers;
|
||||
return this.storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialComparisonRegistry specialComparison()
|
||||
{
|
||||
return this.SpecialComparisonRegistry;
|
||||
return this.comparison;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWirelessTermRegistry wireless()
|
||||
{
|
||||
return this.WirelessRegistry;
|
||||
return this.wireless;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICellRegistry cell()
|
||||
{
|
||||
return this.CellRegistry;
|
||||
return this.cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderRegistry grinder()
|
||||
{
|
||||
return this.GrinderRecipes;
|
||||
return this.grinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInscriberRegistry inscriber()
|
||||
{
|
||||
return this.inscriber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILocatableRegistry locatable()
|
||||
{
|
||||
return this.LocatableRegistry;
|
||||
return this.locatable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IP2PTunnelRegistry p2pTunnel()
|
||||
{
|
||||
return this.P2PRegistry;
|
||||
return this.p2ptunnel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
public class WirelessRangeResult
|
||||
{
|
||||
|
||||
final public float dist;
|
||||
final public TileEntity te;
|
||||
public final float dist;
|
||||
public final TileEntity te;
|
||||
|
||||
public WirelessRangeResult( TileEntity t, float d )
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ import appeng.api.features.IWorldGen;
|
||||
public final class WorldGenRegistry implements IWorldGen
|
||||
{
|
||||
|
||||
static final public WorldGenRegistry INSTANCE = new WorldGenRegistry();
|
||||
public static final WorldGenRegistry INSTANCE = new WorldGenRegistry();
|
||||
final TypeSet[] types;
|
||||
|
||||
private WorldGenRegistry()
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
|
||||
|
||||
/**
|
||||
* inscribe recipes do not use up the provided optional upon craft
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public class InscriberInscribeRecipe extends InscriberRecipe
|
||||
{
|
||||
public InscriberInscribeRecipe( @Nonnull Collection<ItemStack> inputs, @Nonnull ItemStack output, @Nullable ItemStack top, @Nullable ItemStack bot )
|
||||
{
|
||||
super( inputs, output, top, bot, InscriberProcessType.Inscribe );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
|
||||
|
||||
/**
|
||||
* Basic inscriber recipe
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public class InscriberRecipe implements IInscriberRecipe
|
||||
{
|
||||
@Nonnull
|
||||
private final List<ItemStack> inputs;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
@Nonnull
|
||||
private final Optional<ItemStack> maybeTop;
|
||||
|
||||
@Nonnull
|
||||
private final Optional<ItemStack> maybeBot;
|
||||
|
||||
@Nonnull
|
||||
private final InscriberProcessType type;
|
||||
|
||||
public InscriberRecipe( @Nonnull Collection<ItemStack> inputs, @Nonnull ItemStack output, @Nullable ItemStack top, @Nullable ItemStack bot, @Nonnull InscriberProcessType type )
|
||||
{
|
||||
this.inputs = new ArrayList<ItemStack>( inputs.size() );
|
||||
this.inputs.addAll( inputs );
|
||||
|
||||
this.output = output;
|
||||
this.maybeTop = Optional.fromNullable( top );
|
||||
this.maybeBot = Optional.fromNullable( bot );
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final List<ItemStack> getInputs()
|
||||
{
|
||||
return this.inputs;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final ItemStack getOutput()
|
||||
{
|
||||
return this.output;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final Optional<ItemStack> getTopOptional()
|
||||
{
|
||||
return this.maybeTop;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final Optional<ItemStack> getBottomOptional()
|
||||
{
|
||||
return this.maybeBot;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public final InscriberProcessType getProcessType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if( this == o )
|
||||
return true;
|
||||
if( !(o instanceof IInscriberRecipe) )
|
||||
return false;
|
||||
|
||||
IInscriberRecipe that = (IInscriberRecipe) o;
|
||||
|
||||
if( !this.inputs.equals( that.getInputs() ) )
|
||||
return false;
|
||||
if( !this.output.equals( that.getOutput() ) )
|
||||
return false;
|
||||
if( !this.maybeTop.equals( that.getTopOptional() ) )
|
||||
return false;
|
||||
if( !this.maybeBot.equals( that.getBottomOptional()) )
|
||||
return false;
|
||||
return this.type == that.getProcessType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = this.inputs.hashCode();
|
||||
result = 31 * result + this.output.hashCode();
|
||||
result = 31 * result + this.maybeTop.hashCode();
|
||||
result = 31 * result + this.maybeBot.hashCode();
|
||||
result = 31 * result + this.type.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,10 @@ public enum ButtonToolTips
|
||||
|
||||
Craft, Mod, DoesntDespawn, EmitterMode, CraftViaRedstone, EmitWhenCrafting, ReportInaccessibleItems, ReportInaccessibleItemsYes, ReportInaccessibleItemsNo,
|
||||
|
||||
BlockPlacement, BlockPlacementYes, BlockPlacementNo;
|
||||
BlockPlacement, BlockPlacementYes, BlockPlacementNo,
|
||||
|
||||
// Used in the tooltips of the items in the terminal, when moused over
|
||||
ItemsStored, ItemsRequestable;
|
||||
|
||||
final String root;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public enum GuiText
|
||||
|
||||
CraftingTerminal, FormationPlane, Inscriber, QuartzCuttingKnife,
|
||||
|
||||
METunnel, ItemTunnel, RedstoneTunnel, MJTunnel, EUTunnel, FluidTunnel,
|
||||
METunnel, ItemTunnel, RedstoneTunnel, EUTunnel, FluidTunnel,
|
||||
|
||||
StoredSize, CopyMode, CopyModeDesc, PatternTerminal, CraftingPattern,
|
||||
|
||||
@@ -70,7 +70,13 @@ public enum GuiText
|
||||
|
||||
NoCraftingJobs, CPUs, FacadeCrafting, inWorldCraftingPresses, ChargedQuartzFind,
|
||||
|
||||
Included, Excluded, Partitioned, Precise, Fuzzy;
|
||||
Included, Excluded, Partitioned, Precise, Fuzzy,
|
||||
|
||||
// Used in a terminal to indicate that an item is craftable
|
||||
SmallFontCraft, LargeFontCraft,
|
||||
|
||||
// Used in a ME Interface when no appropriate TileEntity was detected near it
|
||||
Nothing;
|
||||
|
||||
final String root;
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ public enum TickRates
|
||||
|
||||
AnnihilationPlane( 2, 120 ),
|
||||
|
||||
MJTunnel( 1, 20 ),
|
||||
|
||||
METunnel( 5, 20 ),
|
||||
|
||||
Inscriber( 1, 1 ),
|
||||
|
||||
@@ -40,17 +40,17 @@ public abstract class AppEngPacket
|
||||
|
||||
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
|
||||
{
|
||||
throw new RuntimeException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
|
||||
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
|
||||
}
|
||||
|
||||
final public int getPacketID()
|
||||
public final int getPacketID()
|
||||
{
|
||||
return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal();
|
||||
}
|
||||
|
||||
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
|
||||
{
|
||||
throw new RuntimeException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
|
||||
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
|
||||
}
|
||||
|
||||
protected void configureWrite( ByteBuf data )
|
||||
|
||||
@@ -130,7 +130,7 @@ public class AppEngPacketHandlerBase
|
||||
REVERSE_LOOKUP.put( this.packetClass, this );
|
||||
|
||||
if( this.packetConstructor == null )
|
||||
throw new RuntimeException( "Invalid Packet Class, must be constructable on DataInputStream" );
|
||||
throw new IllegalStateException( "Invalid Packet Class " + c + ", must be constructable on DataInputStream" );
|
||||
}
|
||||
|
||||
public static PacketTypes getPacket( int id )
|
||||
|
||||
@@ -228,10 +228,10 @@ public enum GuiBridge implements IGuiHandler
|
||||
String guiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
|
||||
|
||||
if( start.equals( guiClass ) )
|
||||
throw new RuntimeException( "Unable to find gui class" );
|
||||
throw new IllegalStateException( "Unable to find gui class" );
|
||||
this.Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), guiClass );
|
||||
if( this.Gui == null )
|
||||
throw new RuntimeException( "Cannot Load class: " + guiClass );
|
||||
throw new IllegalStateException( "Cannot Load class: " + guiClass );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,15 +250,21 @@ public enum GuiBridge implements IGuiHandler
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL & 0x07 );
|
||||
GuiBridge ID = values()[ID_ORDINAL >> 4];
|
||||
boolean stem = ( ( ID_ORDINAL >> 3 ) & 1 ) == 1;
|
||||
|
||||
if( ID.type.isItem() && stem )
|
||||
if( ID.type.isItem() )
|
||||
{
|
||||
ItemStack it = player.inventory.getCurrentItem();
|
||||
ItemStack it = null;
|
||||
if( stem )
|
||||
{
|
||||
it = player.inventory.getCurrentItem();
|
||||
}
|
||||
else if( x >= 0 && x < player.inventory.mainInventory.length )
|
||||
{
|
||||
it = player.inventory.getStackInSlot( x );
|
||||
}
|
||||
Object myItem = this.getGuiObject( it, player, w, x, y, z );
|
||||
if( myItem != null && ID.CorrectTileOrPart( myItem ) )
|
||||
return this.updateGui( ID.ConstructContainer( player.inventory, side, myItem ), w, x, y, z, side, myItem );
|
||||
}
|
||||
|
||||
if( ID.type.isTile() )
|
||||
{
|
||||
TileEntity TE = w.getTileEntity( x, y, z );
|
||||
@@ -275,7 +281,6 @@ public enum GuiBridge implements IGuiHandler
|
||||
return this.updateGui( ID.ConstructContainer( player.inventory, side, TE ), w, x, y, z, side, TE );
|
||||
}
|
||||
}
|
||||
|
||||
return new ContainerNull();
|
||||
}
|
||||
|
||||
@@ -299,7 +304,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
public boolean CorrectTileOrPart( Object tE )
|
||||
{
|
||||
if( this.Tile == null )
|
||||
throw new RuntimeException( "This Gui Cannot use the standard Handler." );
|
||||
throw new IllegalArgumentException( "This Gui Cannot use the standard Handler." );
|
||||
|
||||
return this.Tile.isInstance( tE );
|
||||
}
|
||||
@@ -332,7 +337,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
throw new RuntimeException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
|
||||
throw new IllegalStateException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
|
||||
}
|
||||
|
||||
Object o = target.newInstance( inventory, tE );
|
||||
@@ -359,7 +364,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,19 +416,24 @@ public enum GuiBridge implements IGuiHandler
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID_ORDINAL & 0x07 );
|
||||
GuiBridge ID = values()[ID_ORDINAL >> 4];
|
||||
boolean stem = ( ( ID_ORDINAL >> 3 ) & 1 ) == 1;
|
||||
|
||||
if( ID.type.isItem() && stem )
|
||||
if( ID.type.isItem() )
|
||||
{
|
||||
ItemStack it = player.inventory.getCurrentItem();
|
||||
ItemStack it = null;
|
||||
if( stem )
|
||||
{
|
||||
it = player.inventory.getCurrentItem();
|
||||
}
|
||||
else if( x >= 0 && x < player.inventory.mainInventory.length )
|
||||
{
|
||||
it = player.inventory.getStackInSlot( x );
|
||||
}
|
||||
Object myItem = this.getGuiObject( it, player, w, x, y, z );
|
||||
if( ID.CorrectTileOrPart( myItem ) )
|
||||
if( myItem != null && ID.CorrectTileOrPart( myItem ) )
|
||||
return ID.ConstructGui( player.inventory, side, myItem );
|
||||
}
|
||||
|
||||
if( ID.type.isTile() )
|
||||
{
|
||||
TileEntity TE = w.getTileEntity( x, y, z );
|
||||
|
||||
if( TE instanceof IPartHost )
|
||||
{
|
||||
( (IPartHost) TE ).getPart( side );
|
||||
@@ -437,7 +447,6 @@ public enum GuiBridge implements IGuiHandler
|
||||
return ID.ConstructGui( player.inventory, side, TE );
|
||||
}
|
||||
}
|
||||
|
||||
return new GuiNull( new ContainerNull() );
|
||||
}
|
||||
|
||||
@@ -453,14 +462,14 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
throw new RuntimeException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
|
||||
throw new IllegalStateException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
|
||||
}
|
||||
|
||||
return target.newInstance( inventory, tE );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ import appeng.util.item.AEItemStack;
|
||||
public class PacketAssemblerAnimation extends AppEngPacket
|
||||
{
|
||||
|
||||
final public int x;
|
||||
final public int y;
|
||||
final public int z;
|
||||
final public byte rate;
|
||||
final public IAEItemStack is;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final byte rate;
|
||||
public final IAEItemStack is;
|
||||
|
||||
// automatic.
|
||||
public PacketAssemblerAnimation( ByteBuf stream ) throws IOException
|
||||
|
||||
@@ -36,10 +36,10 @@ import appeng.services.compass.ICompassCallback;
|
||||
public class PacketCompassRequest extends AppEngPacket implements ICompassCallback
|
||||
{
|
||||
|
||||
final public long attunement;
|
||||
final public int cx;
|
||||
final public int cz;
|
||||
final public int cdy;
|
||||
public final long attunement;
|
||||
public final int cx;
|
||||
public final int cz;
|
||||
public final int cdy;
|
||||
|
||||
EntityPlayer talkBackTo;
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ import appeng.hooks.CompassResult;
|
||||
public class PacketCompassResponse extends AppEngPacket
|
||||
{
|
||||
|
||||
final public long attunement;
|
||||
final public int cx;
|
||||
final public int cz;
|
||||
final public int cdy;
|
||||
public final long attunement;
|
||||
public final int cx;
|
||||
public final int cz;
|
||||
public final int cdy;
|
||||
|
||||
public CompassResult cr;
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public class PacketCompressedNBT extends AppEngPacket
|
||||
// input.
|
||||
final NBTTagCompound in;
|
||||
// output...
|
||||
final private ByteBuf data;
|
||||
final private GZIPOutputStream compressFrame;
|
||||
private final ByteBuf data;
|
||||
private final GZIPOutputStream compressFrame;
|
||||
int writtenBytes = 0;
|
||||
boolean empty = true;
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ import appeng.util.Platform;
|
||||
public class PacketConfigButton extends AppEngPacket
|
||||
{
|
||||
|
||||
final public Settings option;
|
||||
final public boolean rotationDirection;
|
||||
public final Settings option;
|
||||
public final boolean rotationDirection;
|
||||
|
||||
// automatic.
|
||||
public PacketConfigButton( ByteBuf stream )
|
||||
|
||||
@@ -46,8 +46,8 @@ import appeng.util.Platform;
|
||||
public class PacketCraftRequest extends AppEngPacket
|
||||
{
|
||||
|
||||
final public long amount;
|
||||
final public boolean heldShift;
|
||||
public final long amount;
|
||||
public final boolean heldShift;
|
||||
|
||||
// automatic.
|
||||
public PacketCraftRequest( ByteBuf stream )
|
||||
|
||||
@@ -44,10 +44,10 @@ import appeng.util.item.AEItemStack;
|
||||
public class PacketInventoryAction extends AppEngPacket
|
||||
{
|
||||
|
||||
final public InventoryAction action;
|
||||
final public int slot;
|
||||
final public long id;
|
||||
final public IAEItemStack slotItem;
|
||||
public final InventoryAction action;
|
||||
public final int slot;
|
||||
public final long id;
|
||||
public final IAEItemStack slotItem;
|
||||
|
||||
// automatic.
|
||||
public PacketInventoryAction( ByteBuf stream ) throws IOException
|
||||
@@ -67,7 +67,7 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
{
|
||||
|
||||
if( Platform.isClient() )
|
||||
throw new RuntimeException( "invalid packet, client cannot post inv actions with stacks." );
|
||||
throw new IllegalStateException( "invalid packet, client cannot post inv actions with stacks." );
|
||||
|
||||
this.action = action;
|
||||
this.slot = slot;
|
||||
|
||||
@@ -36,9 +36,9 @@ import appeng.core.sync.network.INetworkInfo;
|
||||
public class PacketMockExplosion extends AppEngPacket
|
||||
{
|
||||
|
||||
final public double x;
|
||||
final public double y;
|
||||
final public double z;
|
||||
public final double x;
|
||||
public final double y;
|
||||
public final double z;
|
||||
|
||||
// automatic.
|
||||
public PacketMockExplosion( ByteBuf stream )
|
||||
|
||||
@@ -37,8 +37,11 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -53,6 +56,7 @@ import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
@@ -152,14 +156,14 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
|
||||
for( int x = 0; x < craftMatrix.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack PatternItem = testInv.getStackInSlot( x );
|
||||
ItemStack patternItem = testInv.getStackInSlot( x );
|
||||
|
||||
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
||||
if( currentItem != null )
|
||||
{
|
||||
testInv.setInventorySlotContents( x, currentItem );
|
||||
ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
|
||||
testInv.setInventorySlotContents( x, PatternItem );
|
||||
testInv.setInventorySlotContents( x, patternItem );
|
||||
|
||||
if( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
|
||||
{
|
||||
@@ -178,10 +182,10 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
}
|
||||
|
||||
// True if we need to fetch an item for the recipe
|
||||
if( PatternItem != null && currentItem == null )
|
||||
if( patternItem != null && currentItem == null )
|
||||
{
|
||||
// Grab from network by recipe
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, testInv, PatternItem, x, all, realForFake, filter );
|
||||
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter );
|
||||
|
||||
// If that doesn't get it, grab exact items from network (?)
|
||||
// TODO see if this code is necessary
|
||||
@@ -209,28 +213,7 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
// If that doesn't work, grab from the player's inventory
|
||||
if( whichItem == null && playerInventory != null )
|
||||
{
|
||||
for( int y = 0; y < this.recipe[x].length; y++ )
|
||||
{
|
||||
ItemStack playerItemStack = null;
|
||||
for( int i = 0; i < playerInventory.getSizeInventory(); i++ )
|
||||
{
|
||||
// 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() )
|
||||
{
|
||||
if( realForFake == Actionable.SIMULATE )
|
||||
{
|
||||
whichItem = playerInventory.getStackInSlot( i ).copy();
|
||||
whichItem.stackSize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
whichItem = playerInventory.decrStackSize( i, 1 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
whichItem = extractItemFromPlayerInventory( player, realForFake, patternItem );
|
||||
}
|
||||
|
||||
craftMatrix.setInventorySlotContents( x, whichItem );
|
||||
@@ -243,4 +226,43 @@ public class PacketNEIRecipe extends AppEngPacket
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to extract an item from the player inventory. Does account for fuzzy items.
|
||||
*
|
||||
* @param player the {@link EntityPlayer} to extract from
|
||||
* @param mode the {@link Actionable} to simulate or modulate the operation
|
||||
* @param patternItem which {@link ItemStack} to extract
|
||||
* @return null or a found {@link ItemStack}
|
||||
*/
|
||||
private ItemStack extractItemFromPlayerInventory( EntityPlayer player, Actionable mode, ItemStack patternItem )
|
||||
{
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
||||
final AEItemStack request = AEItemStack.create( patternItem );
|
||||
final boolean isSimulated = mode == Actionable.SIMULATE;
|
||||
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || patternItem.hasTagCompound() || patternItem.isItemStackDamageable();
|
||||
|
||||
if( !checkFuzzy )
|
||||
{
|
||||
if( isSimulated )
|
||||
{
|
||||
return ia.simulateRemove( 1, patternItem, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ia.removeItems( 1, patternItem, null );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isSimulated )
|
||||
{
|
||||
return ia.simulateSimilarRemove( 1, patternItem, FuzzyMode.IGNORE_ALL, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ia.removeSimilarItems( 1, patternItem, FuzzyMode.IGNORE_ALL, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ import appeng.util.item.AEItemStack;
|
||||
public class PacketPatternSlot extends AppEngPacket
|
||||
{
|
||||
|
||||
final public IAEItemStack slotItem;
|
||||
public final IAEItemStack slotItem;
|
||||
|
||||
final public IAEItemStack[] pattern = new IAEItemStack[9];
|
||||
public final IAEItemStack[] pattern = new IAEItemStack[9];
|
||||
|
||||
final public boolean shift;
|
||||
public final boolean shift;
|
||||
|
||||
// automatic.
|
||||
public PacketPatternSlot( ByteBuf stream ) throws IOException
|
||||
|
||||
@@ -45,7 +45,7 @@ import appeng.util.Platform;
|
||||
public class PacketTransitionEffect extends AppEngPacket
|
||||
{
|
||||
|
||||
final public boolean mode;
|
||||
public final boolean mode;
|
||||
final double x;
|
||||
final double y;
|
||||
final double z;
|
||||
|
||||
@@ -59,8 +59,8 @@ import appeng.helpers.IMouseWheelItem;
|
||||
public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
|
||||
final public String Name;
|
||||
final public String Value;
|
||||
public final String Name;
|
||||
public final String Value;
|
||||
|
||||
// automatic.
|
||||
public PacketValueConfig( ByteBuf stream ) throws IOException
|
||||
|
||||
@@ -218,7 +218,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
catch( Throwable t )
|
||||
{
|
||||
this.finish();
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
|
||||
this.finish();
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CraftingLink implements ICraftingLink
|
||||
this.standalone = data.getBoolean( "standalone" );
|
||||
|
||||
if( !data.hasKey( "req" ) || !data.getBoolean( "req" ) )
|
||||
throw new RuntimeException( "Invalid Crafting Link for Object" );
|
||||
throw new IllegalStateException( "Invalid Crafting Link for Object" );
|
||||
|
||||
this.req = req;
|
||||
this.cpu = null;
|
||||
@@ -61,7 +61,7 @@ public class CraftingLink implements ICraftingLink
|
||||
this.standalone = data.getBoolean( "standalone" );
|
||||
|
||||
if( !data.hasKey( "req" ) || data.getBoolean( "req" ) )
|
||||
throw new RuntimeException( "Invalid Crafting Link for Object" );
|
||||
throw new IllegalStateException( "Invalid Crafting Link for Object" );
|
||||
|
||||
this.cpu = cpu;
|
||||
this.req = null;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CraftingTreeProcess
|
||||
final ICraftingPatternDetails details;
|
||||
final CraftingJob job;
|
||||
final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>();
|
||||
final private int depth;
|
||||
private final int depth;
|
||||
public boolean possible = true;
|
||||
World world;
|
||||
long crafts = 0;
|
||||
@@ -264,7 +264,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException( "Crafting Tree construction failed." );
|
||||
throw new IllegalStateException( "Crafting Tree construction failed." );
|
||||
}
|
||||
|
||||
public void setSimulate()
|
||||
|
||||
@@ -40,7 +40,7 @@ import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
{
|
||||
|
||||
int delay = 0;
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
final public class EntityFloatingItem extends EntityItem
|
||||
public final class EntityFloatingItem extends EntityItem
|
||||
{
|
||||
|
||||
public static int ageStatic = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntityGrowingCrystal extends EntityItem
|
||||
public final class EntityGrowingCrystal extends EntityItem
|
||||
{
|
||||
|
||||
private int progress_1000 = 0;
|
||||
|
||||
@@ -44,6 +44,6 @@ public final class EntityIds
|
||||
if( droppedEntity == EntityGrowingCrystal.class )
|
||||
return GROWING_CRYSTAL;
|
||||
|
||||
throw new RuntimeException( "Missing entity id: " + droppedEntity.getName() );
|
||||
throw new IllegalStateException( "Missing entity id: " + droppedEntity.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntitySingularity extends AEBaseEntityItem
|
||||
public final class EntitySingularity extends AEBaseEntityItem
|
||||
{
|
||||
|
||||
static private int randTickSeed = 0;
|
||||
private static int randTickSeed = 0;
|
||||
|
||||
@Reflected
|
||||
public EntitySingularity( World w )
|
||||
|
||||
@@ -44,7 +44,7 @@ import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
|
||||
public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
|
||||
{
|
||||
@Reflected
|
||||
public EntityTinyTNTPrimed( World w )
|
||||
|
||||
@@ -70,7 +70,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
|
||||
public FacadePart( ItemStack facade, ForgeDirection side )
|
||||
{
|
||||
if( facade == null )
|
||||
throw new RuntimeException( "Facade Part constructed on null item." );
|
||||
throw new IllegalArgumentException( "Facade Part constructed on null item." );
|
||||
this.facade = facade.copy();
|
||||
this.facade.stackSize = 1;
|
||||
this.side = side;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
||||
{
|
||||
|
||||
public static final ThreadLocal<Boolean> DISABLE_FACADE_OCCLUSION = new ThreadLocal<Boolean>();
|
||||
private final static Cuboid6[] SIDE_TESTS = new Cuboid6[] {
|
||||
private static final Cuboid6[] SIDE_TESTS = new Cuboid6[] {
|
||||
|
||||
new Cuboid6( 6.0 / 16.0, 0, 6.0 / 16.0, 10.0 / 16.0, 6.0 / 16.0, 10.0 / 16.0 ), // DOWN(0, -1, 0),
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ import appeng.util.Platform;
|
||||
public class FMPPlacementHelper implements IPartHost
|
||||
{
|
||||
|
||||
final private static CableBusStorage NULL_STORAGE = new NullStorage();
|
||||
private static final CableBusStorage NULL_STORAGE = new NullStorage();
|
||||
private boolean hasPart = false;
|
||||
private TileMultipart myMP;
|
||||
private CableBusPart myPart;
|
||||
|
||||
@@ -33,9 +33,9 @@ public enum PartRegistry
|
||||
{
|
||||
QuartzTorchPart( "ae2_torch", BlockQuartzTorch.class, QuartzTorchPart.class ), CableBusPart( "ae2_cablebus", BlockCableBus.class, CableBusPart.class );
|
||||
|
||||
final private String name;
|
||||
final private Class<? extends AEBaseBlock> blk;
|
||||
final private Class<? extends TMultiPart> part;
|
||||
private final String name;
|
||||
private final Class<? extends AEBaseBlock> blk;
|
||||
private final Class<? extends TMultiPart> part;
|
||||
|
||||
PartRegistry( String name, Class<? extends AEBaseBlock> blk, Class<? extends TMultiPart> part )
|
||||
{
|
||||
@@ -54,7 +54,8 @@ public enum PartRegistry
|
||||
return pr.name;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException( "Invalid PartName" );
|
||||
|
||||
throw new IllegalStateException( "Invalid PartName" );
|
||||
}
|
||||
|
||||
public static TMultiPart getPartByBlock( Block block, int meta )
|
||||
@@ -74,13 +75,13 @@ public enum PartRegistry
|
||||
try
|
||||
{
|
||||
if( this == CableBusPart )
|
||||
return (TMultiPart) Api.INSTANCE.getPartHelper().getCombinedInstance( this.part.getName() ).newInstance();
|
||||
return (TMultiPart) Api.INSTANCE.partHelper().getCombinedInstance( this.part.getName() ).newInstance();
|
||||
else
|
||||
return this.part.getConstructor( int.class ).newInstance( meta );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
@@ -100,13 +101,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
|
||||
static final Set<Block> badBlocks = new HashSet<Block>();
|
||||
static private boolean interfaceRequest = false;
|
||||
final int[] sides = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||
final IAEItemStack[] requireWork = new IAEItemStack[] { null, null, null, null, null, null, null, null };
|
||||
final MultiCraftingTracker craftingTracker;
|
||||
final AENetworkProxy gridProxy;
|
||||
final IInterfaceHost iHost;
|
||||
final BaseActionSource mySrc;
|
||||
final BaseActionSource mySource;
|
||||
final BaseActionSource interfaceRequestSource;
|
||||
final ConfigManager cm = new ConfigManager( this );
|
||||
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 8 );
|
||||
final AppEngInternalInventory storage = new AppEngInternalInventory( this, 8 );
|
||||
@@ -133,7 +134,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
this.iHost = ih;
|
||||
this.craftingTracker = new MultiCraftingTracker( this.iHost, 9 );
|
||||
this.mySrc = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost );
|
||||
this.mySource = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost );
|
||||
this.interfaceRequestSource = new InterfaceRequestSource( this.iHost );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -371,7 +373,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return;
|
||||
}
|
||||
}
|
||||
else // Stored != null; dispose!
|
||||
else
|
||||
// Stored != null; dispose!
|
||||
{
|
||||
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
@@ -507,7 +510,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return TickRateModulation.SLEEP;
|
||||
|
||||
if( this.hasItemsToSend() )
|
||||
this.pushItemsOut( EnumSet.allOf( ForgeDirection.class ) );
|
||||
this.pushItemsOut( this.iHost.getTargets() );
|
||||
|
||||
boolean couldDoWork = this.updateStorage();
|
||||
return this.hasWorkToDo() ? ( couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER ) : TickRateModulation.SLEEP;
|
||||
@@ -574,7 +577,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
boolean changed = false;
|
||||
InventoryAdaptor adaptor = this.getAdaptor( x );
|
||||
interfaceRequest = this.isWorking = true;
|
||||
this.isWorking = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -592,13 +595,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
throw new GridAccessException();
|
||||
}
|
||||
|
||||
IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.mySrc );
|
||||
IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
|
||||
if( acquired != null )
|
||||
{
|
||||
changed = true;
|
||||
ItemStack issue = adaptor.addItems( acquired.getItemStack() );
|
||||
if( issue != null )
|
||||
throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
||||
}
|
||||
else
|
||||
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
|
||||
@@ -618,7 +621,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
throw new GridAccessException();
|
||||
}
|
||||
|
||||
toStore = Platform.poweredInsert( src, this.destination, toStore, this.mySrc );
|
||||
toStore = Platform.poweredInsert( src, this.destination, toStore, this.interfaceRequestSource );
|
||||
|
||||
if( toStore != null )
|
||||
diff -= toStore.getStackSize();
|
||||
@@ -629,9 +632,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
changed = true;
|
||||
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
||||
if( removed == null )
|
||||
throw new RuntimeException( "bad attempt at managing inventory. ( removeItems )" );
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" );
|
||||
else if( removed.stackSize != diff )
|
||||
throw new RuntimeException( "bad attempt at managing inventory. ( removeItems )" );
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" );
|
||||
}
|
||||
}
|
||||
// else wtf?
|
||||
@@ -644,7 +647,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if( changed )
|
||||
this.updatePlan( x );
|
||||
|
||||
interfaceRequest = this.isWorking = false;
|
||||
this.isWorking = false;
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -659,7 +662,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null )
|
||||
{
|
||||
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorldObj(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySrc );
|
||||
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorldObj(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
@@ -734,7 +737,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.cancelCrafting();
|
||||
|
||||
this.markDirty();
|
||||
} @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
@@ -825,7 +830,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
ItemStack is = table.getStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
this.addToSendList( ad.addItems( is ) );
|
||||
final ItemStack added = ad.addItems( is );
|
||||
this.addToSendList( added );
|
||||
}
|
||||
}
|
||||
this.pushItemsOut( possibleDirections );
|
||||
@@ -1095,8 +1101,17 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
private class InterfaceRequestSource extends MachineSource
|
||||
{
|
||||
|
||||
class InterfaceInventory extends MEMonitorIInventory
|
||||
public InterfaceRequestSource( IActionHost v )
|
||||
{
|
||||
super( v );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class InterfaceInventory extends MEMonitorIInventory
|
||||
{
|
||||
|
||||
public InterfaceInventory( DualityInterface tileInterface )
|
||||
@@ -1108,7 +1123,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
|
||||
{
|
||||
if( interfaceRequest )
|
||||
if( src instanceof InterfaceRequestSource )
|
||||
return input;
|
||||
|
||||
return super.injectItems( input, type, src );
|
||||
@@ -1117,12 +1132,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public IAEItemStack extractItems( IAEItemStack request, Actionable type, BaseActionSource src )
|
||||
{
|
||||
if( interfaceRequest )
|
||||
if( src instanceof InterfaceRequestSource )
|
||||
return null;
|
||||
|
||||
return super.extractItems( request, type, src );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user