reformatted all src files (#141)
This commit is contained in:
@@ -23,25 +23,21 @@ import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
|
||||
public class AEGlassMaterial extends Material
|
||||
{
|
||||
public class AEGlassMaterial extends Material {
|
||||
|
||||
public static final AEGlassMaterial INSTANCE = ( new AEGlassMaterial( MapColor.AIR ) );
|
||||
public static final AEGlassMaterial INSTANCE = (new AEGlassMaterial(MapColor.AIR));
|
||||
|
||||
public AEGlassMaterial( final MapColor color )
|
||||
{
|
||||
super( color );
|
||||
}
|
||||
public AEGlassMaterial(final MapColor color) {
|
||||
super(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isSolid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaque() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import appeng.api.networking.IGridHost;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
||||
|
||||
public interface AEMultiTile extends IGridHost, IPartHost, IColorableTile
|
||||
{
|
||||
public interface AEMultiTile extends IGridHost, IPartHost, IColorableTile {
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,14 +13,13 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
// taken from McJty's McJtyLib
|
||||
|
||||
public class HighlighterHandler
|
||||
{
|
||||
public class HighlighterHandler {
|
||||
|
||||
public static void tick( RenderWorldLastEvent event ) {
|
||||
public static void tick(RenderWorldLastEvent event) {
|
||||
renderHilightedBlock(event);
|
||||
}
|
||||
|
||||
private static void renderHilightedBlock( RenderWorldLastEvent event ) {
|
||||
private static void renderHilightedBlock(RenderWorldLastEvent event) {
|
||||
BlockPos c = BlockPosHighlighter.getHilightedBlock();
|
||||
if (c == null) {
|
||||
return;
|
||||
@@ -30,7 +29,7 @@ public class HighlighterHandler
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
if (time > BlockPosHighlighter.getExpireHilight() || dimension != BlockPosHighlighter.getDimension()) {
|
||||
BlockPosHighlighter.hilightBlock(null, -1, BlockPosHighlighter.getDimension() );
|
||||
BlockPosHighlighter.hilightBlock(null, -1, BlockPosHighlighter.getDimension());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +55,7 @@ public class HighlighterHandler
|
||||
float mx = c.getX();
|
||||
float my = c.getY();
|
||||
float mz = c.getZ();
|
||||
buffer.begin( GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
|
||||
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
|
||||
renderHighLightedBlocksOutline(buffer, mx, my, mz, 1.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
@@ -19,40 +19,37 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
|
||||
public interface IContainerCraftingPacket {
|
||||
|
||||
public interface IContainerCraftingPacket
|
||||
{
|
||||
/**
|
||||
* @return gain access to network infrastructure.
|
||||
*/
|
||||
IGridNode getNetworkNode();
|
||||
|
||||
/**
|
||||
* @return gain access to network infrastructure.
|
||||
*/
|
||||
IGridNode getNetworkNode();
|
||||
/**
|
||||
* @param string name of inventory
|
||||
* @return the inventory of the part/tile by name.
|
||||
*/
|
||||
IItemHandler getInventoryByName(String string);
|
||||
|
||||
/**
|
||||
* @param string name of inventory
|
||||
*
|
||||
* @return the inventory of the part/tile by name.
|
||||
*/
|
||||
IItemHandler getInventoryByName( String string );
|
||||
/**
|
||||
* @return who are we?
|
||||
*/
|
||||
IActionSource getActionSource();
|
||||
|
||||
/**
|
||||
* @return who are we?
|
||||
*/
|
||||
IActionSource getActionSource();
|
||||
/**
|
||||
* @return consume items?
|
||||
*/
|
||||
boolean useRealItems();
|
||||
|
||||
/**
|
||||
* @return consume items?
|
||||
*/
|
||||
boolean useRealItems();
|
||||
|
||||
/**
|
||||
* @return array of view cells
|
||||
*/
|
||||
ItemStack[] getViewCells();
|
||||
/**
|
||||
* @return array of view cells
|
||||
*/
|
||||
ItemStack[] getViewCells();
|
||||
}
|
||||
|
||||
@@ -19,17 +19,16 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICustomCollision
|
||||
{
|
||||
Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, BlockPos pos, Entity thePlayer, boolean b );
|
||||
|
||||
void addCollidingBlockToList( World w, BlockPos pos, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e );
|
||||
public interface ICustomCollision {
|
||||
Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, BlockPos pos, Entity thePlayer, boolean b);
|
||||
|
||||
void addCollidingBlockToList(World w, BlockPos pos, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
public interface ICustomNameObject
|
||||
{
|
||||
public interface ICustomNameObject {
|
||||
|
||||
String getCustomInventoryName();
|
||||
String getCustomInventoryName();
|
||||
|
||||
boolean hasCustomInventoryName();
|
||||
boolean hasCustomInventoryName();
|
||||
|
||||
void setCustomName(String name);
|
||||
void setCustomName(String name);
|
||||
}
|
||||
|
||||
@@ -19,24 +19,22 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
||||
public interface IInterfaceHost extends ICraftingProvider, IUpgradeableHost, ICraftingRequester
|
||||
{
|
||||
public interface IInterfaceHost extends ICraftingProvider, IUpgradeableHost, ICraftingRequester {
|
||||
|
||||
DualityInterface getInterfaceDuality();
|
||||
DualityInterface getInterfaceDuality();
|
||||
|
||||
EnumSet<EnumFacing> getTargets();
|
||||
EnumSet<EnumFacing> getTargets();
|
||||
|
||||
TileEntity getTileEntity();
|
||||
TileEntity getTileEntity();
|
||||
|
||||
void saveChanges();
|
||||
void saveChanges();
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ package appeng.helpers;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public interface IMouseWheelItem
|
||||
{
|
||||
public interface IMouseWheelItem {
|
||||
|
||||
void onWheel( ItemStack is, boolean up );
|
||||
void onWheel(ItemStack is, boolean up);
|
||||
}
|
||||
|
||||
@@ -19,25 +19,23 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
||||
public interface IPriorityHost {
|
||||
|
||||
public interface IPriorityHost
|
||||
{
|
||||
/**
|
||||
* get current priority.
|
||||
*/
|
||||
int getPriority();
|
||||
|
||||
/**
|
||||
* get current priority.
|
||||
*/
|
||||
int getPriority();
|
||||
/**
|
||||
* set new priority
|
||||
*/
|
||||
void setPriority(int newValue);
|
||||
|
||||
/**
|
||||
* set new priority
|
||||
*/
|
||||
void setPriority( int newValue );
|
||||
ItemStack getItemStackRepresentation();
|
||||
|
||||
ItemStack getItemStackRepresentation();
|
||||
|
||||
GuiBridge getGuiBridge();
|
||||
GuiBridge getGuiBridge();
|
||||
}
|
||||
|
||||
@@ -19,139 +19,117 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class InvalidPatternHelper
|
||||
{
|
||||
public class InvalidPatternHelper {
|
||||
|
||||
private final List<PatternIngredient> outputs = new ArrayList<>();
|
||||
private final List<PatternIngredient> inputs = new ArrayList<>();
|
||||
private final boolean isCrafting;
|
||||
private final boolean canSubstitute;
|
||||
private final List<PatternIngredient> outputs = new ArrayList<>();
|
||||
private final List<PatternIngredient> inputs = new ArrayList<>();
|
||||
private final boolean isCrafting;
|
||||
private final boolean canSubstitute;
|
||||
|
||||
public InvalidPatternHelper( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound encodedValue = is.getTagCompound();
|
||||
public InvalidPatternHelper(final ItemStack is) {
|
||||
final NBTTagCompound encodedValue = is.getTagCompound();
|
||||
|
||||
if( encodedValue == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "No pattern here!" );
|
||||
}
|
||||
if (encodedValue == null) {
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
}
|
||||
|
||||
final NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
final NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
this.isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
final NBTTagList inTag = encodedValue.getTagList("in", 10);
|
||||
final NBTTagList outTag = encodedValue.getTagList("out", 10);
|
||||
this.isCrafting = encodedValue.getBoolean("crafting");
|
||||
|
||||
this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" );
|
||||
this.canSubstitute = this.isCrafting && encodedValue.getBoolean("substitute");
|
||||
|
||||
for( int i = 0; i < outTag.tagCount(); i++ )
|
||||
{
|
||||
this.outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) );
|
||||
}
|
||||
for (int i = 0; i < outTag.tagCount(); i++) {
|
||||
this.outputs.add(new PatternIngredient(outTag.getCompoundTagAt(i)));
|
||||
}
|
||||
|
||||
for( int i = 0; i < inTag.tagCount(); i++ )
|
||||
{
|
||||
NBTTagCompound in = inTag.getCompoundTagAt( i );
|
||||
for (int i = 0; i < inTag.tagCount(); i++) {
|
||||
NBTTagCompound in = inTag.getCompoundTagAt(i);
|
||||
|
||||
// skip empty slots in the crafting grid
|
||||
if( in.hasNoTags() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// skip empty slots in the crafting grid
|
||||
if (in.hasNoTags()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.inputs.add( new PatternIngredient( in ) );
|
||||
}
|
||||
}
|
||||
this.inputs.add(new PatternIngredient(in));
|
||||
}
|
||||
}
|
||||
|
||||
public List<PatternIngredient> getOutputs()
|
||||
{
|
||||
return this.outputs;
|
||||
}
|
||||
public List<PatternIngredient> getOutputs() {
|
||||
return this.outputs;
|
||||
}
|
||||
|
||||
public List<PatternIngredient> getInputs()
|
||||
{
|
||||
return this.inputs;
|
||||
}
|
||||
public List<PatternIngredient> getInputs() {
|
||||
return this.inputs;
|
||||
}
|
||||
|
||||
public boolean isCraftable()
|
||||
{
|
||||
return this.isCrafting;
|
||||
}
|
||||
public boolean isCraftable() {
|
||||
return this.isCrafting;
|
||||
}
|
||||
|
||||
public boolean canSubstitute()
|
||||
{
|
||||
return this.canSubstitute;
|
||||
}
|
||||
public boolean canSubstitute() {
|
||||
return this.canSubstitute;
|
||||
}
|
||||
|
||||
public class PatternIngredient
|
||||
{
|
||||
private String id;
|
||||
private int count;
|
||||
private int damage;
|
||||
public class PatternIngredient {
|
||||
private String id;
|
||||
private int count;
|
||||
private int damage;
|
||||
|
||||
private ItemStack stack;
|
||||
private final ItemStack stack;
|
||||
|
||||
public PatternIngredient( NBTTagCompound tag )
|
||||
{
|
||||
this.stack = new ItemStack( tag );
|
||||
public PatternIngredient(NBTTagCompound tag) {
|
||||
this.stack = new ItemStack(tag);
|
||||
|
||||
if( this.stack.isEmpty() )
|
||||
{
|
||||
this.id = tag.getString( "id" );
|
||||
this.count = tag.getByte( "Count" );
|
||||
this.damage = Math.max( 0, tag.getShort( "Damage" ) );
|
||||
}
|
||||
}
|
||||
if (this.stack.isEmpty()) {
|
||||
this.id = tag.getString("id");
|
||||
this.count = tag.getByte("Count");
|
||||
this.damage = Math.max(0, tag.getShort("Damage"));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return !this.stack.isEmpty();
|
||||
}
|
||||
public boolean isValid() {
|
||||
return !this.stack.isEmpty();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.isValid() ? Platform.getItemDisplayName( this.stack ) : this.id + '@' + String.valueOf( this.getDamage() );
|
||||
}
|
||||
public String getName() {
|
||||
return this.isValid() ? Platform.getItemDisplayName(this.stack) : this.id + '@' + this.getDamage();
|
||||
}
|
||||
|
||||
public int getDamage()
|
||||
{
|
||||
return this.isValid() ? this.stack.getItemDamage() : this.damage;
|
||||
}
|
||||
public int getDamage() {
|
||||
return this.isValid() ? this.stack.getItemDamage() : this.damage;
|
||||
}
|
||||
|
||||
public int getCount()
|
||||
{
|
||||
return this.isValid() ? this.stack.getCount() : this.count;
|
||||
}
|
||||
public int getCount() {
|
||||
return this.isValid() ? this.stack.getCount() : this.count;
|
||||
}
|
||||
|
||||
public ItemStack getItem()
|
||||
{
|
||||
if( !this.isValid() )
|
||||
{
|
||||
throw new IllegalArgumentException( "There is no valid ItemStack for this PatternIngredient" );
|
||||
}
|
||||
public ItemStack getItem() {
|
||||
if (!this.isValid()) {
|
||||
throw new IllegalArgumentException("There is no valid ItemStack for this PatternIngredient");
|
||||
}
|
||||
|
||||
return this.stack;
|
||||
}
|
||||
return this.stack;
|
||||
}
|
||||
|
||||
public String getFormattedToolTip()
|
||||
{
|
||||
String result = String.valueOf( this.getCount() ) + ' ' + this.getName();
|
||||
public String getFormattedToolTip() {
|
||||
String result = String.valueOf(this.getCount()) + ' ' + this.getName();
|
||||
|
||||
if( !this.isValid() )
|
||||
{
|
||||
result = TextFormatting.RED + ( ' ' + result );
|
||||
}
|
||||
if (!this.isValid()) {
|
||||
result = TextFormatting.RED + (' ' + result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,30 +19,29 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
public enum InventoryAction
|
||||
{
|
||||
// standard vanilla mechanics.
|
||||
PICKUP_OR_SET_DOWN,
|
||||
SPLIT_OR_PLACE_SINGLE,
|
||||
CREATIVE_DUPLICATE,
|
||||
SHIFT_CLICK,
|
||||
public enum InventoryAction {
|
||||
// standard vanilla mechanics.
|
||||
PICKUP_OR_SET_DOWN,
|
||||
SPLIT_OR_PLACE_SINGLE,
|
||||
CREATIVE_DUPLICATE,
|
||||
SHIFT_CLICK,
|
||||
|
||||
// crafting term
|
||||
CRAFT_STACK,
|
||||
CRAFT_ITEM,
|
||||
CRAFT_SHIFT,
|
||||
// crafting term
|
||||
CRAFT_STACK,
|
||||
CRAFT_ITEM,
|
||||
CRAFT_SHIFT,
|
||||
|
||||
// fluid term
|
||||
FILL_ITEM,
|
||||
EMPTY_ITEM,
|
||||
// fluid term
|
||||
FILL_ITEM,
|
||||
EMPTY_ITEM,
|
||||
|
||||
// extra...
|
||||
MOVE_REGION,
|
||||
PICKUP_SINGLE,
|
||||
UPDATE_HAND,
|
||||
ROLL_UP,
|
||||
ROLL_DOWN,
|
||||
AUTO_CRAFT,
|
||||
PLACE_SINGLE,
|
||||
PLACE_JEI_GHOST_ITEM
|
||||
// extra...
|
||||
MOVE_REGION,
|
||||
PICKUP_SINGLE,
|
||||
UPDATE_HAND,
|
||||
ROLL_UP,
|
||||
ROLL_DOWN,
|
||||
AUTO_CRAFT,
|
||||
PLACE_SINGLE,
|
||||
PLACE_JEI_GHOST_ITEM
|
||||
}
|
||||
|
||||
@@ -19,54 +19,46 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
public class LocationRotation implements IOrientable {
|
||||
|
||||
public class LocationRotation implements IOrientable
|
||||
{
|
||||
private final IBlockAccess w;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
private final IBlockAccess w;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
public LocationRotation(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public LocationRotation( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getForward() {
|
||||
if (this.getUp().getFrontOffsetY() == 0) {
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getForward()
|
||||
{
|
||||
if( this.getUp().getFrontOffsetY() == 0 )
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getUp() {
|
||||
final int num = Math.abs(this.x + this.y + this.z) % 6;
|
||||
return EnumFacing.VALUES[num];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
{
|
||||
final int num = Math.abs( this.x + this.y + this.z ) % 6;
|
||||
return EnumFacing.VALUES[num];
|
||||
}
|
||||
@Override
|
||||
public void setOrientation(final EnumFacing forward, final EnumFacing up) {
|
||||
|
||||
@Override
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.decorative.solid.BlockQuartzPillar;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -27,88 +29,69 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.decorative.solid.BlockQuartzPillar;
|
||||
|
||||
public class MetaRotation implements IOrientable {
|
||||
|
||||
public class MetaRotation implements IOrientable
|
||||
{
|
||||
private final IProperty<EnumFacing> facingProp;
|
||||
private final IBlockAccess w;
|
||||
private final BlockPos pos;
|
||||
|
||||
private final IProperty<EnumFacing> facingProp;
|
||||
private final IBlockAccess w;
|
||||
private final BlockPos pos;
|
||||
public MetaRotation(final IBlockAccess world, final BlockPos pos, final IProperty<EnumFacing> facingProp) {
|
||||
this.w = world;
|
||||
this.pos = pos;
|
||||
this.facingProp = facingProp;
|
||||
}
|
||||
|
||||
public MetaRotation( final IBlockAccess world, final BlockPos pos, final IProperty<EnumFacing> facingProp )
|
||||
{
|
||||
this.w = world;
|
||||
this.pos = pos;
|
||||
this.facingProp = facingProp;
|
||||
}
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getForward() {
|
||||
if (this.getUp().getFrontOffsetY() == 0) {
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getForward()
|
||||
{
|
||||
if( this.getUp().getFrontOffsetY() == 0 )
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getUp() {
|
||||
final IBlockState state = this.w.getBlockState(this.pos);
|
||||
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
{
|
||||
final IBlockState state = this.w.getBlockState( this.pos );
|
||||
if (this.facingProp != null) {
|
||||
return state.getValue(this.facingProp);
|
||||
}
|
||||
|
||||
if( this.facingProp != null )
|
||||
{
|
||||
return state.getValue( this.facingProp );
|
||||
}
|
||||
// TODO 1.10.2-R - Temp
|
||||
Axis a = state.getValue(BlockQuartzPillar.AXIS_ORIENTATION);
|
||||
|
||||
// TODO 1.10.2-R - Temp
|
||||
Axis a = state.getValue( BlockQuartzPillar.AXIS_ORIENTATION );
|
||||
if (a == null) {
|
||||
a = Axis.Y;
|
||||
}
|
||||
|
||||
if( a == null )
|
||||
{
|
||||
a = Axis.Y;
|
||||
}
|
||||
switch (a) {
|
||||
case X:
|
||||
return EnumFacing.EAST;
|
||||
case Z:
|
||||
return EnumFacing.SOUTH;
|
||||
default:
|
||||
case Y:
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
|
||||
switch( a )
|
||||
{
|
||||
case X:
|
||||
return EnumFacing.EAST;
|
||||
case Z:
|
||||
return EnumFacing.SOUTH;
|
||||
default:
|
||||
case Y:
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
if( this.w instanceof World )
|
||||
{
|
||||
if( this.facingProp != null )
|
||||
{
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( this.facingProp, up ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO 1.10.2-R - Temp
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockQuartzPillar.AXIS_ORIENTATION, up.getAxis() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( this.w.getClass().getName() + " received, expected World" );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setOrientation(final EnumFacing forward, final EnumFacing up) {
|
||||
if (this.w instanceof World) {
|
||||
if (this.facingProp != null) {
|
||||
((World) this.w).setBlockState(this.pos, this.w.getBlockState(this.pos).withProperty(this.facingProp, up));
|
||||
} else {
|
||||
// TODO 1.10.2-R - Temp
|
||||
((World) this.w).setBlockState(this.pos, this.w.getBlockState(this.pos).withProperty(BlockQuartzPillar.AXIS_ORIENTATION, up.getAxis()));
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException(this.w.getClass().getName() + " received, expected World");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,6 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
@@ -37,269 +28,215 @@ import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
public class MultiCraftingTracker
|
||||
{
|
||||
public class MultiCraftingTracker {
|
||||
|
||||
private final int size;
|
||||
private final ICraftingRequester owner;
|
||||
private final int size;
|
||||
private final ICraftingRequester owner;
|
||||
|
||||
private Future<ICraftingJob>[] jobs = null;
|
||||
private ICraftingLink[] links = null;
|
||||
private Future<ICraftingJob>[] jobs = null;
|
||||
private ICraftingLink[] links = null;
|
||||
|
||||
public MultiCraftingTracker( final ICraftingRequester o, final int size )
|
||||
{
|
||||
this.owner = o;
|
||||
this.size = size;
|
||||
}
|
||||
public MultiCraftingTracker(final ICraftingRequester o, final int size) {
|
||||
this.owner = o;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void readFromNBT( final NBTTagCompound extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
final NBTTagCompound link = extra.getCompoundTag( "links-" + x );
|
||||
public void readFromNBT(final NBTTagCompound extra) {
|
||||
for (int x = 0; x < this.size; x++) {
|
||||
final NBTTagCompound link = extra.getCompoundTag("links-" + x);
|
||||
|
||||
if( link != null && !link.hasNoTags() )
|
||||
{
|
||||
this.setLink( x, AEApi.instance().storage().loadCraftingLink( link, this.owner ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (link != null && !link.hasNoTags()) {
|
||||
this.setLink(x, AEApi.instance().storage().loadCraftingLink(link, this.owner));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT( final NBTTagCompound extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
final ICraftingLink link = this.getLink( x );
|
||||
public void writeToNBT(final NBTTagCompound extra) {
|
||||
for (int x = 0; x < this.size; x++) {
|
||||
final ICraftingLink link = this.getLink(x);
|
||||
|
||||
if( link != null )
|
||||
{
|
||||
final NBTTagCompound ln = new NBTTagCompound();
|
||||
link.writeToNBT( ln );
|
||||
extra.setTag( "links-" + x, ln );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (link != null) {
|
||||
final NBTTagCompound ln = new NBTTagCompound();
|
||||
link.writeToNBT(ln);
|
||||
extra.setTag("links-" + x, ln);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleCrafting( final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final IActionSource mySrc )
|
||||
{
|
||||
if( ais != null )
|
||||
{
|
||||
ItemStack inputStack = ais.getCachedItemStack( ais.getStackSize() );
|
||||
public boolean handleCrafting(final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final IActionSource mySrc) {
|
||||
if (ais != null) {
|
||||
ItemStack inputStack = ais.getCachedItemStack(ais.getStackSize());
|
||||
|
||||
ItemStack remaining = d.simulateAdd( inputStack );
|
||||
ItemStack remaining = d.simulateAdd(inputStack);
|
||||
|
||||
if( remaining.isEmpty() )
|
||||
{
|
||||
ais.setCachedItemStack( inputStack );
|
||||
if (remaining.isEmpty()) {
|
||||
ais.setCachedItemStack(inputStack);
|
||||
|
||||
final Future<ICraftingJob> craftingJob = this.getJob( x );
|
||||
final Future<ICraftingJob> craftingJob = this.getJob(x);
|
||||
|
||||
if( this.getLink( x ) != null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if( craftingJob != null )
|
||||
{
|
||||
if (this.getLink(x) != null) {
|
||||
return false;
|
||||
} else if (craftingJob != null) {
|
||||
|
||||
try
|
||||
{
|
||||
ICraftingJob job = null;
|
||||
if( craftingJob.isDone() )
|
||||
{
|
||||
job = craftingJob.get();
|
||||
}
|
||||
try {
|
||||
ICraftingJob job = null;
|
||||
if (craftingJob.isDone()) {
|
||||
job = craftingJob.get();
|
||||
}
|
||||
|
||||
if( job != null )
|
||||
{
|
||||
final ICraftingLink link = cg.submitJob( job, this.owner, null, false, mySrc );
|
||||
if (job != null) {
|
||||
final ICraftingLink link = cg.submitJob(job, this.owner, null, false, mySrc);
|
||||
|
||||
this.setJob( x, null );
|
||||
this.setJob(x, null);
|
||||
|
||||
if( link != null )
|
||||
{
|
||||
this.setLink( x, link );
|
||||
if (link != null) {
|
||||
this.setLink(x, link);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final InterruptedException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
catch( final ExecutionException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( this.getLink( x ) == null )
|
||||
{
|
||||
final IAEItemStack aisC = ais.copy();
|
||||
aisC.setStackSize( itemToCraft );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (final InterruptedException e) {
|
||||
// :P
|
||||
} catch (final ExecutionException e) {
|
||||
// :P
|
||||
}
|
||||
} else {
|
||||
if (this.getLink(x) == null) {
|
||||
final IAEItemStack aisC = ais.copy();
|
||||
aisC.setStackSize(itemToCraft);
|
||||
|
||||
this.setJob( x, cg.beginCraftingJob( w, g, mySrc, aisC, null ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ais.setCachedItemStack( remaining );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
this.setJob(x, cg.beginCraftingJob(w, g, mySrc, aisC, null));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ais.setCachedItemStack(remaining);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
if( this.links == null )
|
||||
{
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
if (this.links == null) {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
|
||||
return ImmutableSet.copyOf( new NonNullArrayIterator<>( this.links ) );
|
||||
}
|
||||
return ImmutableSet.copyOf(new NonNullArrayIterator<>(this.links));
|
||||
}
|
||||
|
||||
public void jobStateChange( final ICraftingLink link )
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
for( int x = 0; x < this.links.length; x++ )
|
||||
{
|
||||
if( this.links[x] == link )
|
||||
{
|
||||
this.setLink( x, null );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
if (this.links != null) {
|
||||
for (int x = 0; x < this.links.length; x++) {
|
||||
if (this.links[x] == link) {
|
||||
this.setLink(x, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getSlot( final ICraftingLink link )
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
for( int x = 0; x < this.links.length; x++ )
|
||||
{
|
||||
if( this.links[x] == link )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
int getSlot(final ICraftingLink link) {
|
||||
if (this.links != null) {
|
||||
for (int x = 0; x < this.links.length; x++) {
|
||||
if (this.links[x] == link) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cancel()
|
||||
{
|
||||
if( this.links != null )
|
||||
{
|
||||
for( final ICraftingLink l : this.links )
|
||||
{
|
||||
if( l != null )
|
||||
{
|
||||
l.cancel();
|
||||
}
|
||||
}
|
||||
void cancel() {
|
||||
if (this.links != null) {
|
||||
for (final ICraftingLink l : this.links) {
|
||||
if (l != null) {
|
||||
l.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
this.links = null;
|
||||
}
|
||||
this.links = null;
|
||||
}
|
||||
|
||||
if( this.jobs != null )
|
||||
{
|
||||
for( final Future<ICraftingJob> l : this.jobs )
|
||||
{
|
||||
if( l != null )
|
||||
{
|
||||
l.cancel( true );
|
||||
}
|
||||
}
|
||||
if (this.jobs != null) {
|
||||
for (final Future<ICraftingJob> l : this.jobs) {
|
||||
if (l != null) {
|
||||
l.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
this.jobs = null;
|
||||
}
|
||||
}
|
||||
this.jobs = null;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isBusy( final int slot )
|
||||
{
|
||||
return this.getLink( slot ) != null || this.getJob( slot ) != null;
|
||||
}
|
||||
boolean isBusy(final int slot) {
|
||||
return this.getLink(slot) != null || this.getJob(slot) != null;
|
||||
}
|
||||
|
||||
private ICraftingLink getLink( final int slot )
|
||||
{
|
||||
if( this.links == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
private ICraftingLink getLink(final int slot) {
|
||||
if (this.links == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.links[slot];
|
||||
}
|
||||
return this.links[slot];
|
||||
}
|
||||
|
||||
private void setLink( final int slot, final ICraftingLink l )
|
||||
{
|
||||
if( this.links == null )
|
||||
{
|
||||
this.links = new ICraftingLink[this.size];
|
||||
}
|
||||
private void setLink(final int slot, final ICraftingLink l) {
|
||||
if (this.links == null) {
|
||||
this.links = new ICraftingLink[this.size];
|
||||
}
|
||||
|
||||
this.links[slot] = l;
|
||||
this.links[slot] = l;
|
||||
|
||||
boolean hasStuff = false;
|
||||
for( int x = 0; x < this.links.length; x++ )
|
||||
{
|
||||
final ICraftingLink g = this.links[x];
|
||||
boolean hasStuff = false;
|
||||
for (int x = 0; x < this.links.length; x++) {
|
||||
final ICraftingLink g = this.links[x];
|
||||
|
||||
if( g == null || g.isCanceled() || g.isDone() )
|
||||
{
|
||||
this.links[x] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasStuff = true;
|
||||
}
|
||||
}
|
||||
if (g == null || g.isCanceled() || g.isDone()) {
|
||||
this.links[x] = null;
|
||||
} else {
|
||||
hasStuff = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !hasStuff )
|
||||
{
|
||||
this.links = null;
|
||||
}
|
||||
}
|
||||
if (!hasStuff) {
|
||||
this.links = null;
|
||||
}
|
||||
}
|
||||
|
||||
private Future<ICraftingJob> getJob( final int slot )
|
||||
{
|
||||
if( this.jobs == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
private Future<ICraftingJob> getJob(final int slot) {
|
||||
if (this.jobs == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.jobs[slot];
|
||||
}
|
||||
return this.jobs[slot];
|
||||
}
|
||||
|
||||
private void setJob( final int slot, final Future<ICraftingJob> l )
|
||||
{
|
||||
if( this.jobs == null )
|
||||
{
|
||||
this.jobs = new Future[this.size];
|
||||
}
|
||||
private void setJob(final int slot, final Future<ICraftingJob> l) {
|
||||
if (this.jobs == null) {
|
||||
this.jobs = new Future[this.size];
|
||||
}
|
||||
|
||||
this.jobs[slot] = l;
|
||||
this.jobs[slot] = l;
|
||||
|
||||
boolean hasStuff = false;
|
||||
boolean hasStuff = false;
|
||||
|
||||
for( final Future<ICraftingJob> job : this.jobs )
|
||||
{
|
||||
if( job != null )
|
||||
{
|
||||
hasStuff = true;
|
||||
}
|
||||
}
|
||||
for (final Future<ICraftingJob> job : this.jobs) {
|
||||
if (job != null) {
|
||||
hasStuff = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !hasStuff )
|
||||
{
|
||||
this.jobs = null;
|
||||
}
|
||||
}
|
||||
if (!hasStuff) {
|
||||
this.jobs = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,128 +6,103 @@ import appeng.util.Platform;
|
||||
import gregtech.api.items.metaitem.MetaItem;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.*;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class NonBlockingItems
|
||||
{
|
||||
public static Map<String, Object2ObjectOpenHashMap<Item, IntSet>> NON_BLOCKING_MAP = new HashMap<>();
|
||||
public static NonBlockingItems INSTANCE = new NonBlockingItems();
|
||||
public class NonBlockingItems {
|
||||
public static Map<String, Object2ObjectOpenHashMap<Item, IntSet>> NON_BLOCKING_MAP = new HashMap<>();
|
||||
public static NonBlockingItems INSTANCE = new NonBlockingItems();
|
||||
|
||||
private NonBlockingItems()
|
||||
{
|
||||
String[] strings = AEConfig.instance().getNonBlockingItems();
|
||||
String[] modids = new String[0];
|
||||
if( strings.length > 0 )
|
||||
{
|
||||
for( String s : strings )
|
||||
{
|
||||
if( s.startsWith( "[" ) && s.endsWith( "]" ) )
|
||||
{
|
||||
modids = s.substring( 1, s.length() - 1 ).split( "\\|" );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( String modid : modids )
|
||||
{
|
||||
if( !Loader.isModLoaded( modid ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
NON_BLOCKING_MAP.putIfAbsent( modid, new Object2ObjectOpenHashMap<>() );
|
||||
private NonBlockingItems() {
|
||||
String[] strings = AEConfig.instance().getNonBlockingItems();
|
||||
String[] modids = new String[0];
|
||||
if (strings.length > 0) {
|
||||
for (String s : strings) {
|
||||
if (s.startsWith("[") && s.endsWith("]")) {
|
||||
modids = s.substring(1, s.length() - 1).split("\\|");
|
||||
} else {
|
||||
for (String modid : modids) {
|
||||
if (!Loader.isModLoaded(modid)) {
|
||||
continue;
|
||||
}
|
||||
NON_BLOCKING_MAP.putIfAbsent(modid, new Object2ObjectOpenHashMap<>());
|
||||
|
||||
String[] ModItemMeta = s.split( ":" );
|
||||
String[] ModItemMeta = s.split(":");
|
||||
|
||||
if( ModItemMeta.length < 2 || ModItemMeta.length > 3 )
|
||||
{
|
||||
AELog.error( "Invalid non blocking item entry: " + s );
|
||||
continue;
|
||||
}
|
||||
if (ModItemMeta.length < 2 || ModItemMeta.length > 3) {
|
||||
AELog.error("Invalid non blocking item entry: " + s);
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ModItemMeta[0].equals( "gregtech" ) && Platform.isModLoaded( "gregtech" ) )
|
||||
{
|
||||
boolean found = false;
|
||||
for( MetaItem<?> metaItem : MetaItem.getMetaItems() )
|
||||
{
|
||||
MetaItem<?>.MetaValueItem metaItem2 = metaItem.getItem( ModItemMeta[1] );
|
||||
if( metaItem.getItem( ModItemMeta[1] ) != null )
|
||||
{
|
||||
found = true;
|
||||
ItemStack itemStack = metaItem2.getStackForm();
|
||||
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
|
||||
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
|
||||
{
|
||||
intSet.add( itemStack.getItemDamage() );
|
||||
return intSet;
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemStack = GameRegistry.makeItemStack( ModItemMeta[0] + ":" + ModItemMeta[1], ModItemMeta.length == 3 ? Integer.parseInt( ModItemMeta[2] ) : 0, 1, null );
|
||||
if( !itemStack.isEmpty() )
|
||||
{
|
||||
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
|
||||
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
|
||||
{
|
||||
intSet.add( itemStack.getItemDamage() );
|
||||
return intSet;
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !found )
|
||||
{
|
||||
AELog.error( "Item not found on nonBlocking config: " + s );
|
||||
}
|
||||
}
|
||||
else if( ModItemMeta[0].equals( "ore" ) )
|
||||
{
|
||||
OreDictionary.getOres( ModItemMeta[1] ).forEach( itemStack ->
|
||||
{
|
||||
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
|
||||
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
|
||||
{
|
||||
intSet.add( itemStack.getItemDamage() );
|
||||
return intSet;
|
||||
} );
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack itemStack = GameRegistry.makeItemStack( ModItemMeta[0] + ":" + ModItemMeta[1], ModItemMeta.length == 3 ? Integer.parseInt( ModItemMeta[2] ) : 0, 1, null );
|
||||
if( !itemStack.isEmpty() )
|
||||
{
|
||||
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
|
||||
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
|
||||
{
|
||||
intSet.add( itemStack.getItemDamage() );
|
||||
return intSet;
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
AELog.error( "Item not found on nonBlocking config: " + s );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ModItemMeta[0].equals("gregtech") && Platform.isModLoaded("gregtech")) {
|
||||
boolean found = false;
|
||||
for (MetaItem<?> metaItem : MetaItem.getMetaItems()) {
|
||||
MetaItem<?>.MetaValueItem metaItem2 = metaItem.getItem(ModItemMeta[1]);
|
||||
if (metaItem.getItem(ModItemMeta[1]) != null) {
|
||||
found = true;
|
||||
ItemStack itemStack = metaItem2.getStackForm();
|
||||
NON_BLOCKING_MAP.get(modid).putIfAbsent(itemStack.getItem(), new IntOpenHashSet());
|
||||
NON_BLOCKING_MAP.get(modid).computeIfPresent(itemStack.getItem(), (item, intSet) ->
|
||||
{
|
||||
intSet.add(itemStack.getItemDamage());
|
||||
return intSet;
|
||||
});
|
||||
} else {
|
||||
ItemStack itemStack = GameRegistry.makeItemStack(ModItemMeta[0] + ":" + ModItemMeta[1], ModItemMeta.length == 3 ? Integer.parseInt(ModItemMeta[2]) : 0, 1, null);
|
||||
if (!itemStack.isEmpty()) {
|
||||
NON_BLOCKING_MAP.get(modid).putIfAbsent(itemStack.getItem(), new IntOpenHashSet());
|
||||
NON_BLOCKING_MAP.get(modid).computeIfPresent(itemStack.getItem(), (item, intSet) ->
|
||||
{
|
||||
intSet.add(itemStack.getItemDamage());
|
||||
return intSet;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
AELog.error("Item not found on nonBlocking config: " + s);
|
||||
}
|
||||
} else if (ModItemMeta[0].equals("ore")) {
|
||||
OreDictionary.getOres(ModItemMeta[1]).forEach(itemStack ->
|
||||
{
|
||||
NON_BLOCKING_MAP.get(modid).putIfAbsent(itemStack.getItem(), new IntOpenHashSet());
|
||||
NON_BLOCKING_MAP.get(modid).computeIfPresent(itemStack.getItem(), (item, intSet) ->
|
||||
{
|
||||
intSet.add(itemStack.getItemDamage());
|
||||
return intSet;
|
||||
});
|
||||
});
|
||||
} else {
|
||||
ItemStack itemStack = GameRegistry.makeItemStack(ModItemMeta[0] + ":" + ModItemMeta[1], ModItemMeta.length == 3 ? Integer.parseInt(ModItemMeta[2]) : 0, 1, null);
|
||||
if (!itemStack.isEmpty()) {
|
||||
NON_BLOCKING_MAP.get(modid).putIfAbsent(itemStack.getItem(), new IntOpenHashSet());
|
||||
NON_BLOCKING_MAP.get(modid).computeIfPresent(itemStack.getItem(), (item, intSet) ->
|
||||
{
|
||||
intSet.add(itemStack.getItemDamage());
|
||||
return intSet;
|
||||
});
|
||||
} else {
|
||||
AELog.error("Item not found on nonBlocking config: " + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object2ObjectOpenHashMap<Item, IntSet>> getMap()
|
||||
{
|
||||
return NON_BLOCKING_MAP;
|
||||
}
|
||||
public Map<String, Object2ObjectOpenHashMap<Item, IntSet>> getMap() {
|
||||
return NON_BLOCKING_MAP;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
}
|
||||
public void init() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,40 +22,34 @@ package appeng.helpers;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
public class NonNullArrayIterator<E> implements Iterator<E>
|
||||
{
|
||||
public class NonNullArrayIterator<E> implements Iterator<E> {
|
||||
|
||||
private final E[] g;
|
||||
private int offset = 0;
|
||||
private final E[] g;
|
||||
private int offset = 0;
|
||||
|
||||
public NonNullArrayIterator( final E[] o )
|
||||
{
|
||||
this.g = o;
|
||||
}
|
||||
public NonNullArrayIterator(final E[] o) {
|
||||
this.g = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
while( this.offset < this.g.length && this.g[this.offset] == null )
|
||||
{
|
||||
this.offset++;
|
||||
}
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
while (this.offset < this.g.length && this.g[this.offset] == null) {
|
||||
this.offset++;
|
||||
}
|
||||
|
||||
return this.offset != this.g.length;
|
||||
}
|
||||
return this.offset != this.g.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E next()
|
||||
{
|
||||
final E result = this.g[this.offset];
|
||||
this.offset++;
|
||||
@Override
|
||||
public E next() {
|
||||
final E result = this.g[this.offset];
|
||||
this.offset++;
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,40 +19,33 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
public class NullRotation implements IOrientable {
|
||||
|
||||
public class NullRotation implements IOrientable
|
||||
{
|
||||
public NullRotation() {
|
||||
|
||||
public NullRotation()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getForward() {
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getForward()
|
||||
{
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getUp() {
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
@Override
|
||||
public void setOrientation(final EnumFacing forward, final EnumFacing up) {
|
||||
|
||||
@Override
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,26 +19,23 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.security.ISecurityRegistry;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayerSecurityWrapper implements ISecurityRegistry
|
||||
{
|
||||
|
||||
private final Map<Integer, EnumSet<SecurityPermissions>> target;
|
||||
public class PlayerSecurityWrapper implements ISecurityRegistry {
|
||||
|
||||
public PlayerSecurityWrapper( final Map<Integer, EnumSet<SecurityPermissions>> playerPerms )
|
||||
{
|
||||
this.target = playerPerms;
|
||||
}
|
||||
private final Map<Integer, EnumSet<SecurityPermissions>> target;
|
||||
|
||||
@Override
|
||||
public void addPlayer( final int playerID, final EnumSet<SecurityPermissions> permissions )
|
||||
{
|
||||
this.target.put( playerID, permissions );
|
||||
}
|
||||
public PlayerSecurityWrapper(final Map<Integer, EnumSet<SecurityPermissions>> playerPerms) {
|
||||
this.target = playerPerms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPlayer(final int playerID, final EnumSet<SecurityPermissions> permissions) {
|
||||
this.target.put(playerID, permissions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,8 @@ import java.lang.annotation.Target;
|
||||
/**
|
||||
* Marker interface to help identify invocation of reflection
|
||||
*/
|
||||
@Retention( RetentionPolicy.SOURCE )
|
||||
@Target( { ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.METHOD } )
|
||||
public @interface Reflected
|
||||
{
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.METHOD})
|
||||
public @interface Reflected {
|
||||
|
||||
}
|
||||
|
||||
@@ -19,101 +19,82 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
public class Splotch {
|
||||
|
||||
public class Splotch
|
||||
{
|
||||
private final EnumFacing side;
|
||||
private final boolean lumen;
|
||||
private final AEColor color;
|
||||
private final int pos;
|
||||
|
||||
private final EnumFacing side;
|
||||
private final boolean lumen;
|
||||
private final AEColor color;
|
||||
private final int pos;
|
||||
public Splotch(final AEColor col, final boolean lit, final EnumFacing side, final Vec3d position) {
|
||||
this.color = col;
|
||||
this.lumen = lit;
|
||||
|
||||
public Splotch( final AEColor col, final boolean lit, final EnumFacing side, final Vec3d position )
|
||||
{
|
||||
this.color = col;
|
||||
this.lumen = lit;
|
||||
final double x;
|
||||
final double y;
|
||||
|
||||
final double x;
|
||||
final double y;
|
||||
if (side == EnumFacing.SOUTH || side == EnumFacing.NORTH) {
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
} else if (side == EnumFacing.UP || side == EnumFacing.DOWN) {
|
||||
x = position.x;
|
||||
y = position.z;
|
||||
} else {
|
||||
x = position.y;
|
||||
y = position.z;
|
||||
}
|
||||
|
||||
if( side == EnumFacing.SOUTH || side == EnumFacing.NORTH )
|
||||
{
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
}
|
||||
final int a = (int) (x * 0xF);
|
||||
final int b = (int) (y * 0xF);
|
||||
this.pos = a | (b << 4);
|
||||
|
||||
else if( side == EnumFacing.UP || side == EnumFacing.DOWN )
|
||||
{
|
||||
x = position.x;
|
||||
y = position.z;
|
||||
}
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
x = position.y;
|
||||
y = position.z;
|
||||
}
|
||||
public Splotch(final ByteBuf data) {
|
||||
|
||||
final int a = (int) ( x * 0xF );
|
||||
final int b = (int) ( y * 0xF );
|
||||
this.pos = a | ( b << 4 );
|
||||
this.pos = data.readByte();
|
||||
final int val = data.readByte();
|
||||
|
||||
this.side = side;
|
||||
}
|
||||
this.side = EnumFacing.VALUES[val & 0x07];
|
||||
this.color = AEColor.values()[(val >> 3) & 0x0F];
|
||||
this.lumen = ((val >> 7) & 0x01) > 0;
|
||||
}
|
||||
|
||||
public Splotch( final ByteBuf data )
|
||||
{
|
||||
public void writeToStream(final ByteBuf stream) {
|
||||
stream.writeByte(this.pos);
|
||||
final int val = this.getSide().ordinal() | (this.getColor().ordinal() << 3) | (this.isLumen() ? 0x80 : 0x00);
|
||||
stream.writeByte(val);
|
||||
}
|
||||
|
||||
this.pos = data.readByte();
|
||||
final int val = data.readByte();
|
||||
public float x() {
|
||||
return (this.pos & 0x0f) / 15.0f;
|
||||
}
|
||||
|
||||
this.side = EnumFacing.VALUES[val & 0x07];
|
||||
this.color = AEColor.values()[( val >> 3 ) & 0x0F];
|
||||
this.lumen = ( ( val >> 7 ) & 0x01 ) > 0;
|
||||
}
|
||||
public float y() {
|
||||
return ((this.pos >> 4) & 0x0f) / 15.0f;
|
||||
}
|
||||
|
||||
public void writeToStream( final ByteBuf stream )
|
||||
{
|
||||
stream.writeByte( this.pos );
|
||||
final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 );
|
||||
stream.writeByte( val );
|
||||
}
|
||||
public int getSeed() {
|
||||
final int val = this.getSide().ordinal() | (this.getColor().ordinal() << 3) | (this.isLumen() ? 0x80 : 0x00);
|
||||
return Math.abs(this.pos + val);
|
||||
}
|
||||
|
||||
public float x()
|
||||
{
|
||||
return ( this.pos & 0x0f ) / 15.0f;
|
||||
}
|
||||
public EnumFacing getSide() {
|
||||
return this.side;
|
||||
}
|
||||
|
||||
public float y()
|
||||
{
|
||||
return ( ( this.pos >> 4 ) & 0x0f ) / 15.0f;
|
||||
}
|
||||
public AEColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public int getSeed()
|
||||
{
|
||||
final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 );
|
||||
return Math.abs( this.pos + val );
|
||||
}
|
||||
|
||||
public EnumFacing getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
public AEColor getColor()
|
||||
{
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public boolean isLumen()
|
||||
{
|
||||
return this.lumen;
|
||||
}
|
||||
public boolean isLumen() {
|
||||
return this.lumen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -48,300 +44,246 @@ import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware
|
||||
{
|
||||
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware {
|
||||
|
||||
private final ItemStack effectiveItem;
|
||||
private final IWirelessTermHandler wth;
|
||||
private final String encryptionKey;
|
||||
private final EntityPlayer myPlayer;
|
||||
private IGrid targetGrid;
|
||||
private IStorageGrid sg;
|
||||
private IMEMonitor<IAEItemStack> itemStorage;
|
||||
private IWirelessAccessPoint myWap;
|
||||
private double sqRange = Double.MAX_VALUE;
|
||||
private double myRange = Double.MAX_VALUE;
|
||||
private final int inventorySlot;
|
||||
private final ItemStack effectiveItem;
|
||||
private final IWirelessTermHandler wth;
|
||||
private final String encryptionKey;
|
||||
private final EntityPlayer myPlayer;
|
||||
private IGrid targetGrid;
|
||||
private IStorageGrid sg;
|
||||
private IMEMonitor<IAEItemStack> itemStorage;
|
||||
private IWirelessAccessPoint myWap;
|
||||
private double sqRange = Double.MAX_VALUE;
|
||||
private double myRange = Double.MAX_VALUE;
|
||||
private final int inventorySlot;
|
||||
|
||||
public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
this.encryptionKey = wh.getEncryptionKey( is );
|
||||
this.effectiveItem = is;
|
||||
this.myPlayer = ep;
|
||||
this.wth = wh;
|
||||
this.inventorySlot = x;
|
||||
public WirelessTerminalGuiObject(final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z) {
|
||||
this.encryptionKey = wh.getEncryptionKey(is);
|
||||
this.effectiveItem = is;
|
||||
this.myPlayer = ep;
|
||||
this.wth = wh;
|
||||
this.inventorySlot = x;
|
||||
|
||||
ILocatable obj = null;
|
||||
ILocatable obj = null;
|
||||
|
||||
try
|
||||
{
|
||||
final long encKey = Long.parseLong( this.encryptionKey );
|
||||
obj = AEApi.instance().registries().locatable().getLocatableBy( encKey );
|
||||
}
|
||||
catch( final NumberFormatException err )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
try {
|
||||
final long encKey = Long.parseLong(this.encryptionKey);
|
||||
obj = AEApi.instance().registries().locatable().getLocatableBy(encKey);
|
||||
} catch (final NumberFormatException err) {
|
||||
// :P
|
||||
}
|
||||
|
||||
if( obj instanceof IActionHost )
|
||||
{
|
||||
final IGridNode n = ( (IActionHost) obj ).getActionableNode();
|
||||
if( n != null )
|
||||
{
|
||||
this.targetGrid = n.getGrid();
|
||||
if( this.targetGrid != null )
|
||||
{
|
||||
this.sg = this.targetGrid.getCache( IStorageGrid.class );
|
||||
if( this.sg != null )
|
||||
{
|
||||
this.itemStorage = this.sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj instanceof IActionHost) {
|
||||
final IGridNode n = ((IActionHost) obj).getActionableNode();
|
||||
if (n != null) {
|
||||
this.targetGrid = n.getGrid();
|
||||
if (this.targetGrid != null) {
|
||||
this.sg = this.targetGrid.getCache(IStorageGrid.class);
|
||||
if (this.sg != null) {
|
||||
this.itemStorage = this.sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double getRange()
|
||||
{
|
||||
return this.myRange;
|
||||
}
|
||||
public double getRange() {
|
||||
return this.myRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
return this.sg.getInventory( channel );
|
||||
}
|
||||
@Override
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory(IStorageChannel<T> channel) {
|
||||
return this.sg.getInventory(channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener( final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
this.itemStorage.addListener( l, verificationToken );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addListener(final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken) {
|
||||
if (this.itemStorage != null) {
|
||||
this.itemStorage.addListener(l, verificationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener( final IMEMonitorHandlerReceiver<IAEItemStack> l )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
this.itemStorage.removeListener( l );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void removeListener(final IMEMonitorHandlerReceiver<IAEItemStack> l) {
|
||||
if (this.itemStorage != null) {
|
||||
this.itemStorage.removeListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getAvailableItems( out );
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(final IItemList<IAEItemStack> out) {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.getAvailableItems(out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getStorageList()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getStorageList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getStorageList() {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.getStorageList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getAccess()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getAccess();
|
||||
}
|
||||
return AccessRestriction.NO_ACCESS;
|
||||
}
|
||||
@Override
|
||||
public AccessRestriction getAccess() {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.getAccess();
|
||||
}
|
||||
return AccessRestriction.NO_ACCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized( final IAEItemStack input )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.isPrioritized( input );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isPrioritized(final IAEItemStack input) {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.isPrioritized(input);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept( final IAEItemStack input )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.canAccept( input );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canAccept(final IAEItemStack input) {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.canAccept(input);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getPriority();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getPriority() {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.getPriority();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlot()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getSlot();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getSlot() {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.getSlot();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass( final int i )
|
||||
{
|
||||
return this.itemStorage.validForPass( i );
|
||||
}
|
||||
@Override
|
||||
public boolean validForPass(final int i) {
|
||||
return this.itemStorage.validForPass(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.injectItems( input, type, src );
|
||||
}
|
||||
return input;
|
||||
}
|
||||
@Override
|
||||
public IAEItemStack injectItems(final IAEItemStack input, final Actionable type, final IActionSource src) {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.injectItems(input, type, src);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.extractItems( request, mode, src );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IAEItemStack extractItems(final IAEItemStack request, final Actionable mode, final IActionSource src) {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.extractItems(request, mode, src);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getChannel();
|
||||
}
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
@Override
|
||||
public IStorageChannel getChannel() {
|
||||
if (this.itemStorage != null) {
|
||||
return this.itemStorage.getChannel();
|
||||
}
|
||||
return AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower( final double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier )
|
||||
{
|
||||
if( this.wth != null && this.effectiveItem != null )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
return this.wth.hasPower( this.myPlayer, amt, this.effectiveItem ) ? amt : 0;
|
||||
}
|
||||
return this.wth.usePower( this.myPlayer, amt, this.effectiveItem ) ? amt : 0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
@Override
|
||||
public double extractAEPower(final double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier) {
|
||||
if (this.wth != null && this.effectiveItem != null) {
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
return this.wth.hasPower(this.myPlayer, amt, this.effectiveItem) ? amt : 0;
|
||||
}
|
||||
return this.wth.usePower(this.myPlayer, amt, this.effectiveItem) ? amt : 0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return this.effectiveItem;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return this.effectiveItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return this.wth.getConfigManager( this.effectiveItem );
|
||||
}
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
return this.wth.getConfigManager(this.effectiveItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getActionableNode()
|
||||
{
|
||||
this.rangeCheck();
|
||||
if( this.myWap != null )
|
||||
{
|
||||
return this.myWap.getActionableNode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IGridNode getActionableNode() {
|
||||
this.rangeCheck();
|
||||
if (this.myWap != null) {
|
||||
return this.myWap.getActionableNode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean rangeCheck()
|
||||
{
|
||||
this.sqRange = this.myRange = Double.MAX_VALUE;
|
||||
public boolean rangeCheck() {
|
||||
this.sqRange = this.myRange = Double.MAX_VALUE;
|
||||
|
||||
if( this.targetGrid != null && this.itemStorage != null )
|
||||
{
|
||||
if( this.myWap != null )
|
||||
{
|
||||
if( this.myWap.getGrid() == this.targetGrid )
|
||||
{
|
||||
if( this.testWap( this.myWap ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (this.targetGrid != null && this.itemStorage != null) {
|
||||
if (this.myWap != null) {
|
||||
if (this.myWap.getGrid() == this.targetGrid) {
|
||||
return this.testWap(this.myWap);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
final IMachineSet tw = this.targetGrid.getMachines( TileWireless.class );
|
||||
final IMachineSet tw = this.targetGrid.getMachines(TileWireless.class);
|
||||
|
||||
this.myWap = null;
|
||||
this.myWap = null;
|
||||
|
||||
for( final IGridNode n : tw )
|
||||
{
|
||||
final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||
if( this.testWap( wap ) )
|
||||
{
|
||||
this.myWap = wap;
|
||||
}
|
||||
}
|
||||
for (final IGridNode n : tw) {
|
||||
final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||
if (this.testWap(wap)) {
|
||||
this.myWap = wap;
|
||||
}
|
||||
}
|
||||
|
||||
return this.myWap != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return this.myWap != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean testWap( final IWirelessAccessPoint wap )
|
||||
{
|
||||
double rangeLimit = wap.getRange();
|
||||
rangeLimit *= rangeLimit;
|
||||
private boolean testWap(final IWirelessAccessPoint wap) {
|
||||
double rangeLimit = wap.getRange();
|
||||
rangeLimit *= rangeLimit;
|
||||
|
||||
final DimensionalCoord dc = wap.getLocation();
|
||||
final DimensionalCoord dc = wap.getLocation();
|
||||
|
||||
if( dc.getWorld() == this.myPlayer.world )
|
||||
{
|
||||
final double offX = dc.x - this.myPlayer.posX;
|
||||
final double offY = dc.y - this.myPlayer.posY;
|
||||
final double offZ = dc.z - this.myPlayer.posZ;
|
||||
if (dc.getWorld() == this.myPlayer.world) {
|
||||
final double offX = dc.x - this.myPlayer.posX;
|
||||
final double offY = dc.y - this.myPlayer.posY;
|
||||
final double offZ = dc.z - this.myPlayer.posZ;
|
||||
|
||||
final double r = offX * offX + offY * offY + offZ * offZ;
|
||||
if( r < rangeLimit && this.sqRange > r )
|
||||
{
|
||||
if( wap.isActive() )
|
||||
{
|
||||
this.sqRange = r;
|
||||
this.myRange = Math.sqrt( r );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final double r = offX * offX + offY * offY + offZ * offZ;
|
||||
if (r < rangeLimit && this.sqRange > r) {
|
||||
if (wap.isActive()) {
|
||||
this.sqRange = r;
|
||||
this.myRange = Math.sqrt(r);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventorySlot()
|
||||
{
|
||||
return this.inventorySlot;
|
||||
}
|
||||
@Override
|
||||
public int getInventorySlot() {
|
||||
return this.inventorySlot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user