Relocate Source to proper directory.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class AEGlassMaterial extends Material
|
||||
{
|
||||
|
||||
public AEGlassMaterial(MapColor p_i2116_1_) {
|
||||
super( p_i2116_1_ );
|
||||
}
|
||||
|
||||
public boolean isOpaque()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static AEGlassMaterial instance = (new AEGlassMaterial( MapColor.airColor ));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
||||
public interface AEMultiTile extends IGridHost, IPartHost, IColorableTile
|
||||
{
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
|
||||
public interface IContainerCraftingPacket
|
||||
{
|
||||
|
||||
/**
|
||||
* @return gain access to network infrastructure.
|
||||
*/
|
||||
IGridNode getNetworkNode();
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @return the inventory of the part/tile by name.
|
||||
*/
|
||||
IInventory getInventoryByName(String string);
|
||||
|
||||
/**
|
||||
* @return who are we?
|
||||
*/
|
||||
BaseActionSource getSource();
|
||||
|
||||
/**
|
||||
* @return consume items?
|
||||
*/
|
||||
boolean useRealItems();
|
||||
|
||||
/**
|
||||
* @return array of view cells
|
||||
*/
|
||||
ItemStack[] getViewCells();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICustomCollision
|
||||
{
|
||||
|
||||
Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity thePlayer, boolean b);
|
||||
|
||||
void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package appeng.helpers;
|
||||
|
||||
public interface ICustomNameObject
|
||||
{
|
||||
|
||||
String getCustomName();
|
||||
|
||||
boolean hasCustomName();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
|
||||
public interface IInterfaceHost extends IActionHost, ICraftingProvider, IUpgradeableHost, ICraftingRequester
|
||||
{
|
||||
|
||||
DualityInterface getInterfaceDuality();
|
||||
|
||||
EnumSet<ForgeDirection> getTargets();
|
||||
|
||||
TileEntity getTileEntity();
|
||||
|
||||
void saveChanges();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IMouseWheelItem
|
||||
{
|
||||
|
||||
void onWheel(ItemStack is, boolean up);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package appeng.helpers;
|
||||
|
||||
public interface IPriorityHost
|
||||
{
|
||||
|
||||
/**
|
||||
* get current priority.
|
||||
*/
|
||||
int getPriority();
|
||||
|
||||
/**
|
||||
* set new priority
|
||||
*/
|
||||
void setPriority(int newValue);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package appeng.helpers;
|
||||
|
||||
public enum InventoryAction
|
||||
{
|
||||
// standard vanilla mechanics.
|
||||
PICKUP_OR_SETDOWN, SPLIT_OR_PLACESINGLE, CREATIVE_DUPLICATE, SHIFT_CLICK,
|
||||
|
||||
// crafting term
|
||||
CRAFT_STACK, CRAFT_ITEM, CRAFT_SHIFT,
|
||||
|
||||
// extra...
|
||||
MOVE_REGION, PICKUP_SINGLE, UPDATE_HAND, ROLLUP, ROLLDOWN, AUTOCRAFT, PLACE_SINGLE
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
public class LocationRotation implements IOrientable
|
||||
{
|
||||
|
||||
final IBlockAccess w;
|
||||
final int x;
|
||||
final int y;
|
||||
final int z;
|
||||
|
||||
public LocationRotation(IBlockAccess world, int x, int y, int z) {
|
||||
w = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection Forward, ForgeDirection Up)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
{
|
||||
int num = Math.abs( x + y + z ) % 6;
|
||||
return ForgeDirection.getOrientation( num );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForward()
|
||||
{
|
||||
if ( getUp().offsetY == 0 )
|
||||
return ForgeDirection.UP;
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
public class MetaRotation implements IOrientable
|
||||
{
|
||||
|
||||
final IBlockAccess w;
|
||||
final int x;
|
||||
final int y;
|
||||
final int z;
|
||||
|
||||
public MetaRotation(IBlockAccess world, int x, int y, int z) {
|
||||
w = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection Forward, ForgeDirection Up)
|
||||
{
|
||||
if ( w instanceof World )
|
||||
((World) w).setBlockMetadataWithNotify( x, y, z, Up.ordinal(), 1 + 2 );
|
||||
else
|
||||
throw new RuntimeException( w.getClass().getName() + " received, expected World" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
{
|
||||
return ForgeDirection.getOrientation( w.getBlockMetadata( x, y, z ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForward()
|
||||
{
|
||||
if ( getUp().offsetY == 0 )
|
||||
return ForgeDirection.UP;
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,820 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class MeteoritePlacer
|
||||
{
|
||||
|
||||
private class Fallout
|
||||
{
|
||||
|
||||
public int adjustCrator()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void getRandomFall(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, Blocks.stone );
|
||||
else if ( a > 0.8 )
|
||||
put( w, x, y, z, Blocks.cobblestone );
|
||||
else if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.dirt );
|
||||
else if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.gravel );
|
||||
}
|
||||
|
||||
public void getRandomInset(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, Blocks.cobblestone );
|
||||
else if ( a > 0.8 )
|
||||
put( w, x, y, z, Blocks.stone );
|
||||
else if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.grass );
|
||||
else if ( a > 0.6 )
|
||||
put( w, x, y, z, skystone );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Blocks.gravel );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Platform.air );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private class FalloutCopy extends Fallout
|
||||
{
|
||||
|
||||
Block blk;
|
||||
int meta;
|
||||
|
||||
public FalloutCopy(IMeteoriteWorld w, int x, int y, int z) {
|
||||
blk = w.getBlock( x, y, z );
|
||||
meta = w.getBlockMetadata( x, y, z );
|
||||
}
|
||||
|
||||
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void getRandomFall(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, blk, meta );
|
||||
else
|
||||
getOther( w, x, y, z, a );
|
||||
}
|
||||
|
||||
public void getRandomInset(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
double a = Math.random();
|
||||
if ( a > 0.9 )
|
||||
put( w, x, y, z, blk, meta );
|
||||
else if ( a > 0.8 )
|
||||
put( w, x, y, z, Platform.air );
|
||||
else
|
||||
getOther( w, x, y, z, a - 0.1 );
|
||||
}
|
||||
};
|
||||
|
||||
private class FalloutSand extends FalloutCopy
|
||||
{
|
||||
|
||||
public FalloutSand(IMeteoriteWorld w, int x, int y, int z) {
|
||||
super( w, x, y, z );
|
||||
}
|
||||
|
||||
public int adjustCrator()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
|
||||
{
|
||||
if ( a > 0.66 )
|
||||
put( w, x, y, z, Blocks.glass );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private class FalloutSnow extends FalloutCopy
|
||||
{
|
||||
|
||||
public FalloutSnow(IMeteoriteWorld w, int x, int y, int z) {
|
||||
super( w, x, y, z );
|
||||
}
|
||||
|
||||
public int adjustCrator()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
|
||||
{
|
||||
if ( a > 0.7 )
|
||||
put( w, x, y, z, Blocks.snow );
|
||||
else if ( a > 0.5 )
|
||||
put( w, x, y, z, Blocks.ice );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public interface IMeteoriteWorld
|
||||
{
|
||||
|
||||
int minX(int in);
|
||||
|
||||
int minZ(int in);
|
||||
|
||||
int maxX(int in);
|
||||
|
||||
int maxZ(int in);
|
||||
|
||||
boolean hasNoSky();
|
||||
|
||||
int getBlockMetadata(int x, int y, int z);
|
||||
|
||||
Block getBlock(int x, int y, int z);
|
||||
|
||||
boolean canBlockSeeTheSky(int i, int j, int k);
|
||||
|
||||
TileEntity getTileEntity(int x, int y, int z);
|
||||
|
||||
World getWorld();
|
||||
|
||||
void setBlock(int i, int j, int k, Block blk);
|
||||
|
||||
void setBlock(int i, int j, int k, Block blk_b, int meta_b, int l);
|
||||
|
||||
void done();
|
||||
|
||||
};
|
||||
|
||||
static public class StandardWorld implements IMeteoriteWorld
|
||||
{
|
||||
|
||||
protected World w;
|
||||
|
||||
public StandardWorld(World w) {
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNoSky()
|
||||
{
|
||||
return !w.provider.hasNoSky;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.getBlockMetadata( x, y, z );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.getBlock( x, y, z );
|
||||
return Platform.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.canBlockSeeTheSky( x, y, z );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return w.getTileEntity( x, y, z );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
w.setBlock( x, y, z, blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk, int metadata, int flags)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
w.setBlock( x, y, z, blk, metadata, flags );
|
||||
}
|
||||
|
||||
public boolean range(int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minX(int in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minZ(int in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxX(int in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxZ(int in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static public class ChunkOnly extends StandardWorld
|
||||
{
|
||||
|
||||
Chunk target;
|
||||
|
||||
int verticalBits = 0;
|
||||
|
||||
final int cx, cz;
|
||||
|
||||
public ChunkOnly(World w, int cx, int cz) {
|
||||
super( w );
|
||||
target = w.getChunkFromChunkCoords( cx, cz );
|
||||
this.cx = cx;
|
||||
this.cz = cz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done()
|
||||
{
|
||||
if ( verticalBits != 0 )
|
||||
Platform.sendChunk( target, verticalBits );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
{
|
||||
verticalBits |= 1 << (y >> 4);
|
||||
w.setBlock( x, y, z, blk, 0, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block blk, int metadata, int flags)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
{
|
||||
verticalBits |= 1 << (y >> 4);
|
||||
w.setBlock( x, y, z, blk, metadata, flags & (~2) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return target.getBlock( x & 0xF, y, z & 0xF );
|
||||
return Platform.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z)
|
||||
{
|
||||
if ( range( x, y, z ) )
|
||||
return target.getBlockMetadata( x & 0xF, y, z & 0xF );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean range(int x, int y, int z)
|
||||
{
|
||||
return cx == (x >> 4) && cz == (z >> 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minX(int in)
|
||||
{
|
||||
return Math.max( in, cx << 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minZ(int in)
|
||||
{
|
||||
return Math.max( in, cz << 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxX(int in)
|
||||
{
|
||||
return Math.min( in, (cx + 1) << 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxZ(int in)
|
||||
{
|
||||
return Math.min( in, (cz + 1) << 4 );
|
||||
}
|
||||
};
|
||||
|
||||
int minBLocks = 200;
|
||||
HashSet<Block> validSpawn = new HashSet();
|
||||
HashSet<Block> invalidSpawn = new HashSet();
|
||||
|
||||
Fallout type = new Fallout();
|
||||
|
||||
Block skystone = AEApi.instance().blocks().blockSkyStone.block();
|
||||
Block skychest;
|
||||
|
||||
double real_sizeOfMeteorite = (Math.random() * 6.0) + 2;
|
||||
double real_crator = real_sizeOfMeteorite * 2 + 5;
|
||||
|
||||
double sizeOfMeteorite = real_sizeOfMeteorite * real_sizeOfMeteorite;
|
||||
double crator = real_crator * real_crator;
|
||||
|
||||
public MeteoritePlacer() {
|
||||
|
||||
if ( AEApi.instance().blocks().blockSkyChest.block() == null )
|
||||
skychest = Blocks.chest;
|
||||
else
|
||||
skychest = AEApi.instance().blocks().blockSkyChest.block();
|
||||
|
||||
validSpawn.add( Blocks.stone );
|
||||
validSpawn.add( Blocks.cobblestone );
|
||||
validSpawn.add( Blocks.grass );
|
||||
validSpawn.add( Blocks.sand );
|
||||
validSpawn.add( Blocks.dirt );
|
||||
validSpawn.add( Blocks.gravel );
|
||||
validSpawn.add( Blocks.netherrack );
|
||||
validSpawn.add( Blocks.iron_ore );
|
||||
validSpawn.add( Blocks.gold_ore );
|
||||
validSpawn.add( Blocks.diamond_ore );
|
||||
validSpawn.add( Blocks.redstone_ore );
|
||||
validSpawn.add( Blocks.hardened_clay );
|
||||
validSpawn.add( Blocks.ice );
|
||||
validSpawn.add( Blocks.snow );
|
||||
|
||||
invalidSpawn.add( skystone );
|
||||
invalidSpawn.add( Blocks.planks );
|
||||
invalidSpawn.add( Blocks.iron_door );
|
||||
invalidSpawn.add( Blocks.iron_bars );
|
||||
invalidSpawn.add( Blocks.wooden_door );
|
||||
invalidSpawn.add( Blocks.brick_block );
|
||||
invalidSpawn.add( Blocks.clay );
|
||||
invalidSpawn.add( Blocks.water );
|
||||
invalidSpawn.add( Blocks.log );
|
||||
invalidSpawn.add( Blocks.log2 );
|
||||
}
|
||||
|
||||
NBTTagCompound settings;
|
||||
|
||||
public boolean spawnMeteorite(IMeteoriteWorld w, NBTTagCompound meteoriteBlob)
|
||||
{
|
||||
settings = meteoriteBlob;
|
||||
|
||||
int x = settings.getInteger( "x" );
|
||||
int y = settings.getInteger( "y" );
|
||||
int z = settings.getInteger( "z" );
|
||||
|
||||
real_sizeOfMeteorite = settings.getDouble( "real_sizeOfMeteorite" );
|
||||
real_crator = settings.getDouble( "real_crator" );
|
||||
sizeOfMeteorite = settings.getDouble( "sizeOfMeteorite" );
|
||||
crator = settings.getDouble( "crator" );
|
||||
|
||||
Block blk = Block.getBlockById( settings.getInteger( "blk" ) );
|
||||
|
||||
if ( blk == Blocks.sand )
|
||||
type = new FalloutSand( w, x, y, z );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
type = new FalloutCopy( w, x, y, z );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
type = new FalloutSnow( w, x, y, z );
|
||||
|
||||
int skyMode = settings.getInteger( "skyMode" );
|
||||
|
||||
// creator
|
||||
if ( skyMode > 10 )
|
||||
placeCrator( w, x, y, z );
|
||||
|
||||
placeMeteorite( w, x, y, z );
|
||||
|
||||
// collapse blocks...
|
||||
if ( skyMode > 3 )
|
||||
Decay( w, x, y, z );
|
||||
|
||||
w.done();
|
||||
return true;
|
||||
}
|
||||
|
||||
public double getSqDistance(int x, int z)
|
||||
{
|
||||
int Cx = settings.getInteger( "x" ) - x;
|
||||
int Cz = settings.getInteger( "z" ) - z;
|
||||
|
||||
return Cx * Cx + Cz * Cz;
|
||||
}
|
||||
|
||||
public boolean spawnMeteorite(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
int validBlocks = 0;
|
||||
|
||||
if ( !w.hasNoSky() )
|
||||
return false;
|
||||
|
||||
Block blk = w.getBlock( x, y, z );
|
||||
if ( !validSpawn.contains( blk ) )
|
||||
return false; // must spawn on a valid block..
|
||||
|
||||
settings = new NBTTagCompound();
|
||||
settings.setInteger( "x", x );
|
||||
settings.setInteger( "y", y );
|
||||
settings.setInteger( "z", z );
|
||||
settings.setInteger( "blk", Block.getIdFromBlock( blk ) );
|
||||
|
||||
settings.setDouble( "real_sizeOfMeteorite", real_sizeOfMeteorite );
|
||||
settings.setDouble( "real_crator", real_crator );
|
||||
settings.setDouble( "sizeOfMeteorite", sizeOfMeteorite );
|
||||
settings.setDouble( "crator", crator );
|
||||
|
||||
settings.setBoolean( "lava", Math.random() > 0.9 );
|
||||
|
||||
if ( blk == Blocks.sand )
|
||||
type = new FalloutSand( w, x, y, z );
|
||||
else if ( blk == Blocks.hardened_clay )
|
||||
type = new FalloutCopy( w, x, y, z );
|
||||
else if ( blk == Blocks.ice || blk == Blocks.snow )
|
||||
type = new FalloutSnow( w, x, y, z );
|
||||
|
||||
int realValidBlocks = 0;
|
||||
|
||||
for (int i = x - 6; i < x + 6; i++)
|
||||
for (int j = y - 6; j < y + 6; j++)
|
||||
for (int k = z - 6; k < z + 6; k++)
|
||||
{
|
||||
blk = w.getBlock( i, j, k );
|
||||
if ( validSpawn.contains( blk ) )
|
||||
realValidBlocks++;
|
||||
}
|
||||
|
||||
for (int i = x - 15; i < x + 15; i++)
|
||||
for (int j = y - 15; j < y + 15; j++)
|
||||
for (int k = z - 15; k < z + 15; k++)
|
||||
{
|
||||
blk = w.getBlock( i, j, k );
|
||||
if ( invalidSpawn.contains( blk ) )
|
||||
return false;
|
||||
if ( validSpawn.contains( blk ) )
|
||||
validBlocks++;
|
||||
}
|
||||
|
||||
if ( validBlocks > minBLocks && realValidBlocks > 80 )
|
||||
{
|
||||
// we can spawn here!
|
||||
|
||||
int skyMode = 0;
|
||||
|
||||
for (int i = x - 15; i < x + 15; i++)
|
||||
for (int j = y - 15; j < y + 11; j++)
|
||||
for (int k = z - 15; k < z + 15; k++)
|
||||
{
|
||||
if ( w.canBlockSeeTheSky( i, j, k ) )
|
||||
skyMode++;
|
||||
}
|
||||
|
||||
boolean solid = true;
|
||||
for (int j = y - 15; j < y - 1; j++)
|
||||
{
|
||||
if ( w.getBlock( x, j, z ) == Platform.air )
|
||||
solid = false;
|
||||
}
|
||||
|
||||
if ( !solid )
|
||||
skyMode = 0;
|
||||
|
||||
// creator
|
||||
if ( skyMode > 10 )
|
||||
placeCrator( w, x, y, z );
|
||||
|
||||
placeMeteorite( w, x, y, z );
|
||||
|
||||
// collapse blocks...
|
||||
if ( skyMode > 3 )
|
||||
Decay( w, x, y, z );
|
||||
|
||||
settings.setInteger( "skyMode", skyMode );
|
||||
w.done();
|
||||
|
||||
WorldSettings.getInstance().addNearByMeteorites( w.getWorld().provider.dimensionId, x >> 4, z >> 4, settings );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void placeCrator(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
boolean lava = settings.getBoolean( "lava" );
|
||||
|
||||
int maxY = 255;
|
||||
int minX = w.minX( x - 200 );
|
||||
int maxX = w.maxX( x + 200 );
|
||||
int minZ = w.minZ( z - 200 );
|
||||
int maxZ = w.maxZ( z + 200 );
|
||||
|
||||
for (int j = y - 5; j < maxY; j++)
|
||||
{
|
||||
boolean changed = false;
|
||||
|
||||
for (int i = minX; i < maxX; i++)
|
||||
for (int k = minZ; k < maxZ; k++)
|
||||
{
|
||||
double dx = i - x;
|
||||
double dz = k - z;
|
||||
double h = y - real_sizeOfMeteorite + 1 + type.adjustCrator();
|
||||
|
||||
double distanceFrom = dx * dx + dz * dz;
|
||||
|
||||
if ( j > h + distanceFrom * 0.02 )
|
||||
{
|
||||
if ( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), i, j, k, 0 ) )
|
||||
{
|
||||
if ( j > h + distanceFrom * 0.02 )
|
||||
put( w, i, j, k, Blocks.lava );
|
||||
}
|
||||
else
|
||||
changed = put( w, i, j, k, Platform.air ) || changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class,
|
||||
AxisAlignedBB.getBoundingBox( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ))
|
||||
{
|
||||
Entity e = (Entity) o;
|
||||
e.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
private void placeMeteorite(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
int Xmeteor_l = w.minX( x - 8 );
|
||||
int Xmeteor_h = w.maxX( x + 8 );
|
||||
int Zmeteor_l = w.minZ( z - 8 );
|
||||
int Zmeteor_h = w.maxZ( z + 8 );
|
||||
|
||||
// spawn metor
|
||||
for (int i = Xmeteor_l; i < Xmeteor_h; i++)
|
||||
for (int j = y - 8; j < y + 8; j++)
|
||||
for (int k = Zmeteor_l; k < Zmeteor_h; k++)
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
|
||||
if ( dx * dx * 0.7 + dy * dy * (j > y ? 1.4 : 0.8) + dz * dz * 0.7 < sizeOfMeteorite )
|
||||
put( w, i, j, k, skystone );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.SpawnPressesInMeteorites ) )
|
||||
{
|
||||
put( w, x, y, z, skychest );
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( te != null && te instanceof IInventory )
|
||||
{
|
||||
InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, ForgeDirection.UP );
|
||||
|
||||
int primary = Math.max( 1, (int) (Math.random() * 4) );
|
||||
|
||||
if ( primary > 3 ) // in case math breaks...
|
||||
primary = 3;
|
||||
|
||||
for (int zz = 0; zz < primary; zz++)
|
||||
{
|
||||
int r = 0;
|
||||
boolean duplicate = false;
|
||||
|
||||
do
|
||||
{
|
||||
duplicate = false;
|
||||
|
||||
if ( Math.random() > 0.7 )
|
||||
r = WorldSettings.getInstance().getNextOrderedValue( "presses" );
|
||||
else
|
||||
r = (int) (Math.random() * 1000);
|
||||
|
||||
ItemStack toAdd = null;
|
||||
|
||||
switch (r % 4)
|
||||
{
|
||||
case 0:
|
||||
toAdd = AEApi.instance().materials().materialCalcProcessorPress.stack( 1 );
|
||||
break;
|
||||
case 1:
|
||||
toAdd = AEApi.instance().materials().materialEngProcessorPress.stack( 1 );
|
||||
break;
|
||||
case 2:
|
||||
toAdd = AEApi.instance().materials().materialLogicProcessorPress.stack( 1 );
|
||||
break;
|
||||
case 3:
|
||||
toAdd = AEApi.instance().materials().materialSiliconPress.stack( 1 );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if ( toAdd != null )
|
||||
{
|
||||
if ( ap.simulateRemove( 1, toAdd, null ) == null )
|
||||
ap.addItems( toAdd );
|
||||
else
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
while (duplicate);
|
||||
}
|
||||
|
||||
int secondary = Math.max( 1, (int) (Math.random() * 3) );
|
||||
for (int zz = 0; zz < secondary; zz++)
|
||||
{
|
||||
switch ((int) (Math.random() * 1000) % 3)
|
||||
{
|
||||
case 0:
|
||||
ap.addItems( AEApi.instance().blocks().blockSkyStone.stack( (int) (Math.random() * 12) + 1 ) );
|
||||
break;
|
||||
case 1:
|
||||
List<ItemStack> possibles = new LinkedList();
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetIron" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetCopper" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetTin" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetSilver" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetLead" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetPlatinum" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetNickel" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetAluminium" ) );
|
||||
possibles.addAll( OreDictionary.getOres( "nuggetElectrum" ) );
|
||||
possibles.add( new ItemStack( net.minecraft.init.Items.gold_nugget ) );
|
||||
|
||||
ItemStack nugget = Platform.pickRandom( possibles );
|
||||
if ( nugget != null )
|
||||
{
|
||||
nugget = nugget.copy();
|
||||
nugget.stackSize = (int) (Math.random() * 12) + 1;
|
||||
ap.addItems( nugget );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Decay(IMeteoriteWorld w, int x, int y, int z)
|
||||
{
|
||||
double randomShit = 0;
|
||||
|
||||
int Xmeteor_l = w.minX( x - 30 );
|
||||
int Xmeteor_h = w.maxX( x + 30 );
|
||||
int Zmeteor_l = w.minZ( z - 30 );
|
||||
int Zmeteor_h = w.maxZ( z + 30 );
|
||||
|
||||
for (int i = Xmeteor_l; i < Xmeteor_h; i++)
|
||||
for (int k = Zmeteor_l; k < Zmeteor_h; k++)
|
||||
for (int j = y - 9; j < y + 30; j++)
|
||||
{
|
||||
Block blk = w.getBlock( i, j, k );
|
||||
if ( blk == Blocks.lava )
|
||||
continue;
|
||||
|
||||
if ( blk.isReplaceable( w.getWorld(), i, j, k ) )
|
||||
{
|
||||
blk = Platform.air;
|
||||
Block blk_b = w.getBlock( i, j + 1, k );
|
||||
|
||||
if ( blk_b != blk )
|
||||
{
|
||||
int meta_b = w.getBlockMetadata( i, j + 1, k );
|
||||
|
||||
w.setBlock( i, j, k, blk_b, meta_b, 3 );
|
||||
w.setBlock( i, j + 1, k, blk );
|
||||
}
|
||||
else if ( randomShit < 100 * crator )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
double dist = dx * dx + dy * dy + dz * dz;
|
||||
|
||||
Block xf = w.getBlock( i, j - 1, k );
|
||||
if ( !xf.isReplaceable( w.getWorld(), i, j - 1, k ) )
|
||||
{
|
||||
double extrRange = Math.random() * 0.6;
|
||||
double height = crator * (extrRange + 0.2) - Math.abs( dist - crator * 1.7 );
|
||||
|
||||
if ( xf != blk && height > 0 && Math.random() > 0.6 )
|
||||
{
|
||||
randomShit++;
|
||||
type.getRandomFall( w, i, j, k );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// decay.
|
||||
Block blk_b = w.getBlock( i, j + 1, k );
|
||||
if ( blk_b == Platform.air )
|
||||
{
|
||||
if ( Math.random() > 0.4 )
|
||||
{
|
||||
double dx = i - x;
|
||||
double dy = j - y;
|
||||
double dz = k - z;
|
||||
|
||||
if ( dx * dx + dy * dy + dz * dz < crator * 1.6 )
|
||||
{
|
||||
type.getRandomInset( w, i, j, k );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean put(IMeteoriteWorld w, int i, int j, int k, Block blk)
|
||||
{
|
||||
Block original = w.getBlock( i, j, k );
|
||||
|
||||
if ( original == Blocks.bedrock || original == blk )
|
||||
return false;
|
||||
|
||||
w.setBlock( i, j, k, blk );
|
||||
return true;
|
||||
}
|
||||
|
||||
private void put(IMeteoriteWorld w, int i, int j, int k, Block blk, int meta)
|
||||
{
|
||||
if ( w.getBlock( i, j, k ) == Blocks.bedrock )
|
||||
return;
|
||||
|
||||
w.setBlock( i, j, k, blk, meta, 3 );
|
||||
}
|
||||
|
||||
public NBTTagCompound getSettings()
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.NonNullArrayIterator;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
public class MultiCraftingTracker
|
||||
{
|
||||
|
||||
final int size;
|
||||
final ICraftingRequester owner;
|
||||
|
||||
Future<ICraftingJob>[] jobs = null;
|
||||
ICraftingLink[] links = null;
|
||||
|
||||
public MultiCraftingTracker(ICraftingRequester o, int size) {
|
||||
owner = o;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound extra)
|
||||
{
|
||||
for (int x = 0; x < size; x++)
|
||||
{
|
||||
NBTTagCompound link = extra.getCompoundTag( "links-" + x );
|
||||
if ( link != null && !link.hasNoTags() )
|
||||
setLink( x, AEApi.instance().storage().loadCraftingLink( link, owner ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound extra)
|
||||
{
|
||||
for (int x = 0; x < size; x++)
|
||||
{
|
||||
ICraftingLink link = getLink( x );
|
||||
if ( link != null )
|
||||
{
|
||||
NBTTagCompound ln = new NBTTagCompound();
|
||||
link.writeToNBT( ln );
|
||||
extra.setTag( "links-" + x, ln );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleCrafting(int x, long itemToCraft, IAEItemStack ais, InventoryAdaptor d, World w, IGrid g, ICraftingGrid cg, BaseActionSource mySrc)
|
||||
throws GridAccessException
|
||||
{
|
||||
if ( ais != null && d.simulateAdd( ais.getItemStack() ) == null )
|
||||
{
|
||||
Future<ICraftingJob> cjob = getJob( x );
|
||||
if ( getLink( x ) != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ( cjob != null )
|
||||
{
|
||||
ICraftingJob job = null;
|
||||
try
|
||||
{
|
||||
if ( cjob.isDone() )
|
||||
job = cjob.get();
|
||||
else if ( cjob.isCancelled() )
|
||||
job = null;
|
||||
|
||||
if ( job != null )
|
||||
{
|
||||
setJob( x, null );
|
||||
setLink( x, cg.submitJob( job, owner, null, false, mySrc ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( getLink( x ) == null )
|
||||
{
|
||||
IAEItemStack aisC = ais.copy();
|
||||
aisC.setStackSize( itemToCraft );
|
||||
setJob( x, cg.beginCraftingJob( w, g, mySrc, aisC, null ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ICraftingLink getLink(int slot)
|
||||
{
|
||||
if ( links == null )
|
||||
return null;
|
||||
|
||||
return links[slot];
|
||||
}
|
||||
|
||||
void setLink(int slot, ICraftingLink l)
|
||||
{
|
||||
if ( links == null )
|
||||
links = new ICraftingLink[size];
|
||||
|
||||
links[slot] = l;
|
||||
|
||||
boolean hasStuff = false;
|
||||
for (int x = 0; x < links.length; x++)
|
||||
{
|
||||
ICraftingLink g = links[x];
|
||||
|
||||
if ( g == null || g.isCanceled() || g.isDone() )
|
||||
links[x] = null;
|
||||
else
|
||||
hasStuff = true;
|
||||
}
|
||||
|
||||
if ( hasStuff == false )
|
||||
links = null;
|
||||
}
|
||||
|
||||
Future<ICraftingJob> getJob(int slot)
|
||||
{
|
||||
if ( jobs == null )
|
||||
return null;
|
||||
|
||||
return jobs[slot];
|
||||
}
|
||||
|
||||
void setJob(int slot, Future<ICraftingJob> l)
|
||||
{
|
||||
if ( jobs == null )
|
||||
jobs = new Future[size];
|
||||
|
||||
jobs[slot] = l;
|
||||
|
||||
boolean hasStuff = false;
|
||||
for (int x = 0; x < jobs.length; x++)
|
||||
{
|
||||
if ( jobs[x] != null )
|
||||
hasStuff = true;
|
||||
}
|
||||
|
||||
if ( hasStuff == false )
|
||||
jobs = null;
|
||||
}
|
||||
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
if ( links == null )
|
||||
return ImmutableSet.of();
|
||||
|
||||
return ImmutableSet.copyOf( new NonNullArrayIterator( links ) );
|
||||
}
|
||||
|
||||
public void jobStateChange(ICraftingLink link)
|
||||
{
|
||||
if ( links != null )
|
||||
{
|
||||
for (int x = 0; x < links.length; x++)
|
||||
{
|
||||
if ( links[x] == link )
|
||||
{
|
||||
setLink( x, null );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getSlot(ICraftingLink link)
|
||||
{
|
||||
if ( links != null )
|
||||
{
|
||||
for (int x = 0; x < links.length; x++)
|
||||
{
|
||||
if ( links[x] == link )
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void cancel()
|
||||
{
|
||||
if ( links != null )
|
||||
{
|
||||
for (ICraftingLink l : links)
|
||||
{
|
||||
if ( l != null )
|
||||
l.cancel();
|
||||
}
|
||||
|
||||
links = null;
|
||||
}
|
||||
|
||||
if ( jobs != null )
|
||||
{
|
||||
for (Future<ICraftingJob> l : jobs)
|
||||
{
|
||||
if ( l != null )
|
||||
l.cancel( true );
|
||||
}
|
||||
|
||||
jobs = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBusy(int slot)
|
||||
{
|
||||
return getLink( slot ) != null || getJob( slot ) != null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
public class NullRotation implements IOrientable
|
||||
{
|
||||
|
||||
public NullRotation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(ForgeDirection Forward, ForgeDirection Up)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
{
|
||||
return ForgeDirection.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForward()
|
||||
{
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.util.ItemSorters;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class PatternHelper implements ICraftingPatternDetails, Comparable<PatternHelper>
|
||||
{
|
||||
|
||||
final ItemStack patternItem;
|
||||
private IAEItemStack aepattern;
|
||||
|
||||
final InventoryCrafting crafting = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
final InventoryCrafting testFrame = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
|
||||
final ItemStack correctOutput;
|
||||
final IRecipe standardRecipe;
|
||||
|
||||
final IAEItemStack condensedInputs[];
|
||||
final IAEItemStack condensedOutputs[];
|
||||
final IAEItemStack inputs[];
|
||||
final IAEItemStack outputs[];
|
||||
|
||||
final boolean isCrafting;
|
||||
public int priority = 0;
|
||||
|
||||
class TestLookup
|
||||
{
|
||||
|
||||
final int slot;
|
||||
final int ref;
|
||||
final int hash;
|
||||
|
||||
public TestLookup(int slot, ItemStack i) {
|
||||
this( slot, i.getItem(), i.getItemDamage() );
|
||||
}
|
||||
|
||||
public TestLookup(int slot, Item item, int dmg) {
|
||||
this.slot = slot;
|
||||
ref = (dmg << Platform.DEF_OFFSET) | (Item.getIdFromItem( item ) & 0xffff);
|
||||
int offset = 3 * slot;
|
||||
hash = (ref << offset) | (ref >> (offset + 32));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
TestLookup b = (TestLookup) obj;
|
||||
return b.slot == slot && b.ref == ref;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
enum TestStatus
|
||||
{
|
||||
ACCEPT, DECLINE, TEST
|
||||
};
|
||||
|
||||
HashSet<TestLookup> failCache = new HashSet();
|
||||
HashSet<TestLookup> passCache = new HashSet();
|
||||
|
||||
private void markItemAs(int slotIndex, ItemStack i, TestStatus b)
|
||||
{
|
||||
if ( b == TestStatus.TEST || i.hasTagCompound() )
|
||||
return;
|
||||
|
||||
(b == TestStatus.ACCEPT ? passCache : failCache).add( new TestLookup( slotIndex, i ) );
|
||||
}
|
||||
|
||||
private TestStatus getStatus(int slotIndex, ItemStack i)
|
||||
{
|
||||
if ( crafting.getStackInSlot( slotIndex ) == null )
|
||||
return i == null ? TestStatus.ACCEPT : TestStatus.DECLINE;
|
||||
|
||||
if ( i == null )
|
||||
return TestStatus.DECLINE;
|
||||
|
||||
if ( i.hasTagCompound() )
|
||||
return TestStatus.TEST;
|
||||
|
||||
if ( passCache.contains( new TestLookup( slotIndex, i ) ) )
|
||||
return TestStatus.ACCEPT;
|
||||
|
||||
if ( failCache.contains( new TestLookup( slotIndex, i ) ) )
|
||||
return TestStatus.DECLINE;
|
||||
|
||||
return TestStatus.TEST;
|
||||
}
|
||||
|
||||
public PatternHelper(ItemStack is, World w) {
|
||||
NBTTagCompound encodedValue = is.getTagCompound();
|
||||
|
||||
if ( encodedValue == null )
|
||||
throw new RuntimeException( "No pattern here!" );
|
||||
|
||||
NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
patternItem = is;
|
||||
aepattern = AEItemStack.create( is );
|
||||
|
||||
List<IAEItemStack> in = new ArrayList();
|
||||
List<IAEItemStack> out = new ArrayList();
|
||||
|
||||
for (int x = 0; x < inTag.tagCount(); x++)
|
||||
{
|
||||
ItemStack gs = ItemStack.loadItemStackFromNBT( inTag.getCompoundTagAt( x ) );
|
||||
crafting.setInventorySlotContents( x, gs );
|
||||
|
||||
if ( gs != null && (!isCrafting || !gs.hasTagCompound()) )
|
||||
{
|
||||
markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
}
|
||||
|
||||
in.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
testFrame.setInventorySlotContents( x, gs );
|
||||
}
|
||||
|
||||
if ( isCrafting )
|
||||
{
|
||||
standardRecipe = Platform.findMatchingRecipe( crafting, w );
|
||||
if ( standardRecipe != null )
|
||||
{
|
||||
correctOutput = standardRecipe.getCraftingResult( crafting );
|
||||
out.add( AEApi.instance().storage().createItemStack( correctOutput ) );
|
||||
}
|
||||
else
|
||||
throw new RuntimeException( "No pattern here!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
standardRecipe = null;
|
||||
correctOutput = null;
|
||||
|
||||
for (int x = 0; x < outTag.tagCount(); x++)
|
||||
{
|
||||
ItemStack gs = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( x ) );
|
||||
if ( gs != null )
|
||||
out.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
}
|
||||
}
|
||||
|
||||
outputs = out.toArray( new IAEItemStack[out.size()] );
|
||||
inputs = in.toArray( new IAEItemStack[in.size()] );
|
||||
|
||||
HashMap<IAEItemStack, IAEItemStack> tmpOutputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for (IAEItemStack io : outputs)
|
||||
{
|
||||
if ( io == null )
|
||||
continue;
|
||||
|
||||
IAEItemStack g = tmpOutputs.get( io );
|
||||
if ( g == null )
|
||||
tmpOutputs.put( io, io.copy() );
|
||||
else
|
||||
g.add( io );
|
||||
}
|
||||
|
||||
HashMap<IAEItemStack, IAEItemStack> tmpInputs = new HashMap<IAEItemStack, IAEItemStack>();
|
||||
for (IAEItemStack io : inputs)
|
||||
{
|
||||
if ( io == null )
|
||||
continue;
|
||||
|
||||
IAEItemStack g = tmpInputs.get( io );
|
||||
if ( g == null )
|
||||
tmpInputs.put( io, io.copy() );
|
||||
else
|
||||
g.add( io );
|
||||
}
|
||||
|
||||
if ( tmpOutputs.isEmpty() || tmpInputs.isEmpty() )
|
||||
throw new RuntimeException( "No pattern here!" );
|
||||
|
||||
int offset = 0;
|
||||
condensedInputs = new IAEItemStack[tmpInputs.size()];
|
||||
for (IAEItemStack io : tmpInputs.values())
|
||||
condensedInputs[offset++] = io;
|
||||
|
||||
offset = 0;
|
||||
condensedOutputs = new IAEItemStack[tmpOutputs.size()];
|
||||
for (IAEItemStack io : tmpOutputs.values())
|
||||
condensedOutputs[offset++] = io;
|
||||
}
|
||||
|
||||
synchronized public boolean isValidItemForSlot(int slotIndex, ItemStack i, World w)
|
||||
{
|
||||
if ( isCrafting == false )
|
||||
{
|
||||
throw new RuntimeException( "Only crafting recipes supported." );
|
||||
}
|
||||
|
||||
TestStatus result = getStatus( slotIndex, i );
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case ACCEPT:
|
||||
return true;
|
||||
case DECLINE:
|
||||
return false;
|
||||
case TEST:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !isCrafting )
|
||||
return false;
|
||||
|
||||
for (int x = 0; x < crafting.getSizeInventory(); x++)
|
||||
testFrame.setInventorySlotContents( x, crafting.getStackInSlot( x ) );
|
||||
|
||||
testFrame.setInventorySlotContents( slotIndex, i );
|
||||
|
||||
if ( standardRecipe.matches( testFrame, w ) )
|
||||
{
|
||||
ItemStack testOutput = standardRecipe.getCraftingResult( testFrame );
|
||||
|
||||
if ( Platform.isSameItemPrecise( correctOutput, testOutput ) )
|
||||
{
|
||||
testFrame.setInventorySlotContents( slotIndex, crafting.getStackInSlot( slotIndex ) );
|
||||
markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( testFrame, w );
|
||||
|
||||
if ( Platform.isSameItemPrecise( correctOutput, testOutput ) )
|
||||
{
|
||||
testFrame.setInventorySlotContents( slotIndex, crafting.getStackInSlot( slotIndex ) );
|
||||
markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
markItemAs( slotIndex, i, TestStatus.DECLINE );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput(InventoryCrafting craftingInv, World w)
|
||||
{
|
||||
if ( isCrafting == false )
|
||||
throw new RuntimeException( "Only crafting recipes supported." );
|
||||
|
||||
for (int x = 0; x < craftingInv.getSizeInventory(); x++)
|
||||
{
|
||||
if ( !isValidItemForSlot( x, craftingInv.getStackInSlot( x ), w ) )
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( outputs != null && outputs.length > 0 )
|
||||
return outputs[0].getItemStack();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSubstitute()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCraftable()
|
||||
{
|
||||
return isCrafting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getInputs()
|
||||
{
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getOutputs()
|
||||
{
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPattern()
|
||||
{
|
||||
return patternItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getCondensedInputs()
|
||||
{
|
||||
return condensedInputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack[] getCondensedOutputs()
|
||||
{
|
||||
return condensedOutputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PatternHelper o)
|
||||
{
|
||||
return ItemSorters.compareInt( o.priority, priority );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return aepattern.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return aepattern.equals( ((PatternHelper) obj).aepattern );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority(int priority)
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.security.ISecurityRegistry;
|
||||
|
||||
public class PlayerSecurityWrapper implements ISecurityRegistry
|
||||
{
|
||||
|
||||
final HashMap<Integer, EnumSet<SecurityPermissions>> target;
|
||||
|
||||
public PlayerSecurityWrapper(HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms) {
|
||||
target = playerPerms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPlayer(int PlayerID, EnumSet<SecurityPermissions> permissions)
|
||||
{
|
||||
target.put( PlayerID, permissions );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
public class Splot
|
||||
{
|
||||
|
||||
public Splot(AEColor col, boolean lit, ForgeDirection side, Vec3 Pos) {
|
||||
color = col;
|
||||
lumen = lit;
|
||||
|
||||
double x, y;
|
||||
|
||||
if ( side == ForgeDirection.SOUTH || side == ForgeDirection.NORTH )
|
||||
{
|
||||
x = Pos.xCoord;
|
||||
y = Pos.yCoord;
|
||||
}
|
||||
|
||||
else if ( side == ForgeDirection.UP || side == ForgeDirection.DOWN )
|
||||
{
|
||||
x = Pos.xCoord;
|
||||
y = Pos.zCoord;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
x = Pos.yCoord;
|
||||
y = Pos.zCoord;
|
||||
}
|
||||
|
||||
int a = (int) (x * 0xF);
|
||||
int b = (int) (y * 0xF);
|
||||
this.pos = a | (b << 4);
|
||||
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
public Splot(ByteBuf data) {
|
||||
|
||||
pos = data.readByte();
|
||||
int val = data.readByte();
|
||||
|
||||
side = ForgeDirection.getOrientation( val & 0x07 );
|
||||
color = AEColor.values()[(val >> 3) & 0x0F];
|
||||
lumen = ((val >> 7) & 0x01) > 0;
|
||||
}
|
||||
|
||||
public void writeToStream(ByteBuf stream)
|
||||
{
|
||||
stream.writeByte( pos );
|
||||
int val = side.ordinal() | (color.ordinal() << 3) | (lumen ? 0x80 : 0x00);
|
||||
stream.writeByte( val );
|
||||
}
|
||||
|
||||
final private int pos;
|
||||
final public ForgeDirection side;
|
||||
final public boolean lumen;
|
||||
final public AEColor color;
|
||||
|
||||
public float x()
|
||||
{
|
||||
return (float) (pos & 0x0f) / 15.0f;
|
||||
}
|
||||
|
||||
public float y()
|
||||
{
|
||||
return (float) ((pos >> 4) & 0x0f) / 15.0f;
|
||||
}
|
||||
|
||||
public int getSeed()
|
||||
{
|
||||
int val = side.ordinal() | (color.ordinal() << 3) | (lumen ? 0x80 : 0x00);
|
||||
return Math.abs( pos + val );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IMachineSet;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
|
||||
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
|
||||
{
|
||||
|
||||
IWirelessTermHandler wth;
|
||||
String encryptionKey;
|
||||
|
||||
IGrid targetGrid;
|
||||
IStorageGrid sg;
|
||||
IMEMonitor<IAEItemStack> itemStorage;
|
||||
IWirelessAccessPoint myWap;
|
||||
|
||||
double sqRange = Double.MAX_VALUE;
|
||||
double myRange = Double.MAX_VALUE;
|
||||
|
||||
EntityPlayer myPlayer;
|
||||
public ItemStack effectiveItem;
|
||||
|
||||
public double getRange()
|
||||
{
|
||||
return myRange;
|
||||
}
|
||||
|
||||
public WirelessTerminalGuiObject(IWirelessTermHandler wh, ItemStack is, EntityPlayer ep, World w, int x, int y, int z) {
|
||||
encryptionKey = wh.getEncryptionKey( is );
|
||||
effectiveItem = is;
|
||||
myPlayer = ep;
|
||||
wth = wh;
|
||||
|
||||
Object obj = null;
|
||||
|
||||
try
|
||||
{
|
||||
long encKey = Long.parseLong( encryptionKey );
|
||||
obj = AEApi.instance().registries().locatable().findLocatableBySerial( encKey );
|
||||
}
|
||||
catch (NumberFormatException err)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
if ( obj instanceof IGridHost )
|
||||
{
|
||||
IGridNode n = ((IGridHost) obj).getGridNode( ForgeDirection.UNKNOWN );
|
||||
if ( n != null )
|
||||
{
|
||||
targetGrid = n.getGrid();
|
||||
if ( targetGrid != null )
|
||||
{
|
||||
sg = targetGrid.getCache( IStorageGrid.class );
|
||||
if ( sg != null )
|
||||
itemStorage = sg.getItemInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean rangeCheck()
|
||||
{
|
||||
sqRange = myRange = Double.MAX_VALUE;
|
||||
|
||||
if ( targetGrid != null && itemStorage != null )
|
||||
{
|
||||
if ( myWap != null )
|
||||
{
|
||||
if ( myWap.getGrid() == targetGrid )
|
||||
{
|
||||
if ( testWap( myWap ) )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IMachineSet tw = targetGrid.getMachines( TileWireless.class );
|
||||
|
||||
myWap = null;
|
||||
|
||||
for (IGridNode n : tw)
|
||||
{
|
||||
IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||
if ( testWap( wap ) )
|
||||
myWap = wap;
|
||||
}
|
||||
|
||||
return myWap != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean testWap(IWirelessAccessPoint wap)
|
||||
{
|
||||
double rangeLimit = wap.getRange();
|
||||
rangeLimit *= rangeLimit;
|
||||
|
||||
DimensionalCoord dc = wap.getLocation();
|
||||
|
||||
if ( dc.getWorld() == myPlayer.worldObj )
|
||||
{
|
||||
double offX = (double) dc.x - myPlayer.posX;
|
||||
double offY = (double) dc.y - myPlayer.posY;
|
||||
double offZ = (double) dc.z - myPlayer.posZ;
|
||||
|
||||
double r = offX * offX + offY * offY + offZ * offZ;
|
||||
if ( r < rangeLimit && sqRange > r )
|
||||
{
|
||||
if ( wap.isActive() )
|
||||
{
|
||||
sqRange = r;
|
||||
myRange = Math.sqrt( r );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
if ( sg == null )
|
||||
return null;
|
||||
return sg.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if ( sg == null )
|
||||
return null;
|
||||
return sg.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
itemStorage.addListener( l, verificationToken );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IMEMonitorHandlerReceiver<IAEItemStack> l)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
itemStorage.removeListener( l );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList out)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getAvailableItems( out );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getStorageList()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getStorageList();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getAccess()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getAccess();
|
||||
return AccessRestriction.NO_ACCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(IAEItemStack input)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.isPrioritized( input );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(IAEItemStack input)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.canAccept( input );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getPriority();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlot()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getSlot();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.injectItems( input, type, src );
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.extractItems( request, mode, src );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
if ( itemStorage != null )
|
||||
return itemStorage.getChannel();
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier)
|
||||
{
|
||||
if ( wth != null && effectiveItem != null )
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return wth.hasPower( myPlayer, amt, getItemStack() ) ? amt : 0;
|
||||
return wth.usePower( myPlayer, amt, getItemStack() ) ? amt : 0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return effectiveItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return wth.getConfigManager( effectiveItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode(ForgeDirection dir)
|
||||
{
|
||||
return this.getActionableNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType(ForgeDirection dir)
|
||||
{
|
||||
return AECableType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void securityBreak()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getActionableNode()
|
||||
{
|
||||
rangeCheck();
|
||||
if ( myWap != null )
|
||||
return myWap.getActionableNode();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass(int i)
|
||||
{
|
||||
return itemStorage.validForPass( i );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user