diff --git a/src/main/java/appeng/block/AEBaseBlock.java b/src/main/java/appeng/block/AEBaseBlock.java index 9e51f71dc..ed07224b1 100644 --- a/src/main/java/appeng/block/AEBaseBlock.java +++ b/src/main/java/appeng/block/AEBaseBlock.java @@ -75,24 +75,25 @@ import com.google.common.base.Optional; public abstract class AEBaseBlock extends Block implements IAEFeature { - public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create("axis", EnumFacing.Axis.class); - + public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class ); + private final String featureFullName; - protected final Optional featureSubName; - protected boolean isOpaque = true; - protected boolean isFullSize = true; - protected boolean hasSubtypes = false; - protected boolean isInventory = false; + private final Optional featureSubName; + private boolean isOpaque = true; + private boolean isFullSize = true; + private boolean hasSubtypes = false; + private boolean isInventory = false; private IFeatureHandler handler; @SideOnly( Side.CLIENT ) - BlockRenderInfo renderInfo; - + private BlockRenderInfo renderInfo; + private String textureName; + @Override public boolean isVisuallyOpaque() { - return this.isOpaque && this.isFullSize; + return this.isOpaque() && this.isFullSize(); } - + protected AEBaseBlock( final Material mat ) { this( mat, Optional.absent() ); @@ -135,11 +136,11 @@ public abstract class AEBaseBlock extends Block implements IAEFeature public static final UnlistedBlockPos AE_BLOCK_POS = new UnlistedBlockPos(); public static final UnlistedBlockAccess AE_BLOCK_ACCESS = new UnlistedBlockAccess(); - + @Override protected final BlockState createBlockState() { - return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { AE_BLOCK_POS, AE_BLOCK_ACCESS} ); + return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { AE_BLOCK_POS, AE_BLOCK_ACCESS } ); } @Override @@ -148,14 +149,14 @@ public abstract class AEBaseBlock extends Block implements IAEFeature final IBlockAccess world, final BlockPos pos ) { - return ((IExtendedBlockState)super.getExtendedState( state, world, pos ) ).withProperty( AE_BLOCK_POS, pos ).withProperty( AE_BLOCK_ACCESS, world ); + return ( (IExtendedBlockState) super.getExtendedState( state, world, pos ) ).withProperty( AE_BLOCK_POS, pos ).withProperty( AE_BLOCK_ACCESS, world ); } - + protected IProperty[] getAEStates() { return new IProperty[0]; } - + @SideOnly( Side.CLIENT ) public BlockRenderInfo getRendererInstance() { @@ -167,7 +168,8 @@ public abstract class AEBaseBlock extends Block implements IAEFeature try { final Class re = this.getRenderer(); - if ( re == null ) return null; // use 1.8 models. + if( re == null ) + return null; // use 1.8 models. final BaseBlockRender renderer = re.newInstance(); this.renderInfo = new BlockRenderInfo( renderer ); @@ -182,7 +184,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature throw new IllegalStateException( "Failed to create a new instance of " + this.getRenderer() + " because of permissions.", e ); } } - + @Override public int colorMultiplier( final IBlockAccess worldIn, @@ -200,7 +202,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature protected void setFeature( final EnumSet f ) { - final AEBlockFeatureHandler featureHandler = new AEBlockFeatureHandler( f, this, this.featureSubName ); + final AEBlockFeatureHandler featureHandler = new AEBlockFeatureHandler( f, this, this.getFeatureSubName() ); this.setHandler( featureHandler ); } @@ -225,14 +227,14 @@ public abstract class AEBaseBlock extends Block implements IAEFeature { return this.isOpaque; } - + @Override public boolean isNormalCube() { - return this.isFullSize && this.isOpaque; + return this.isFullSize() && this.isOpaque(); } - - protected ICustomCollision getCustomCollision( final World w, final BlockPos pos ) + + protected ICustomCollision getCustomCollision( final World w, final BlockPos pos ) { if( this instanceof ICustomCollision ) { @@ -244,12 +246,12 @@ public abstract class AEBaseBlock extends Block implements IAEFeature @SideOnly( Side.CLIENT ) public IAESprite getIcon( final IBlockAccess w, final BlockPos pos, final EnumFacing side ) { - final IBlockState state =w.getBlockState( pos ); + final IBlockState state = w.getBlockState( pos ); final IOrientable ori = this.getOrientable( w, pos ); - - if ( ori == null ) - return this.getIcon( side,state ); - + + if( ori == null ) + return this.getIcon( side, state ); + return this.getIcon( this.mapRotation( ori, side ), state ); } @@ -288,7 +290,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature super.addCollisionBoxesToList( w, pos, state, bb, out, e ); } } - + @Override @SideOnly( Side.CLIENT ) public AxisAlignedBB getSelectedBoundingBox( @@ -313,15 +315,15 @@ public abstract class AEBaseBlock extends Block implements IAEFeature { this.setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ ); - final MovingObjectPosition r = super.collisionRayTrace( w, pos, ld.a, ld.b ); + final MovingObjectPosition r = super.collisionRayTrace( w, pos, ld.getA(), ld.getB() ); this.setBlockBounds( 0, 0, 0, 1, 1, 1 ); if( r != null ) { - final double xLen = ( ld.a.xCoord - r.hitVec.xCoord ); - final double yLen = ( ld.a.yCoord - r.hitVec.yCoord ); - final double zLen = ( ld.a.zCoord - r.hitVec.zCoord ); + final double xLen = ( ld.getA().xCoord - r.hitVec.xCoord ); + final double yLen = ( ld.getA().yCoord - r.hitVec.yCoord ); + final double zLen = ( ld.getA().zCoord - r.hitVec.zCoord ); final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen; @@ -344,12 +346,12 @@ public abstract class AEBaseBlock extends Block implements IAEFeature for( final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) ) { - if ( b == null ) + if( b == null ) { b = bx; continue; } - + final double minX = Math.min( b.minX, bx.minX ); final double minY = Math.min( b.minY, bx.minY ); final double minZ = Math.min( b.minZ, bx.minZ ); @@ -360,10 +362,10 @@ public abstract class AEBaseBlock extends Block implements IAEFeature b = AxisAlignedBB.fromBounds( minX, minY, minZ, maxX, maxY, maxZ ); } - if ( b == null ) + if( b == null ) b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d ); else - b = AxisAlignedBB.fromBounds( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX+ pos.getX(), b.maxY + pos.getY(), b.maxZ + pos.getZ() ); + b = AxisAlignedBB.fromBounds( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos.getZ() ); return b; } @@ -374,7 +376,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature @Override public final boolean isOpaqueCube() { - return this.isOpaque; + return this.isOpaque(); } @Override @@ -432,7 +434,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature { return false; } - + @Override @SideOnly( Side.CLIENT ) @SuppressWarnings( "unchecked" ) @@ -446,7 +448,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature { return this.isInventory; } - + @Override public int getComparatorInputOverride( final World worldIn, @@ -454,13 +456,13 @@ public abstract class AEBaseBlock extends Block implements IAEFeature { return 0; } - + @Override public boolean isNormalCube( final IBlockAccess world, final BlockPos pos ) { - return this.isFullSize; + return this.isFullSize(); } public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) @@ -563,7 +565,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature } public EnumFacing mapRotation( - final IOrientable ori, + final IOrientable ori, final EnumFacing dir ) { // case DOWN: return bottomIcon; @@ -593,8 +595,8 @@ public abstract class AEBaseBlock extends Block implements IAEFeature west = dx; } } - - if ( west == null ) + + if( west == null ) return dir; if( dir == forward ) @@ -664,7 +666,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature final IResource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc ); if( res != null ) { - return new FlippableIcon( new BaseIcon( ir.registerSprite( new ResourceLocation(AppEng.MOD_ID, "blocks/" + name ) ) ) ); + return new FlippableIcon( new BaseIcon( ir.registerSprite( new ResourceLocation( AppEng.MOD_ID, "blocks/" + name ) ) ) ); } } catch( final Throwable e ) @@ -673,19 +675,40 @@ public abstract class AEBaseBlock extends Block implements IAEFeature } } - final ResourceLocation resLoc = new ResourceLocation(AppEng.MOD_ID, "blocks/" + name ); - return new FlippableIcon(new BaseIcon( ir.registerSprite( resLoc ) ) ); + final ResourceLocation resLoc = new ResourceLocation( AppEng.MOD_ID, "blocks/" + name ); + return new FlippableIcon( new BaseIcon( ir.registerSprite( resLoc ) ) ); } - - String textureName; + public void setBlockTextureName( final String texture ) { this.textureName = texture; } - + private String getTextureName() { return this.textureName; } + public boolean isFullSize() + { + return isFullSize; + } + + public boolean setFullSize( boolean isFullSize ) + { + this.isFullSize = isFullSize; + return isFullSize; + } + + public boolean setOpaque( boolean isOpaque ) + { + this.isOpaque = isOpaque; + return isOpaque; + } + + public Optional getFeatureSubName() + { + return featureSubName; + } + } diff --git a/src/main/java/appeng/block/AEBaseSlabBlock.java b/src/main/java/appeng/block/AEBaseSlabBlock.java new file mode 100644 index 000000000..b07718498 --- /dev/null +++ b/src/main/java/appeng/block/AEBaseSlabBlock.java @@ -0,0 +1,137 @@ +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + +package appeng.block; + + +import java.util.EnumSet; +import java.util.Random; + +import net.minecraft.block.BlockSlab; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +import appeng.client.texture.IAESprite; +import appeng.core.features.AEFeature; +import appeng.core.features.IAEFeature; +import appeng.core.features.IFeatureHandler; + + +public class AEBaseSlabBlock extends BlockSlab implements IAEFeature +{ + private final IFeatureHandler features; + private final AEBaseBlock block; + private final int meta; + private AEBaseSlabBlock slabs; + private AEBaseSlabBlock doubleSlabs; + private final String name; + + public AEBaseSlabBlock( final AEBaseBlock block, final int meta, final EnumSet features, final boolean isDoubleSlab, final String name ) + { + super( isDoubleSlab, block.getMaterial() ); + this.block = block; + this.meta = meta; + this.name = name; + this.setBlockName( "appliedenergistics2." + name ); + this.setHardness( block.getBlockHardness( null, 0, 0, 0 ) ); + this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F ); + this.setStepSound( block.stepSound ); + this.useNeighborBrightness = true; + if( !this.field_150004_a ) + { + this.doubleSlabs = new AEBaseSlabBlock( block, meta, features, true, name + ".double" ).setSlabs( this ); + } + this.features = !this.field_150004_a ? new SlabBlockFeatureHandler( features, this ) : null; + } + + private AEBaseSlabBlock setSlabs( final AEBaseSlabBlock slabs ) + { + this.slabs = slabs; + return this; + } + + public AEBaseSlabBlock slabs() + { + return this.slabs; + } + + public AEBaseSlabBlock doubleSlabs() + { + return this.doubleSlabs; + } + + @Override + public IFeatureHandler handler() + { + return this.features; + } + + @Override + public void postInit() + { + // Override to do stuff + } + + @Override + public IAESprite getIcon( final int dir, final int meta ) + { + return this.block.getIcon( dir, this.meta ); + } + + @Override + public String func_150002_b( final int p_150002_1_ ) + { + return this.getUnlocalizedName(); + } + + @Override + public void registerBlockIcons( final IIconRegister reg ) + { + } + + @Override + public Item getItemDropped( final int meta, final Random rand, final int fortune ) + { + return this.field_150004_a ? Item.getItemFromBlock( this.slabs ) : Item.getItemFromBlock( this ); + } + + @Override + public ItemStack getPickBlock( final MovingObjectPosition target, final World world, final int x, final int y, final int z ) + { + AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock( x, y, z ); + + if( block == null ) + { + return null; + } + if( block.field_150004_a ) + { + block = this.slabs; + } + + final int meta = world.getBlockMetadata( x, y, z ) & 7; + return new ItemStack( block, 1, meta ); + } + + public String name() + { + return this.name; + } +} diff --git a/src/main/java/appeng/block/AEBaseTileBlock.java b/src/main/java/appeng/block/AEBaseTileBlock.java index e81e01fb0..7a75f1b69 100644 --- a/src/main/java/appeng/block/AEBaseTileBlock.java +++ b/src/main/java/appeng/block/AEBaseTileBlock.java @@ -84,7 +84,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature, @Override protected void setFeature( final EnumSet f ) { - final AETileBlockFeatureHandler featureHandler = new AETileBlockFeatureHandler( f, this, this.featureSubName ); + final AETileBlockFeatureHandler featureHandler = new AETileBlockFeatureHandler( f, this, this.getFeatureSubName() ); this.setHandler( featureHandler ); } @@ -102,7 +102,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature, ReflectionHelper.setPrivateValue( Block.class, this, b, "isTileProvider" ); } - public boolean hasBlockTileEntity() + private boolean hasBlockTileEntity() { return this.tileEntityType != null; } diff --git a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java index 9611e8dd4..544c705e9 100644 --- a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java +++ b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java @@ -48,16 +48,17 @@ public class BlockMolecularAssembler extends AEBaseTileBlock super( Material.iron ); this.setTileEntity( TileMolecularAssembler.class ); - this.isOpaque = false; + this.setOpaque( false ); this.lightOpacity = 1; this.setFeature( EnumSet.of( AEFeature.MolecularAssembler ) ); } @Override - public boolean canRenderInLayer( final net.minecraft.util.EnumWorldBlockLayer layer) { - return layer == EnumWorldBlockLayer.CUTOUT_MIPPED; + public boolean canRenderInLayer( final net.minecraft.util.EnumWorldBlockLayer layer ) + { + return layer == EnumWorldBlockLayer.CUTOUT_MIPPED; } - + @Override @SideOnly( Side.CLIENT ) public Class getRenderer() diff --git a/src/main/java/appeng/block/grindstone/BlockCrank.java b/src/main/java/appeng/block/grindstone/BlockCrank.java index 16fb8db0c..77d7b7229 100644 --- a/src/main/java/appeng/block/grindstone/BlockCrank.java +++ b/src/main/java/appeng/block/grindstone/BlockCrank.java @@ -52,7 +52,7 @@ public class BlockCrank extends AEBaseTileBlock this.setTileEntity( TileCrank.class ); this.setLightOpacity( 0 ); this.setHarvestLevel( "axe", 0 ); - this.isFullSize = this.isOpaque = false; + this.setFullSize( this.setOpaque( false ) ); this.setFeature( EnumSet.of( AEFeature.GrindStone ) ); } diff --git a/src/main/java/appeng/block/misc/BlockCharger.java b/src/main/java/appeng/block/misc/BlockCharger.java index fd40d026e..cda2bac12 100644 --- a/src/main/java/appeng/block/misc/BlockCharger.java +++ b/src/main/java/appeng/block/misc/BlockCharger.java @@ -59,7 +59,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision this.setTileEntity( TileCharger.class ); this.setLightOpacity( 2 ); - this.isFullSize = this.isOpaque = false; + this.setFullSize( this.setOpaque( false ) ); this.setFeature( EnumSet.of( AEFeature.Core ) ); } diff --git a/src/main/java/appeng/block/misc/BlockInscriber.java b/src/main/java/appeng/block/misc/BlockInscriber.java index 5b4c7fb77..a6f7a8ae2 100644 --- a/src/main/java/appeng/block/misc/BlockInscriber.java +++ b/src/main/java/appeng/block/misc/BlockInscriber.java @@ -46,7 +46,7 @@ public class BlockInscriber extends AEBaseTileBlock this.setTileEntity( TileInscriber.class ); this.setLightOpacity( 2 ); - this.isFullSize = this.isOpaque = false; + this.setFullSize( this.setOpaque( false ) ); this.setFeature( EnumSet.of( AEFeature.Inscriber ) ); } diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java index bba01102e..634e891e1 100644 --- a/src/main/java/appeng/block/misc/BlockLightDetector.java +++ b/src/main/java/appeng/block/misc/BlockLightDetector.java @@ -53,8 +53,8 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl super( Material.circuits ); this.setLightOpacity( 0 ); - this.isFullSize = false; - this.isOpaque = false; + this.setFullSize( false ); + this.setOpaque( false ); this.setTileEntity( TileLightDetector.class ); this.setFeature( EnumSet.of( AEFeature.LightDetector ) ); diff --git a/src/main/java/appeng/block/misc/BlockPaint.java b/src/main/java/appeng/block/misc/BlockPaint.java index 6da37b54c..f623a82e1 100644 --- a/src/main/java/appeng/block/misc/BlockPaint.java +++ b/src/main/java/appeng/block/misc/BlockPaint.java @@ -54,8 +54,8 @@ public class BlockPaint extends AEBaseTileBlock this.setTileEntity( TilePaint.class ); this.setLightOpacity( 0 ); - this.isFullSize = false; - this.isOpaque = false; + this.setFullSize( false ); + this.setOpaque( false ); this.setFeature( EnumSet.of( AEFeature.PaintBalls ) ); } diff --git a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java index 397009f90..32999a205 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java +++ b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java @@ -70,7 +70,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock final TileQuartzGrowthAccelerator cga = this.getTileEntity( w, pos ); - if( cga != null && cga.hasPower && CommonHelper.proxy.shouldAddParticles( r ) ) + if( cga != null && cga.isPowered() && CommonHelper.proxy.shouldAddParticles( r ) ) { final double d0 = r.nextFloat() - 0.5F; final double d1 = r.nextFloat() - 0.5F; @@ -93,46 +93,41 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock double dz = 0; double dx = 0; + BlockPos pt = null; + switch( r.nextInt( 4 ) ) { case 0: dx = 0.6; dz = d1; - final BlockPos pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() ); - if( !w.getBlockState(pt).getBlock().isAir( w, pt) ) - { - return; - } + pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() ); + break; case 1: dx = d1; dz += 0.6; - pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() ); - if( !w.getBlockState(pt).getBlock().isAir( w, pt) ) - { - return; - } + pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() ); + break; case 2: dx = d1; dz = -0.6; - pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() ); - if( !w.getBlockState(pt).getBlock().isAir( w, pt) ) - { - return; - } + pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() ); + break; case 3: dx = -0.6; dz = d1; - pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() ); - if( !w.getBlockState(pt).getBlock().isAir( w, pt) ) - { - return; - } + pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() ); + break; } + if( !w.getBlockState( pt ).getBlock().isAir( w, pt ) ) + { + return; + } + rx += dx * west.getFrontOffsetX(); ry += dx * west.getFrontOffsetY(); rz += dx * west.getFrontOffsetZ(); diff --git a/src/main/java/appeng/block/misc/BlockQuartzTorch.java b/src/main/java/appeng/block/misc/BlockQuartzTorch.java index 512dc0da2..edc7a6710 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzTorch.java +++ b/src/main/java/appeng/block/misc/BlockQuartzTorch.java @@ -60,8 +60,8 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I this.setFeature( EnumSet.of( AEFeature.DecorativeLights ) ); this.setLightLevel( 0.9375F ); this.setLightOpacity( 0 ); - this.isFullSize = false; - this.isOpaque = false; + this.setFullSize( false ); + this.setOpaque( false ); } @Override diff --git a/src/main/java/appeng/block/misc/BlockSkyCompass.java b/src/main/java/appeng/block/misc/BlockSkyCompass.java index 6c6a1fe57..810739054 100644 --- a/src/main/java/appeng/block/misc/BlockSkyCompass.java +++ b/src/main/java/appeng/block/misc/BlockSkyCompass.java @@ -46,7 +46,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision { super( Material.iron ); this.setTileEntity( TileSkyCompass.class ); - this.isOpaque = this.isFullSize = false; + this.setOpaque( this.setFullSize( false ) ); this.lightOpacity = 0; this.setFeature( EnumSet.of( AEFeature.MeteoriteCompass ) ); } diff --git a/src/main/java/appeng/block/misc/BlockTinyTNT.java b/src/main/java/appeng/block/misc/BlockTinyTNT.java index e9a139ac9..1852a45b4 100644 --- a/src/main/java/appeng/block/misc/BlockTinyTNT.java +++ b/src/main/java/appeng/block/misc/BlockTinyTNT.java @@ -58,12 +58,12 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision super( Material.tnt ); this.setLightOpacity( 1 ); this.setBlockBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f ); - this.isFullSize = this.isOpaque = false; + this.setFullSize( this.setOpaque( false ) ); this.setStepSound( soundTypeGrass ); this.setHardness( 0F ); this.setFeature( EnumSet.of( AEFeature.TinyTNT ) ); - EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.TINY_TNT, AppEng.instance(), 16, 4, true ); + EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true ); } @Override diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java index 61e2c1c83..0b04a697c 100644 --- a/src/main/java/appeng/block/networking/BlockCableBus.java +++ b/src/main/java/appeng/block/networking/BlockCableBus.java @@ -57,6 +57,7 @@ import appeng.core.CommonHelper; import appeng.core.features.AECableBusFeatureHandler; import appeng.core.features.AEFeature; import appeng.helpers.AEGlassMaterial; +import appeng.helpers.Reflected; import appeng.integration.IntegrationRegistry; import appeng.integration.IntegrationType; import appeng.integration.abstraction.IFMP; @@ -70,22 +71,27 @@ import appeng.util.Platform; // TODO: MFR INTEGRATION //@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = IntegrationType.MFR ) -public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnection +public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnection { private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer(); - public static Class noTesrTile; - public static Class tesrTile; + private static Class noTesrTile; + private static Class tesrTile; + /** * Immibis MB Support. + * + * It will look for a field named ImmibisMicroblocks_TransformableBlockMarker or + * ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc can be ignored. */ - boolean ImmibisMicroblocks_TransformableBlockMarker = true; + @Reflected + private static final boolean ImmibisMicroblocks_TransformableBlockMarker = true; public BlockCableBus() { super( AEGlassMaterial.INSTANCE ); this.setLightOpacity( 0 ); - this.isFullSize = this.isOpaque = false; + this.setFullSize( this.setOpaque( false ) ); // this will actually be overwritten later through setupTile and the combined layers this.setTileEntity( TileCableBus.class ); @@ -153,7 +159,7 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio final IBlockState state, final EnumFacing side ) { - return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!? + return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!? } @Override @@ -218,9 +224,9 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio final BlockPos pos, EnumFacing side ) { - if ( side == null ) + if( side == null ) side = EnumFacing.UP; - + return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) ); } @@ -268,41 +274,37 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio // TODO HIT EFFECTS /* - for( AEPartLocation side : AEPartLocation.values() ) - { - IPart p = host.getPart( side ); - TextureAtlasSprite ico = this.getIcon( p ); - - if( ico == null ) - { - continue; - } - - byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 ); - - for( int i1 = 0; i1 < b0; ++i1 ) - { - for( int j1 = 0; j1 < b0; ++j1 ) - { - for( int k1 = 0; k1 < b0; ++k1 ) - { - double d0 = target.blockX + ( i1 + 0.5D ) / b0; - double d1 = target.blockY + ( j1 + 0.5D ) / b0; - double d2 = target.blockZ + ( k1 + 0.5D ) / b0; - - double dd0 = target.hitVec.xCoord; - double dd1 = target.hitVec.yCoord; - double dd2 = target.hitVec.zCoord; - EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 - target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX, target.blockY, target.blockZ ); - - fx.setParticleIcon( ico ); - - effectRenderer.addEffect( fx ); - } - } - } - } - */ + * for( AEPartLocation side : AEPartLocation.values() ) + * { + * IPart p = host.getPart( side ); + * TextureAtlasSprite ico = this.getIcon( p ); + * if( ico == null ) + * { + * continue; + * } + * byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 ); + * for( int i1 = 0; i1 < b0; ++i1 ) + * { + * for( int j1 = 0; j1 < b0; ++j1 ) + * { + * for( int k1 = 0; k1 < b0; ++k1 ) + * { + * double d0 = target.blockX + ( i1 + 0.5D ) / b0; + * double d1 = target.blockY + ( j1 + 0.5D ) / b0; + * double d2 = target.blockZ + ( k1 + 0.5D ) / b0; + * double dd0 = target.hitVec.xCoord; + * double dd1 = target.hitVec.yCoord; + * double dd2 = target.hitVec.zCoord; + * EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 - + * target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX, + * target.blockY, target.blockZ ); + * fx.setParticleIcon( ico ); + * effectRenderer.addEffect( fx ); + * } + * } + * } + * } + */ } return true; @@ -321,37 +323,33 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio // TODO DESTROY EFFECTS /* - for( AEPartLocation side : AEPartLocation.values() ) - { - IPart p = host.getPart( side ); - TextureAtlasSprite ico = this.getIcon( p ); - - if( ico == null ) - { - continue; - } - - byte b0 = 3; - - for( int i1 = 0; i1 < b0; ++i1 ) - { - for( int j1 = 0; j1 < b0; ++j1 ) - { - for( int k1 = 0; k1 < b0; ++k1 ) - { - double d0 = x + ( i1 + 0.5D ) / b0; - double d1 = y + ( j1 + 0.5D ) / b0; - double d2 = z + ( k1 + 0.5D ) / b0; - EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, meta ) ).applyColourMultiplier( x, y, z ); - - fx.setParticleIcon( ico ); - - effectRenderer.addEffect( fx ); - } - } - } - } - */ + * for( AEPartLocation side : AEPartLocation.values() ) + * { + * IPart p = host.getPart( side ); + * TextureAtlasSprite ico = this.getIcon( p ); + * if( ico == null ) + * { + * continue; + * } + * byte b0 = 3; + * for( int i1 = 0; i1 < b0; ++i1 ) + * { + * for( int j1 = 0; j1 < b0; ++j1 ) + * { + * for( int k1 = 0; k1 < b0; ++k1 ) + * { + * double d0 = x + ( i1 + 0.5D ) / b0; + * double d1 = y + ( j1 + 0.5D ) / b0; + * double d2 = z + ( k1 + 0.5D ) / b0; + * EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z - + * 0.5D, this, meta ) ).applyColourMultiplier( x, y, z ); + * fx.setParticleIcon( ico ); + * effectRenderer.addEffect( fx ); + * } + * } + * } + * } + */ } return true; @@ -377,7 +375,7 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio if( te instanceof TileCableBus ) { - out = ( (TileCableBus) te ).cb; + out = ( (TileCableBus) te ).getCableBus(); } else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) { @@ -425,10 +423,11 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio { try { - return this.cb( world, pos ).recolourBlock( side, AEColor.values()[ color.ordinal() ], who ); + return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who ); } catch( final Throwable ignored ) - {} + { + } return false; } @@ -460,7 +459,7 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio @Override protected void setFeature( final EnumSet f ) { - final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.featureSubName ); + final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.getFeatureSubName() ); this.setHandler( featureHandler ); } @@ -476,17 +475,28 @@ public class BlockCableBus extends AEBaseTileBlock //implements IRedNetConnectio CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this ); } } - -// TODO MFR Integration -// @Override -// @Method( iname = IntegrationType.MFR ) -// public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side ) -// { -// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? RedNetConnectionType.CableSingle : RedNetConnectionType.None; -// } -// -// public void setRenderColor( int color ) -// { -// this.myColorMultiplier = color; -// } + + public static Class getTesrTile() + { + return tesrTile; + } + + public static Class getNoTesrTile() + { + return noTesrTile; + } + + // TODO MFR Integration + // @Override + // @Method( iname = IntegrationType.MFR ) + // public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side ) + // { + // return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? + // RedNetConnectionType.CableSingle : RedNetConnectionType.None; + // } + // + // public void setRenderColor( int color ) + // { + // this.myColorMultiplier = color; + // } } diff --git a/src/main/java/appeng/block/networking/BlockWireless.java b/src/main/java/appeng/block/networking/BlockWireless.java index 9c88337a6..c5f3677d8 100644 --- a/src/main/java/appeng/block/networking/BlockWireless.java +++ b/src/main/java/appeng/block/networking/BlockWireless.java @@ -51,8 +51,8 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision super( AEGlassMaterial.INSTANCE ); this.setTileEntity( TileWireless.class ); this.setLightOpacity( 0 ); - this.isFullSize = false; - this.isOpaque = false; + this.setFullSize( false ); + this.setOpaque( false ); this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) ); } diff --git a/src/main/java/appeng/block/qnb/BlockQuantumBase.java b/src/main/java/appeng/block/qnb/BlockQuantumBase.java index 16d9b69f1..572571761 100644 --- a/src/main/java/appeng/block/qnb/BlockQuantumBase.java +++ b/src/main/java/appeng/block/qnb/BlockQuantumBase.java @@ -44,7 +44,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto final float shave = 2.0f / 16.0f; this.setBlockBounds( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave ); this.setLightOpacity( 0 ); - this.isFullSize = this.isOpaque = false; + this.setFullSize( this.setOpaque( false ) ); this.setFeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) ); } diff --git a/src/main/java/appeng/block/spatial/BlockMatrixFrame.java b/src/main/java/appeng/block/spatial/BlockMatrixFrame.java index 5870bc88d..bf08d4357 100644 --- a/src/main/java/appeng/block/spatial/BlockMatrixFrame.java +++ b/src/main/java/appeng/block/spatial/BlockMatrixFrame.java @@ -51,7 +51,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision this.setResistance( 6000000.0F ); this.setBlockUnbreakable(); this.setLightOpacity( 0 ); - this.isOpaque = false; + this.setOpaque( false ); this.setFeature( EnumSet.of( AEFeature.SpatialIO ) ); } diff --git a/src/main/java/appeng/block/storage/BlockSkyChest.java b/src/main/java/appeng/block/storage/BlockSkyChest.java index 8181d9d43..f627416cc 100644 --- a/src/main/java/appeng/block/storage/BlockSkyChest.java +++ b/src/main/java/appeng/block/storage/BlockSkyChest.java @@ -58,7 +58,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision { super( Material.rock, Optional.of( type.name() ) ); this.setTileEntity( TileSkyChest.class ); - this.isOpaque = this.isFullSize = false; + this.setOpaque( this.setFullSize( false ) ); this.lightOpacity = 0; this.hasSubtypes = true; this.setHardness( 50 ); diff --git a/src/main/java/appeng/client/ClientHelper.java b/src/main/java/appeng/client/ClientHelper.java index 3632ed69d..d77a9d1a5 100644 --- a/src/main/java/appeng/client/ClientHelper.java +++ b/src/main/java/appeng/client/ClientHelper.java @@ -158,7 +158,7 @@ public class ClientHelper extends ServerHelper @Override public void bindTileEntitySpecialRenderer( final Class tile, final AEBaseBlock blk ) { - final BaseBlockRender bbr = blk.getRendererInstance().rendererInstance; + final BaseBlockRender bbr = blk.getRendererInstance().getRendererInstance(); if( bbr.hasTESR() && tile != null ) { ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) ); @@ -293,7 +293,7 @@ public class ClientHelper extends ServerHelper this.addIcon( reg.name ); - mesher.register( reg.item instanceof Item ? (Item) reg.item : Item.getItemFromBlock( (Block) reg.item ), stack -> renderer.rendererInstance.getResourcePath() ); + mesher.register( reg.item instanceof Item ? (Item) reg.item : Item.getItemFromBlock( (Block) reg.item ), stack -> renderer.getRendererInstance().getResourcePath() ); continue; } @@ -512,7 +512,7 @@ public class ClientHelper extends ServerHelper } final SmartModel sm = new SmartModel( renderer ); - event.modelRegistry.putObject( renderer.rendererInstance.getResourcePath(), sm ); + event.modelRegistry.putObject( renderer.getRendererInstance().getResourcePath(), sm ); final Map data = new DefaultStateMapper().putStateModelLocations( (Block) reg.item ); for( final Object Loc : data.values() ) diff --git a/src/main/java/appeng/client/SmartModel.java b/src/main/java/appeng/client/SmartModel.java index 5ad198cd7..d9cd397f0 100644 --- a/src/main/java/appeng/client/SmartModel.java +++ b/src/main/java/appeng/client/SmartModel.java @@ -1,5 +1,7 @@ + package appeng.client; + import java.util.Collections; import java.util.List; @@ -19,6 +21,7 @@ import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.client.model.ISmartItemModel; import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.common.property.IExtendedBlockState; + import appeng.api.util.AEPartLocation; import appeng.block.AEBaseBlock; import appeng.block.AEBaseTileBlock; @@ -26,72 +29,73 @@ import appeng.client.render.BlockRenderInfo; import appeng.client.render.ModelGenerator; import appeng.client.texture.MissingIcon; + // net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer -public class SmartModel implements IBakedModel, ISmartBlockModel,ISmartItemModel +public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemModel { - - BlockRenderInfo AERenderer; - private class DefState implements IModelState - { + private BlockRenderInfo aeRenderer; - @Override - public TRSRTransformation apply( - final IModelPart part ) - { - return TRSRTransformation.identity(); - } + private class DefState implements IModelState + { - }; + @Override + public TRSRTransformation apply( + final IModelPart part ) + { + return TRSRTransformation.identity(); + } - public SmartModel( + }; + + public SmartModel( final BlockRenderInfo rendererInstance ) { - this.AERenderer = rendererInstance; + this.aeRenderer = rendererInstance; } @Override - public List getFaceQuads( - final EnumFacing p_177551_1_ ) - { - return Collections.emptyList(); - } + public List getFaceQuads( + final EnumFacing p_177551_1_ ) + { + return Collections.emptyList(); + } - @Override - public List getGeneralQuads() - { - return Collections.emptyList(); - } + @Override + public List getGeneralQuads() + { + return Collections.emptyList(); + } - @Override - public boolean isAmbientOcclusion() - { - return true; - } + @Override + public boolean isAmbientOcclusion() + { + return true; + } - @Override - public boolean isGui3d() - { - return true; - } + @Override + public boolean isGui3d() + { + return true; + } - @Override - public boolean isBuiltInRenderer() - { - return false; - } + @Override + public boolean isBuiltInRenderer() + { + return false; + } - @Override - public TextureAtlasSprite getTexture() - { - return this.AERenderer != null ? this.AERenderer.getTexture( AEPartLocation.UP ).getAtlas() : MissingIcon.getMissing(); - } + @Override + public TextureAtlasSprite getTexture() + { + return this.aeRenderer != null ? this.aeRenderer.getTexture( AEPartLocation.UP ).getAtlas() : MissingIcon.getMissing(); + } - @Override - public ItemCameraTransforms getItemCameraTransforms() - { - return ItemCameraTransforms.DEFAULT; - } + @Override + public ItemCameraTransforms getItemCameraTransforms() + { + return ItemCameraTransforms.DEFAULT; + } @Override public IBakedModel handleItemState( @@ -100,7 +104,7 @@ public class SmartModel implements IBakedModel, ISmartBlockModel,ISmartItemModel final ModelGenerator helper = new ModelGenerator(); final Block blk = Block.getBlockFromItem( stack.getItem() ); helper.setRenderBoundsFromBlock( blk ); - this.AERenderer.rendererInstance.renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null ); + this.aeRenderer.getRendererInstance().renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null ); helper.finalizeModel( true ); return helper.getOutput(); } @@ -111,12 +115,12 @@ public class SmartModel implements IBakedModel, ISmartBlockModel,ISmartItemModel { final ModelGenerator helper = new ModelGenerator(); final Block blk = state.getBlock(); - final BlockPos pos = ( (IExtendedBlockState)state ).getValue( AEBaseTileBlock.AE_BLOCK_POS ); - final IBlockAccess world = ( (IExtendedBlockState)state ).getValue( AEBaseTileBlock.AE_BLOCK_ACCESS); + final BlockPos pos = ( (IExtendedBlockState) state ).getValue( AEBaseTileBlock.AE_BLOCK_POS ); + final IBlockAccess world = ( (IExtendedBlockState) state ).getValue( AEBaseTileBlock.AE_BLOCK_ACCESS ); helper.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() ); helper.setRenderBoundsFromBlock( blk ); - helper.blockAccess = world; - this.AERenderer.rendererInstance.renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper); + helper.setBlockAccess( world ); + this.aeRenderer.getRendererInstance().renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper ); helper.finalizeModel( false ); return helper.getOutput(); } diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index a6379da7d..cbc33b131 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -83,17 +83,17 @@ import com.google.common.base.Stopwatch; public abstract class AEBaseGui extends GuiContainer { - public static boolean switchingGuis; - protected final List meSlots = new LinkedList(); + private static boolean switchingGuis; + private final List meSlots = new LinkedList(); // drag y - final Set drag_click = new HashSet(); - final AppEngRenderItem aeRenderItem = new AppEngRenderItem(Minecraft.getMinecraft().renderEngine,Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager()); - protected GuiScrollbar myScrollBar = null; - boolean disableShiftClick = false; - Stopwatch dbl_clickTimer = Stopwatch.createStarted(); - ItemStack dbl_whichItem; - Slot bl_clicked; - boolean useNEI = false; + private final Set drag_click = new HashSet(); + private final AppEngRenderItem aeRenderItem = new AppEngRenderItem( Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager() ); + private GuiScrollbar myScrollBar = null; + private boolean disableShiftClick = false; + private Stopwatch dbl_clickTimer = Stopwatch.createStarted(); + private ItemStack dbl_whichItem; + private Slot bl_clicked; + private boolean useNEI = false; private boolean subGui; public AEBaseGui( final Container container ) @@ -161,9 +161,9 @@ public abstract class AEBaseGui extends GuiContainer super.drawScreen( mouseX, mouseY, btn ); final boolean hasClicked = Mouse.isButtonDown( 0 ); - if( hasClicked && this.myScrollBar != null ) + if( hasClicked && this.getScrollBar() != null ) { - this.myScrollBar.click( this, mouseX - this.guiLeft, mouseY - this.guiTop ); + this.getScrollBar().click( this, mouseX - this.guiLeft, mouseY - this.guiTop ); } for( final Object c : this.buttonList ) @@ -290,9 +290,9 @@ public abstract class AEBaseGui extends GuiContainer final int oy = this.guiTop; // (height - ySize) / 2; GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); - if( this.myScrollBar != null ) + if( this.getScrollBar() != null ) { - this.myScrollBar.draw( this ); + this.getScrollBar().draw( this ); } this.drawFG( ox, oy, x, y ); @@ -318,14 +318,14 @@ public abstract class AEBaseGui extends GuiContainer { if( fs.isEnabled() ) { - this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.srcX - 1, fs.srcY - 1, 18, 18 ); + this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 ); } else { GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); GL11.glColor4f( 1.0F, 1.0F, 1.0F, 0.4F ); GL11.glEnable( GL11.GL_BLEND ); - this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.srcX - 1, fs.srcY - 1, 18, 18 ); + this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 ); GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); GL11.glPopAttrib(); } @@ -491,7 +491,7 @@ public abstract class AEBaseGui extends GuiContainer if( action != null ) { - final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).mySlot.id ); + final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() ); NetworkHandler.instance.sendToServer( p ); } @@ -681,13 +681,13 @@ public abstract class AEBaseGui extends GuiContainer final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; this.mouseWheelEvent( x, y, i / Math.abs( i ) ); } - else if( i != 0 && this.myScrollBar != null ) + else if( i != 0 && this.getScrollBar() != null ) { - this.myScrollBar.wheel( i ); + this.getScrollBar().wheel( i ); } } - protected void mouseWheelEvent( final int x, final int y, final int wheel ) + private void mouseWheelEvent( final int x, final int y, final int wheel ) { final Slot slot = this.getSlot( x, y ); if( slot instanceof SlotME ) @@ -745,22 +745,17 @@ public abstract class AEBaseGui extends GuiContainer { if( this.inventorySlots instanceof AEBaseContainer ) { - return ( (AEBaseContainer) this.inventorySlots ).customName != null; + return ( (AEBaseContainer) this.inventorySlots ).getCustomName() != null; } return false; } private String getInventoryName() { - return ( (AEBaseContainer) this.inventorySlots ).customName; + return ( (AEBaseContainer) this.inventorySlots ).getCustomName(); } - public void a( final Slot s ) - { - this.drawSlot( s ); - } - - public void drawSlot( final Slot s ) + private void drawSlot( final Slot s ) { if( s instanceof SlotME ) { @@ -780,7 +775,7 @@ public abstract class AEBaseGui extends GuiContainer this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; - this.aeRenderItem.aeStack = ( (SlotME) s ).getAEStack(); + this.aeRenderItem.setAeStack( ( (SlotME) s ).getAEStack() ); this.safeDrawSlot( s ); } @@ -820,7 +815,7 @@ public abstract class AEBaseGui extends GuiContainer final float par4 = uv_y * 16; final Tessellator tessellator = Tessellator.getInstance(); - final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.startDrawingQuads(); worldrenderer.setColorRGBA_F( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ); @@ -844,7 +839,7 @@ public abstract class AEBaseGui extends GuiContainer if( is != null && s instanceof AppEngSlot ) { - if( ( (AppEngSlot) s ).isValid == hasCalculatedValidness.NotAvailable ) + if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.NotAvailable ) { boolean isValid = s.isItemValid( is ) || s instanceof SlotOutput || s instanceof AppEngCraftingSlot || s instanceof SlotDisabled || s instanceof SlotInaccessible || s instanceof SlotFake || s instanceof SlotRestrictedInput || s instanceof SlotDisconnected; if( isValid && s instanceof SlotRestrictedInput ) @@ -858,10 +853,10 @@ public abstract class AEBaseGui extends GuiContainer AELog.error( err ); } } - ( (AppEngSlot) s ).isValid = isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid; + ( (AppEngSlot) s ).setIsValid( isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid ); } - if( ( (AppEngSlot) s ).isValid == hasCalculatedValidness.Invalid ) + if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.Invalid ) { this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; @@ -877,7 +872,7 @@ public abstract class AEBaseGui extends GuiContainer if( s instanceof AppEngSlot ) { - ( (AppEngSlot) s ).isDisplay = true; + ( (AppEngSlot) s ).setDisplay( true ); this.safeDrawSlot( s ); } else @@ -936,4 +931,29 @@ public abstract class AEBaseGui extends GuiContainer { this.drawSlot( s ); } + + protected GuiScrollbar getScrollBar() + { + return this.myScrollBar; + } + + protected void setScrollBar( final GuiScrollbar myScrollBar ) + { + this.myScrollBar = myScrollBar; + } + + protected List getMeSlots() + { + return this.meSlots; + } + + public static final synchronized boolean isSwitchingGuis() + { + return switchingGuis; + } + + public static final synchronized void setSwitchingGuis( final boolean switchingGuis ) + { + AEBaseGui.switchingGuis = switchingGuis; + } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java b/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java index b5ece080f..a732f667c 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java @@ -47,19 +47,17 @@ import appeng.util.Platform; public class GuiCellWorkbench extends GuiUpgradeable { - final ContainerCellWorkbench workbench; - final TileCellWorkbench tcw; + private final ContainerCellWorkbench workbench; - GuiImgButton clear; - GuiImgButton partition; - GuiToggleButton copyMode; + private GuiImgButton clear; + private GuiImgButton partition; + private GuiToggleButton copyMode; public GuiCellWorkbench( final InventoryPlayer inventoryPlayer, final TileCellWorkbench te ) { super( new ContainerCellWorkbench( inventoryPlayer, te ) ); this.workbench = (ContainerCellWorkbench) this.inventorySlots; this.ySize = 251; - this.tcw = te; } @Override @@ -135,7 +133,7 @@ public class GuiCellWorkbench extends GuiUpgradeable @Override protected void handleButtonVisibility() { - this.copyMode.setState( this.workbench.copyMode == CopyMode.CLEAR_ON_REMOVE ); + this.copyMode.setState( this.workbench.getCopyMode() == CopyMode.CLEAR_ON_REMOVE ); boolean hasFuzzy = false; final IInventory inv = this.workbench.getCellUpgradeInventory(); diff --git a/src/main/java/appeng/client/gui/implementations/GuiChest.java b/src/main/java/appeng/client/gui/implementations/GuiChest.java index 4623968c9..e58ee4f69 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiChest.java +++ b/src/main/java/appeng/client/gui/implementations/GuiChest.java @@ -36,7 +36,7 @@ import appeng.tile.storage.TileChest; public class GuiChest extends AEBaseGui { - GuiTabButton priority; + private GuiTabButton priority; public GuiChest( final InventoryPlayer inventoryPlayer, final TileChest te ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiCondenser.java b/src/main/java/appeng/client/gui/implementations/GuiCondenser.java index 23f64ab7b..b3464e251 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCondenser.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCondenser.java @@ -41,9 +41,9 @@ import appeng.tile.misc.TileCondenser; public class GuiCondenser extends AEBaseGui { - final ContainerCondenser cvc; - GuiProgressBar pb; - GuiImgButton mode; + private final ContainerCondenser cvc; + private GuiProgressBar pb; + private GuiImgButton mode; public GuiCondenser( final InventoryPlayer inventoryPlayer, final TileCondenser te ) { @@ -72,7 +72,7 @@ public class GuiCondenser extends AEBaseGui this.pb = new GuiProgressBar( this.cvc, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.getLocal() ); - this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.cvc.output ); + this.mode = new GuiImgButton( 128 + this.guiLeft, 52 + this.guiTop, Settings.CONDENSER_OUTPUT, this.cvc.getOutput() ); this.buttonList.add( this.pb ); this.buttonList.add( this.mode ); @@ -84,8 +84,8 @@ public class GuiCondenser extends AEBaseGui this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 ); this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - this.mode.set( this.cvc.output ); - this.mode.fillVar = String.valueOf( this.cvc.output.requiredPower ); + this.mode.set( this.cvc.getOutput() ); + this.mode.setFillVar( String.valueOf( this.cvc.getOutput().requiredPower ) ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java index 853d93f28..c478fae6a 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java @@ -58,28 +58,30 @@ import com.google.common.base.Joiner; public class GuiCraftConfirm extends AEBaseGui { - final ContainerCraftConfirm ccc; + private final ContainerCraftConfirm ccc; - final int rows = 5; + private final int rows = 5; - final IItemList storage = AEApi.instance().storage().createItemList(); - final IItemList pending = AEApi.instance().storage().createItemList(); - final IItemList missing = AEApi.instance().storage().createItemList(); + private final IItemList storage = AEApi.instance().storage().createItemList(); + private final IItemList pending = AEApi.instance().storage().createItemList(); + private final IItemList missing = AEApi.instance().storage().createItemList(); - final List visual = new ArrayList(); + private final List visual = new ArrayList(); - GuiBridge OriginalGui; - GuiButton cancel; - GuiButton start; - GuiButton selectCPU; - int tooltip = -1; + private GuiBridge OriginalGui; + private GuiButton cancel; + private GuiButton start; + private GuiButton selectCPU; + private int tooltip = -1; public GuiCraftConfirm( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) { super( new ContainerCraftConfirm( inventoryPlayer, te ) ); this.xSize = 238; this.ySize = 206; - this.myScrollBar = new GuiScrollbar(); + + final GuiScrollbar scrollbar = new GuiScrollbar(); + this.setScrollBar( scrollbar ); this.ccc = (ContainerCraftConfirm) this.inventorySlots; @@ -106,7 +108,7 @@ public class GuiCraftConfirm extends AEBaseGui boolean isAutoStart() { - return ( (ContainerCraftConfirm) this.inventorySlots ).autoStart; + return ( (ContainerCraftConfirm) this.inventorySlots ).isAutoStart(); } @Override @@ -135,7 +137,7 @@ public class GuiCraftConfirm extends AEBaseGui { this.updateCPUButtonText(); - this.start.enabled = !( this.ccc.noCPU || this.isSimulation() ); + this.start.enabled = !( this.ccc.hasNoCPU() || this.isSimulation() ); this.selectCPU.enabled = !this.isSimulation(); final int gx = ( this.width - this.xSize ) / 2; @@ -175,20 +177,20 @@ public class GuiCraftConfirm extends AEBaseGui private void updateCPUButtonText() { String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal(); - if( this.ccc.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() ) + if( this.ccc.getSelectedCpu() >= 0 )// && status.selectedCpu < status.cpus.size() ) { - if( this.ccc.myName.length() > 0 ) + if( this.ccc.getName().length() > 0 ) { - final String name = this.ccc.myName.substring( 0, Math.min( 20, this.ccc.myName.length() ) ); + final String name = this.ccc.getName().substring( 0, Math.min( 20, this.ccc.getName().length() ) ); btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name; } else { - btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.selectedCpu; + btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.getSelectedCpu(); } } - if( this.ccc.noCPU ) + if( this.ccc.hasNoCPU() ) { btnTextText = GuiText.NoCraftingCPUs.getLocal(); } @@ -196,15 +198,15 @@ public class GuiCraftConfirm extends AEBaseGui this.selectCPU.displayString = btnTextText; } - boolean isSimulation() + private boolean isSimulation() { - return ( (ContainerCraftConfirm) this.inventorySlots ).simulation; + return ( (ContainerCraftConfirm) this.inventorySlots ).isSimulation(); } @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { - final long BytesUsed = this.ccc.bytesUsed; + final long BytesUsed = this.ccc.getUsedBytes(); final String byteUsed = NumberFormat.getInstance().format( BytesUsed ); final String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal(); this.fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 ); @@ -217,7 +219,7 @@ public class GuiCraftConfirm extends AEBaseGui } else { - dsp = this.ccc.cpuBytesAvail > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.cpuCoProcessors ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A"; + dsp = this.ccc.getCpuAvailableBytes() > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.ccc.getCpuAvailableBytes() + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A"; } final int offset = ( 219 - this.fontRendererObj.getStringWidth( dsp ) ) / 2; @@ -229,7 +231,7 @@ public class GuiCraftConfirm extends AEBaseGui int y = 0; final int xo = 9; final int yo = 22; - final int viewStart = this.myScrollBar.getCurrentScroll() * 3; + final int viewStart = this.getScrollBar().getCurrentScroll() * 3; final int viewEnd = viewStart + 3 * this.rows; String dspToolTip = ""; @@ -399,8 +401,8 @@ public class GuiCraftConfirm extends AEBaseGui { final int size = this.visual.size(); - this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 ); - this.myScrollBar.setRange( 0, ( size + 2 ) / 3 - this.rows, 1 ); + this.getScrollBar().setTop( 19 ).setLeft( 218 ).setHeight( 114 ); + this.getScrollBar().setRange( 0, ( size + 2 ) / 3 - this.rows, 1 ); } public void postUpdate( final List list, final byte ref ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java index 98d2da0cd..79bb30517 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java @@ -103,7 +103,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource this.craftingCpu = container; this.ySize = GUI_HEIGHT; this.xSize = GUI_WIDTH; - this.myScrollBar = new GuiScrollbar(); + + final GuiScrollbar scrollbar = new GuiScrollbar(); + this.setScrollBar( scrollbar ); } public void clearItems() @@ -145,8 +147,8 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource { final int size = this.visual.size(); - this.myScrollBar.setTop( SCROLLBAR_TOP ).setLeft( SCROLLBAR_LEFT ).setHeight( SCROLLBAR_HEIGHT ); - this.myScrollBar.setRange( 0, ( size + 2 ) / 3 - DISPLAYED_ROWS, 1 ); + this.getScrollBar().setTop( SCROLLBAR_TOP ).setLeft( SCROLLBAR_LEFT ).setHeight( SCROLLBAR_HEIGHT ); + this.getScrollBar().setRange( 0, ( size + 2 ) / 3 - DISPLAYED_ROWS, 1 ); } @Override @@ -193,9 +195,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource { String title = this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() ); - if( this.craftingCpu.eta > 0 && !this.visual.isEmpty() ) + if( this.craftingCpu.getEstimatedTime() > 0 && !this.visual.isEmpty() ) { - final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.craftingCpu.eta, TimeUnit.NANOSECONDS ); + final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.craftingCpu.getEstimatedTime(), TimeUnit.NANOSECONDS ); final String etaTimeText = DurationFormatUtils.formatDuration( etaInMilliseconds, GuiText.ETAFormat.getLocal() ); title += " - " + etaTimeText; } @@ -204,7 +206,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource int x = 0; int y = 0; - final int viewStart = this.myScrollBar.getCurrentScroll() * 3; + final int viewStart = this.getScrollBar().getCurrentScroll() * 3; final int viewEnd = viewStart + 3 * 6; String dspToolTip = ""; diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java index d7914098b..2a534ba55 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java @@ -52,12 +52,12 @@ import appeng.parts.reporting.PartTerminal; public class GuiCraftingStatus extends GuiCraftingCPU { - final ContainerCraftingStatus status; - GuiButton selectCPU; + private final ContainerCraftingStatus status; + private GuiButton selectCPU; - GuiTabButton originalGuiBtn; - GuiBridge originalGui; - ItemStack myIcon = null; + private GuiTabButton originalGuiBtn; + private GuiBridge originalGui; + private ItemStack myIcon = null; public GuiCraftingStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) { @@ -143,7 +143,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU if( this.myIcon != null ) { this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), this.itemRender ) ); - this.originalGuiBtn.hideEdge = 13; + this.originalGuiBtn.setHideEdge( 13 ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java index c4dfb656e..08957dfd5 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java @@ -38,12 +38,12 @@ import appeng.helpers.InventoryAction; public class GuiCraftingTerm extends GuiMEMonitorable { - GuiImgButton clearBtn; + private GuiImgButton clearBtn; public GuiCraftingTerm( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) { super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) ); - this.reservedSpace = 73; + this.setReservedSpace( 73 ); } @Override @@ -76,14 +76,14 @@ public class GuiCraftingTerm extends GuiMEMonitorable { super.initGui(); this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) ); - this.clearBtn.halfSize = true; + this.clearBtn.setHalfSize( true ); } @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { super.drawFG( offsetX, offsetY, mouseX, mouseY ); - this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 ); + this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752 ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiDrive.java b/src/main/java/appeng/client/gui/implementations/GuiDrive.java index dbfa6aa2e..6bd4af792 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiDrive.java +++ b/src/main/java/appeng/client/gui/implementations/GuiDrive.java @@ -36,7 +36,7 @@ import appeng.tile.storage.TileDrive; public class GuiDrive extends AEBaseGui { - GuiTabButton priority; + private GuiTabButton priority; public GuiDrive( final InventoryPlayer inventoryPlayer, final TileDrive te ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java index cf7bd9a3b..634222505 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java +++ b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java @@ -43,8 +43,8 @@ import appeng.parts.automation.PartFormationPlane; public class GuiFormationPlane extends GuiUpgradeable { - GuiTabButton priority; - GuiImgButton placeMode; + private GuiTabButton priority; + private GuiImgButton placeMode; public GuiFormationPlane( final InventoryPlayer inventoryPlayer, final PartFormationPlane te ) { @@ -72,12 +72,12 @@ public class GuiFormationPlane extends GuiUpgradeable if( this.fuzzyMode != null ) { - this.fuzzyMode.set( this.cvb.fzMode ); + this.fuzzyMode.set( this.cvb.getFuzzyMode() ); } if( this.placeMode != null ) { - this.placeMode.set( ( (ContainerFormationPlane) this.cvb ).placeMode ); + this.placeMode.set( ( (ContainerFormationPlane) this.cvb ).getPlaceMode() ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiIOPort.java b/src/main/java/appeng/client/gui/implementations/GuiIOPort.java index 623ed5ed5..8710cfa52 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiIOPort.java +++ b/src/main/java/appeng/client/gui/implementations/GuiIOPort.java @@ -44,8 +44,8 @@ import appeng.tile.storage.TileIOPort; public class GuiIOPort extends GuiUpgradeable { - GuiImgButton fullMode; - GuiImgButton operationMode; + private GuiImgButton fullMode; + private GuiImgButton operationMode; public GuiIOPort( final InventoryPlayer inventoryPlayer, final TileIOPort te ) { @@ -73,17 +73,17 @@ public class GuiIOPort extends GuiUpgradeable if( this.redstoneMode != null ) { - this.redstoneMode.set( this.cvb.rsMode ); + this.redstoneMode.set( this.cvb.getRedStoneMode() ); } if( this.operationMode != null ) { - this.operationMode.set( ( (ContainerIOPort) this.cvb ).opMode ); + this.operationMode.set( ( (ContainerIOPort) this.cvb ).getOperationMode() ); } if( this.fullMode != null ) { - this.fullMode.set( ( (ContainerIOPort) this.cvb ).fMode ); + this.fullMode.set( ( (ContainerIOPort) this.cvb ).getFullMode() ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInscriber.java b/src/main/java/appeng/client/gui/implementations/GuiInscriber.java index 5b4da8172..d4e4b7c48 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInscriber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInscriber.java @@ -32,8 +32,8 @@ import appeng.tile.misc.TileInscriber; public class GuiInscriber extends AEBaseGui { - final ContainerInscriber cvc; - GuiProgressBar pb; + private final ContainerInscriber cvc; + private GuiProgressBar pb; public GuiInscriber( final InventoryPlayer inventoryPlayer, final TileInscriber te ) { @@ -43,7 +43,7 @@ public class GuiInscriber extends AEBaseGui this.xSize = this.hasToolbox() ? 246 : 211; } - protected boolean hasToolbox() + private boolean hasToolbox() { return ( (ContainerUpgradeable) this.inventorySlots ).hasToolbox(); } @@ -85,7 +85,7 @@ public class GuiInscriber extends AEBaseGui } } - protected boolean drawUpgrades() + private boolean drawUpgrades() { return true; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterface.java b/src/main/java/appeng/client/gui/implementations/GuiInterface.java index fc4a30f1f..757f7032d 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterface.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterface.java @@ -43,9 +43,9 @@ import appeng.helpers.IInterfaceHost; public class GuiInterface extends GuiUpgradeable { - GuiTabButton priority; - GuiImgButton BlockMode; - GuiToggleButton interfaceMode; + private GuiTabButton priority; + private GuiImgButton BlockMode; + private GuiToggleButton interfaceMode; public GuiInterface( final InventoryPlayer inventoryPlayer, final IInterfaceHost te ) { @@ -71,12 +71,12 @@ public class GuiInterface extends GuiUpgradeable { if( this.BlockMode != null ) { - this.BlockMode.set( ( (ContainerInterface) this.cvb ).bMode ); + this.BlockMode.set( ( (ContainerInterface) this.cvb ).getBlockingMode() ); } if( this.interfaceMode != null ) { - this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).iTermMode == YesNo.YES ); + this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).getInterfaceTerminalMode() == YesNo.YES ); } this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index 1e7cef96a..f1eb34778 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -56,7 +56,7 @@ public class GuiInterfaceTerminal extends AEBaseGui private static final int LINES_ON_PAGE = 6; // TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded? - final int offsetX = 9; + private final int offsetX = 9; private final HashMap byId = new HashMap(); private final HashMultimap byName = HashMultimap.create(); @@ -71,7 +71,9 @@ public class GuiInterfaceTerminal extends AEBaseGui public GuiInterfaceTerminal( final InventoryPlayer inventoryPlayer, final PartInterfaceTerminal te ) { super( new ContainerInterfaceTerminal( inventoryPlayer, te ) ); - this.myScrollBar = new GuiScrollbar(); + + final GuiScrollbar scrollbar = new GuiScrollbar(); + this.setScrollBar( scrollbar ); this.xSize = 195; this.ySize = 222; } @@ -81,9 +83,9 @@ public class GuiInterfaceTerminal extends AEBaseGui { super.initGui(); - this.myScrollBar.setLeft( 175 ); - this.myScrollBar.setHeight( 106 ); - this.myScrollBar.setTop( 18 ); + this.getScrollBar().setLeft( 175 ); + this.getScrollBar().setHeight( 106 ); + this.getScrollBar().setTop( 18 ); this.searchField = new MEGuiTextField( this.fontRendererObj, this.guiLeft + Math.max( 104, this.offsetX ), this.guiTop + 4, 65, 12 ); this.searchField.setEnableBackgroundDrawing( false ); @@ -99,7 +101,7 @@ public class GuiInterfaceTerminal extends AEBaseGui this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 ); this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - final int ex = this.myScrollBar.getCurrentScroll(); + final int ex = this.getScrollBar().getCurrentScroll(); final Iterator o = this.inventorySlots.inventorySlots.iterator(); while( o.hasNext() ) @@ -117,7 +119,7 @@ public class GuiInterfaceTerminal extends AEBaseGui if( lineObj instanceof ClientDCInternalInv ) { final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj; - for( int z = 0; z < inv.inv.getSizeInventory(); z++ ) + for( int z = 0; z < inv.getInventory().getSizeInventory(); z++ ) { this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) ); } @@ -163,7 +165,7 @@ public class GuiInterfaceTerminal extends AEBaseGui this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); int offset = 17; - final int ex = this.myScrollBar.getCurrentScroll(); + final int ex = this.getScrollBar().getCurrentScroll(); for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ ) { @@ -173,7 +175,7 @@ public class GuiInterfaceTerminal extends AEBaseGui final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj; GL11.glColor4f( 1, 1, 1, 1 ); - final int width = inv.inv.getSizeInventory() * 18; + final int width = inv.getInventory().getSizeInventory() * 18; this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 ); } offset += 18; @@ -225,12 +227,12 @@ public class GuiInterfaceTerminal extends AEBaseGui final NBTTagCompound invData = in.getCompoundTag( key ); final ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) ); - for( int x = 0; x < current.inv.getSizeInventory(); x++ ) + for( int x = 0; x < current.getInventory().getSizeInventory(); x++ ) { final String which = Integer.toString( x ); if( invData.hasKey( which ) ) { - current.inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) ); + current.getInventory().setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) ); } } } @@ -277,7 +279,7 @@ public class GuiInterfaceTerminal extends AEBaseGui // Search if the current inventory holds a pattern containing the search term. if( !found && !searchFilterLowerCase.isEmpty() ) { - for( final ItemStack itemStack : entry.inv ) + for( final ItemStack itemStack : entry.getInventory() ) { found = this.itemStackMatchesSearchTerm( itemStack, searchFilterLowerCase ); if( found ) @@ -318,7 +320,7 @@ public class GuiInterfaceTerminal extends AEBaseGui this.lines.addAll( clientInventories ); } - this.myScrollBar.setRange( 0, this.lines.size() - LINES_ON_PAGE, 2 ); + this.getScrollBar().setRange( 0, this.lines.size() - LINES_ON_PAGE, 2 ); } private boolean itemStackMatchesSearchTerm( final ItemStack itemStack, final String searchTerm ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java index 6aee59481..deb174bbd 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java +++ b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java @@ -47,19 +47,19 @@ import appeng.parts.automation.PartLevelEmitter; public class GuiLevelEmitter extends GuiUpgradeable { - GuiNumberBox level; + private GuiNumberBox level; - GuiButton plus1; - GuiButton plus10; - GuiButton plus100; - GuiButton plus1000; - GuiButton minus1; - GuiButton minus10; - GuiButton minus100; - GuiButton minus1000; + private GuiButton plus1; + private GuiButton plus10; + private GuiButton plus100; + private GuiButton plus1000; + private GuiButton minus1; + private GuiButton minus10; + private GuiButton minus100; + private GuiButton minus1000; - GuiImgButton levelMode; - GuiImgButton craftingMode; + private GuiImgButton levelMode; + private GuiImgButton craftingMode; public GuiLevelEmitter( final InventoryPlayer inventoryPlayer, final PartLevelEmitter te ) { @@ -131,12 +131,12 @@ public class GuiLevelEmitter extends GuiUpgradeable if( this.craftingMode != null ) { - this.craftingMode.set( ( (ContainerLevelEmitter) this.cvb ).cmType ); + this.craftingMode.set( ( (ContainerLevelEmitter) this.cvb ).getCraftingMode() ); } if( this.levelMode != null ) { - this.levelMode.set( ( (ContainerLevelEmitter) this.cvb ).lvType ); + this.levelMode.set( ( (ContainerLevelEmitter) this.cvb ).getLevelMode() ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiMAC.java b/src/main/java/appeng/client/gui/implementations/GuiMAC.java index f14711116..82bbf64bf 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMAC.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMAC.java @@ -33,8 +33,8 @@ import appeng.tile.crafting.TileMolecularAssembler; public class GuiMAC extends GuiUpgradeable { - final ContainerMAC container; - GuiProgressBar pb; + private final ContainerMAC container; + private GuiProgressBar pb; public GuiMAC( final InventoryPlayer inventoryPlayer, final TileMolecularAssembler te ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java index d01c7b592..36089bbd5 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java @@ -71,30 +71,31 @@ import appeng.util.Platform; public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost { - public static int CraftingGridOffsetX; - public static int CraftingGridOffsetY; + private static int craftingGridOffsetX; + private static int craftingGridOffsetY; + private static String memoryText = ""; - final ItemRepo repo; - final int offsetX = 9; - final int lowerTextureOffset = 0; - final IConfigManager configSrc; - final boolean viewCell; - final ItemStack[] myCurrentViewCells = new ItemStack[5]; - final ContainerMEMonitorable monitorableContainer; - GuiTabButton craftingStatusBtn; - MEGuiTextField searchField; - GuiText myName; - int perRow = 9; - int reservedSpace = 0; - boolean customSortOrder = true; - int rows = 0; - int maxRows = Integer.MAX_VALUE; - int standardSize; - GuiImgButton ViewBox; - GuiImgButton SortByBox; - GuiImgButton SortDirBox; - GuiImgButton searchBoxSettings; - GuiImgButton terminalStyleBox; + private final ItemRepo repo; + private final int offsetX = 9; + private final int lowerTextureOffset = 0; + private final IConfigManager configSrc; + private final boolean viewCell; + private final ItemStack[] myCurrentViewCells = new ItemStack[5]; + private final ContainerMEMonitorable monitorableContainer; + private GuiTabButton craftingStatusBtn; + private MEGuiTextField searchField; + private GuiText myName; + private int perRow = 9; + private int reservedSpace = 0; + private boolean customSortOrder = true; + private int rows = 0; + private int maxRows = Integer.MAX_VALUE; + private int standardSize; + private GuiImgButton ViewBox; + private GuiImgButton SortByBox; + private GuiImgButton SortDirBox; + private GuiImgButton searchBoxSettings; + private GuiImgButton terminalStyleBox; public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) { @@ -105,8 +106,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi { super( c ); - this.myScrollBar = new GuiScrollbar(); - this.repo = new ItemRepo( this.myScrollBar, this ); + + final GuiScrollbar scrollbar = new GuiScrollbar(); + this.setScrollBar( scrollbar ); + this.repo = new ItemRepo( scrollbar, this ); this.xSize = 185; this.ySize = 204; @@ -119,7 +122,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi this.standardSize = this.xSize; this.configSrc = ( (IConfigurableObject) this.inventorySlots ).getConfigManager(); - ( this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots ).gui = this; + ( this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots ).setGui( this ); this.viewCell = te instanceof IViewCellStorage; @@ -158,8 +161,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi private void setScrollBar() { - this.myScrollBar.setTop( 18 ).setLeft( 175 ).setHeight( this.rows * 18 - 2 ); - this.myScrollBar.setRange( 0, ( this.repo.size() + this.perRow - 1 ) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) ); + this.getScrollBar().setTop( 18 ).setLeft( 175 ).setHeight( this.rows * 18 - 2 ); + this.getScrollBar().setRange( 0, ( this.repo.size() + this.perRow - 1 ) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) ); } @Override @@ -204,13 +207,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class ) { - this.re_init(); + this.reinitalize(); } } } } - public void re_init() + private void reinitalize() { this.buttonList.clear(); this.initGui(); @@ -249,12 +252,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi this.rows = 3; } - this.meSlots.clear(); + this.getMeSlots().clear(); for( int y = 0; y < this.rows; y++ ) { for( int x = 0; x < this.perRow; x++ ) { - this.meSlots.add( new InternalSlotME( this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18 ) ); + this.getMeSlots().add( new InternalSlotME( this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18 ) ); } } @@ -311,7 +314,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if( this.viewCell || this instanceof GuiWirelessTerm ) { this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(), this.itemRender ) ); - this.craftingStatusBtn.hideEdge = 13; + this.craftingStatusBtn.setHideEdge( 13 ); } // Enum setting = AEConfig.INSTANCE.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH ); @@ -321,13 +324,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if( this.isSubGui() ) { this.searchField.setText( memoryText ); - this.repo.searchString = memoryText; + this.repo.setSearchString( memoryText ); this.repo.updateView(); this.setScrollBar(); } - CraftingGridOffsetX = Integer.MAX_VALUE; - CraftingGridOffsetY = Integer.MAX_VALUE; + craftingGridOffsetX = Integer.MAX_VALUE; + craftingGridOffsetY = Integer.MAX_VALUE; for( final Object s : this.inventorySlots.inventorySlots ) { @@ -344,14 +347,14 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi final Slot g = (Slot) s; if( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 ) { - CraftingGridOffsetX = Math.min( CraftingGridOffsetX, g.xDisplayPosition ); - CraftingGridOffsetY = Math.min( CraftingGridOffsetY, g.yDisplayPosition ); + craftingGridOffsetX = Math.min( craftingGridOffsetX, g.xDisplayPosition ); + craftingGridOffsetY = Math.min( craftingGridOffsetY, g.yDisplayPosition ); } } } - CraftingGridOffsetX -= 25; - CraftingGridOffsetY -= 6; + craftingGridOffsetX -= 25; + craftingGridOffsetY -= 6; } @Override @@ -374,7 +377,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) ) { this.searchField.setText( "" ); - this.repo.searchString = ""; + this.repo.setSearchString( "" ); this.repo.updateView(); this.setScrollBar(); } @@ -416,10 +419,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi for( int i = 0; i < 5; i++ ) { - if( this.myCurrentViewCells[i] != this.monitorableContainer.cellView[i].getStack() ) + if( this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot( i ).getStack() ) { update = true; - this.myCurrentViewCells[i] = this.monitorableContainer.cellView[i].getStack(); + this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot( i ).getStack(); } } @@ -453,7 +456,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi protected void repositionSlot( final AppEngSlot s ) { - s.yDisplayPosition = s.defY + this.ySize - 78 - 5; + s.yDisplayPosition = s.getY() + this.ySize - 78 - 5; } @Override @@ -468,7 +471,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi if( this.searchField.textboxKeyTyped( character, key ) ) { - this.repo.searchString = this.searchField.getText(); + this.repo.setSearchString( this.searchField.getText() ); this.repo.updateView(); this.setScrollBar(); } @@ -482,7 +485,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi @Override public void updateScreen() { - this.repo.setPower( this.monitorableContainer.hasPower ); + this.repo.setPower( this.monitorableContainer.isPowered() ); super.updateScreen(); } @@ -524,4 +527,34 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi this.repo.updateView(); } + + int getReservedSpace() + { + return this.reservedSpace; + } + + void setReservedSpace( final int reservedSpace ) + { + this.reservedSpace = reservedSpace; + } + + public boolean isCustomSortOrder() + { + return this.customSortOrder; + } + + void setCustomSortOrder( final boolean customSortOrder ) + { + this.customSortOrder = customSortOrder; + } + + public int getStandardSize() + { + return this.standardSize; + } + + void setStandardSize( final int standardSize ) + { + this.standardSize = standardSize; + } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java index a9a961241..4df3d864c 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java @@ -51,19 +51,21 @@ import appeng.util.Platform; public class GuiNetworkStatus extends AEBaseGui implements ISortSource { - final ItemRepo repo; - final int rows = 4; - GuiImgButton units; - int tooltip = -1; + private final ItemRepo repo; + private final int rows = 4; + private GuiImgButton units; + private int tooltip = -1; public GuiNetworkStatus( final InventoryPlayer inventoryPlayer, final INetworkTool te ) { super( new ContainerNetworkStatus( inventoryPlayer, te ) ); + final GuiScrollbar scrollbar = new GuiScrollbar(); + + this.setScrollBar( scrollbar ); + this.repo = new ItemRepo( scrollbar, this ); this.ySize = 153; this.xSize = 195; - this.myScrollBar = new GuiScrollbar(); - this.repo = new ItemRepo( this.myScrollBar, this ); - this.repo.rowSize = 5; + this.repo.setRowSize( 5 ); } @Override @@ -133,11 +135,11 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource this.fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 ); - this.fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 ); - this.fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 ); + this.fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.getCurrentPower(), false ), 13, 16, 4210752 ); + this.fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.getMaxPower(), false ), 13, 26, 4210752 ); - this.fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 ); - this.fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 ); + this.fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.getAverageAddition(), true ), 13, 143 - 10, 4210752 ); + this.fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.getPowerUsage(), true ), 13, 143 - 20, 4210752 ); final int sectionLength = 30; @@ -230,8 +232,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource private void setScrollBar() { final int size = this.repo.size(); - this.myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 ); - this.myScrollBar.setRange( 0, ( size + 4 ) / 5 - this.rows, 1 ); + this.getScrollBar().setTop( 39 ).setLeft( 175 ).setHeight( 78 ); + this.getScrollBar().setRange( 0, ( size + 4 ) / 5 - this.rows, 1 ); } // @Override - NEI diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java index 94b74c28c..9e8e670c5 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java @@ -36,7 +36,7 @@ import appeng.core.sync.packets.PacketValueConfig; public class GuiNetworkTool extends AEBaseGui { - GuiToggleButton tFacades; + private GuiToggleButton tFacades; public GuiNetworkTool( final InventoryPlayer inventoryPlayer, final INetworkTool te ) { @@ -77,7 +77,7 @@ public class GuiNetworkTool extends AEBaseGui { if( this.tFacades != null ) { - this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).facadeMode ); + this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).isFacadeMode() ); } this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java index 7e6609248..01f2e9ba6 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java @@ -60,7 +60,7 @@ public class GuiPatternTerm extends GuiMEMonitorable { super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) ); this.container = (ContainerPatternTerm) this.inventorySlots; - this.reservedSpace = 81; + this.setReservedSpace( 81 ); } @Override @@ -110,15 +110,15 @@ public class GuiPatternTerm extends GuiMEMonitorable this.buttonList.add( this.tabProcessButton ); this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED ); - this.substitutionsEnabledBtn.halfSize = true; + this.substitutionsEnabledBtn.setHalfSize( true ); this.buttonList.add( this.substitutionsEnabledBtn ); this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED ); - this.substitutionsDisabledBtn.halfSize = true; + this.substitutionsDisabledBtn.setHalfSize( true ); this.buttonList.add( this.substitutionsDisabledBtn ); this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ); - this.clearBtn.halfSize = true; + this.clearBtn.setHalfSize( true ); this.buttonList.add( this.clearBtn ); this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ); @@ -128,7 +128,7 @@ public class GuiPatternTerm extends GuiMEMonitorable @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { - if( !this.container.craftingMode ) + if( !this.container.isCraftingMode() ) { this.tabCraftButton.visible = false; this.tabProcessButton.visible = true; @@ -151,13 +151,13 @@ public class GuiPatternTerm extends GuiMEMonitorable } super.drawFG( offsetX, offsetY, mouseX, mouseY ); - this.fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.reservedSpace, 4210752 ); + this.fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.getReservedSpace(), 4210752 ); } @Override protected String getBackground() { - if( this.container.craftingMode ) + if( this.container.isCraftingMode() ) { return "guis/pattern.png"; } @@ -169,11 +169,11 @@ public class GuiPatternTerm extends GuiMEMonitorable { if( s.isPlayerSide() ) { - s.yDisplayPosition = s.defY + this.ySize - 78 - 5; + s.yDisplayPosition = s.getY() + this.ySize - 78 - 5; } else { - s.yDisplayPosition = s.defY + this.ySize - 78 - 3; + s.yDisplayPosition = s.getY() + this.ySize - 78 - 3; } } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiPriority.java b/src/main/java/appeng/client/gui/implementations/GuiPriority.java index b3385a889..27e2ae5cd 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPriority.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPriority.java @@ -52,19 +52,19 @@ import appeng.tile.storage.TileDrive; public class GuiPriority extends AEBaseGui { - GuiNumberBox priority; - GuiTabButton originalGuiBtn; + private GuiNumberBox priority; + private GuiTabButton originalGuiBtn; - GuiButton plus1; - GuiButton plus10; - GuiButton plus100; - GuiButton plus1000; - GuiButton minus1; - GuiButton minus10; - GuiButton minus100; - GuiButton minus1000; + private GuiButton plus1; + private GuiButton plus10; + private GuiButton plus100; + private GuiButton plus1000; + private GuiButton minus1; + private GuiButton minus10; + private GuiButton minus100; + private GuiButton minus1000; - GuiBridge OriginalGui; + private GuiBridge OriginalGui; public GuiPriority( final InventoryPlayer inventoryPlayer, final IPriorityHost te ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java index 36bfbaaa9..7115ab0ab 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java +++ b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java @@ -35,7 +35,7 @@ import appeng.items.contents.QuartzKnifeObj; public class GuiQuartzKnife extends AEBaseGui { - GuiTextField name; + private GuiTextField name; public GuiQuartzKnife( final InventoryPlayer inventoryPlayer, final QuartzKnifeObj te ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiSecurity.java b/src/main/java/appeng/client/gui/implementations/GuiSecurity.java index 8821cfc05..c5931ed73 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSecurity.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSecurity.java @@ -36,21 +36,21 @@ import appeng.core.sync.packets.PacketValueConfig; public class GuiSecurity extends GuiMEMonitorable { - GuiToggleButton inject; - GuiToggleButton extract; - GuiToggleButton craft; - GuiToggleButton build; - GuiToggleButton security; + private GuiToggleButton inject; + private GuiToggleButton extract; + private GuiToggleButton craft; + private GuiToggleButton build; + private GuiToggleButton security; public GuiSecurity( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) { super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) ); - this.customSortOrder = false; - this.reservedSpace = 33; + this.setCustomSortOrder( false ); + this.setReservedSpace( 33 ); // increase size so that the slot is over the gui. this.xSize += 56; - this.standardSize = this.xSize; + this.setStandardSize( this.xSize ); } @Override @@ -115,7 +115,7 @@ public class GuiSecurity extends GuiMEMonitorable public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { super.drawFG( offsetX, offsetY, mouseX, mouseY ); - this.fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 ); + this.fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752 ); } @Override @@ -123,11 +123,11 @@ public class GuiSecurity extends GuiMEMonitorable { final ContainerSecurity cs = (ContainerSecurity) this.inventorySlots; - this.inject.setState( ( cs.security & ( 1 << SecurityPermissions.INJECT.ordinal() ) ) > 0 ); - this.extract.setState( ( cs.security & ( 1 << SecurityPermissions.EXTRACT.ordinal() ) ) > 0 ); - this.craft.setState( ( cs.security & ( 1 << SecurityPermissions.CRAFT.ordinal() ) ) > 0 ); - this.build.setState( ( cs.security & ( 1 << SecurityPermissions.BUILD.ordinal() ) ) > 0 ); - this.security.setState( ( cs.security & ( 1 << SecurityPermissions.SECURITY.ordinal() ) ) > 0 ); + this.inject.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.INJECT.ordinal() ) ) > 0 ); + this.extract.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.EXTRACT.ordinal() ) ) > 0 ); + this.craft.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.CRAFT.ordinal() ) ) > 0 ); + this.build.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.BUILD.ordinal() ) ) > 0 ); + this.security.setState( ( cs.getPermissionMode() & ( 1 << SecurityPermissions.SECURITY.ordinal() ) ) > 0 ); return "guis/security.png"; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java b/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java index 47482a7b3..c442b85e0 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java @@ -39,8 +39,8 @@ import appeng.util.Platform; public class GuiSpatialIOPort extends AEBaseGui { - final ContainerSpatialIOPort container; - GuiImgButton units; + private final ContainerSpatialIOPort container; + private GuiImgButton units; public GuiSpatialIOPort( final InventoryPlayer inventoryPlayer, final TileSpatialIOPort te ) { @@ -75,10 +75,10 @@ public class GuiSpatialIOPort extends AEBaseGui @Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { - this.fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.currentPower, false ), 13, 21, 4210752 ); - this.fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.maxPower, false ), 13, 31, 4210752 ); - this.fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.reqPower, false ), 13, 78, 4210752 ); - this.fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.eff ) / 100 ) + '%', 13, 88, 4210752 ); + this.fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21, 4210752 ); + this.fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 ); + this.fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 78, 4210752 ); + this.fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 88, 4210752 ); this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 ); this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java index bc1c5a09f..bfef66b86 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java @@ -47,11 +47,11 @@ import appeng.parts.misc.PartStorageBus; public class GuiStorageBus extends GuiUpgradeable { - GuiImgButton rwMode; - GuiImgButton storageFilter; - GuiTabButton priority; - GuiImgButton partition; - GuiImgButton clear; + private GuiImgButton rwMode; + private GuiImgButton storageFilter; + private GuiTabButton priority; + private GuiImgButton partition; + private GuiImgButton clear; public GuiStorageBus( final InventoryPlayer inventoryPlayer, final PartStorageBus te ) { @@ -85,17 +85,17 @@ public class GuiStorageBus extends GuiUpgradeable if( this.fuzzyMode != null ) { - this.fuzzyMode.set( this.cvb.fzMode ); + this.fuzzyMode.set( this.cvb.getFuzzyMode() ); } if( this.storageFilter != null ) { - this.storageFilter.set( ( (ContainerStorageBus) this.cvb ).storageFilter ); + this.storageFilter.set( ( (ContainerStorageBus) this.cvb ).getStorageFilter() ); } if( this.rwMode != null ) { - this.rwMode.set( ( (ContainerStorageBus) this.cvb ).rwMode ); + this.rwMode.set( ( (ContainerStorageBus) this.cvb ).getReadWriteMode() ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java b/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java index 64ba5fe68..2b090d73c 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java @@ -46,13 +46,13 @@ import appeng.parts.automation.PartImportBus; public class GuiUpgradeable extends AEBaseGui { - final ContainerUpgradeable cvb; - final IUpgradeableHost bc; + protected final ContainerUpgradeable cvb; + protected final IUpgradeableHost bc; - GuiImgButton redstoneMode; - GuiImgButton fuzzyMode; - GuiImgButton craftMode; - GuiImgButton schedulingMode; + protected GuiImgButton redstoneMode; + protected GuiImgButton fuzzyMode; + protected GuiImgButton craftMode; + protected GuiImgButton schedulingMode; public GuiUpgradeable( final InventoryPlayer inventoryPlayer, final IUpgradeableHost te ) { @@ -102,22 +102,22 @@ public class GuiUpgradeable extends AEBaseGui if( this.redstoneMode != null ) { - this.redstoneMode.set( this.cvb.rsMode ); + this.redstoneMode.set( this.cvb.getRedStoneMode() ); } if( this.fuzzyMode != null ) { - this.fuzzyMode.set( this.cvb.fzMode ); + this.fuzzyMode.set( this.cvb.getFuzzyMode() ); } if( this.craftMode != null ) { - this.craftMode.set( this.cvb.cMode ); + this.craftMode.set( this.cvb.getCraftingMode() ); } if( this.schedulingMode != null ) { - this.schedulingMode.set( this.cvb.schedulingMode ); + this.schedulingMode.set( this.cvb.getSchedulingMode() ); } } diff --git a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java index c6cb2ba59..3c4d77cc7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java @@ -34,8 +34,8 @@ import appeng.tile.misc.TileVibrationChamber; public class GuiVibrationChamber extends AEBaseGui { - final ContainerVibrationChamber cvc; - GuiProgressBar pb; + private final ContainerVibrationChamber cvc; + private GuiProgressBar pb; public GuiVibrationChamber( final InventoryPlayer inventoryPlayer, final TileVibrationChamber te ) { @@ -59,7 +59,7 @@ public class GuiVibrationChamber extends AEBaseGui this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 ); this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); - this.pb.setFullMsg( this.cvc.aePerTick * this.cvc.getCurrentProgress() / 100 + " AE/t" ); + this.pb.setFullMsg( this.cvc.getAePerTick() * this.cvc.getCurrentProgress() / 100 + " AE/t" ); if( this.cvc.getCurrentProgress() > 0 ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiWireless.java b/src/main/java/appeng/client/gui/implementations/GuiWireless.java index efa9a6f9f..3fe52dc96 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiWireless.java +++ b/src/main/java/appeng/client/gui/implementations/GuiWireless.java @@ -39,7 +39,7 @@ import appeng.util.Platform; public class GuiWireless extends AEBaseGui { - GuiImgButton units; + private GuiImgButton units; public GuiWireless( final InventoryPlayer inventoryPlayer, final TileWireless te ) { @@ -78,10 +78,10 @@ public class GuiWireless extends AEBaseGui final ContainerWireless cw = (ContainerWireless) this.inventorySlots; - if( cw.range > 0 ) + if( cw.getRange() > 0 ) { - final String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.range / 10.0 ) + " m"; - final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.drain, true ); + final String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.getRange() / 10.0 ) + " m"; + final String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.getDrain(), true ); final int strWidth = Math.max( this.fontRendererObj.getStringWidth( firstMessage ), this.fontRendererObj.getStringWidth( secondMessage ) ); final int cOffset = ( this.xSize / 2 ) - ( strWidth / 2 ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java b/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java index 0b9c8dd75..431569201 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java @@ -29,7 +29,6 @@ public class GuiWirelessTerm extends GuiMEPortableCell public GuiWirelessTerm( final InventoryPlayer inventoryPlayer, final IPortableCell te ) { super( inventoryPlayer, te ); - this.maxRows = Integer.MAX_VALUE; } @Override diff --git a/src/main/java/appeng/client/gui/widgets/GuiImgButton.java b/src/main/java/appeng/client/gui/widgets/GuiImgButton.java index ef6f9c0d3..586032e61 100644 --- a/src/main/java/appeng/client/gui/widgets/GuiImgButton.java +++ b/src/main/java/appeng/client/gui/widgets/GuiImgButton.java @@ -59,8 +59,8 @@ public class GuiImgButton extends GuiButton implements ITooltip private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL ); private static Map appearances; private final Enum buttonSetting; - public boolean halfSize = false; - public String fillVar; + private boolean halfSize = false; + private String fillVar; private Enum currentValue; public GuiImgButton( final int x, final int y, final Enum idx, final Enum val ) @@ -362,7 +362,27 @@ public class GuiImgButton extends GuiButton implements ITooltip } } - static class EnumPair + public boolean isHalfSize() + { + return this.halfSize; + } + + public void setHalfSize( final boolean halfSize ) + { + this.halfSize = halfSize; + } + + public String getFillVar() + { + return this.fillVar; + } + + public void setFillVar( final String fillVar ) + { + this.fillVar = fillVar; + } + + private static final class EnumPair { final Enum setting; diff --git a/src/main/java/appeng/client/gui/widgets/GuiNumberBox.java b/src/main/java/appeng/client/gui/widgets/GuiNumberBox.java index 0ebd44451..1443b15ae 100644 --- a/src/main/java/appeng/client/gui/widgets/GuiNumberBox.java +++ b/src/main/java/appeng/client/gui/widgets/GuiNumberBox.java @@ -26,7 +26,7 @@ import net.minecraft.client.gui.GuiTextField; public class GuiNumberBox extends GuiTextField { - final Class type; + private final Class type; public GuiNumberBox( final FontRenderer fontRenderer, final int x, final int y, final int width, final int height, final Class type ) { diff --git a/src/main/java/appeng/client/gui/widgets/GuiScrollbar.java b/src/main/java/appeng/client/gui/widgets/GuiScrollbar.java index 6de88922b..9ac472f44 100644 --- a/src/main/java/appeng/client/gui/widgets/GuiScrollbar.java +++ b/src/main/java/appeng/client/gui/widgets/GuiScrollbar.java @@ -53,7 +53,7 @@ public class GuiScrollbar implements IScrollSource } } - public int getRange() + private int getRange() { return this.maxScroll - this.minScroll; } diff --git a/src/main/java/appeng/client/gui/widgets/GuiTabButton.java b/src/main/java/appeng/client/gui/widgets/GuiTabButton.java index b304731d9..c0e421640 100644 --- a/src/main/java/appeng/client/gui/widgets/GuiTabButton.java +++ b/src/main/java/appeng/client/gui/widgets/GuiTabButton.java @@ -35,7 +35,7 @@ public class GuiTabButton extends GuiButton implements ITooltip { private final RenderItem itemRenderer; private final String message; - public int hideEdge = 0; + private int hideEdge = 0; private int myIcon = -1; private ItemStack myItem; @@ -150,4 +150,14 @@ public class GuiTabButton extends GuiButton implements ITooltip { return this.visible; } + + public int getHideEdge() + { + return this.hideEdge; + } + + public void setHideEdge( final int hideEdge ) + { + this.hideEdge = hideEdge; + } } diff --git a/src/main/java/appeng/client/me/ClientDCInternalInv.java b/src/main/java/appeng/client/me/ClientDCInternalInv.java index c539f7944..8cec1ff7c 100644 --- a/src/main/java/appeng/client/me/ClientDCInternalInv.java +++ b/src/main/java/appeng/client/me/ClientDCInternalInv.java @@ -29,14 +29,15 @@ import appeng.util.ItemSorters; public class ClientDCInternalInv implements Comparable { - public final String unlocalizedName; - public final AppEngInternalInventory inv; - public final long id; - public final long sortBy; + private final String unlocalizedName; + private final AppEngInternalInventory inventory; + + private final long id; + private final long sortBy; public ClientDCInternalInv( final int size, final long id, final long sortBy, final String unlocalizedName ) { - this.inv = new AppEngInternalInventory( null, size ); + this.inventory = new AppEngInternalInventory( null, size ); this.unlocalizedName = unlocalizedName; this.id = id; this.sortBy = sortBy; @@ -57,4 +58,14 @@ public class ClientDCInternalInv implements Comparable { return ItemSorters.compareLong( this.sortBy, o.sortBy ); } + + public AppEngInternalInventory getInventory() + { + return this.inventory; + } + + public long getId() + { + return this.id; + } } \ No newline at end of file diff --git a/src/main/java/appeng/client/me/InternalSlotME.java b/src/main/java/appeng/client/me/InternalSlotME.java index 2d25ad363..938e786f4 100644 --- a/src/main/java/appeng/client/me/InternalSlotME.java +++ b/src/main/java/appeng/client/me/InternalSlotME.java @@ -26,9 +26,9 @@ import appeng.api.storage.data.IAEItemStack; public class InternalSlotME { - public final int offset; - public final int xPos; - public final int yPos; + private final int offset; + private final int xPos; + private final int yPos; private final ItemRepo repo; public InternalSlotME( final ItemRepo def, final int offset, final int displayX, final int displayY ) @@ -39,18 +39,28 @@ public class InternalSlotME this.yPos = displayY; } - public ItemStack getStack() + ItemStack getStack() { return this.repo.getItem( this.offset ); } - public IAEItemStack getAEStack() + IAEItemStack getAEStack() { return this.repo.getReferenceItem( this.offset ); } - public boolean hasPower() + boolean hasPower() { return this.repo.hasPower(); } + + int getxPosition() + { + return this.xPos; + } + + int getyPosition() + { + return this.yPos; + } } diff --git a/src/main/java/appeng/client/me/ItemRepo.java b/src/main/java/appeng/client/me/ItemRepo.java index 1cba5d366..57af7f102 100644 --- a/src/main/java/appeng/client/me/ItemRepo.java +++ b/src/main/java/appeng/client/me/ItemRepo.java @@ -25,6 +25,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.regex.Pattern; +import javax.annotation.Nonnull; + import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.ReflectionHelper; import appeng.api.AEApi; @@ -53,10 +55,10 @@ public class ItemRepo private final IScrollSource src; private final ISortSource sortSrc; - public int rowSize = 9; + private int rowSize = 9; - public String searchString = ""; - IPartitionList myPartitionList; + private String searchString = ""; + private IPartitionList myPartitionList; private String innerSearch = ""; private String NEIWord = null; private boolean hasPower; @@ -216,7 +218,7 @@ public class ItemRepo final Enum SortBy = this.sortSrc.getSortBy(); final Enum SortDir = this.sortSrc.getSortDir(); - ItemSorters.Direction = (appeng.api.config.SortDir) SortDir; + ItemSorters.setDirection( (appeng.api.config.SortDir) SortDir ); ItemSorters.init(); if( SortBy == SortOrder.MOD ) @@ -285,4 +287,24 @@ public class ItemRepo { this.hasPower = hasPower; } + + public int getRowSize() + { + return this.rowSize; + } + + public void setRowSize( final int rowSize ) + { + this.rowSize = rowSize; + } + + public String getSearchString() + { + return this.searchString; + } + + public void setSearchString( @Nonnull final String searchString ) + { + this.searchString = searchString; + } } diff --git a/src/main/java/appeng/client/me/SlotDisconnected.java b/src/main/java/appeng/client/me/SlotDisconnected.java index 00fa56c21..07ceb2cf2 100644 --- a/src/main/java/appeng/client/me/SlotDisconnected.java +++ b/src/main/java/appeng/client/me/SlotDisconnected.java @@ -30,11 +30,11 @@ import appeng.util.Platform; public class SlotDisconnected extends AppEngSlot { - public final ClientDCInternalInv mySlot; + private final ClientDCInternalInv mySlot; public SlotDisconnected( final ClientDCInternalInv me, final int which, final int x, final int y ) { - super( me.inv, which, x, y ); + super( me.getInventory(), which, x, y ); this.mySlot = me; } @@ -103,4 +103,9 @@ public class SlotDisconnected extends AppEngSlot { return false; } + + public ClientDCInternalInv getSlot() + { + return this.mySlot; + } } diff --git a/src/main/java/appeng/client/me/SlotME.java b/src/main/java/appeng/client/me/SlotME.java index 3024bdbc4..2c6a0fc1b 100644 --- a/src/main/java/appeng/client/me/SlotME.java +++ b/src/main/java/appeng/client/me/SlotME.java @@ -30,11 +30,11 @@ import appeng.api.storage.data.IAEItemStack; public class SlotME extends Slot { - public final InternalSlotME mySlot; + private final InternalSlotME mySlot; public SlotME( final InternalSlotME me ) { - super( null, 0, me.xPos, me.yPos ); + super( null, 0, me.getxPosition(), me.getyPosition() ); this.mySlot = me; } diff --git a/src/main/java/appeng/client/render/AppEngRenderItem.java b/src/main/java/appeng/client/render/AppEngRenderItem.java index 9655591ca..ec006c3e9 100644 --- a/src/main/java/appeng/client/render/AppEngRenderItem.java +++ b/src/main/java/appeng/client/render/AppEngRenderItem.java @@ -19,6 +19,10 @@ package appeng.client.render; +import javax.annotation.Nonnull; + +import org.lwjgl.opengl.GL11; + import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -27,8 +31,6 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; - import appeng.api.storage.data.IAEItemStack; import appeng.core.AEConfig; import appeng.core.localization.GuiText; @@ -55,7 +57,7 @@ public class AppEngRenderItem extends RenderItem private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE; private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE; - public IAEItemStack aeStack; + private IAEItemStack aeStack = null; @Override public void renderItemOverlayIntoGUI( @@ -137,7 +139,7 @@ public class AppEngRenderItem extends RenderItem private void renderQuad( final Tessellator par1Tessellator, final int par2, final int par3, final int par4, final int par5, final int par6 ) { final WorldRenderer wr = par1Tessellator.getWorldRenderer(); - + wr.startDrawingQuads(); wr.setColorOpaque_I( par6 ); wr.addVertex( par2, par3, 0.0D ); @@ -158,4 +160,14 @@ public class AppEngRenderItem extends RenderItem return WIDE_CONVERTER.toWideReadableForm( originalSize ); } } + + public IAEItemStack getAeStack() + { + return this.aeStack; + } + + public void setAeStack( @Nonnull final IAEItemStack aeStack ) + { + this.aeStack = aeStack; + } } diff --git a/src/main/java/appeng/client/render/BaseBlockRender.java b/src/main/java/appeng/client/render/BaseBlockRender.java index 9b1292365..7d634475f 100644 --- a/src/main/java/appeng/client/render/BaseBlockRender.java +++ b/src/main/java/appeng/client/render/BaseBlockRender.java @@ -24,6 +24,9 @@ import java.util.EnumSet; import javax.annotation.Nullable; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.WorldRenderer; @@ -40,9 +43,6 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.GL11; - import appeng.api.util.AEPartLocation; import appeng.api.util.IOrientable; import appeng.block.AEBaseBlock; @@ -80,7 +80,7 @@ public class BaseBlockRender setOriMap(); } - public static void setOriMap() + private static void setOriMap() { // pointed up... ORIENTATION_MAP[0][3][1] = 0; @@ -279,7 +279,7 @@ public class BaseBlockRender return ( r << 16 ) | ( g << 8 ) | b; } - public double getTesrRenderDistance() + double getTesrRenderDistance() { return this.renderDistance; } @@ -294,14 +294,14 @@ public class BaseBlockRender block.setRenderStateByMeta( item.getItemDamage() ); } - renderer.uvRotateBottom = info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.UP ) ); - renderer.uvRotateTop = info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.UP ) ); + renderer.setUvRotateBottom( info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.UP ) ) ); + renderer.setUvRotateTop( info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.UP ) ) ); - renderer.uvRotateEast = info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.UP ) ); - renderer.uvRotateWest = info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.UP ) ); + renderer.setUvRotateEast( info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.UP ) ) ); + renderer.setUvRotateWest( info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.UP ) ) ); - renderer.uvRotateNorth = info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP ) ); - renderer.uvRotateSouth = info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, EnumFacing.SOUTH, EnumFacing.UP ) ); + renderer.setUvRotateNorth( info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP ) ) ); + renderer.setUvRotateSouth( info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, EnumFacing.SOUTH, EnumFacing.UP ) ) ); } this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), block, item, 0xffffff, renderer ); @@ -311,10 +311,10 @@ public class BaseBlockRender info.setTemporaryRenderIcon( null ); } - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); } - public static int getOrientation( final EnumFacing in, final EnumFacing forward, final EnumFacing up ) + static int getOrientation( final EnumFacing in, final EnumFacing forward, final EnumFacing up ) { if( in == null // 1 || forward == null // 2 @@ -339,51 +339,51 @@ public class BaseBlockRender final IAESprite[] icons = tess.getIcon( item == null ? block.getDefaultState() : block.getStateFromMeta( item.getMetadata() ) ); final BlockPos zero = new BlockPos(0,0,0); - + if( sides.contains( AEPartLocation.DOWN ) ) { tess.setNormal( 0.0F, -1.0F, 0.0F ); tess.setColorOpaque_I( color ); - tess.renderFaceYNeg( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.DOWN ), icons[ AEPartLocation.DOWN.ordinal() ] ) ); + tess.renderFaceYNeg( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.DOWN ), icons[ AEPartLocation.DOWN.ordinal() ] ) ); } if( sides.contains( AEPartLocation.UP ) ) { tess.setNormal( 0.0F, 1.0F, 0.0F ); tess.setColorOpaque_I( color ); - tess.renderFaceYPos( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.UP ), icons[ AEPartLocation.UP.ordinal() ] ) ); + tess.renderFaceYPos( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.UP ), icons[ AEPartLocation.UP.ordinal() ] ) ); } if( sides.contains( AEPartLocation.NORTH ) ) { tess.setNormal( 0.0F, 0.0F, -1.0F ); tess.setColorOpaque_I( color ); - tess.renderFaceZNeg( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.NORTH ), icons[ AEPartLocation.NORTH.ordinal() ] ) ); + tess.renderFaceZNeg( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.NORTH ), icons[ AEPartLocation.NORTH.ordinal() ] ) ); } if( sides.contains( AEPartLocation.SOUTH ) ) { tess.setNormal( 0.0F, 0.0F, 1.0F ); tess.setColorOpaque_I( color ); - tess.renderFaceZPos( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.SOUTH ), icons[ AEPartLocation.SOUTH.ordinal() ] ) ); + tess.renderFaceZPos( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.SOUTH ), icons[ AEPartLocation.SOUTH.ordinal() ] ) ); } if( sides.contains( AEPartLocation.WEST ) ) { tess.setNormal( -1.0F, 0.0F, 0.0F ); tess.setColorOpaque_I( color ); - tess.renderFaceXNeg( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.WEST ), icons[ AEPartLocation.WEST.ordinal() ] ) ); + tess.renderFaceXNeg( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.WEST ), icons[ AEPartLocation.WEST.ordinal() ] ) ); } if( sides.contains( AEPartLocation.EAST ) ) { tess.setNormal( 1.0F, 0.0F, 0.0F ); tess.setColorOpaque_I( color ); - tess.renderFaceXPos( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.EAST ), icons[ AEPartLocation.EAST.ordinal() ]) ); + tess.renderFaceXPos( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.EAST ), icons[ AEPartLocation.EAST.ordinal() ]) ); } } - public IAESprite firstNotNull( final IAESprite... s ) + private IAESprite firstNotNull( final IAESprite... s ) { for( final IAESprite o : s ) { @@ -415,20 +415,20 @@ public class BaseBlockRender final EnumFacing forward = te.getForward(); final EnumFacing up = te.getUp(); - renderer.uvRotateBottom = info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, forward, up ) ); - renderer.uvRotateTop = info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, forward, up ) ); + renderer.setUvRotateBottom( info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, forward, up ) ) ); + renderer.setUvRotateTop( info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, forward, up ) ) ); - renderer.uvRotateEast = info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, forward, up ) ); - renderer.uvRotateWest = info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, forward, up ) ); + renderer.setUvRotateEast( info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, forward, up ) ) ); + renderer.setUvRotateWest( info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, forward, up ) ) ); - renderer.uvRotateNorth = info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, forward, up ) ); - renderer.uvRotateSouth = info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, forward, up ) ); + renderer.setUvRotateNorth( info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, forward, up ) ) ); + renderer.setUvRotateSouth( info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, forward, up ) ) ); } } public void postRenderInWorld( final ModelGenerator renderer ) { - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); } @Nullable @@ -483,12 +483,12 @@ public class BaseBlockRender bZ += 1; } - renderer.renderMinX = Math.min( aX, bX ); - renderer.renderMinY = Math.min( aY, bY ); - renderer.renderMinZ = Math.min( aZ, bZ ); - renderer.renderMaxX = Math.max( aX, bX ); - renderer.renderMaxY = Math.max( aY, bY ); - renderer.renderMaxZ = Math.max( aZ, bZ ); + renderer.setRenderMinX( Math.min( aX, bX ) ); + renderer.setRenderMinY( Math.min( aY, bY ) ); + renderer.setRenderMinZ( Math.min( aZ, bZ ) ); + renderer.setRenderMaxX( Math.max( aX, bX ) ); + renderer.setRenderMaxY( Math.max( aY, bY ) ); + renderer.setRenderMaxZ( Math.max( aZ, bZ ) ); } @SideOnly( Side.CLIENT ) @@ -642,14 +642,14 @@ public class BaseBlockRender final double maxY = ( forward.getFrontOffsetY() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetY(), u2 ) + this.mapFaceUV( up.getFrontOffsetY(), v2 ); final double maxZ = ( forward.getFrontOffsetZ() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetZ(), u2 ) + this.mapFaceUV( up.getFrontOffsetZ(), v2 ); - renderer.renderMinX = Math.max( 0.0, Math.min( minX, maxX ) - ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) ); - renderer.renderMaxX = Math.min( 1.0, Math.max( minX, maxX ) + ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) ); + renderer.setRenderMinX( Math.max( 0.0, Math.min( minX, maxX ) - ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) ) ); + renderer.setRenderMaxX( Math.min( 1.0, Math.max( minX, maxX ) + ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) ) ); - renderer.renderMinY = Math.max( 0.0, Math.min( minY, maxY ) - ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) ); - renderer.renderMaxY = Math.min( 1.0, Math.max( minY, maxY ) + ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) ); + renderer.setRenderMinY( Math.max( 0.0, Math.min( minY, maxY ) - ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) ) ); + renderer.setRenderMaxY( Math.min( 1.0, Math.max( minY, maxY ) + ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) ) ); - renderer.renderMinZ = Math.max( 0.0, Math.min( minZ, maxZ ) - ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) ); - renderer.renderMaxZ = Math.min( 1.0, Math.max( minZ, maxZ ) + ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) ); + renderer.setRenderMinZ( Math.max( 0.0, Math.min( minZ, maxZ ) - ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) ) ); + renderer.setRenderMaxZ( Math.min( 1.0, Math.max( minZ, maxZ ) + ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) ) ); } private double mapFaceUV( final int offset, final int uv ) @@ -670,7 +670,7 @@ public class BaseBlockRender public void renderTile( final B block, final T tile, final WorldRenderer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer ) { - renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0; + renderer.setUvRotateBottom( renderer.setUvRotateTop( renderer.setUvRotateEast( renderer.setUvRotateWest( renderer.setUvRotateNorth( renderer.setUvRotateSouth( 0 ) ) ) ) ) ); final AEPartLocation up = AEPartLocation.UP; final AEPartLocation forward = AEPartLocation.SOUTH; @@ -700,7 +700,7 @@ public class BaseBlockRender renderer.setTranslation( 0, 0, 0 ); RenderHelper.enableStandardItemLighting(); - renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0; + renderer.setUvRotateBottom( renderer.setUvRotateTop( renderer.setUvRotateEast( renderer.setUvRotateWest( renderer.setUvRotateNorth( renderer.setUvRotateSouth( 0 ) ) ) ) ) ); } protected void applyTESRRotation( final double x, final double y, final double z, final EnumFacing forward, final EnumFacing up ) diff --git a/src/main/java/appeng/client/render/BlockRenderInfo.java b/src/main/java/appeng/client/render/BlockRenderInfo.java index 1ffb49bbc..9da15eca1 100644 --- a/src/main/java/appeng/client/render/BlockRenderInfo.java +++ b/src/main/java/appeng/client/render/BlockRenderInfo.java @@ -28,7 +28,7 @@ import appeng.client.texture.TmpFlippableIcon; public class BlockRenderInfo { - public final BaseBlockRender rendererInstance; + private final BaseBlockRender rendererInstance; private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon(); private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon(); private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon(); @@ -131,8 +131,13 @@ public class BlockRenderInfo return this.topIcon; } - public boolean isValid() + boolean isValid() { return this.topIcon != null && this.bottomIcon != null && this.southIcon != null && this.northIcon != null && this.eastIcon != null && this.westIcon != null; } + + public BaseBlockRender getRendererInstance() + { + return this.rendererInstance; + } } diff --git a/src/main/java/appeng/client/render/BusRenderHelper.java b/src/main/java/appeng/client/render/BusRenderHelper.java index 2e4682572..50f4497ba 100644 --- a/src/main/java/appeng/client/render/BusRenderHelper.java +++ b/src/main/java/appeng/client/render/BusRenderHelper.java @@ -125,16 +125,16 @@ public final class BusRenderHelper implements IPartRenderHelper } /* - public void setRenderColor( int color ) - { - for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() ) - { - final BlockCableBus cableBus = (BlockCableBus) block; - cableBus.setRenderColor( color ); - } - } - */ - + * public void setRenderColor( int color ) + * { + * for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() ) + * { + * final BlockCableBus cableBus = (BlockCableBus) block; + * cableBus.setRenderColor( color ); + * } + * } + */ + public void setOrientation( final EnumFacing dx, final EnumFacing dy, final EnumFacing dz ) { this.ax = dx == null ? EnumFacing.EAST : dx; @@ -250,7 +250,7 @@ public final class BusRenderHelper implements IPartRenderHelper this.renderingForPass = pass; } - public boolean renderThis() + private boolean renderThis() { if( this.renderingForPass == this.currentPass || this.noAlphaPass ) { @@ -304,7 +304,7 @@ public final class BusRenderHelper implements IPartRenderHelper } } - public EnumFacing mapRotation( final EnumFacing dir ) + private EnumFacing mapRotation( final EnumFacing dir ) { final EnumFacing forward = this.az; final EnumFacing up = this.ay; @@ -353,7 +353,7 @@ public final class BusRenderHelper implements IPartRenderHelper { return EnumFacing.EAST; } - + return null; } @@ -396,14 +396,14 @@ public final class BusRenderHelper implements IPartRenderHelper final EnumFacing forward = BusRenderHelper.INSTANCE.az; final EnumFacing up = BusRenderHelper.INSTANCE.ay; - renderer.uvRotateBottom = info.getTexture( AEPartLocation.DOWN ).setFlip( BaseBlockRender.getOrientation( EnumFacing.DOWN, forward, up ) ); - renderer.uvRotateTop = info.getTexture( AEPartLocation.UP ).setFlip( BaseBlockRender.getOrientation( EnumFacing.UP, forward, up ) ); + renderer.setUvRotateBottom( info.getTexture( AEPartLocation.DOWN ).setFlip( BaseBlockRender.getOrientation( EnumFacing.DOWN, forward, up ) ) ); + renderer.setUvRotateTop( info.getTexture( AEPartLocation.UP ).setFlip( BaseBlockRender.getOrientation( EnumFacing.UP, forward, up ) ) ); - renderer.uvRotateEast = info.getTexture( AEPartLocation.EAST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.EAST, forward, up ) ); - renderer.uvRotateWest = info.getTexture( AEPartLocation.WEST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.WEST, forward, up ) ); + renderer.setUvRotateEast( info.getTexture( AEPartLocation.EAST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.EAST, forward, up ) ) ); + renderer.setUvRotateWest( info.getTexture( AEPartLocation.WEST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.WEST, forward, up ) ) ); - renderer.uvRotateNorth = info.getTexture( AEPartLocation.NORTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.NORTH, forward, up ) ); - renderer.uvRotateSouth = info.getTexture( AEPartLocation.SOUTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.SOUTH, forward, up ) ); + renderer.setUvRotateNorth( info.getTexture( AEPartLocation.NORTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.NORTH, forward, up ) ) ); + renderer.setUvRotateSouth( info.getTexture( AEPartLocation.SOUTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.SOUTH, forward, up ) ) ); this.bbr.renderBlockBounds( renderer, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az ); @@ -430,7 +430,7 @@ public final class BusRenderHelper implements IPartRenderHelper @Override public void setFacesToRender( final EnumSet faces ) { - BusRenderer.INSTANCE.renderer.renderFaces = faces; + BusRenderer.INSTANCE.getRenderer().setRenderFaces( faces ); } @Override diff --git a/src/main/java/appeng/client/render/BusRenderer.java b/src/main/java/appeng/client/render/BusRenderer.java index 84dffc0ee..597611b1f 100644 --- a/src/main/java/appeng/client/render/BusRenderer.java +++ b/src/main/java/appeng/client/render/BusRenderer.java @@ -50,7 +50,7 @@ public class BusRenderer implements IItemRenderer public static final BusRenderer INSTANCE = new BusRenderer(); private static final Map RENDER_PART = new HashMap(); - public ModelGenerator renderer; + private ModelGenerator renderer; @Override public boolean handleRenderType( final ItemStack item, final ItemRenderType type ) @@ -113,18 +113,18 @@ public class BusRenderer implements IItemRenderer GL11.glScaled( 1.2, 1.2, 1. ); GL11.glColor4f( 1, 1, 1, 1 ); - this.renderer.setColorOpaque_F( 1, 1, 1 ); - this.renderer.setBrightness( 14 << 20 | 14 << 4 ); + this.getRenderer().setColorOpaque_F( 1, 1, 1 ); + this.getRenderer().setBrightness( 14 << 20 | 14 << 4 ); BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 ); BusRenderHelper.INSTANCE.setTexture( null ); BusRenderHelper.INSTANCE.setInvColor( 0xffffff ); - this.renderer.blockAccess = ClientHelper.proxy.getWorld(); + this.getRenderer().setBlockAccess( ClientHelper.proxy.getWorld() ); BusRenderHelper.INSTANCE.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH ); - this.renderer.uvRotateBottom = this.renderer.uvRotateEast = this.renderer.uvRotateNorth = this.renderer.uvRotateSouth = this.renderer.uvRotateTop = this.renderer.uvRotateWest = 0; - this.renderer.overrideBlockTexture = null; + this.getRenderer().setUvRotateBottom( this.getRenderer().setUvRotateEast( this.getRenderer().setUvRotateNorth( this.getRenderer().setUvRotateSouth( this.getRenderer().setUvRotateTop( this.getRenderer().setUvRotateWest( 0 ) ) ) ) ) ); + this.getRenderer().setOverrideBlockTexture( null ); if( item.getItem() instanceof IFacadeItem ) { @@ -139,7 +139,7 @@ public class BusRenderer implements IItemRenderer if( fp != null ) { - fp.renderInventory( BusRenderHelper.INSTANCE, this.renderer ); + fp.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() ); } } else @@ -153,18 +153,18 @@ public class BusRenderer implements IItemRenderer GL11.glTranslatef( 0.0f, 0.0f, -0.04f * ( 8 - depth ) - 0.06f ); } - ip.renderInventory( BusRenderHelper.INSTANCE, this.renderer ); + ip.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() ); } } - this.renderer.uvRotateBottom = this.renderer.uvRotateEast = this.renderer.uvRotateNorth = this.renderer.uvRotateSouth = this.renderer.uvRotateTop = this.renderer.uvRotateWest = 0; + this.getRenderer().setUvRotateBottom( this.getRenderer().setUvRotateEast( this.getRenderer().setUvRotateNorth( this.getRenderer().setUvRotateSouth( this.getRenderer().setUvRotateTop( this.getRenderer().setUvRotateWest( 0 ) ) ) ) ) ); GL11.glPopAttrib(); GL11.glPopMatrix(); } @Nullable - public IPart getRenderer( final ItemStack is, final IPartItem c ) + private IPart getRenderer( final ItemStack is, final IPartItem c ) { final int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage(); @@ -180,4 +180,14 @@ public class BusRenderer implements IItemRenderer return part; } + + public ModelGenerator getRenderer() + { + return this.renderer; + } + + public void setRenderer( ModelGenerator renderer ) + { + this.renderer = renderer; + } } diff --git a/src/main/java/appeng/client/render/CableRenderHelper.java b/src/main/java/appeng/client/render/CableRenderHelper.java index d37239a5c..8bd9ffb18 100644 --- a/src/main/java/appeng/client/render/CableRenderHelper.java +++ b/src/main/java/appeng/client/render/CableRenderHelper.java @@ -50,9 +50,9 @@ public class CableRenderHelper public void renderStatic( final CableBusContainer cableBusContainer, final IFacadeContainer iFacadeContainer ) { final TileEntity te = cableBusContainer.getTile(); - final ModelGenerator renderer = BusRenderer.INSTANCE.renderer; + final ModelGenerator renderer = BusRenderer.INSTANCE.getRenderer(); - if( renderer.overrideBlockTexture != null ) + if( renderer.getOverrideBlockTexture() != null ) { BusRenderHelper.INSTANCE.setPass( 0 ); } @@ -61,9 +61,9 @@ public class CableRenderHelper BusRenderHelper.INSTANCE.setPass( MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.TRANSLUCENT ? 1 : 0 ); } - if( renderer.blockAccess == null ) + if( renderer.getBlockAccess() == null ) { - renderer.blockAccess = Minecraft.getMinecraft().theWorld; + renderer.setBlockAccess( Minecraft.getMinecraft().theWorld ); } for( final AEPartLocation s : AEPartLocation.values() ) @@ -72,16 +72,21 @@ public class CableRenderHelper if( part != null ) { this.setSide( s ); - renderer.renderAllFaces = true; + renderer.setRenderAllFaces( true ); - //renderer.flipTexture = false; - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + // renderer.flipTexture = false; + renderer.setUvRotateBottom( 0 ); + renderer.setUvRotateEast( 0 ); + renderer.setUvRotateNorth( 0 ); + renderer.setUvRotateSouth( 0 ); + renderer.setUvRotateTop( 0 ); + renderer.setUvRotateWest( 0 ); renderer.setOverrideBlockTexture( null ); part.renderStatic( te.getPos(), BusRenderHelper.INSTANCE, renderer ); - //renderer.faces = EnumSet.allOf( EnumFacing.class ); - //renderer.useTextures = true; + // renderer.faces = EnumSet.allOf( EnumFacing.class ); + // renderer.useTextures = true; } } @@ -151,18 +156,23 @@ public class CableRenderHelper } } - renderer.flipTexture = false; - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setFlipTexture( false ); + renderer.setUvRotateBottom( 0 ); + renderer.setUvRotateEast( 0 ); + renderer.setUvRotateNorth( 0 ); + renderer.setUvRotateSouth( 0 ); + renderer.setUvRotateTop( 0 ); + renderer.setUvRotateWest( 0 ); renderer.setOverrideBlockTexture( null ); this.setSide( s ); - + fPart.renderStatic( te.getPos(), BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b == null ? null : b.getBoundingBox(), cableBusContainer.getPart( s ) == null ); } } - //renderer.isFacade = false; - //renderer.enableAO = false; + // renderer.isFacade = false; + // renderer.enableAO = false; // renderer.sett } } @@ -266,7 +276,7 @@ public class CableRenderHelper } BusRenderHelper.INSTANCE.setOrientation( ax, ay, az ); - part.renderDynamic( x, y, z, BusRenderHelper.INSTANCE, BusRenderer.INSTANCE.renderer ); + part.renderDynamic( x, y, z, BusRenderHelper.INSTANCE, BusRenderer.INSTANCE.getRenderer() ); } } } diff --git a/src/main/java/appeng/client/render/IconUnwrapper.java b/src/main/java/appeng/client/render/IconUnwrapper.java index daaf81246..c52d14cb2 100644 --- a/src/main/java/appeng/client/render/IconUnwrapper.java +++ b/src/main/java/appeng/client/render/IconUnwrapper.java @@ -7,15 +7,15 @@ import appeng.client.texture.IAESprite; public class IconUnwrapper extends TextureAtlasSprite { - - int width; - int height; - - float max_u; - float min_u; - float min_v; - float max_v; - + + private int width; + private int height; + + private float max_u; + private float min_u; + private float min_v; + private float max_v; + protected IconUnwrapper( final IAESprite src ) { diff --git a/src/main/java/appeng/client/render/ModelGenerator.java b/src/main/java/appeng/client/render/ModelGenerator.java index c3e6f8cb3..ea8658a08 100644 --- a/src/main/java/appeng/client/render/ModelGenerator.java +++ b/src/main/java/appeng/client/render/ModelGenerator.java @@ -1,5 +1,7 @@ + package appeng.client.render; + import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -32,21 +34,22 @@ import appeng.client.texture.MissingIcon; import appeng.items.AEBaseItem; import appeng.items.parts.ItemMultiPart; + public class ModelGenerator { private static final class CachedModel implements IBakedModel { - List[] faces = new List[6]; - List general; + private List[] faces = new List[6]; + private List general; public CachedModel() { this.general = new ArrayList(); - for ( final EnumFacing f : EnumFacing.VALUES ) + for( final EnumFacing f : EnumFacing.VALUES ) this.faces[f.ordinal()] = new ArrayList(); } - + @Override public boolean isGui3d() { @@ -91,45 +94,66 @@ public class ModelGenerator } } - public int uvRotateBottom; - public int uvRotateEast; - public int uvRotateNorth; - public int uvRotateSouth; - public int uvRotateTop; - public int uvRotateWest; - public IAESprite overrideBlockTexture; - public boolean renderAllFaces; + private int uvRotateBottom; + private int uvRotateEast; + private int uvRotateNorth; + private int uvRotateSouth; + private int uvRotateTop; + private int uvRotateWest; + private IAESprite overrideBlockTexture; + private boolean renderAllFaces; - public double renderMinX; - public double renderMaxX; - - public double renderMinY; - public double renderMaxY; - - public double renderMinZ; - public double renderMaxZ; + private double renderMinX; + private double renderMaxX; - public IBlockAccess blockAccess; - - CachedModel generatedModel = new CachedModel(); + private double renderMinY; + private double renderMaxY; + + private double renderMinZ; + private double renderMaxZ; + + private IBlockAccess blockAccess; + + private CachedModel generatedModel = new CachedModel(); // used to create faces... - final FaceBakery faceBakery = new FaceBakery(); + private final FaceBakery faceBakery = new FaceBakery(); - float tx=0,ty=0,tz=0; - final float[] defUVs = { 0, 0, 1, 1 }; + private float tx = 0, ty = 0, tz = 0; + private final float[] defUVs = { 0, 0, 1, 1 }; + + private final float[] quadsUV = { + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1 + }; + private EnumSet renderFaces = EnumSet.allOf( EnumFacing.class ); + private boolean flipTexture = false; + private List faces = new ArrayList(); + + private int point = 0; + private int brightness = -1; + private float[][] points = new float[4][]; + private EnumFacing currentFace = EnumFacing.UP; + private int color = -1; public void setRenderBoundsFromBlock( final Block block ) { - if ( block == null ) return; + if( block == null ) + return; - this.renderMinX = block.getBlockBoundsMinX(); - this.renderMinY = block.getBlockBoundsMinY(); - this.renderMinZ = block.getBlockBoundsMinZ(); - this.renderMaxX = block.getBlockBoundsMaxX(); - this.renderMaxY = block.getBlockBoundsMaxY(); - this.renderMaxZ = block.getBlockBoundsMaxZ(); + this.setRenderMinX( block.getBlockBoundsMinX() ); + this.setRenderMinY( block.getBlockBoundsMinY() ); + this.setRenderMinZ( block.getBlockBoundsMinZ() ); + this.setRenderMaxX( block.getBlockBoundsMaxX() ); + this.setRenderMaxY( block.getBlockBoundsMaxY() ); + this.setRenderMaxZ( block.getBlockBoundsMaxZ() ); } public void setRenderBounds( @@ -140,20 +164,18 @@ public class ModelGenerator final double h, final double i ) { - this.renderMinX = d; - this.renderMinY = e; - this.renderMinZ = f; - this.renderMaxX = g; - this.renderMaxY = h; - this.renderMaxZ = i; + this.setRenderMinX( d ); + this.setRenderMinY( e ); + this.setRenderMinZ( f ); + this.setRenderMaxX( g ); + this.setRenderMaxY( h ); + this.setRenderMaxZ( i ); } - int color = -1; - public void setBrightness( final int i ) { - this.brightness =i; + this.brightness = i; } public void setColorRGBA_F( @@ -162,7 +184,7 @@ public class ModelGenerator final int b, final float a ) { - final int alpha = ( int ) ( a * 0xff ); + final int alpha = (int) ( a * 0xff ); this.color = alpha << 24 | r << 16 | b << 8 | @@ -173,29 +195,30 @@ public class ModelGenerator final int whiteVariant ) { final int alpha = 0xff; - this.color = //alpha << 24 | - whiteVariant; + this.color = // alpha << 24 | + whiteVariant; } + public void setColorOpaque( final int r, final int g, final int b ) { final int alpha = 0xff; - this.color =// alpha << 24 | - r << 16 | + this.color = // alpha << 24 | + r << 16 | g << 8 | b; } - + public void setColorOpaque_F( final int r, final int g, final int b ) { final int alpha = 0xff; - this.color = //alpha << 24 | - Math.min( 0xff, Math.max( 0, r ) ) << 16 | + this.color = // alpha << 24 | + Math.min( 0xff, Math.max( 0, r ) ) << 16 | Math.min( 0xff, Math.max( 0, g ) ) << 8 | Math.min( 0xff, Math.max( 0, b ) ); } @@ -205,12 +228,12 @@ public class ModelGenerator final float bf, final float gf ) { - final int r = (int)( rf * 0xff ); - final int g = (int)( gf * 0xff ); - final int b = (int)( bf * 0xff ); + final int r = (int) ( rf * 0xff ); + final int g = (int) ( gf * 0xff ); + final int b = (int) ( bf * 0xff ); final int alpha = 0xff; - this.color = //alpha << 24 | - Math.min( 0xff, Math.max( 0, r ) ) << 16 | + this.color = // alpha << 24 | + Math.min( 0xff, Math.max( 0, r ) ) << 16 | Math.min( 0xff, Math.max( 0, g ) ) << 8 | Math.min( 0xff, Math.max( 0, b ) ); } @@ -219,24 +242,24 @@ public class ModelGenerator final ItemStack is ) { final Item it = is.getItem(); - - if ( it instanceof ItemMultiPart ) - return ( (ItemMultiPart) it).getIcon( is); - + + if( it instanceof ItemMultiPart ) + return ( (ItemMultiPart) it ).getIcon( is ); + final Block blk = Block.getBlockFromItem( it ); - - if ( blk != null ) - return this.getIcon(blk.getStateFromMeta( is.getMetadata() ))[0]; - if ( it instanceof AEBaseItem ) + if( blk != null ) + return this.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0]; + + if( it instanceof AEBaseItem ) { - final IAESprite ico = ( (AEBaseItem)it ).getIcon(is); - if ( ico != null ) return ico; + final IAESprite ico = ( (AEBaseItem) it ).getIcon( is ); + if( ico != null ) + return ico; } - - return new MissingIcon( is ); - } + return new MissingIcon( is ); + } public IAESprite[] getIcon( final IBlockState state ) @@ -244,62 +267,58 @@ public class ModelGenerator final IAESprite[] out = new IAESprite[6]; final Block blk = state.getBlock(); - if ( blk instanceof AEBaseBlock ) + if( blk instanceof AEBaseBlock ) { - final AEBaseBlock base = (AEBaseBlock)blk; - for ( final EnumFacing face : EnumFacing.VALUES ) + final AEBaseBlock base = (AEBaseBlock) blk; + for( final EnumFacing face : EnumFacing.VALUES ) out[face.ordinal()] = base.getIcon( face, state ); } else { final TextureAtlasSprite spite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( state ); - if ( spite == null ) + if( spite == null ) { - out[0] = new MissingIcon( blk ); - out[1] = new MissingIcon( blk ); - out[2] = new MissingIcon( blk ); - out[3] = new MissingIcon( blk ); - out[4] = new MissingIcon( blk ); - out[5] = new MissingIcon( blk ); + out[0] = new MissingIcon( blk ); + out[1] = new MissingIcon( blk ); + out[2] = new MissingIcon( blk ); + out[3] = new MissingIcon( blk ); + out[4] = new MissingIcon( blk ); + out[5] = new MissingIcon( blk ); } else { final IAESprite mySpite = new BaseIcon( spite ); - out[0] = mySpite; - out[1] = mySpite; - out[2] = mySpite; - out[3] = mySpite; - out[4] = mySpite; - out[5] = mySpite; + out[0] = mySpite; + out[1] = mySpite; + out[2] = mySpite; + out[3] = mySpite; + out[4] = mySpite; + out[5] = mySpite; } } - + return out; } - public IAESprite[] getIcon( final IBlockAccess world, final BlockPos pos) + public IAESprite[] getIcon( final IBlockAccess world, final BlockPos pos ) { final IBlockState state = world.getBlockState( pos ); final Block blk = state.getBlock(); - - if ( blk instanceof AEBaseBlock ) + + if( blk instanceof AEBaseBlock ) { final IAESprite[] out = new IAESprite[6]; - final AEBaseBlock base = (AEBaseBlock)blk; - for ( final EnumFacing face : EnumFacing.VALUES ) + final AEBaseBlock base = (AEBaseBlock) blk; + for( final EnumFacing face : EnumFacing.VALUES ) out[face.ordinal()] = base.getIcon( world, pos, face ); - + return out; } - + return this.getIcon( state ); } - int point =0; - int brightness = -1; - float[][] points = new float[4][]; - public void addVertexWithUV( final EnumFacing face, final double x, @@ -308,48 +327,48 @@ public class ModelGenerator final double u, final double v ) { - this.points[this.point++] = new float[]{ (float)x+ this.tx, (float)y+ this.ty, (float)z+ this.tz, (float)u, (float)v }; - - if ( this.point == 4 ) + this.points[this.point++] = new float[] { (float) x + this.tx, (float) y + this.ty, (float) z + this.tz, (float) u, (float) v }; + + if( this.point == 4 ) { this.brightness = -1; final int[] vertData = { - Float.floatToRawIntBits( this.points[0][0] ), - Float.floatToRawIntBits( this.points[0][1] ), - Float.floatToRawIntBits( this.points[0][2] ), - this.brightness, - Float.floatToRawIntBits( this.points[0][3] ), - Float.floatToRawIntBits( this.points[0][4] ), - 0, + Float.floatToRawIntBits( this.points[0][0] ), + Float.floatToRawIntBits( this.points[0][1] ), + Float.floatToRawIntBits( this.points[0][2] ), + this.brightness, + Float.floatToRawIntBits( this.points[0][3] ), + Float.floatToRawIntBits( this.points[0][4] ), + 0, - Float.floatToRawIntBits( this.points[1][0] ), - Float.floatToRawIntBits( this.points[1][1] ), - Float.floatToRawIntBits( this.points[1][2] ), - this.brightness, - Float.floatToRawIntBits( this.points[1][3] ), - Float.floatToRawIntBits( this.points[1][4] ), - 0, - - Float.floatToRawIntBits( this.points[2][0] ), - Float.floatToRawIntBits( this.points[2][1] ), - Float.floatToRawIntBits( this.points[2][2] ), - this.brightness, - Float.floatToRawIntBits( this.points[2][3] ), - Float.floatToRawIntBits( this.points[2][4] ), - 0, - - Float.floatToRawIntBits( this.points[3][0] ), - Float.floatToRawIntBits( this.points[3][1] ), - Float.floatToRawIntBits( this.points[3][2] ), - this.brightness, - Float.floatToRawIntBits( this.points[3][3] ), - Float.floatToRawIntBits( this.points[3][4] ), - 0, + Float.floatToRawIntBits( this.points[1][0] ), + Float.floatToRawIntBits( this.points[1][1] ), + Float.floatToRawIntBits( this.points[1][2] ), + this.brightness, + Float.floatToRawIntBits( this.points[1][3] ), + Float.floatToRawIntBits( this.points[1][4] ), + 0, + + Float.floatToRawIntBits( this.points[2][0] ), + Float.floatToRawIntBits( this.points[2][1] ), + Float.floatToRawIntBits( this.points[2][2] ), + this.brightness, + Float.floatToRawIntBits( this.points[2][3] ), + Float.floatToRawIntBits( this.points[2][4] ), + 0, + + Float.floatToRawIntBits( this.points[3][0] ), + Float.floatToRawIntBits( this.points[3][1] ), + Float.floatToRawIntBits( this.points[3][2] ), + this.brightness, + Float.floatToRawIntBits( this.points[3][3] ), + Float.floatToRawIntBits( this.points[3][4] ), + 0, }; - this.generatedModel.general.add( new IColoredBakedQuad.ColoredBakedQuad( vertData, this.color, face )); + this.generatedModel.general.add( new IColoredBakedQuad.ColoredBakedQuad( vertData, this.color, face ) ); - this.point =0; + this.point = 0; } } @@ -357,9 +376,9 @@ public class ModelGenerator final Block block, final BlockPos pos ) { - //setRenderBoundsFromBlock( block ); + // setRenderBoundsFromBlock( block ); - final IAESprite[] textures = this.getIcon( this.blockAccess,pos ); + final IAESprite[] textures = this.getIcon( this.getBlockAccess(), pos ); this.setColorOpaque_I( 0xffffff ); this.renderFaceXNeg( block, pos, textures[EnumFacing.WEST.ordinal()] ); @@ -368,7 +387,7 @@ public class ModelGenerator this.renderFaceYPos( block, pos, textures[EnumFacing.UP.ordinal()] ); this.renderFaceZNeg( block, pos, textures[EnumFacing.NORTH.ordinal()] ); this.renderFaceZPos( block, pos, textures[EnumFacing.SOUTH.ordinal()] ); - + return false; } @@ -377,9 +396,9 @@ public class ModelGenerator final int y, final int z ) { - this.tx =x; - this.ty =y; - this.tz =z; + this.tx = x; + this.ty = y; + this.tz = z; } public boolean isAlphaPass() @@ -387,31 +406,17 @@ public class ModelGenerator return MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.TRANSLUCENT; } - final float[] quadsUV = { - 0, - 0, - 1, - 1, - 0, - 0, - 1, - 1 - }; - public EnumSet renderFaces = EnumSet.allOf(EnumFacing.class); - public boolean flipTexture=false; - private List faces = new ArrayList(); - private float[] getFaceUvs( final EnumFacing face, final Vector3f to_16, - final Vector3f from_16 ) + final Vector3f from_16 ) { float from_a = 0; float from_b = 0; float to_a = 0; float to_b = 0; - switch ( face ) + switch( face ) { case UP: from_a = from_16.x / 16.0f; @@ -473,57 +478,57 @@ public class ModelGenerator return afloat; } - + public void renderFaceXNeg( final Block blk, final BlockPos pos, final IAESprite lights ) - { - final boolean isEdge = this.renderMinX < 0.0001; - final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f); - final Vector3f from = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f); + { + final boolean isEdge = this.getRenderMinX() < 0.0001; + final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f ); + final Vector3f from = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f ); final EnumFacing myFace = EnumFacing.WEST; - this.addFace(myFace, isEdge,to,from, this.defUVs,lights ); + this.addFace( myFace, isEdge, to, from, this.defUVs, lights ); } - + public void renderFaceYNeg( final Block blk, final BlockPos pos, final IAESprite lights ) - { - final boolean isEdge = this.renderMinY < 0.0001; - final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f ); - final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMaxZ * 16.0f ); + { + final boolean isEdge = this.getRenderMinY() < 0.0001; + final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f ); + final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f ); final EnumFacing myFace = EnumFacing.DOWN; - this.addFace(myFace, isEdge,to,from, this.defUVs, lights ); + this.addFace( myFace, isEdge, to, from, this.defUVs, lights ); } public void renderFaceZNeg( final Block blk, final BlockPos pos, final IAESprite lights ) - { - final boolean isEdge = this.renderMinZ < 0.0001; - final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f ); - final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMinZ * 16.0f ); + { + final boolean isEdge = this.getRenderMinZ() < 0.0001; + final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f ); + final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMinZ() * 16.0f ); final EnumFacing myFace = EnumFacing.NORTH; - this.addFace(myFace, isEdge,to,from, this.defUVs, lights ); + this.addFace( myFace, isEdge, to, from, this.defUVs, lights ); } public void renderFaceYPos( final Block blk, final BlockPos pos, final IAESprite lights ) - { - final boolean isEdge = this.renderMaxY > 0.9999; - final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMinZ * 16.0f ); - final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f); + { + final boolean isEdge = this.getRenderMaxY() > 0.9999; + final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMinZ() * 16.0f ); + final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f ); final EnumFacing myFace = EnumFacing.UP; - this.addFace(myFace, isEdge,to,from, this.defUVs,lights ); + this.addFace( myFace, isEdge, to, from, this.defUVs, lights ); } public void renderFaceZPos( @@ -531,12 +536,12 @@ public class ModelGenerator final BlockPos pos, final IAESprite lights ) { - final boolean isEdge = this.renderMaxZ > 0.9999; - final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMaxZ * 16.0f ); - final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f ); + final boolean isEdge = this.getRenderMaxZ() > 0.9999; + final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f ); + final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f ); final EnumFacing myFace = EnumFacing.SOUTH; - this.addFace(myFace, isEdge,to,from, this.defUVs,lights ); + this.addFace( myFace, isEdge, to, from, this.defUVs, lights ); } public void renderFaceXPos( @@ -544,45 +549,43 @@ public class ModelGenerator final BlockPos pos, final IAESprite lights ) { - final boolean isEdge = this.renderMaxX > 0.9999; - final Vector3f to = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f ); - final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f ); + final boolean isEdge = this.getRenderMaxX() > 0.9999; + final Vector3f to = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f ); + final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f ); final EnumFacing myFace = EnumFacing.EAST; - this.addFace(myFace, isEdge,to,from, this.defUVs, lights ); + this.addFace( myFace, isEdge, to, from, this.defUVs, lights ); } private void addFace( - final EnumFacing face , final boolean isEdge, + final EnumFacing face, final boolean isEdge, final Vector3f to, final Vector3f from, final float[] defUVs2, IAESprite texture ) { - if ( this.overrideBlockTexture != null ) - texture = this.overrideBlockTexture; + if( this.getOverrideBlockTexture() != null ) + texture = this.getOverrideBlockTexture(); this.faces.add( new SMFace( face, isEdge, this.color, to, from, defUVs2, new IconUnwrapper( texture ) ) ); } - EnumFacing currentFace = EnumFacing.UP; - public void setNormal( final float x, final float y, final float z ) { - if ( x > 0.5 ) + if( x > 0.5 ) this.currentFace = EnumFacing.EAST; - if ( x < -0.5 ) + if( x < -0.5 ) this.currentFace = EnumFacing.WEST; - if ( y > 0.5 ) + if( y > 0.5 ) this.currentFace = EnumFacing.UP; - if ( y < -0.5 ) + if( y < -0.5 ) this.currentFace = EnumFacing.DOWN; - if ( z > 0.5 ) + if( z > 0.5 ) this.currentFace = EnumFacing.SOUTH; - if ( z < -0.5 ) + if( z < -0.5 ) this.currentFace = EnumFacing.NORTH; } @@ -595,31 +598,202 @@ public class ModelGenerator public void finalizeModel( final boolean Flip ) { ModelRotation mr = ModelRotation.X0_Y0; - - if ( Flip ) - mr = ModelRotation.X0_Y180; - - for ( final SMFace face : this.faces ) + + if( Flip ) + mr = ModelRotation.X0_Y180; + + for( final SMFace face : this.faces ) { - final EnumFacing myFace = face.face; - final float[] uvs = this.getFaceUvs( myFace, face.from, face.to ); - + final EnumFacing myFace = face.getFace(); + final float[] uvs = this.getFaceUvs( myFace, face.getFrom(), face.getTo() ); + final BlockFaceUV uv = new BlockFaceUV( uvs, 0 ); - final BlockPartFace bpf = new BlockPartFace( myFace, face.color, "", uv ); - - BakedQuad bf = this.faceBakery.makeBakedQuad( face.to, face.from, bpf, face.spite, myFace, mr, null, true, true ); - bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.color, bf.getFace() ); - - if ( face.isEdge ) + final BlockPartFace bpf = new BlockPartFace( myFace, face.getColor(), "", uv ); + + BakedQuad bf = this.faceBakery.makeBakedQuad( face.getTo(), face.getFrom(), bpf, face.getSpite(), myFace, mr, null, true, true ); + bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.getColor(), bf.getFace() ); + + if( face.isEdge ) this.generatedModel.getFaceQuads( myFace ).add( bf ); else this.generatedModel.getGeneralQuads().add( bf ); } } - + public IBakedModel getOutput() { return this.generatedModel; } + public IAESprite getOverrideBlockTexture() + { + return overrideBlockTexture; + } + + public IBlockAccess getBlockAccess() + { + return blockAccess; + } + + public void setBlockAccess( IBlockAccess blockAccess ) + { + this.blockAccess = blockAccess; + } + + public boolean isRenderAllFaces() + { + return renderAllFaces; + } + + public void setRenderAllFaces( boolean renderAllFaces ) + { + this.renderAllFaces = renderAllFaces; + } + + public int getUvRotateBottom() + { + return uvRotateBottom; + } + + public int setUvRotateBottom( int uvRotateBottom ) + { + this.uvRotateBottom = uvRotateBottom; + return uvRotateBottom; + } + + public int getUvRotateEast() + { + return uvRotateEast; + } + + public int setUvRotateEast( int uvRotateEast ) + { + this.uvRotateEast = uvRotateEast; + return uvRotateEast; + } + + public int getUvRotateNorth() + { + return uvRotateNorth; + } + + public int setUvRotateNorth( int uvRotateNorth ) + { + this.uvRotateNorth = uvRotateNorth; + return uvRotateNorth; + } + + public int getUvRotateSouth() + { + return uvRotateSouth; + } + + public int setUvRotateSouth( int uvRotateSouth ) + { + this.uvRotateSouth = uvRotateSouth; + return uvRotateSouth; + } + + public int getUvRotateTop() + { + return uvRotateTop; + } + + public int setUvRotateTop( int uvRotateTop ) + { + this.uvRotateTop = uvRotateTop; + return uvRotateTop; + } + + public int getUvRotateWest() + { + return uvRotateWest; + } + + public int setUvRotateWest( int uvRotateWest ) + { + this.uvRotateWest = uvRotateWest; + return uvRotateWest; + } + + public double getRenderMinX() + { + return renderMinX; + } + + public void setRenderMinX( double renderMinX ) + { + this.renderMinX = renderMinX; + } + + public double getRenderMinY() + { + return renderMinY; + } + + public void setRenderMinY( double renderMinY ) + { + this.renderMinY = renderMinY; + } + + public double getRenderMinZ() + { + return renderMinZ; + } + + public void setRenderMinZ( double renderMinZ ) + { + this.renderMinZ = renderMinZ; + } + + public double getRenderMaxX() + { + return renderMaxX; + } + + public void setRenderMaxX( double renderMaxX ) + { + this.renderMaxX = renderMaxX; + } + + public double getRenderMaxY() + { + return renderMaxY; + } + + public void setRenderMaxY( double renderMaxY ) + { + this.renderMaxY = renderMaxY; + } + + public double getRenderMaxZ() + { + return renderMaxZ; + } + + public void setRenderMaxZ( double renderMaxZ ) + { + this.renderMaxZ = renderMaxZ; + } + + public boolean isFlipTexture() + { + return flipTexture; + } + + public void setFlipTexture( boolean flipTexture ) + { + this.flipTexture = flipTexture; + } + + public EnumSet getRenderFaces() + { + return renderFaces; + } + + public void setRenderFaces( EnumSet renderFaces ) + { + this.renderFaces = renderFaces; + } + } diff --git a/src/main/java/appeng/client/render/RenderBlocksWorkaround.java b/src/main/java/appeng/client/render/RenderBlocksWorkaround.java index 11b6e4d94..72c216788 100644 --- a/src/main/java/appeng/client/render/RenderBlocksWorkaround.java +++ b/src/main/java/appeng/client/render/RenderBlocksWorkaround.java @@ -30,17 +30,31 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class RenderBlocksWorkaround extends ModelGenerator { - public boolean flipTexture; - public EnumSet faces; - public boolean useTextures; - public EnumSet renderFaces; - public float opacity; - + private boolean flipTexture; + private EnumSet faces; + private boolean useTextures; + private EnumSet renderFaces; + private float opacity; + public void setTexture( final Object object ) { // TODO Auto-generated method stub - } - + + public void setOpacity( float f ) + { + this.opacity = f; + } + + public EnumSet getFaces() + { + return faces; + } + + public void setFaces( EnumSet faces ) + { + this.faces = faces; + } + } diff --git a/src/main/java/appeng/client/render/SMFace.java b/src/main/java/appeng/client/render/SMFace.java index 099f5d24d..bf59abd73 100644 --- a/src/main/java/appeng/client/render/SMFace.java +++ b/src/main/java/appeng/client/render/SMFace.java @@ -8,18 +8,18 @@ import net.minecraft.util.EnumFacing; public class SMFace { - public final EnumFacing face; - public final boolean isEdge; + private final EnumFacing face; + private final boolean isEdge; + + private final Vector3f to; + private final Vector3f from; + + private final float[] uv; + + private final TextureAtlasSprite spite; + + private final int color; - public final Vector3f to; - public final Vector3f from; - - public final float[] uv; - - public final TextureAtlasSprite spite; - - public final int color; - public SMFace( final EnumFacing face , final boolean isEdge, final int color, @@ -37,4 +37,29 @@ public class SMFace this.spite = iconUnwrapper; } + public int getColor() + { + return color; + } + + public EnumFacing getFace() + { + return face; + } + + public Vector3f getFrom() + { + return from; + } + + public Vector3f getTo() + { + return to; + } + + public TextureAtlasSprite getSpite() + { + return spite; + } + } diff --git a/src/main/java/appeng/client/render/TESRWrapper.java b/src/main/java/appeng/client/render/TESRWrapper.java index 2fec580a5..d70740731 100644 --- a/src/main/java/appeng/client/render/TESRWrapper.java +++ b/src/main/java/appeng/client/render/TESRWrapper.java @@ -37,8 +37,7 @@ import appeng.tile.AEBaseTile; public class TESRWrapper extends TileEntitySpecialRenderer { - public final ModelGenerator renderBlocksInstance = new ModelGenerator(); - + private final ModelGenerator renderBlocksInstance = new ModelGenerator(); private final BaseBlockRender blkRender; private final double maxDistance; @@ -68,7 +67,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer { GL11.glPushMatrix(); - this.renderBlocksInstance.blockAccess = te.getWorld(); + this.renderBlocksInstance.setBlockAccess( te.getWorld() ); this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess.getWorldRenderer(), x, y, z, f, this.renderBlocksInstance ); GL11.glPopMatrix(); diff --git a/src/main/java/appeng/client/render/WorldRender.java b/src/main/java/appeng/client/render/WorldRender.java index fb7b983e4..7916abc9b 100644 --- a/src/main/java/appeng/client/render/WorldRender.java +++ b/src/main/java/appeng/client/render/WorldRender.java @@ -36,10 +36,10 @@ import appeng.core.AELog; public final class WorldRender implements ISimpleBlockRenderingHandler { - public static final WorldRender INSTANCE = new WorldRender(); - public final HashMap blockRenders = new HashMap(); + private static final WorldRender INSTANCE = new WorldRender(); + private final HashMap blockRenders = new HashMap(); private final ModelGenerator renderer = new ModelGenerator(); - boolean hasError = false; + private boolean hasError = false; private WorldRender() { @@ -66,10 +66,10 @@ public final class WorldRender implements ISimpleBlockRenderingHandler private BaseBlockRender getRender( final AEBaseBlock block ) { - return block.getRendererInstance().rendererInstance; + return block.getRendererInstance().getRendererInstance(); } - public void renderItemBlock( final ItemStack item, final ItemRenderType type, final Object[] data ) + void renderItemBlock( final ItemStack item, final ItemRenderType type, final Object[] data ) { final Block blk = Block.getBlockFromItem( item.getItem() ); if( blk instanceof AEBaseBlock ) @@ -77,9 +77,9 @@ public final class WorldRender implements ISimpleBlockRenderingHandler final AEBaseBlock block = (AEBaseBlock) blk; this.renderer.setRenderBoundsFromBlock( block ); - this.renderer.uvRotateBottom = this.renderer.uvRotateEast = this.renderer.uvRotateNorth = this.renderer.uvRotateSouth = this.renderer.uvRotateTop = this.renderer.uvRotateWest = 0; + this.renderer.setUvRotateBottom( this.renderer.setUvRotateEast( this.renderer.setUvRotateNorth( this.renderer.setUvRotateSouth( this.renderer.setUvRotateTop( this.renderer.setUvRotateWest( 0 ) ) ) ) ) ); this.getRender( block ).renderInventory( block, item, this.renderer, type, data ); - this.renderer.uvRotateBottom = this.renderer.uvRotateEast = this.renderer.uvRotateNorth = this.renderer.uvRotateSouth = this.renderer.uvRotateTop = this.renderer.uvRotateWest = 0; + this.renderer.setUvRotateBottom( this.renderer.setUvRotateEast( this.renderer.setUvRotateNorth( this.renderer.setUvRotateSouth( this.renderer.setUvRotateTop( this.renderer.setUvRotateWest( 0 ) ) ) ) ) ); } else { diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java b/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java index 2ececdb6e..d0726f280 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockAssembler.java @@ -87,16 +87,16 @@ public class RenderBlockAssembler extends BaseBlockRender= 2 ) { final int v = ( Math.abs( pos.getX() ) + Math.abs( pos.getY() ) + Math.abs( pos.getZ() ) ) % 2; - renderer.uvRotateEast = renderer.uvRotateBottom = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateEast( renderer.setUvRotateBottom( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); if( v == 0 ) { @@ -171,7 +171,7 @@ public class RenderBlockController extends BaseBlockRender @Override public void renderInventory( final BlockCrank blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj ) { - renderer.renderAllFaces = true; + renderer.setRenderAllFaces( true ); renderer.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.3, 0.5D + 0.05 ); super.renderInventory( blk, is, renderer, type, obj ); @@ -57,7 +57,7 @@ public class RenderBlockCrank extends BaseBlockRender renderer.setRenderBounds( 0.70D - 0.15, 0.75D - 0.05, 0.5D - 0.05, 0.70D + 0.28, 0.75D + 0.05, 0.5D + 0.05 ); super.renderInventory( blk, is, renderer, type, obj ); - renderer.renderAllFaces = false; + renderer.setRenderAllFaces( false ); } @Override @@ -90,19 +90,19 @@ public class RenderBlockCrank extends BaseBlockRender this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() ); GL11.glTranslated( 0.5, 0, 0.5 ); - GL11.glRotatef( tile.visibleRotation, 0, 1, 0 ); + GL11.glRotatef( tile.getVisibleRotation(), 0, 1, 0 ); GL11.glScalef( -1, 1, 1 ); GL11.glTranslated( -0.5, 0, -0.5 ); //tess.setTranslation( -tc.getPos().getX(), -tc.getPos().getY(), -tc.getPos().getZ() ); //tess.startDrawingQuads(); - + final RenderItem ri = Minecraft.getMinecraft().getRenderItem(); - + final ItemStack stack = new ItemStack( blk ); final IBakedModel model = ri.getItemModelMesher().getItemModel( stack ); Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor( model, 1.0F, 1.0F, 1.0F, 1.0F ); - + /* renderBlocks.renderAllFaces = true; renderBlocks.blockAccess = tc.getWorld(); diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockEnergyCube.java b/src/main/java/appeng/client/render/blocks/RenderBlockEnergyCube.java index a0e9fb0f9..bf693814a 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockEnergyCube.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockEnergyCube.java @@ -64,9 +64,9 @@ public class RenderBlockEnergyCube extends BaseBlockRender 800 ) { - tile.smash = false; + tile.setSmash( false ); } } @@ -262,7 +262,7 @@ public class RenderBlockInscriber extends BaseBlockRender final int lumen = 14 << 20 | 14 << 4; for( final Splotch s : tp.getDots() ) { - if( !validSides.contains( s.side ) ) + if( !validSides.contains( s.getSide() ) ) { continue; } - if( s.lumen ) + if( s.isLumen() ) { - tess.setColorOpaque_I( s.color.whiteVariant ); + tess.setColorOpaque_I( s.getColor().whiteVariant ); tess.setBrightness( lumen ); } else { - tess.setColorOpaque_I( s.color.mediumVariant ); + tess.setColorOpaque_I( s.getColor().mediumVariant ); tess.setBrightness( brightness ); } @@ -106,13 +106,13 @@ public class RenderBlockPaint extends BaseBlockRender pos_x = Math.max( buffer, Math.min( 1.0 - buffer, pos_x ) ); pos_y = Math.max( buffer, Math.min( 1.0 - buffer, pos_y ) ); - if( s.side == EnumFacing.SOUTH || s.side == EnumFacing.NORTH ) + if( s.getSide() == EnumFacing.SOUTH || s.getSide() == EnumFacing.NORTH ) { pos_x += x; pos_y += y; } - else if( s.side == EnumFacing.UP || s.side == EnumFacing.DOWN ) + else if( s.getSide() == EnumFacing.UP || s.getSide() == EnumFacing.DOWN ) { pos_x += x; pos_y += z; @@ -123,18 +123,18 @@ public class RenderBlockPaint extends BaseBlockRender pos_x += y; pos_y += z; } - + final IAESprite ico = icoSet[s.getSeed() % icoSet.length]; - final EnumFacing rs = s.side.getOpposite(); - - switch( s.side ) + final EnumFacing rs = s.getSide().getOpposite(); + + switch( s.getSide() ) { case UP: offset = 1.0 - offset; - tess.addVertexWithUV( rs,pos_x - buffer, y + offset, pos_y - buffer, ico.getMinU(), ico.getMinV() ); - tess.addVertexWithUV( rs,pos_x + buffer, y + offset, pos_y - buffer, ico.getMaxU(), ico.getMinV() ); - tess.addVertexWithUV( rs,pos_x + buffer, y + offset, pos_y + buffer, ico.getMaxU(), ico.getMaxV() ); - tess.addVertexWithUV( rs,pos_x - buffer, y + offset, pos_y + buffer, ico.getMinU(), ico.getMaxV() ); + tess.addVertexWithUV( rs, pos_x - buffer, y + offset, pos_y - buffer, ico.getMinU(), ico.getMinV() ); + tess.addVertexWithUV( rs, pos_x + buffer, y + offset, pos_y - buffer, ico.getMaxU(), ico.getMinV() ); + tess.addVertexWithUV( rs, pos_x + buffer, y + offset, pos_y + buffer, ico.getMaxU(), ico.getMaxV() ); + tess.addVertexWithUV( rs, pos_x - buffer, y + offset, pos_y + buffer, ico.getMinU(), ico.getMaxV() ); break; case DOWN: diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockQuartzAccelerator.java b/src/main/java/appeng/client/render/blocks/RenderBlockQuartzAccelerator.java index 7ae1e8110..4432befb8 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockQuartzAccelerator.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockQuartzAccelerator.java @@ -44,7 +44,7 @@ public class RenderBlockQuartzAccelerator extends BaseBlockRender 0 ) + if( skyChest.getPlayerOpen() > 0 ) { - skyChest.lidAngle += distance * 0.0001; + skyChest.setLidAngle( skyChest.getLidAngle() + distance * 0.0001f ); } else { - skyChest.lidAngle -= distance * 0.0001; + skyChest.setLidAngle( skyChest.getLidAngle() - distance * 0.0001f ); } - if( skyChest.lidAngle > 0.5f ) + if( skyChest.getLidAngle() > 0.5f ) { - skyChest.lidAngle = 0.5f; + skyChest.setLidAngle( 0.5f ); } - if( skyChest.lidAngle < 0.0f ) + if( skyChest.getLidAngle() < 0.0f ) { - skyChest.lidAngle = 0.0f; + skyChest.setLidAngle( 0.0f ); } - float lidAngle = skyChest.lidAngle; + float lidAngle = skyChest.getLidAngle(); lidAngle = 1.0F - lidAngle; lidAngle = 1.0F - lidAngle * lidAngle * lidAngle; diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockSkyCompass.java b/src/main/java/appeng/client/render/blocks/RenderBlockSkyCompass.java index f9f1784ba..c299f5447 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockSkyCompass.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockSkyCompass.java @@ -45,8 +45,7 @@ import appeng.tile.misc.TileSkyCompass; public class RenderBlockSkyCompass extends BaseBlockRender { - final ModelCompass model = new ModelCompass(); - float r = 0; + private final ModelCompass model = new ModelCompass(); public RenderBlockSkyCompass() { @@ -57,122 +56,121 @@ public class RenderBlockSkyCompass extends BaseBlockRender>>>>>> 500fc47... Reduces visibility of internal fields/methods + * } + * } + * } + * else + * { + * now %= 1000000; + * this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f ); + * } + * } + * else + * { + * now %= 100000; + * this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f ); + * } + * GL11.glDisable( GL12.GL_RESCALE_NORMAL ); + * GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); + */ } @Override @@ -213,23 +211,23 @@ public class RenderBlockSkyCompass extends BaseBlockRender { - BlockPos center; + private BlockPos center; private BlockWireless blk; private boolean hasChan = false; private boolean hasPower = false; @@ -62,7 +62,7 @@ public class RenderBlockWireless extends BaseBlockRender @Override public void renderInventory( final BlockDrive block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj ) { - renderer.overrideBlockTexture = ExtraBlockTextures.White.getIcon(); + renderer.setOverrideBlockTexture( ExtraBlockTextures.White.getIcon() ); this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer ); - renderer.overrideBlockTexture = null; + renderer.setOverrideBlockTexture( null ); super.renderInventory( block, is, renderer, type, obj ); } @@ -219,40 +219,40 @@ public class RenderDrive extends BaseBlockRender switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 ) { case 1: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case -1: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case -2: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case 2: - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case 3: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 ); break; case -3: - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 ); break; } @@ -303,47 +303,47 @@ public class RenderDrive extends BaseBlockRender switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 ) { case 1: - renderer.addVertexWithUV( forward, x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case -1: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case -2: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case 2: - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 ); break; case 3: - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 ); break; case -3: - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 ); - renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 ); - renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 ); + renderer.addVertexWithUV( forward,x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 ); break; } } } } - renderer.overrideBlockTexture = null; + renderer.setOverrideBlockTexture( null ); return result; } } diff --git a/src/main/java/appeng/client/render/blocks/RenderMEChest.java b/src/main/java/appeng/client/render/blocks/RenderMEChest.java index ad03651dd..e338151a8 100644 --- a/src/main/java/appeng/client/render/blocks/RenderMEChest.java +++ b/src/main/java/appeng/client/render/blocks/RenderMEChest.java @@ -53,13 +53,13 @@ public class RenderMEChest extends BaseBlockRender public void renderInventory( final BlockChest block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj ) { renderer.setBrightness( 0 ); - renderer.overrideBlockTexture = ExtraBlockTextures.White.getIcon(); + renderer.setOverrideBlockTexture( ExtraBlockTextures.White.getIcon() ); this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer ); - renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon(); + renderer.setOverrideBlockTexture( ExtraBlockTextures.MEChest.getIcon() ); this.renderInvBlock( EnumSet.of( AEPartLocation.UP ), block, is, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer ); - renderer.overrideBlockTexture = null; + renderer.setOverrideBlockTexture( null ); super.renderInventory( block, is, renderer, type, obj ); } @@ -179,7 +179,7 @@ public class RenderMEChest extends BaseBlockRender this.renderFace( pos, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up ); } - renderer.overrideBlockTexture = null; + renderer.setOverrideBlockTexture( null ); this.postRenderInWorld( renderer ); return result; diff --git a/src/main/java/appeng/client/render/blocks/RenderQNB.java b/src/main/java/appeng/client/render/blocks/RenderQNB.java index 10f5584b8..ed6f2bae8 100644 --- a/src/main/java/appeng/client/render/blocks/RenderQNB.java +++ b/src/main/java/appeng/client/render/blocks/RenderQNB.java @@ -65,7 +65,7 @@ public class RenderQNB extends BaseBlockRender { - static byte[][][] offsets; + private static byte[][][] offsets; public RenderQuartzGlass() { @@ -60,9 +60,9 @@ public class RenderQuartzGlass extends BaseBlockRender this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer ); blk.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( Blocks.hopper.getDefaultState() )[0] ); - renderer.renderAllFaces = true; + renderer.setRenderAllFaces( true ); final float top = 8.0f / 16.0f; final float bottom = 7.0f / 16.0f; @@ -87,7 +87,7 @@ public class RenderQuartzTorch extends BaseBlockRender this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer ); - renderer.renderAllFaces = false; + renderer.setRenderAllFaces( false ); blk.getRendererInstance().setTemporaryRenderIcon( null ); } @@ -96,7 +96,7 @@ public class RenderQuartzTorch extends BaseBlockRender { final IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, pos ); - renderer.renderAllFaces = true; + renderer.setRenderAllFaces( true ); float zOff = 0.0f; float yOff = 0.0f; float xOff = 0.0f; @@ -197,7 +197,7 @@ public class RenderQuartzTorch extends BaseBlockRender } } - renderer.renderAllFaces = false; + renderer.setRenderAllFaces( false ); block.getRendererInstance().setTemporaryRenderIcon( null ); return out; diff --git a/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java b/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java index fab131f53..a08db6e48 100644 --- a/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java +++ b/src/main/java/appeng/client/render/blocks/RenderSpatialPylon.java @@ -45,9 +45,9 @@ public class RenderSpatialPylon extends BaseBlockRender public boolean renderInWorld( final BlockTinyTNT imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer ) { renderer.setOverrideBlockTexture( new FullIcon( Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( Blocks.tnt.getDefaultState() )) ); - renderer.renderAllFaces = true; + renderer.setRenderAllFaces( true ); renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f ); final boolean out = super.renderInWorld( imb, world, pos, renderer ); - renderer.renderAllFaces = false; + renderer.setRenderAllFaces( false ); return out; } } diff --git a/src/main/java/appeng/client/render/blocks/RendererCableBus.java b/src/main/java/appeng/client/render/blocks/RendererCableBus.java index b07e6ae4e..911e252af 100644 --- a/src/main/java/appeng/client/render/blocks/RendererCableBus.java +++ b/src/main/java/appeng/client/render/blocks/RendererCableBus.java @@ -59,16 +59,16 @@ public class RendererCableBus extends BaseBlockRender RENDER_PART = new HashMap(); - + @Override public boolean renderInWorld( final BlockCableBus block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer ) { @@ -124,12 +124,12 @@ public class RendererCableBus extends BaseBlockRender 0; @@ -140,8 +140,8 @@ public class RendererCableBus extends BaseBlockRender= 20 ) - { - par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon(); - } - - final float f4 = par2Icon.getMinU(); - final float f5 = par2Icon.getMaxU(); - final float f6 = par2Icon.getMinV(); - final float f7 = par2Icon.getMaxV(); - - final ItemPaintBall ipb = (ItemPaintBall) item.getItem(); - - final Tessellator tessellator = Tessellator.instance; - GL11.glPushMatrix(); - GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - - final AEColor col = ipb.getColor( item ); - - final int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant; - final int r = ( colorValue >> 16 ) & 0xff; - final int g = ( colorValue >> 8 ) & 0xff; - final int b = ( colorValue ) & 0xff; - - if( item.getItemDamage() >= 20 ) - { - final float fail = 0.7f; - final int full = (int) ( 255 * 0.3 ); - GL11.glColor4ub( (byte) ( full + r * fail ), (byte) ( full + g * fail ), (byte) ( full + b * fail ), (byte) 255 ); - } - else - { - GL11.glColor4ub( (byte) r, (byte) g, (byte) b, (byte) 255 ); - } - - if( type == ItemRenderType.INVENTORY ) - { - GL11.glScalef( 16F, 16F, 10F ); - GL11.glTranslatef( 0.0F, 1.0F, 0.0F ); - GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F ); - GL11.glEnable( GL11.GL_ALPHA_TEST ); - - tessellator.startDrawingQuads(); - tessellator.setNormal( 0.0F, 1.0F, 0.0F ); - tessellator.addVertexWithUV( 0, 0, 0, f4, f7 ); - tessellator.addVertexWithUV( 1, 0, 0, f5, f7 ); - tessellator.addVertexWithUV( 1, 1, 0, f5, f6 ); - tessellator.addVertexWithUV( 0, 1, 0, f4, f6 ); - tessellator.draw(); - } - else - { - if( type == ItemRenderType.EQUIPPED_FIRST_PERSON ) - { - GL11.glTranslatef( 0.0F, 0.0F, 0.0F ); - } - else - { - GL11.glTranslatef( -0.5F, -0.3F, 0.01F ); - } - final float f12 = 0.0625F; - ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 ); - - GL11.glDisable( GL11.GL_CULL_FACE ); - GL11.glColor4f( 1, 1, 1, 1.0F ); - GL11.glScalef( 1F, 1.1F, 1F ); - GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f ); - GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F ); - } - - GL11.glColor4f( 1, 1, 1, 1.0F ); - - GL11.glPopAttrib(); - GL11.glPopMatrix(); - } -} +//import org.lwjgl.opengl.GL11; +// +//import net.minecraft.client.renderer.ItemRenderer; +//import net.minecraft.client.renderer.Tessellator; +//import net.minecraft.item.ItemStack; +//import net.minecraftforge.client.IItemRenderer; +// +//import appeng.api.util.AEColor; +//import appeng.client.texture.ExtraItemTextures; +//import appeng.items.misc.ItemPaintBall; +// +// +//public class PaintBallRender implements IItemRenderer +//{ +// +// @Override +// public boolean handleRenderType( final ItemStack item, final ItemRenderType type ) +// { +// return true; +// } +// +// @Override +// public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper ) +// { +// return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION; +// } +// +// @Override +// public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data ) +// { +// IIcon par2Icon = item.getIconIndex(); +// if( item.getItemDamage() >= 20 ) +// { +// par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon(); +// } +// +// final float f4 = par2Icon.getMinU(); +// final float f5 = par2Icon.getMaxU(); +// final float f6 = par2Icon.getMinV(); +// final float f7 = par2Icon.getMaxV(); +// +// final ItemPaintBall ipb = (ItemPaintBall) item.getItem(); +// +// final Tessellator tessellator = Tessellator.getInstance(); +// GL11.glPushMatrix(); +// GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); +// +// final AEColor col = ipb.getColor( item ); +// +// final int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant; +// final int r = ( colorValue >> 16 ) & 0xff; +// final int g = ( colorValue >> 8 ) & 0xff; +// final int b = ( colorValue ) & 0xff; +// +// if( item.getItemDamage() >= 20 ) +// { +// final float fail = 0.7f; +// final int full = (int) ( 255 * 0.3 ); +// GL11.glColor4ub( (byte) ( full + r * fail ), (byte) ( full + g * fail ), (byte) ( full + b * fail ), (byte) 255 ); +// } +// else +// { +// GL11.glColor4ub( (byte) r, (byte) g, (byte) b, (byte) 255 ); +// } +// +// if( type == ItemRenderType.INVENTORY ) +// { +// GL11.glScalef( 16F, 16F, 10F ); +// GL11.glTranslatef( 0.0F, 1.0F, 0.0F ); +// GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F ); +// GL11.glEnable( GL11.GL_ALPHA_TEST ); +// +// tessellator.startDrawingQuads(); +// tessellator.setNormal( 0.0F, 1.0F, 0.0F ); +// tessellator.addVertexWithUV( 0, 0, 0, f4, f7 ); +// tessellator.addVertexWithUV( 1, 0, 0, f5, f7 ); +// tessellator.addVertexWithUV( 1, 1, 0, f5, f6 ); +// tessellator.addVertexWithUV( 0, 1, 0, f4, f6 ); +// tessellator.draw(); +// } +// else +// { +// if( type == ItemRenderType.EQUIPPED_FIRST_PERSON ) +// { +// GL11.glTranslatef( 0.0F, 0.0F, 0.0F ); +// } +// else +// { +// GL11.glTranslatef( -0.5F, -0.3F, 0.01F ); +// } +// final float f12 = 0.0625F; +// ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 ); +// +// GL11.glDisable( GL11.GL_CULL_FACE ); +// GL11.glColor4f( 1, 1, 1, 1.0F ); +// GL11.glScalef( 1F, 1.1F, 1F ); +// GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f ); +// GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F ); +// } +// +// GL11.glColor4f( 1, 1, 1, 1.0F ); +// +// GL11.glPopAttrib(); +// GL11.glPopMatrix(); +// } +//} diff --git a/src/main/java/appeng/client/render/model/ModelCompass.java b/src/main/java/appeng/client/render/model/ModelCompass.java index bd60629ba..4c03c9d8a 100644 --- a/src/main/java/appeng/client/render/model/ModelCompass.java +++ b/src/main/java/appeng/client/render/model/ModelCompass.java @@ -26,14 +26,14 @@ import net.minecraft.client.model.ModelRenderer; public class ModelCompass extends ModelBase { - final ModelRenderer Ring1; - final ModelRenderer Ring2; - final ModelRenderer Ring3; - final ModelRenderer Ring4; - final ModelRenderer Middle; - final ModelRenderer Base; + private final ModelRenderer Ring1; + private final ModelRenderer Ring2; + private final ModelRenderer Ring3; + private final ModelRenderer Ring4; + private final ModelRenderer Middle; + private final ModelRenderer Base; - final ModelRenderer Pointer; + private final ModelRenderer Pointer; public ModelCompass() { diff --git a/src/main/java/appeng/client/texture/ExtraBlockTextures.java b/src/main/java/appeng/client/texture/ExtraBlockTextures.java index df52d3465..a33c3bbd3 100644 --- a/src/main/java/appeng/client/texture/ExtraBlockTextures.java +++ b/src/main/java/appeng/client/texture/ExtraBlockTextures.java @@ -88,7 +88,7 @@ public enum ExtraBlockTextures BlockPaint2( "BlockPaint2" ), BlockPaint3( "BlockPaint3" ); private final String name; - public IAESprite IIcon; + private IAESprite IIcon; ExtraBlockTextures( final String name ) { diff --git a/src/main/java/appeng/client/texture/ExtraItemTextures.java b/src/main/java/appeng/client/texture/ExtraItemTextures.java index 4c95af486..290b4e086 100644 --- a/src/main/java/appeng/client/texture/ExtraItemTextures.java +++ b/src/main/java/appeng/client/texture/ExtraItemTextures.java @@ -35,7 +35,7 @@ public enum ExtraItemTextures ToolColorApplicatorTip_Light( "ToolColorApplicatorTip_Light" ); private final String name; - public IAESprite IIcon; + private IAESprite IIcon; ExtraItemTextures( final String name ) { diff --git a/src/main/java/appeng/client/texture/FlippableIcon.java b/src/main/java/appeng/client/texture/FlippableIcon.java index 9fd9bd0c8..5ca139495 100644 --- a/src/main/java/appeng/client/texture/FlippableIcon.java +++ b/src/main/java/appeng/client/texture/FlippableIcon.java @@ -18,23 +18,19 @@ package appeng.client.texture; + +import javax.annotation.Nonnull; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; public class FlippableIcon implements IAESprite { - protected IAESprite original; - boolean flip_u; - boolean flip_v; + private IAESprite original; + private boolean flip_u; + private boolean flip_v; - - @Override - public TextureAtlasSprite getAtlas() - { - return this.original.getAtlas(); - } - public FlippableIcon( final IAESprite o ) { this.original = o; @@ -42,82 +38,88 @@ public class FlippableIcon implements IAESprite this.flip_v = false; } + @Override + public TextureAtlasSprite getAtlas() + { + return this.original.getAtlas(); + } + @Override public int getIconWidth() { - return this.original.getIconWidth(); + return this.getOriginal().getIconWidth(); } @Override public int getIconHeight() { - return this.original.getIconHeight(); + return this.getOriginal().getIconHeight(); } @Override public float getMinU() { - if( this.flip_u ) + if( this.isFlipU() ) { - return this.original.getMaxU(); + return this.getOriginal().getMaxU(); } - return this.original.getMinU(); + return this.getOriginal().getMinU(); } @Override public float getMaxU() { - if( this.flip_u ) + if( this.isFlipU() ) { - return this.original.getMinU(); + return this.getOriginal().getMinU(); } - return this.original.getMaxU(); + return this.getOriginal().getMaxU(); } @Override public float getInterpolatedU( final double px ) { - if( this.flip_u ) + if( this.isFlipU() ) { - return this.original.getInterpolatedU( 16 - px ); + return this.getOriginal().getInterpolatedU( 16 - px ); } - return this.original.getInterpolatedU( px ); + return this.getOriginal().getInterpolatedU( px ); } @Override public float getMinV() { - if( this.flip_v ) + if( this.isFlipV() ) { - return this.original.getMaxV(); + return this.getOriginal().getMaxV(); } - return this.original.getMinV(); + return this.getOriginal().getMinV(); } @Override public float getMaxV() { - if( this.flip_v ) + if( this.isFlipV() ) { - return this.original.getMinV(); + return this.getOriginal().getMinV(); } - return this.original.getMaxV(); + return this.getOriginal().getMaxV(); } @Override public float getInterpolatedV( final double px ) { - if( this.flip_v ) + if( this.isFlipV() ) { - return this.original.getInterpolatedV( 16 - px ); + return this.getOriginal().getInterpolatedV( 16 - px ); } - return this.original.getInterpolatedV( px ); + return this.getOriginal().getInterpolatedV( px ); } @Override public String getIconName() { - return this.original.getIconName(); + return this.getOriginal().getIconName(); } public IAESprite getOriginal() @@ -127,14 +129,39 @@ public class FlippableIcon implements IAESprite public void setFlip( final boolean u, final boolean v ) { - this.flip_u = u; - this.flip_v = v; + this.setFlipU( u ); + this.setFlipV( v ); } public int setFlip( final int orientation ) { - this.flip_u = ( orientation & 8 ) == 8; - this.flip_v = ( orientation & 16 ) == 16; + this.setFlipU( ( orientation & 8 ) == 8 ); + this.setFlipV( ( orientation & 16 ) == 16 ); return orientation & 7; } + + boolean isFlipU() + { + return this.flip_u; + } + + void setFlipU( final boolean flipU ) + { + this.flip_u = flipU; + } + + boolean isFlipV() + { + return this.flip_v; + } + + void setFlipV( final boolean flipV ) + { + this.flip_v = flipV; + } + + public void setOriginal( @Nonnull final IAESprite original ) + { + this.original = original; + } } diff --git a/src/main/java/appeng/client/texture/MissingIcon.java b/src/main/java/appeng/client/texture/MissingIcon.java index b169efce7..048137fa7 100644 --- a/src/main/java/appeng/client/texture/MissingIcon.java +++ b/src/main/java/appeng/client/texture/MissingIcon.java @@ -29,8 +29,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class MissingIcon implements IAESprite { - TextureAtlasSprite missing; - + private TextureAtlasSprite missing; + public MissingIcon( final Object forWhat ) { } @@ -42,7 +42,8 @@ public class MissingIcon implements IAESprite } @SideOnly( Side.CLIENT ) - public static TextureAtlasSprite getMissing() + public + static TextureAtlasSprite getMissing() { return ( (TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture( TextureMap.locationBlocksTexture ) ).getAtlasSprite( "missingno" ); } @@ -52,7 +53,7 @@ public class MissingIcon implements IAESprite { return getMissing(); } - + @Override public int getIconHeight() { diff --git a/src/main/java/appeng/client/texture/OffsetIcon.java b/src/main/java/appeng/client/texture/OffsetIcon.java index dd08fb380..da6575c8b 100644 --- a/src/main/java/appeng/client/texture/OffsetIcon.java +++ b/src/main/java/appeng/client/texture/OffsetIcon.java @@ -27,8 +27,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class OffsetIcon implements IAESprite { - final float offsetX; - final float offsetY; + private final float offsetX; + private final float offsetY; private final IAESprite p; diff --git a/src/main/java/appeng/client/texture/TaughtIcon.java b/src/main/java/appeng/client/texture/TaughtIcon.java index 835599d14..53c847d4a 100644 --- a/src/main/java/appeng/client/texture/TaughtIcon.java +++ b/src/main/java/appeng/client/texture/TaughtIcon.java @@ -27,7 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TaughtIcon implements IAESprite { - final float tightness; + private final float tightness; private final IAESprite icon; diff --git a/src/main/java/appeng/client/texture/TmpFlippableIcon.java b/src/main/java/appeng/client/texture/TmpFlippableIcon.java index b90af563e..2417437c0 100644 --- a/src/main/java/appeng/client/texture/TmpFlippableIcon.java +++ b/src/main/java/appeng/client/texture/TmpFlippableIcon.java @@ -19,11 +19,9 @@ package appeng.client.texture; - - public class TmpFlippableIcon extends FlippableIcon { - + public TmpFlippableIcon() { super( null ); @@ -36,26 +34,19 @@ public class TmpFlippableIcon extends FlippableIcon while( i instanceof FlippableIcon ) { final FlippableIcon fi = (FlippableIcon) i; - if( fi.flip_u ) + if( fi.isFlipU() ) { - this.flip_u = !this.flip_u; + this.setFlipU( !this.isFlipU() ); } - if( fi.flip_v ) + if( fi.isFlipV() ) { - this.flip_v = !this.flip_v; + this.setFlipV( !this.isFlipV() ); } i = fi.getOriginal(); } - if( i == null ) - { - this.original = null; - } - else - { - this.original = i; - } + super.setOriginal( i ); } } diff --git a/src/main/java/appeng/container/AEBaseContainer.java b/src/main/java/appeng/container/AEBaseContainer.java index 2c8e3189a..d916de208 100644 --- a/src/main/java/appeng/container/AEBaseContainer.java +++ b/src/main/java/appeng/container/AEBaseContainer.java @@ -84,22 +84,22 @@ import appeng.util.item.AEItemStack; public abstract class AEBaseContainer extends Container { - protected final InventoryPlayer invPlayer; - protected final BaseActionSource mySrc; - protected final HashSet locked = new HashSet(); - final TileEntity tileEntity; - final IPart part; - final IGuiItemObject obj; - final List dataChunks = new LinkedList(); - final HashMap syncData = new HashMap(); - public boolean isContainerValid = true; - public String customName; - public ContainerOpenContext openContext; - protected IMEInventoryHandler cellInv; - protected IEnergySource powerSrc; - boolean sentCustomName; - int ticksSinceCheck = 900; - IAEItemStack clientRequestedTargetItem = null; + private final InventoryPlayer invPlayer; + private final BaseActionSource mySrc; + private final HashSet locked = new HashSet(); + private final TileEntity tileEntity; + private final IPart part; + private final IGuiItemObject obj; + private final List dataChunks = new LinkedList(); + private final HashMap syncData = new HashMap(); + private boolean isContainerValid = true; + private String customName; + private ContainerOpenContext openContext; + private IMEInventoryHandler cellInv; + private IEnergySource powerSrc; + private boolean sentCustomName; + private int ticksSinceCheck = 900; + private IAEItemStack clientRequestedTargetItem = null; public AEBaseContainer( final InventoryPlayer ip, final TileEntity myTile, final IPart myPart ) { @@ -277,7 +277,7 @@ public abstract class AEBaseContainer extends Container this.clientRequestedTargetItem = stack == null ? null : stack.copy(); } - public BaseActionSource getSource() + public BaseActionSource getActionSource() { return this.mySrc; } @@ -296,7 +296,7 @@ public abstract class AEBaseContainer extends Container } this.ticksSinceCheck = 0; - this.isContainerValid = this.isContainerValid && this.hasAccess( security, requirePower ); + this.setValidContainer( this.isValidContainer() && this.hasAccess( security, requirePower ) ); } protected boolean hasAccess( final SecurityPermissions perm, final boolean requirePower ) @@ -321,7 +321,7 @@ public abstract class AEBaseContainer extends Container } final ISecurityGrid sg = g.getCache( ISecurityGrid.class ); - if( sg.hasPermission( this.invPlayer.player, perm ) ) + if( sg.hasPermission( this.getInventoryPlayer().player, perm ) ) { return true; } @@ -356,7 +356,7 @@ public abstract class AEBaseContainer extends Container public InventoryPlayer getPlayerInv() { - return this.invPlayer; + return this.getInventoryPlayer(); } public TileEntity getTileEntity() @@ -421,7 +421,7 @@ public abstract class AEBaseContainer extends Container if( newSlot instanceof AppEngSlot ) { final AppEngSlot s = (AppEngSlot) newSlot; - s.myContainer = this; + s.setContainer( this ); return super.addSlotToContainer( newSlot ); } else @@ -723,7 +723,7 @@ public abstract class AEBaseContainer extends Container @Override public boolean canInteractWith( final EntityPlayer entityplayer ) { - if( this.isContainerValid ) + if( this.isValidContainer() ) { if( this.tileEntity instanceof IInventory ) { @@ -737,7 +737,7 @@ public abstract class AEBaseContainer extends Container @Override public boolean canDragIntoSlot( final Slot s ) { - return ( (AppEngSlot) s ).isDraggable; + return ( (AppEngSlot) s ).isDraggable(); } public void doAction( final EntityPlayerMP player, final InventoryAction action, final int slot, final long id ) @@ -851,7 +851,7 @@ public abstract class AEBaseContainer extends Container switch( action ) { case SHIFT_CLICK: - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return; } @@ -872,7 +872,7 @@ public abstract class AEBaseContainer extends Container ais.setStackSize( ais.getStackSize() - myItem.stackSize ); } - ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais != null ) { adp.addItems( ais.getItemStack() ); @@ -880,7 +880,7 @@ public abstract class AEBaseContainer extends Container } break; case ROLL_DOWN: - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return; } @@ -894,7 +894,7 @@ public abstract class AEBaseContainer extends Container ais.setStackSize( 1 ); final IAEItemStack extracted = ais.copy(); - ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais == null ) { final InventoryAdaptor ia = new AdaptorPlayerHand( player ); @@ -902,7 +902,7 @@ public abstract class AEBaseContainer extends Container final ItemStack fail = ia.removeItems( 1, extracted.getItemStack(), null ); if( fail == null ) { - this.cellInv.extractItems( extracted, Actionable.MODULATE, this.mySrc ); + this.getCellInventory().extractItems( extracted, Actionable.MODULATE, this.getActionSource() ); } this.updateHeld( player ); @@ -912,7 +912,7 @@ public abstract class AEBaseContainer extends Container break; case ROLL_UP: case PICKUP_SINGLE: - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return; } @@ -938,7 +938,7 @@ public abstract class AEBaseContainer extends Container { IAEItemStack ais = slotItem.copy(); ais.setStackSize( 1 ); - ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais != null ) { final InventoryAdaptor ia = new AdaptorPlayerHand( player ); @@ -946,7 +946,7 @@ public abstract class AEBaseContainer extends Container final ItemStack fail = ia.addItems( ais.getItemStack() ); if( fail != null ) { - this.cellInv.injectItems( ais, Actionable.MODULATE, this.mySrc ); + this.getCellInventory().injectItems( ais, Actionable.MODULATE, this.getActionSource() ); } this.updateHeld( player ); @@ -955,7 +955,7 @@ public abstract class AEBaseContainer extends Container } break; case PICKUP_OR_SET_DOWN: - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return; } @@ -966,7 +966,7 @@ public abstract class AEBaseContainer extends Container { IAEItemStack ais = slotItem.copy(); ais.setStackSize( ais.getItemStack().getMaxStackSize() ); - ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais != null ) { player.inventory.setItemStack( ais.getItemStack() ); @@ -981,7 +981,7 @@ public abstract class AEBaseContainer extends Container else { IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() ); - ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais != null ) { player.inventory.setItemStack( ais.getItemStack() ); @@ -995,7 +995,7 @@ public abstract class AEBaseContainer extends Container break; case SPLIT_OR_PLACE_SINGLE: - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return; } @@ -1007,13 +1007,13 @@ public abstract class AEBaseContainer extends Container IAEItemStack ais = slotItem.copy(); final long maxSize = ais.getItemStack().getMaxStackSize(); ais.setStackSize( maxSize ); - ais = this.cellInv.extractItems( ais, Actionable.SIMULATE, this.mySrc ); + ais = this.getCellInventory().extractItems( ais, Actionable.SIMULATE, this.getActionSource() ); if( ais != null ) { final long stackSize = Math.min( maxSize, ais.getStackSize() ); ais.setStackSize( ( stackSize + 1 ) >> 1 ); - ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); } if( ais != null ) @@ -1031,7 +1031,7 @@ public abstract class AEBaseContainer extends Container { IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() ); ais.setStackSize( 1 ); - ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais == null ) { final ItemStack is = player.inventory.getItemStack(); @@ -1056,7 +1056,7 @@ public abstract class AEBaseContainer extends Container break; case MOVE_REGION: - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return; } @@ -1080,7 +1080,7 @@ public abstract class AEBaseContainer extends Container ais.setStackSize( ais.getStackSize() - myItem.stackSize ); } - ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc ); + ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() ); if( ais != null ) { adp.addItems( ais.getItemStack() ); @@ -1113,13 +1113,13 @@ public abstract class AEBaseContainer extends Container } } - public ItemStack shiftStoreItem( final ItemStack input ) + private ItemStack shiftStoreItem( final ItemStack input ) { - if( this.powerSrc == null || this.cellInv == null ) + if( this.getPowerSource() == null || this.getCellInventory() == null ) { return input; } - final IAEItemStack ais = Platform.poweredInsert( this.powerSrc, this.cellInv, AEApi.instance().storage().createItemStack( input ), this.mySrc ); + final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ), this.getActionSource() ); if( ais == null ) { return null; @@ -1133,7 +1133,7 @@ public abstract class AEBaseContainer extends Container this.detectAndSendChanges(); } - protected void sendCustomName() + private void sendCustomName() { if( !this.sentCustomName ) { @@ -1166,14 +1166,14 @@ public abstract class AEBaseContainer extends Container { if( name.hasCustomName() ) { - this.customName = name.getCustomName(); + this.setCustomName( name.getCustomName() ); } - if( this.customName != null ) + if( this.getCustomName() != null ) { try { - NetworkHandler.instance.sendTo( new PacketValueConfig( "CustomName", this.customName ), (EntityPlayerMP) this.invPlayer.player ); + NetworkHandler.instance.sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ), (EntityPlayerMP) this.getInventoryPlayer().player ); } catch( final IOException e ) { @@ -1207,12 +1207,12 @@ public abstract class AEBaseContainer extends Container // can take? - if( isA != null && !a.canTakeStack( this.invPlayer.player ) ) + if( isA != null && !a.canTakeStack( this.getInventoryPlayer().player ) ) { return; } - if( isB != null && !b.canTakeStack( this.invPlayer.player ) ) + if( isB != null && !b.canTakeStack( this.getInventoryPlayer().player ) ) { return; } @@ -1279,4 +1279,59 @@ public abstract class AEBaseContainer extends Container { return true; } + + public IMEInventoryHandler getCellInventory() + { + return this.cellInv; + } + + public void setCellInventory( final IMEInventoryHandler cellInv ) + { + this.cellInv = cellInv; + } + + public String getCustomName() + { + return this.customName; + } + + public void setCustomName( final String customName ) + { + this.customName = customName; + } + + public InventoryPlayer getInventoryPlayer() + { + return this.invPlayer; + } + + public boolean isValidContainer() + { + return this.isContainerValid; + } + + public void setValidContainer( final boolean isContainerValid ) + { + this.isContainerValid = isContainerValid; + } + + public ContainerOpenContext getOpenContext() + { + return this.openContext; + } + + public void setOpenContext( final ContainerOpenContext openContext ) + { + this.openContext = openContext; + } + + public IEnergySource getPowerSource() + { + return this.powerSrc; + } + + public void setPowerSource( final IEnergySource powerSrc ) + { + this.powerSrc = powerSrc; + } } diff --git a/src/main/java/appeng/container/ContainerOpenContext.java b/src/main/java/appeng/container/ContainerOpenContext.java index 11add6374..30e8aa2e4 100644 --- a/src/main/java/appeng/container/ContainerOpenContext.java +++ b/src/main/java/appeng/container/ContainerOpenContext.java @@ -29,12 +29,12 @@ import appeng.api.util.AEPartLocation; public class ContainerOpenContext { - public final boolean isItem; - public World w; - public int x; - public int y; - public int z; - public AEPartLocation side; + private final boolean isItem; + private World w; + private int x; + private int y; + private int z; + private AEPartLocation side; public ContainerOpenContext( final Object myItem ) { @@ -50,4 +50,54 @@ public class ContainerOpenContext } return this.w.getTileEntity( new BlockPos( this.x, this.y, this.z ) ); } + + public AEPartLocation getSide() + { + return this.side; + } + + public void setSide( final AEPartLocation side ) + { + this.side = side; + } + + private int getZ() + { + return this.z; + } + + public void setZ( final int z ) + { + this.z = z; + } + + private int getY() + { + return this.y; + } + + public void setY( final int y ) + { + this.y = y; + } + + private int getX() + { + return this.x; + } + + public void setX( final int x ) + { + this.x = x; + } + + private World getWorld() + { + return this.w; + } + + public void setWorld( final World w ) + { + this.w = w; + } } diff --git a/src/main/java/appeng/container/guisync/GuiSync.java b/src/main/java/appeng/container/guisync/GuiSync.java index 4a68fde01..14d6e922f 100644 --- a/src/main/java/appeng/container/guisync/GuiSync.java +++ b/src/main/java/appeng/container/guisync/GuiSync.java @@ -19,11 +19,18 @@ package appeng.container.guisync; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +/** + * Annotates that this field should be synchronized between the server and client. + * Requires the field to be public. + */ @Retention( RetentionPolicy.RUNTIME ) +@Target( ElementType.FIELD ) public @interface GuiSync { diff --git a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java index c94797d2a..a3ef442a9 100644 --- a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java +++ b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java @@ -55,7 +55,6 @@ public class ContainerCellWorkbench extends ContainerUpgradeable public CopyMode copyMode = CopyMode.CLEAR_ON_REMOVE; private ItemStack prevStack = null; private int lastUpgrades = 0; - private ItemStack LastCell; public ContainerCellWorkbench( final InventoryPlayer ip, final TileCellWorkbench te ) { @@ -72,12 +71,12 @@ public class ContainerCellWorkbench extends ContainerUpgradeable } } - public void nextCopyMode() + public void nextWorkBenchCopyMode() { - this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, Platform.nextEnum( this.getCopyMode() ) ); + this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, Platform.nextEnum( this.getWorkBenchCopyMode() ) ); } - public CopyMode getCopyMode() + private CopyMode getWorkBenchCopyMode() { return (CopyMode) this.workBench.getConfigManager().getSetting( Settings.COPY_MODE ); } @@ -91,11 +90,10 @@ public class ContainerCellWorkbench extends ContainerUpgradeable @Override protected void setupConfig() { + final IInventory cell = this.getUpgradeable().getInventoryByName( "cell" ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.getPlayerInv() ) ); - final IInventory cell = this.upgradeable.getInventoryByName( "cell" ); - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) ); - - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); final IInventory upgradeInventory = new Upgrades(); // null, 3 * 8 ); @@ -116,7 +114,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable for( int z = 0; z < 8; z++ ) { final int iSLot = zz * 8 + z; - this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) ); + this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.getInventoryPlayer() ) ); } } /* @@ -149,7 +147,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { if( this.workBench.getWorld().getTileEntity( this.workBench.getPos() ) != this.workBench ) { - this.isContainerValid = false; + this.setValidContainer( false ); } for( final Object crafter : this.crafters ) @@ -171,8 +169,8 @@ public class ContainerCellWorkbench extends ContainerUpgradeable } } - this.copyMode = this.getCopyMode(); - this.fzMode = this.getFuzzyMode(); + this.setCopyMode( this.getWorkBenchCopyMode() ); + this.setFuzzyMode( this.getWorkBenchFuzzyMode() ); } this.prevStack = is; @@ -197,7 +195,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { if( field.equals( "copyMode" ) ) { - this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.copyMode ); + this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.getCopyMode() ); } super.onUpdate( field, oldValue, newValue ); @@ -205,7 +203,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable public void clear() { - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); for( int x = 0; x < inv.getSizeInventory(); x++ ) { inv.setInventorySlotContents( x, null ); @@ -213,7 +211,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable this.detectAndSendChanges(); } - private FuzzyMode getFuzzyMode() + private FuzzyMode getWorkBenchFuzzyMode() { final ICellWorkbenchItem cwi = this.workBench.getCell(); if( cwi != null ) @@ -225,9 +223,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable public void partition() { - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); - final IMEInventory cellInv = AEApi.instance().registries().cell().getCellInventory( this.upgradeable.getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS ); + final IMEInventory cellInv = AEApi.instance().registries().cell().getCellInventory( this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS ); Iterator i = new NullIterator(); if( cellInv != null ) @@ -253,6 +251,16 @@ public class ContainerCellWorkbench extends ContainerUpgradeable this.detectAndSendChanges(); } + public CopyMode getCopyMode() + { + return this.copyMode; + } + + private void setCopyMode( final CopyMode copyMode ) + { + this.copyMode = copyMode; + } + private class Upgrades implements IInventory { @@ -328,14 +336,14 @@ public class ContainerCellWorkbench extends ContainerUpgradeable public void openInventory( final EntityPlayer player ) { - + } - + @Override public void closeInventory( final EntityPlayer player ) { - + } @Override @@ -362,7 +370,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable final int id, final int value ) { - + } @Override @@ -374,7 +382,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable @Override public void clear() { - ContainerCellWorkbench.this.getCellUpgradeInventory().clear(); + ContainerCellWorkbench.this.getCellUpgradeInventory().clear(); } } } diff --git a/src/main/java/appeng/container/implementations/ContainerChest.java b/src/main/java/appeng/container/implementations/ContainerChest.java index c0cb379fd..6c2863206 100644 --- a/src/main/java/appeng/container/implementations/ContainerChest.java +++ b/src/main/java/appeng/container/implementations/ContainerChest.java @@ -28,14 +28,14 @@ import appeng.tile.storage.TileChest; public class ContainerChest extends AEBaseContainer { - final TileChest chest; + private final TileChest chest; public ContainerChest( final InventoryPlayer ip, final TileChest chest ) { super( ip, chest, null ); this.chest = chest; - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest, 1, 80, 37, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest, 1, 80, 37, this.getInventoryPlayer() ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } diff --git a/src/main/java/appeng/container/implementations/ContainerCondenser.java b/src/main/java/appeng/container/implementations/ContainerCondenser.java index 976aba47a..4302c70c9 100644 --- a/src/main/java/appeng/container/implementations/ContainerCondenser.java +++ b/src/main/java/appeng/container/implementations/ContainerCondenser.java @@ -34,7 +34,7 @@ import appeng.util.Platform; public class ContainerCondenser extends AEBaseContainer implements IProgressProvider { - final TileCondenser condenser; + private final TileCondenser condenser; @GuiSync( 0 ) public long requiredEnergy = 0; @GuiSync( 1 ) @@ -63,8 +63,8 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv final double requiredEnergy = this.condenser.getRequiredPower(); this.requiredEnergy = requiredEnergy == 0 ? (int) maxStorage : (int) Math.min( requiredEnergy, maxStorage ); - this.storedPower = (int) this.condenser.storedPower; - this.output = (CondenserOutput) this.condenser.getConfigManager().getSetting( Settings.CONDENSER_OUTPUT ); + this.storedPower = (int) this.condenser.getStoredPower(); + this.setOutput( (CondenserOutput) this.condenser.getConfigManager().getSetting( Settings.CONDENSER_OUTPUT ) ); } super.detectAndSendChanges(); @@ -81,4 +81,14 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv { return (int) this.requiredEnergy; } + + public CondenserOutput getOutput() + { + return this.output; + } + + private void setOutput( final CondenserOutput output ) + { + this.output = output; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftAmount.java b/src/main/java/appeng/container/implementations/ContainerCraftAmount.java index 1b7ebcf27..31186c7ed 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftAmount.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftAmount.java @@ -19,6 +19,8 @@ package appeng.container.implementations; +import javax.annotation.Nonnull; + import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.world.World; @@ -37,17 +39,15 @@ import appeng.tile.inventory.AppEngInternalInventory; public class ContainerCraftAmount extends AEBaseContainer { - public final Slot craftingItem; - final ITerminalHost priHost; - public IAEItemStack whatToMake; + private final Slot craftingItem; + private IAEItemStack itemToCreate; public ContainerCraftAmount( final InventoryPlayer ip, final ITerminalHost te ) { super( ip, te ); - this.priHost = te; this.craftingItem = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 ); - this.addSlotToContainer( this.craftingItem ); + this.addSlotToContainer( this.getCraftingItem() ); } @Override @@ -72,4 +72,19 @@ public class ContainerCraftAmount extends AEBaseContainer { return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() ); } + + public Slot getCraftingItem() + { + return this.craftingItem; + } + + public IAEItemStack getItemToCraft() + { + return this.itemToCreate; + } + + public void setItemToCraft( @Nonnull final IAEItemStack itemToCreate ) + { + this.itemToCreate = itemToCreate; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java index bee6e6a7b..b20dc6a21 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java @@ -24,6 +24,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.concurrent.Future; +import javax.annotation.Nonnull; + +import com.google.common.collect.ImmutableSet; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -31,6 +35,7 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; + import appeng.api.AEApi; import appeng.api.config.Actionable; import appeng.api.config.SecurityPermissions; @@ -60,16 +65,13 @@ import appeng.parts.reporting.PartPatternTerminal; import appeng.parts.reporting.PartTerminal; import appeng.util.Platform; -import com.google.common.collect.ImmutableSet; - public class ContainerCraftConfirm extends AEBaseContainer { - public final ArrayList cpus = new ArrayList(); - final ITerminalHost priHost; - public Future job; - public ICraftingJob result; + private final ArrayList cpus = new ArrayList(); + private Future job; + private ICraftingJob result; @GuiSync( 0 ) public long bytesUsed; @GuiSync( 1 ) @@ -86,45 +88,43 @@ public class ContainerCraftConfirm extends AEBaseContainer public boolean noCPU = true; @GuiSync( 7 ) public String myName = ""; - protected long cpuIdx = Long.MIN_VALUE; public ContainerCraftConfirm( final InventoryPlayer ip, final ITerminalHost te ) { super( ip, te ); - this.priHost = te; } public void cycleCpu( final boolean next ) { if( next ) { - this.selectedCpu++; + this.setSelectedCpu( this.getSelectedCpu() + 1 ); } else { - this.selectedCpu--; + this.setSelectedCpu( this.getSelectedCpu() - 1 ); } - if( this.selectedCpu < -1 ) + if( this.getSelectedCpu() < -1 ) { - this.selectedCpu = this.cpus.size() - 1; + this.setSelectedCpu( this.cpus.size() - 1 ); } - else if( this.selectedCpu >= this.cpus.size() ) + else if( this.getSelectedCpu() >= this.cpus.size() ) { - this.selectedCpu = -1; + this.setSelectedCpu( -1 ); } - if( this.selectedCpu == -1 ) + if( this.getSelectedCpu() == -1 ) { - this.cpuBytesAvail = 0; - this.cpuCoProcessors = 0; - this.myName = ""; + this.setCpuAvailableBytes( 0 ); + this.setCpuCoProcessors( 0 ); + this.setName( "" ); } else { - this.myName = this.cpus.get( this.selectedCpu ).myName; - this.cpuBytesAvail = this.cpus.get( this.selectedCpu ).size; - this.cpuCoProcessors = this.cpus.get( this.selectedCpu ).processors; + this.setName( this.cpus.get( this.getSelectedCpu() ).getName() ); + this.setCpuAvailableBytes( this.cpus.get( this.getSelectedCpu() ).getSize() ); + this.setCpuCoProcessors( this.cpus.get( this.getSelectedCpu() ).getProcessors() ); } } @@ -146,7 +146,7 @@ public class ContainerCraftConfirm extends AEBaseContainer boolean found = false; for( final CraftingCPURecord ccr : this.cpus ) { - if( ccr.cpu == c ) + if( ccr.getCpu() == c ) { found = true; } @@ -179,20 +179,20 @@ public class ContainerCraftConfirm extends AEBaseContainer this.sendCPUs(); } - this.noCPU = this.cpus.isEmpty(); + this.setNoCPU( this.cpus.isEmpty() ); super.detectAndSendChanges(); - if( this.job != null && this.job.isDone() ) + if( this.getJob() != null && this.getJob().isDone() ) { try { - this.result = this.job.get(); + this.result = this.getJob().get(); if( !this.result.isSimulation() ) { - this.simulation = false; - if( this.autoStart ) + this.setSimulation( false ); + if( this.isAutoStart() ) { this.startJob(); return; @@ -200,7 +200,7 @@ public class ContainerCraftConfirm extends AEBaseContainer } else { - this.simulation = true; + this.setSimulation( true ); } try @@ -212,7 +212,7 @@ public class ContainerCraftConfirm extends AEBaseContainer final IItemList plan = AEApi.instance().storage().createItemList(); this.result.populatePlan( plan ); - this.bytesUsed = this.result.getByteTotal(); + this.setUsedBytes( this.result.getByteTotal() ); for( final IAEItemStack out : plan ) { @@ -232,7 +232,7 @@ public class ContainerCraftConfirm extends AEBaseContainer if( c != null && this.result.isSimulation() ) { m = o.copy(); - o = items.extractItems( o, Actionable.SIMULATE, this.mySrc ); + o = items.extractItems( o, Actionable.SIMULATE, this.getActionSource() ); if( o == null ) { @@ -281,16 +281,16 @@ public class ContainerCraftConfirm extends AEBaseContainer { this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) ); AELog.error( e ); - this.isContainerValid = false; + this.setValidContainer( false ); this.result = null; } - this.job = null; + this.setJob( null ); } this.verifyPermissions( SecurityPermissions.CRAFT, false ); } - public IGrid getGrid() + private IGrid getGrid() { final IActionHost h = ( (IActionHost) this.getTarget() ); return h.getActionableNode().getGrid(); @@ -298,25 +298,25 @@ public class ContainerCraftConfirm extends AEBaseContainer private boolean cpuMatches( final ICraftingCPU c ) { - return c.getAvailableStorage() >= this.bytesUsed && !c.isBusy(); + return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy(); } private void sendCPUs() { Collections.sort( this.cpus ); - if( this.selectedCpu >= this.cpus.size() ) + if( this.getSelectedCpu() >= this.cpus.size() ) { - this.selectedCpu = -1; - this.cpuBytesAvail = 0; - this.cpuCoProcessors = 0; - this.myName = ""; + this.setSelectedCpu( -1 ); + this.setCpuAvailableBytes( 0 ); + this.setCpuCoProcessors( 0 ); + this.setName( "" ); } - else if( this.selectedCpu != -1 ) + else if( this.getSelectedCpu() != -1 ) { - this.myName = this.cpus.get( this.selectedCpu ).myName; - this.cpuBytesAvail = this.cpus.get( this.selectedCpu ).size; - this.cpuCoProcessors = this.cpus.get( this.selectedCpu ).processors; + this.setName( this.cpus.get( this.getSelectedCpu() ).getName() ); + this.setCpuAvailableBytes( this.cpus.get( this.getSelectedCpu() ).getSize() ); + this.setCpuCoProcessors( this.cpus.get( this.getSelectedCpu() ).getProcessors() ); } } @@ -345,22 +345,22 @@ public class ContainerCraftConfirm extends AEBaseContainer originalGui = GuiBridge.GUI_PATTERN_TERMINAL; } - if( this.result != null && !this.simulation ) + if( this.result != null && !this.isSimulation() ) { final ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class ); - final ICraftingLink g = cc.submitJob( this.result, null, this.selectedCpu == -1 ? null : this.cpus.get( this.selectedCpu ).cpu, true, this.getActionSrc() ); - this.autoStart = false; - if( g != null && originalGui != null && this.openContext != null ) + final ICraftingLink g = cc.submitJob( this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get( this.getSelectedCpu() ).getCpu(), true, this.getActionSrc() ); + this.setAutoStart( false ); + if( g != null && originalGui != null && this.getOpenContext() != null ) { - NetworkHandler.instance.sendTo( new PacketSwitchGuis( originalGui ), (EntityPlayerMP) this.invPlayer.player ); + NetworkHandler.instance.sendTo( new PacketSwitchGuis( originalGui ), (EntityPlayerMP) this.getInventoryPlayer().player ); - final TileEntity te = this.openContext.getTile(); - Platform.openGUI( this.invPlayer.player, te, this.openContext.side, originalGui ); + final TileEntity te = this.getOpenContext().getTile(); + Platform.openGUI( this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui ); } } } - public BaseActionSource getActionSrc() + private BaseActionSource getActionSrc() { return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() ); } @@ -369,10 +369,10 @@ public class ContainerCraftConfirm extends AEBaseContainer public void removeCraftingFromCrafters( final ICrafting c ) { super.removeCraftingFromCrafters( c ); - if( this.job != null ) + if( this.getJob() != null ) { - this.job.cancel( true ); - this.job = null; + this.getJob().cancel( true ); + this.setJob( null ); } } @@ -380,10 +380,10 @@ public class ContainerCraftConfirm extends AEBaseContainer public void onContainerClosed( final EntityPlayer par1EntityPlayer ) { super.onContainerClosed( par1EntityPlayer ); - if( this.job != null ) + if( this.getJob() != null ) { - this.job.cancel( true ); - this.job = null; + this.getJob().cancel( true ); + this.setJob( null ); } } @@ -391,4 +391,94 @@ public class ContainerCraftConfirm extends AEBaseContainer { return this.getPlayerInv().player.worldObj; } + + public boolean isAutoStart() + { + return this.autoStart; + } + + public void setAutoStart( final boolean autoStart ) + { + this.autoStart = autoStart; + } + + public long getUsedBytes() + { + return this.bytesUsed; + } + + private void setUsedBytes( final long bytesUsed ) + { + this.bytesUsed = bytesUsed; + } + + public long getCpuAvailableBytes() + { + return this.cpuBytesAvail; + } + + private void setCpuAvailableBytes( final long cpuBytesAvail ) + { + this.cpuBytesAvail = cpuBytesAvail; + } + + public int getCpuCoProcessors() + { + return this.cpuCoProcessors; + } + + private void setCpuCoProcessors( final int cpuCoProcessors ) + { + this.cpuCoProcessors = cpuCoProcessors; + } + + public int getSelectedCpu() + { + return this.selectedCpu; + } + + private void setSelectedCpu( final int selectedCpu ) + { + this.selectedCpu = selectedCpu; + } + + public String getName() + { + return this.myName; + } + + private void setName( @Nonnull final String myName ) + { + this.myName = myName; + } + + public boolean hasNoCPU() + { + return this.noCPU; + } + + private void setNoCPU( final boolean noCPU ) + { + this.noCPU = noCPU; + } + + public boolean isSimulation() + { + return this.simulation; + } + + private void setSimulation( final boolean simulation ) + { + this.simulation = simulation; + } + + private Future getJob() + { + return this.job; + } + + public void setJob( final Future job ) + { + this.job = job; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java b/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java index 2c0256433..2df06c35b 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java @@ -53,11 +53,10 @@ import appeng.util.Platform; public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver, ICustomNameObject { - final IItemList list = AEApi.instance().storage().createItemList(); - protected IGrid network; - CraftingCPUCluster monitor = null; - String cpuName = null; - int delay = 40; + private final IItemList list = AEApi.instance().storage().createItemList(); + private IGrid network; + private CraftingCPUCluster monitor = null; + private String cpuName = null; @GuiSync( 0 ) public long eta = -1; @@ -81,34 +80,34 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH this.setCPU( (ICraftingCPU) ( (IAEMultiBlock) te ).getCluster() ); } - if( this.network == null && Platform.isServer() ) + if( this.getNetwork() == null && Platform.isServer() ) { - this.isContainerValid = false; + this.setValidContainer( false ); } } private void findNode( final IGridHost host, final AEPartLocation d ) { - if( this.network == null ) + if( this.getNetwork() == null ) { final IGridNode node = host.getGridNode( d ); if( node != null ) { - this.network = node.getGrid(); + this.setNetwork( node.getGrid() ); } } } protected void setCPU( final ICraftingCPU c ) { - if( c == this.monitor ) + if( c == this.getMonitor() ) { return; } - if( this.monitor != null ) + if( this.getMonitor() != null ) { - this.monitor.removeListener( this ); + this.getMonitor().removeListener( this ); } for( final Object g : this.crafters ) @@ -129,27 +128,27 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH if( c instanceof CraftingCPUCluster ) { this.cpuName = c.getName(); - this.monitor = (CraftingCPUCluster) c; + this.setMonitor( (CraftingCPUCluster) c ); this.list.resetStatus(); - this.monitor.getListOfItem( this.list, CraftingItemList.ALL ); - this.monitor.addListener( this, null ); - this.eta = 0; + this.getMonitor().getListOfItem( this.list, CraftingItemList.ALL ); + this.getMonitor().addListener( this, null ); + this.setEstimatedTime( 0 ); } else { - this.monitor = null; + this.setMonitor( null ); this.cpuName = ""; - this.eta = -1; + this.setEstimatedTime( -1 ); } } public void cancelCrafting() { - if( this.monitor != null ) + if( this.getMonitor() != null ) { - this.monitor.cancel(); + this.getMonitor().cancel(); } - this.eta = -1; + this.setEstimatedTime( -1 ); } @Override @@ -157,9 +156,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH { super.removeCraftingFromCrafters( c ); - if( this.crafters.isEmpty() && this.monitor != null ) + if( this.crafters.isEmpty() && this.getMonitor() != null ) { - this.monitor.removeListener( this ); + this.getMonitor().removeListener( this ); } } @@ -167,26 +166,26 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH public void onContainerClosed( final EntityPlayer player ) { super.onContainerClosed( player ); - if( this.monitor != null ) + if( this.getMonitor() != null ) { - this.monitor.removeListener( this ); + this.getMonitor().removeListener( this ); } } @Override public void detectAndSendChanges() { - if( Platform.isServer() && this.monitor != null && !this.list.isEmpty() ) + if( Platform.isServer() && this.getMonitor() != null && !this.list.isEmpty() ) { try { - if( this.eta >= 0 ) + if( this.getEstimatedTime() >= 0 ) { - final long elapsedTime = this.monitor.getElapsedTime(); - final double remainingItems = this.monitor.getRemainingItemCount(); - final double startItems = this.monitor.getStartItemCount(); + final long elapsedTime = this.getMonitor().getElapsedTime(); + final double remainingItems = this.getMonitor().getRemainingItemCount(); + final double startItems = this.getMonitor().getStartItemCount(); final long eta = (long) ( elapsedTime / Math.max( 1d, ( startItems - remainingItems ) ) * remainingItems ); - this.eta = eta; + this.setEstimatedTime( eta ); } final PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 ); @@ -195,9 +194,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH for( final IAEItemStack out : this.list ) { - a.appendItem( this.monitor.getItemStack( out, CraftingItemList.STORAGE ) ); - b.appendItem( this.monitor.getItemStack( out, CraftingItemList.ACTIVE ) ); - c.appendItem( this.monitor.getItemStack( out, CraftingItemList.PENDING ) ); + a.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.STORAGE ) ); + b.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.ACTIVE ) ); + c.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.PENDING ) ); } this.list.resetStatus(); @@ -265,4 +264,34 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH { return this.cpuName != null && this.cpuName.length() > 0; } + + public long getEstimatedTime() + { + return this.eta; + } + + private void setEstimatedTime( final long eta ) + { + this.eta = eta; + } + + CraftingCPUCluster getMonitor() + { + return this.monitor; + } + + private void setMonitor( final CraftingCPUCluster monitor ) + { + this.monitor = monitor; + } + + IGrid getNetwork() + { + return this.network; + } + + private void setNetwork( final IGrid network ) + { + this.network = network; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java index bf9d6e90e..76da6d9c7 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java @@ -21,6 +21,7 @@ package appeng.container.implementations; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import net.minecraft.entity.player.InventoryPlayer; import appeng.api.networking.crafting.ICraftingCPU; @@ -34,7 +35,7 @@ import com.google.common.collect.ImmutableSet; public class ContainerCraftingStatus extends ContainerCraftingCPU { - public final ArrayList cpus = new ArrayList(); + private final List cpus = new ArrayList(); @GuiSync( 5 ) public int selectedCpu = -1; @GuiSync( 6 ) @@ -50,7 +51,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU @Override public void detectAndSendChanges() { - final ICraftingGrid cc = this.network.getCache( ICraftingGrid.class ); + final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class ); final ImmutableSet cpuSet = cc.getCpus(); int matches = 0; @@ -60,7 +61,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU boolean found = false; for( final CraftingCPURecord ccr : this.cpus ) { - if( ccr.cpu == c ) + if( ccr.getCpu() == c ) { found = true; } @@ -114,7 +115,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU } else if( this.selectedCpu != -1 ) { - this.myName = this.cpus.get( this.selectedCpu ).myName; + this.myName = this.cpus.get( this.selectedCpu ).getName(); } if( this.selectedCpu == -1 && this.cpus.size() > 0 ) @@ -124,9 +125,9 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU if( this.selectedCpu != -1 ) { - if( this.cpus.get( this.selectedCpu ).cpu != this.monitor ) + if( this.cpus.get( this.selectedCpu ).getCpu() != this.getMonitor() ) { - this.setCPU( this.cpus.get( this.selectedCpu ).cpu ); + this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() ); } } else @@ -167,8 +168,8 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU } else { - this.myName = this.cpus.get( this.selectedCpu ).myName; - this.setCPU( this.cpus.get( this.selectedCpu ).cpu ); + this.myName = this.cpus.get( this.selectedCpu ).getName(); + this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() ); } } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java index f538173ee..937f7700c 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java @@ -38,10 +38,10 @@ import appeng.tile.inventory.InvOperation; public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IContainerCraftingPacket { - public final PartCraftingTerminal ct; - final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 ); - final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9]; - final SlotCraftingTerm outputSlot; + private final PartCraftingTerminal ct; + private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 ); + private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9]; + private final SlotCraftingTerm outputSlot; public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable ) { @@ -58,7 +58,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE } } - this.addSlotToContainer( this.outputSlot = new SlotCraftingTerm( this.getPlayerInv().player, this.mySrc, this.powerSrc, monitorable, crafting, crafting, this.output, 131, -72 + 18, this ) ); + this.addSlotToContainer( this.outputSlot = new SlotCraftingTerm( this.getPlayerInv().player, this.getActionSource(), this.getPowerSource(), monitorable, crafting, crafting, this.output, 131, -72 + 18, this ) ); this.bindPlayerInventory( ip, 0, 0 ); @@ -99,7 +99,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE { if( name.equals( "player" ) ) { - return this.invPlayer; + return this.getInventoryPlayer(); } return this.ct.getInventoryByName( name ); } diff --git a/src/main/java/appeng/container/implementations/ContainerDrive.java b/src/main/java/appeng/container/implementations/ContainerDrive.java index 97459cb68..da918f1dd 100644 --- a/src/main/java/appeng/container/implementations/ContainerDrive.java +++ b/src/main/java/appeng/container/implementations/ContainerDrive.java @@ -28,18 +28,15 @@ import appeng.tile.storage.TileDrive; public class ContainerDrive extends AEBaseContainer { - final TileDrive drive; - public ContainerDrive( final InventoryPlayer ip, final TileDrive drive ) { super( ip, drive, null ); - this.drive = drive; for( int y = 0; y < 5; y++ ) { for( int x = 0; x < 2; x++ ) { - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, this.getInventoryPlayer() ) ); } } diff --git a/src/main/java/appeng/container/implementations/ContainerFormationPlane.java b/src/main/java/appeng/container/implementations/ContainerFormationPlane.java index 0d7f04ae0..fbfb135a2 100644 --- a/src/main/java/appeng/container/implementations/ContainerFormationPlane.java +++ b/src/main/java/appeng/container/implementations/ContainerFormationPlane.java @@ -37,15 +37,12 @@ import appeng.util.Platform; public class ContainerFormationPlane extends ContainerUpgradeable { - final PartFormationPlane storageBus; - @GuiSync( 6 ) public YesNo placeMode; public ContainerFormationPlane( final InventoryPlayer ip, final PartFormationPlane te ) { super( ip, te ); - this.storageBus = te; } @Override @@ -60,7 +57,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable final int xo = 8; final int yo = 23 + 6; - final IInventory config = this.upgradeable.getInventoryByName( "config" ); + final IInventory config = this.getUpgradeable().getInventoryByName( "config" ); for( int y = 0; y < 7; y++ ) { for( int x = 0; x < 9; x++ ) @@ -76,12 +73,12 @@ public class ContainerFormationPlane extends ContainerUpgradeable } } - final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer ) ).setNotDraggable() ); + final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ).setNotDraggable() ); } @Override @@ -103,8 +100,8 @@ public class ContainerFormationPlane extends ContainerUpgradeable if( Platform.isServer() ) { - this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE ); - this.placeMode = (YesNo) this.upgradeable.getConfigManager().getSetting( Settings.PLACE_BLOCK ); + this.setFuzzyMode( (FuzzyMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FUZZY_MODE ) ); + this.setPlaceMode( (YesNo) this.getUpgradeable().getConfigManager().getSetting( Settings.PLACE_BLOCK ) ); } this.standardDetectAndSendChanges(); @@ -113,8 +110,18 @@ public class ContainerFormationPlane extends ContainerUpgradeable @Override public boolean isSlotEnabled( final int idx ) { - final int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY ); + final int upgrades = this.getUpgradeable().getInstalledUpgrades( Upgrades.CAPACITY ); return upgrades > idx; } + + public YesNo getPlaceMode() + { + return this.placeMode; + } + + private void setPlaceMode( final YesNo placeMode ) + { + this.placeMode = placeMode; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerGrinder.java b/src/main/java/appeng/container/implementations/ContainerGrinder.java index 60264f18b..a2693947b 100644 --- a/src/main/java/appeng/container/implementations/ContainerGrinder.java +++ b/src/main/java/appeng/container/implementations/ContainerGrinder.java @@ -30,16 +30,13 @@ import appeng.tile.grindstone.TileGrinder; public class ContainerGrinder extends AEBaseContainer { - final TileGrinder grinder; - public ContainerGrinder( final InventoryPlayer ip, final TileGrinder grinder ) { super( ip, grinder, null ); - this.grinder = grinder; - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 0, 12, 17, this.invPlayer ) ); - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 1, 12 + 18, 17, this.invPlayer ) ); - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 2, 12 + 36, 17, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 0, 12, 17, this.getInventoryPlayer() ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 1, 12 + 18, 17, this.getInventoryPlayer() ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 2, 12 + 36, 17, this.getInventoryPlayer() ) ); this.addSlotToContainer( new SlotInaccessible( grinder, 6, 80, 40 ) ); diff --git a/src/main/java/appeng/container/implementations/ContainerIOPort.java b/src/main/java/appeng/container/implementations/ContainerIOPort.java index 8248a72aa..5be22358a 100644 --- a/src/main/java/appeng/container/implementations/ContainerIOPort.java +++ b/src/main/java/appeng/container/implementations/ContainerIOPort.java @@ -36,8 +36,6 @@ import appeng.util.Platform; public class ContainerIOPort extends ContainerUpgradeable { - final TileIOPort ioPort; - @GuiSync( 2 ) public FullnessMode fMode = FullnessMode.EMPTY; @GuiSync( 3 ) @@ -46,7 +44,6 @@ public class ContainerIOPort extends ContainerUpgradeable public ContainerIOPort( final InventoryPlayer ip, final TileIOPort te ) { super( ip, te ); - this.ioPort = te; } @Override @@ -61,13 +58,13 @@ public class ContainerIOPort extends ContainerUpgradeable int offX = 19; int offY = 17; - final IInventory cells = this.upgradeable.getInventoryByName( "cells" ); + final IInventory cells = this.getUpgradeable().getInventoryByName( "cells" ); for( int y = 0; y < 3; y++ ) { for( int x = 0; x < 2; x++ ) { - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.getInventoryPlayer() ) ); } } @@ -81,10 +78,10 @@ public class ContainerIOPort extends ContainerUpgradeable } } - final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() ); + final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() ); } @Override @@ -106,11 +103,31 @@ public class ContainerIOPort extends ContainerUpgradeable if( Platform.isServer() ) { - this.opMode = (OperationMode) this.upgradeable.getConfigManager().getSetting( Settings.OPERATION_MODE ); - this.fMode = (FullnessMode) this.upgradeable.getConfigManager().getSetting( Settings.FULLNESS_MODE ); - this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ); + this.setOperationMode( (OperationMode) this.getUpgradeable().getConfigManager().getSetting( Settings.OPERATION_MODE ) ); + this.setFullMode( (FullnessMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FULLNESS_MODE ) ); + this.setRedStoneMode( (RedstoneMode) this.getUpgradeable().getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ) ); } this.standardDetectAndSendChanges(); } + + public FullnessMode getFullMode() + { + return this.fMode; + } + + private void setFullMode( final FullnessMode fMode ) + { + this.fMode = fMode; + } + + public OperationMode getOperationMode() + { + return this.opMode; + } + + private void setOperationMode( final OperationMode opMode ) + { + this.opMode = opMode; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerInscriber.java b/src/main/java/appeng/container/implementations/ContainerInscriber.java index 707d0ea1c..a8a1e4ffa 100644 --- a/src/main/java/appeng/container/implementations/ContainerInscriber.java +++ b/src/main/java/appeng/container/implementations/ContainerInscriber.java @@ -42,11 +42,11 @@ import appeng.util.Platform; public class ContainerInscriber extends ContainerUpgradeable implements IProgressProvider { - final TileInscriber ti; + private final TileInscriber ti; - final Slot top; - final Slot middle; - final Slot bottom; + private final Slot top; + private final Slot middle; + private final Slot bottom; @GuiSync( 2 ) public int maxProcessingTime = -1; @@ -59,9 +59,9 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres super( ip, te ); this.ti = te; - this.addSlotToContainer( this.top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 0, 45, 16, this.invPlayer ) ); - this.addSlotToContainer( this.bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 1, 45, 62, this.invPlayer ) ); - this.addSlotToContainer( this.middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, this.ti, 2, 63, 39, this.invPlayer ) ); + this.addSlotToContainer( this.top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 0, 45, 16, this.getInventoryPlayer() ) ); + this.addSlotToContainer( this.bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 1, 45, 62, this.getInventoryPlayer() ) ); + this.addSlotToContainer( this.middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, this.ti, 2, 63, 39, this.getInventoryPlayer() ) ); this.addSlotToContainer( new SlotOutput( this.ti, 3, 113, 40, -1 ) ); } @@ -99,8 +99,8 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres if( Platform.isServer() ) { - this.maxProcessingTime = this.ti.maxProcessingTime; - this.processingTime = this.ti.processingTime; + this.maxProcessingTime = this.ti.getMaxProcessingTime(); + this.processingTime = this.ti.getProcessingTime(); } } diff --git a/src/main/java/appeng/container/implementations/ContainerInterface.java b/src/main/java/appeng/container/implementations/ContainerInterface.java index 29cadd8e1..88816d91b 100644 --- a/src/main/java/appeng/container/implementations/ContainerInterface.java +++ b/src/main/java/appeng/container/implementations/ContainerInterface.java @@ -35,7 +35,7 @@ import appeng.helpers.IInterfaceHost; public class ContainerInterface extends ContainerUpgradeable { - final DualityInterface myDuality; + private final DualityInterface myDuality; @GuiSync( 3 ) public YesNo bMode = YesNo.NO; @@ -51,7 +51,7 @@ public class ContainerInterface extends ContainerUpgradeable for( int x = 0; x < DualityInterface.NUMBER_OF_PATTERN_SLOTS; x++ ) { - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, this.getInventoryPlayer() ) ); } for( int x = 0; x < DualityInterface.NUMBER_OF_CONFIG_SLOTS; x++ ) @@ -93,7 +93,27 @@ public class ContainerInterface extends ContainerUpgradeable @Override protected void loadSettingsFromHost( final IConfigManager cm ) { - this.bMode = (YesNo) cm.getSetting( Settings.BLOCK ); - this.iTermMode = (YesNo) cm.getSetting( Settings.INTERFACE_TERMINAL ); + this.setBlockingMode( (YesNo) cm.getSetting( Settings.BLOCK ) ); + this.setInterfaceTerminalMode( (YesNo) cm.getSetting( Settings.INTERFACE_TERMINAL ) ); + } + + public YesNo getBlockingMode() + { + return this.bMode; + } + + private void setBlockingMode( final YesNo bMode ) + { + this.bMode = bMode; + } + + public YesNo getInterfaceTerminalMode() + { + return this.iTermMode; + } + + private void setInterfaceTerminalMode( final YesNo iTermMode ) + { + this.iTermMode = iTermMode; } } diff --git a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java index eab63eed7..91498adb0 100644 --- a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java +++ b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java @@ -61,10 +61,10 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer */ private static long autoBase = Long.MIN_VALUE; - final Map diList = new HashMap(); - final Map byId = new HashMap(); - IGrid grid; - NBTTagCompound data = new NBTTagCompound(); + private final Map diList = new HashMap(); + private final Map byId = new HashMap(); + private IGrid grid; + private NBTTagCompound data = new NBTTagCompound(); public ContainerInterfaceTerminal( final InventoryPlayer ip, final PartInterfaceTerminal anchor ) { @@ -400,14 +400,14 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer data.setTag( name, tag ); } - static class InvTracker + private static class InvTracker { - public final long sortBy; - final long which = autoBase++; - final String unlocalizedName; - final IInventory client; - final IInventory server; + private final long sortBy; + private final long which = autoBase++; + private final String unlocalizedName; + private final IInventory client; + private final IInventory server; public InvTracker( final DualityInterface dual, final IInventory patterns, final String unlocalizedName ) { @@ -418,7 +418,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer } } - static class PatternInvSlot extends WrapperInvSlot + private static class PatternInvSlot extends WrapperInvSlot { public PatternInvSlot( final IInventory inv ) diff --git a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java index 8ff4289c2..b7217bba1 100644 --- a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java +++ b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java @@ -41,10 +41,10 @@ import appeng.util.Platform; public class ContainerLevelEmitter extends ContainerUpgradeable { - final PartLevelEmitter lvlEmitter; + private final PartLevelEmitter lvlEmitter; @SideOnly( Side.CLIENT ) - public GuiTextField textField; + private GuiTextField textField; @GuiSync( 2 ) public LevelType lvType; @GuiSync( 3 ) @@ -74,26 +74,25 @@ public class ContainerLevelEmitter extends ContainerUpgradeable @Override protected void setupConfig() { - - final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); + final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); if( this.availableUpgrades() > 0 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() ); } if( this.availableUpgrades() > 1 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() ); } if( this.availableUpgrades() > 2 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() ); } if( this.availableUpgrades() > 3 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() ); } - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); final int y = 40; final int x = 80 + 44; this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) ); @@ -120,10 +119,10 @@ public class ContainerLevelEmitter extends ContainerUpgradeable if( Platform.isServer() ) { this.EmitterValue = this.lvlEmitter.getReportingValue(); - this.cmType = (YesNo) this.upgradeable.getConfigManager().getSetting( Settings.CRAFT_VIA_REDSTONE ); - this.lvType = (LevelType) this.upgradeable.getConfigManager().getSetting( Settings.LEVEL_TYPE ); - this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE ); - this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_EMITTER ); + this.setCraftingMode( (YesNo) this.getUpgradeable().getConfigManager().getSetting( Settings.CRAFT_VIA_REDSTONE ) ); + this.setLevelMode( (LevelType) this.getUpgradeable().getConfigManager().getSetting( Settings.LEVEL_TYPE ) ); + this.setFuzzyMode( (FuzzyMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FUZZY_MODE ) ); + this.setRedStoneMode( (RedstoneMode) this.getUpgradeable().getConfigManager().getSetting( Settings.REDSTONE_EMITTER ) ); } this.standardDetectAndSendChanges(); @@ -140,4 +139,26 @@ public class ContainerLevelEmitter extends ContainerUpgradeable } } } + + @Override + public YesNo getCraftingMode() + { + return this.cmType; + } + + @Override + public void setCraftingMode( final YesNo cmType ) + { + this.cmType = cmType; + } + + public LevelType getLevelMode() + { + return this.lvType; + } + + private void setLevelMode( final LevelType lvType ) + { + this.lvType = lvType; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerMAC.java b/src/main/java/appeng/container/implementations/ContainerMAC.java index 4a6fde9ae..ed90a6121 100644 --- a/src/main/java/appeng/container/implementations/ContainerMAC.java +++ b/src/main/java/appeng/container/implementations/ContainerMAC.java @@ -41,7 +41,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi { private static final int MAX_CRAFT_PROGRESS = 100; - final TileMolecularAssembler tma; + private final TileMolecularAssembler tma; @GuiSync( 4 ) public int craftProgress = 0; @@ -53,7 +53,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi public boolean isValidItemForSlot( final int slotIndex, final ItemStack i ) { - final IInventory mac = this.upgradeable.getInventoryByName( "mac" ); + final IInventory mac = this.getUpgradeable().getInventoryByName( "mac" ); final ItemStack is = mac.getStackInSlot( 10 ); if( is == null ) @@ -87,7 +87,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi int offX = 29; int offY = 30; - final IInventory mac = this.upgradeable.getInventoryByName( "mac" ); + final IInventory mac = this.getUpgradeable().getInventoryByName( "mac" ); for( int y = 0; y < 3; y++ ) { @@ -101,18 +101,18 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi offX = 126; offY = 16; - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.getInventoryPlayer() ) ); this.addSlotToContainer( new SlotOutput( mac, 9, offX, offY + 32, -1 ) ); offX = 122; offY = 17; - final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer ) ).setNotDraggable() ); + final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ).setNotDraggable() ); } @Override @@ -134,7 +134,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi if( Platform.isServer() ) { - this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ); + this.setRedStoneMode( (RedstoneMode) this.getUpgradeable().getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ) ); } this.craftProgress = this.tma.getCraftingProgress(); diff --git a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java index 7454e6b44..ad1c5a565 100644 --- a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java +++ b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java @@ -22,6 +22,8 @@ package appeng.container.implementations; import java.io.IOException; import java.nio.BufferOverflowException; +import javax.annotation.Nonnull; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -71,17 +73,17 @@ import appeng.util.Platform; public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver { - public final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5]; - final IMEMonitor monitor; - final IItemList items = AEApi.instance().storage().createItemList(); - final IConfigManager clientCM; + private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5]; + private final IMEMonitor monitor; + private final IItemList items = AEApi.instance().storage().createItemList(); + private final IConfigManager clientCM; private final ITerminalHost host; @GuiSync( 99 ) public boolean canAccessViewCells = false; @GuiSync( 98 ) public boolean hasPower = false; - public IConfigManagerHost gui; - IConfigManager serverCM; + private IConfigManagerHost gui; + private IConfigManager serverCM; private IGridNode networkNode; public ContainerMEMonitorable( final InventoryPlayer ip, final ITerminalHost monitorable ) @@ -109,15 +111,15 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { this.monitor.addListener( this, null ); - this.cellInv = this.monitor; + this.setCellInventory( this.monitor ); if( monitorable instanceof IPortableCell ) { - this.powerSrc = (IEnergySource) monitorable; + this.setPowerSource( (IEnergySource) monitorable ); } else if( monitorable instanceof IMEChest ) { - this.powerSrc = (IEnergySource) monitorable; + this.setPowerSource( (IEnergySource) monitorable ); } else if( monitorable instanceof IGridHost ) { @@ -128,14 +130,14 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa final IGrid g = node.getGrid(); if( g != null ) { - this.powerSrc = new ChannelPowerSrc( this.networkNode, (IEnergySource) g.getCache( IEnergyGrid.class ) ); + this.setPowerSource( new ChannelPowerSrc( this.networkNode, (IEnergySource) g.getCache( IEnergyGrid.class ) ) ); } } } } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } else @@ -148,8 +150,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { for( int y = 0; y < 5; y++ ) { - this.cellView[y] = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.VIEW_CELL, ( (IViewCellStorage) monitorable ).getViewCellStorage(), y, 206, y * 18 + 8, this.invPlayer ); - this.cellView[y].allowEdit = this.canAccessViewCells; + this.cellView[y] = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.VIEW_CELL, ( (IViewCellStorage) monitorable ).getViewCellStorage(), y, 206, y * 18 + 8, this.getInventoryPlayer() ); + this.cellView[y].setAllowEdit( this.canAccessViewCells ); this.addSlotToContainer( this.cellView[y] ); } } @@ -172,7 +174,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { if( this.monitor != this.host.getItemInventory() ) { - this.isContainerValid = false; + this.setValidContainer( false ); } for( final Settings set : this.serverCM.getSettings() ) @@ -248,7 +250,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { if( this.cellView[y] != null ) { - this.cellView[y].allowEdit = this.canAccessViewCells; + this.cellView[y].setAllowEdit( this.canAccessViewCells ); } } } @@ -263,15 +265,15 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { if( this.networkNode != null ) { - this.hasPower = this.networkNode.isActive(); + this.setPowered( this.networkNode.isActive() ); } - else if( this.powerSrc instanceof IEnergyGrid ) + else if( this.getPowerSource() instanceof IEnergyGrid ) { - this.hasPower = ( (IEnergyGrid) this.powerSrc ).isNetworkPowered(); + this.setPowered( ( (IEnergyGrid) this.getPowerSource() ).isNetworkPowered() ); } else { - this.hasPower = this.powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8; + this.setPowered( this.getPowerSource().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8 ); } } catch( final Throwable t ) @@ -289,7 +291,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { if( this.cellView[y] != null ) { - this.cellView[y].allowEdit = this.canAccessViewCells; + this.cellView[y].setAllowEdit( this.canAccessViewCells ); } } } @@ -305,7 +307,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa this.queueInventory( c ); } - public void queueInventory( final ICrafting c ) + private void queueInventory( final ICrafting c ) { if( Platform.isServer() && c instanceof EntityPlayer && this.monitor != null ) { @@ -390,9 +392,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa @Override public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue ) { - if( this.gui != null ) + if( this.getGui() != null ) { - this.gui.updateSetting( manager, settingName, newValue ); + this.getGui().updateSetting( manager, settingName, newValue ); } } @@ -417,4 +419,29 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa return list; } + + public SlotRestrictedInput getCellViewSlot( final int index ) + { + return this.cellView[index]; + } + + public boolean isPowered() + { + return this.hasPower; + } + + private void setPowered( final boolean isPowered ) + { + this.hasPower = isPowered; + } + + private IConfigManagerHost getGui() + { + return this.gui; + } + + public void setGui( @Nonnull final IConfigManagerHost gui ) + { + this.gui = gui; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java b/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java index 4a7038f75..9a54a24d5 100644 --- a/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java +++ b/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java @@ -31,7 +31,7 @@ import appeng.util.Platform; public class ContainerMEPortableCell extends ContainerMEMonitorable { - public double powerMultiplier = 0.5; + private double powerMultiplier = 0.5; private final IPortableCell civ; private int ticks = 0; @@ -72,27 +72,37 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } } else { - this.isContainerValid = false; + this.setValidContainer( false ); } // drain 1 ae t this.ticks++; if( this.ticks > 10 ) { - this.civ.extractAEPower( this.powerMultiplier * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG ); + this.civ.extractAEPower( this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG ); this.ticks = 0; } super.detectAndSendChanges(); } + + private double getPowerMultiplier() + { + return this.powerMultiplier; + } + + void setPowerMultiplier( final double powerMultiplier ) + { + this.powerMultiplier = powerMultiplier; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java index a2a289d92..cd601336a 100644 --- a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java @@ -54,8 +54,8 @@ public class ContainerNetworkStatus extends AEBaseContainer public long currentPower; @GuiSync( 3 ) public long maxPower; - IGrid network; - int delay = 40; + private IGrid network; + private int delay = 40; public ContainerNetworkStatus( final InventoryPlayer ip, final INetworkTool te ) { @@ -73,7 +73,7 @@ public class ContainerNetworkStatus extends AEBaseContainer if( this.network == null && Platform.isServer() ) { - this.isContainerValid = false; + this.setValidContainer( false ); } } @@ -100,10 +100,10 @@ public class ContainerNetworkStatus extends AEBaseContainer final IEnergyGrid eg = this.network.getCache( IEnergyGrid.class ); if( eg != null ) { - this.avgAddition = (long) ( 100.0 * eg.getAvgPowerInjection() ); - this.powerUsage = (long) ( 100.0 * eg.getAvgPowerUsage() ); - this.currentPower = (long) ( 100.0 * eg.getStoredPower() ); - this.maxPower = (long) ( 100.0 * eg.getMaxStoredPower() ); + this.setAverageAddition( (long) ( 100.0 * eg.getAvgPowerInjection() ) ); + this.setPowerUsage( (long) ( 100.0 * eg.getAvgPowerUsage() ) ); + this.setCurrentPower( (long) ( 100.0 * eg.getStoredPower() ) ); + this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) ); } try @@ -147,4 +147,44 @@ public class ContainerNetworkStatus extends AEBaseContainer } super.detectAndSendChanges(); } + + public long getCurrentPower() + { + return this.currentPower; + } + + private void setCurrentPower( final long currentPower ) + { + this.currentPower = currentPower; + } + + public long getMaxPower() + { + return this.maxPower; + } + + private void setMaxPower( final long maxPower ) + { + this.maxPower = maxPower; + } + + public long getAverageAddition() + { + return this.avgAddition; + } + + private void setAverageAddition( final long avgAddition ) + { + this.avgAddition = avgAddition; + } + + public long getPowerUsage() + { + return this.powerUsage; + } + + private void setPowerUsage( final long powerUsage ) + { + this.powerUsage = powerUsage; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkTool.java b/src/main/java/appeng/container/implementations/ContainerNetworkTool.java index 8c801c27e..cd225ac08 100644 --- a/src/main/java/appeng/container/implementations/ContainerNetworkTool.java +++ b/src/main/java/appeng/container/implementations/ContainerNetworkTool.java @@ -32,7 +32,7 @@ import appeng.util.Platform; public class ContainerNetworkTool extends AEBaseContainer { - final INetworkTool toolInv; + private final INetworkTool toolInv; @GuiSync( 1 ) public boolean facadeMode; @@ -48,7 +48,7 @@ public class ContainerNetworkTool extends AEBaseContainer { for( int x = 0; x < 3; x++ ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.invPlayer ) ) ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.getInventoryPlayer() ) ) ); } } @@ -77,21 +77,31 @@ public class ContainerNetworkTool extends AEBaseContainer } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } - if( this.isContainerValid ) + if( this.isValidContainer() ) { final NBTTagCompound data = Platform.openNbtData( currentItem ); - this.facadeMode = data.getBoolean( "hideFacades" ); + this.setFacadeMode( data.getBoolean( "hideFacades" ) ); } super.detectAndSendChanges(); } + + public boolean isFacadeMode() + { + return this.facadeMode; + } + + private void setFacadeMode( final boolean facadeMode ) + { + this.facadeMode = facadeMode; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java index 04bd69f08..a0d1cfc8f 100644 --- a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java @@ -69,7 +69,7 @@ import appeng.util.item.AEItemStack; public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket { - public final PartPatternTerminal ct; + private final PartPatternTerminal patternTerminal; private final AppEngInternalInventory cOut = new AppEngInternalInventory( null, 1 ); private final IInventory crafting; private final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9]; @@ -85,12 +85,12 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA public ContainerPatternTerm( final InventoryPlayer ip, final ITerminalHost monitorable ) { super( ip, monitorable, false ); - this.ct = (PartPatternTerminal) monitorable; + this.patternTerminal = (PartPatternTerminal) monitorable; - final IInventory patternInv = this.ct.getInventoryByName( "pattern" ); - final IInventory output = this.ct.getInventoryByName( "output" ); + final IInventory patternInv = this.getPatternTerminal().getInventoryByName( "pattern" ); + final IInventory output = this.getPatternTerminal().getInventoryByName( "output" ); - this.crafting = this.ct.getInventoryByName( "crafting" ); + this.crafting = this.getPatternTerminal().getInventoryByName( "crafting" ); for( int y = 0; y < 3; y++ ) { @@ -100,18 +100,18 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA } } - this.addSlotToContainer( this.craftSlot = new SlotPatternTerm( ip.player, this.mySrc, this.powerSrc, monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this ) ); - this.craftSlot.IIcon = -1; + this.addSlotToContainer( this.craftSlot = new SlotPatternTerm( ip.player, this.getActionSource(), this.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this ) ); + this.craftSlot.setIIcon( -1 ); for( int y = 0; y < 3; y++ ) { this.addSlotToContainer( this.outputSlots[y] = new SlotPatternOutputs( output, this, y, 110, -76 + y * 18, 0, 0, 1 ) ); - this.outputSlots[y].renderDisabled = false; - this.outputSlots[y].IIcon = -1; + this.outputSlots[y].setRenderDisabled( false ); + this.outputSlots[y].setIIcon( -1 ); } - this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.invPlayer ) ); - this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this.invPlayer ) ); + this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.getInventoryPlayer() ) ); + this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this.getInventoryPlayer() ) ); this.patternSlotOUT.setStackLimit( 1 ); @@ -121,18 +121,18 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA private void updateOrderOfOutputSlots() { - if( !this.craftingMode ) + if( !this.isCraftingMode() ) { this.craftSlot.xDisplayPosition = -9000; for( int y = 0; y < 3; y++ ) { - this.outputSlots[y].xDisplayPosition = this.outputSlots[y].defX; + this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX(); } } else { - this.craftSlot.xDisplayPosition = this.craftSlot.defX; + this.craftSlot.xDisplayPosition = this.craftSlot.getX(); for( int y = 0; y < 3; y++ ) { @@ -155,7 +155,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA this.getAndUpdateOutput(); } - public ItemStack getAndUpdateOutput() + private ItemStack getAndUpdateOutput() { final InventoryCrafting ic = new InventoryCrafting( this, 3, 3 ); @@ -240,8 +240,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA encodedValue.setTag( "in", tagIn ); encodedValue.setTag( "out", tagOut ); - encodedValue.setBoolean( "crafting", this.craftingMode ); - encodedValue.setBoolean( "substitute", this.substitute ); + encodedValue.setBoolean( "crafting", this.isCraftingMode() ); + encodedValue.setBoolean( "substitute", this.isSubstitute() ); output.setTagCompound( encodedValue ); } @@ -270,7 +270,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA private ItemStack[] getOutputs() { - if( this.craftingMode ) + if( this.isCraftingMode() ) { final ItemStack out = this.getAndUpdateOutput(); @@ -336,11 +336,11 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { if( idx == 1 ) { - return Platform.isServer() ? !this.ct.isCraftingRecipe() : !this.craftingMode; + return Platform.isServer() ? !this.getPatternTerminal().isCraftingRecipe() : !this.isCraftingMode(); } else if( idx == 2 ) { - return Platform.isServer() ? this.ct.isCraftingRecipe() : this.craftingMode; + return Platform.isServer() ? this.getPatternTerminal().isCraftingRecipe() : this.isCraftingMode(); } else { @@ -350,7 +350,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA public void craftOrGetItem( final PacketPatternSlot packetPatternSlot ) { - if( packetPatternSlot.slotItem != null && this.cellInv != null ) + if( packetPatternSlot.slotItem != null && this.getCellInventory() != null ) { final IAEItemStack out = packetPatternSlot.slotItem.copy(); InventoryAdaptor inv = new AdaptorPlayerHand( this.getPlayerInv().player ); @@ -366,7 +366,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA return; } - final IAEItemStack extracted = Platform.poweredExtraction( this.powerSrc, this.cellInv, out, this.mySrc ); + final IAEItemStack extracted = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), out, this.getActionSource() ); final EntityPlayer p = this.getPlayerInv().player; if( extracted != null ) @@ -395,7 +395,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA return; } - final IMEMonitor storage = this.ct.getItemInventory(); + final IMEMonitor storage = this.getPatternTerminal().getItemInventory(); final IItemList all = storage.getStorageList(); final ItemStack is = r.getCraftingResult( ic ); @@ -404,7 +404,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { if( ic.getStackInSlot( x ) != null ) { - final ItemStack pulled = Platform.extractItemsByRecipe( this.powerSrc, this.mySrc, storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) ); + final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) ); real.setInventorySlotContents( x, pulled ); } } @@ -440,7 +440,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA final ItemStack failed = real.getStackInSlot( x ); if( failed != null ) { - this.cellInv.injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.ct ) ); + this.getCellInventory().injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.getPatternTerminal() ) ); } } } @@ -453,13 +453,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA super.detectAndSendChanges(); if( Platform.isServer() ) { - if( this.craftingMode != this.ct.isCraftingRecipe() ) + if( this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe() ) { - this.craftingMode = this.ct.isCraftingRecipe(); + this.setCraftingMode( this.getPatternTerminal().isCraftingRecipe() ); this.updateOrderOfOutputSlots(); } - this.substitute = this.ct.isSubstitution(); + this.substitute = this.patternTerminal.isSubstitution(); } } @@ -519,9 +519,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { if( name.equals( "player" ) ) { - return this.invPlayer; + return this.getInventoryPlayer(); } - return this.ct.getInventoryByName( name ); + return this.getPatternTerminal().getInventoryByName( name ); } @Override @@ -537,4 +537,29 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA this.detectAndSendChanges(); this.getAndUpdateOutput(); } + + public boolean isCraftingMode() + { + return this.craftingMode; + } + + private void setCraftingMode( final boolean craftingMode ) + { + this.craftingMode = craftingMode; + } + + public PartPatternTerminal getPatternTerminal() + { + return this.patternTerminal; + } + + private boolean isSubstitute() + { + return this.substitute; + } + + public void setSubstitute( final boolean substitute ) + { + this.substitute = substitute; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerPriority.java b/src/main/java/appeng/container/implementations/ContainerPriority.java index db2320bbf..683e65f0a 100644 --- a/src/main/java/appeng/container/implementations/ContainerPriority.java +++ b/src/main/java/appeng/container/implementations/ContainerPriority.java @@ -36,10 +36,10 @@ import appeng.util.Platform; public class ContainerPriority extends AEBaseContainer { - final IPriorityHost priHost; + private final IPriorityHost priHost; @SideOnly( Side.CLIENT ) - public GuiTextField textField; + private GuiTextField textField; @GuiSync( 2 ) public long PriorityValue = -1; diff --git a/src/main/java/appeng/container/implementations/ContainerQNB.java b/src/main/java/appeng/container/implementations/ContainerQNB.java index 1ea00e24b..9e1724962 100644 --- a/src/main/java/appeng/container/implementations/ContainerQNB.java +++ b/src/main/java/appeng/container/implementations/ContainerQNB.java @@ -28,14 +28,11 @@ import appeng.tile.qnb.TileQuantumBridge; public class ContainerQNB extends AEBaseContainer { - final TileQuantumBridge quantumBridge; - public ContainerQNB( final InventoryPlayer ip, final TileQuantumBridge quantumBridge ) { super( ip, quantumBridge, null ); - this.quantumBridge = quantumBridge; - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge, 0, 80, 37, this.invPlayer ) ).setStackLimit( 1 ) ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge, 0, 80, 37, this.getInventoryPlayer() ) ).setStackLimit( 1 ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } diff --git a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java index 24bda1ba9..5ec1329e6 100644 --- a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java +++ b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java @@ -41,20 +41,23 @@ import appeng.util.Platform; public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngInventory, IInventory { - final QuartzKnifeObj toolInv; + private final QuartzKnifeObj toolInv; - final AppEngInternalInventory inSlot = new AppEngInternalInventory( this, 1 ); - final SlotRestrictedInput metals; - final QuartzKnifeOutput output; - String myName = ""; + private final AppEngInternalInventory inSlot = new AppEngInternalInventory( this, 1 ); + private final SlotRestrictedInput metals; + private final QuartzKnifeOutput output; + private String myName = ""; public ContainerQuartzKnife( final InventoryPlayer ip, final QuartzKnifeObj te ) { super( ip, null, null ); this.toolInv = te; - this.addSlotToContainer( this.metals = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, this.inSlot, 0, 94, 44, ip ) ); - this.addSlotToContainer( this.output = new QuartzKnifeOutput( this, 0, 134, 44, -1 ) ); + this.metals = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, this.inSlot, 0, 94, 44, ip ); + this.addSlotToContainer( this.metals ); + + this.output = new QuartzKnifeOutput( this, 0, 134, 44, -1 ); + this.addSlotToContainer( this.output ); this.lockPlayerInventorySlot( ip.currentItem ); @@ -81,12 +84,12 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } diff --git a/src/main/java/appeng/container/implementations/ContainerSecurity.java b/src/main/java/appeng/container/implementations/ContainerSecurity.java index ac0c07400..49afd8950 100644 --- a/src/main/java/appeng/container/implementations/ContainerSecurity.java +++ b/src/main/java/appeng/container/implementations/ContainerSecurity.java @@ -42,16 +42,16 @@ import appeng.tile.misc.TileSecurity; public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppEngInventory { - final SlotRestrictedInput configSlot; + private final SlotRestrictedInput configSlot; - final AppEngInternalInventory wirelessEncoder = new AppEngInternalInventory( this, 2 ); + private final AppEngInternalInventory wirelessEncoder = new AppEngInternalInventory( this, 2 ); - final SlotRestrictedInput wirelessIn; - final SlotOutput wirelessOut; + private final SlotRestrictedInput wirelessIn; + private final SlotOutput wirelessOut; - final TileSecurity securityBox; + private final TileSecurity securityBox; @GuiSync( 0 ) - public int security = 0; + public int permissionMode = 0; public ContainerSecurity( final InventoryPlayer ip, final ITerminalHost monitorable ) { @@ -59,7 +59,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE this.securityBox = (TileSecurity) monitorable; - this.addSlotToContainer( this.configSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox.configSlot, 0, 37, -33, ip ) ); + this.addSlotToContainer( this.configSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox.getConfigSlot(), 0, 37, -33, ip ) ); this.addSlotToContainer( this.wirelessIn = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, this.wirelessEncoder, 0, 212, 10, ip ) ); this.addSlotToContainer( this.wirelessOut = new SlotOutput( this.wirelessEncoder, 1, 212, 68, -1 ) ); @@ -98,7 +98,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE { this.verifyPermissions( SecurityPermissions.SECURITY, false ); - this.security = 0; + this.setPermissionMode( 0 ); final ItemStack a = this.configSlot.getStack(); if( a != null && a.getItem() instanceof IBiometricCard ) @@ -107,7 +107,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE for( final SecurityPermissions sp : bc.getPermissions( a ) ) { - this.security |= ( 1 << sp.ordinal() ); + this.setPermissionMode( this.getPermissionMode() | ( 1 << sp.ordinal() ) ); } } @@ -161,7 +161,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE if( networkEncodable != null ) { - networkEncodable.setEncryptionKey( term, String.valueOf( this.securityBox.securityKey ), "" ); + networkEncodable.setEncryptionKey( term, String.valueOf( this.securityBox.getSecurityKey() ), "" ); this.wirelessIn.putStack( null ); this.wirelessOut.putStack( term ); @@ -177,4 +177,14 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE } } } + + public int getPermissionMode() + { + return this.permissionMode; + } + + private void setPermissionMode( final int permissionMode ) + { + this.permissionMode = permissionMode; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerSkyChest.java b/src/main/java/appeng/container/implementations/ContainerSkyChest.java index 846427d0b..48b503090 100644 --- a/src/main/java/appeng/container/implementations/ContainerSkyChest.java +++ b/src/main/java/appeng/container/implementations/ContainerSkyChest.java @@ -31,7 +31,7 @@ import appeng.tile.storage.TileSkyChest; public class ContainerSkyChest extends AEBaseContainer { - final TileSkyChest chest; + private final TileSkyChest chest; public ContainerSkyChest( final InventoryPlayer ip, final TileSkyChest chest ) { diff --git a/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java b/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java index 60c0a7073..17a298237 100644 --- a/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java +++ b/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java @@ -36,7 +36,6 @@ import appeng.util.Platform; public class ContainerSpatialIOPort extends AEBaseContainer { - final TileSpatialIOPort spatialIOPort; @GuiSync( 0 ) public long currentPower; @GuiSync( 1 ) @@ -45,20 +44,19 @@ public class ContainerSpatialIOPort extends AEBaseContainer public long reqPower; @GuiSync( 3 ) public long eff; - IGrid network; - int delay = 40; + private IGrid network; + private int delay = 40; public ContainerSpatialIOPort( final InventoryPlayer ip, final TileSpatialIOPort spatialIOPort ) { super( ip, spatialIOPort, null ); - this.spatialIOPort = spatialIOPort; if( Platform.isServer() ) { this.network = spatialIOPort.getGridNode( AEPartLocation.INTERNAL ).getGrid(); } - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, this.getInventoryPlayer() ) ); this.addSlotToContainer( new SlotOutput( spatialIOPort, 1, 113, 48, SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS.IIcon ) ); this.bindPlayerInventory( ip, 0, 197 - /* height of player inventory */82 ); @@ -80,14 +78,54 @@ public class ContainerSpatialIOPort extends AEBaseContainer final ISpatialCache sc = this.network.getCache( ISpatialCache.class ); if( eg != null ) { - this.currentPower = (long) ( 100.0 * eg.getStoredPower() ); - this.maxPower = (long) ( 100.0 * eg.getMaxStoredPower() ); - this.reqPower = (long) ( 100.0 * sc.requiredPower() ); - this.eff = (long) ( 100.0f * sc.currentEfficiency() ); + this.setCurrentPower( (long) ( 100.0 * eg.getStoredPower() ) ); + this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) ); + this.setRequiredPower( (long) ( 100.0 * sc.requiredPower() ) ); + this.setEfficency( (long) ( 100.0f * sc.currentEfficiency() ) ); } } } super.detectAndSendChanges(); } + + public long getCurrentPower() + { + return this.currentPower; + } + + private void setCurrentPower( final long currentPower ) + { + this.currentPower = currentPower; + } + + public long getMaxPower() + { + return this.maxPower; + } + + private void setMaxPower( final long maxPower ) + { + this.maxPower = maxPower; + } + + public long getRequiredPower() + { + return this.reqPower; + } + + private void setRequiredPower( final long reqPower ) + { + this.reqPower = reqPower; + } + + public long getEfficency() + { + return this.eff; + } + + private void setEfficency( final long eff ) + { + this.eff = eff; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerStorageBus.java b/src/main/java/appeng/container/implementations/ContainerStorageBus.java index 59f722fc2..1c94f75e8 100644 --- a/src/main/java/appeng/container/implementations/ContainerStorageBus.java +++ b/src/main/java/appeng/container/implementations/ContainerStorageBus.java @@ -46,7 +46,7 @@ import appeng.util.iterators.NullIterator; public class ContainerStorageBus extends ContainerUpgradeable { - final PartStorageBus storageBus; + private final PartStorageBus storageBus; @GuiSync( 3 ) public AccessRestriction rwMode = AccessRestriction.READ_WRITE; @@ -72,7 +72,7 @@ public class ContainerStorageBus extends ContainerUpgradeable final int xo = 8; final int yo = 23 + 6; - final IInventory config = this.upgradeable.getInventoryByName( "config" ); + final IInventory config = this.getUpgradeable().getInventoryByName( "config" ); for( int y = 0; y < 7; y++ ) { for( int x = 0; x < 9; x++ ) @@ -88,12 +88,12 @@ public class ContainerStorageBus extends ContainerUpgradeable } } - final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer ) ).setNotDraggable() ); + final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ).setNotDraggable() ); } @Override @@ -115,9 +115,9 @@ public class ContainerStorageBus extends ContainerUpgradeable if( Platform.isServer() ) { - this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE ); - this.rwMode = (AccessRestriction) this.upgradeable.getConfigManager().getSetting( Settings.ACCESS ); - this.storageFilter = (StorageFilter) this.upgradeable.getConfigManager().getSetting( Settings.STORAGE_FILTER ); + this.setFuzzyMode( (FuzzyMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FUZZY_MODE ) ); + this.setReadWriteMode( (AccessRestriction) this.getUpgradeable().getConfigManager().getSetting( Settings.ACCESS ) ); + this.setStorageFilter( (StorageFilter) this.getUpgradeable().getConfigManager().getSetting( Settings.STORAGE_FILTER ) ); } this.standardDetectAndSendChanges(); @@ -126,14 +126,14 @@ public class ContainerStorageBus extends ContainerUpgradeable @Override public boolean isSlotEnabled( final int idx ) { - final int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY ); + final int upgrades = this.getUpgradeable().getInstalledUpgrades( Upgrades.CAPACITY ); return upgrades > idx; } public void clear() { - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); for( int x = 0; x < inv.getSizeInventory(); x++ ) { inv.setInventorySlotContents( x, null ); @@ -143,7 +143,7 @@ public class ContainerStorageBus extends ContainerUpgradeable public void partition() { - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); final IMEInventory cellInv = this.storageBus.getInternalHandler(); @@ -170,4 +170,24 @@ public class ContainerStorageBus extends ContainerUpgradeable this.detectAndSendChanges(); } + + public AccessRestriction getReadWriteMode() + { + return this.rwMode; + } + + private void setReadWriteMode( final AccessRestriction rwMode ) + { + this.rwMode = rwMode; + } + + public StorageFilter getStorageFilter() + { + return this.storageFilter; + } + + private void setStorageFilter( final StorageFilter storageFilter ) + { + this.storageFilter = storageFilter; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java index 58b034829..f6018b3e4 100644 --- a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java +++ b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java @@ -52,7 +52,7 @@ import appeng.util.Platform; public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSlotHost { - final IUpgradeableHost upgradeable; + private final IUpgradeableHost upgradeable; @GuiSync( 0 ) public RedstoneMode rsMode = RedstoneMode.IGNORE; @GuiSync( 1 ) @@ -61,8 +61,8 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl public YesNo cMode = YesNo.NO; @GuiSync( 6 ) public SchedulingMode schedulingMode = SchedulingMode.DEFAULT; - int tbSlot; - NetworkToolViewer tbInventory; + private int tbSlot; + private NetworkToolViewer tbInventory; public ContainerUpgradeable( final InventoryPlayer ip, final IUpgradeableHost te ) { @@ -111,7 +111,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl { for( int u = 0; u < 3; u++ ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory, u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.invPlayer ) ).setPlayerSide() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory, u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.getInventoryPlayer() ) ).setPlayerSide() ); } } } @@ -135,7 +135,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl { this.setupUpgrades(); - final IInventory inv = this.upgradeable.getInventoryByName( "config" ); + final IInventory inv = this.getUpgradeable().getInventoryByName( "config" ); final int y = 40; final int x = 80; this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) ); @@ -156,22 +156,22 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl protected void setupUpgrades() { - final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" ); + final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); if( this.availableUpgrades() > 0 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() ); } if( this.availableUpgrades() > 1 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() ); } if( this.availableUpgrades() > 2 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() ); } if( this.availableUpgrades() > 3 ) { - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() ); + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() ); } } @@ -192,7 +192,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl if( Platform.isServer() ) { - final IConfigManager cm = this.upgradeable.getConfigManager(); + final IConfigManager cm = this.getUpgradeable().getConfigManager(); this.loadSettingsFromHost( cm ); } @@ -215,16 +215,16 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl protected void loadSettingsFromHost( final IConfigManager cm ) { - this.fzMode = (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE ); - this.rsMode = (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED ); - if( this.upgradeable instanceof PartExportBus ) + this.setFuzzyMode( (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE ) ); + this.setRedStoneMode( (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED ) ); + if( this.getUpgradeable() instanceof PartExportBus ) { - this.cMode = (YesNo) cm.getSetting( Settings.CRAFT_ONLY ); - this.schedulingMode = (SchedulingMode) cm.getSetting( Settings.SCHEDULING_MODE ); + this.setCraftingMode( (YesNo) cm.getSetting( Settings.CRAFT_ONLY ) ); + this.setSchedulingMode( (SchedulingMode) cm.getSetting( Settings.SCHEDULING_MODE ) ); } } - public void checkToolbox() + private void checkToolbox() { if( this.hasToolbox() ) { @@ -240,12 +240,12 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } else { - this.isContainerValid = false; + this.setValidContainer( false ); } } } @@ -259,7 +259,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl @Override public boolean isSlotEnabled( final int idx ) { - final int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY ); + final int upgrades = this.getUpgradeable().getInstalledUpgrades( Upgrades.CAPACITY ); if( idx == 1 && upgrades > 0 ) { @@ -272,4 +272,49 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl return false; } + + public FuzzyMode getFuzzyMode() + { + return this.fzMode; + } + + void setFuzzyMode( final FuzzyMode fzMode ) + { + this.fzMode = fzMode; + } + + public YesNo getCraftingMode() + { + return this.cMode; + } + + public void setCraftingMode( final YesNo cMode ) + { + this.cMode = cMode; + } + + public RedstoneMode getRedStoneMode() + { + return this.rsMode; + } + + void setRedStoneMode( final RedstoneMode rsMode ) + { + this.rsMode = rsMode; + } + + public SchedulingMode getSchedulingMode() + { + return this.schedulingMode; + } + + private void setSchedulingMode( final SchedulingMode schedulingMode ) + { + this.schedulingMode = schedulingMode; + } + + IUpgradeableHost getUpgradeable() + { + return this.upgradeable; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java b/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java index 70809c573..5fe67418b 100644 --- a/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java +++ b/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java @@ -32,8 +32,8 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr { private static final int MAX_BURN_TIME = 200; - public final int aePerTick = 5; - final TileVibrationChamber vibrationChamber; + private final int aePerTick = 5; + private final TileVibrationChamber vibrationChamber; @GuiSync( 0 ) public int burnProgress = 0; @GuiSync( 1 ) @@ -44,7 +44,7 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr super( ip, vibrationChamber, null ); this.vibrationChamber = vibrationChamber; - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, this.invPlayer ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, this.getInventoryPlayer() ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } @@ -54,8 +54,8 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr { if( Platform.isServer() ) { - this.burnProgress = (int) ( this.vibrationChamber.maxBurnTime <= 0 ? 0 : 12 * this.vibrationChamber.burnTime / this.vibrationChamber.maxBurnTime ); - this.burnSpeed = this.vibrationChamber.burnSpeed; + this.burnProgress = (int) ( this.vibrationChamber.getMaxBurnTime() <= 0 ? 0 : 12 * this.vibrationChamber.getBurnTime() / this.vibrationChamber.getMaxBurnTime() ); + this.burnSpeed = this.vibrationChamber.getBurnSpeed(); } super.detectAndSendChanges(); @@ -72,4 +72,9 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr { return MAX_BURN_TIME; } + + public int getAePerTick() + { + return this.aePerTick; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerWireless.java b/src/main/java/appeng/container/implementations/ContainerWireless.java index 48e5c04dd..2c853a428 100644 --- a/src/main/java/appeng/container/implementations/ContainerWireless.java +++ b/src/main/java/appeng/container/implementations/ContainerWireless.java @@ -30,8 +30,8 @@ import appeng.tile.networking.TileWireless; public class ContainerWireless extends AEBaseContainer { - final TileWireless wirelessTerminal; - final SlotRestrictedInput boosterSlot; + private final TileWireless wirelessTerminal; + private final SlotRestrictedInput boosterSlot; @GuiSync( 1 ) public long range = 0; @GuiSync( 2 ) @@ -42,7 +42,7 @@ public class ContainerWireless extends AEBaseContainer super( ip, te, null ); this.wirelessTerminal = te; - this.addSlotToContainer( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal, 0, 80, 47, this.invPlayer ) ); + this.addSlotToContainer( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal, 0, 80, 47, this.getInventoryPlayer() ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } @@ -52,9 +52,29 @@ public class ContainerWireless extends AEBaseContainer { final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().stackSize; - this.range = (long) ( 10 * AEConfig.instance.wireless_getMaxRange( boosters ) ); - this.drain = (long) ( 100 * AEConfig.instance.wireless_getPowerDrain( boosters ) ); + this.setRange( (long) ( 10 * AEConfig.instance.wireless_getMaxRange( boosters ) ) ); + this.setDrain( (long) ( 100 * AEConfig.instance.wireless_getPowerDrain( boosters ) ) ); super.detectAndSendChanges(); } + + public long getRange() + { + return this.range; + } + + private void setRange( final long range ) + { + this.range = range; + } + + public long getDrain() + { + return this.drain; + } + + private void setDrain( final long drain ) + { + this.drain = drain; + } } diff --git a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java index 5d6d53a6d..676e93801 100644 --- a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java @@ -29,7 +29,7 @@ import appeng.util.Platform; public class ContainerWirelessTerm extends ContainerMEPortableCell { - final WirelessTerminalGuiObject wirelessTerminalGUIObject; + private final WirelessTerminalGuiObject wirelessTerminalGUIObject; public ContainerWirelessTerm( final InventoryPlayer ip, final WirelessTerminalGuiObject gui ) { @@ -44,16 +44,16 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell if( !this.wirelessTerminalGUIObject.rangeCheck() ) { - if( Platform.isServer() && this.isContainerValid ) + if( Platform.isServer() && this.isValidContainer() ) { this.getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() ); } - this.isContainerValid = false; + this.setValidContainer( false ); } else { - this.powerMultiplier = AEConfig.instance.wireless_getDrainRate( this.wirelessTerminalGUIObject.getRange() ); + this.setPowerMultiplier( AEConfig.instance.wireless_getDrainRate( this.wirelessTerminalGUIObject.getRange() ) ); } } } diff --git a/src/main/java/appeng/container/implementations/CraftingCPURecord.java b/src/main/java/appeng/container/implementations/CraftingCPURecord.java index adcb1a951..94dfc1835 100644 --- a/src/main/java/appeng/container/implementations/CraftingCPURecord.java +++ b/src/main/java/appeng/container/implementations/CraftingCPURecord.java @@ -28,10 +28,10 @@ import appeng.util.ItemSorters; public class CraftingCPURecord implements Comparable { - public final String myName; - final ICraftingCPU cpu; - final long size; - final int processors; + private final String myName; + private final ICraftingCPU cpu; + private final long size; + private final int processors; public CraftingCPURecord( final long size, final int coProcessors, final ICraftingCPU server ) { @@ -44,11 +44,31 @@ public class CraftingCPURecord implements Comparable @Override public int compareTo( @Nonnull final CraftingCPURecord o ) { - final int a = ItemSorters.compareLong( o.processors, this.processors ); + final int a = ItemSorters.compareLong( o.getProcessors(), this.getProcessors() ); if( a != 0 ) { return a; } - return ItemSorters.compareLong( o.size, this.size ); + return ItemSorters.compareLong( o.getSize(), this.getSize() ); + } + + ICraftingCPU getCpu() + { + return this.cpu; + } + + String getName() + { + return this.myName; + } + + int getProcessors() + { + return this.processors; + } + + long getSize() + { + return this.size; } } \ No newline at end of file diff --git a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java index 941bfa5cf..a312185eb 100644 --- a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java +++ b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java @@ -145,16 +145,16 @@ public class AppEngCraftingSlot extends AppEngSlot net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix ); this.onCrafting(stack); net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); - final InventoryCrafting ic = new InventoryCrafting( this.myContainer, 3, 3 ); - + final InventoryCrafting ic = new InventoryCrafting( this.getContainer(), 3, 3 ); + for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ ) ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) ); - + final ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(ic, playerIn.worldObj); - + for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ ) this.craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) ); - + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < aitemstack.length; ++i) diff --git a/src/main/java/appeng/container/slot/AppEngSlot.java b/src/main/java/appeng/container/slot/AppEngSlot.java index dbc100bb4..e0fe4f72b 100644 --- a/src/main/java/appeng/container/slot/AppEngSlot.java +++ b/src/main/java/appeng/container/slot/AppEngSlot.java @@ -30,26 +30,26 @@ import appeng.tile.inventory.AppEngInternalInventory; public class AppEngSlot extends Slot { - public final int defX; - public final int defY; - public boolean isDraggable = true; - public boolean isPlayerSide = false; - public AEBaseContainer myContainer = null; - public int IIcon = -1; - public hasCalculatedValidness isValid; - public boolean isDisplay = false; + private final int defX; + private final int defY; + private boolean isDraggable = true; + private boolean isPlayerSide = false; + private AEBaseContainer myContainer = null; + private int IIcon = -1; + private hasCalculatedValidness isValid; + private boolean isDisplay = false; public AppEngSlot( final IInventory inv, final int idx, final int x, final int y ) { super( inv, idx, x, y ); this.defX = x; this.defY = y; - this.isValid = hasCalculatedValidness.NotAvailable; + this.setIsValid( hasCalculatedValidness.NotAvailable ); } public Slot setNotDraggable() { - this.isDraggable = false; + this.setDraggable( false ); return this; } @@ -92,9 +92,9 @@ public class AppEngSlot extends Slot return null; } - if( this.isDisplay ) + if( this.isDisplay() ) { - this.isDisplay = false; + this.setDisplay( false ); return this.getDisplayStack(); } return super.getStack(); @@ -107,9 +107,9 @@ public class AppEngSlot extends Slot { super.putStack( par1ItemStack ); - if( this.myContainer != null ) + if( this.getContainer() != null ) { - this.myContainer.onSlotChange( this ); + this.getContainer().onSlotChange( this ); } } } @@ -126,7 +126,7 @@ public class AppEngSlot extends Slot super.onSlotChanged(); } - this.isValid = hasCalculatedValidness.NotAvailable; + this.setIsValid( hasCalculatedValidness.NotAvailable ); } @Override @@ -167,7 +167,7 @@ public class AppEngSlot extends Slot public int getIcon() { - return this.IIcon; + return this.getIIcon(); } public boolean isPlayerSide() @@ -180,6 +180,71 @@ public class AppEngSlot extends Slot return this.isEnabled(); } + public int getX() + { + return this.defX; + } + + public int getY() + { + return this.defY; + } + + private int getIIcon() + { + return this.IIcon; + } + + public void setIIcon( final int iIcon ) + { + this.IIcon = iIcon; + } + + private boolean isDisplay() + { + return this.isDisplay; + } + + public void setDisplay( final boolean isDisplay ) + { + this.isDisplay = isDisplay; + } + + public boolean isDraggable() + { + return this.isDraggable; + } + + private void setDraggable( final boolean isDraggable ) + { + this.isDraggable = isDraggable; + } + + void setPlayerSide( final boolean isPlayerSide ) + { + this.isPlayerSide = isPlayerSide; + } + + public hasCalculatedValidness getIsValid() + { + return this.isValid; + } + + public void setIsValid( final hasCalculatedValidness isValid ) + { + this.isValid = isValid; + } + + AEBaseContainer getContainer() + { + return this.myContainer; + } + + public void setContainer( final AEBaseContainer myContainer ) + { + this.myContainer = myContainer; + } + public enum hasCalculatedValidness { NotAvailable, Valid, Invalid diff --git a/src/main/java/appeng/container/slot/OptionalSlotFake.java b/src/main/java/appeng/container/slot/OptionalSlotFake.java index 9bbc8a5d5..d2e5d3a63 100644 --- a/src/main/java/appeng/container/slot/OptionalSlotFake.java +++ b/src/main/java/appeng/container/slot/OptionalSlotFake.java @@ -26,19 +26,17 @@ import net.minecraft.item.ItemStack; public class OptionalSlotFake extends SlotFake { - public final int srcX; - public final int srcY; - final int invSlot; - final int groupNum; - final IOptionalSlotHost host; - public boolean renderDisabled = true; + private final int srcX; + private final int srcY; + private final int groupNum; + private final IOptionalSlotHost host; + private boolean renderDisabled = true; public OptionalSlotFake( final IInventory inv, final IOptionalSlotHost containerBus, final int idx, final int x, final int y, final int offX, final int offY, final int groupNum ) { super( inv, idx, x + offX * 18, y + offY * 18 ); this.srcX = x; this.srcY = y; - this.invSlot = idx; this.groupNum = groupNum; this.host = containerBus; } @@ -69,7 +67,27 @@ public class OptionalSlotFake extends SlotFake } public boolean renderDisabled() + { + return this.isRenderDisabled(); + } + + private boolean isRenderDisabled() { return this.renderDisabled; } + + public void setRenderDisabled( final boolean renderDisabled ) + { + this.renderDisabled = renderDisabled; + } + + public int getSourceX() + { + return this.srcX; + } + + public int getSourceY() + { + return this.srcY; + } } diff --git a/src/main/java/appeng/container/slot/OptionalSlotNormal.java b/src/main/java/appeng/container/slot/OptionalSlotNormal.java index 7edd1dc82..95247c9ef 100644 --- a/src/main/java/appeng/container/slot/OptionalSlotNormal.java +++ b/src/main/java/appeng/container/slot/OptionalSlotNormal.java @@ -25,8 +25,8 @@ import net.minecraft.inventory.IInventory; public class OptionalSlotNormal extends AppEngSlot { - final int groupNum; - final IOptionalSlotHost host; + private final int groupNum; + private final IOptionalSlotHost host; public OptionalSlotNormal( final IInventory inv, final IOptionalSlotHost containerBus, final int slot, final int xPos, final int yPos, final int groupNum ) { diff --git a/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java b/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java index 175b7ed5d..a9c994af9 100644 --- a/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java +++ b/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java @@ -26,8 +26,8 @@ import net.minecraft.inventory.IInventory; public class OptionalSlotRestrictedInput extends SlotRestrictedInput { - final int groupNum; - final IOptionalSlotHost host; + private final int groupNum; + private final IOptionalSlotHost host; public OptionalSlotRestrictedInput( final PlacableItemType valid, final IInventory i, final IOptionalSlotHost host, final int slotIndex, final int x, final int y, final int grpNum, final InventoryPlayer invPlayer ) { diff --git a/src/main/java/appeng/container/slot/SlotCraftingMatrix.java b/src/main/java/appeng/container/slot/SlotCraftingMatrix.java index 923a08742..e87320a52 100644 --- a/src/main/java/appeng/container/slot/SlotCraftingMatrix.java +++ b/src/main/java/appeng/container/slot/SlotCraftingMatrix.java @@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack; public class SlotCraftingMatrix extends AppEngSlot { - final Container c; + private final Container c; public SlotCraftingMatrix( final Container c, final IInventory par1iInventory, final int par2, final int par3, final int par4 ) { diff --git a/src/main/java/appeng/container/slot/SlotCraftingTerm.java b/src/main/java/appeng/container/slot/SlotCraftingTerm.java index f60a3ed98..e467ff834 100644 --- a/src/main/java/appeng/container/slot/SlotCraftingTerm.java +++ b/src/main/java/appeng/container/slot/SlotCraftingTerm.java @@ -49,8 +49,8 @@ import appeng.util.item.AEItemStack; public class SlotCraftingTerm extends AppEngCraftingSlot { - protected final IInventory craftInv; - protected final IInventory pattern; + private final IInventory craftInv; + private final IInventory pattern; private final BaseActionSource mySrc; private final IEnergySource energySrc; @@ -147,19 +147,19 @@ public class SlotCraftingTerm extends AppEngCraftingSlot } } - protected int capCraftingAttempts( final int maxTimesToCraft ) + private int capCraftingAttempts( final int maxTimesToCraft ) { return maxTimesToCraft; } - public ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor inv, final IItemList all ) + private ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor inv, final IItemList all ) { // update crafting matrix... ItemStack is = this.getStack(); if( is != null && Platform.isSameItem( request, is ) ) { - final ItemStack[] set = new ItemStack[this.pattern.getSizeInventory()]; + final ItemStack[] set = new ItemStack[this.getPattern().getSizeInventory()]; // add one of each item to the items on the board... if( Platform.isServer() ) @@ -167,7 +167,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 ); for( int x = 0; x < 9; x++ ) { - ic.setInventorySlotContents( x, this.pattern.getStackInSlot( x ) ); + ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) ); } final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj ); @@ -205,11 +205,11 @@ public class SlotCraftingTerm extends AppEngCraftingSlot if( inv != null ) { - for( int x = 0; x < this.pattern.getSizeInventory(); x++ ) + for( int x = 0; x < this.getPattern().getSizeInventory(); x++ ) { - if( this.pattern.getStackInSlot( x ) != null ) + if( this.getPattern().getStackInSlot( x ) != null ) { - set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.pattern.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) ); + set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) ); ic.setInventorySlotContents( x, set[x] ); } } @@ -232,17 +232,17 @@ public class SlotCraftingTerm extends AppEngCraftingSlot return null; } - public boolean preCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) + private boolean preCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) { return true; } - public void makeItem( final EntityPlayer p, final ItemStack is ) + private void makeItem( final EntityPlayer p, final ItemStack is ) { super.onPickupFromSlot( p, is ); } - public void postCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) + private void postCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) { final List drops = new ArrayList(); @@ -273,4 +273,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot Platform.spawnDrops( p.worldObj, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops ); } } + + IInventory getPattern() + { + return this.pattern; + } } diff --git a/src/main/java/appeng/container/slot/SlotFake.java b/src/main/java/appeng/container/slot/SlotFake.java index ee389b6ae..28807ee0c 100644 --- a/src/main/java/appeng/container/slot/SlotFake.java +++ b/src/main/java/appeng/container/slot/SlotFake.java @@ -27,12 +27,9 @@ import net.minecraft.item.ItemStack; public class SlotFake extends AppEngSlot { - final int invSlot; - public SlotFake( final IInventory inv, final int idx, final int x, final int y ) { super( inv, idx, x, y ); - this.invSlot = idx; } @Override diff --git a/src/main/java/appeng/container/slot/SlotInaccessible.java b/src/main/java/appeng/container/slot/SlotInaccessible.java index 968e31716..b385a9c5b 100644 --- a/src/main/java/appeng/container/slot/SlotInaccessible.java +++ b/src/main/java/appeng/container/slot/SlotInaccessible.java @@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack; public class SlotInaccessible extends AppEngSlot { - ItemStack dspStack = null; + private ItemStack dspStack = null; public SlotInaccessible( final IInventory i, final int slotIdx, final int x, final int y ) { diff --git a/src/main/java/appeng/container/slot/SlotMACPattern.java b/src/main/java/appeng/container/slot/SlotMACPattern.java index e68518283..276f3bc5e 100644 --- a/src/main/java/appeng/container/slot/SlotMACPattern.java +++ b/src/main/java/appeng/container/slot/SlotMACPattern.java @@ -27,7 +27,7 @@ import appeng.container.implementations.ContainerMAC; public class SlotMACPattern extends AppEngSlot { - final ContainerMAC mac; + private final ContainerMAC mac; public SlotMACPattern( final ContainerMAC mac, final IInventory i, final int slotIdx, final int x, final int y ) { diff --git a/src/main/java/appeng/container/slot/SlotOutput.java b/src/main/java/appeng/container/slot/SlotOutput.java index 191291f29..3c6624337 100644 --- a/src/main/java/appeng/container/slot/SlotOutput.java +++ b/src/main/java/appeng/container/slot/SlotOutput.java @@ -29,7 +29,7 @@ public class SlotOutput extends AppEngSlot public SlotOutput( final IInventory a, final int b, final int c, final int d, final int i ) { super( a, b, c, d ); - this.IIcon = i; + this.setIIcon( i ); } @Override diff --git a/src/main/java/appeng/container/slot/SlotPatternTerm.java b/src/main/java/appeng/container/slot/SlotPatternTerm.java index d1823eed7..a866c3093 100644 --- a/src/main/java/appeng/container/slot/SlotPatternTerm.java +++ b/src/main/java/appeng/container/slot/SlotPatternTerm.java @@ -36,8 +36,8 @@ import appeng.helpers.IContainerCraftingPacket; public class SlotPatternTerm extends SlotCraftingTerm { - final int groupNum; - final IOptionalSlotHost host; + private final int groupNum; + private final IOptionalSlotHost host; public SlotPatternTerm( final EntityPlayer player, final BaseActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IInventory cMatrix, final IInventory secondMatrix, final IInventory output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c ) { @@ -49,7 +49,7 @@ public class SlotPatternTerm extends SlotCraftingTerm public AppEngPacket getRequest( final boolean shift ) throws IOException { - return new PacketPatternSlot( this.pattern, AEApi.instance().storage().createItemStack( this.getStack() ), shift ); + return new PacketPatternSlot( this.getPattern(), AEApi.instance().storage().createItemStack( this.getStack() ), shift ); } @Override diff --git a/src/main/java/appeng/container/slot/SlotPlayerHotBar.java b/src/main/java/appeng/container/slot/SlotPlayerHotBar.java index 3ec5c2341..aba5e52cd 100644 --- a/src/main/java/appeng/container/slot/SlotPlayerHotBar.java +++ b/src/main/java/appeng/container/slot/SlotPlayerHotBar.java @@ -28,6 +28,6 @@ public class SlotPlayerHotBar extends AppEngSlot public SlotPlayerHotBar( final IInventory par1iInventory, final int par2, final int par3, final int par4 ) { super( par1iInventory, par2, par3, par4 ); - this.isPlayerSide = true; + this.setPlayerSide( true ); } } diff --git a/src/main/java/appeng/container/slot/SlotPlayerInv.java b/src/main/java/appeng/container/slot/SlotPlayerInv.java index 663fa5c17..a30f3766c 100644 --- a/src/main/java/appeng/container/slot/SlotPlayerInv.java +++ b/src/main/java/appeng/container/slot/SlotPlayerInv.java @@ -31,6 +31,6 @@ public class SlotPlayerInv extends AppEngSlot { super( par1iInventory, par2, par3, par4 ); - this.isPlayerSide = true; + this.setPlayerSide( true ); } } diff --git a/src/main/java/appeng/container/slot/SlotRestrictedInput.java b/src/main/java/appeng/container/slot/SlotRestrictedInput.java index ea0f34572..6a9c8aba9 100644 --- a/src/main/java/appeng/container/slot/SlotRestrictedInput.java +++ b/src/main/java/appeng/container/slot/SlotRestrictedInput.java @@ -53,16 +53,16 @@ import appeng.util.Platform; public class SlotRestrictedInput extends AppEngSlot { - public final PlacableItemType which; + private final PlacableItemType which; private final InventoryPlayer p; - public boolean allowEdit = true; - public int stackLimit = -1; + private boolean allowEdit = true; + private int stackLimit = -1; public SlotRestrictedInput( final PlacableItemType valid, final IInventory i, final int slotIndex, final int x, final int y, final InventoryPlayer p ) { super( i, slotIndex, x, y ); this.which = valid; - this.IIcon = valid.IIcon; + this.setIIcon( valid.IIcon ); this.p = p; } @@ -95,7 +95,7 @@ public class SlotRestrictedInput extends AppEngSlot @Override public boolean isItemValid( final ItemStack i ) { - if( !this.myContainer.isValidForSlot( this, i ) ) + if( !this.getContainer().isValidForSlot( this, i ) ) { return false; } @@ -114,7 +114,7 @@ public class SlotRestrictedInput extends AppEngSlot return false; } - if( !this.allowEdit ) + if( !this.isAllowEdit() ) { return false; } @@ -232,7 +232,7 @@ public class SlotRestrictedInput extends AppEngSlot @Override public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) { - return this.allowEdit; + return this.isAllowEdit(); } @Override @@ -275,6 +275,16 @@ public class SlotRestrictedInput extends AppEngSlot return false; } + private boolean isAllowEdit() + { + return this.allowEdit; + } + + public void setAllowEdit( final boolean allowEdit ) + { + this.allowEdit = allowEdit; + } + public enum PlacableItemType { STORAGE_CELLS( 15 ), ORE( 16 + 15 ), STORAGE_COMPONENT( 3 * 16 + 15 ), diff --git a/src/main/java/appeng/core/AEConfig.java b/src/main/java/appeng/core/AEConfig.java index 3999629b6..79819e959 100644 --- a/src/main/java/appeng/core/AEConfig.java +++ b/src/main/java/appeng/core/AEConfig.java @@ -68,7 +68,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject public float spawnChargedChance = 0.92f; public int quartzOresPerCluster = 4; public int quartzOresClusterAmount = 15; - public int chargedChange = 4; + public final int chargedChange = 4; public int minMeteoriteDistance = 707; public int minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance; public double spatialPowerExponent = 1.35; diff --git a/src/main/java/appeng/core/AELog.java b/src/main/java/appeng/core/AELog.java index 8e73d22b7..c0513d694 100644 --- a/src/main/java/appeng/core/AELog.java +++ b/src/main/java/appeng/core/AELog.java @@ -110,7 +110,7 @@ public final class AELog } } - public static void debug( String format, Object... data ) + public static void debug( final String format, final Object... data ) { if( AEConfig.instance.isFeatureEnabled( AEFeature.DebugLogging ) ) { diff --git a/src/main/java/appeng/core/ApiDefinitions.java b/src/main/java/appeng/core/ApiDefinitions.java index 2a44fc335..d20d53c57 100644 --- a/src/main/java/appeng/core/ApiDefinitions.java +++ b/src/main/java/appeng/core/ApiDefinitions.java @@ -53,12 +53,12 @@ public final class ApiDefinitions implements IDefinitions this.parts = new ApiParts( constructor, partHelper ); } - public FeatureHandlerRegistry getFeatureHandlerRegistry() + FeatureHandlerRegistry getFeatureHandlerRegistry() { return this.handlers; } - public FeatureRegistry getFeatureRegistry() + FeatureRegistry getFeatureRegistry() { return this.features; } diff --git a/src/main/java/appeng/core/AppEng.java b/src/main/java/appeng/core/AppEng.java index bf1066ffb..505c14ec8 100644 --- a/src/main/java/appeng/core/AppEng.java +++ b/src/main/java/appeng/core/AppEng.java @@ -186,9 +186,9 @@ public final class AppEng final Stopwatch start = Stopwatch.createStarted(); AELog.info( "Initialization ( started )" ); - if( exportConfig.isExportingItemNamesEnabled() ) + if( this.exportConfig.isExportingItemNamesEnabled() ) { - final ExportProcess process = new ExportProcess( this.recipeDirectory, exportConfig ); + final ExportProcess process = new ExportProcess( this.recipeDirectory, this.exportConfig ); final Thread exportProcessThread = new Thread( process ); this.startService( "AE2 CSV Export", exportProcessThread ); diff --git a/src/main/java/appeng/core/CreativeTab.java b/src/main/java/appeng/core/CreativeTab.java index c95affe2d..0be0cca59 100644 --- a/src/main/java/appeng/core/CreativeTab.java +++ b/src/main/java/appeng/core/CreativeTab.java @@ -40,7 +40,7 @@ public final class CreativeTab extends CreativeTabs super( "appliedenergistics2" ); } - public static void init() + static void init() { instance = new CreativeTab(); } diff --git a/src/main/java/appeng/core/CreativeTabFacade.java b/src/main/java/appeng/core/CreativeTabFacade.java index 339005116..d7219ef9d 100644 --- a/src/main/java/appeng/core/CreativeTabFacade.java +++ b/src/main/java/appeng/core/CreativeTabFacade.java @@ -39,7 +39,7 @@ public final class CreativeTabFacade extends CreativeTabs super( "appliedenergistics2.facades" ); } - public static void init() + static void init() { instance = new CreativeTabFacade(); } diff --git a/src/main/java/appeng/core/FacadeConfig.java b/src/main/java/appeng/core/FacadeConfig.java index 94eecc4dd..f4a7f19e2 100644 --- a/src/main/java/appeng/core/FacadeConfig.java +++ b/src/main/java/appeng/core/FacadeConfig.java @@ -34,7 +34,7 @@ public class FacadeConfig extends Configuration { public static FacadeConfig instance; - final Pattern replacementPattern; + private final Pattern replacementPattern; public FacadeConfig( final File facadeFile ) { diff --git a/src/main/java/appeng/core/FeatureHandlerRegistry.java b/src/main/java/appeng/core/FeatureHandlerRegistry.java index 2464b3b75..e52cb8ac6 100644 --- a/src/main/java/appeng/core/FeatureHandlerRegistry.java +++ b/src/main/java/appeng/core/FeatureHandlerRegistry.java @@ -34,7 +34,7 @@ public final class FeatureHandlerRegistry this.registry.add( feature ); } - public Set getRegisteredFeatureHandlers() + Set getRegisteredFeatureHandlers() { return this.registry; } diff --git a/src/main/java/appeng/core/FeatureRegistry.java b/src/main/java/appeng/core/FeatureRegistry.java index 4991f1d7a..5405cab82 100644 --- a/src/main/java/appeng/core/FeatureRegistry.java +++ b/src/main/java/appeng/core/FeatureRegistry.java @@ -34,7 +34,7 @@ public final class FeatureRegistry this.registry.add( feature ); } - public Set getRegisteredFeatures() + Set getRegisteredFeatures() { return this.registry; } diff --git a/src/main/java/appeng/core/IMCHandler.java b/src/main/java/appeng/core/IMCHandler.java index 5ea8c6af3..1c4fa5c4e 100644 --- a/src/main/java/appeng/core/IMCHandler.java +++ b/src/main/java/appeng/core/IMCHandler.java @@ -74,7 +74,7 @@ public class IMCHandler * * @param event Event carrying the identifier and message for the handlers */ - public void handleIMCEvent( final FMLInterModComms.IMCEvent event ) + void handleIMCEvent( final FMLInterModComms.IMCEvent event ) { for( final FMLInterModComms.IMCMessage message : event.getMessages() ) { diff --git a/src/main/java/appeng/core/RecipeLoader.java b/src/main/java/appeng/core/RecipeLoader.java index dc0a13b5a..9ef0c0dc0 100644 --- a/src/main/java/appeng/core/RecipeLoader.java +++ b/src/main/java/appeng/core/RecipeLoader.java @@ -92,7 +92,7 @@ public class RecipeLoader implements Runnable FileUtils.cleanDirectory( generatedRecipesDir ); copier.copyTo( ".recipe", generatedRecipesDir ); - copier.copyTo( ".html", recipeDirectory ); + copier.copyTo( ".html", this.recipeDirectory ); // parse recipes prioritising the user scripts by using the generated as template this.handler.parseRecipes( new ConfigLoader( generatedRecipesDir, userRecipesDir ), "index.recipe" ); diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index 5575029f9..5456326ab 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -129,7 +129,7 @@ public final class Registration return this.storageBiome; } - public void preInitialize( final FMLPreInitializationEvent event ) + void preInitialize( final FMLPreInitializationEvent event ) { this.registerSpatial( false ); @@ -315,7 +315,7 @@ public final class Registration } } - public void postInit( final FMLPostInitializationEvent event ) + void postInit( final FMLPostInitializationEvent event ) { this.registerSpatial( true ); diff --git a/src/main/java/appeng/core/api/ApiPart.java b/src/main/java/appeng/core/api/ApiPart.java index 08787bb78..d624a39cf 100644 --- a/src/main/java/appeng/core/api/ApiPart.java +++ b/src/main/java/appeng/core/api/ApiPart.java @@ -146,7 +146,7 @@ public class ApiPart implements IPartHelper return myCLass; } - public Class getClassByDesc( final String addendum, final String fullPath, final String root, final String next ) + private Class getClassByDesc( final String addendum, final String fullPath, final String root, final String next ) { if( this.roots.get( fullPath ) != null ) { @@ -236,7 +236,7 @@ public class ApiPart implements IPartHelper return clazz; } - public ClassNode getReader( final String name ) + private ClassNode getReader( final String name ) { final String path = '/' + name.replace( ".", "/" ) + ".class"; final InputStream is = this.getClass().getResourceAsStream( path ); @@ -349,10 +349,10 @@ public class ApiPart implements IPartHelper return CommonHelper.proxy.getRenderMode(); } - static class DefaultPackageClassNameRemapper extends Remapper + private static class DefaultPackageClassNameRemapper extends Remapper { - public final HashMap inputOutput = new HashMap(); + private final HashMap inputOutput = new HashMap(); @Override public String map( final String typeName ) diff --git a/src/main/java/appeng/core/api/definitions/DefinitionConstructor.java b/src/main/java/appeng/core/api/definitions/DefinitionConstructor.java index e9a7de285..4d8691753 100644 --- a/src/main/java/appeng/core/api/definitions/DefinitionConstructor.java +++ b/src/main/java/appeng/core/api/definitions/DefinitionConstructor.java @@ -47,7 +47,7 @@ public class DefinitionConstructor this.handlers = handlers; } - public final ITileDefinition registerTileDefinition( final IAEFeature feature ) + final ITileDefinition registerTileDefinition( final IAEFeature feature ) { final IBlockDefinition definition = this.registerBlockDefinition( feature ); @@ -59,7 +59,7 @@ public class DefinitionConstructor throw new IllegalStateException( "No tile definition for " + feature ); } - public final IBlockDefinition registerBlockDefinition( final IAEFeature feature ) + final IBlockDefinition registerBlockDefinition( final IAEFeature feature ) { final IItemDefinition definition = this.registerItemDefinition( feature ); @@ -71,7 +71,7 @@ public class DefinitionConstructor throw new IllegalStateException( "No block definition for " + feature ); } - public final IItemDefinition registerItemDefinition( final IAEFeature feature ) + final IItemDefinition registerItemDefinition( final IAEFeature feature ) { final IFeatureHandler handler = feature.handler(); @@ -86,7 +86,7 @@ public class DefinitionConstructor return definition; } - public final AEColoredItemDefinition constructColoredDefinition( final IItemDefinition target, final int offset ) + final AEColoredItemDefinition constructColoredDefinition( final IItemDefinition target, final int offset ) { final ColoredItemDefinition definition = new ColoredItemDefinition(); @@ -103,7 +103,7 @@ public class DefinitionConstructor return definition; } - public final AEColoredItemDefinition constructColoredDefinition( final ItemMultiPart target, final PartType type ) + final AEColoredItemDefinition constructColoredDefinition( final ItemMultiPart target, final PartType type ) { final ColoredItemDefinition definition = new ColoredItemDefinition(); diff --git a/src/main/java/appeng/core/features/BlockStackSrc.java b/src/main/java/appeng/core/features/BlockStackSrc.java index 1f6f18a1b..60f1279fe 100644 --- a/src/main/java/appeng/core/features/BlockStackSrc.java +++ b/src/main/java/appeng/core/features/BlockStackSrc.java @@ -31,8 +31,8 @@ import net.minecraft.item.ItemStack; public class BlockStackSrc implements IStackSrc { - public final Block block; - public final int damage; + private final Block block; + private final int damage; private final boolean enabled; public BlockStackSrc( final Block block, final int damage, final ActivityState state ) diff --git a/src/main/java/appeng/core/features/ColoredItemDefinition.java b/src/main/java/appeng/core/features/ColoredItemDefinition.java index cedde71c4..2b7e0ce50 100644 --- a/src/main/java/appeng/core/features/ColoredItemDefinition.java +++ b/src/main/java/appeng/core/features/ColoredItemDefinition.java @@ -30,7 +30,7 @@ import appeng.api.util.AEColoredItemDefinition; public final class ColoredItemDefinition implements AEColoredItemDefinition { - final ItemStackSrc[] colors = new ItemStackSrc[17]; + private final ItemStackSrc[] colors = new ItemStackSrc[17]; public void add( final AEColor v, final ItemStackSrc is ) { @@ -96,6 +96,6 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition return false; } - return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.damage; + return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.getDamage(); } } diff --git a/src/main/java/appeng/core/features/FeaturedActiveChecker.java b/src/main/java/appeng/core/features/FeaturedActiveChecker.java index 49b5b8857..623af56fa 100644 --- a/src/main/java/appeng/core/features/FeaturedActiveChecker.java +++ b/src/main/java/appeng/core/features/FeaturedActiveChecker.java @@ -33,7 +33,7 @@ public final class FeaturedActiveChecker this.features = features; } - public ActivityState getActivityState() + ActivityState getActivityState() { for( final AEFeature f : this.features ) { diff --git a/src/main/java/appeng/core/features/ItemStackSrc.java b/src/main/java/appeng/core/features/ItemStackSrc.java index ae7ee32a8..c263d40d1 100644 --- a/src/main/java/appeng/core/features/ItemStackSrc.java +++ b/src/main/java/appeng/core/features/ItemStackSrc.java @@ -31,7 +31,7 @@ public class ItemStackSrc implements IStackSrc { private final Item item; - public final int damage; + private final int damage; private final boolean enabled; public ItemStackSrc( final Item item, final int damage, final ActivityState state ) diff --git a/src/main/java/appeng/core/features/MaterialStackSrc.java b/src/main/java/appeng/core/features/MaterialStackSrc.java index 8201f9b7f..d8c90c643 100644 --- a/src/main/java/appeng/core/features/MaterialStackSrc.java +++ b/src/main/java/appeng/core/features/MaterialStackSrc.java @@ -46,13 +46,13 @@ public class MaterialStackSrc implements IStackSrc @Override public Item getItem() { - return this.src.itemInstance; + return this.src.getItemInstance(); } @Override public int getDamage() { - return this.src.damageValue; + return this.src.getDamageValue(); } @Override diff --git a/src/main/java/appeng/core/features/registries/CellRegistry.java b/src/main/java/appeng/core/features/registries/CellRegistry.java index 450487aff..9ca11bfb4 100644 --- a/src/main/java/appeng/core/features/registries/CellRegistry.java +++ b/src/main/java/appeng/core/features/registries/CellRegistry.java @@ -33,7 +33,7 @@ import appeng.api.storage.StorageChannel; public class CellRegistry implements ICellRegistry { - final List handlers; + private final List handlers; public CellRegistry() { diff --git a/src/main/java/appeng/core/features/registries/ExternalStorageRegistry.java b/src/main/java/appeng/core/features/registries/ExternalStorageRegistry.java index 888dedc7b..aed7147e6 100644 --- a/src/main/java/appeng/core/features/registries/ExternalStorageRegistry.java +++ b/src/main/java/appeng/core/features/registries/ExternalStorageRegistry.java @@ -34,8 +34,8 @@ import appeng.core.features.registries.entries.ExternalIInv; public class ExternalStorageRegistry implements IExternalStorageRegistry { - final List Handlers; - final ExternalIInv lastHandler = new ExternalIInv(); + private final List Handlers; + private final ExternalIInv lastHandler = new ExternalIInv(); public ExternalStorageRegistry() { diff --git a/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java b/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java index eb57e2d0c..7b166ea25 100644 --- a/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java +++ b/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java @@ -163,7 +163,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene return null; } - public void log( final String o ) + private void log( final String o ) { AELog.grinder( o ); } diff --git a/src/main/java/appeng/core/features/registries/WirelessRangeResult.java b/src/main/java/appeng/core/features/registries/WirelessRangeResult.java deleted file mode 100644 index baf16b590..000000000 --- a/src/main/java/appeng/core/features/registries/WirelessRangeResult.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.core.features.registries; - - -import net.minecraft.tileentity.TileEntity; - - -public class WirelessRangeResult -{ - - public final float dist; - public final TileEntity te; - - public WirelessRangeResult( final TileEntity t, final float d ) - { - this.dist = d; - this.te = t; - } -} diff --git a/src/main/java/appeng/core/features/registries/WorldGenRegistry.java b/src/main/java/appeng/core/features/registries/WorldGenRegistry.java index e9d187691..9a843ff2d 100644 --- a/src/main/java/appeng/core/features/registries/WorldGenRegistry.java +++ b/src/main/java/appeng/core/features/registries/WorldGenRegistry.java @@ -30,7 +30,7 @@ public final class WorldGenRegistry implements IWorldGen { public static final WorldGenRegistry INSTANCE = new WorldGenRegistry(); - final TypeSet[] types; + private final TypeSet[] types; private WorldGenRegistry() { diff --git a/src/main/java/appeng/core/localization/ButtonToolTips.java b/src/main/java/appeng/core/localization/ButtonToolTips.java index 9384ee8bc..2cdc64a16 100644 --- a/src/main/java/appeng/core/localization/ButtonToolTips.java +++ b/src/main/java/appeng/core/localization/ButtonToolTips.java @@ -65,7 +65,7 @@ public enum ButtonToolTips SchedulingMode, SchedulingModeDefault, SchedulingModeRoundRobin, SchedulingModeRandom; - final String root; + private final String root; ButtonToolTips() { diff --git a/src/main/java/appeng/core/localization/GuiText.java b/src/main/java/appeng/core/localization/GuiText.java index fd7d0ce58..386c05c15 100644 --- a/src/main/java/appeng/core/localization/GuiText.java +++ b/src/main/java/appeng/core/localization/GuiText.java @@ -94,7 +94,7 @@ public enum GuiText // Used in a ME Interface when no appropriate TileEntity was detected near it Nothing; - final String root; + private final String root; GuiText() { diff --git a/src/main/java/appeng/core/localization/WailaText.java b/src/main/java/appeng/core/localization/WailaText.java index b41cbcb03..3c940c4a8 100644 --- a/src/main/java/appeng/core/localization/WailaText.java +++ b/src/main/java/appeng/core/localization/WailaText.java @@ -32,7 +32,7 @@ public enum WailaText Contains, Channels; - final String root; + private final String root; WailaText() { diff --git a/src/main/java/appeng/core/settings/TickRates.java b/src/main/java/appeng/core/settings/TickRates.java index 35b2930ed..bc440898e 100644 --- a/src/main/java/appeng/core/settings/TickRates.java +++ b/src/main/java/appeng/core/settings/TickRates.java @@ -51,20 +51,40 @@ public enum TickRates PressureTunnel( 1, 120 ); - public int min; - public int max; + private int min; + private int max; TickRates( final int min, final int max ) { - this.min = min; - this.max = max; + this.setMin( min ); + this.setMax( max ); } public void Load( final AEConfig config ) { config.addCustomCategoryComment( "TickRates", " Min / Max Tickrates for dynamic ticking, most of these components also use sleeping, to prevent constant ticking, adjust with care, non standard rates are not supported or tested." ); - this.min = config.get( "TickRates", this.name() + ".min", this.min ).getInt( this.min ); - this.max = config.get( "TickRates", this.name() + ".max", this.max ).getInt( this.max ); + this.setMin( config.get( "TickRates", this.name() + ".min", this.getMin() ).getInt( this.getMin() ) ); + this.setMax( config.get( "TickRates", this.name() + ".max", this.getMax() ).getInt( this.getMax() ) ); + } + + public int getMax() + { + return this.max; + } + + public void setMax( final int max ) + { + this.max = max; + } + + public int getMin() + { + return this.min; + } + + public void setMin( final int min ) + { + this.min = min; } } diff --git a/src/main/java/appeng/core/stats/AchievementCraftingHandler.java b/src/main/java/appeng/core/stats/AchievementCraftingHandler.java index 2e235ea92..e136dc201 100644 --- a/src/main/java/appeng/core/stats/AchievementCraftingHandler.java +++ b/src/main/java/appeng/core/stats/AchievementCraftingHandler.java @@ -50,17 +50,17 @@ public class AchievementCraftingHandler for( final Achievements achievement : Achievements.values() ) { - switch( achievement.type ) + switch( achievement.getType() ) { case Craft: - if( Platform.isSameItemPrecise( achievement.stack, event.crafting ) ) + if( Platform.isSameItemPrecise( achievement.getStack(), event.crafting ) ) { achievement.addToPlayer( event.player ); return; } break; case CraftItem: - if( achievement.stack != null && achievement.stack.getItem().getClass() == event.crafting.getItem().getClass() ) + if( achievement.getStack() != null && achievement.getStack().getItem().getClass() == event.crafting.getItem().getClass() ) { achievement.addToPlayer( event.player ); return; diff --git a/src/main/java/appeng/core/stats/AchievementHierarchy.java b/src/main/java/appeng/core/stats/AchievementHierarchy.java index 3c07f6845..cb8df6804 100644 --- a/src/main/java/appeng/core/stats/AchievementHierarchy.java +++ b/src/main/java/appeng/core/stats/AchievementHierarchy.java @@ -30,7 +30,7 @@ public class AchievementHierarchy /** * Setup hierarchy through assigning parents. */ - public void registerAchievementHierarchy() + void registerAchievementHierarchy() { Achievements.Presses.setParent( Achievements.Compass ); diff --git a/src/main/java/appeng/core/stats/AchievementPickupHandler.java b/src/main/java/appeng/core/stats/AchievementPickupHandler.java index 1447aed0a..14e0a9172 100644 --- a/src/main/java/appeng/core/stats/AchievementPickupHandler.java +++ b/src/main/java/appeng/core/stats/AchievementPickupHandler.java @@ -53,7 +53,7 @@ public class AchievementPickupHandler for( final Achievements achievement : Achievements.values() ) { - if( achievement.type == AchievementType.Pickup && Platform.isSameItemPrecise( achievement.stack, is ) ) + if( achievement.getType() == AchievementType.Pickup && Platform.isSameItemPrecise( achievement.getStack(), is ) ) { achievement.addToPlayer( event.player ); return; diff --git a/src/main/java/appeng/core/stats/Achievements.java b/src/main/java/appeng/core/stats/Achievements.java index 51a0ab2ca..ee8985622 100644 --- a/src/main/java/appeng/core/stats/Achievements.java +++ b/src/main/java/appeng/core/stats/Achievements.java @@ -105,8 +105,8 @@ public enum Achievements // done QNB( 10, 2, AEApi.instance().definitions().blocks().quantumLink(), AchievementType.Craft ); - public final ItemStack stack; - public final AchievementType type; + private final ItemStack stack; + private final AchievementType type; private final int x; private final int y; @@ -137,16 +137,16 @@ public enum Achievements this.y = y; } - public void setParent( final Achievements parent ) + void setParent( final Achievements parent ) { this.parent = parent.getAchievement(); } public Achievement getAchievement() { - if( this.stat == null && this.stack != null ) + if( this.stat == null && this.getStack() != null ) { - this.stat = new Achievement( "achievement.ae2." + this.name(), "ae2." + this.name(), this.x, this.y, this.stack, this.parent ); + this.stat = new Achievement( "achievement.ae2." + this.name(), "ae2." + this.name(), this.x, this.y, this.getStack(), this.parent ); this.stat.registerStat(); } @@ -158,4 +158,14 @@ public enum Achievements player.addStat( this.getAchievement(), 1 ); } + AchievementType getType() + { + return this.type; + } + + ItemStack getStack() + { + return this.stack; + } + } diff --git a/src/main/java/appeng/core/stats/PlayerDifferentiator.java b/src/main/java/appeng/core/stats/PlayerDifferentiator.java index d4efda36d..8e81ba1e4 100644 --- a/src/main/java/appeng/core/stats/PlayerDifferentiator.java +++ b/src/main/java/appeng/core/stats/PlayerDifferentiator.java @@ -42,7 +42,7 @@ public class PlayerDifferentiator * * @return true if {@param player} is not a real player */ - public boolean isNoPlayer( final EntityPlayer player ) + boolean isNoPlayer( final EntityPlayer player ) { return player == null || player.isDead || player instanceof FakePlayer; } diff --git a/src/main/java/appeng/core/stats/Stats.java b/src/main/java/appeng/core/stats/Stats.java index 1a7144e7d..a3fd1546d 100644 --- a/src/main/java/appeng/core/stats/Stats.java +++ b/src/main/java/appeng/core/stats/Stats.java @@ -47,7 +47,7 @@ public enum Stats player.addStat( this.getStat(), howMany ); } - public StatBasic getStat() + StatBasic getStat() { if( this.stat == null ) { diff --git a/src/main/java/appeng/core/sync/AppEngPacket.java b/src/main/java/appeng/core/sync/AppEngPacket.java index 7af2ef9a8..b684237f5 100644 --- a/src/main/java/appeng/core/sync/AppEngPacket.java +++ b/src/main/java/appeng/core/sync/AppEngPacket.java @@ -38,8 +38,9 @@ import appeng.core.sync.network.NetworkHandler; public abstract class AppEngPacket implements Packet { - AppEngPacketHandlerBase.PacketTypes id; + private AppEngPacketHandlerBase.PacketTypes id; private PacketBuffer p; + private PacketCallState caller; public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) { @@ -59,7 +60,7 @@ public abstract class AppEngPacket implements Packet protected void configureWrite( final ByteBuf data ) { data.capacity( data.readableBytes() ); - this.p = new PacketBuffer(data); + this.p = new PacketBuffer( data ); } public FMLProxyPacket getProxy() @@ -78,28 +79,28 @@ public abstract class AppEngPacket implements Packet return pp; } - - @Override - public void readPacketData( final PacketBuffer buf) throws IOException - { - throw new RuntimeException( "Not Implemented" ); - } @Override - public void writePacketData( final PacketBuffer buf) throws IOException - { - throw new RuntimeException( "Not Implemented" ); - } + public void readPacketData( final PacketBuffer buf ) throws IOException + { + throw new RuntimeException( "Not Implemented" ); + } - PacketCallState caller; - - public void setCallParam( final PacketCallState call ){ - this.caller = call;} - @Override - public void processPacket( final INetHandler handler) - { + public void writePacketData( final PacketBuffer buf ) throws IOException + { + throw new RuntimeException( "Not Implemented" ); + } + + public void setCallParam( final PacketCallState call ) + { + this.caller = call; + } + + @Override + public void processPacket( final INetHandler handler ) + { this.caller.call( this ); - } + } } diff --git a/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java b/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java index de47487e8..80024e268 100644 --- a/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java +++ b/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java @@ -140,7 +140,7 @@ public class AppEngPacketHandlerBase return ( values() )[id]; } - public static PacketTypes getID( final Class c ) + static PacketTypes getID( final Class c ) { return REVERSE_LOOKUP.get( c ); } diff --git a/src/main/java/appeng/core/sync/GuiBridge.java b/src/main/java/appeng/core/sync/GuiBridge.java index 3465804d5..7dc14a5dd 100644 --- a/src/main/java/appeng/core/sync/GuiBridge.java +++ b/src/main/java/appeng/core/sync/GuiBridge.java @@ -323,12 +323,12 @@ public enum GuiBridge implements IGuiHandler if( newContainer instanceof AEBaseContainer ) { final AEBaseContainer bc = (AEBaseContainer) newContainer; - bc.openContext = new ContainerOpenContext( myItem ); - bc.openContext.w = w; - bc.openContext.x = x; - bc.openContext.y = y; - bc.openContext.z = z; - bc.openContext.side = side; + bc.setOpenContext( new ContainerOpenContext( myItem ) ); + bc.getOpenContext().setWorld( w ); + bc.getOpenContext().setX( x ); + bc.getOpenContext().setY( y ); + bc.getOpenContext().setZ( z ); + bc.getOpenContext().setSide( side ); } return newContainer; diff --git a/src/main/java/appeng/core/sync/GuiHostType.java b/src/main/java/appeng/core/sync/GuiHostType.java index 6127a585c..ac7800285 100644 --- a/src/main/java/appeng/core/sync/GuiHostType.java +++ b/src/main/java/appeng/core/sync/GuiHostType.java @@ -28,7 +28,7 @@ public enum GuiHostType return this != WORLD; } - public boolean isTile() + boolean isTile() { return this != ITEM; } diff --git a/src/main/java/appeng/core/sync/network/NetworkHandler.java b/src/main/java/appeng/core/sync/network/NetworkHandler.java index dc676b790..1a31fbd87 100644 --- a/src/main/java/appeng/core/sync/network/NetworkHandler.java +++ b/src/main/java/appeng/core/sync/network/NetworkHandler.java @@ -38,11 +38,11 @@ public class NetworkHandler { public static NetworkHandler instance; - final FMLEventChannel ec; - final String myChannelName; + private final FMLEventChannel ec; + private final String myChannelName; - final IPacketHandler clientHandler; - final IPacketHandler serveHandler; + private final IPacketHandler clientHandler; + private final IPacketHandler serveHandler; public NetworkHandler( final String channelName ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java b/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java index b8d568ad2..c9410e3ef 100644 --- a/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java +++ b/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java @@ -39,9 +39,9 @@ import appeng.util.item.AEItemStack; public class PacketAssemblerAnimation extends AppEngPacket { - public final int x; - public final int y; - public final int z; + private final int x; + private final int y; + private final int z; public final byte rate; public final IAEItemStack is; diff --git a/src/main/java/appeng/core/sync/packets/PacketClick.java b/src/main/java/appeng/core/sync/packets/PacketClick.java index d67585b2a..fc35edf02 100644 --- a/src/main/java/appeng/core/sync/packets/PacketClick.java +++ b/src/main/java/appeng/core/sync/packets/PacketClick.java @@ -39,13 +39,13 @@ import appeng.items.tools.powered.ToolColorApplicator; public class PacketClick extends AppEngPacket { - final int x; - final int y; - final int z; - final int side; - final float hitX; - final float hitY; - final float hitZ; + private final int x; + private final int y; + private final int z; + private final int side; + private final float hitX; + private final float hitY; + private final float hitZ; // automatic. public PacketClick( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java b/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java index 4f8ba563e..4635351a6 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java @@ -34,12 +34,12 @@ import appeng.services.compass.ICompassCallback; public class PacketCompassRequest extends AppEngPacket implements ICompassCallback { - public final long attunement; - public final int cx; - public final int cz; - public final int cdy; + final long attunement; + final int cx; + final int cz; + final int cdy; - EntityPlayer talkBackTo; + private EntityPlayer talkBackTo; // automatic. public PacketCompassRequest( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java b/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java index 20ca01476..d23cc183f 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java @@ -31,12 +31,12 @@ import appeng.hooks.CompassResult; public class PacketCompassResponse extends AppEngPacket { - public final long attunement; - public final int cx; - public final int cz; - public final int cdy; + private final long attunement; + private final int cx; + private final int cz; + private final int cdy; - public CompassResult cr; + private CompassResult cr; // automatic. public PacketCompassResponse( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java b/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java index e7aa39291..73359e033 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java @@ -46,12 +46,10 @@ public class PacketCompressedNBT extends AppEngPacket { // input. - final NBTTagCompound in; + private final NBTTagCompound in; // output... private final ByteBuf data; private final GZIPOutputStream compressFrame; - int writtenBytes = 0; - boolean empty = true; // automatic. public PacketCompressedNBT( final ByteBuf stream ) throws IOException diff --git a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java index f14de6ed3..c630a484a 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java +++ b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java @@ -45,8 +45,8 @@ import appeng.util.Platform; public class PacketCraftRequest extends AppEngPacket { - public final long amount; - public final boolean heldShift; + private final long amount; + private final boolean heldShift; // automatic. public PacketCraftRequest( final ByteBuf stream ) @@ -86,30 +86,30 @@ public class PacketCraftRequest extends AppEngPacket } final IGrid g = gn.getGrid(); - if( g == null || cca.whatToMake == null ) + if( g == null || cca.getItemToCraft() == null ) { return; } - cca.whatToMake.setStackSize( this.amount ); + cca.getItemToCraft().setStackSize( this.amount ); Future futureJob = null; try { final ICraftingGrid cg = g.getCache( ICraftingGrid.class ); - futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.whatToMake, null ); + futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.getItemToCraft(), null ); - final ContainerOpenContext context = cca.openContext; + final ContainerOpenContext context = cca.getOpenContext(); if( context != null ) { final TileEntity te = context.getTile(); - Platform.openGUI( player, te, cca.openContext.side, GuiBridge.GUI_CRAFTING_CONFIRM ); + Platform.openGUI( player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM ); if( player.openContainer instanceof ContainerCraftConfirm ) { final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer; - ccc.autoStart = this.heldShift; - ccc.job = futureJob; + ccc.setAutoStart( this.heldShift ); + ccc.setJob( futureJob ); cca.detectAndSendChanges(); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java b/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java index 416eca1d0..df0ab2055 100644 --- a/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java +++ b/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java @@ -43,10 +43,10 @@ import appeng.util.item.AEItemStack; public class PacketInventoryAction extends AppEngPacket { - public final InventoryAction action; - public final int slot; - public final long id; - public final IAEItemStack slotItem; + private final InventoryAction action; + private final int slot; + private final long id; + private final IAEItemStack slotItem; // automatic. public PacketInventoryAction( final ByteBuf stream ) throws IOException @@ -127,11 +127,11 @@ public class PacketInventoryAction extends AppEngPacket final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer; if( this.action == InventoryAction.AUTO_CRAFT ) { - final ContainerOpenContext context = baseContainer.openContext; + final ContainerOpenContext context = baseContainer.getOpenContext(); if( context != null ) { final TileEntity te = context.getTile(); - Platform.openGUI( sender, te, baseContainer.openContext.side, GuiBridge.GUI_CRAFTING_AMOUNT ); + Platform.openGUI( sender, te, baseContainer.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_AMOUNT ); if( sender.openContainer instanceof ContainerCraftAmount ) { @@ -139,8 +139,8 @@ public class PacketInventoryAction extends AppEngPacket if( baseContainer.getTargetStack() != null ) { - cca.craftingItem.putStack( baseContainer.getTargetStack().getItemStack() ); - cca.whatToMake = baseContainer.getTargetStack(); + cca.getCraftingItem().putStack( baseContainer.getTargetStack().getItemStack() ); + cca.setItemToCraft( baseContainer.getTargetStack() ); } cca.detectAndSendChanges(); diff --git a/src/main/java/appeng/core/sync/packets/PacketLightning.java b/src/main/java/appeng/core/sync/packets/PacketLightning.java index 44d3d50e8..ea34e7698 100644 --- a/src/main/java/appeng/core/sync/packets/PacketLightning.java +++ b/src/main/java/appeng/core/sync/packets/PacketLightning.java @@ -36,9 +36,9 @@ import appeng.util.Platform; public class PacketLightning extends AppEngPacket { - final double x; - final double y; - final double z; + private final double x; + private final double y; + private final double z; // automatic. public PacketLightning( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java index d332d3280..a1c48ac50 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java +++ b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java @@ -36,13 +36,13 @@ import appeng.core.sync.network.INetworkInfo; public class PacketMatterCannon extends AppEngPacket { - final double x; - final double y; - final double z; - final double dx; - final double dy; - final double dz; - final byte len; + private final double x; + private final double y; + private final double z; + private final double dx; + private final double dy; + private final double dz; + private final byte len; // automatic. public PacketMatterCannon( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java b/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java index 24ba9170c..eb4349220 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java +++ b/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java @@ -34,9 +34,9 @@ import appeng.core.sync.network.INetworkInfo; public class PacketMockExplosion extends AppEngPacket { - public final double x; - public final double y; - public final double z; + private final double x; + private final double y; + private final double z; // automatic. public PacketMockExplosion( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketNEIRecipe.java b/src/main/java/appeng/core/sync/packets/PacketNEIRecipe.java index 11b6c3fca..bd8c594a1 100644 --- a/src/main/java/appeng/core/sync/packets/PacketNEIRecipe.java +++ b/src/main/java/appeng/core/sync/packets/PacketNEIRecipe.java @@ -64,7 +64,7 @@ import appeng.util.prioitylist.IPartitionList; public class PacketNEIRecipe extends AppEngPacket { - ItemStack[][] recipe; + private ItemStack[][] recipe; // automatic. public PacketNEIRecipe( final ByteBuf stream ) throws IOException @@ -171,7 +171,7 @@ public class PacketNEIRecipe extends AppEngPacket final IAEItemStack in = AEItemStack.create( currentItem ); if( in != null ) { - final IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in, cct.getSource() ); + final IAEItemStack out = realForFake == Actionable.SIMULATE ? null : Platform.poweredInsert( energy, storage, in, cct.getActionSource() ); if( out != null ) { craftMatrix.setInventorySlotContents( x, out.getItemStack() ); @@ -190,7 +190,7 @@ public class PacketNEIRecipe extends AppEngPacket if( patternItem != null && currentItem == null ) { // Grab from network by recipe - ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter ); + ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getActionSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter ); // If that doesn't get it, grab exact items from network (?) // TODO see if this code is necessary @@ -204,7 +204,7 @@ public class PacketNEIRecipe extends AppEngPacket if( filter == null || filter.isListed( request ) ) { request.setStackSize( 1 ); - final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getSource() ); + final IAEItemStack out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() ); if( out != null ) { whichItem = out.getItemStack(); diff --git a/src/main/java/appeng/core/sync/packets/PacketNewStorageDimension.java b/src/main/java/appeng/core/sync/packets/PacketNewStorageDimension.java index 156cfdc05..083af8cf3 100644 --- a/src/main/java/appeng/core/sync/packets/PacketNewStorageDimension.java +++ b/src/main/java/appeng/core/sync/packets/PacketNewStorageDimension.java @@ -33,7 +33,7 @@ import appeng.core.sync.network.INetworkInfo; public class PacketNewStorageDimension extends AppEngPacket { - final int newDim; + private final int newDim; // automatic. public PacketNewStorageDimension( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java b/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java index 655007f24..7a2aac052 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java +++ b/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java @@ -34,11 +34,11 @@ import appeng.parts.PartPlacement; public class PacketPartPlacement extends AppEngPacket { - int x; - int y; - int z; - int face; - float eyeHeight; + private int x; + private int y; + private int z; + private int face; + private float eyeHeight; // automatic. public PacketPartPlacement( final ByteBuf stream ) @@ -70,8 +70,8 @@ public class PacketPartPlacement extends AppEngPacket { final EntityPlayerMP sender = (EntityPlayerMP) player; CommonHelper.proxy.updateRenderMode( sender ); - PartPlacement.eyeHeight = this.eyeHeight; - PartPlacement.place( sender.getHeldItem(), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[ this.face ], sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 ); + PartPlacement.setEyeHeight( this.eyeHeight ); + PartPlacement.place( sender.getHeldItem(), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, sender.worldObj, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 ); CommonHelper.proxy.updateRenderMode( null ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketPartialItem.java b/src/main/java/appeng/core/sync/packets/PacketPartialItem.java index 7c7298e2b..caa7ca4de 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPartialItem.java +++ b/src/main/java/appeng/core/sync/packets/PacketPartialItem.java @@ -30,8 +30,8 @@ import appeng.core.sync.network.INetworkInfo; public class PacketPartialItem extends AppEngPacket { - final short pageNum; - final byte[] data; + private final short pageNum; + private final byte[] data; // automatic. public PacketPartialItem( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java b/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java index 18491f095..9c06a7dbe 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java +++ b/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java @@ -58,7 +58,7 @@ public class PacketPatternSlot extends AppEngPacket } } - public IAEItemStack readItem( final ByteBuf stream ) throws IOException + private IAEItemStack readItem( final ByteBuf stream ) throws IOException { final boolean hasItem = stream.readBoolean(); diff --git a/src/main/java/appeng/core/sync/packets/PacketProgressBar.java b/src/main/java/appeng/core/sync/packets/PacketProgressBar.java index 3f35a9767..eeb1ca7ea 100644 --- a/src/main/java/appeng/core/sync/packets/PacketProgressBar.java +++ b/src/main/java/appeng/core/sync/packets/PacketProgressBar.java @@ -31,8 +31,8 @@ import appeng.core.sync.network.INetworkInfo; public class PacketProgressBar extends AppEngPacket { - final short id; - final long value; + private final short id; + private final long value; // automatic. public PacketProgressBar( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java b/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java index 448cd7094..77ef390a3 100644 --- a/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java +++ b/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java @@ -30,8 +30,8 @@ import appeng.core.sync.network.INetworkInfo; public class PacketSwapSlots extends AppEngPacket { - final int slotA; - final int slotB; + private final int slotA; + private final int slotB; // automatic. public PacketSwapSlots( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java b/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java index fdb5a0395..d5926cf1e 100644 --- a/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java +++ b/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java @@ -36,7 +36,7 @@ import appeng.util.Platform; public class PacketSwitchGuis extends AppEngPacket { - final GuiBridge newGui; + private final GuiBridge newGui; // automatic. public PacketSwitchGuis( final ByteBuf stream ) @@ -51,7 +51,7 @@ public class PacketSwitchGuis extends AppEngPacket if( Platform.isClient() ) { - AEBaseGui.switchingGuis = true; + AEBaseGui.setSwitchingGuis( true ); } final ByteBuf data = Unpooled.buffer(); @@ -69,11 +69,11 @@ public class PacketSwitchGuis extends AppEngPacket if( c instanceof AEBaseContainer ) { final AEBaseContainer bc = (AEBaseContainer) c; - final ContainerOpenContext context = bc.openContext; + final ContainerOpenContext context = bc.getOpenContext(); if( context != null ) { final TileEntity te = context.getTile(); - Platform.openGUI( player, te, context.side, this.newGui ); + Platform.openGUI( player, te, context.getSide(), this.newGui ); } } } @@ -81,6 +81,6 @@ public class PacketSwitchGuis extends AppEngPacket @Override public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) { - AEBaseGui.switchingGuis = true; + AEBaseGui.setSwitchingGuis( true ); } } diff --git a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java index b8b90bac4..7350d9115 100644 --- a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java +++ b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java @@ -43,11 +43,11 @@ import appeng.util.Platform; public class PacketTransitionEffect extends AppEngPacket { - public final boolean mode; - final double x; - final double y; - final double z; - final AEPartLocation d; + private final boolean mode; + private final double x; + private final double y; + private final double z; + private final AEPartLocation d; // automatic. public PacketTransitionEffect( final ByteBuf stream ) diff --git a/src/main/java/appeng/core/sync/packets/PacketValueConfig.java b/src/main/java/appeng/core/sync/packets/PacketValueConfig.java index ed0ff5dd2..88a681099 100644 --- a/src/main/java/appeng/core/sync/packets/PacketValueConfig.java +++ b/src/main/java/appeng/core/sync/packets/PacketValueConfig.java @@ -147,7 +147,7 @@ public class PacketValueConfig extends AppEngPacket final ContainerPatternTerm cpt = (ContainerPatternTerm) c; if( this.Name.equals( "PatternTerminal.CraftMode" ) ) { - cpt.ct.setCraftingRecipe( this.Value.equals( "1" ) ); + cpt.getPatternTerminal().setCraftingRecipe( this.Value.equals( "1" ) ); } else if( this.Name.equals( "PatternTerminal.Encode" ) ) { @@ -159,7 +159,7 @@ public class PacketValueConfig extends AppEngPacket } else if( this.Name.equals( "PatternTerminal.Substitute" ) ) { - cpt.ct.setSubstitution( this.Value.equals( "1" ) ); + cpt.getPatternTerminal().setSubstitution( this.Value.equals( "1" ) ); } } else if( this.Name.startsWith( "StorageBus." ) && c instanceof ContainerStorageBus ) @@ -184,7 +184,7 @@ public class PacketValueConfig extends AppEngPacket { if( this.Value.equals( "CopyMode" ) ) { - ccw.nextCopyMode(); + ccw.nextWorkBenchCopyMode(); } else if( this.Value.equals( "Partition" ) ) { @@ -239,7 +239,7 @@ public class PacketValueConfig extends AppEngPacket if( this.Name.equals( "CustomName" ) && c instanceof AEBaseContainer ) { - ( (AEBaseContainer) c ).customName = this.Value; + ( (AEBaseContainer) c ).setCustomName( this.Value ); } else if( this.Name.startsWith( "SyncDat." ) ) { diff --git a/src/main/java/appeng/core/worlddata/StorageData.java b/src/main/java/appeng/core/worlddata/StorageData.java index e13be38c2..87867af1b 100644 --- a/src/main/java/appeng/core/worlddata/StorageData.java +++ b/src/main/java/appeng/core/worlddata/StorageData.java @@ -80,12 +80,12 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn final String id = String.valueOf( storageID ); final String data = this.config.get( "gridstorage", id, "" ).getString(); final GridStorage thisStorage = new GridStorage( data, storageID, gss ); - gss.gridStorage = new WeakReference( thisStorage ); + gss.setGridStorage( new WeakReference( thisStorage ) ); this.loadedStorage.put( gss, new WeakReference( gss ) ); return thisStorage; } - return result.get().gridStorage.get(); + return result.get().getGridStorage().get(); } /** @@ -98,7 +98,7 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn final long storageID = this.nextGridStorage(); final GridStorageSearch gss = new GridStorageSearch( storageID ); final GridStorage newStorage = new GridStorage( storageID, gss ); - gss.gridStorage = new WeakReference( newStorage ); + gss.setGridStorage( new WeakReference( newStorage ) ); this.loadedStorage.put( gss, new WeakReference( gss ) ); return newStorage; @@ -152,7 +152,7 @@ final class StorageData implements IWorldGridStorageData, IOnWorldStartable, IOn // populate new data for( final GridStorageSearch gs : this.loadedStorage.keySet() ) { - final GridStorage thisStorage = gs.gridStorage.get(); + final GridStorage thisStorage = gs.getGridStorage().get(); if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() ) { final String value = thisStorage.getValue(); diff --git a/src/main/java/appeng/crafting/CraftBranchFailure.java b/src/main/java/appeng/crafting/CraftBranchFailure.java index c8da305e3..c04916783 100644 --- a/src/main/java/appeng/crafting/CraftBranchFailure.java +++ b/src/main/java/appeng/crafting/CraftBranchFailure.java @@ -27,7 +27,7 @@ public class CraftBranchFailure extends Exception private static final long serialVersionUID = 654603652836724823L; - final IAEItemStack missing; + private final IAEItemStack missing; public CraftBranchFailure( final IAEItemStack what, final long howMany ) { diff --git a/src/main/java/appeng/crafting/CraftingCalculationFailure.java b/src/main/java/appeng/crafting/CraftingCalculationFailure.java index d34ff80f9..bfaa7ece2 100644 --- a/src/main/java/appeng/crafting/CraftingCalculationFailure.java +++ b/src/main/java/appeng/crafting/CraftingCalculationFailure.java @@ -27,7 +27,7 @@ public class CraftingCalculationFailure extends RuntimeException private static final long serialVersionUID = 654603652836724823L; - final IAEItemStack missing; + private final IAEItemStack missing; public CraftingCalculationFailure( final IAEItemStack what, final long howMany ) { diff --git a/src/main/java/appeng/crafting/CraftingJob.java b/src/main/java/appeng/crafting/CraftingJob.java index 3f7a1de7b..014693196 100644 --- a/src/main/java/appeng/crafting/CraftingJob.java +++ b/src/main/java/appeng/crafting/CraftingJob.java @@ -20,8 +20,6 @@ package appeng.crafting; import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; import java.util.concurrent.TimeUnit; import net.minecraft.nbt.NBTTagCompound; @@ -46,36 +44,25 @@ import com.google.common.base.Stopwatch; public class CraftingJob implements Runnable, ICraftingJob { - final IItemList storage; - final Set prophecies; - final MECraftingInventory original; - final World world; - final IItemList crafting = AEApi.instance().storage().createItemList(); - final IItemList missing = AEApi.instance().storage().createItemList(); - final HashMap opsAndMultiplier = new HashMap(); + private final MECraftingInventory original; + private final World world; + private final IItemList crafting = AEApi.instance().storage().createItemList(); + private final IItemList missing = AEApi.instance().storage().createItemList(); + private final HashMap opsAndMultiplier = new HashMap(); private final Object monitor = new Object(); private final Stopwatch watch = Stopwatch.createUnstarted(); - public CraftingTreeNode tree; - IAEItemStack output; - boolean simulate = false; - MECraftingInventory availableCheck; - long bytes = 0; - private BaseActionSource actionSrc; - private ICraftingCallback callback; + private CraftingTreeNode tree; + private final IAEItemStack output; + private boolean simulate = false; + private MECraftingInventory availableCheck; + private long bytes = 0; + private final BaseActionSource actionSrc; + private final ICraftingCallback callback; private boolean running = false; private boolean done = false; private int time = 5; private int incTime = Integer.MAX_VALUE; - public CraftingJob( final World w, final NBTTagCompound data ) - { - this.world = this.wrapWorld( w ); - this.storage = AEApi.instance().storage().createItemList(); - this.prophecies = new HashSet(); - this.original = null; - this.availableCheck = null; - } - private World wrapWorld( final World w ) { return w; @@ -85,8 +72,6 @@ public class CraftingJob implements Runnable, ICraftingJob { this.world = this.wrapWorld( w ); this.output = what.copy(); - this.storage = AEApi.instance().storage().createItemList(); - this.prophecies = new HashSet(); this.actionSrc = actionSrc; this.callback = callback; @@ -94,7 +79,7 @@ public class CraftingJob implements Runnable, ICraftingJob final IStorageGrid sg = grid.getCache( IStorageGrid.class ); this.original = new MECraftingInventory( sg.getItemInventory(), actionSrc, false, false, false ); - this.tree = this.getCraftingTree( cc, what ); + this.setTree( this.getCraftingTree( cc, what ) ); this.availableCheck = null; } @@ -103,12 +88,12 @@ public class CraftingJob implements Runnable, ICraftingJob return new CraftingTreeNode( cc, this, what, null, -1, 0 ); } - public void refund( final IAEItemStack o ) + void refund( final IAEItemStack o ) { this.availableCheck.injectItems( o, Actionable.MODULATE, this.actionSrc ); } - public IAEItemStack checkUse( final IAEItemStack available ) + IAEItemStack checkUse( final IAEItemStack available ) { return this.availableCheck.extractItems( available, Actionable.MODULATE, this.actionSrc ); } @@ -118,7 +103,7 @@ public class CraftingJob implements Runnable, ICraftingJob } - public void addTask( IAEItemStack what, final long crafts, final ICraftingPatternDetails details, final int depth ) + void addTask( IAEItemStack what, final long crafts, final ICraftingPatternDetails details, final int depth ) { if( crafts > 0 ) { @@ -128,7 +113,7 @@ public class CraftingJob implements Runnable, ICraftingJob } } - public void addMissing( IAEItemStack what ) + void addMissing( IAEItemStack what ) { what = what.copy(); this.missing.add( what ); @@ -150,8 +135,8 @@ public class CraftingJob implements Runnable, ICraftingJob craftingInventory.ignore( this.output ); this.availableCheck = new MECraftingInventory( this.original, false, false, false ); - this.tree.request( craftingInventory, this.output.getStackSize(), this.actionSrc ); - this.tree.dive( this ); + this.getTree().request( craftingInventory, this.output.getStackSize(), this.actionSrc ); + this.getTree().dive( this ); for( final String s : this.opsAndMultiplier.keySet() ) { @@ -175,9 +160,9 @@ public class CraftingJob implements Runnable, ICraftingJob this.availableCheck = new MECraftingInventory( this.original, false, false, false ); - this.tree.setSimulate(); - this.tree.request( craftingInventory, this.output.getStackSize(), this.actionSrc ); - this.tree.dive( this ); + this.getTree().setSimulate(); + this.getTree().request( craftingInventory, this.output.getStackSize(), this.actionSrc ); + this.getTree().dive( this ); for( final String s : this.opsAndMultiplier.keySet() ) { @@ -224,7 +209,7 @@ public class CraftingJob implements Runnable, ICraftingJob this.finish(); } - public void handlePausing() throws InterruptedException + void handlePausing() throws InterruptedException { if( this.incTime > 100 ) { @@ -260,7 +245,7 @@ public class CraftingJob implements Runnable, ICraftingJob this.incTime++; } - public void finish() + private void finish() { if( this.callback != null ) { @@ -297,9 +282,9 @@ public class CraftingJob implements Runnable, ICraftingJob @Override public void populatePlan( final IItemList plan ) { - if( this.tree != null ) + if( this.getTree() != null ) { - this.tree.getPlan( plan ); + this.getTree().getPlan( plan ); } } @@ -314,7 +299,7 @@ public class CraftingJob implements Runnable, ICraftingJob return this.done; } - public World getWorld() + World getWorld() { return this.world; } @@ -362,15 +347,25 @@ public class CraftingJob implements Runnable, ICraftingJob return true; } - public void addBytes( final long crafts ) + void addBytes( final long crafts ) { this.bytes += crafts; } - static class TwoIntegers + public CraftingTreeNode getTree() + { + return this.tree; + } + + private void setTree( final CraftingTreeNode tree ) + { + this.tree = tree; + } + + private static class TwoIntegers { - public final long perOp = 0; - public final long times = 0; + private final long perOp = 0; + private final long times = 0; } } diff --git a/src/main/java/appeng/crafting/CraftingLink.java b/src/main/java/appeng/crafting/CraftingLink.java index 805a52c4c..174629985 100644 --- a/src/main/java/appeng/crafting/CraftingLink.java +++ b/src/main/java/appeng/crafting/CraftingLink.java @@ -30,19 +30,19 @@ import appeng.api.storage.data.IAEItemStack; public class CraftingLink implements ICraftingLink { - final ICraftingRequester req; - final ICraftingCPU cpu; - final String CraftID; - final boolean standalone; - boolean canceled = false; - boolean done = false; - CraftingLinkNexus tie; + private final ICraftingRequester req; + private final ICraftingCPU cpu; + private final String CraftID; + private final boolean standalone; + private boolean canceled = false; + private boolean done = false; + private CraftingLinkNexus tie; public CraftingLink( final NBTTagCompound data, final ICraftingRequester req ) { this.CraftID = data.getString( "CraftID" ); - this.canceled = data.getBoolean( "canceled" ); - this.done = data.getBoolean( "done" ); + this.setCanceled( data.getBoolean( "canceled" ) ); + this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); if( !data.hasKey( "req" ) || !data.getBoolean( "req" ) ) @@ -57,8 +57,8 @@ public class CraftingLink implements ICraftingLink public CraftingLink( final NBTTagCompound data, final ICraftingCPU cpu ) { this.CraftID = data.getString( "CraftID" ); - this.canceled = data.getBoolean( "canceled" ); - this.done = data.getBoolean( "done" ); + this.setCanceled( data.getBoolean( "canceled" ) ); + this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); if( !data.hasKey( "req" ) || data.getBoolean( "req" ) ) @@ -120,7 +120,7 @@ public class CraftingLink implements ICraftingLink return; } - this.canceled = true; + this.setCanceled( true ); if( this.tie != null ) { @@ -140,10 +140,10 @@ public class CraftingLink implements ICraftingLink public void writeToNBT( final NBTTagCompound tag ) { tag.setString( "CraftID", this.CraftID ); - tag.setBoolean( "canceled", this.canceled ); - tag.setBoolean( "done", this.done ); + tag.setBoolean( "canceled", this.isCanceled() ); + tag.setBoolean( "done", this.isDone() ); tag.setBoolean( "standalone", this.standalone ); - tag.setBoolean( "req", this.req != null ); + tag.setBoolean( "req", this.getRequester() != null ); } @Override @@ -159,7 +159,7 @@ public class CraftingLink implements ICraftingLink this.tie.remove( this ); } - if( this.canceled && n != null ) + if( this.isCanceled() && n != null ) { n.cancel(); this.tie = null; @@ -176,12 +176,12 @@ public class CraftingLink implements ICraftingLink public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode ) { - if( this.tie == null || this.tie.req == null || this.tie.req.req == null ) + if( this.tie == null || this.tie.getRequest() == null || this.tie.getRequest().getRequester() == null ) { return input; } - return this.tie.req.req.injectCraftedItems( this.tie.req, input, mode ); + return this.tie.getRequest().getRequester().injectCraftedItems( this.tie.getRequest(), input, mode ); } public void markDone() @@ -191,4 +191,24 @@ public class CraftingLink implements ICraftingLink this.tie.markDone(); } } + + void setCanceled( final boolean canceled ) + { + this.canceled = canceled; + } + + ICraftingRequester getRequester() + { + return this.req; + } + + ICraftingCPU getCpu() + { + return this.cpu; + } + + void setDone( final boolean done ) + { + this.done = done; + } } diff --git a/src/main/java/appeng/crafting/CraftingLinkNexus.java b/src/main/java/appeng/crafting/CraftingLinkNexus.java index a01a23dd8..7a30dcf60 100644 --- a/src/main/java/appeng/crafting/CraftingLinkNexus.java +++ b/src/main/java/appeng/crafting/CraftingLinkNexus.java @@ -27,16 +27,16 @@ import appeng.me.cache.CraftingGridCache; public class CraftingLinkNexus { - public final String CraftID; - boolean canceled = false; - boolean done = false; - int tickOfDeath = 0; - CraftingLink req; - CraftingLink cpu; + private final String craftID; + private boolean canceled = false; + private boolean done = false; + private int tickOfDeath = 0; + private CraftingLink req; + private CraftingLink cpu; public CraftingLinkNexus( final String craftID ) { - this.CraftID = craftID; + this.craftID = craftID; } public boolean isDead( final IGrid g, final CraftingGridCache craftingGridCache ) @@ -46,14 +46,14 @@ public class CraftingLinkNexus return true; } - if( this.req == null || this.cpu == null ) + if( this.getRequest() == null || this.cpu == null ) { this.tickOfDeath++; } else { - final boolean hasCpu = craftingGridCache.hasCpu( this.cpu.cpu ); - final boolean hasMachine = this.req.req.getActionableNode().getGrid() == g; + final boolean hasCpu = craftingGridCache.hasCpu( this.cpu.getCpu() ); + final boolean hasMachine = this.getRequest().getRequester().getActionableNode().getGrid() == g; if( hasCpu && hasMachine ) { @@ -74,30 +74,30 @@ public class CraftingLinkNexus return false; } - public void cancel() + void cancel() { this.canceled = true; - if( this.req != null ) + if( this.getRequest() != null ) { - this.req.canceled = true; - if( this.req.req != null ) + this.getRequest().setCanceled( true ); + if( this.getRequest().getRequester() != null ) { - this.req.req.jobStateChange( this.req ); + this.getRequest().getRequester().jobStateChange( this.getRequest() ); } } if( this.cpu != null ) { - this.cpu.canceled = true; + this.cpu.setCanceled( true ); } } - public void remove( final CraftingLink craftingLink ) + void remove( final CraftingLink craftingLink ) { - if( this.req == craftingLink ) + if( this.getRequest() == craftingLink ) { - this.req = null; + this.setRequest( null ); } else if( this.cpu == craftingLink ) { @@ -105,60 +105,70 @@ public class CraftingLinkNexus } } - public void add( final CraftingLink craftingLink ) + void add( final CraftingLink craftingLink ) { - if( craftingLink.cpu != null ) + if( craftingLink.getCpu() != null ) { this.cpu = craftingLink; } - else if( craftingLink.req != null ) + else if( craftingLink.getRequester() != null ) { - this.req = craftingLink; + this.setRequest( craftingLink ); } } - public boolean isCanceled() + boolean isCanceled() { return this.canceled; } - public boolean isDone() + boolean isDone() { return this.done; } - public void markDone() + void markDone() { this.done = true; - if( this.req != null ) + if( this.getRequest() != null ) { - this.req.done = true; - if( this.req.req != null ) + this.getRequest().setDone( true ); + if( this.getRequest().getRequester() != null ) { - this.req.req.jobStateChange( this.req ); + this.getRequest().getRequester().jobStateChange( this.getRequest() ); } } if( this.cpu != null ) { - this.cpu.done = true; + this.cpu.setDone( true ); } } public boolean isMachine( final IGridHost machine ) { - return this.req == machine; + return this.getRequest() == machine; } public void removeNode() { - if( this.req != null ) + if( this.getRequest() != null ) { - this.req.setNexus( null ); + this.getRequest().setNexus( null ); } - this.req = null; + this.setRequest( null ); this.tickOfDeath = 0; } + + public CraftingLink getRequest() + { + return req; + } + + public void setRequest( CraftingLink req ) + { + this.req = req; + } } diff --git a/src/main/java/appeng/crafting/CraftingTreeNode.java b/src/main/java/appeng/crafting/CraftingTreeNode.java index 4d0b77c29..37255086e 100644 --- a/src/main/java/appeng/crafting/CraftingTreeNode.java +++ b/src/main/java/appeng/crafting/CraftingTreeNode.java @@ -42,7 +42,7 @@ public class CraftingTreeNode { // what slot! - final int slot; + private final int slot; private final CraftingJob job; private final IItemList used = AEApi.instance().storage().createItemList(); // parent node. @@ -54,10 +54,10 @@ public class CraftingTreeNode private final ArrayList nodes = new ArrayList(); private int bytes = 0; private boolean canEmit = false; - private boolean cannotUse = false; private long missing = 0; private long howManyEmitted = 0; private boolean exhausted = false; + private boolean sim; public CraftingTreeNode( final ICraftingGrid cc, final CraftingJob job, final IAEItemStack wat, final CraftingTreeProcess par, final int slot, final int depth ) @@ -116,14 +116,14 @@ public class CraftingTreeNode return this.parent.notRecursive( details ); } - public IAEItemStack request( final MECraftingInventory inv, long l, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException + IAEItemStack request( final MECraftingInventory inv, long l, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException { this.job.handlePausing(); final List thingsUsed = new LinkedList(); this.what.setStackSize( l ); - if( this.slot >= 0 && this.parent != null && this.parent.details.isCraftable() ) + if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() ) { final Collection itemList; final IItemList inventoryList = inv.getItemList(); @@ -146,7 +146,7 @@ public class CraftingTreeNode for( IAEItemStack fuzz : itemList ) { - if( this.parent.details.isValidItemForSlot( this.slot, fuzz.getItemStack(), this.world ) ) + if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.getItemStack(), this.world ) ) { fuzz = fuzz.copy(); fuzz.setStackSize( l ); @@ -308,7 +308,7 @@ public class CraftingTreeNode throw new CraftBranchFailure( this.what, l ); } - public void dive( final CraftingJob job ) + void dive( final CraftingJob job ) { if( this.missing > 0 ) { @@ -324,14 +324,14 @@ public class CraftingTreeNode } } - public IAEItemStack getStack( final long size ) + IAEItemStack getStack( final long size ) { final IAEItemStack is = this.what.copy(); is.setStackSize( size ); return is; } - public void setSimulate() + void setSimulate() { this.sim = true; this.missing = 0; @@ -372,7 +372,7 @@ public class CraftingTreeNode } } - public void getPlan( final IItemList plan ) + void getPlan( final IItemList plan ) { if( this.missing > 0 ) { @@ -398,4 +398,9 @@ public class CraftingTreeNode pro.getPlan( plan ); } } + + int getSlot() + { + return this.slot; + } } diff --git a/src/main/java/appeng/crafting/CraftingTreeProcess.java b/src/main/java/appeng/crafting/CraftingTreeProcess.java index 9c689483e..e28bfaf98 100644 --- a/src/main/java/appeng/crafting/CraftingTreeProcess.java +++ b/src/main/java/appeng/crafting/CraftingTreeProcess.java @@ -43,17 +43,17 @@ import appeng.util.Platform; public class CraftingTreeProcess { - final CraftingTreeNode parent; + private final CraftingTreeNode parent; final ICraftingPatternDetails details; - final CraftingJob job; - final Map nodes = new HashMap(); + private final CraftingJob job; + private final Map nodes = new HashMap(); private final int depth; - public boolean possible = true; - World world; - long crafts = 0; - boolean containerItems; - boolean limitQty; - boolean fullSimulation; + boolean possible = true; + private World world; + private long crafts = 0; + private boolean containerItems; + private boolean limitQty; + private boolean fullSimulation; private long bytes = 0; public CraftingTreeProcess( final ICraftingGrid cc, final CraftingJob job, final ICraftingPatternDetails details, final CraftingTreeNode craftingTreeNode, final int depth ) @@ -169,7 +169,7 @@ public class CraftingTreeProcess } } - public boolean notRecursive( final ICraftingPatternDetails details ) + boolean notRecursive( final ICraftingPatternDetails details ) { return this.parent == null || this.parent.notRecursive( details ); } @@ -183,7 +183,7 @@ public class CraftingTreeProcess return ( remaining / stackSize ) + ( remaining % stackSize != 0 ? 1 : 0 ); } - public void request( final MECraftingInventory inv, final long i, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException + void request( final MECraftingInventory inv, final long i, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException { this.job.handlePausing(); @@ -196,7 +196,7 @@ public class CraftingTreeProcess final IAEItemStack item = entry.getKey().getStack( entry.getValue() ); final IAEItemStack stack = entry.getKey().request( inv, item.getStackSize(), src ); - ic.setInventorySlotContents( entry.getKey().slot, stack.getItemStack() ); + ic.setInventorySlotContents( entry.getKey().getSlot(), stack.getItemStack() ); } FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.world ), this.details.getOutput( ic, this.world ), ic ); @@ -248,7 +248,7 @@ public class CraftingTreeProcess this.crafts += i; } - public void dive( final CraftingJob job ) + void dive( final CraftingJob job ) { job.addTask( this.getAmountCrafted( this.parent.getStack( 1 ) ), this.crafts, this.details, this.depth ); for( final CraftingTreeNode pro : this.nodes.keySet() ) @@ -285,7 +285,7 @@ public class CraftingTreeProcess throw new IllegalStateException( "Crafting Tree construction failed." ); } - public void setSimulate() + void setSimulate() { this.crafts = 0; this.bytes = 0; @@ -296,7 +296,7 @@ public class CraftingTreeProcess } } - public void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure + void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure { craftingCPUCluster.addCrafting( this.details, this.crafts ); @@ -306,7 +306,7 @@ public class CraftingTreeProcess } } - public void getPlan( final IItemList plan ) + void getPlan( final IItemList plan ) { for( IAEItemStack i : this.details.getOutputs() ) { diff --git a/src/main/java/appeng/crafting/CraftingWatcher.java b/src/main/java/appeng/crafting/CraftingWatcher.java index 2ee6a41ae..293f61af7 100644 --- a/src/main/java/appeng/crafting/CraftingWatcher.java +++ b/src/main/java/appeng/crafting/CraftingWatcher.java @@ -37,9 +37,9 @@ import appeng.me.cache.CraftingGridCache; public class CraftingWatcher implements ICraftingWatcher { - final CraftingGridCache gsc; - final ICraftingWatcherHost host; - final HashSet myInterests = new HashSet(); + private final CraftingGridCache gsc; + private final ICraftingWatcherHost host; + private final HashSet myInterests = new HashSet(); public CraftingWatcher( final CraftingGridCache cache, final ICraftingWatcherHost host ) { @@ -99,13 +99,13 @@ public class CraftingWatcher implements ICraftingWatcher return false; } - return this.myInterests.add( e.copy() ) && this.gsc.interestManager.put( e, this ); + return this.myInterests.add( e.copy() ) && this.gsc.getInterestManager().put( e, this ); } @Override public boolean remove( final Object o ) { - return this.myInterests.remove( o ) && this.gsc.interestManager.remove( (IAEStack) o, this ); + return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this ); } @Override @@ -162,17 +162,17 @@ public class CraftingWatcher implements ICraftingWatcher final Iterator i = this.myInterests.iterator(); while( i.hasNext() ) { - this.gsc.interestManager.remove( i.next(), this ); + this.gsc.getInterestManager().remove( i.next(), this ); i.remove(); } } - class ItemWatcherIterator implements Iterator + private class ItemWatcherIterator implements Iterator { - final CraftingWatcher watcher; - final Iterator interestIterator; - IAEStack myLast; + private final CraftingWatcher watcher; + private final Iterator interestIterator; + private IAEStack myLast; public ItemWatcherIterator( final CraftingWatcher parent, final Iterator i ) { @@ -195,7 +195,7 @@ public class CraftingWatcher implements ICraftingWatcher @Override public void remove() { - CraftingWatcher.this.gsc.interestManager.remove( this.myLast, this.watcher ); + CraftingWatcher.this.gsc.getInterestManager().remove( this.myLast, this.watcher ); this.interestIterator.remove(); } } diff --git a/src/main/java/appeng/crafting/MECraftingInventory.java b/src/main/java/appeng/crafting/MECraftingInventory.java index 0ec5f9903..433e5dc7d 100644 --- a/src/main/java/appeng/crafting/MECraftingInventory.java +++ b/src/main/java/appeng/crafting/MECraftingInventory.java @@ -32,19 +32,19 @@ import appeng.api.storage.data.IItemList; public class MECraftingInventory implements IMEInventory { - final MECraftingInventory par; + private final MECraftingInventory par; - final IMEInventory target; - final IItemList localCache; + private final IMEInventory target; + private final IItemList localCache; - final boolean logExtracted; - final IItemList extractedCache; + private final boolean logExtracted; + private final IItemList extractedCache; - final boolean logInjections; - final IItemList injectedCache; + private final boolean logInjections; + private final IItemList injectedCache; - final boolean logMissing; - final IItemList missingCache; + private final boolean logMissing; + private final IItemList missingCache; public MECraftingInventory() { @@ -336,12 +336,12 @@ public class MECraftingInventory implements IMEInventory return true; } - public void addMissing( final IAEItemStack extra ) + private void addMissing( final IAEItemStack extra ) { this.missingCache.add( extra ); } - public void ignore( final IAEItemStack what ) + void ignore( final IAEItemStack what ) { final IAEItemStack list = this.localCache.findPrecise( what ); if( list != null ) diff --git a/src/main/java/appeng/debug/TileChunkLoader.java b/src/main/java/appeng/debug/TileChunkLoader.java index f384329a1..161eab8eb 100644 --- a/src/main/java/appeng/debug/TileChunkLoader.java +++ b/src/main/java/appeng/debug/TileChunkLoader.java @@ -41,8 +41,8 @@ import appeng.util.Platform; public class TileChunkLoader extends AEBaseTile implements IUpdatePlayerListBox { - boolean requestTicket = true; - Ticket ct; + private boolean requestTicket = true; + private Ticket ct = null; @TileEvent( TileEventType.TICK ) public void onTickEvent() @@ -54,7 +54,7 @@ public class TileChunkLoader extends AEBaseTile implements IUpdatePlayerListBox } } - void initTicket() + private void initTicket() { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/debug/TileCubeGenerator.java b/src/main/java/appeng/debug/TileCubeGenerator.java index e24e87c20..72f770788 100644 --- a/src/main/java/appeng/debug/TileCubeGenerator.java +++ b/src/main/java/appeng/debug/TileCubeGenerator.java @@ -36,10 +36,10 @@ import appeng.util.Platform; public class TileCubeGenerator extends AEBaseTile implements IUpdatePlayerListBox { - int size = 3; - ItemStack is = null; - int countdown = 20 * 10; - EntityPlayer who; + private int size = 3; + private ItemStack is = null; + private int countdown = 20 * 10; + private EntityPlayer who = null; @TileEvent( TileEventType.TICK ) public void onTickEvent() @@ -63,7 +63,7 @@ public class TileCubeGenerator extends AEBaseTile implements IUpdatePlayerListBo } } - void spawn() + private void spawn() { this.worldObj.setBlockToAir( this.pos ); @@ -85,7 +85,7 @@ public class TileCubeGenerator extends AEBaseTile implements IUpdatePlayerListBo } } - public void click( final EntityPlayer player ) + void click( final EntityPlayer player ) { if( Platform.isServer() ) { diff --git a/src/main/java/appeng/debug/TilePhantomNode.java b/src/main/java/appeng/debug/TilePhantomNode.java index 4a5340964..67e619950 100644 --- a/src/main/java/appeng/debug/TilePhantomNode.java +++ b/src/main/java/appeng/debug/TilePhantomNode.java @@ -31,8 +31,8 @@ import appeng.tile.grid.AENetworkTile; public class TilePhantomNode extends AENetworkTile { - protected AENetworkProxy proxy = null; - boolean crashMode = false; + private AENetworkProxy proxy = null; + private boolean crashMode = false; @Override public IGridNode getGridNode( final AEPartLocation dir ) @@ -54,7 +54,7 @@ public class TilePhantomNode extends AENetworkTile this.crashMode = true; } - public void triggerCrashMode() + void triggerCrashMode() { if( this.proxy != null ) { diff --git a/src/main/java/appeng/debug/ToolDebugCard.java b/src/main/java/appeng/debug/ToolDebugCard.java index a74e4c9de..f843cdf6e 100644 --- a/src/main/java/appeng/debug/ToolDebugCard.java +++ b/src/main/java/appeng/debug/ToolDebugCard.java @@ -146,7 +146,7 @@ public class ToolDebugCard extends AEBaseItem if( center.getMachine() instanceof PartP2PTunnel ) { - this.outputMsg( player, "Freq: " + ( (PartP2PTunnel) center.getMachine() ).freq ); + this.outputMsg( player, "Freq: " + ( (PartP2PTunnel) center.getMachine() ).getFrequency() ); } final TickManagerCache tmc = g.getCache( ITickManager.class ); @@ -223,7 +223,7 @@ public class ToolDebugCard extends AEBaseItem player.addChatMessage( new ChatComponentText( string ) ); } - public String timeMeasurement( final long nanos ) + private String timeMeasurement( final long nanos ) { final long ms = nanos / 100000; if( nanos <= 100000 ) diff --git a/src/main/java/appeng/debug/ToolEraser.java b/src/main/java/appeng/debug/ToolEraser.java index 74e5457ef..97e89655e 100644 --- a/src/main/java/appeng/debug/ToolEraser.java +++ b/src/main/java/appeng/debug/ToolEraser.java @@ -38,7 +38,7 @@ import appeng.util.Platform; public class ToolEraser extends AEBaseItem { - public static final int BLOCK_ERASE_LIMIT = 90000; + private static final int BLOCK_ERASE_LIMIT = 90000; public ToolEraser() { diff --git a/src/main/java/appeng/decorative/solid/QuartzGlassBlock.java b/src/main/java/appeng/decorative/solid/QuartzGlassBlock.java index 87c1e1e2f..2d29dfcbf 100644 --- a/src/main/java/appeng/decorative/solid/QuartzGlassBlock.java +++ b/src/main/java/appeng/decorative/solid/QuartzGlassBlock.java @@ -41,7 +41,7 @@ public class QuartzGlassBlock extends AEBaseBlock { super( Material.glass ); this.setLightOpacity( 0 ); - this.isOpaque = false; + this.setOpaque( false ); this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) ); } diff --git a/src/main/java/appeng/decorative/solid/QuartzOreBlock.java b/src/main/java/appeng/decorative/solid/QuartzOreBlock.java index 481366946..c60f2f87a 100644 --- a/src/main/java/appeng/decorative/solid/QuartzOreBlock.java +++ b/src/main/java/appeng/decorative/solid/QuartzOreBlock.java @@ -175,12 +175,12 @@ public class QuartzOreBlock extends AEBaseBlock } } - public void setBoostBrightnessLow( final int boostBrightnessLow ) + void setBoostBrightnessLow( final int boostBrightnessLow ) { this.boostBrightnessLow = boostBrightnessLow; } - public void setBoostBrightnessHigh( final int boostBrightnessHigh ) + void setBoostBrightnessHigh( final int boostBrightnessHigh ) { this.boostBrightnessHigh = boostBrightnessHigh; } diff --git a/src/main/java/appeng/entity/AEBaseEntityItem.java b/src/main/java/appeng/entity/AEBaseEntityItem.java index 07e4c11c4..a17dcdfc5 100644 --- a/src/main/java/appeng/entity/AEBaseEntityItem.java +++ b/src/main/java/appeng/entity/AEBaseEntityItem.java @@ -41,7 +41,7 @@ public abstract class AEBaseEntityItem extends EntityItem } @SuppressWarnings( "unchecked" ) - public List getCheckedEntitiesWithinAABBExcludingEntity( final AxisAlignedBB region ) + protected List getCheckedEntitiesWithinAABBExcludingEntity( final AxisAlignedBB region ) { return this.worldObj.getEntitiesWithinAABBExcludingEntity( this, region ); } diff --git a/src/main/java/appeng/entity/EntityChargedQuartz.java b/src/main/java/appeng/entity/EntityChargedQuartz.java index 64edb73d5..4501a5d1f 100644 --- a/src/main/java/appeng/entity/EntityChargedQuartz.java +++ b/src/main/java/appeng/entity/EntityChargedQuartz.java @@ -43,8 +43,8 @@ import appeng.util.Platform; public final class EntityChargedQuartz extends AEBaseEntityItem { - int delay = 0; - int transformTime = 0; + private int delay = 0; + private int transformTime = 0; @Reflected public EntityChargedQuartz( final World w ) @@ -96,7 +96,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem } } - public boolean transform() + private boolean transform() { final ItemStack item = this.getEntityItem(); final IMaterials materials = AEApi.instance().definitions().materials(); diff --git a/src/main/java/appeng/entity/EntityFloatingItem.java b/src/main/java/appeng/entity/EntityFloatingItem.java index d2e4fe12e..217612e41 100644 --- a/src/main/java/appeng/entity/EntityFloatingItem.java +++ b/src/main/java/appeng/entity/EntityFloatingItem.java @@ -29,8 +29,8 @@ public final class EntityFloatingItem extends EntityItem { private final Entity parent; - int superDeath = 0; - float progress = 0; + private int superDeath = 0; + private float progress = 0; public EntityFloatingItem( final Entity parent, final World world, final double x, final double y, final double z, final ItemStack stack ) { @@ -68,4 +68,9 @@ public final class EntityFloatingItem extends EntityItem this.setDead(); } } + + float getProgress() + { + return this.progress; + } } diff --git a/src/main/java/appeng/entity/EntityIds.java b/src/main/java/appeng/entity/EntityIds.java index 3c469421b..a79ac012e 100644 --- a/src/main/java/appeng/entity/EntityIds.java +++ b/src/main/java/appeng/entity/EntityIds.java @@ -24,10 +24,10 @@ import net.minecraft.entity.Entity; public final class EntityIds { - public static final int TINY_TNT = 10; - public static final int SINGULARITY = 11; - public static final int CHARGED_QUARTZ = 12; - public static final int GROWING_CRYSTAL = 13; + private static final int TINY_TNT = 10; + private static final int SINGULARITY = 11; + private static final int CHARGED_QUARTZ = 12; + private static final int GROWING_CRYSTAL = 13; private EntityIds() { diff --git a/src/main/java/appeng/entity/EntitySingularity.java b/src/main/java/appeng/entity/EntitySingularity.java index 385bd3d90..3555000e7 100644 --- a/src/main/java/appeng/entity/EntitySingularity.java +++ b/src/main/java/appeng/entity/EntitySingularity.java @@ -66,7 +66,7 @@ public final class EntitySingularity extends AEBaseEntityItem return super.attackEntityFrom( src, dmg ); } - public void doExplosion() + private void doExplosion() { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/entity/RenderFloatingItem.java b/src/main/java/appeng/entity/RenderFloatingItem.java index 4f64488ac..773af9504 100644 --- a/src/main/java/appeng/entity/RenderFloatingItem.java +++ b/src/main/java/appeng/entity/RenderFloatingItem.java @@ -19,8 +19,7 @@ package appeng.entity; -import java.nio.ByteBuffer; -import java.nio.DoubleBuffer; +import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderEntityItem; @@ -30,21 +29,17 @@ import net.minecraft.item.ItemBlock; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - @SideOnly( Side.CLIENT ) public class RenderFloatingItem extends RenderEntityItem { - public static DoubleBuffer buffer = ByteBuffer.allocateDirect( 8 * 4 ).asDoubleBuffer(); - - public RenderFloatingItem( final RenderManager manager) + public RenderFloatingItem( final RenderManager manager ) { - super(manager,Minecraft.getMinecraft().getRenderItem()); + super( manager, Minecraft.getMinecraft().getRenderItem() ); this.shadowOpaque = 0.0F; } - + @Override public void doRender( final Entity entityItem, @@ -57,7 +52,7 @@ public class RenderFloatingItem extends RenderEntityItem if( entityItem instanceof EntityFloatingItem ) { final EntityFloatingItem efi = (EntityFloatingItem) entityItem; - if( efi.progress > 0.0 ) + if( efi.getProgress() > 0.0 ) { GL11.glPushMatrix(); diff --git a/src/main/java/appeng/entity/RenderTinyTNTPrimed.java b/src/main/java/appeng/entity/RenderTinyTNTPrimed.java index 8be162d87..53e6ecffc 100644 --- a/src/main/java/appeng/entity/RenderTinyTNTPrimed.java +++ b/src/main/java/appeng/entity/RenderTinyTNTPrimed.java @@ -19,6 +19,8 @@ package appeng.entity; +import org.lwjgl.opengl.GL11; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; @@ -31,8 +33,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - import appeng.client.render.ModelGenerator; @@ -42,9 +42,9 @@ public class RenderTinyTNTPrimed extends Render private final ModelGenerator blockRenderer = new ModelGenerator(); - public RenderTinyTNTPrimed( final RenderManager p_i46134_1_) - { - super(p_i46134_1_); + public RenderTinyTNTPrimed( final RenderManager p_i46134_1_ ) + { + super( p_i46134_1_ ); this.shadowSize = 0.5F; } @@ -54,11 +54,11 @@ public class RenderTinyTNTPrimed extends Render this.renderPrimedTNT( (EntityTinyTNTPrimed) tnt, x, y, z, unused, life ); } - public void renderPrimedTNT( final EntityTinyTNTPrimed tnt, final double x, final double y, final double z, final float unused, final float life ) + private void renderPrimedTNT( final EntityTinyTNTPrimed tnt, final double x, final double y, final double z, final float unused, final float life ) { - final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); - GlStateManager.pushMatrix(); - GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); + final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + GlStateManager.pushMatrix(); + GlStateManager.translate( (float) x, (float) y + 0.5F, (float) z ); float f2; if( tnt.fuse - life + 1.0F < 10.0F ) @@ -82,32 +82,32 @@ public class RenderTinyTNTPrimed extends Render } GL11.glScalef( 0.5f, 0.5f, 0.5f ); - f2 = (1.0F - (tnt.fuse - life + 1.0F) / 100.0F) * 0.8F; - this.bindEntityTexture(tnt); - GlStateManager.translate(-0.5F, -0.5F, 0.5F); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), tnt.getBrightness(life)); - GlStateManager.translate(0.0F, 0.0F, 1.0F); + f2 = ( 1.0F - ( tnt.fuse - life + 1.0F ) / 100.0F ) * 0.8F; + this.bindEntityTexture( tnt ); + GlStateManager.translate( -0.5F, -0.5F, 0.5F ); + blockrendererdispatcher.renderBlockBrightness( Blocks.tnt.getDefaultState(), tnt.getBrightness( life ) ); + GlStateManager.translate( 0.0F, 0.0F, 1.0F ); if( tnt.fuse / 5 % 2 == 0 ) { - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(770, 772); - GlStateManager.color(1.0F, 1.0F, 1.0F, f2); - GlStateManager.doPolygonOffset(-3.0F, -3.0F); - GlStateManager.enablePolygonOffset(); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F); - GlStateManager.doPolygonOffset(0.0F, 0.0F); - GlStateManager.disablePolygonOffset(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); - GlStateManager.enableLighting(); - GlStateManager.enableTexture2D(); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc( 770, 772 ); + GlStateManager.color( 1.0F, 1.0F, 1.0F, f2 ); + GlStateManager.doPolygonOffset( -3.0F, -3.0F ); + GlStateManager.enablePolygonOffset(); + blockrendererdispatcher.renderBlockBrightness( Blocks.tnt.getDefaultState(), 1.0F ); + GlStateManager.doPolygonOffset( 0.0F, 0.0F ); + GlStateManager.disablePolygonOffset(); + GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); } - GlStateManager.popMatrix(); - super.doRender(tnt, x, y, z, unused, life ); + GlStateManager.popMatrix(); + super.doRender( tnt, x, y, z, unused, life ); } @Override diff --git a/src/main/java/appeng/facade/FacadeContainer.java b/src/main/java/appeng/facade/FacadeContainer.java index 337df73bd..aa38b24a9 100644 --- a/src/main/java/appeng/facade/FacadeContainer.java +++ b/src/main/java/appeng/facade/FacadeContainer.java @@ -44,8 +44,8 @@ import appeng.parts.CableBusStorage; public class FacadeContainer implements IFacadeContainer { - final int facades = 6; - final CableBusStorage storage; + private final int facades = 6; + private final CableBusStorage storage; public FacadeContainer( final CableBusStorage cbs ) { diff --git a/src/main/java/appeng/facade/FacadePart.java b/src/main/java/appeng/facade/FacadePart.java index 3fc34474f..93044acae 100644 --- a/src/main/java/appeng/facade/FacadePart.java +++ b/src/main/java/appeng/facade/FacadePart.java @@ -60,9 +60,9 @@ import appeng.util.Platform; public class FacadePart implements IFacadePart, IBoxProvider { - public final ItemStack facade; - public final AEPartLocation side; - public int thickness = 2; + private final ItemStack facade; + private final AEPartLocation side; + private int thickness = 2; public FacadePart( final ItemStack facade, final AEPartLocation side ) { @@ -123,8 +123,8 @@ public class FacadePart implements IFacadePart, IBoxProvider { if( rbw != null ) { - //rbw.isFacade = false; - //rbw.calculations = true; + // rbw.isFacade = false; + // rbw.calculations = true; } IAESprite myIcon = null; @@ -165,7 +165,7 @@ public class FacadePart implements IFacadePart, IBoxProvider { if( rbw != null ) { - rbw.opacity = 0.3f; + rbw.setOpacity( 0.3f ); } instance.renderForPass( 1 ); } @@ -185,41 +185,50 @@ public class FacadePart implements IFacadePart, IBoxProvider { } - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); instance.setBounds( 0, 0, 16 - this.thickness, 16, 16, 16 ); instance.prepareBounds( renderer ); /* - if( rbw != null ) - { - rbw.isFacade = true; - - rbw.calculations = true; - rbw.faces = EnumSet.noneOf( AEPartLocation.class ); - - if( this.prevLight != null && rbw.similarLighting( blk, rbw.blockAccess, x, y, z, this.prevLight ) ) - { - rbw.populate( this.prevLight ); - } - else - { - instance.setRenderColor( color ); - rbw.renderStandardBlock( instance.getBlock(), x, y, z ); - instance.setRenderColor( 0xffffff ); - this.prevLight = rbw.getLightingCache(); - } - - rbw.calculations = false; - rbw.faces = this.calculateFaceOpenFaces( rbw.blockAccess, fc, x, y, z, this.side ); - - ( (RenderBlocksWorkaround) renderer ).setTexture( blk.getIcon( AEPartLocation.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) ); - } - else - {*/ + * if( rbw != null ) + * { + * rbw.setFacade( true ); + * <<<<<<< HEAD + * rbw.calculations = true; + * rbw.faces = EnumSet.noneOf( AEPartLocation.class ); + * ======= + * rbw.setCalculations( true ); + * rbw.setFaces( EnumSet.noneOf( ForgeDirection.class ) ); + * >>>>>>> 500fc47... Reduces visibility of internal fields/methods + * if( this.prevLight != null && rbw.similarLighting( blk, rbw.blockAccess, x, y, z, + * this.prevLight ) ) + * { + * rbw.populate( this.prevLight ); + * } + * else + * { + * instance.setRenderColor( color ); + * rbw.renderStandardBlock( instance.getBlock(), x, y, z ); + * instance.setRenderColor( 0xffffff ); + * this.prevLight = rbw.getLightingCache(); + * } + * rbw.setCalculations( false ); + * rbw.setFaces( this.calculateFaceOpenFaces( rbw.blockAccess, fc, x, y, z, this.side ) ); + * ( (RenderBlocksWorkaround) renderer ).setTexture( blk.getIcon( AEPartLocation.DOWN.ordinal(), + * ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.UP.ordinal(), + * ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.NORTH.ordinal(), + * ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.SOUTH.ordinal(), + * ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.WEST.ordinal(), + * ib.getMetadata( randomItem.getItemDamage() ) ), blk.getIcon( AEPartLocation.EAST.ordinal(), + * ib.getMetadata( randomItem.getItemDamage() ) ) ); + * } + * else + * { + */ final IAESprite[] icon_down = renderer.getIcon( blk.getDefaultState() ); instance.setTexture( icon_down[EnumFacing.DOWN.ordinal()], icon_down[EnumFacing.UP.ordinal()], icon_down[EnumFacing.NORTH.ordinal()], icon_down[EnumFacing.SOUTH.ordinal()], icon_down[EnumFacing.WEST.ordinal()], icon_down[EnumFacing.EAST.ordinal()] ); - //} + // } if( busBounds == null ) { @@ -231,12 +240,12 @@ public class FacadePart implements IFacadePart, IBoxProvider { if( fc.getFacade( AEPartLocation.UP ) != null ) { - renderer.renderMaxY -= this.thickness / 16.0; + renderer.setRenderMaxY( renderer.getRenderMaxY() - this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.DOWN ) != null ) { - renderer.renderMinY += this.thickness / 16.0; + renderer.setRenderMinY( renderer.getRenderMinY() + this.thickness / 16.0 ); } instance.renderBlockCurrentBounds( pos, renderer ); @@ -245,22 +254,22 @@ public class FacadePart implements IFacadePart, IBoxProvider { if( fc.getFacade( AEPartLocation.UP ) != null ) { - renderer.renderMaxY -= this.thickness / 16.0; + renderer.setRenderMaxY( renderer.getRenderMaxY() - this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.DOWN ) != null ) { - renderer.renderMinY += this.thickness / 16.0; + renderer.setRenderMinY( renderer.getRenderMinY() + this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.SOUTH ) != null ) { - renderer.renderMaxZ -= this.thickness / 16.0; + renderer.setRenderMaxZ( renderer.getRenderMaxZ() - this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.NORTH ) != null ) { - renderer.renderMinZ += this.thickness / 16.0; + renderer.setRenderMinZ( renderer.getRenderMinZ() + this.thickness / 16.0 ); } instance.renderBlockCurrentBounds( pos, renderer ); @@ -279,12 +288,12 @@ public class FacadePart implements IFacadePart, IBoxProvider { if( fc.getFacade( AEPartLocation.UP ) != null ) { - renderer.renderMaxY -= this.thickness / 16.0; + renderer.setRenderMaxY( renderer.getRenderMaxY() - this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.DOWN ) != null ) { - renderer.renderMinY += this.thickness / 16.0; + renderer.setRenderMinY( renderer.getRenderMinY() + this.thickness / 16.0 ); } this.renderSegmentBlockCurrentBounds( instance, pos, renderer, busBounds.maxX, 0.0, 0.0, 1.0, 1.0, 1.0 ); @@ -296,22 +305,22 @@ public class FacadePart implements IFacadePart, IBoxProvider { if( fc.getFacade( AEPartLocation.UP ) != null ) { - renderer.renderMaxY -= this.thickness / 16.0; + renderer.setRenderMaxY( renderer.getRenderMaxY() - this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.DOWN ) != null ) { - renderer.renderMinY += this.thickness / 16.0; + renderer.setRenderMinY( renderer.getRenderMinY() + this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.SOUTH ) != null ) { - renderer.renderMaxZ -= this.thickness / 16.0; + renderer.setRenderMaxZ( renderer.getRenderMaxZ() - this.thickness / 16.0 ); } if( fc.getFacade( AEPartLocation.NORTH ) != null ) { - renderer.renderMinZ += this.thickness / 16.0; + renderer.setRenderMinZ( renderer.getRenderMinZ() + this.thickness / 16.0 ); } this.renderSegmentBlockCurrentBounds( instance, pos, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 ); @@ -323,8 +332,8 @@ public class FacadePart implements IFacadePart, IBoxProvider if( rbw != null ) { - rbw.opacity = 1.0f; - rbw.faces = EnumSet.allOf( EnumFacing.class ); + rbw.setOpacity( 1.0f ); + rbw.setFaces( EnumSet.allOf( EnumFacing.class ) ); } instance.renderForPass( 0 ); @@ -453,7 +462,7 @@ public class FacadePart implements IFacadePart, IBoxProvider } @Nullable - ItemStack getTexture() + private ItemStack getTexture() { final Item maybeFacade = this.facade.getItem(); @@ -527,23 +536,18 @@ public class FacadePart implements IFacadePart, IBoxProvider * if ( out.contains( AEPartLocation.EAST ) && (side.offsetZ != 0) ) { IFacadePart fp = fc.getFacade( * AEPartLocation.EAST ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove( * AEPartLocation.EAST ); } - * * if ( out.contains( AEPartLocation.WEST ) && (side.offsetZ != 0) ) { IFacadePart fp = fc.getFacade( * AEPartLocation.WEST ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove( * AEPartLocation.WEST ); } - * * if ( out.contains( AEPartLocation.NORTH ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade( * AEPartLocation.NORTH ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove( * AEPartLocation.NORTH ); } - * * if ( out.contains( AEPartLocation.SOUTH ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade( * AEPartLocation.SOUTH ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove( * AEPartLocation.SOUTH ); } - * * if ( out.contains( AEPartLocation.EAST ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade( * AEPartLocation.EAST ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove( * AEPartLocation.EAST ); } - * * if ( out.contains( AEPartLocation.WEST ) && (side.offsetY != 0) ) { IFacadePart fp = fc.getFacade( * AEPartLocation.WEST ); if ( fp != null && (fp.isTransparent() == facade.isTransparent()) ) out.remove( * AEPartLocation.WEST ); } @@ -554,32 +558,32 @@ public class FacadePart implements IFacadePart, IBoxProvider @SideOnly( Side.CLIENT ) private void renderSegmentBlockCurrentBounds( final IPartRenderHelper instance, final BlockPos pos, final ModelGenerator renderer, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ ) { - final double oldMinX = renderer.renderMinX; - final double oldMinY = renderer.renderMinY; - final double oldMinZ = renderer.renderMinZ; - final double oldMaxX = renderer.renderMaxX; - final double oldMaxY = renderer.renderMaxY; - final double oldMaxZ = renderer.renderMaxZ; + final double oldMinX = renderer.getRenderMinX(); + final double oldMinY = renderer.getRenderMinY(); + final double oldMinZ = renderer.getRenderMinZ(); + final double oldMaxX = renderer.getRenderMaxX(); + final double oldMaxY = renderer.getRenderMaxY(); + final double oldMaxZ = renderer.getRenderMaxZ(); - renderer.renderMinX = Math.max( renderer.renderMinX, minX ); - renderer.renderMinY = Math.max( renderer.renderMinY, minY ); - renderer.renderMinZ = Math.max( renderer.renderMinZ, minZ ); - renderer.renderMaxX = Math.min( renderer.renderMaxX, maxX ); - renderer.renderMaxY = Math.min( renderer.renderMaxY, maxY ); - renderer.renderMaxZ = Math.min( renderer.renderMaxZ, maxZ ); + renderer.setRenderMinX( Math.max( renderer.getRenderMinX(), minX ) ); + renderer.setRenderMinY( Math.max( renderer.getRenderMinY(), minY ) ); + renderer.setRenderMinZ( Math.max( renderer.getRenderMinZ(), minZ ) ); + renderer.setRenderMaxX( Math.min( renderer.getRenderMaxX(), maxX ) ); + renderer.setRenderMaxY( Math.min( renderer.getRenderMaxY(), maxY ) ); + renderer.setRenderMaxZ( Math.min( renderer.getRenderMaxZ(), maxZ ) ); // don't draw it if its not at least a pixel wide... - if( renderer.renderMaxX - renderer.renderMinX >= 1.0 / 16.0 && renderer.renderMaxY - renderer.renderMinY >= 1.0 / 16.0 && renderer.renderMaxZ - renderer.renderMinZ >= 1.0 / 16.0 ) + if( renderer.getRenderMaxX() - renderer.getRenderMinX() >= 1.0 / 16.0 && renderer.getRenderMaxY() - renderer.getRenderMinY() >= 1.0 / 16.0 && renderer.getRenderMaxZ() - renderer.getRenderMinZ() >= 1.0 / 16.0 ) { instance.renderBlockCurrentBounds( pos, renderer ); } - renderer.renderMinX = oldMinX; - renderer.renderMinY = oldMinY; - renderer.renderMinZ = oldMinZ; - renderer.renderMaxX = oldMaxX; - renderer.renderMaxY = oldMaxY; - renderer.renderMaxZ = oldMaxZ; + renderer.setRenderMinX( oldMinX ); + renderer.setRenderMinY( oldMinY ); + renderer.setRenderMinZ( oldMinZ ); + renderer.setRenderMaxX( oldMaxX ); + renderer.setRenderMaxY( oldMaxY ); + renderer.setRenderMaxZ( oldMaxZ ); } private boolean hasAlphaDiff( final TileEntity tileEntity, final AEPartLocation side, final IFacadePart facade ) diff --git a/src/main/java/appeng/fmp/CableBusPart.java b/src/main/java/appeng/fmp/CableBusPart.java deleted file mode 100644 index 076a2bb00..000000000 --- a/src/main/java/appeng/fmp/CableBusPart.java +++ /dev/null @@ -1,697 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.fmp; - - -import java.io.IOException; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import codechicken.lib.data.MCDataInput; -import codechicken.lib.data.MCDataOutput; -import codechicken.lib.raytracer.IndexedCuboid6; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import codechicken.multipart.IMaskedRedstonePart; -import codechicken.multipart.JCuboidPart; -import codechicken.multipart.JNormalOcclusion; -import codechicken.multipart.NormalOcclusionTest; -import codechicken.multipart.NormallyOccludedPart; -import codechicken.multipart.TMultiPart; -import codechicken.multipart.scalatraits.TIInventoryTile; -import appeng.api.implementations.parts.IPartCable; -import appeng.api.networking.IGridNode; -import appeng.api.parts.IFacadeContainer; -import appeng.api.parts.IFacadePart; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartCollisionHelper; -import appeng.api.parts.IPartItem; -import appeng.api.parts.LayerFlags; -import appeng.api.parts.PartItemStack; -import appeng.api.parts.SelectedPart; -import appeng.api.util.AECableType; -import appeng.api.util.AEColor; -import appeng.api.util.DimensionalCoord; -import appeng.api.util.ForgeDirection; -import appeng.client.render.BusRenderHelper; -import appeng.client.render.BusRenderer; -import appeng.core.AEConfig; -import appeng.core.AELog; -import appeng.core.features.AEFeature; -import appeng.helpers.AEMultiTile; -import appeng.parts.BusCollisionHelper; -import appeng.parts.CableBusContainer; -import appeng.parts.PartPlacement; -import appeng.tile.networking.TileCableBus; -import appeng.util.Platform; - - -/** - * Implementing these might help improve visuals for hollow covers - * - * TSlottedPart,ISidedHollowConnect - */ -public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IMaskedRedstonePart, AEMultiTile -{ - public static final ThreadLocal DISABLE_FACADE_OCCLUSION = new ThreadLocal(); - - private static final double SHORTER = 6.0 / 16.0; - private static final double LONGER = 10.0 / 16.0; - private static final double MIN_DIRECTION = 0; - private static final double MAX_DIRECTION = 1.0; - private static final Cuboid6[] SIDE_TESTS = { - - // DOWN(0, -1, 0), - new Cuboid6( SHORTER, MIN_DIRECTION, SHORTER, LONGER, SHORTER, LONGER ), - - // UP(0, 1, 0), - new Cuboid6( SHORTER, LONGER, SHORTER, LONGER, MAX_DIRECTION, LONGER ), - - // NORTH(0, 0, -1), - new Cuboid6( SHORTER, SHORTER, MIN_DIRECTION, LONGER, LONGER, SHORTER ), - - // SOUTH(0, 0, 1), - new Cuboid6( SHORTER, SHORTER, LONGER, LONGER, LONGER, MAX_DIRECTION ), - - // WEST(-1, 0, 0), - new Cuboid6( MIN_DIRECTION, SHORTER, SHORTER, SHORTER, LONGER, LONGER ), - - // EAST(1, 0, 0), - new Cuboid6( LONGER, SHORTER, SHORTER, MAX_DIRECTION, LONGER, LONGER ), - }; - - /** - * Mask for {@link IMaskedRedstonePart#getConnectionMask(int)} - * - * the bits are derived from the rotation, where 4 is the center - */ - private static final int CONNECTION_MASK = 0x000010; - public CableBusContainer cb = new CableBusContainer( this ); - boolean canUpdate = false; - - @Override - public boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who ) - { - return this.cb.recolourBlock( side, colour, who ); - } - - @Override - public Cuboid6 getBounds() - { - AxisAlignedBB b = null; - - for( AxisAlignedBB bx : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, true ) ) - { - if( b == null ) - { - b = bx; - } - else - { - double minX = Math.min( b.minX, bx.minX ); - double minY = Math.min( b.minY, bx.minY ); - double minZ = Math.min( b.minZ, bx.minZ ); - double maxX = Math.max( b.maxX, bx.maxX ); - double maxY = Math.max( b.maxY, bx.maxY ); - double maxZ = Math.max( b.maxZ, bx.maxZ ); - b.setBounds( minX, minY, minZ, maxX, maxY, maxZ ); - } - } - - if( b == null ) - { - return new Cuboid6( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ); - } - - return new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ); - } - - @Override - public String getType() - { - return PartRegistry.CableBusPart.getName(); - } - - @Override - public int getLightValue() - { - return this.cb.getLightValue(); - } - - @Override - public void onWorldJoin() - { - this.canUpdate = true; - this.cb.updateConnections(); - this.cb.addToWorld(); - } - - @Override - public boolean occlusionTest( TMultiPart part ) - { - return NormalOcclusionTest.apply( this, part ); - } - - @Override - public boolean renderStatic( Vector3 pos, int pass ) - { - if( pass == 0 || ( pass == 1 && AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) ) ) - { - BusRenderHelper.INSTANCE.setPass( pass ); - BusRenderer.INSTANCE.renderer.renderAllFaces = true; - BusRenderer.INSTANCE.renderer.blockAccess = this.world(); - BusRenderer.INSTANCE.renderer.overrideBlockTexture = null; - this.cb.renderStatic( pos.x, pos.y, pos.z ); - return BusRenderHelper.INSTANCE.getItemsRendered() > 0; - } - return false; - } - - @Override - public void renderDynamic( Vector3 pos, float frame, int pass ) - { - if( pass == 0 || ( pass == 1 && AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) ) ) - { - BusRenderHelper.INSTANCE.setPass( pass ); - this.cb.renderDynamic( pos.x, pos.y, pos.z ); - } - } - - @Override - public void onPartChanged( TMultiPart part ) - { - this.cb.updateConnections(); - } - - @Override - public void onEntityCollision( Entity entity ) - { - this.cb.onEntityCollision( entity ); - } - - @Override - public boolean activate( EntityPlayer player, MovingObjectPosition hit, ItemStack item ) - { - return this.cb.activate( player, hit.hitVec.addVector( -hit.blockX, -hit.blockY, -hit.blockZ ) ); - } - - @Override - public void load( NBTTagCompound tag ) - { - this.cb.readFromNBT( tag ); - } - - @Override - public void onWorldSeparate() - { - this.canUpdate = false; - this.cb.removeFromWorld(); - } - - @Override - public void save( NBTTagCompound tag ) - { - this.cb.writeToNBT( tag ); - } - - @Override - public void writeDesc( MCDataOutput packet ) - { - ByteBuf stream = Unpooled.buffer(); - - try - { - this.cb.writeToStream( stream ); - packet.writeInt( stream.readableBytes() ); - stream.capacity( stream.readableBytes() ); - packet.writeByteArray( stream.array() ); - } - catch( IOException e ) - { - AELog.error( e ); - } - } - - @Override - public ItemStack pickItem( MovingObjectPosition hit ) - { - Vec3 v3 = hit.hitVec.addVector( -hit.blockX, -hit.blockY, -hit.blockZ ); - SelectedPart sp = this.cb.selectPart( v3 ); - if( sp != null ) - { - if( sp.part != null ) - { - return sp.part.getItemStack( PartItemStack.Break ); - } - if( sp.facade != null ) - { - return sp.facade.getItemStack(); - } - } - return null; - } - - @Override - public Iterable getDrops() - { - return this.cb.getDrops( new ArrayList() ); - } - - @Override - public void onNeighborChanged() - { - this.cb.onNeighborChanged(); - } - - @Override - public boolean doesTick() - { - return false; - } - - @Override - public void invalidateConvertedTile() - { - this.cb.setHost( this ); - } - - @Override - public void readDesc( MCDataInput packet ) - { - int len = packet.readInt(); - byte[] data = packet.readByteArray( len ); - - try - { - if( len > 0 ) - { - ByteBuf byteBuffer = Unpooled.wrappedBuffer( data ); - this.cb.readFromStream( byteBuffer ); - } - } - catch( IOException e ) - { - AELog.error( e ); - } - } - - @Override - public boolean canConnectRedstone( int side ) - { - return this.cb.canConnectRedstone( EnumSet.of( ForgeDirection.getOrientation( side ) ) ); - } - - @Override - public int weakPowerLevel( int side ) - { - return this.cb.isProvidingWeakPower( ForgeDirection.getOrientation( side ) ); - } - - @Override - public int strongPowerLevel( int side ) - { - return this.cb.isProvidingStrongPower( ForgeDirection.getOrientation( side ) ); - } - - public void convertFromTile( TileEntity blockTileEntity ) - { - TileCableBus tcb = (TileCableBus) blockTileEntity; - this.cb = tcb.cb; - } - - @Override - public Iterable getOcclusionBoxes() - { - LinkedList l = new LinkedList(); - for( AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( true, DISABLE_FACADE_OCCLUSION.get() == null, null, true ) ) - { - l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) ); - } - return l; - } - - @Override - public IGridNode getGridNode( ForgeDirection dir ) - { - return this.cb.getGridNode( dir ); - } - - @Override - public AECableType getCableConnectionType( ForgeDirection dir ) - { - return this.cb.getCableConnectionType( dir ); - } - - @Override - public void securityBreak() - { - this.cb.securityBreak(); - } - - // @Override - public int getHollowSize( int side ) - { - IPartCable cable = (IPartCable) this.getPart( ForgeDirection.UNKNOWN ); - - ForgeDirection dir = ForgeDirection.getOrientation( side ); - if( cable != null && cable.isConnected( dir ) ) - { - List boxes = new ArrayList(); - - BusCollisionHelper bch = new BusCollisionHelper( boxes, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH, null, true ); - - for( ForgeDirection whichSide : ForgeDirection.values() ) - { - IPart fPart = this.getPart( whichSide ); - - if( fPart != null ) - { - fPart.getBoxes( bch ); - } - } - - AxisAlignedBB b = null; - AxisAlignedBB pb = Platform.getPrimaryBox( dir, 2 ); - - for( AxisAlignedBB bb : boxes ) - { - if( bb.intersectsWith( pb ) ) - { - if( b == null ) - { - b = bb; - } - else - { - b.maxX = Math.max( b.maxX, bb.maxX ); - b.maxY = Math.max( b.maxY, bb.maxY ); - b.maxZ = Math.max( b.maxZ, bb.maxZ ); - b.minX = Math.min( b.minX, bb.minX ); - b.minY = Math.min( b.minY, bb.minY ); - b.minZ = Math.min( b.minZ, bb.minZ ); - } - } - } - - if( b == null ) - { - return 0; - } - - switch( dir ) - { - case WEST: - case EAST: - return this.getSize( b.minZ, b.maxZ, b.minY, b.maxY ); - case DOWN: - case NORTH: - return this.getSize( b.minX, b.maxX, b.minZ, b.maxZ ); - case SOUTH: - case UP: - return this.getSize( b.minX, b.maxX, b.minY, b.maxY ); - default: - } - } - - return 12; - } - - int getSize( double a, double b, double c, double d ) - { - double r = Math.abs( a - 0.5 ); - r = Math.max( Math.abs( b - 0.5 ), r ); - r = Math.max( Math.abs( c - 0.5 ), r ); - return ( 8 * (int) Math.max( Math.abs( d - 0.5 ), r ) ); - } - - // @Override - public int getSlotMask() - { - int mask = 0; - - for( ForgeDirection side : ForgeDirection.values() ) - { - if( this.getPart( side ) != null ) - { - mask |= 1 << side.ordinal(); - } - else if( side != ForgeDirection.UNKNOWN && this.getFacadeContainer().getFacade( side ) != null ) - { - mask |= 1 << side.ordinal(); - } - } - - return mask; - } - - @Override - public IFacadeContainer getFacadeContainer() - { - return this.cb.getFacadeContainer(); - } - - @Override - public boolean canAddPart( ItemStack is, ForgeDirection side ) - { - IFacadePart fp = PartPlacement.isFacade( is, side ); - if( fp != null ) - { - if( !( side == null || side == ForgeDirection.UNKNOWN || this.tile() == null ) ) - { - List boxes = new ArrayList(); - IPartCollisionHelper bch = new BusCollisionHelper( boxes, side, null, true ); - fp.getBoxes( bch, null ); - for( AxisAlignedBB bb : boxes ) - { - DISABLE_FACADE_OCCLUSION.set( true ); - boolean canAdd = this.tile().canAddPart( new NormallyOccludedPart( new Cuboid6( bb ) ) ); - DISABLE_FACADE_OCCLUSION.remove(); - if( !canAdd ) - { - return false; - } - } - } - return true; - } - - if( is.getItem() instanceof IPartItem ) - { - IPartItem bi = (IPartItem) is.getItem(); - - is = is.copy(); - is.stackSize = 1; - - final IPart bp = bi.createPartFromItemStack( is ); - if( !( side == null || side == ForgeDirection.UNKNOWN || this.tile() == null ) ) - { - List boxes = new ArrayList(); - IPartCollisionHelper bch = new BusCollisionHelper( boxes, side, null, true ); - if( bp != null ) - { - bp.getBoxes( bch ); - } - for( AxisAlignedBB bb : boxes ) - { - if( !this.tile().canAddPart( new NormallyOccludedPart( new Cuboid6( bb ) ) ) ) - { - return false; - } - } - } - } - - return this.cb.canAddPart( is, side ); - } - - @Override - public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner ) - { - return this.cb.addPart( is, side, owner ); - } - - @Override - public IPart getPart( ForgeDirection side ) - { - return this.cb.getPart( side ); - } - - @Override - public void removePart( ForgeDirection side, boolean suppressUpdate ) - { - this.cb.removePart( side, suppressUpdate ); - } - - @Override - public void markForUpdate() - { - if( Platform.isServer() && this.canUpdate ) - { - this.sendDescUpdate(); - } - } - - @Override - public DimensionalCoord getLocation() - { - return new DimensionalCoord( this.tile() ); - } - - @Override - public AEColor getColor() - { - return this.cb.getColor(); - } - - @Override - public void clearContainer() - { - this.cb = new CableBusContainer( this ); - } - - @Override - public boolean isBlocked( ForgeDirection side ) - { - if( side == null || side == ForgeDirection.UNKNOWN || this.tile() == null ) - { - return false; - } - - DISABLE_FACADE_OCCLUSION.set( true ); - - final int ordinal = side.ordinal(); - final Cuboid6 sideTest = SIDE_TESTS[ordinal]; - final NormallyOccludedPart occludedPart = new NormallyOccludedPart( sideTest ); - boolean blocked = !this.tile().canAddPart( occludedPart ); - DISABLE_FACADE_OCCLUSION.remove(); - - return blocked; - } - - @Override - public SelectedPart selectPart( Vec3 pos ) - { - return this.cb.selectPart( pos ); - } - - @Override - public void markForSave() - { - // mark the chunk for save... - TileEntity te = this.tile(); - if( te != null && te.getWorld() != null ) - { - te.getWorld().getChunkFromBlockCoords( this.x(), this.z() ).isModified = true; - } - } - - @Override - public void partChanged() - { - if( this.isInWorld() ) - { - this.notifyNeighbors(); - } - } - - @Override - public boolean hasRedstone( ForgeDirection side ) - { - return this.cb.hasRedstone( side ); - } - - @Override - public boolean isEmpty() - { - return this.cb.isEmpty(); - } - - @Override - public Set getLayerFlags() - { - return this.cb.getLayerFlags(); - } - - @Override - public void cleanup() - { - this.tile().remPart( this ); - } - - @Override - public void notifyNeighbors() - { - if( this.tile() instanceof TIInventoryTile ) - { - ( (TIInventoryTile) this.tile() ).rebuildSlotMap(); - } - - if( this.world() != null && this.world().blockExists( this.x(), this.y(), this.z() ) && !CableBusContainer.isLoading() ) - { - Platform.notifyBlocksOfNeighbors( this.world(), this.x(), this.y(), this.z() ); - } - } - - @Override - public boolean isInWorld() - { - return this.cb.isInWorld(); - } - - @Override - public Iterable getCollisionBoxes() - { - LinkedList l = new LinkedList(); - for( AxisAlignedBB b : this.cb.getSelectedBoundingBoxesFromPool( false, true, null, true ) ) - { - l.add( new Cuboid6( b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ ) ); - } - return l; - } - - @Override - public Iterable getSubParts() - { - LinkedList l = new LinkedList(); - for( Cuboid6 c : this.getCollisionBoxes() ) - { - l.add( new IndexedCuboid6( 0, c ) ); - } - return l; - } - - @Override - public int getConnectionMask( int side ) - { - return CONNECTION_MASK; - } -} diff --git a/src/main/java/appeng/fmp/FMPEvent.java b/src/main/java/appeng/fmp/FMPEvent.java deleted file mode 100644 index 4c522904d..000000000 --- a/src/main/java/appeng/fmp/FMPEvent.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.fmp; - - -import net.minecraft.block.Block; -import net.minecraft.block.BlockFence; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import codechicken.lib.packet.PacketCustom; -import codechicken.lib.raytracer.RayTracer; -import codechicken.lib.vec.BlockCoord; -import codechicken.lib.vec.Vector3; -import codechicken.multipart.TMultiPart; -import codechicken.multipart.TileMultipart; -import appeng.block.AEBaseItemBlock; -import appeng.core.sync.network.NetworkHandler; -import appeng.core.sync.packets.PacketMultiPart; -import appeng.integration.modules.helpers.FMPPacketEvent; - - -/** - * Basically a total rip of of the FMP version for vanilla, seemed to work well enough... - */ -public class FMPEvent -{ - - private final ThreadLocal placing = new ThreadLocal(); - - @SubscribeEvent - public void ServerFMPEvent( FMPPacketEvent event ) - { - FMPEvent.place( event.sender, event.sender.worldObj ); - } - - public static boolean place( EntityPlayer player, World world ) - { - MovingObjectPosition hit = RayTracer.reTrace( world, player ); - if( hit == null ) - { - return false; - } - - BlockCoord pos = new BlockCoord( hit.blockX, hit.blockY, hit.blockZ ).offset( hit.sideHit ); - ItemStack held = player.getHeldItem(); - TMultiPart part = null; - - Block blk = null; - - if( held == null ) - { - return false; - } - - if( held.getItem() instanceof AEBaseItemBlock ) - { - AEBaseItemBlock ib = (AEBaseItemBlock) held.getItem(); - blk = Block.getBlockFromItem( ib ); - part = PartRegistry.getPartByBlock( blk, hit.sideHit ); - } - - if( part == null ) - { - return false; - } - - if( world.isRemote && !player.isSneaking() )// attempt to use block activated like normal and tell the server - // the right stuff - { - Vector3 f = new Vector3( hit.hitVec ).add( -hit.blockX, -hit.blockY, -hit.blockZ ); - Block block = world.getBlock( hit.blockX, hit.blockY, hit.blockZ ); - if( block != null && !ignoreActivate( block ) && block.onBlockActivated( world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float) f.x, (float) f.y, (float) f.z ) ) - { - player.swingItem(); - PacketCustom.sendToServer( new C08PacketPlayerBlockPlacement( hit.blockX, hit.blockY, hit.blockZ, hit.sideHit, player.inventory.getCurrentItem(), (float) f.x, (float) f.y, (float) f.z ) ); - return true; - } - } - - TileMultipart tile = TileMultipart.getOrConvertTile( world, pos ); - if( tile == null || !tile.canAddPart( part ) ) - { - return false; - } - - if( !world.isRemote ) - { - TileMultipart.addPart( world, pos, part ); - world.playSoundEffect( pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, blk.stepSound.func_150496_b(), ( blk.stepSound.getVolume() + 1.0F ) / 2.0F, blk.stepSound.getPitch() * 0.8F ); - if( !player.capabilities.isCreativeMode ) - { - held.stackSize--; - if( held.stackSize == 0 ) - { - player.inventory.mainInventory[player.inventory.currentItem] = null; - MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held ) ); - } - } - } - else - { - player.swingItem(); - NetworkHandler.instance.sendToServer( new PacketMultiPart() ); - } - return true; - } - - /** - * Because vanilla is weird. - */ - private static boolean ignoreActivate( Block block ) - { - if( block instanceof BlockFence ) - { - return true; - } - return false; - } - - @SubscribeEvent - public void playerInteract( PlayerInteractEvent event ) - { - if( event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote ) - { - if( this.placing.get() != null ) - { - return; - } - this.placing.set( event ); - if( place( event.entityPlayer, event.entityPlayer.worldObj ) ) - { - event.setCanceled( true ); - } - this.placing.set( null ); - } - } -} diff --git a/src/main/java/appeng/fmp/FMPPlacementHelper.java b/src/main/java/appeng/fmp/FMPPlacementHelper.java deleted file mode 100644 index aa2e01db8..000000000 --- a/src/main/java/appeng/fmp/FMPPlacementHelper.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.fmp; - - -import java.util.EnumSet; -import java.util.Set; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Vec3; -import codechicken.lib.vec.BlockCoord; -import codechicken.multipart.TMultiPart; -import codechicken.multipart.TileMultipart; -import appeng.api.parts.IFacadeContainer; -import appeng.api.parts.IFacadePart; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.LayerFlags; -import appeng.api.parts.SelectedPart; -import appeng.api.util.AEColor; -import appeng.api.util.DimensionalCoord; -import appeng.api.util.ForgeDirection; -import appeng.facade.FacadeContainer; -import appeng.parts.CableBusStorage; -import appeng.util.Platform; - - -public class FMPPlacementHelper implements IPartHost -{ - - private static final CableBusStorage NULL_STORAGE = new NullStorage(); - private boolean hasPart = false; - private TileMultipart myMP; - private CableBusPart myPart; - - public FMPPlacementHelper( TileMultipart mp ) - { - this.myMP = mp; - } - - @Override - public IFacadeContainer getFacadeContainer() - { - if( this.myPart == null ) - { - return new FacadeContainer( NULL_STORAGE ); - } - return this.myPart.getFacadeContainer(); - } - - @Override - public boolean canAddPart( ItemStack part, ForgeDirection side ) - { - CableBusPart myPart = this.getPart(); - - boolean returnValue = this.hasPart && myPart.canAddPart( part, side ); - - this.removePart(); - - return returnValue; - } - - private CableBusPart getPart() - { - scala.collection.Iterator i = this.myMP.partList().iterator(); - while( i.hasNext() ) - { - TMultiPart p = i.next(); - if( p instanceof CableBusPart ) - { - this.myPart = (CableBusPart) p; - } - } - - if( this.myPart == null ) - { - this.myPart = (CableBusPart) PartRegistry.CableBusPart.construct( 0 ); - } - - BlockCoord loc = new BlockCoord( this.myMP.xCoord, this.myMP.yCoord, this.myMP.zCoord ); - - if( this.myMP.canAddPart( this.myPart ) && Platform.isServer() ) - { - this.myMP = TileMultipart.addPart( this.myMP.getWorld(), loc, this.myPart ); - this.hasPart = true; - } - - return this.myPart; - } - - public void removePart() - { - if( this.myPart.isEmpty() ) - { - scala.collection.Iterator i = this.myMP.partList().iterator(); - while( i.hasNext() ) - { - TMultiPart p = i.next(); - if( p == this.myPart ) - { - this.myMP = this.myMP.remPart( this.myPart ); - break; - } - } - this.hasPart = false; - this.myPart = null; - } - } - - @Override - public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner ) - { - CableBusPart myPart = this.getPart(); - - ForgeDirection returnValue = this.hasPart ? myPart.addPart( is, side, owner ) : null; - - this.removePart(); - - return returnValue; - } - - @Override - public IPart getPart( ForgeDirection side ) - { - if( this.myPart == null ) - { - return null; - } - return this.myPart.getPart( side ); - } - - @Override - public void removePart( ForgeDirection side, boolean suppressUpdate ) - { - if( this.myPart == null ) - { - return; - } - this.myPart.removePart( side, suppressUpdate ); - } - - @Override - public void markForUpdate() - { - if( this.myPart == null ) - { - return; - } - this.myPart.markForUpdate(); - } - - @Override - public DimensionalCoord getLocation() - { - if( this.myPart == null ) - { - return new DimensionalCoord( this.myMP ); - } - return this.myPart.getLocation(); - } - - @Override - public TileEntity getTile() - { - return this.myMP; - } - - @Override - public AEColor getColor() - { - if( this.myPart == null ) - { - return AEColor.Transparent; - } - return this.myPart.getColor(); - } - - @Override - public void clearContainer() - { - if( this.myPart == null ) - { - return; - } - this.myPart.clearContainer(); - } - - @Override - public boolean isBlocked( ForgeDirection side ) - { - this.getPart(); - - boolean returnValue = this.myPart.isBlocked( side ); - - this.removePart(); - - return returnValue; - } - - @Override - public SelectedPart selectPart( Vec3 pos ) - { - if( this.myPart == null ) - { - return new SelectedPart(); - } - return this.myPart.selectPart( pos ); - } - - @Override - public void markForSave() - { - if( this.myPart == null ) - { - return; - } - this.myPart.markForSave(); - } - - @Override - public void partChanged() - { - if( this.myPart == null ) - { - return; - } - this.myPart.partChanged(); - } - - @Override - public boolean hasRedstone( ForgeDirection side ) - { - if( this.myPart == null ) - { - return false; - } - return this.myPart.hasRedstone( side ); - } - - @Override - public boolean isEmpty() - { - if( this.myPart == null ) - { - return true; - } - return this.myPart.isEmpty(); - } - - @Override - public Set getLayerFlags() - { - if( this.myPart == null ) - { - return EnumSet.noneOf( LayerFlags.class ); - } - return this.myPart.getLayerFlags(); - } - - @Override - public void cleanup() - { - if( this.myPart == null ) - { - return; - } - this.myPart.cleanup(); - } - - @Override - public void notifyNeighbors() - { - if( this.myPart == null ) - { - return; - } - this.myPart.notifyNeighbors(); - } - - @Override - public boolean isInWorld() - { - if( this.myPart == null ) - { - return this.myMP.getWorld() != null; - } - return this.myPart.isInWorld(); - } - - static class NullStorage extends CableBusStorage - { - - @Override - public IFacadePart getFacade( int x ) - { - return null; - } - - @Override - public void setFacade( int x, IFacadePart facade ) - { - - } - } -} diff --git a/src/main/java/appeng/fmp/PartRegistry.java b/src/main/java/appeng/fmp/PartRegistry.java deleted file mode 100644 index d8a7311e9..000000000 --- a/src/main/java/appeng/fmp/PartRegistry.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.fmp; - - -import javax.annotation.Nullable; - -import net.minecraft.block.Block; - -import codechicken.multipart.TMultiPart; - -import appeng.block.AEBaseBlock; -import appeng.block.misc.BlockQuartzTorch; -import appeng.block.networking.BlockCableBus; -import appeng.core.Api; - - -public enum PartRegistry -{ - QuartzTorchPart( "ae2_torch", BlockQuartzTorch.class, QuartzTorchPart.class ), - CableBusPart( "ae2_cablebus", BlockCableBus.class, CableBusPart.class ); - - private final String name; - private final Class blk; - private final Class part; - - PartRegistry( String name, Class blk, Class part ) - { - this.name = name; - this.blk = blk; - this.part = part; - } - - @Nullable - public static TMultiPart getPartByBlock( Block block, int meta ) - { - for( PartRegistry pr : values() ) - { - if( pr.blk.isInstance( block ) ) - { - return pr.construct( meta ); - } - } - return null; - } - - public TMultiPart construct( int meta ) - { - try - { - if( this == CableBusPart ) - { - return (TMultiPart) Api.INSTANCE.partHelper().getCombinedInstance( this.part.getName() ).newInstance(); - } - else - { - return this.part.getConstructor( int.class ).newInstance( meta ); - } - } - catch( Throwable t ) - { - throw new IllegalStateException( t ); - } - } - - public String getName() - { - return this.name; - } -} diff --git a/src/main/java/appeng/fmp/QuartzTorchPart.java b/src/main/java/appeng/fmp/QuartzTorchPart.java deleted file mode 100644 index e11b9da2b..000000000 --- a/src/main/java/appeng/fmp/QuartzTorchPart.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. - * - * Applied Energistics 2 is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Applied Energistics 2 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Applied Energistics 2. If not, see . - */ - -package appeng.fmp; - - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.world.World; -import codechicken.lib.vec.BlockCoord; -import codechicken.lib.vec.Cuboid6; -import codechicken.multipart.IRandomDisplayTick; -import codechicken.multipart.minecraft.McBlockPart; -import codechicken.multipart.minecraft.McSidedMetaPart; -import appeng.api.AEApi; -import appeng.api.exceptions.MissingDefinition; -import appeng.api.util.ForgeDirection; - - -public class QuartzTorchPart extends McSidedMetaPart implements IRandomDisplayTick -{ - - public QuartzTorchPart() - { - this( ForgeDirection.DOWN.ordinal() ); - } - - public QuartzTorchPart( int meta ) - { - super( meta ); - } - - public static McBlockPart placement( World world, BlockCoord pos, int side ) - { - pos = pos.copy().offset( side ); - if( !world.isSideSolid( pos.x, pos.y, pos.z, ForgeDirection.getOrientation( side ) ) ) - { - return null; - } - - return new QuartzTorchPart( side ); - } - - @Override - public boolean doesTick() - { - return false; - } - - @Override - public String getType() - { - return PartRegistry.QuartzTorchPart.getName(); - } - - @Override - public Cuboid6 getBounds() - { - return this.getBounds( this.meta ); - } - - public Cuboid6 getBounds( int meta ) - { - ForgeDirection up = ForgeDirection.getOrientation( meta ); - double xOff = -0.3 * up.offsetX; - double yOff = -0.3 * up.offsetY; - double zOff = -0.3 * up.offsetZ; - return new Cuboid6( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ); - } - - @Override - public int sideForMeta( int meta ) - { - return ForgeDirection.getOrientation( meta ).getOpposite().ordinal(); - } - - @Override - public void randomDisplayTick( Random r ) - { - this.getBlock().randomDisplayTick( this.world(), this.x(), this.y(), this.z(), r ); - } - - @Override - public Block getBlock() - { - for( Block torchBlock : AEApi.instance().definitions().blocks().quartzTorch().maybeBlock().asSet() ) - { - return torchBlock; - } - - throw new MissingDefinition( "Tried to retrieve a quartz torch, even though it is disabled." ); - } -} \ No newline at end of file diff --git a/src/main/java/appeng/helpers/DualityInterface.java b/src/main/java/appeng/helpers/DualityInterface.java index 9d977a8c7..05cad774b 100644 --- a/src/main/java/appeng/helpers/DualityInterface.java +++ b/src/main/java/appeng/helpers/DualityInterface.java @@ -106,26 +106,26 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn public static final int NUMBER_OF_PATTERN_SLOTS = 9; private static final Collection BAD_BLOCKS = new HashSet( 100 ); - final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - final IAEItemStack[] requireWork = { null, null, null, null, null, null, null, null, null }; - final MultiCraftingTracker craftingTracker; - final AENetworkProxy gridProxy; - final IInterfaceHost iHost; - final BaseActionSource mySource; - final BaseActionSource interfaceRequestSource; - final ConfigManager cm = new ConfigManager( this ); - final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS ); - final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS ); - final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS ); - final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage ); - final MEMonitorPassThrough items = new MEMonitorPassThrough( new NullInventory(), StorageChannel.ITEMS ); - final MEMonitorPassThrough fluids = new MEMonitorPassThrough( new NullInventory(), StorageChannel.FLUIDS ); + private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; + private final IAEItemStack[] requireWork = { null, null, null, null, null, null, null, null, null }; + private final MultiCraftingTracker craftingTracker; + private final AENetworkProxy gridProxy; + private final IInterfaceHost iHost; + private final BaseActionSource mySource; + private final BaseActionSource interfaceRequestSource; + private final ConfigManager cm = new ConfigManager( this ); + private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS ); + private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS ); + private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS ); + private final WrapperInvSlot slotInv = new WrapperInvSlot( this.storage ); + private final MEMonitorPassThrough items = new MEMonitorPassThrough( new NullInventory(), StorageChannel.ITEMS ); + private final MEMonitorPassThrough fluids = new MEMonitorPassThrough( new NullInventory(), StorageChannel.FLUIDS ); private final UpgradeInventory upgrades; - boolean hasConfig = false; - int priority; - List craftingList = null; - List waitingToSend = null; - IMEInventory destination; + private boolean hasConfig = false; + private int priority; + private List craftingList = null; + private List waitingToSend = null; + private IMEInventory destination; private boolean isWorking = false; public DualityInterface( final AENetworkProxy networkProxy, final IInterfaceHost ih ) @@ -139,7 +139,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn this.iHost = ih; this.craftingTracker = new MultiCraftingTracker( this.iHost, 9 ); - this.mySource = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost ); + + final MachineSource actionSource = new MachineSource( this.iHost ); + this.mySource = actionSource; + this.fluids.setChangeSource( actionSource ); + this.items.setChangeSource( actionSource ); + this.interfaceRequestSource = new InterfaceRequestSource( this.iHost ); } @@ -245,7 +250,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn this.updateCraftingList(); } - public void addToSendList( final ItemStack is ) + private void addToSendList( final ItemStack is ) { if( is == null ) { @@ -313,7 +318,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn this.notifyNeighbors(); } - public void updateCraftingList() + private void updateCraftingList() { final Boolean[] accountedFor = { false, false, false, false, false, false, false, false, false }; // 9... @@ -455,7 +460,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn } } - public void addToCraftingList( final ItemStack is ) + private void addToCraftingList( final ItemStack is ) { if( is == null ) { @@ -479,7 +484,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn } } - public boolean hasItemsToSend() + private boolean hasItemsToSend() { return this.waitingToSend != null && !this.waitingToSend.isEmpty(); } @@ -556,7 +561,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.Interface.min, TickRates.Interface.max, !this.hasWorkToDo(), true ); + return new TickingRequest( TickRates.Interface.getMin(), TickRates.Interface.getMax(), !this.hasWorkToDo(), true ); } @Override @@ -788,7 +793,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn return this.items; } - public boolean hasConfig() + private boolean hasConfig() { return this.hasConfig; } @@ -886,7 +891,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn @Override public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table ) { - if( this.hasItemsToSend() || !this.gridProxy.isActive() ) + if( this.hasItemsToSend() || !this.gridProxy.isActive() || !this.craftingList.contains( patternDetails ) ) { return false; } @@ -1089,7 +1094,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn return null; } - public IPart getPart() + private IPart getPart() { return (IPart) ( this.iHost instanceof IPart ? this.iHost : null ); } @@ -1271,7 +1276,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn public InterfaceInventory( final DualityInterface tileInterface ) { super( new AdaptorIInventory( tileInterface.storage ) ); - this.mySource = new MachineSource( DualityInterface.this.iHost ); + this.setActionSource( new MachineSource( DualityInterface.this.iHost ) ); } @Override diff --git a/src/main/java/appeng/helpers/IContainerCraftingPacket.java b/src/main/java/appeng/helpers/IContainerCraftingPacket.java index ebd3eb4bc..865031299 100644 --- a/src/main/java/appeng/helpers/IContainerCraftingPacket.java +++ b/src/main/java/appeng/helpers/IContainerCraftingPacket.java @@ -43,7 +43,7 @@ public interface IContainerCraftingPacket /** * @return who are we? */ - BaseActionSource getSource(); + BaseActionSource getActionSource(); /** * @return consume items? diff --git a/src/main/java/appeng/helpers/LocationRotation.java b/src/main/java/appeng/helpers/LocationRotation.java index 9c31659e0..9a8cc8f0e 100644 --- a/src/main/java/appeng/helpers/LocationRotation.java +++ b/src/main/java/appeng/helpers/LocationRotation.java @@ -27,10 +27,10 @@ import appeng.api.util.IOrientable; public class LocationRotation implements IOrientable { - final IBlockAccess w; - final int x; - final int y; - 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 ) { diff --git a/src/main/java/appeng/helpers/MetaRotation.java b/src/main/java/appeng/helpers/MetaRotation.java index e70ea8ebc..f11ea36cc 100644 --- a/src/main/java/appeng/helpers/MetaRotation.java +++ b/src/main/java/appeng/helpers/MetaRotation.java @@ -33,9 +33,9 @@ import appeng.block.AEBaseBlock; public class MetaRotation implements IOrientable { - final boolean useFacing; - final IBlockAccess w; - final BlockPos pos; + private final boolean useFacing; + private final IBlockAccess w; + private final BlockPos pos; public MetaRotation( final IBlockAccess world, final BlockPos pos, final boolean FullFacing ) { @@ -64,18 +64,18 @@ public class MetaRotation implements IOrientable public EnumFacing getUp() { final IBlockState state = this.w.getBlockState( this.pos ); - - if ( this.useFacing ) + + if( this.useFacing ) { final EnumFacing f = state == null ? EnumFacing.UP : (EnumFacing) state.getValue( BlockTorch.FACING ); return f; } - + Axis a = state == null ? null : (Axis) state.getValue( AEBaseBlock.AXIS_ORIENTATION ); - - if ( a == null ) + + if( a == null ) a = Axis.Y; - + switch( a ) { case X: @@ -93,7 +93,7 @@ public class MetaRotation implements IOrientable { if( this.w instanceof World ) { - if ( this.useFacing ) + if( this.useFacing ) ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockTorch.FACING, up ) ); else ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( AEBaseBlock.AXIS_ORIENTATION, up.getAxis() ) ); diff --git a/src/main/java/appeng/helpers/MultiCraftingTracker.java b/src/main/java/appeng/helpers/MultiCraftingTracker.java index 290eb4761..831dfe337 100644 --- a/src/main/java/appeng/helpers/MultiCraftingTracker.java +++ b/src/main/java/appeng/helpers/MultiCraftingTracker.java @@ -174,7 +174,7 @@ public class MultiCraftingTracker } } - public int getSlot( final ICraftingLink link ) + int getSlot( final ICraftingLink link ) { if( this.links != null ) { @@ -190,7 +190,7 @@ public class MultiCraftingTracker return -1; } - public void cancel() + void cancel() { if( this.links != null ) { @@ -219,7 +219,7 @@ public class MultiCraftingTracker } } - public boolean isBusy( final int slot ) + boolean isBusy( final int slot ) { return this.getLink( slot ) != null || this.getJob( slot ) != null; } diff --git a/src/main/java/appeng/helpers/PlayerSecurityWrapper.java b/src/main/java/appeng/helpers/PlayerSecurityWrapper.java index 006b2dd1f..27889752a 100644 --- a/src/main/java/appeng/helpers/PlayerSecurityWrapper.java +++ b/src/main/java/appeng/helpers/PlayerSecurityWrapper.java @@ -30,7 +30,7 @@ import appeng.api.networking.security.ISecurityRegistry; public class PlayerSecurityWrapper implements ISecurityRegistry { - final Map> target; + private final Map> target; public PlayerSecurityWrapper( final HashMap> playerPerms ) { diff --git a/src/main/java/appeng/helpers/Splotch.java b/src/main/java/appeng/helpers/Splotch.java index ec5cb7c45..30112d135 100644 --- a/src/main/java/appeng/helpers/Splotch.java +++ b/src/main/java/appeng/helpers/Splotch.java @@ -28,9 +28,9 @@ import appeng.api.util.AEColor; public class Splotch { - public final EnumFacing side; - public final boolean lumen; - public final AEColor color; + 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 Vec3 position ) @@ -72,7 +72,7 @@ public class Splotch this.pos = data.readByte(); final int val = data.readByte(); - this.side = EnumFacing.VALUES[ val & 0x07 ]; + this.side = EnumFacing.VALUES[val & 0x07]; this.color = AEColor.values()[( val >> 3 ) & 0x0F]; this.lumen = ( ( val >> 7 ) & 0x01 ) > 0; } @@ -80,7 +80,7 @@ public class Splotch public void writeToStream( final ByteBuf stream ) { stream.writeByte( this.pos ); - final int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 ); + final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 ); stream.writeByte( val ); } @@ -96,7 +96,22 @@ public class Splotch public int getSeed() { - final int val = this.side.ordinal() | ( this.color.ordinal() << 3 ) | ( this.lumen ? 0x80 : 0x00 ); + 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; + } } diff --git a/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java b/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java index 44d7d57af..c075be632 100644 --- a/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java +++ b/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java @@ -54,16 +54,16 @@ import appeng.tile.networking.TileWireless; public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware { - public final ItemStack effectiveItem; - final IWirelessTermHandler wth; - final String encryptionKey; - final EntityPlayer myPlayer; - IGrid targetGrid; - IStorageGrid sg; - IMEMonitor itemStorage; - IWirelessAccessPoint myWap; - double sqRange = Double.MAX_VALUE; - double myRange = Double.MAX_VALUE; + private final ItemStack effectiveItem; + private final IWirelessTermHandler wth; + private final String encryptionKey; + private final EntityPlayer myPlayer; + private IGrid targetGrid; + private IStorageGrid sg; + private IMEMonitor 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 ) diff --git a/src/main/java/appeng/hooks/CompassManager.java b/src/main/java/appeng/hooks/CompassManager.java index 9b26f5497..8c7e04362 100644 --- a/src/main/java/appeng/hooks/CompassManager.java +++ b/src/main/java/appeng/hooks/CompassManager.java @@ -30,7 +30,7 @@ public class CompassManager { public static final CompassManager INSTANCE = new CompassManager(); - final HashMap requests = new HashMap(); + private final HashMap requests = new HashMap(); public void postResult( final long attunement, final int x, final int y, final int z, final CompassResult result ) { @@ -46,7 +46,7 @@ public class CompassManager while( i.hasNext() ) { final CompassResult res = i.next(); - final long diff = now - res.time; + final long diff = now - res.getTime(); if( diff > 20000 ) { i.remove(); @@ -62,11 +62,11 @@ public class CompassManager this.requests.put( r, res ); this.requestUpdate( r ); } - else if( now - res.time > 1000 * 3 ) + else if( now - res.getTime() > 1000 * 3 ) { - if( !res.requested ) + if( !res.isRequested() ) { - res.requested = true; + res.setRequested( true ); this.requestUpdate( r ); } } @@ -79,15 +79,14 @@ public class CompassManager NetworkHandler.instance.sendToServer( new PacketCompassRequest( r.attunement, r.cx, r.cz, r.cdy ) ); } - static class CompassRequest + private static class CompassRequest { - final int hash; - - final long attunement; - final int cx; - final int cdy; - final int cz; + private final int hash; + private final long attunement; + private final int cx; + private final int cdy; + private final int cz; public CompassRequest( final long attunement, final int x, final int y, final int z ) { diff --git a/src/main/java/appeng/hooks/CompassResult.java b/src/main/java/appeng/hooks/CompassResult.java index 89f047d46..53c0982cb 100644 --- a/src/main/java/appeng/hooks/CompassResult.java +++ b/src/main/java/appeng/hooks/CompassResult.java @@ -22,12 +22,11 @@ package appeng.hooks; public class CompassResult { - public final boolean hasResult; - public final boolean spin; - public final double rad; - public final long time; - - public boolean requested = false; + private final boolean hasResult; + private final boolean spin; + private final double rad; + private final long time; + private boolean requested = false; public CompassResult( final boolean hasResult, final boolean spin, final double rad ) { @@ -36,4 +35,34 @@ public class CompassResult this.rad = rad; this.time = System.currentTimeMillis(); } + + public boolean isValidResult() + { + return this.hasResult; + } + + public boolean isSpin() + { + return this.spin; + } + + public double getRad() + { + return this.rad; + } + + boolean isRequested() + { + return this.requested; + } + + void setRequested( final boolean requested ) + { + this.requested = requested; + } + + long getTime() + { + return this.time; + } } diff --git a/src/main/java/appeng/hooks/TickHandler.java b/src/main/java/appeng/hooks/TickHandler.java index 98856eb22..b75ad6f6e 100644 --- a/src/main/java/appeng/hooks/TickHandler.java +++ b/src/main/java/appeng/hooks/TickHandler.java @@ -59,14 +59,14 @@ public class TickHandler { public static final TickHandler INSTANCE = new TickHandler(); - final Queue> serverQueue = new LinkedList>(); - final Multimap craftingJobs = LinkedListMultimap.create(); + private final Queue> serverQueue = new LinkedList>(); + private final Multimap craftingJobs = LinkedListMultimap.create(); private final WeakHashMap>> callQueue = new WeakHashMap>>(); private final HandlerRep server = new HandlerRep(); private final HandlerRep client = new HandlerRep(); private final HashMap cliPlayerColors = new HashMap(); private final HashMap srvPlayerColors = new HashMap(); - CableRenderMode crm = CableRenderMode.Standard; + private CableRenderMode crm = CableRenderMode.Standard; public HashMap getPlayerColors() { @@ -105,7 +105,7 @@ public class TickHandler } } - HandlerRep getRepo() + private HandlerRep getRepo() { if( Platform.isServer() ) { @@ -302,14 +302,14 @@ public class TickHandler } } - static class HandlerRep + private static class HandlerRep { - public Queue tiles = new LinkedList(); + private Queue tiles = new LinkedList(); - public Collection networks = new NetworkList(); + private Collection networks = new NetworkList(); - public void clear() + private void clear() { this.tiles = new LinkedList(); this.networks = new NetworkList(); @@ -321,8 +321,8 @@ public class TickHandler { public final AEColor myColor; - protected final int myEntity; - protected int ticksLeft; + private final int myEntity; + private int ticksLeft; public PlayerColor( final int id, final AEColor col, final int ticks ) { diff --git a/src/main/java/appeng/integration/IntegrationNode.java b/src/main/java/appeng/integration/IntegrationNode.java index c19ef32d9..8b9dee0c4 100644 --- a/src/main/java/appeng/integration/IntegrationNode.java +++ b/src/main/java/appeng/integration/IntegrationNode.java @@ -31,16 +31,16 @@ import appeng.core.AELog; public final class IntegrationNode { - final String displayName; - final String modID; - final IntegrationType shortName; - IntegrationStage state = IntegrationStage.PRE_INIT; - IntegrationStage failedStage = IntegrationStage.PRE_INIT; - Throwable exception = null; - String name = null; - Class classValue = null; - Object instance; - IIntegrationModule mod = null; + private final String displayName; + private final String modID; + private final IntegrationType shortName; + private IntegrationStage state = IntegrationStage.PRE_INIT; + private IntegrationStage failedStage = IntegrationStage.PRE_INIT; + private Throwable exception = null; + private String name = null; + private Class classValue = null; + private Object instance; + private IIntegrationModule mod = null; public IntegrationNode( final String displayName, final String modID, final IntegrationType shortName, final String name ) { @@ -53,24 +53,24 @@ public final class IntegrationNode @Override public String toString() { - return this.shortName.name() + ':' + this.state.name(); + return this.getShortName().name() + ':' + this.getState().name(); } - public boolean isActive() + boolean isActive() { - if( this.state == IntegrationStage.PRE_INIT ) + if( this.getState() == IntegrationStage.PRE_INIT ) { this.call( IntegrationStage.PRE_INIT ); } - return this.state != IntegrationStage.FAILED; + return this.getState() != IntegrationStage.FAILED; } void call( final IntegrationStage stage ) { - if( this.state != IntegrationStage.FAILED ) + if( this.getState() != IntegrationStage.FAILED ) { - if( this.state.ordinal() > stage.ordinal() ) + if( this.getState().ordinal() > stage.ordinal() ) { return; } @@ -100,24 +100,24 @@ public final class IntegrationNode this.classValue = this.getClass().getClassLoader().loadClass( this.name ); this.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance(); final Field f = this.classValue.getField( "instance" ); - f.set( this.classValue, this.instance = this.mod ); + f.set( this.classValue, this.setInstance( this.mod ) ); } else { throw new ModNotInstalled( this.modID ); } - this.state = IntegrationStage.INIT; + this.setState( IntegrationStage.INIT ); break; case INIT: this.mod.init(); - this.state = IntegrationStage.POST_INIT; + this.setState( IntegrationStage.POST_INIT ); break; case POST_INIT: this.mod.postInit(); - this.state = IntegrationStage.READY; + this.setState( IntegrationStage.READY ); break; case FAILED: @@ -129,13 +129,13 @@ public final class IntegrationNode { this.failedStage = stage; this.exception = t; - this.state = IntegrationStage.FAILED; + this.setState( IntegrationStage.FAILED ); } } if( stage == IntegrationStage.POST_INIT ) { - if( this.state == IntegrationStage.FAILED ) + if( this.getState() == IntegrationStage.FAILED ) { AELog.info( this.displayName + " - Integration Disabled" ); if( !( this.exception instanceof ModNotInstalled ) ) @@ -149,4 +149,30 @@ public final class IntegrationNode } } } + + Object getInstance() + { + return this.instance; + } + + private Object setInstance( final Object instance ) + { + this.instance = instance; + return instance; + } + + IntegrationType getShortName() + { + return this.shortName; + } + + IntegrationStage getState() + { + return this.state; + } + + private void setState( final IntegrationStage state ) + { + this.state = state; + } } diff --git a/src/main/java/appeng/integration/IntegrationRegistry.java b/src/main/java/appeng/integration/IntegrationRegistry.java index 2bbd9b15b..12af6f344 100644 --- a/src/main/java/appeng/integration/IntegrationRegistry.java +++ b/src/main/java/appeng/integration/IntegrationRegistry.java @@ -83,7 +83,7 @@ public enum IntegrationRegistry builder.append( ", " ); } - final String integrationState = node.shortName + ":" + ( node.state == IntegrationStage.FAILED ? "OFF" : "ON" ); + final String integrationState = node.getShortName() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" ); builder.append( integrationState ); } @@ -94,7 +94,7 @@ public enum IntegrationRegistry { for( final IntegrationNode node : this.modules ) { - if( node.shortName == name ) + if( node.getShortName() == name ) { return node.isActive(); } @@ -107,9 +107,9 @@ public enum IntegrationRegistry { for( final IntegrationNode node : this.modules ) { - if( node.shortName == name && node.isActive() ) + if( node.getShortName() == name && node.isActive() ) { - return node.instance; + return node.getInstance(); } } diff --git a/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java b/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java index 9015c0313..dbc1cfba1 100644 --- a/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java +++ b/src/main/java/appeng/integration/modules/BCHelpers/BCPipeInventory.java @@ -35,8 +35,8 @@ import appeng.integration.abstraction.IBuildCraftTransport; public class BCPipeInventory implements IMEInventory { - final TileEntity te; - final ForgeDirection direction; + private final TileEntity te; + private final ForgeDirection direction; public BCPipeInventory( TileEntity te, ForgeDirection direction ) { diff --git a/src/main/java/appeng/integration/modules/BetterStorage.java b/src/main/java/appeng/integration/modules/BetterStorage.java index a94401a2b..358ff1116 100644 --- a/src/main/java/appeng/integration/modules/BetterStorage.java +++ b/src/main/java/appeng/integration/modules/BetterStorage.java @@ -52,7 +52,7 @@ public class BetterStorage implements IIntegrationModule, IBetterStorage { if( te instanceof ICrateStorage ) { - return new BSCrateStorageAdaptor( te, d ); + return new BSCrateStorageAdaptor( te ); } return null; } diff --git a/src/main/java/appeng/integration/modules/FMP.java b/src/main/java/appeng/integration/modules/FMP.java index 3183b9b29..fc0104e91 100644 --- a/src/main/java/appeng/integration/modules/FMP.java +++ b/src/main/java/appeng/integration/modules/FMP.java @@ -192,7 +192,7 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF TMultiPart p = i.next(); if( p instanceof CableBusPart ) { - return ( (CableBusPart) p ).cb; + return ( (CableBusPart) p ).getCableBus(); } } } diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java index 7742cb43c..867003135 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapedRecipeHandler.java @@ -177,7 +177,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); } - public boolean isRecipe2x2( int recipe ) + private boolean isRecipe2x2( final int recipe ) { for( PositionedStack stack : this.getIngredientStacks( recipe ) ) { @@ -195,11 +195,11 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler return NEIClientUtils.translate( "recipe.shaped" ); } - public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe + private class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe { - public final List ingredients; - public final PositionedStack result; + private final List ingredients; + private final PositionedStack result; public CachedShapedRecipe( ShapedRecipe recipe ) { @@ -208,7 +208,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler this.setIngredients( recipe.getWidth(), recipe.getHeight(), recipe.getIngredients() ); } - public void setIngredients( int width, int height, Object[] items ) + private void setIngredients( final int width, final int height, final Object[] items ) { boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI(); for( int x = 0; x < width; x++ ) @@ -251,7 +251,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients ); } - public void computeVisuals() + private void computeVisuals() { for( PositionedStack p : this.ingredients ) { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java index 6430f9334..a56f86d42 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIAEShapelessRecipeHandler.java @@ -177,7 +177,11 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); } +<<<<<<< HEAD public boolean isRecipe2x2( int recipe ) +======= + private boolean isRecipe2x2( final int recipe ) +>>>>>>> 500fc47... Reduces visibility of internal fields/methods { for( PositionedStack stack : this.getIngredientStacks( recipe ) ) { @@ -195,11 +199,11 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler return NEIClientUtils.translate( "recipe.shapeless" ); } - public class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe + private class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe { - public final List ingredients; - public final PositionedStack result; + private final List ingredients; + private final PositionedStack result; public CachedShapelessRecipe( ShapelessRecipe recipe ) { @@ -220,7 +224,11 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients ); } +<<<<<<< HEAD public void setIngredients( Object[] items ) +======= + private void setIngredients( final Object[] items ) +>>>>>>> 500fc47... Reduces visibility of internal fields/methods { boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI(); for( int x = 0; x < 3; x++ ) @@ -251,7 +259,7 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler } } - public void computeVisuals() + private void computeVisuals() { for( PositionedStack p : this.ingredients ) { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java index 6d7f35627..a4664a25e 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEICraftingHandler.java @@ -44,13 +44,11 @@ import appeng.util.Platform; public class NEICraftingHandler implements IOverlayHandler { - final int offsetX; - final int offsetY; + private final int offsetX; + private final int offsetY; - public NEICraftingHandler( int x, int y ) + public NEICraftingHandler( final int x, final int y ) { - this.offsetX = x; - this.offsetY = y; } @Override @@ -69,7 +67,7 @@ public class NEICraftingHandler implements IOverlayHandler } } - public void overlayRecipe( GuiContainer gui, List ingredients, boolean shift ) + private void overlayRecipe( GuiContainer gui, List ingredients, boolean shift ) { try { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java index b44f18505..ddf94f533 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java @@ -46,8 +46,8 @@ import appeng.items.parts.ItemFacade; public class NEIFacadeRecipeHandler extends TemplateRecipeHandler { - final ItemFacade facade; - final IItemDefinition anchorDefinition; + private final ItemFacade facade; + private final IItemDefinition anchorDefinition; public NEIFacadeRecipeHandler() { @@ -176,7 +176,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler return RecipeInfo.getOverlayHandler( gui, "crafting2x2" ); } - public boolean isRecipe2x2( int recipe ) + private boolean isRecipe2x2( final int recipe ) { for( PositionedStack stack : this.getIngredientStacks( recipe ) ) { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java index 6d0cce640..68116e3ed 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java @@ -183,12 +183,12 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler return GuiText.GrindStone.getLocal(); } - public class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe + private class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe { - public final List ingredients; - public final PositionedStack result; - public String displayChance; - boolean hasOptional = false; + private final List ingredients; + private final PositionedStack result; + private String displayChance; + private boolean hasOptional = false; public CachedGrindStoneRecipe( IGrinderEntry recipe ) { @@ -231,7 +231,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients ); } - public void computeVisuals() + private void computeVisuals() { for( PositionedStack p : this.ingredients ) { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java index a9bedb1b7..baa955dfd 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIInscriberRecipeHandler.java @@ -160,11 +160,11 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler return GuiText.Inscriber.getLocal(); } - public class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe + private class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe { - public final List ingredients; - public final PositionedStack result; + private final List ingredients; + private final PositionedStack result; public CachedInscriberRecipe( IInscriberRecipe recipe ) { @@ -196,7 +196,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients ); } - public void computeVisuals() + private void computeVisuals() { for( PositionedStack p : this.ingredients ) { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java index e953d2093..b8d8c3990 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIWorldCraftingHandler.java @@ -181,7 +181,7 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler return this; } - public NEIWorldCraftingHandler newInstance() + private NEIWorldCraftingHandler newInstance() { try { diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java b/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java index fd241d450..eb86e0a65 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/TerminalCraftingSlotFinder.java @@ -37,8 +37,8 @@ public class TerminalCraftingSlotFinder implements IStackPositioner { if( ps != null ) { - ps.relx += GuiMEMonitorable.CraftingGridOffsetX; - ps.rely += GuiMEMonitorable.CraftingGridOffsetY; + ps.relx += GuiMEMonitorable.craftingGridOffsetX; + ps.rely += GuiMEMonitorable.craftingGridOffsetY; } } return a; diff --git a/src/main/java/appeng/integration/modules/helpers/BSCrate.java b/src/main/java/appeng/integration/modules/helpers/BSCrate.java index 350967036..be8bc5b31 100644 --- a/src/main/java/appeng/integration/modules/helpers/BSCrate.java +++ b/src/main/java/appeng/integration/modules/helpers/BSCrate.java @@ -21,6 +21,10 @@ package appeng.integration.modules.helpers; import net.mcft.copy.betterstorage.api.crate.ICrateStorage; import net.minecraft.item.ItemStack; +<<<<<<< HEAD +======= + +>>>>>>> 500fc47... Reduces visibility of internal fields/methods import appeng.api.config.Actionable; import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IMEInventory; @@ -34,12 +38,10 @@ import appeng.util.item.AEItemStack; public class BSCrate implements IMEInventory { private final ICrateStorage crateStorage; - private final ForgeDirection side; - public BSCrate( Object object, ForgeDirection d ) + public BSCrate( final Object object ) { this.crateStorage = (ICrateStorage) object; - this.side = d; } @Override diff --git a/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java b/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java index d8a547d14..6a0407d55 100644 --- a/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java +++ b/src/main/java/appeng/integration/modules/helpers/BSCrateHandler.java @@ -42,7 +42,7 @@ public class BSCrateHandler implements IExternalStorageHandler { if( channel == StorageChannel.ITEMS ) { - return new BSCrate( te, ForgeDirection.UNKNOWN ); + return new BSCrate( te ); } return null; } diff --git a/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java b/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java index 5a0985118..9f901ebc1 100644 --- a/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java +++ b/src/main/java/appeng/integration/modules/helpers/BSCrateStorageAdaptor.java @@ -23,6 +23,10 @@ import java.util.Iterator; import net.mcft.copy.betterstorage.api.crate.ICrateStorage; import net.minecraft.item.ItemStack; +<<<<<<< HEAD +======= + +>>>>>>> 500fc47... Reduces visibility of internal fields/methods import appeng.api.config.FuzzyMode; import appeng.api.util.ForgeDirection; import appeng.util.InventoryAdaptor; @@ -35,13 +39,11 @@ import appeng.util.iterators.StackToSlotIterator; public class BSCrateStorageAdaptor extends InventoryAdaptor { - final ICrateStorage cs; - final ForgeDirection side; + private final ICrateStorage cs; - public BSCrateStorageAdaptor( Object te, ForgeDirection d ) + public BSCrateStorageAdaptor( final Object te ) { this.cs = (ICrateStorage) te; - this.side = d; } @Override diff --git a/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java b/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java index 912de2564..665c0f667 100644 --- a/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java +++ b/src/main/java/appeng/integration/modules/helpers/FMPPacketEvent.java @@ -26,10 +26,15 @@ import net.minecraftforge.fml.common.eventhandler.Event; public class FMPPacketEvent extends Event { - public final EntityPlayerMP sender; + private final EntityPlayerMP sender; public FMPPacketEvent( EntityPlayerMP sender ) { this.sender = sender; } + + public EntityPlayerMP getSender() + { + return this.sender; + } } diff --git a/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java b/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java index 13a74fb43..c881e493f 100644 --- a/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java +++ b/src/main/java/appeng/integration/modules/helpers/FactorizationBarrel.java @@ -35,7 +35,7 @@ import appeng.util.item.AEItemStack; public class FactorizationBarrel implements IMEInventory { - final IFZ fProxy; + private final IFZ fProxy; private final TileEntity te; public FactorizationBarrel( IFZ proxy, TileEntity tile ) @@ -102,12 +102,12 @@ public class FactorizationBarrel implements IMEInventory return input; } - public long remainingItemTypes() + private long remainingItemTypes() { return this.fProxy.barrelGetItem( this.te ) == null ? 1 : 0; } - public boolean containsItemType( IAEItemStack i, boolean acceptEmpty ) + private boolean containsItemType( final IAEItemStack i, final boolean acceptEmpty ) { ItemStack currentItem = this.fProxy.barrelGetItem( this.te ); @@ -120,7 +120,7 @@ public class FactorizationBarrel implements IMEInventory return i.equals( currentItem ); } - public long storedItemCount() + private long storedItemCount() { return this.fProxy.barrelGetItemCount( this.te ); } diff --git a/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java b/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java index b0acfb729..f4b720f78 100644 --- a/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java +++ b/src/main/java/appeng/integration/modules/helpers/MinefactoryReloadedDeepStorageUnit.java @@ -36,12 +36,10 @@ import appeng.util.item.AEItemStack; public class MinefactoryReloadedDeepStorageUnit implements IMEInventory { - final IDeepStorageUnit dsu; - final TileEntity te; + private final IDeepStorageUnit dsu; public MinefactoryReloadedDeepStorageUnit( TileEntity ta ) { - this.te = ta; this.dsu = (IDeepStorageUnit) ta; } diff --git a/src/main/java/appeng/items/contents/CellConfig.java b/src/main/java/appeng/items/contents/CellConfig.java index afb4d93b3..1ec329820 100644 --- a/src/main/java/appeng/items/contents/CellConfig.java +++ b/src/main/java/appeng/items/contents/CellConfig.java @@ -27,7 +27,7 @@ import appeng.util.Platform; public class CellConfig extends AppEngInternalInventory { - final ItemStack is; + private final ItemStack is; public CellConfig( final ItemStack is ) { diff --git a/src/main/java/appeng/items/contents/CellUpgrades.java b/src/main/java/appeng/items/contents/CellUpgrades.java index a830dc99a..0f60d3b48 100644 --- a/src/main/java/appeng/items/contents/CellUpgrades.java +++ b/src/main/java/appeng/items/contents/CellUpgrades.java @@ -26,7 +26,7 @@ import appeng.util.Platform; public final class CellUpgrades extends StackUpgradeInventory { - final ItemStack is; + private final ItemStack is; public CellUpgrades( final ItemStack is, final int upgrades ) { diff --git a/src/main/java/appeng/items/contents/NetworkToolViewer.java b/src/main/java/appeng/items/contents/NetworkToolViewer.java index be0e9c5da..0f9f33c29 100644 --- a/src/main/java/appeng/items/contents/NetworkToolViewer.java +++ b/src/main/java/appeng/items/contents/NetworkToolViewer.java @@ -32,9 +32,9 @@ import appeng.util.Platform; public class NetworkToolViewer implements INetworkTool { - final AppEngInternalInventory inv; - final ItemStack is; - final IGridHost gh; + private final AppEngInternalInventory inv; + private final ItemStack is; + private final IGridHost gh; public NetworkToolViewer( final ItemStack is, final IGridHost gHost ) { diff --git a/src/main/java/appeng/items/contents/QuartzKnifeObj.java b/src/main/java/appeng/items/contents/QuartzKnifeObj.java index 380e42ab6..bac29207a 100644 --- a/src/main/java/appeng/items/contents/QuartzKnifeObj.java +++ b/src/main/java/appeng/items/contents/QuartzKnifeObj.java @@ -26,7 +26,7 @@ import appeng.api.implementations.guiobjects.IGuiItemObject; public class QuartzKnifeObj implements IGuiItemObject { - final ItemStack is; + private final ItemStack is; public QuartzKnifeObj( final ItemStack o ) { diff --git a/src/main/java/appeng/items/materials/MaterialType.java b/src/main/java/appeng/items/materials/MaterialType.java index e7f6c3692..ffd5b50c7 100644 --- a/src/main/java/appeng/items/materials/MaterialType.java +++ b/src/main/java/appeng/items/materials/MaterialType.java @@ -118,31 +118,31 @@ public enum MaterialType private final EnumSet features; // TextureAtlasSprite for the material. @SideOnly( Side.CLIENT ) - public TextureAtlasSprite IIcon; - public Item itemInstance; - public int damageValue; + private TextureAtlasSprite IIcon; + private Item itemInstance; + private int damageValue; // stack! - public MaterialStackSrc stackSrc; + private MaterialStackSrc stackSrc; private String oreName; private Class droppedEntity; private boolean isRegistered = false; MaterialType( final int metaValue ) { - this.damageValue = metaValue; + this.setDamageValue( metaValue ); this.features = EnumSet.of( AEFeature.Core ); } MaterialType( final int metaValue, final AEFeature part ) { - this.damageValue = metaValue; + this.setDamageValue( metaValue ); this.features = EnumSet.of( part ); } MaterialType( final int metaValue, final AEFeature part, final Class c ) { this.features = EnumSet.of( part ); - this.damageValue = metaValue; + this.setDamageValue( metaValue ); this.droppedEntity = c; EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true ); @@ -151,7 +151,7 @@ public enum MaterialType MaterialType( final int metaValue, final AEFeature part, final String oreDictionary, final Class c ) { this.features = EnumSet.of( part ); - this.damageValue = metaValue; + this.setDamageValue( metaValue ); this.oreName = oreDictionary; this.droppedEntity = c; EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true ); @@ -160,16 +160,16 @@ public enum MaterialType MaterialType( final int metaValue, final AEFeature part, final String oreDictionary ) { this.features = EnumSet.of( part ); - this.damageValue = metaValue; + this.setDamageValue( metaValue ); this.oreName = oreDictionary; } public ItemStack stack( final int size ) { - return new ItemStack( this.itemInstance, size, this.damageValue ); + return new ItemStack( this.getItemInstance(), size, this.getDamageValue() ); } - public EnumSet getFeature() + EnumSet getFeature() { return this.features; } @@ -179,12 +179,12 @@ public enum MaterialType return this.oreName; } - public boolean hasCustomEntity() + boolean hasCustomEntity() { return this.droppedEntity != null; } - public Class getCustomEntityClass() + Class getCustomEntityClass() { return this.droppedEntity; } @@ -194,9 +194,49 @@ public enum MaterialType return this.isRegistered; } - public void markReady() + void markReady() { this.isRegistered = true; } + public int getDamageValue() + { + return this.damageValue; + } + + void setDamageValue( final int damageValue ) + { + this.damageValue = damageValue; + } + + public Item getItemInstance() + { + return this.itemInstance; + } + + void setItemInstance( final Item itemInstance ) + { + this.itemInstance = itemInstance; + } + + TextureAtlasSprite getIIcon() + { + return this.IIcon; + } + + void setIIcon( final TextureAtlasSprite iIcon ) + { + this.IIcon = iIcon; + } + + MaterialStackSrc getStackSrc() + { + return this.stackSrc; + } + + void setStackSrc( final MaterialStackSrc stackSrc ) + { + this.stackSrc = stackSrc; + } + } diff --git a/src/main/java/appeng/items/materials/MultiItem.java b/src/main/java/appeng/items/materials/MultiItem.java index d4f2804e9..1d2985c87 100644 --- a/src/main/java/appeng/items/materials/MultiItem.java +++ b/src/main/java/appeng/items/materials/MultiItem.java @@ -71,9 +71,10 @@ import appeng.util.Platform; public final class MultiItem extends AEBaseItem implements IStorageComponent, IUpgradeModule { - public static final int KILO_SCALAR = 1024; public static MultiItem instance; + private static final int KILO_SCALAR = 1024; + private final Map dmgToMaterial = new HashMap(); public MultiItem() @@ -146,7 +147,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU { if( type != MaterialType.InvalidType ) { - proxy.setIcon( this, type.damageValue, name + "." + type.name() ); + proxy.setIcon( this, type.getDamageValue(), name + "." + type.name() ); } } } @@ -193,13 +194,13 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU enabled = enabled && AEConfig.instance.isFeatureEnabled( f ); } - mat.stackSrc = new MaterialStackSrc( mat ); + mat.setStackSrc( new MaterialStackSrc( mat ) ); if( enabled ) { - mat.itemInstance = this; + mat.setItemInstance( this ); mat.markReady(); - final int newMaterialNum = mat.damageValue; + final int newMaterialNum = mat.getDamageValue(); if( this.dmgToMaterial.get( newMaterialNum ) == null ) { @@ -212,7 +213,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU } } - return mat.stackSrc; + return mat.getStackSrc(); } public void makeUnique() @@ -256,13 +257,13 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU } else { - if( mt.itemInstance == this ) + if( mt.getItemInstance() == this ) { - this.dmgToMaterial.remove( mt.damageValue ); + this.dmgToMaterial.remove( mt.getDamageValue() ); } - mt.itemInstance = replacement.getItem(); - mt.damageValue = replacement.getItemDamage(); + mt.setItemInstance( replacement.getItem() ); + mt.setDamageValue( replacement.getItemDamage() ); } } } @@ -290,9 +291,9 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU for( final MaterialType mat : types ) { - if( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this ) + if( mat.getDamageValue() >= 0 && mat.isRegistered() && mat.getItemInstance() == this ) { - itemStacks.add( new ItemStack( this, 1, mat.damageValue ) ); + itemStacks.add( new ItemStack( this, 1, mat.getDamageValue() ) ); } } } diff --git a/src/main/java/appeng/items/misc/ItemCrystalSeed.java b/src/main/java/appeng/items/misc/ItemCrystalSeed.java index 4052b317d..d12ff49ae 100644 --- a/src/main/java/appeng/items/misc/ItemCrystalSeed.java +++ b/src/main/java/appeng/items/misc/ItemCrystalSeed.java @@ -57,17 +57,17 @@ import appeng.util.Platform; public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal { - public static final int LEVEL_OFFSET = 200; - public static final int SINGLE_OFFSET = LEVEL_OFFSET * 3; + private static final int LEVEL_OFFSET = 200; + private static final int SINGLE_OFFSET = LEVEL_OFFSET * 3; public static final int CERTUS = 0; public static final int NETHER = SINGLE_OFFSET; public static final int FLUIX = SINGLE_OFFSET * 2; public static final int FINAL_STAGE = SINGLE_OFFSET * 3; - final ModelResourceLocation[] certus = new ModelResourceLocation[3]; - final ModelResourceLocation[] fluix = new ModelResourceLocation[3]; - final ModelResourceLocation[] nether = new ModelResourceLocation[3]; + private final ModelResourceLocation[] certus = new ModelResourceLocation[3]; + private final ModelResourceLocation[] fluix = new ModelResourceLocation[3]; + private final ModelResourceLocation[] nether = new ModelResourceLocation[3]; public ItemCrystalSeed() { @@ -78,10 +78,10 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal } @Override - @SideOnly(Side.CLIENT) + @SideOnly( Side.CLIENT ) public void registerIcons( final ClientHelper ir, final String name ) { - final String preFix = name+"."; + final String preFix = name + "."; this.certus[0] = ir.setIcon( this, preFix + "Certus" ); this.certus[1] = ir.setIcon( this, preFix + "Certus2" ); @@ -94,9 +94,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal this.fluix[0] = ir.setIcon( this, preFix + "Fluix" ); this.fluix[1] = ir.setIcon( this, preFix + "Fluix2" ); this.fluix[2] = ir.setIcon( this, preFix + "Fluix3" ); - + Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this, new ItemMeshDefinition(){ - + @Override public ModelResourceLocation getModelLocation( final ItemStack stack ) @@ -139,9 +139,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal return list[2]; } } - }); + } ); } - + @Nullable public static ResolverResult getResolver( final int certus2 ) { diff --git a/src/main/java/appeng/items/misc/ItemEncodedPattern.java b/src/main/java/appeng/items/misc/ItemEncodedPattern.java index 81089fc3b..d80da2f4b 100644 --- a/src/main/java/appeng/items/misc/ItemEncodedPattern.java +++ b/src/main/java/appeng/items/misc/ItemEncodedPattern.java @@ -54,18 +54,18 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt // rather simple client side caching. private static final Map SIMPLE_CACHE = new WeakHashMap(); + @SideOnly( Side.CLIENT ) + private ModelResourceLocation res; + + @SideOnly( Side.CLIENT ) + private ModelResourceLocation encodedPatternModel; // TODO: make encoded pattern model! + public ItemEncodedPattern() { this.setFeature( EnumSet.of( AEFeature.Patterns ) ); this.setMaxStackSize( 1 ); } - @SideOnly(Side.CLIENT) - ModelResourceLocation res; - - @SideOnly(Side.CLIENT) - ModelResourceLocation encodedPatternModel; // TODO: make encoded pattern model! - @Override public void registerIcons( final ClientHelper proxy, @@ -74,34 +74,34 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt this.encodedPatternModel = this.res = proxy.setIcon( this, name ); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this, new ItemMeshDefinition(){ - + boolean recursive = false; - + @Override public ModelResourceLocation getModelLocation( final ItemStack stack ) { - if ( this.recursive == false ) + if( this.recursive == false ) { this.recursive = true; - + final ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem(); - + final ItemStack is = iep.getOutput( stack ); - if ( Minecraft.getMinecraft().thePlayer.isSneaking() ) + if( Minecraft.getMinecraft().thePlayer.isSneaking() ) { return ItemEncodedPattern.this.encodedPatternModel; } - + this.recursive = false; } - + return ItemEncodedPattern.this.res; } - }); + } ); } - + @Override public ItemStack onItemRightClick( final ItemStack stack, final World w, final EntityPlayer player ) { diff --git a/src/main/java/appeng/items/misc/ItemPaintBall.java b/src/main/java/appeng/items/misc/ItemPaintBall.java index dab8bd225..83c4f7313 100644 --- a/src/main/java/appeng/items/misc/ItemPaintBall.java +++ b/src/main/java/appeng/items/misc/ItemPaintBall.java @@ -40,7 +40,7 @@ import appeng.items.AEBaseItem; public class ItemPaintBall extends AEBaseItem { - public static final int DAMAGE_THRESHOLD = 20; + private static final int DAMAGE_THRESHOLD = 20; public ItemPaintBall() { @@ -76,7 +76,7 @@ public class ItemPaintBall extends AEBaseItem return super.getItemStackDisplayName( is ) + " - " + this.getExtraName( is ); } - public String getExtraName( final ItemStack is ) + private String getExtraName( final ItemStack is ) { return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is ); } diff --git a/src/main/java/appeng/items/parts/ItemMultiPart.java b/src/main/java/appeng/items/parts/ItemMultiPart.java index e4011d481..a1dd99717 100644 --- a/src/main/java/appeng/items/parts/ItemMultiPart.java +++ b/src/main/java/appeng/items/parts/ItemMultiPart.java @@ -132,7 +132,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType ); } - final int partDamage = mat.baseDamage + varID; + final int partDamage = mat.getBaseDamage() + varID; final ActivityState state = ActivityState.from( enabled ); final ItemStackSrc output = new ItemStackSrc( this, partDamage, state ); @@ -254,7 +254,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG } } - public String getName( final ItemStack is ) + private String getName( final ItemStack is ) { Preconditions.checkNotNull( is ); @@ -291,12 +291,12 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG try { - if( type.constructor == null ) + if( type.getConstructor() == null ) { - type.constructor = part.getConstructor( ItemStack.class ); + type.setConstructor( part.getConstructor( ItemStack.class ) ); } - return type.constructor.newInstance( is ); + return type.getConstructor().newInstance( is ); } catch( final InstantiationException e ) { diff --git a/src/main/java/appeng/items/parts/PartType.java b/src/main/java/appeng/items/parts/PartType.java index adaa1d13b..52d51383c 100644 --- a/src/main/java/appeng/items/parts/PartType.java +++ b/src/main/java/appeng/items/parts/PartType.java @@ -160,12 +160,12 @@ public enum PartType InterfaceTerminal( 480, EnumSet.of( AEFeature.InterfaceTerminal ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ); - public final int baseDamage; + private final int baseDamage; private final Set features; private final Set integrations; private final Class myPart; private final GuiText extraName; - public Constructor constructor; + private Constructor constructor; PartType( final int baseMetaValue, final Set features, final Set integrations, final Class c ) { @@ -186,24 +186,39 @@ public enum PartType return false; } - public Set getFeature() + Set getFeature() { return this.features; } - public Set getIntegrations() + Set getIntegrations() { return this.integrations; } - public Class getPart() + Class getPart() { return this.myPart; } - public GuiText getExtraName() + GuiText getExtraName() { return this.extraName; } + Constructor getConstructor() + { + return this.constructor; + } + + void setConstructor( final Constructor constructor ) + { + this.constructor = constructor; + } + + int getBaseDamage() + { + return this.baseDamage; + } + } diff --git a/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java b/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java index 8076ca19b..b3e76f4b4 100644 --- a/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java +++ b/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java @@ -181,7 +181,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag return new TransitionResult( false, 0 ); } - public World createNewWorld( final ItemStack is ) + private World createNewWorld( final ItemStack is ) { final NBTTagCompound c = Platform.openNbtData( is ); final int newDim = DimensionManager.getNextFreeDimId(); diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java index 8afc9bcaf..170e3c053 100644 --- a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java +++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java @@ -88,7 +88,7 @@ import appeng.util.item.AEItemStack; public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell, IItemGroup, IBlockTool, IMouseWheelItem { - static final Map ORE_TO_COLOR = new HashMap(); + private static final Map ORE_TO_COLOR = new HashMap(); static { @@ -229,7 +229,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe return this.getColorFromItem( this.getColor( tol ) ); } - public AEColor getColorFromItem( final ItemStack paintBall ) + private AEColor getColorFromItem( final ItemStack paintBall ) { if( paintBall == null ) { @@ -350,7 +350,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe return newColor; } - public void setColor( final ItemStack is, final ItemStack newColor ) + private void setColor( final ItemStack is, final ItemStack newColor ) { final NBTTagCompound data = Platform.openNbtData( is ); if( newColor == null ) diff --git a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java index 32a1d4702..e3e5739e0 100644 --- a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java +++ b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java @@ -143,19 +143,19 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT r = this.heatUp.get( new InWorldToolOperationIngredient( state.getBlock(), true ) ); } - if( r.BlockItem != null ) + if( r.getBlockItem() != null ) { - final Block blk = Block.getBlockFromItem( r.BlockItem.getItem() ); - w.setBlockState( pos, blk.getStateFromMeta( r.BlockItem.getItemDamage() ), 3 ); + final Block blk = Block.getBlockFromItem( r.getBlockItem().getItem() ); + w.setBlockState( pos, blk.getStateFromMeta( r.getBlockItem().getItemDamage() ), 3 ); } else { w.setBlockToAir( pos ); } - if( r.Drops != null ) + if( r.getDrops() != null ) { - Platform.spawnDrops( w, pos, r.Drops ); + Platform.spawnDrops( w, pos, r.getDrops() ); } } @@ -180,19 +180,19 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT r = this.coolDown.get( new InWorldToolOperationIngredient( state.getBlock(), true ) ); } - if( r.BlockItem != null ) + if( r.getBlockItem() != null ) { - final Block blk = Block.getBlockFromItem( r.BlockItem.getItem() ); - w.setBlockState( pos, blk.getStateFromMeta( r.BlockItem.getItemDamage() ), 3 ); + final Block blk = Block.getBlockFromItem( r.getBlockItem().getItem() ); + w.setBlockState( pos, blk.getStateFromMeta( r.getBlockItem().getItemDamage() ), 3 ); } else { w.setBlockToAir( pos ); } - if( r.Drops != null ) + if( r.getDrops() != null ) { - Platform.spawnDrops( w, pos, r.Drops ); + Platform.spawnDrops( w, pos, r.getDrops() ); } } @@ -245,7 +245,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT return item; } - + @Override public boolean onItemUse( final ItemStack item, @@ -333,19 +333,19 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) ); w.playSoundEffect( pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F ); - if( or.BlockItem == null ) + if( or.getBlockItem() == null ) { w.setBlockState( pos, Platform.AIR_BLOCK.getDefaultState(), 3 ); } else { - final Block blk = Block.getBlockFromItem( or.BlockItem.getItem() ); - w.setBlockState( pos, blk.getStateFromMeta( or.BlockItem.getItemDamage() ), 3 ); + final Block blk = Block.getBlockFromItem( or.getBlockItem().getItem() ); + w.setBlockState( pos, blk.getStateFromMeta( or.getBlockItem().getItemDamage() ), 3 ); } - if( or.Drops != null ) + if( or.getDrops() != null ) { - Platform.spawnDrops( w, pos, or.Drops ); + Platform.spawnDrops( w, pos, or.getDrops() ); } return true; diff --git a/src/main/java/appeng/items/tools/powered/ToolMassCannon.java b/src/main/java/appeng/items/tools/powered/ToolMassCannon.java index 445d12e10..d1bc07364 100644 --- a/src/main/java/appeng/items/tools/powered/ToolMassCannon.java +++ b/src/main/java/appeng/items/tools/powered/ToolMassCannon.java @@ -156,18 +156,18 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell { return item; } - + final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() ); - final Vec3 vec3 = dir.a; - final Vec3 vec31 = dir.b; + final Vec3 vec3 = dir.getA(); + final Vec3 vec31 = dir.getB(); final Vec3 direction = vec31.subtract( vec3 ); direction.normalize(); final double d0 = vec3.xCoord; final double d1 = vec3.yCoord; final double d2 = vec3.zCoord; - + final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f; if( penetration <= 0 ) { diff --git a/src/main/java/appeng/me/Grid.java b/src/main/java/appeng/me/Grid.java index 8bd513f88..066d9d552 100644 --- a/src/main/java/appeng/me/Grid.java +++ b/src/main/java/appeng/me/Grid.java @@ -71,17 +71,17 @@ public class Grid implements IGrid center.setGrid( this ); } - public int getPriority() + int getPriority() { return this.priority; } - public IGridStorage getMyStorage() + IGridStorage getMyStorage() { return this.myStorage; } - public Map, GridCacheWrapper> getCaches() + Map, GridCacheWrapper> getCaches() { return this.caches; } @@ -91,7 +91,7 @@ public class Grid implements IGrid return this.machines.keySet(); } - public int size() + int size() { int out = 0; for( final Collection x : this.machines.values() ) @@ -101,7 +101,7 @@ public class Grid implements IGrid return out; } - public void remove( final GridNode gridNode ) + void remove( final GridNode gridNode ) { for( final IGridCache c : this.caches.values() ) { @@ -134,7 +134,7 @@ public class Grid implements IGrid } } - public void add( final GridNode gridNode ) + void add( final GridNode gridNode ) { final Class mClass = gridNode.getMachineClass(); @@ -213,7 +213,7 @@ public class Grid implements IGrid @SuppressWarnings( "unchecked" ) public C getCache( final Class iface ) { - return (C) this.caches.get( iface ).myCache; + return (C) this.caches.get( iface ).getCache(); } @Override @@ -265,7 +265,7 @@ public class Grid implements IGrid return this.pivot; } - public void setPivot( final GridNode pivot ) + void setPivot( final GridNode pivot ) { this.pivot = pivot; } @@ -282,7 +282,7 @@ public class Grid implements IGrid } } - public void saveState() + void saveState() { for( final IGridCache c : this.caches.values() ) { diff --git a/src/main/java/appeng/me/GridCacheWrapper.java b/src/main/java/appeng/me/GridCacheWrapper.java index 499c3b557..2825faa45 100644 --- a/src/main/java/appeng/me/GridCacheWrapper.java +++ b/src/main/java/appeng/me/GridCacheWrapper.java @@ -28,53 +28,58 @@ import appeng.api.networking.IGridStorage; public class GridCacheWrapper implements IGridCache { - final IGridCache myCache; - final String name; + private final IGridCache myCache; + private final String name; public GridCacheWrapper( final IGridCache gc ) { this.myCache = gc; - this.name = this.myCache.getClass().getName(); + this.name = this.getCache().getClass().getName(); } @Override public void onUpdateTick() { - this.myCache.onUpdateTick(); + this.getCache().onUpdateTick(); } @Override public void removeNode( final IGridNode gridNode, final IGridHost machine ) { - this.myCache.removeNode( gridNode, machine ); + this.getCache().removeNode( gridNode, machine ); } @Override public void addNode( final IGridNode gridNode, final IGridHost machine ) { - this.myCache.addNode( gridNode, machine ); + this.getCache().addNode( gridNode, machine ); } @Override public void onSplit( final IGridStorage storageB ) { - this.myCache.onSplit( storageB ); + this.getCache().onSplit( storageB ); } @Override public void onJoin( final IGridStorage storageB ) { - this.myCache.onJoin( storageB ); + this.getCache().onJoin( storageB ); } @Override public void populateGridStorage( final IGridStorage storage ) { - this.myCache.populateGridStorage( storage ); + this.getCache().populateGridStorage( storage ); } public String getName() { return this.name; } + + IGridCache getCache() + { + return this.myCache; + } } diff --git a/src/main/java/appeng/me/GridConnection.java b/src/main/java/appeng/me/GridConnection.java index 5ab929121..399b1eefa 100644 --- a/src/main/java/appeng/me/GridConnection.java +++ b/src/main/java/appeng/me/GridConnection.java @@ -48,8 +48,8 @@ public class GridConnection implements IGridConnection, IPathItem private static final String EXISTING_CONNECTION_MESSAGE = "Connection between node [machine=%s, %s] and [machine=%s, %s] on [%s] already exists."; private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged(); - public int channelData = 0; - Object visitorIterationNumber = null; + private int channelData = 0; + private Object visitorIterationNumber = null; private GridNode sideA; private AEPartLocation fromAtoB; private GridNode sideB; @@ -67,8 +67,8 @@ public class GridConnection implements IGridConnection, IPathItem final DimensionalCoord aCoordinates = a.getGridBlock().getLocation(); final DimensionalCoord bCoordinates = b.getGridBlock().getLocation(); - AELog.info( "Security audit 1 failed at [%s] belonging to player [id=%d]", aCoordinates.toString(), a.playerID ); - AELog.info( "Security audit 2 failed at [%s] belonging to player [id=%d]", bCoordinates.toString(), b.playerID ); + AELog.info( "Security audit 1 failed at [%s] belonging to player [id=%d]", aCoordinates.toString(), a.getPlayerID() ); + AELog.info( "Security audit 2 failed at [%s] belonging to player [id=%d]", bCoordinates.toString(), b.getPlayerID() ); } throw new SecurityConnectionException(); @@ -276,8 +276,18 @@ public class GridConnection implements IGridConnection, IPathItem } } - public int getLastUsedChannels() + private int getLastUsedChannels() { return this.channelData & 0xff; } + + Object getVisitorIterationNumber() + { + return this.visitorIterationNumber; + } + + void setVisitorIterationNumber( final Object visitorIterationNumber ) + { + this.visitorIterationNumber = visitorIterationNumber; + } } diff --git a/src/main/java/appeng/me/GridNode.java b/src/main/java/appeng/me/GridNode.java index 530e7e8be..a1f58cc6c 100644 --- a/src/main/java/appeng/me/GridNode.java +++ b/src/main/java/appeng/me/GridNode.java @@ -64,9 +64,9 @@ public class GridNode implements IGridNode, IPathItem private final List connections = new LinkedList(); private final IGridBlock gridProxy; // old power draw, used to diff - public double previousDraw = 0.0; - public long lastSecurityKey = -1; - public int playerID = -1; + private double previousDraw = 0.0; + private long lastSecurityKey = -1; + private int playerID = -1; private GridStorage myStorage = null; private Grid myGrid; private Object visitorIterationNumber = null; @@ -80,12 +80,12 @@ public class GridNode implements IGridNode, IPathItem this.gridProxy = what; } - public IGridBlock getGridProxy() + IGridBlock getGridProxy() { return this.gridProxy; } - public Grid getMyGrid() + Grid getMyGrid() { return this.myGrid; } @@ -95,12 +95,12 @@ public class GridNode implements IGridNode, IPathItem return this.lastUsedChannels; } - public Class getMachineClass() + Class getMachineClass() { return this.getMachine().getClass(); } - public void addConnection( final IGridConnection gridConnection ) + void addConnection( final IGridConnection gridConnection ) { this.connections.add( gridConnection ); if( gridConnection.hasDirection() ) @@ -113,7 +113,7 @@ public class GridNode implements IGridNode, IPathItem Collections.sort( this.connections, new ConnectionComparator( gn ) ); } - public void removeConnection( final IGridConnection gridConnection ) + void removeConnection( final IGridConnection gridConnection ) { this.connections.remove( gridConnection ); if( gridConnection.hasDirection() ) @@ -122,7 +122,7 @@ public class GridNode implements IGridNode, IPathItem } } - public boolean hasConnection( final IGridNode otherSide ) + boolean hasConnection( final IGridNode otherSide ) { for( final IGridConnection gc : this.connections ) { @@ -134,11 +134,11 @@ public class GridNode implements IGridNode, IPathItem return false; } - public void validateGrid() + void validateGrid() { final GridSplitDetector gsd = new GridSplitDetector( this.getInternalGrid().getPivot() ); this.beginVisit( gsd ); - if( !gsd.pivotFound ) + if( !gsd.isPivotFound() ) { final IGridVisitor gp = new GridPropagator( new Grid( this ) ); this.beginVisit( gp ); @@ -231,7 +231,7 @@ public class GridNode implements IGridNode, IPathItem return this.myGrid; } - public void setGrid( final Grid grid ) + void setGrid( final Grid grid ) { if( this.myGrid == grid ) { @@ -329,7 +329,7 @@ public class GridNode implements IGridNode, IPathItem { final NBTTagCompound node = nodeData.getCompoundTag( name ); this.playerID = node.getInteger( "p" ); - this.lastSecurityKey = node.getLong( "k" ); + this.setLastSecurityKey( node.getLong( "k" ) ); final long storageID = node.getLong( "g" ); final GridStorage gridStorage = WorldData.instance().storageData().getGridStorage( storageID ); @@ -349,7 +349,7 @@ public class GridNode implements IGridNode, IPathItem final NBTTagCompound node = new NBTTagCompound(); node.setInteger( "p", this.playerID ); - node.setLong( "k", this.lastSecurityKey ); + node.setLong( "k", this.getLastSecurityKey() ); node.setLong( "g", this.myStorage.getID() ); nodeData.setTag( name, node ); @@ -387,12 +387,12 @@ public class GridNode implements IGridNode, IPathItem } } - public int getUsedChannels() + private int getUsedChannels() { return this.usedChannels; } - public void FindConnections() + private void FindConnections() { if( !this.gridProxy.isWorldAccessible() ) { @@ -445,7 +445,7 @@ public class GridNode implements IGridNode, IPathItem } else if( isValidConnection ) { - if( node.lastSecurityKey != -1 ) + if( node.getLastSecurityKey() != -1 ) { newSecurityConnections.add( f ); } @@ -495,7 +495,7 @@ public class GridNode implements IGridNode, IPathItem private IGridHost findGridHost( final World world, final int x, final int y, final int z ) { - final BlockPos pos = new BlockPos(x,y,z); + final BlockPos pos = new BlockPos( x, y, z ); if( world.isBlockLoaded( pos ) ) { final TileEntity te = world.getTileEntity( pos ); @@ -507,7 +507,7 @@ public class GridNode implements IGridNode, IPathItem return null; } - public boolean canConnect( final GridNode from, final AEPartLocation dir ) + private boolean canConnect( final GridNode from, final AEPartLocation dir ) { if( !this.isValidDirection( dir ) ) { @@ -527,7 +527,7 @@ public class GridNode implements IGridNode, IPathItem return ( this.compressedData & ( 1 << ( 8 + dir.ordinal() ) ) ) > 0; } - public AEColor getColor() + private AEColor getColor() { return AEColor.values()[( this.compressedData >> 3 ) & 0x1F]; } @@ -541,9 +541,9 @@ public class GridNode implements IGridNode, IPathItem final GridNode gn = (GridNode) gc.getOtherSide( this ); final GridConnection gcc = (GridConnection) gc; - if( gcc.visitorIterationNumber != tracker ) + if( gcc.getVisitorIterationNumber() != tracker ) { - gcc.visitorIterationNumber = tracker; + gcc.setVisitorIterationNumber( tracker ); nextConnections.add( gc ); } @@ -579,12 +579,12 @@ public class GridNode implements IGridNode, IPathItem } } - public GridStorage getGridStorage() + GridStorage getGridStorage() { return this.myStorage; } - public void setGridStorage( final GridStorage s ) + void setGridStorage( final GridStorage s ) { this.myStorage = s; this.usedChannels = 0; @@ -624,7 +624,7 @@ public class GridNode implements IGridNode, IPathItem return this.getUsedChannels() < this.getMaxChannels(); } - public int getMaxChannels() + private int getMaxChannels() { return CHANNEL_COUNT[this.compressedData & 0x03]; } @@ -666,11 +666,31 @@ public class GridNode implements IGridNode, IPathItem } } - public int getLastUsedChannels() + private int getLastUsedChannels() { return this.lastUsedChannels; } + public long getLastSecurityKey() + { + return this.lastSecurityKey; + } + + public void setLastSecurityKey( final long lastSecurityKey ) + { + this.lastSecurityKey = lastSecurityKey; + } + + public double getPreviousDraw() + { + return this.previousDraw; + } + + public void setPreviousDraw( final double previousDraw ) + { + this.previousDraw = previousDraw; + } + private static class MachineSecurityBreak implements IWorldCallable { private final GridNode node; @@ -681,7 +701,7 @@ public class GridNode implements IGridNode, IPathItem } @Override - public Void call( final World world) throws Exception + public Void call( final World world ) throws Exception { this.node.getMachine().securityBreak(); diff --git a/src/main/java/appeng/me/GridSplitDetector.java b/src/main/java/appeng/me/GridSplitDetector.java index d406c0058..ac0b98c7a 100644 --- a/src/main/java/appeng/me/GridSplitDetector.java +++ b/src/main/java/appeng/me/GridSplitDetector.java @@ -26,8 +26,8 @@ import appeng.api.networking.IGridVisitor; class GridSplitDetector implements IGridVisitor { - final IGridNode pivot; - boolean pivotFound; + private final IGridNode pivot; + private boolean pivotFound; public GridSplitDetector( final IGridNode pivot ) { @@ -39,9 +39,19 @@ class GridSplitDetector implements IGridVisitor { if( n == this.pivot ) { - this.pivotFound = true; + this.setPivotFound( true ); } - return !this.pivotFound; + return !this.isPivotFound(); + } + + public boolean isPivotFound() + { + return this.pivotFound; + } + + private void setPivotFound( final boolean pivotFound ) + { + this.pivotFound = pivotFound; } } diff --git a/src/main/java/appeng/me/GridStorage.java b/src/main/java/appeng/me/GridStorage.java index 20e295dc2..318e72a13 100644 --- a/src/main/java/appeng/me/GridStorage.java +++ b/src/main/java/appeng/me/GridStorage.java @@ -36,11 +36,10 @@ import appeng.core.worlddata.WorldData; public class GridStorage implements IGridStorage { - final long myID; - final NBTTagCompound data; - final GridStorageSearch mySearchEntry; // keep myself in the list until I'm + private final long myID; + private final NBTTagCompound data; + private final GridStorageSearch mySearchEntry; // keep myself in the list until I'm private final WeakHashMap divided = new WeakHashMap(); - public boolean isDirty = false; private WeakReference internalGrid = null; // lost... @@ -95,8 +94,6 @@ public class GridStorage implements IGridStorage public String getValue() { - this.isDirty = false; - final Grid currentGrid = (Grid) this.getGrid(); if( currentGrid != null ) { @@ -122,7 +119,7 @@ public class GridStorage implements IGridStorage return this.internalGrid == null ? null : this.internalGrid.get(); } - public void setGrid( final Grid grid ) + void setGrid( final Grid grid ) { this.internalGrid = new WeakReference( grid ); } @@ -139,22 +136,17 @@ public class GridStorage implements IGridStorage return this.myID; } - public void markDirty() - { - this.isDirty = true; - } - - public void addDivided( final GridStorage gs ) + void addDivided( final GridStorage gs ) { this.divided.put( gs, true ); } - public boolean hasDivided( final GridStorage myStorage ) + boolean hasDivided( final GridStorage myStorage ) { return this.divided.containsKey( myStorage ); } - public void remove() + void remove() { WorldData.instance().storageData().destroyGridStorage( this.myID ); } diff --git a/src/main/java/appeng/me/GridStorageSearch.java b/src/main/java/appeng/me/GridStorageSearch.java index a95633e4a..cd8875ca2 100644 --- a/src/main/java/appeng/me/GridStorageSearch.java +++ b/src/main/java/appeng/me/GridStorageSearch.java @@ -25,8 +25,8 @@ import java.lang.ref.WeakReference; public class GridStorageSearch { - final long id; - public WeakReference gridStorage; + private final long id; + private WeakReference gridStorage; /** * for use with the world settings @@ -64,4 +64,14 @@ public class GridStorageSearch return false; } + + public WeakReference getGridStorage() + { + return this.gridStorage; + } + + public void setGridStorage( final WeakReference gridStorage ) + { + this.gridStorage = gridStorage; + } } diff --git a/src/main/java/appeng/me/NetworkEventBus.java b/src/main/java/appeng/me/NetworkEventBus.java index 5eedb30b8..90e777b1d 100644 --- a/src/main/java/appeng/me/NetworkEventBus.java +++ b/src/main/java/appeng/me/NetworkEventBus.java @@ -39,7 +39,7 @@ public class NetworkEventBus private static final Collection READ_CLASSES = new HashSet(); private static final Map, Map> EVENTS = new HashMap, Map>(); - public void readClass( final Class listAs, final Class c ) + void readClass( final Class listAs, final Class c ) { if( READ_CLASSES.contains( c ) ) { @@ -94,7 +94,7 @@ public class NetworkEventBus } } - public MENetworkEvent postEvent( final Grid g, final MENetworkEvent e ) + MENetworkEvent postEvent( final Grid g, final MENetworkEvent e ) { final Map subscribers = EVENTS.get( e.getClass() ); int x = 0; @@ -110,7 +110,7 @@ public class NetworkEventBus if( cache != null ) { x++; - target.invoke( cache.myCache, e ); + target.invoke( cache.getCache(), e ); } for( final IGridNode obj : g.getMachines( subscriber.getKey() ) ) @@ -130,7 +130,7 @@ public class NetworkEventBus return e; } - public MENetworkEvent postEventTo( final Grid grid, final GridNode node, final MENetworkEvent e ) + MENetworkEvent postEventTo( final Grid grid, final GridNode node, final MENetworkEvent e ) { final Map subscribers = EVENTS.get( e.getClass() ); int x = 0; @@ -156,19 +156,18 @@ public class NetworkEventBus return e; } - static class NetworkEventDone extends Throwable + private static class NetworkEventDone extends Throwable { private static final long serialVersionUID = -3079021487019171205L; } - - class EventMethod + private class EventMethod { - public final Class objClass; - public final Method objMethod; - public final Class objEvent; + private final Class objClass; + private final Method objMethod; + private final Class objEvent; public EventMethod( final Class Event, final Class ObjClass, final Method ObjMethod ) { @@ -177,7 +176,7 @@ public class NetworkEventBus this.objEvent = Event; } - public void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone + private void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone { try { @@ -199,18 +198,17 @@ public class NetworkEventBus } } - - class MENetworkEventInfo + private class MENetworkEventInfo { private final List methods = new ArrayList(); - public void Add( final Class Event, final Class ObjClass, final Method ObjMethod ) + private void Add( final Class Event, final Class ObjClass, final Method ObjMethod ) { this.methods.add( new EventMethod( Event, ObjClass, ObjMethod ) ); } - public void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone + private void invoke( final Object obj, final MENetworkEvent e ) throws NetworkEventDone { for( final EventMethod em : this.methods ) { diff --git a/src/main/java/appeng/me/cache/CraftingGridCache.java b/src/main/java/appeng/me/cache/CraftingGridCache.java index 5bbb3fc2d..38097fe77 100644 --- a/src/main/java/appeng/me/cache/CraftingGridCache.java +++ b/src/main/java/appeng/me/cache/CraftingGridCache.java @@ -88,8 +88,8 @@ import com.google.common.collect.Multimap; public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper, ICellProvider, IMEInventoryHandler { - public static final ExecutorService CRAFTING_POOL; - static final Comparator COMPARATOR = new Comparator() + private static final ExecutorService CRAFTING_POOL; + private static final Comparator COMPARATOR = new Comparator() { @Override public int compare( final ICraftingPatternDetails firstDetail, final ICraftingPatternDetails nextDetail ) @@ -122,7 +122,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper private final Set emitableItems = new HashSet(); private final Map craftingLinks = new HashMap(); private final Multimap interests = HashMultimap.create(); - public final GenericInterestManager interestManager = new GenericInterestManager( this.interests ); + private final GenericInterestManager interestManager = new GenericInterestManager( this.interests ); private IStorageGrid storageGrid; private IEnergyGrid energyGrid; private boolean updateList = false; @@ -615,7 +615,12 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper return this.craftingCPUClusters.contains( cpu ); } - static class ActiveCpuIterator implements Iterator + public GenericInterestManager getInterestManager() + { + return this.interestManager; + } + + private static class ActiveCpuIterator implements Iterator { private final Iterator iterator; diff --git a/src/main/java/appeng/me/cache/EnergyGridCache.java b/src/main/java/appeng/me/cache/EnergyGridCache.java index 0e31e5028..4fb86000a 100644 --- a/src/main/java/appeng/me/cache/EnergyGridCache.java +++ b/src/main/java/appeng/me/cache/EnergyGridCache.java @@ -58,42 +58,42 @@ import com.google.common.collect.Multiset; public class EnergyGridCache implements IEnergyGrid { - public final TreeSet interests = new TreeSet(); - final double AvgLength = 40.0; - final Set providers = new LinkedHashSet(); - final Set requesters = new LinkedHashSet(); - final Multiset energyGridProviders = HashMultiset.create(); - final IGrid myGrid; + private final TreeSet interests = new TreeSet(); + private final double AvgLength = 40.0; + private final Set providers = new LinkedHashSet(); + private final Set requesters = new LinkedHashSet(); + private final Multiset energyGridProviders = HashMultiset.create(); + private final IGrid myGrid; private final HashMap watchers = new HashMap(); private final Set localSeen = new HashSet(); /** * estimated power available. */ - int availableTicksSinceUpdate = 0; - double globalAvailablePower = 0; - double globalMaxPower = 0; + private int availableTicksSinceUpdate = 0; + private double globalAvailablePower = 0; + private double globalMaxPower = 0; /** * idle draw. */ - double drainPerTick = 0; - double avgDrainPerTick = 0; - double avgInjectionPerTick = 0; - double tickDrainPerTick = 0; - double tickInjectionPerTick = 0; + private double drainPerTick = 0; + private double avgDrainPerTick = 0; + private double avgInjectionPerTick = 0; + private double tickDrainPerTick = 0; + private double tickInjectionPerTick = 0; /** * power status */ - boolean publicHasPower = false; - boolean hasPower = true; - long ticksSinceHasPowerChange = 900; + private boolean publicHasPower = false; + private boolean hasPower = true; + private long ticksSinceHasPowerChange = 900; /** * excess power in the system. */ - double extra = 0; - IAEPowerStorage lastProvider; - IAEPowerStorage lastRequester; - PathGridCache pgc; - double lastStoredPower = -1; + private double extra = 0; + private IAEPowerStorage lastProvider; + private IAEPowerStorage lastRequester; + private PathGridCache pgc; + private double lastStoredPower = -1; public EnergyGridCache( final IGrid g ) { @@ -114,8 +114,8 @@ public class EnergyGridCache implements IEnergyGrid final IGridBlock gb = node.getGridBlock(); final double newDraw = gb.getIdlePowerUsage(); - final double diffDraw = newDraw - node.previousDraw; - node.previousDraw = newDraw; + final double diffDraw = newDraw - node.getPreviousDraw(); + node.setPreviousDraw( newDraw ); this.drainPerTick += diffDraw; } @@ -150,16 +150,16 @@ public class EnergyGridCache implements IEnergyGrid @Override public void onUpdateTick() { - if( !this.interests.isEmpty() ) + if( !this.getInterests().isEmpty() ) { final double oldPower = this.lastStoredPower; this.lastStoredPower = this.getStoredPower(); final EnergyThreshold low = new EnergyThreshold( Math.min( oldPower, this.lastStoredPower ), null ); final EnergyThreshold high = new EnergyThreshold( Math.max( oldPower, this.lastStoredPower ), null ); - for( final EnergyThreshold th : this.interests.subSet( low, true, high, true ) ) + for( final EnergyThreshold th : this.getInterests().subSet( low, true, high, true ) ) { - ( (EnergyWatcher) th.watcher ).post( this ); + ( (EnergyWatcher) th.getWatcher() ).post( this ); } } @@ -221,7 +221,7 @@ public class EnergyGridCache implements IEnergyGrid @Override public double getIdlePowerUsage() { - return this.drainPerTick + this.pgc.channelPowerUsage; + return this.drainPerTick + this.pgc.getChannelPowerUsage(); } private void publicPowerState( final boolean newState, final IGrid grid ) @@ -239,7 +239,7 @@ public class EnergyGridCache implements IEnergyGrid /** * refresh current stored power. */ - public void refreshPower() + private void refreshPower() { this.availableTicksSinceUpdate = 0; this.globalAvailablePower = 0; @@ -520,7 +520,7 @@ public class EnergyGridCache implements IEnergyGrid // idle draw. final GridNode gridNode = (GridNode) node; - this.drainPerTick -= gridNode.previousDraw; + this.drainPerTick -= gridNode.getPreviousDraw(); // power storage. if( machine instanceof IAEPowerStorage ) @@ -571,8 +571,8 @@ public class EnergyGridCache implements IEnergyGrid // idle draw... final GridNode gridNode = (GridNode) node; final IGridBlock gb = gridNode.getGridBlock(); - gridNode.previousDraw = gb.getIdlePowerUsage(); - this.drainPerTick += gridNode.previousDraw; + gridNode.setPreviousDraw( gb.getIdlePowerUsage() ); + this.drainPerTick += gridNode.getPreviousDraw(); // power storage if( machine instanceof IAEPowerStorage ) @@ -630,4 +630,9 @@ public class EnergyGridCache implements IEnergyGrid { storage.dataObject().setDouble( "extraEnergy", this.extra ); } + + public TreeSet getInterests() + { + return this.interests; + } } diff --git a/src/main/java/appeng/me/cache/GridStorageCache.java b/src/main/java/appeng/me/cache/GridStorageCache.java index c155da8c3..b96c5f792 100644 --- a/src/main/java/appeng/me/cache/GridStorageCache.java +++ b/src/main/java/appeng/me/cache/GridStorageCache.java @@ -58,11 +58,11 @@ import com.google.common.collect.SetMultimap; public class GridStorageCache implements IStorageGrid { - public final IGrid myGrid; - final HashSet activeCellProviders = new HashSet(); - final HashSet inactiveCellProviders = new HashSet(); + private final IGrid myGrid; + private final HashSet activeCellProviders = new HashSet(); + private final HashSet inactiveCellProviders = new HashSet(); private final SetMultimap interests = HashMultimap.create(); - public final GenericInterestManager interestManager = new GenericInterestManager( this.interests ); + private final GenericInterestManager interestManager = new GenericInterestManager( this.interests ); private final NetworkMonitor itemMonitor = new NetworkMonitor( this, StorageChannel.ITEMS ); private final NetworkMonitor fluidMonitor = new NetworkMonitor( this, StorageChannel.FLUIDS ); private final HashMap watchers = new HashMap(); @@ -88,7 +88,7 @@ public class GridStorageCache implements IStorageGrid { final ICellContainer cc = (ICellContainer) machine; - this.myGrid.postEvent( new MENetworkCellArrayUpdate() ); + this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); this.removeCellProvider( cc, new CellChangeTracker() ).applyChanges(); this.inactiveCellProviders.remove( cc ); } @@ -112,7 +112,7 @@ public class GridStorageCache implements IStorageGrid final ICellContainer cc = (ICellContainer) machine; this.inactiveCellProviders.add( cc ); - this.myGrid.postEvent( new MENetworkCellArrayUpdate() ); + this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); if( node.isActive() ) { this.addCellProvider( cc, new CellChangeTracker() ).applyChanges(); @@ -146,7 +146,7 @@ public class GridStorageCache implements IStorageGrid } - public CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) + private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) { if( this.inactiveCellProviders.contains( cc ) ) { @@ -173,7 +173,7 @@ public class GridStorageCache implements IStorageGrid return tracker; } - public CellChangeTracker removeCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) + private CellChangeTracker removeCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) { if( this.activeCellProviders.contains( cc ) ) { @@ -259,7 +259,7 @@ public class GridStorageCache implements IStorageGrid } } - public IMEInventoryHandler getItemInventoryHandler() + IMEInventoryHandler getItemInventoryHandler() { if( this.myItemNetwork == null ) { @@ -270,7 +270,7 @@ public class GridStorageCache implements IStorageGrid private void buildNetworkStorage( final StorageChannel chan ) { - final SecurityCache security = this.myGrid.getCache( ISecurityGrid.class ); + final SecurityCache security = this.getGrid().getCache( ISecurityGrid.class ); switch( chan ) { @@ -298,7 +298,7 @@ public class GridStorageCache implements IStorageGrid } } - public IMEInventoryHandler getFluidInventoryHandler() + IMEInventoryHandler getFluidInventoryHandler() { if( this.myFluidNetwork == null ) { @@ -346,6 +346,16 @@ public class GridStorageCache implements IStorageGrid return this.fluidMonitor; } + public GenericInterestManager getInterestManager() + { + return this.interestManager; + } + + IGrid getGrid() + { + return this.myGrid; + } + private class CellChangeTrackerRecord { diff --git a/src/main/java/appeng/me/cache/NetworkMonitor.java b/src/main/java/appeng/me/cache/NetworkMonitor.java index 8b0c1cd46..d61fca357 100644 --- a/src/main/java/appeng/me/cache/NetworkMonitor.java +++ b/src/main/java/appeng/me/cache/NetworkMonitor.java @@ -42,7 +42,7 @@ public class NetworkMonitor> extends MEMonitorHandler private static final Deque> DEPTH = new LinkedList>(); private final GridStorageCache myGridCache; private final StorageChannel myChannel; - boolean sendEvent = false; + private boolean sendEvent = false; public NetworkMonitor( final GridStorageCache cache, final StorageChannel chan ) { @@ -51,7 +51,7 @@ public class NetworkMonitor> extends MEMonitorHandler this.myChannel = chan; } - public void forceUpdate() + void forceUpdate() { this.hasChanged = true; @@ -72,12 +72,12 @@ public class NetworkMonitor> extends MEMonitorHandler } } - public void onTick() + void onTick() { if( this.sendEvent ) { this.sendEvent = false; - this.myGridCache.myGrid.postEvent( new MENetworkStorageEvent( this, this.myChannel ) ); + this.myGridCache.getGrid().postEvent( new MENetworkStorageEvent( this, this.myChannel ) ); } } @@ -124,9 +124,9 @@ public class NetworkMonitor> extends MEMonitorHandler ( difference = changedItem.copy() ).setStackSize( -changedItem.getStackSize() ); } - if( this.myGridCache.interestManager.containsKey( changedItem ) ) + if( this.myGridCache.getInterestManager().containsKey( changedItem ) ) { - final Collection list = this.myGridCache.interestManager.get( changedItem ); + final Collection list = this.myGridCache.getInterestManager().get( changedItem ); if( !list.isEmpty() ) { IAEStack fullStack = myStorageList.findPrecise( changedItem ); @@ -136,14 +136,14 @@ public class NetworkMonitor> extends MEMonitorHandler fullStack.setStackSize( 0 ); } - this.myGridCache.interestManager.enableTransactions(); + this.myGridCache.getInterestManager().enableTransactions(); for( final ItemWatcher iw : list ) { iw.getHost().onStackChange( myStorageList, fullStack, difference, src, this.getChannel() ); } - this.myGridCache.interestManager.disableTransactions(); + this.myGridCache.getInterestManager().disableTransactions(); } } } diff --git a/src/main/java/appeng/me/cache/P2PCache.java b/src/main/java/appeng/me/cache/P2PCache.java index 3af3a0303..6fc77ebe0 100644 --- a/src/main/java/appeng/me/cache/P2PCache.java +++ b/src/main/java/appeng/me/cache/P2PCache.java @@ -42,7 +42,7 @@ import com.google.common.collect.Multimap; public class P2PCache implements IGridCache { - final IGrid myGrid; + private final IGrid myGrid; private final HashMap inputs = new HashMap(); private final Multimap outputs = LinkedHashMultimap.create(); private final TunnelCollection NullColl = new TunnelCollection( null, null ); @@ -101,16 +101,16 @@ public class P2PCache implements IGridCache // AELog.info( "rmv-" + (t.output ? "output: " : "input: ") + t.freq // ); - if( t.output ) + if( t.isOutput() ) { - this.outputs.remove( t.freq, t ); + this.outputs.remove( t.getFrequency(), t ); } else { - this.inputs.remove( t.freq ); + this.inputs.remove( t.getFrequency() ); } - this.updateTunnel( t.freq, !t.output, false ); + this.updateTunnel( t.getFrequency(), !t.isOutput(), false ); } } @@ -131,16 +131,16 @@ public class P2PCache implements IGridCache // AELog.info( "add-" + (t.output ? "output: " : "input: ") + t.freq // ); - if( t.output ) + if( t.isOutput() ) { - this.outputs.put( t.freq, t ); + this.outputs.put( t.getFrequency(), t ); } else { - this.inputs.put( t.freq, t ); + this.inputs.put( t.getFrequency(), t ); } - this.updateTunnel( t.freq, !t.output, false ); + this.updateTunnel( t.getFrequency(), !t.isOutput(), false ); } } @@ -188,29 +188,29 @@ public class P2PCache implements IGridCache { if( this.outputs.containsValue( t ) ) { - this.outputs.remove( t.freq, t ); + this.outputs.remove( t.getFrequency(), t ); } if( this.inputs.containsValue( t ) ) { - this.inputs.remove( t.freq ); + this.inputs.remove( t.getFrequency() ); } - t.freq = newFrequency; + t.setFrequency( newFrequency ); - if( t.output ) + if( t.isOutput() ) { - this.outputs.put( t.freq, t ); + this.outputs.put( t.getFrequency(), t ); } else { - this.inputs.put( t.freq, t ); + this.inputs.put( t.getFrequency(), t ); } // AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq // ); - this.updateTunnel( t.freq, t.output, true ); - this.updateTunnel( t.freq, !t.output, true ); + this.updateTunnel( t.getFrequency(), t.isOutput(), true ); + this.updateTunnel( t.getFrequency(), !t.isOutput(), true ); } public TunnelCollection getOutputs( final long freq, final Class c ) diff --git a/src/main/java/appeng/me/cache/PathGridCache.java b/src/main/java/appeng/me/cache/PathGridCache.java index 5f80dcc9a..f2cb082aa 100644 --- a/src/main/java/appeng/me/cache/PathGridCache.java +++ b/src/main/java/appeng/me/cache/PathGridCache.java @@ -59,21 +59,20 @@ import appeng.util.Platform; public class PathGridCache implements IPathingGrid { - final LinkedList active = new LinkedList(); - final Set controllers = new HashSet(); - final Set requireChannels = new HashSet(); - final Set blockDense = new HashSet(); - final IGrid myGrid; - public int channelsInUse = 0; - public int channelsByBlocks = 0; - public double channelPowerUsage = 0.0; - boolean recalculateControllerNextTick = true; - boolean updateNetwork = true; - boolean booting = false; - ControllerState controllerState = ControllerState.NO_CONTROLLER; - int instance = Integer.MIN_VALUE; - int ticksUntilReady = 20; - int lastChannels = 0; + private final LinkedList active = new LinkedList(); + private final Set controllers = new HashSet(); + private final Set requireChannels = new HashSet(); + private final Set blockDense = new HashSet(); + private final IGrid myGrid; + private int channelsInUse = 0; + private int channelsByBlocks = 0; + private double channelPowerUsage = 0.0; + private boolean recalculateControllerNextTick = true; + private boolean updateNetwork = true; + private boolean booting = false; + private ControllerState controllerState = ControllerState.NO_CONTROLLER; + private int ticksUntilReady = 20; + private int lastChannels = 0; private HashSet semiOpen = new HashSet(); public PathGridCache( final IGrid g ) @@ -98,8 +97,7 @@ public class PathGridCache implements IPathingGrid this.booting = true; this.updateNetwork = false; - this.instance++; - this.channelsInUse = 0; + this.setChannelsInUse( 0 ); if( !AEConfig.instance.isFeatureEnabled( AEFeature.Channels ) ) { @@ -107,8 +105,8 @@ public class PathGridCache implements IPathingGrid final int nodes = this.myGrid.getNodes().size(); this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 ); - this.channelsByBlocks = nodes * used; - this.channelPowerUsage = this.channelsByBlocks / 128.0; + this.setChannelsByBlocks( nodes * used ); + this.setChannelPowerUsage( this.getChannelsByBlocks() / 128.0 ); this.myGrid.getPivot().beginVisit( new AdHocChannelUpdater( used ) ); } @@ -122,11 +120,11 @@ public class PathGridCache implements IPathingGrid } final int nodes = this.myGrid.getNodes().size(); - this.channelsInUse = used; + this.setChannelsInUse( used ); this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 ); - this.channelsByBlocks = nodes * used; - this.channelPowerUsage = this.channelsByBlocks / 128.0; + this.setChannelsByBlocks( nodes * used ); + this.setChannelPowerUsage( this.getChannelsByBlocks() / 128.0 ); this.myGrid.getPivot().beginVisit( new AdHocChannelUpdater( used ) ); } @@ -171,7 +169,7 @@ public class PathGridCache implements IPathingGrid final PathSegment pat = i.next(); if( pat.step() ) { - pat.isDead = true; + pat.setDead( true ); i.remove(); } } @@ -194,7 +192,7 @@ public class PathGridCache implements IPathingGrid this.achievementPost(); this.booting = false; - this.channelPowerUsage = this.channelsByBlocks / 128.0; + this.setChannelPowerUsage( this.getChannelsByBlocks() / 128.0 ); this.myGrid.postEvent( new MENetworkBootingStatusChange() ); } } @@ -289,7 +287,7 @@ public class PathGridCache implements IPathingGrid startingNode.beginVisit( cv ); - if( cv.isValid && cv.found == this.controllers.size() ) + if( cv.isValid() && cv.getFound() == this.controllers.size() ) { this.controllerState = ControllerState.CONTROLLER_ONLINE; } @@ -341,9 +339,9 @@ public class PathGridCache implements IPathingGrid private void achievementPost() { - if( this.lastChannels != this.channelsInUse && AEConfig.instance.isFeatureEnabled( AEFeature.Channels ) ) + if( this.lastChannels != this.getChannelsInUse() && AEConfig.instance.isFeatureEnabled( AEFeature.Channels ) ) { - final Achievements currentBracket = this.getAchievementBracket( this.channelsInUse ); + final Achievements currentBracket = this.getAchievementBracket( this.getChannelsInUse() ); final Achievements lastBracket = this.getAchievementBracket( this.lastChannels ); if( currentBracket != lastBracket && currentBracket != null ) { @@ -359,7 +357,7 @@ public class PathGridCache implements IPathingGrid } } } - this.lastChannels = this.channelsInUse; + this.lastChannels = this.getChannelsInUse(); } private Achievements getAchievementBracket( final int ch ) @@ -417,7 +415,37 @@ public class PathGridCache implements IPathingGrid // clean up... this.active.clear(); - this.channelsByBlocks = 0; + this.setChannelsByBlocks( 0 ); this.updateNetwork = true; } + + double getChannelPowerUsage() + { + return this.channelPowerUsage; + } + + private void setChannelPowerUsage( final double channelPowerUsage ) + { + this.channelPowerUsage = channelPowerUsage; + } + + public int getChannelsByBlocks() + { + return this.channelsByBlocks; + } + + public void setChannelsByBlocks( final int channelsByBlocks ) + { + this.channelsByBlocks = channelsByBlocks; + } + + public int getChannelsInUse() + { + return this.channelsInUse; + } + + public void setChannelsInUse( final int channelsInUse ) + { + this.channelsInUse = channelsInUse; + } } diff --git a/src/main/java/appeng/me/cache/SecurityCache.java b/src/main/java/appeng/me/cache/SecurityCache.java index 863bbf2b8..1c08d9cfd 100644 --- a/src/main/java/appeng/me/cache/SecurityCache.java +++ b/src/main/java/appeng/me/cache/SecurityCache.java @@ -44,7 +44,7 @@ import appeng.me.GridNode; public class SecurityCache implements ISecurityGrid { - public final IGrid myGrid; + private final IGrid myGrid; private final List securityProvider = new ArrayList(); private final HashMap> playerPerms = new HashMap>(); private long securityKey = -1; @@ -102,10 +102,10 @@ public class SecurityCache implements ISecurityGrid if( lastCode != this.securityKey ) { - this.myGrid.postEvent( new MENetworkSecurityChange() ); - for( final IGridNode n : this.myGrid.getNodes() ) + this.getGrid().postEvent( new MENetworkSecurityChange() ); + for( final IGridNode n : this.getGrid().getNodes() ) { - ( (GridNode) n ).lastSecurityKey = this.securityKey; + ( (GridNode) n ).setLastSecurityKey( this.securityKey ); } } } @@ -120,7 +120,7 @@ public class SecurityCache implements ISecurityGrid } else { - ( (GridNode) gridNode ).lastSecurityKey = this.securityKey; + ( (GridNode) gridNode ).setLastSecurityKey( this.securityKey ); } } @@ -193,4 +193,9 @@ public class SecurityCache implements ISecurityGrid } return -1; } + + public IGrid getGrid() + { + return this.myGrid; + } } diff --git a/src/main/java/appeng/me/cache/SpatialPylonCache.java b/src/main/java/appeng/me/cache/SpatialPylonCache.java index 564eb8eb5..61e25f0d2 100644 --- a/src/main/java/appeng/me/cache/SpatialPylonCache.java +++ b/src/main/java/appeng/me/cache/SpatialPylonCache.java @@ -41,15 +41,14 @@ import appeng.tile.spatial.TileSpatialPylon; public class SpatialPylonCache implements ISpatialCache { - final IGrid myGrid; - long powerRequired = 0; - double efficiency = 0.0; - DimensionalCoord captureMin; - DimensionalCoord captureMax; - boolean isValid = false; - List ioPorts = new LinkedList(); - HashMap clusters = new HashMap(); - boolean needsUpdate = false; + private final IGrid myGrid; + private long powerRequired = 0; + private double efficiency = 0.0; + private DimensionalCoord captureMin; + private DimensionalCoord captureMax; + private boolean isValid = false; + private List ioPorts = new LinkedList(); + private HashMap clusters = new HashMap(); public SpatialPylonCache( final IGrid g ) { @@ -62,7 +61,7 @@ public class SpatialPylonCache implements ISpatialCache this.reset( this.myGrid ); } - public void reset( final IGrid grid ) + private void reset( final IGrid grid ) { this.clusters = new HashMap(); @@ -95,22 +94,22 @@ public class SpatialPylonCache implements ISpatialCache { if( this.captureMax == null ) { - this.captureMax = cl.max.copy(); + this.captureMax = cl.getMax().copy(); } if( this.captureMin == null ) { - this.captureMin = cl.min.copy(); + this.captureMin = cl.getMin().copy(); } pylonBlocks += cl.tileCount(); - this.captureMin.x = Math.min( this.captureMin.x, cl.min.x ); - this.captureMin.y = Math.min( this.captureMin.y, cl.min.y ); - this.captureMin.z = Math.min( this.captureMin.z, cl.min.z ); + this.captureMin.x = Math.min( this.captureMin.x, cl.getMin().x ); + this.captureMin.y = Math.min( this.captureMin.y, cl.getMin().y ); + this.captureMin.z = Math.min( this.captureMin.z, cl.getMin().z ); - this.captureMax.x = Math.max( this.captureMax.x, cl.max.x ); - this.captureMax.y = Math.max( this.captureMax.y, cl.max.y ); - this.captureMax.z = Math.max( this.captureMax.z, cl.max.z ); + this.captureMax.x = Math.max( this.captureMax.x, cl.getMax().x ); + this.captureMax.y = Math.max( this.captureMax.y, cl.getMax().y ); + this.captureMax.z = Math.max( this.captureMax.z, cl.getMax().z ); } double maxPower = 0; @@ -121,21 +120,21 @@ public class SpatialPylonCache implements ISpatialCache for( final SpatialPylonCluster cl : this.clusters.values() ) { - switch( cl.currentAxis ) + switch( cl.getCurrentAxis() ) { case X: - this.isValid = this.isValid && ( ( this.captureMax.y == cl.min.y || this.captureMin.y == cl.max.y ) || ( this.captureMax.z == cl.min.z || this.captureMin.z == cl.max.z ) ) && ( ( this.captureMax.y == cl.max.y || this.captureMin.y == cl.min.y ) || ( this.captureMax.z == cl.max.z || this.captureMin.z == cl.min.z ) ); + this.isValid = this.isValid && ( ( this.captureMax.y == cl.getMin().y || this.captureMin.y == cl.getMax().y ) || ( this.captureMax.z == cl.getMin().z || this.captureMin.z == cl.getMax().z ) ) && ( ( this.captureMax.y == cl.getMax().y || this.captureMin.y == cl.getMin().y ) || ( this.captureMax.z == cl.getMax().z || this.captureMin.z == cl.getMin().z ) ); break; case Y: - this.isValid = this.isValid && ( ( this.captureMax.x == cl.min.x || this.captureMin.x == cl.max.x ) || ( this.captureMax.z == cl.min.z || this.captureMin.z == cl.max.z ) ) && ( ( this.captureMax.x == cl.max.x || this.captureMin.x == cl.min.x ) || ( this.captureMax.z == cl.max.z || this.captureMin.z == cl.min.z ) ); + this.isValid = this.isValid && ( ( this.captureMax.x == cl.getMin().x || this.captureMin.x == cl.getMax().x ) || ( this.captureMax.z == cl.getMin().z || this.captureMin.z == cl.getMax().z ) ) && ( ( this.captureMax.x == cl.getMax().x || this.captureMin.x == cl.getMin().x ) || ( this.captureMax.z == cl.getMax().z || this.captureMin.z == cl.getMin().z ) ); break; case Z: - this.isValid = this.isValid && ( ( this.captureMax.y == cl.min.y || this.captureMin.y == cl.max.y ) || ( this.captureMax.x == cl.min.x || this.captureMin.x == cl.max.x ) ) && ( ( this.captureMax.y == cl.max.y || this.captureMin.y == cl.min.y ) || ( this.captureMax.x == cl.max.x || this.captureMin.x == cl.min.x ) ); + this.isValid = this.isValid && ( ( this.captureMax.y == cl.getMin().y || this.captureMin.y == cl.getMax().y ) || ( this.captureMax.x == cl.getMin().x || this.captureMin.x == cl.getMax().x ) ) && ( ( this.captureMax.y == cl.getMax().y || this.captureMin.y == cl.getMin().y ) || ( this.captureMax.x == cl.getMax().x || this.captureMin.x == cl.getMin().x ) ); break; case UNFORMED: @@ -169,8 +168,8 @@ public class SpatialPylonCache implements ISpatialCache for( final SpatialPylonCluster cl : this.clusters.values() ) { - final boolean myWasValid = cl.isValid; - cl.isValid = this.isValid; + final boolean myWasValid = cl.isValid(); + cl.setValid( this.isValid ); if( myWasValid != this.isValid ) { cl.updateStatus( false ); diff --git a/src/main/java/appeng/me/cache/TickManagerCache.java b/src/main/java/appeng/me/cache/TickManagerCache.java index e609bdab2..c3a134805 100644 --- a/src/main/java/appeng/me/cache/TickManagerCache.java +++ b/src/main/java/appeng/me/cache/TickManagerCache.java @@ -39,11 +39,11 @@ import appeng.me.cache.helpers.TickTracker; public class TickManagerCache implements ITickManager { - final IGrid myGrid; - final HashMap alertable = new HashMap(); - final HashMap sleeping = new HashMap(); - final HashMap awake = new HashMap(); - final PriorityQueue upcomingTicks = new PriorityQueue(); + private final IGrid myGrid; + private final HashMap alertable = new HashMap(); + private final HashMap sleeping = new HashMap(); + private final HashMap awake = new HashMap(); + private final PriorityQueue upcomingTicks = new PriorityQueue(); private long currentTick = 0; public TickManagerCache( final IGrid g ) @@ -83,28 +83,28 @@ public class TickManagerCache implements ITickManager while( !this.upcomingTicks.isEmpty() ) { tt = this.upcomingTicks.peek(); - final int diff = (int) ( this.currentTick - tt.lastTick ); - if( diff >= tt.current_rate ) + final int diff = (int) ( this.currentTick - tt.getLastTick() ); + if( diff >= tt.getCurrentRate() ) { // remove tt.. this.upcomingTicks.poll(); - final TickRateModulation mod = tt.gt.tickingRequest( tt.node, diff ); + final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff ); switch( mod ) { case FASTER: - tt.setRate( tt.current_rate - 2 ); + tt.setRate( tt.getCurrentRate() - 2 ); break; case IDLE: - tt.setRate( tt.request.maxTickRate ); + tt.setRate( tt.getRequest().maxTickRate ); break; case SAME: break; case SLEEP: - this.sleepDevice( tt.node ); + this.sleepDevice( tt.getNode() ); break; case SLOWER: - tt.setRate( tt.current_rate + 1 ); + tt.setRate( tt.getCurrentRate() + 1 ); break; case URGENT: tt.setRate( 0 ); @@ -113,7 +113,7 @@ public class TickManagerCache implements ITickManager break; } - if( this.awake.containsKey( tt.node ) ) + if( this.awake.containsKey( tt.getNode() ) ) { this.addToQueue( tt ); } @@ -127,7 +127,7 @@ public class TickManagerCache implements ITickManager catch( final Throwable t ) { final CrashReport crashreport = CrashReport.makeCrashReport( t, "Ticking GridNode" ); - final CrashReportCategory crashreportcategory = crashreport.makeCategory( tt.gt.getClass().getSimpleName() + " being ticked." ); + final CrashReportCategory crashreportcategory = crashreport.makeCategory( tt.getGridTickable().getClass().getSimpleName() + " being ticked." ); tt.addEntityCrashInfo( crashreportcategory ); throw new ReportedException( crashreport ); } @@ -135,7 +135,7 @@ public class TickManagerCache implements ITickManager private void addToQueue( final TickTracker tt ) { - tt.lastTick = this.currentTick; + tt.setLastTick( this.currentTick ); this.upcomingTicks.add( tt ); } @@ -212,8 +212,8 @@ public class TickManagerCache implements ITickManager this.awake.put( node, tt ); // configure sort. - tt.lastTick -= tt.request.maxTickRate; - tt.current_rate = tt.request.minTickRate; + tt.setLastTick( tt.getLastTick() - tt.getRequest().maxTickRate ); + tt.setCurrentRate( tt.getRequest().minTickRate ); // prevent dupes and tick build up. this.upcomingTicks.remove( tt ); diff --git a/src/main/java/appeng/me/cache/helpers/ConnectionWrapper.java b/src/main/java/appeng/me/cache/helpers/ConnectionWrapper.java index 514f50fc4..759a94080 100644 --- a/src/main/java/appeng/me/cache/helpers/ConnectionWrapper.java +++ b/src/main/java/appeng/me/cache/helpers/ConnectionWrapper.java @@ -25,10 +25,20 @@ import appeng.api.networking.IGridConnection; public class ConnectionWrapper { - public IGridConnection connection; + private IGridConnection connection; public ConnectionWrapper( final IGridConnection gc ) { - this.connection = gc; + this.setConnection( gc ); + } + + public IGridConnection getConnection() + { + return this.connection; + } + + public void setConnection( final IGridConnection connection ) + { + this.connection = connection; } } \ No newline at end of file diff --git a/src/main/java/appeng/me/cache/helpers/Connections.java b/src/main/java/appeng/me/cache/helpers/Connections.java index 02f7846c7..5ea373d89 100644 --- a/src/main/java/appeng/me/cache/helpers/Connections.java +++ b/src/main/java/appeng/me/cache/helpers/Connections.java @@ -31,10 +31,10 @@ import appeng.util.IWorldCallable; public class Connections implements IWorldCallable { - public final HashMap connections = new HashMap(); + private final HashMap connections = new HashMap(); private final PartP2PTunnelME me; - public boolean create = false; - public boolean destroy = false; + private boolean create = false; + private boolean destroy = false; public Connections( final PartP2PTunnelME o ) { @@ -51,13 +51,38 @@ public class Connections implements IWorldCallable public void markDestroy() { - this.create = false; - this.destroy = true; + this.setCreate( false ); + this.setDestroy( true ); } public void markCreate() { - this.create = true; - this.destroy = false; + this.setCreate( true ); + this.setDestroy( false ); + } + + public HashMap getConnections() + { + return this.connections; + } + + public boolean isCreate() + { + return this.create; + } + + private void setCreate( final boolean create ) + { + this.create = create; + } + + public boolean isDestroy() + { + return this.destroy; + } + + private void setDestroy( final boolean destroy ) + { + this.destroy = destroy; } } diff --git a/src/main/java/appeng/me/cache/helpers/TickTracker.java b/src/main/java/appeng/me/cache/helpers/TickTracker.java index 89b07031c..041626ce3 100644 --- a/src/main/java/appeng/me/cache/helpers/TickTracker.java +++ b/src/main/java/appeng/me/cache/helpers/TickTracker.java @@ -33,23 +33,23 @@ import appeng.parts.AEBasePart; public class TickTracker implements Comparable { - public final TickingRequest request; - public final IGridTickable gt; - public final IGridNode node; - public final TickManagerCache host; + private final TickingRequest request; + private final IGridTickable gt; + private final IGridNode node; + private final TickManagerCache host; - public final long LastFiveTicksTime = 0; + private final long LastFiveTicksTime = 0; - public long lastTick; - public int current_rate; + private long lastTick; + private int currentRate; public TickTracker( final TickingRequest req, final IGridNode node, final IGridTickable gt, final long currentTick, final TickManagerCache tickManagerCache ) { this.request = req; this.gt = gt; this.node = node; - this.current_rate = ( req.minTickRate + req.maxTickRate ) / 2; - this.lastTick = currentTick; + this.setCurrentRate( ( req.minTickRate + req.maxTickRate ) / 2 ); + this.setLastTick( currentTick ); this.host = tickManagerCache; } @@ -60,46 +60,81 @@ public class TickTracker implements Comparable public void setRate( final int rate ) { - this.current_rate = rate; + this.setCurrentRate( rate ); - if( this.current_rate < this.request.minTickRate ) + if( this.getCurrentRate() < this.getRequest().minTickRate ) { - this.current_rate = this.request.minTickRate; + this.setCurrentRate( this.getRequest().minTickRate ); } - if( this.current_rate > this.request.maxTickRate ) + if( this.getCurrentRate() > this.getRequest().maxTickRate ) { - this.current_rate = this.request.maxTickRate; + this.setCurrentRate( this.getRequest().maxTickRate ); } } @Override public int compareTo( @Nonnull final TickTracker t ) { - final int nextTick = (int) ( ( this.lastTick - this.host.getCurrentTick() ) + this.current_rate ); - final int ts_nextTick = (int) ( ( t.lastTick - this.host.getCurrentTick() ) + t.current_rate ); + final int nextTick = (int) ( ( this.getLastTick() - this.host.getCurrentTick() ) + this.getCurrentRate() ); + final int ts_nextTick = (int) ( ( t.getLastTick() - this.host.getCurrentTick() ) + t.getCurrentRate() ); return nextTick - ts_nextTick; } public void addEntityCrashInfo( final CrashReportCategory crashreportcategory ) { - if( this.gt instanceof AEBasePart ) + if( this.getGridTickable() instanceof AEBasePart ) { - final AEBasePart part = (AEBasePart) this.gt; + final AEBasePart part = (AEBasePart) this.getGridTickable(); part.addEntityCrashInfo( crashreportcategory ); } - crashreportcategory.addCrashSection( "CurrentTickRate", this.current_rate ); - crashreportcategory.addCrashSection( "MinTickRate", this.request.minTickRate ); - crashreportcategory.addCrashSection( "MaxTickRate", this.request.maxTickRate ); - crashreportcategory.addCrashSection( "MachineType", this.gt.getClass().getName() ); - crashreportcategory.addCrashSection( "GridBlockType", this.node.getGridBlock().getClass().getName() ); - crashreportcategory.addCrashSection( "ConnectedSides", this.node.getConnectedSides() ); + crashreportcategory.addCrashSection( "CurrentTickRate", this.getCurrentRate() ); + crashreportcategory.addCrashSection( "MinTickRate", this.getRequest().minTickRate ); + crashreportcategory.addCrashSection( "MaxTickRate", this.getRequest().maxTickRate ); + crashreportcategory.addCrashSection( "MachineType", this.getGridTickable().getClass().getName() ); + crashreportcategory.addCrashSection( "GridBlockType", this.getNode().getGridBlock().getClass().getName() ); + crashreportcategory.addCrashSection( "ConnectedSides", this.getNode().getConnectedSides() ); - final DimensionalCoord dc = this.node.getGridBlock().getLocation(); + final DimensionalCoord dc = this.getNode().getGridBlock().getLocation(); if( dc != null ) { crashreportcategory.addCrashSection( "Location", dc ); } } + + public int getCurrentRate() + { + return this.currentRate; + } + + public void setCurrentRate( final int currentRate ) + { + this.currentRate = currentRate; + } + + public long getLastTick() + { + return this.lastTick; + } + + public void setLastTick( final long lastTick ) + { + this.lastTick = lastTick; + } + + public IGridNode getNode() + { + return this.node; + } + + public IGridTickable getGridTickable() + { + return this.gt; + } + + public TickingRequest getRequest() + { + return this.request; + } } diff --git a/src/main/java/appeng/me/cache/helpers/TunnelCollection.java b/src/main/java/appeng/me/cache/helpers/TunnelCollection.java index 88763bbb2..c0caad44e 100644 --- a/src/main/java/appeng/me/cache/helpers/TunnelCollection.java +++ b/src/main/java/appeng/me/cache/helpers/TunnelCollection.java @@ -29,8 +29,8 @@ import appeng.util.iterators.NullIterator; public class TunnelCollection implements Iterable { - final Class clz; - Collection tunnelSources; + private final Class clz; + private Collection tunnelSources; public TunnelCollection( final Collection src, final Class c ) { diff --git a/src/main/java/appeng/me/cache/helpers/TunnelConnection.java b/src/main/java/appeng/me/cache/helpers/TunnelConnection.java index 388ab370e..b4abb1b34 100644 --- a/src/main/java/appeng/me/cache/helpers/TunnelConnection.java +++ b/src/main/java/appeng/me/cache/helpers/TunnelConnection.java @@ -26,12 +26,22 @@ import appeng.parts.p2p.PartP2PTunnelME; public class TunnelConnection { - public final PartP2PTunnelME tunnel; - public final IGridConnection c; + private final PartP2PTunnelME tunnel; + private final IGridConnection c; public TunnelConnection( final PartP2PTunnelME t, final IGridConnection con ) { this.tunnel = t; this.c = con; } + + public IGridConnection getConnection() + { + return this.c; + } + + public PartP2PTunnelME getTunnel() + { + return this.tunnel; + } } \ No newline at end of file diff --git a/src/main/java/appeng/me/cache/helpers/TunnelIterator.java b/src/main/java/appeng/me/cache/helpers/TunnelIterator.java index bfe6a6693..3e86f1207 100644 --- a/src/main/java/appeng/me/cache/helpers/TunnelIterator.java +++ b/src/main/java/appeng/me/cache/helpers/TunnelIterator.java @@ -28,9 +28,9 @@ import appeng.parts.p2p.PartP2PTunnel; public class TunnelIterator implements Iterator { - final Iterator wrapped; - final Class targetType; - T Next; + private final Iterator wrapped; + private final Class targetType; + private T Next; public TunnelIterator( final Collection tunnelSources, final Class clz ) { diff --git a/src/main/java/appeng/me/cluster/MBCalculator.java b/src/main/java/appeng/me/cluster/MBCalculator.java index 3fb730688..dcb5b3e11 100644 --- a/src/main/java/appeng/me/cluster/MBCalculator.java +++ b/src/main/java/appeng/me/cluster/MBCalculator.java @@ -122,7 +122,7 @@ public abstract class MBCalculator this.disconnect(); } - public boolean isValidTileAt( final World w, final int x, final int y, final int z ) + private boolean isValidTileAt( final World w, final int x, final int y, final int z ) { return this.isValidTile( w.getTileEntity( new BlockPos( x, y, z ) ) ); } @@ -137,7 +137,7 @@ public abstract class MBCalculator */ public abstract boolean checkMultiblockScale( WorldCoord min, WorldCoord max ); - public boolean verifyUnownedRegion( final World w, final WorldCoord min, final WorldCoord max ) + private boolean verifyUnownedRegion( final World w, final WorldCoord min, final WorldCoord max ) { for( final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS ) { @@ -153,7 +153,7 @@ public abstract class MBCalculator /** * construct the correct cluster, usually very simple. * - * @param w world + * @param w world * @param min min world coord * @param max max world coord * @@ -171,8 +171,8 @@ public abstract class MBCalculator /** * configure the multi-block tiles, most of the important stuff is in here. * - * @param c updated cluster - * @param w in world + * @param c updated cluster + * @param w in world * @param min min world coord * @param max max world coord */ @@ -187,7 +187,7 @@ public abstract class MBCalculator */ public abstract boolean isValidTile( TileEntity te ); - public boolean verifyUnownedRegionInner( final World w, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, final AEPartLocation side ) + private boolean verifyUnownedRegionInner( final World w, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, final AEPartLocation side ) { switch( side ) { diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCalculator.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCalculator.java index 73aefb507..7939e31cc 100644 --- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCalculator.java +++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCalculator.java @@ -39,7 +39,7 @@ import appeng.tile.crafting.TileCraftingTile; public class CraftingCPUCalculator extends MBCalculator { - final TileCraftingTile tqb; + private final TileCraftingTile tqb; public CraftingCPUCalculator( final IAEMultiBlock t ) { diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java index 630e1af3f..8dd21960b 100644 --- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java @@ -194,14 +194,14 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU return (Iterator) this.tiles.iterator(); } - public void addTile( final TileCraftingTile te ) + void addTile( final TileCraftingTile te ) { - if( this.machineSrc == null || te.isCoreBlock ) + if( this.machineSrc == null || te.isCoreBlock() ) { this.machineSrc = new MachineSource( te ); } - te.isCoreBlock = false; + te.setCoreBlock( false ); te.markDirty(); this.tiles.push( te ); @@ -362,7 +362,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU return input; } - protected void postChange( final IAEItemStack diff, final BaseActionSource src ) + private void postChange( final IAEItemStack diff, final BaseActionSource src ) { final Iterator, Object>> i = this.getListeners(); @@ -394,7 +394,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU this.getCore().markDirty(); } - public void postCraftingStatusChange( final IAEItemStack diff ) + private void postCraftingStatusChange( final IAEItemStack diff ) { if( this.getGrid() == null ) { @@ -403,9 +403,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU final CraftingGridCache sg = this.getGrid().getCache( ICraftingGrid.class ); - if( sg.interestManager.containsKey( diff ) ) + if( sg.getInterestManager().containsKey( diff ) ) { - final Collection list = sg.interestManager.get( diff ); + final Collection list = sg.getInterestManager().get( diff ); if( !list.isEmpty() ) { @@ -448,7 +448,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU } } - protected Iterator, Object>> getListeners() + private Iterator, Object>> getListeners() { return this.listeners.entrySet().iterator(); } @@ -458,7 +458,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU return (TileCraftingTile) this.machineSrc.via; } - public IGrid getGrid() + private IGrid getGrid() { for( final TileCraftingTile r : this.tiles ) { @@ -853,7 +853,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU try { this.waitingFor.resetStatus(); - ( (CraftingJob) job ).tree.setJob( ci, this, src ); + ( (CraftingJob) job ).getTree().setJob( ci, this, src ); if( ci.commit( src ) ) { this.finalOutput = job.getOutput(); @@ -1159,16 +1159,16 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU return out; } - public void done() + void done() { final TileCraftingTile core = this.getCore(); - core.isCoreBlock = true; + core.setCoreBlock( true ); - if( core.previousState != null ) + if( core.getPreviousState() != null ) { - this.readFromNBT( core.previousState ); - core.previousState = null; + this.readFromNBT( core.getPreviousState() ); + core.setPreviousState( null ); } this.updateCPU(); @@ -1328,8 +1328,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU return this.startItemCount; } - static class TaskProgress + private static class TaskProgress { - long value; + private long value; } } diff --git a/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java b/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java index aafb793b6..0444ed6ac 100644 --- a/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java +++ b/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java @@ -140,13 +140,13 @@ public class QuantumCalculator extends MBCalculator { if( num == 1 || num == 3 || num == 7 || num == 9 ) { - flags = (byte) ( this.tqb.corner | num ); + flags = (byte) ( this.tqb.getCorner() | num ); } else { flags = num; } - c.Ring[ringNum] = te; + c.getRing()[ringNum] = te; ringNum++; } diff --git a/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java b/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java index 70f969e19..d5f7baeed 100644 --- a/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java @@ -46,13 +46,13 @@ import appeng.util.iterators.ChainedIterator; public class QuantumCluster implements ILocatable, IAECluster { - public final WorldCoord min; - public final WorldCoord max; - public boolean isDestroyed = false; - public boolean updateStatus = true; - public TileQuantumBridge[] Ring; - boolean registered = false; - ConnectionWrapper connection; + private final WorldCoord min; + private final WorldCoord max; + private boolean isDestroyed = false; + private boolean updateStatus = true; + private TileQuantumBridge[] Ring; + private boolean registered = false; + private ConnectionWrapper connection; private long thisSide; private long otherSide; private TileQuantumBridge center; @@ -61,7 +61,7 @@ public class QuantumCluster implements ILocatable, IAECluster { this.min = min; this.max = max; - this.Ring = new TileQuantumBridge[8]; + this.setRing( new TileQuantumBridge[8] ); } @SubscribeEvent @@ -69,7 +69,7 @@ public class QuantumCluster implements ILocatable, IAECluster { if( this.center.getWorld() == e.world ) { - this.updateStatus = false; + this.setUpdateStatus( false ); this.destroy(); } } @@ -122,10 +122,10 @@ public class QuantumCluster implements ILocatable, IAECluster if( sideA.isActive() && sideB.isActive() ) { - if( this.connection != null && this.connection.connection != null ) + if( this.connection != null && this.connection.getConnection() != null ) { - final IGridNode a = this.connection.connection.a(); - final IGridNode b = this.connection.connection.b(); + final IGridNode a = this.connection.getConnection().a(); + final IGridNode b = this.connection.getConnection().b(); final IGridNode sa = sideA.getNode(); final IGridNode sb = sideB.getNode(); if( ( a == sa || b == sa ) && ( a == sb || b == sb ) ) @@ -138,18 +138,18 @@ public class QuantumCluster implements ILocatable, IAECluster { if( sideA.connection != null ) { - if( sideA.connection.connection != null ) + if( sideA.connection.getConnection() != null ) { - sideA.connection.connection.destroy(); + sideA.connection.getConnection().destroy(); sideA.connection = new ConnectionWrapper( null ); } } if( sideB.connection != null ) { - if( sideB.connection.connection != null ) + if( sideB.connection.getConnection() != null ) { - sideB.connection.connection.destroy(); + sideB.connection.getConnection().destroy(); sideB.connection = new ConnectionWrapper( null ); } } @@ -173,16 +173,16 @@ public class QuantumCluster implements ILocatable, IAECluster if( shutdown && this.connection != null ) { - if( this.connection.connection != null ) + if( this.connection.getConnection() != null ) { - this.connection.connection.destroy(); - this.connection.connection = null; + this.connection.getConnection().destroy(); + this.connection.setConnection( null ); this.connection = new ConnectionWrapper( null ); } } } - public boolean canUseNode( final long qe ) + private boolean canUseNode( final long qe ) { final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe ); if( qc != null ) @@ -219,7 +219,7 @@ public class QuantumCluster implements ILocatable, IAECluster return this.center.getGridNode( AEPartLocation.INTERNAL ); } - public boolean hasQES() + private boolean hasQES() { return this.thisSide != 0; } @@ -245,26 +245,26 @@ public class QuantumCluster implements ILocatable, IAECluster MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) ); } - this.center.updateStatus( null, (byte) -1, this.updateStatus ); + this.center.updateStatus( null, (byte) -1, this.isUpdateStatus() ); - for( final TileQuantumBridge r : this.Ring ) + for( final TileQuantumBridge r : this.getRing() ) { - r.updateStatus( null, (byte) -1, this.updateStatus ); + r.updateStatus( null, (byte) -1, this.isUpdateStatus() ); } this.center = null; - this.Ring = new TileQuantumBridge[8]; + this.setRing( new TileQuantumBridge[8] ); } @Override public Iterator getTiles() { - return new ChainedIterator( this.Ring[0], this.Ring[1], this.Ring[2], this.Ring[3], this.Ring[4], this.Ring[5], this.Ring[6], this.Ring[7], this.center ); + return new ChainedIterator( this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3], this.getRing()[4], this.getRing()[5], this.getRing()[6], this.getRing()[7], this.center ); } public boolean isCorner( final TileQuantumBridge tileQuantumBridge ) { - return this.Ring[0] == tileQuantumBridge || this.Ring[2] == tileQuantumBridge || this.Ring[4] == tileQuantumBridge || this.Ring[6] == tileQuantumBridge; + return this.getRing()[0] == tileQuantumBridge || this.getRing()[2] == tileQuantumBridge || this.getRing()[4] == tileQuantumBridge || this.getRing()[6] == tileQuantumBridge; } @Override @@ -278,10 +278,30 @@ public class QuantumCluster implements ILocatable, IAECluster return this.center; } - public void setCenter( final TileQuantumBridge c ) + void setCenter( final TileQuantumBridge c ) { this.registered = true; MinecraftForge.EVENT_BUS.register( this ); this.center = c; } + + private boolean isUpdateStatus() + { + return this.updateStatus; + } + + public void setUpdateStatus( final boolean updateStatus ) + { + this.updateStatus = updateStatus; + } + + TileQuantumBridge[] getRing() + { + return this.Ring; + } + + private void setRing( final TileQuantumBridge[] ring ) + { + this.Ring = ring; + } } diff --git a/src/main/java/appeng/me/cluster/implementations/SpatialPylonCalculator.java b/src/main/java/appeng/me/cluster/implementations/SpatialPylonCalculator.java index 0b7088067..0b662ae84 100644 --- a/src/main/java/appeng/me/cluster/implementations/SpatialPylonCalculator.java +++ b/src/main/java/appeng/me/cluster/implementations/SpatialPylonCalculator.java @@ -95,7 +95,7 @@ public class SpatialPylonCalculator extends MBCalculator { final TileSpatialPylon te = (TileSpatialPylon) w.getTileEntity( new BlockPos( x, y, z ) ); te.updateStatus( c ); - c.line.add( ( te ) ); + c.getLine().add( ( te ) ); } } } diff --git a/src/main/java/appeng/me/cluster/implementations/SpatialPylonCluster.java b/src/main/java/appeng/me/cluster/implementations/SpatialPylonCluster.java index c33801d97..0febdedad 100644 --- a/src/main/java/appeng/me/cluster/implementations/SpatialPylonCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/SpatialPylonCluster.java @@ -32,43 +32,41 @@ import appeng.tile.spatial.TileSpatialPylon; public class SpatialPylonCluster implements IAECluster { - public final DimensionalCoord min; - public final DimensionalCoord max; - final List line = new ArrayList(); - public boolean isDestroyed = false; + private final DimensionalCoord min; + private final DimensionalCoord max; + private final List line = new ArrayList(); + private boolean isDestroyed = false; - public Axis currentAxis = Axis.UNFORMED; - public boolean isValid; - public boolean hasPower; - public boolean hasChannel; + private Axis currentAxis = Axis.UNFORMED; + private boolean isValid; public SpatialPylonCluster( final DimensionalCoord min, final DimensionalCoord max ) { this.min = min.copy(); this.max = max.copy(); - if( this.min.x != this.max.x ) + if( this.getMin().x != this.getMax().x ) { - this.currentAxis = Axis.X; + this.setCurrentAxis( Axis.X ); } - else if( this.min.y != this.max.y ) + else if( this.getMin().y != this.getMax().y ) { - this.currentAxis = Axis.Y; + this.setCurrentAxis( Axis.Y ); } - else if( this.min.z != this.max.z ) + else if( this.getMin().z != this.getMax().z ) { - this.currentAxis = Axis.Z; + this.setCurrentAxis( Axis.Z ); } else { - this.currentAxis = Axis.UNFORMED; + this.setCurrentAxis( Axis.UNFORMED ); } } @Override public void updateStatus( final boolean updateGrid ) { - for( final TileSpatialPylon r : this.line ) + for( final TileSpatialPylon r : this.getLine() ) { r.recalculateDisplay(); } @@ -84,7 +82,7 @@ public class SpatialPylonCluster implements IAECluster } this.isDestroyed = true; - for( final TileSpatialPylon r : this.line ) + for( final TileSpatialPylon r : this.getLine() ) { r.updateStatus( null ); } @@ -93,12 +91,47 @@ public class SpatialPylonCluster implements IAECluster @Override public Iterator getTiles() { - return (Iterator) this.line.iterator(); + return (Iterator) this.getLine().iterator(); } public int tileCount() { - return this.line.size(); + return this.getLine().size(); + } + + public Axis getCurrentAxis() + { + return this.currentAxis; + } + + private void setCurrentAxis( final Axis currentAxis ) + { + this.currentAxis = currentAxis; + } + + public boolean isValid() + { + return this.isValid; + } + + public void setValid( final boolean isValid ) + { + this.isValid = isValid; + } + + public DimensionalCoord getMax() + { + return this.max; + } + + public DimensionalCoord getMin() + { + return this.min; + } + + List getLine() + { + return this.line; } public enum Axis diff --git a/src/main/java/appeng/me/energy/EnergyThreshold.java b/src/main/java/appeng/me/energy/EnergyThreshold.java index 13522fbea..3bf4d0552 100644 --- a/src/main/java/appeng/me/energy/EnergyThreshold.java +++ b/src/main/java/appeng/me/energy/EnergyThreshold.java @@ -26,18 +26,18 @@ import appeng.util.ItemSorters; public class EnergyThreshold implements Comparable { - public final double Limit; - public final IEnergyWatcher watcher; - final int hash; + private final double Limit; + private final IEnergyWatcher watcher; + private final int hash; public EnergyThreshold( final double lim, final IEnergyWatcher wat ) { this.Limit = lim; this.watcher = wat; - if( this.watcher != null ) + if( this.getWatcher() != null ) { - this.hash = this.watcher.hashCode() ^ ( (Double) lim ).hashCode(); + this.hash = this.getWatcher().hashCode() ^ ( (Double) lim ).hashCode(); } else { @@ -54,6 +54,16 @@ public class EnergyThreshold implements Comparable @Override public int compareTo( final EnergyThreshold o ) { - return ItemSorters.compareDouble( this.Limit, o.Limit ); + return ItemSorters.compareDouble( this.getLimit(), o.getLimit() ); + } + + double getLimit() + { + return this.Limit; + } + + public IEnergyWatcher getWatcher() + { + return this.watcher; } } diff --git a/src/main/java/appeng/me/energy/EnergyWatcher.java b/src/main/java/appeng/me/energy/EnergyWatcher.java index c827279de..ed1ad9e6d 100644 --- a/src/main/java/appeng/me/energy/EnergyWatcher.java +++ b/src/main/java/appeng/me/energy/EnergyWatcher.java @@ -34,9 +34,9 @@ import appeng.me.cache.EnergyGridCache; public class EnergyWatcher implements IEnergyWatcher { - final EnergyGridCache gsc; - final IEnergyWatcherHost myObject; - final HashSet myInterests = new HashSet(); + private final EnergyGridCache gsc; + private final IEnergyWatcherHost myObject; + private final HashSet myInterests = new HashSet(); public EnergyWatcher( final EnergyGridCache cache, final IEnergyWatcherHost host ) { @@ -99,14 +99,14 @@ public class EnergyWatcher implements IEnergyWatcher } final EnergyThreshold eh = new EnergyThreshold( e, this ); - return this.gsc.interests.add( eh ) && this.myInterests.add( eh ); + return this.gsc.getInterests().add( eh ) && this.myInterests.add( eh ); } @Override public boolean remove( final Object o ) { final EnergyThreshold eh = new EnergyThreshold( (Double) o, this ); - return this.myInterests.remove( eh ) && this.gsc.interests.remove( eh ); + return this.myInterests.remove( eh ) && this.gsc.getInterests().remove( eh ); } @Override @@ -163,17 +163,17 @@ public class EnergyWatcher implements IEnergyWatcher final Iterator i = this.myInterests.iterator(); while( i.hasNext() ) { - this.gsc.interests.remove( i.next() ); + this.gsc.getInterests().remove( i.next() ); i.remove(); } } - class EnergyWatcherIterator implements Iterator + private class EnergyWatcherIterator implements Iterator { - final EnergyWatcher watcher; - final Iterator interestIterator; - EnergyThreshold myLast; + private final EnergyWatcher watcher; + private final Iterator interestIterator; + private EnergyThreshold myLast; public EnergyWatcherIterator( final EnergyWatcher parent, final Iterator i ) { @@ -191,13 +191,13 @@ public class EnergyWatcher implements IEnergyWatcher public Double next() { this.myLast = this.interestIterator.next(); - return this.myLast.Limit; + return this.myLast.getLimit(); } @Override public void remove() { - EnergyWatcher.this.gsc.interests.remove( this.myLast ); + EnergyWatcher.this.gsc.getInterests().remove( this.myLast ); this.interestIterator.remove(); } } diff --git a/src/main/java/appeng/me/helpers/AENetworkProxy.java b/src/main/java/appeng/me/helpers/AENetworkProxy.java index 7415d327e..459dd126e 100644 --- a/src/main/java/appeng/me/helpers/AENetworkProxy.java +++ b/src/main/java/appeng/me/helpers/AENetworkProxy.java @@ -60,8 +60,8 @@ public class AENetworkProxy implements IGridBlock private final IGridProxyable gp; private final boolean worldNode; private final String nbtName; // name - public AEColor myColor = AEColor.Transparent; - NBTTagCompound data = null; // input + private AEColor myColor = AEColor.Transparent; + private NBTTagCompound data = null; // input private ItemStack myRepInstance; private boolean isReady = false; private IGridNode node = null; @@ -322,7 +322,7 @@ public class AENetworkProxy implements IGridBlock @Override public AEColor getGridColor() { - return this.myColor; + return this.getColor(); } @Override @@ -437,4 +437,14 @@ public class AENetworkProxy implements IGridBlock { this.owner = player; } + + public AEColor getColor() + { + return this.myColor; + } + + public void setColor( final AEColor myColor ) + { + this.myColor = myColor; + } } diff --git a/src/main/java/appeng/me/helpers/AENetworkProxyMultiblock.java b/src/main/java/appeng/me/helpers/AENetworkProxyMultiblock.java index e74677530..f92fc1b68 100644 --- a/src/main/java/appeng/me/helpers/AENetworkProxyMultiblock.java +++ b/src/main/java/appeng/me/helpers/AENetworkProxyMultiblock.java @@ -49,7 +49,7 @@ public class AENetworkProxyMultiblock extends AENetworkProxy implements IGridMul return new ProxyNodeIterator( this.getCluster().getTiles() ); } - IAECluster getCluster() + private IAECluster getCluster() { return ( (IAEMultiBlock) this.getMachine() ).getCluster(); } diff --git a/src/main/java/appeng/me/helpers/ChannelPowerSrc.java b/src/main/java/appeng/me/helpers/ChannelPowerSrc.java index 9bfff2b9a..8ca76443c 100644 --- a/src/main/java/appeng/me/helpers/ChannelPowerSrc.java +++ b/src/main/java/appeng/me/helpers/ChannelPowerSrc.java @@ -28,8 +28,8 @@ import appeng.api.networking.energy.IEnergySource; public class ChannelPowerSrc implements IEnergySource { - final IGridNode node; - final IEnergySource realSrc; + private final IGridNode node; + private final IEnergySource realSrc; public ChannelPowerSrc( final IGridNode networkNode, final IEnergySource src ) { diff --git a/src/main/java/appeng/me/helpers/GenericInterestManager.java b/src/main/java/appeng/me/helpers/GenericInterestManager.java index a198a2e26..a6e3c317d 100644 --- a/src/main/java/appeng/me/helpers/GenericInterestManager.java +++ b/src/main/java/appeng/me/helpers/GenericInterestManager.java @@ -108,12 +108,12 @@ public class GenericInterestManager return this.container.get( stack ); } - class SavedTransactions + private class SavedTransactions { - public final boolean put; - public final IAEStack stack; - public final T iw; + private final boolean put; + private final IAEStack stack; + private final T iw; public SavedTransactions( final boolean putOperation, final IAEStack myStack, final T watcher ) { diff --git a/src/main/java/appeng/me/pathfinding/ControllerValidator.java b/src/main/java/appeng/me/pathfinding/ControllerValidator.java index 7e9aff2eb..9fd2b78de 100644 --- a/src/main/java/appeng/me/pathfinding/ControllerValidator.java +++ b/src/main/java/appeng/me/pathfinding/ControllerValidator.java @@ -29,14 +29,14 @@ import appeng.tile.networking.TileController; public class ControllerValidator implements IGridVisitor { - public boolean isValid = true; - public int found = 0; - int minX; - int minY; - int minZ; - int maxX; - int maxY; - int maxZ; + private boolean isValid = true; + private int found = 0; + private int minX; + private int minY; + private int minZ; + private int maxX; + private int maxY; + private int maxZ; public ControllerValidator( final int x, final int y, final int z ) { @@ -52,7 +52,7 @@ public class ControllerValidator implements IGridVisitor public boolean visitNode( final IGridNode n ) { final IGridHost host = n.getMachine(); - if( this.isValid && host instanceof TileController ) + if( this.isValid() && host instanceof TileController ) { final TileController c = (TileController) host; @@ -67,17 +67,37 @@ public class ControllerValidator implements IGridVisitor if( this.maxX - this.minX < 7 && this.maxY - this.minY < 7 && this.maxZ - this.minZ < 7 ) { - this.found++; + this.setFound( this.getFound() + 1 ); return true; } - this.isValid = false; + this.setValid( false ); } else { return false; } + return this.isValid(); + } + + public boolean isValid() + { return this.isValid; } + + private void setValid( final boolean isValid ) + { + this.isValid = isValid; + } + + public int getFound() + { + return this.found; + } + + private void setFound( final int found ) + { + this.found = found; + } } diff --git a/src/main/java/appeng/me/pathfinding/PathSegment.java b/src/main/java/appeng/me/pathfinding/PathSegment.java index 1c38ba593..f4c78683f 100644 --- a/src/main/java/appeng/me/pathfinding/PathSegment.java +++ b/src/main/java/appeng/me/pathfinding/PathSegment.java @@ -34,11 +34,11 @@ import appeng.me.cache.PathGridCache; public class PathSegment { - final PathGridCache pgc; - final Set semiOpen; - final Set closed; - public boolean isDead; - List open; + private final PathGridCache pgc; + private final Set semiOpen; + private final Set closed; + private boolean isDead; + private List open; public PathSegment( final PathGridCache myPGC, final List open, final Set semiOpen, final Set closed ) { @@ -46,7 +46,7 @@ public class PathSegment this.semiOpen = semiOpen; this.closed = closed; this.pgc = myPGC; - this.isDead = false; + this.setDead( false ); } public boolean step() @@ -125,12 +125,12 @@ public class PathSegment pi = start; while( pi != null ) { - this.pgc.channelsByBlocks++; + this.pgc.setChannelsByBlocks( this.pgc.getChannelsByBlocks() + 1 ); pi.incrementChannelCount( 1 ); pi = pi.getControllerRoute(); } - this.pgc.channelsInUse++; + this.pgc.setChannelsInUse( this.pgc.getChannelsInUse() + 1 ); return true; } @@ -150,12 +150,22 @@ public class PathSegment pi = start; while( pi != null ) { - this.pgc.channelsByBlocks++; + this.pgc.setChannelsByBlocks( this.pgc.getChannelsByBlocks() + 1 ); pi.incrementChannelCount( 1 ); pi = pi.getControllerRoute(); } - this.pgc.channelsInUse++; + this.pgc.setChannelsInUse( this.pgc.getChannelsInUse() + 1 ); return true; } + + public boolean isDead() + { + return this.isDead; + } + + public void setDead( final boolean isDead ) + { + this.isDead = isDead; + } } diff --git a/src/main/java/appeng/me/storage/CellInventory.java b/src/main/java/appeng/me/storage/CellInventory.java index e766f2962..7c3ef0f14 100644 --- a/src/main/java/appeng/me/storage/CellInventory.java +++ b/src/main/java/appeng/me/storage/CellInventory.java @@ -48,25 +48,25 @@ import appeng.util.item.AEItemStack; public class CellInventory implements ICellInventory { - static final String ITEM_TYPE_TAG = "it"; - static final String ITEM_COUNT_TAG = "ic"; - static final String ITEM_SLOT = "#"; - static final String ITEM_SLOT_COUNT = "@"; - static final String ITEM_PRE_FORMATTED_COUNT = "PF"; - static final String ITEM_PRE_FORMATTED_SLOT = "PF#"; - static final String ITEM_PRE_FORMATTED_NAME = "PN"; - static final String ITEM_PRE_FORMATTED_FUZZY = "FP"; + private static final String ITEM_TYPE_TAG = "it"; + private static final String ITEM_COUNT_TAG = "ic"; + private static final String ITEM_SLOT = "#"; + private static final String ITEM_SLOT_COUNT = "@"; + private static final String ITEM_PRE_FORMATTED_COUNT = "PF"; + private static final String ITEM_PRE_FORMATTED_SLOT = "PF#"; + private static final String ITEM_PRE_FORMATTED_NAME = "PN"; + private static final String ITEM_PRE_FORMATTED_FUZZY = "FP"; private static final HashSet BLACK_LIST = new HashSet(); - protected static String[] itemSlots; - protected static String[] itemSlotCount; - protected final NBTTagCompound tagCompound; - protected final ISaveProvider container; - protected int maxItemTypes = 63; - protected short storedItems = 0; - protected int storedItemCount = 0; - protected IItemList cellItems; - protected ItemStack i; - protected IStorageCell cellType; + private static String[] itemSlots; + private static String[] itemSlotCount; + private final NBTTagCompound tagCompound; + private final ISaveProvider container; + private int maxItemTypes = 63; + private short storedItems = 0; + private int storedItemCount = 0; + private IItemList cellItems; + private ItemStack i; + private IStorageCell cellType; protected CellInventory( final NBTTagCompound data, final ISaveProvider container ) { @@ -74,7 +74,7 @@ public class CellInventory implements ICellInventory this.container = container; } - protected CellInventory( final ItemStack o, final ISaveProvider container ) throws AppEngException + private CellInventory( final ItemStack o, final ISaveProvider container ) throws AppEngException { if( itemSlots == null ) { @@ -185,7 +185,7 @@ public class CellInventory implements ICellInventory BLACK_LIST.add( ( meta << Platform.DEF_OFFSET ) | itemID ); } - public static boolean isBlackListed( final IAEItemStack input ) + private static boolean isBlackListed( final IAEItemStack input ) { if( BLACK_LIST.contains( ( OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET ) | Item.getIdFromItem( input.getItem() ) ) ) { diff --git a/src/main/java/appeng/me/storage/CellInventoryHandler.java b/src/main/java/appeng/me/storage/CellInventoryHandler.java index fcea2e372..b49a9be45 100644 --- a/src/main/java/appeng/me/storage/CellInventoryHandler.java +++ b/src/main/java/appeng/me/storage/CellInventoryHandler.java @@ -108,7 +108,7 @@ public class CellInventoryHandler extends MEInventoryHandler imple @Override public ICellInventory getCellInv() { - Object o = this.internal; + Object o = this.getInternal(); if( o instanceof MEPassThrough ) { diff --git a/src/main/java/appeng/me/storage/CreativeCellInventory.java b/src/main/java/appeng/me/storage/CreativeCellInventory.java index 514e85707..a0fb6cb94 100644 --- a/src/main/java/appeng/me/storage/CreativeCellInventory.java +++ b/src/main/java/appeng/me/storage/CreativeCellInventory.java @@ -35,7 +35,7 @@ import appeng.util.item.AEItemStack; public class CreativeCellInventory implements IMEInventoryHandler { - final IItemList itemListCache = AEApi.instance().storage().createItemList(); + private final IItemList itemListCache = AEApi.instance().storage().createItemList(); protected CreativeCellInventory( final ItemStack o ) { diff --git a/src/main/java/appeng/me/storage/DriveWatcher.java b/src/main/java/appeng/me/storage/DriveWatcher.java index 4437c0d8c..7eebc9dd4 100644 --- a/src/main/java/appeng/me/storage/DriveWatcher.java +++ b/src/main/java/appeng/me/storage/DriveWatcher.java @@ -31,10 +31,10 @@ import appeng.api.storage.data.IAEStack; public class DriveWatcher> extends MEInventoryHandler { - final int oldStatus = 0; - final ItemStack is; - final ICellHandler handler; - final IChestOrDrive cord; + private final int oldStatus = 0; + private final ItemStack is; + private final ICellHandler handler; + private final IChestOrDrive cord; public DriveWatcher( final IMEInventory i, final ItemStack is, final ICellHandler han, final IChestOrDrive cod ) { diff --git a/src/main/java/appeng/me/storage/ItemWatcher.java b/src/main/java/appeng/me/storage/ItemWatcher.java index 91699ad96..84f458a52 100644 --- a/src/main/java/appeng/me/storage/ItemWatcher.java +++ b/src/main/java/appeng/me/storage/ItemWatcher.java @@ -35,9 +35,9 @@ import appeng.me.cache.GridStorageCache; public class ItemWatcher implements IStackWatcher { - final GridStorageCache gsc; - final IStackWatcherHost myObject; - final HashSet myInterests = new HashSet(); + private final GridStorageCache gsc; + private final IStackWatcherHost myObject; + private final HashSet myInterests = new HashSet(); public ItemWatcher( final GridStorageCache cache, final IStackWatcherHost host ) { @@ -94,13 +94,13 @@ public class ItemWatcher implements IStackWatcher return false; } - return this.myInterests.add( e.copy() ) && this.gsc.interestManager.put( e, this ); + return this.myInterests.add( e.copy() ) && this.gsc.getInterestManager().put( e, this ); } @Override public boolean remove( final Object o ) { - return this.myInterests.remove( o ) && this.gsc.interestManager.remove( (IAEStack) o, this ); + return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this ); } @Override @@ -157,17 +157,17 @@ public class ItemWatcher implements IStackWatcher final Iterator i = this.myInterests.iterator(); while( i.hasNext() ) { - this.gsc.interestManager.remove( i.next(), this ); + this.gsc.getInterestManager().remove( i.next(), this ); i.remove(); } } - class ItemWatcherIterator implements Iterator + private class ItemWatcherIterator implements Iterator { - final ItemWatcher watcher; - final Iterator interestIterator; - IAEStack myLast; + private final ItemWatcher watcher; + private final Iterator interestIterator; + private IAEStack myLast; public ItemWatcherIterator( final ItemWatcher parent, final Iterator i ) { @@ -190,7 +190,7 @@ public class ItemWatcher implements IStackWatcher @Override public void remove() { - ItemWatcher.this.gsc.interestManager.remove( this.myLast, this.watcher ); + ItemWatcher.this.gsc.getInterestManager().remove( this.myLast, this.watcher ); this.interestIterator.remove(); } } diff --git a/src/main/java/appeng/me/storage/MEIInventoryWrapper.java b/src/main/java/appeng/me/storage/MEIInventoryWrapper.java index 6132e43a6..1500f48b3 100644 --- a/src/main/java/appeng/me/storage/MEIInventoryWrapper.java +++ b/src/main/java/appeng/me/storage/MEIInventoryWrapper.java @@ -35,8 +35,8 @@ import appeng.util.item.AEItemStack; public class MEIInventoryWrapper implements IMEInventory { - protected final IInventory target; - protected final InventoryAdaptor adaptor; + private final IInventory target; + private final InventoryAdaptor adaptor; public MEIInventoryWrapper( final IInventory m, final InventoryAdaptor ia ) { diff --git a/src/main/java/appeng/me/storage/MEInventoryHandler.java b/src/main/java/appeng/me/storage/MEInventoryHandler.java index 79eb47134..062f02c31 100644 --- a/src/main/java/appeng/me/storage/MEInventoryHandler.java +++ b/src/main/java/appeng/me/storage/MEInventoryHandler.java @@ -25,7 +25,6 @@ import appeng.api.config.IncludeExclude; import appeng.api.networking.security.BaseActionSource; import appeng.api.storage.IMEInventory; import appeng.api.storage.IMEInventoryHandler; -import appeng.api.storage.IMEMonitor; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IItemList; @@ -36,9 +35,7 @@ import appeng.util.prioitylist.IPartitionList; public class MEInventoryHandler> implements IMEInventoryHandler { - protected final IMEMonitor monitor; - protected final IMEInventoryHandler internal; - final StorageChannel channel; + private final IMEInventoryHandler internal; private int myPriority; private IncludeExclude myWhitelist; private AccessRestriction myAccess; @@ -50,8 +47,6 @@ public class MEInventoryHandler> implements IMEInventoryHa public MEInventoryHandler( final IMEInventory i, final StorageChannel channel ) { - this.channel = channel; - if( i instanceof IMEInventoryHandler ) { this.internal = (IMEInventoryHandler) i; @@ -61,15 +56,13 @@ public class MEInventoryHandler> implements IMEInventoryHa this.internal = new MEPassThrough( i, channel ); } - this.monitor = this.internal instanceof IMEMonitor ? (IMEMonitor) this.internal : null; - this.myPriority = 0; this.myWhitelist = IncludeExclude.WHITELIST; this.setBaseAccess( AccessRestriction.READ_WRITE ); this.myPartitionList = new DefaultPriorityList(); } - public IncludeExclude getWhitelist() + IncludeExclude getWhitelist() { return this.myWhitelist; } @@ -92,7 +85,7 @@ public class MEInventoryHandler> implements IMEInventoryHa this.hasWriteAccess = this.cachedAccessRestriction.hasPermission( AccessRestriction.WRITE ); } - public IPartitionList getPartitionList() + IPartitionList getPartitionList() { return this.myPartitionList; } diff --git a/src/main/java/appeng/me/storage/MEMonitorIInventory.java b/src/main/java/appeng/me/storage/MEMonitorIInventory.java index 56c46da1e..9c078d647 100644 --- a/src/main/java/appeng/me/storage/MEMonitorIInventory.java +++ b/src/main/java/appeng/me/storage/MEMonitorIInventory.java @@ -46,12 +46,12 @@ import appeng.util.inv.ItemSlot; public class MEMonitorIInventory implements IMEMonitor { - final InventoryAdaptor adaptor; - final IItemList list = AEApi.instance().storage().createItemList(); - final HashMap, Object> listeners = new HashMap, Object>(); + private final InventoryAdaptor adaptor; + private final IItemList list = AEApi.instance().storage().createItemList(); + private final HashMap, Object> listeners = new HashMap, Object>(); private final NavigableMap memory; - public BaseActionSource mySource; - public StorageFilter mode = StorageFilter.EXTRACTABLE_ONLY; + private BaseActionSource mySource; + private StorageFilter mode = StorageFilter.EXTRACTABLE_ONLY; public MEMonitorIInventory( final InventoryAdaptor adaptor ) { @@ -148,16 +148,16 @@ public class MEMonitorIInventory implements IMEMonitor boolean changed = false; for( final ItemSlot is : this.adaptor ) { - final CachedItemStack old = this.memory.get( is.slot ); - high = Math.max( high, is.slot ); + final CachedItemStack old = this.memory.get( is.getSlot() ); + high = Math.max( high, is.getSlot() ); - final ItemStack newIS = !is.isExtractable && this.mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack(); + final ItemStack newIS = !is.isExtractable() && this.getMode() == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack(); final ItemStack oldIS = old == null ? null : old.itemStack; if( this.isDifferent( newIS, oldIS ) ) { final CachedItemStack cis = new CachedItemStack( is.getItemStack() ); - this.memory.put( is.slot, cis ); + this.memory.put( is.getSlot(), cis ); if( old != null && old.aeStack != null ) { @@ -188,7 +188,7 @@ public class MEMonitorIInventory implements IMEMonitor if( diff != 0 && stack != null ) { final CachedItemStack cis = new CachedItemStack( is.getItemStack() ); - this.memory.put( is.slot, cis ); + this.memory.put( is.getSlot(), cis ); final IAEItemStack a = stack.copy(); a.setStackSize( diff ); @@ -250,7 +250,7 @@ public class MEMonitorIInventory implements IMEMonitor final IMEMonitorHandlerReceiver key = l.getKey(); if( key.isValid( l.getValue() ) ) { - key.postChange( this, a, this.mySource ); + key.postChange( this, a, this.getActionSource() ); } else { @@ -313,11 +313,31 @@ public class MEMonitorIInventory implements IMEMonitor return this.list; } - static class CachedItemStack + private StorageFilter getMode() + { + return this.mode; + } + + public void setMode( final StorageFilter mode ) + { + this.mode = mode; + } + + private BaseActionSource getActionSource() + { + return this.mySource; + } + + public void setActionSource( final BaseActionSource mySource ) + { + this.mySource = mySource; + } + + private static class CachedItemStack { - final ItemStack itemStack; - final IAEItemStack aeStack; + private final ItemStack itemStack; + private final IAEItemStack aeStack; public CachedItemStack( final ItemStack is ) { diff --git a/src/main/java/appeng/me/storage/MEMonitorPassThrough.java b/src/main/java/appeng/me/storage/MEMonitorPassThrough.java index dfc054c0d..d0612910e 100644 --- a/src/main/java/appeng/me/storage/MEMonitorPassThrough.java +++ b/src/main/java/appeng/me/storage/MEMonitorPassThrough.java @@ -38,9 +38,9 @@ import appeng.util.inv.ItemListIgnoreCrafting; public class MEMonitorPassThrough> extends MEPassThrough implements IMEMonitor, IMEMonitorHandlerReceiver { - final HashMap, Object> listeners = new HashMap, Object>(); - public BaseActionSource changeSource; - IMEMonitor monitor; + private final HashMap, Object> listeners = new HashMap, Object>(); + private BaseActionSource changeSource; + private IMEMonitor monitor; public MEMonitorPassThrough( final IMEInventory i, final StorageChannel channel ) { @@ -60,7 +60,7 @@ public class MEMonitorPassThrough> extends MEPassThrough before = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) ); + final IItemList before = this.getInternal() == null ? this.getWrappedChannel().createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.getWrappedChannel().createList() ) ); super.setInternal( i ); if( i instanceof IMEMonitor ) @@ -68,14 +68,14 @@ public class MEMonitorPassThrough> extends MEPassThrough) i; } - final IItemList after = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) ); + final IItemList after = this.getInternal() == null ? this.getWrappedChannel().createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.getWrappedChannel().createList() ) ); if( this.monitor != null ) { this.monitor.addListener( this, this.monitor ); } - Platform.postListChanges( before, after, this, this.changeSource ); + Platform.postListChanges( before, after, this, this.getChangeSource() ); } @Override @@ -102,7 +102,7 @@ public class MEMonitorPassThrough> extends MEPassThrough out = this.channel.createList(); + final IItemList out = this.getWrappedChannel().createList(); this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) ); return out; } @@ -152,4 +152,14 @@ public class MEMonitorPassThrough> extends MEPassThrough> implements IMEInventoryHandler { - protected final StorageChannel channel; + private final StorageChannel wrappedChannel; private IMEInventory internal; public MEPassThrough( final IMEInventory i, final StorageChannel channel ) { - this.channel = channel; + this.wrappedChannel = channel; this.setInternal( i ); } @@ -110,4 +110,9 @@ public class MEPassThrough> implements IMEInventoryHandler { return true; } + + StorageChannel getWrappedChannel() + { + return this.wrappedChannel; + } } diff --git a/src/main/java/appeng/me/storage/NetworkInventoryHandler.java b/src/main/java/appeng/me/storage/NetworkInventoryHandler.java index b96a5a97f..fffaf7f1e 100644 --- a/src/main/java/appeng/me/storage/NetworkInventoryHandler.java +++ b/src/main/java/appeng/me/storage/NetworkInventoryHandler.java @@ -47,8 +47,8 @@ import appeng.util.ItemSorters; public class NetworkInventoryHandler> implements IMEInventoryHandler { - static final ThreadLocal DEPTH_MOD = new ThreadLocal(); - static final ThreadLocal DEPTH_SIM = new ThreadLocal(); + private static final ThreadLocal DEPTH_MOD = new ThreadLocal(); + private static final ThreadLocal DEPTH_SIM = new ThreadLocal(); private static final Comparator PRIORITY_SORTER = new Comparator() { @@ -58,12 +58,12 @@ public class NetworkInventoryHandler> implements IMEInvent return ItemSorters.compareInt( o2, o1 ); } }; - static int currentPass = 0; - final StorageChannel myChannel; - final SecurityCache security; + private static int currentPass = 0; + private final StorageChannel myChannel; + private final SecurityCache security; // final TreeMultimap> priorityInventory; private final NavigableMap>> priorityInventory; - int myPass = 0; + private int myPass = 0; public NetworkInventoryHandler( final StorageChannel chan, final SecurityCache security ) { @@ -164,7 +164,7 @@ public class NetworkInventoryHandler> implements IMEInvent } final IGrid gn = n.getGrid(); - if( gn != this.security.myGrid ) + if( gn != this.security.getGrid() ) { final ISecurityGrid sg = gn.getCache( ISecurityGrid.class ); diff --git a/src/main/java/appeng/me/storage/SecurityInventory.java b/src/main/java/appeng/me/storage/SecurityInventory.java index 5032801b0..27515c21d 100644 --- a/src/main/java/appeng/me/storage/SecurityInventory.java +++ b/src/main/java/appeng/me/storage/SecurityInventory.java @@ -39,8 +39,8 @@ import com.mojang.authlib.GameProfile; public class SecurityInventory implements IMEInventoryHandler { - public final IItemList storedItems = AEApi.instance().storage().createItemList(); - final TileSecurity securityTile; + private final IItemList storedItems = AEApi.instance().storage().createItemList(); + private final TileSecurity securityTile; public SecurityInventory( final TileSecurity ts ) { @@ -61,7 +61,7 @@ public class SecurityInventory implements IMEInventoryHandler return null; } - this.storedItems.add( input ); + this.getStoredItems().add( input ); this.securityTile.inventoryChanged(); return null; } @@ -91,7 +91,7 @@ public class SecurityInventory implements IMEInventoryHandler { if( this.hasPermission( src ) ) { - final IAEItemStack target = this.storedItems.findPrecise( request ); + final IAEItemStack target = this.getStoredItems().findPrecise( request ); if( target != null ) { final IAEItemStack output = target.copy(); @@ -112,7 +112,7 @@ public class SecurityInventory implements IMEInventoryHandler @Override public IItemList getAvailableItems( final IItemList out ) { - for( final IAEItemStack ais : this.storedItems ) + for( final IAEItemStack ais : this.getStoredItems() ) { out.add( ais ); } @@ -152,7 +152,7 @@ public class SecurityInventory implements IMEInventoryHandler return false; } - for( final IAEItemStack ais : this.storedItems ) + for( final IAEItemStack ais : this.getStoredItems() ) { if( ais.isMeaningful() ) { @@ -191,4 +191,9 @@ public class SecurityInventory implements IMEInventoryHandler { return true; } + + public IItemList getStoredItems() + { + return this.storedItems; + } } diff --git a/src/main/java/appeng/me/storage/VoidFluidInventory.java b/src/main/java/appeng/me/storage/VoidFluidInventory.java index 3cab7082d..af98dc6e3 100644 --- a/src/main/java/appeng/me/storage/VoidFluidInventory.java +++ b/src/main/java/appeng/me/storage/VoidFluidInventory.java @@ -32,7 +32,7 @@ import appeng.tile.misc.TileCondenser; public class VoidFluidInventory implements IMEInventoryHandler { - final TileCondenser target; + private final TileCondenser target; public VoidFluidInventory( final TileCondenser te ) { diff --git a/src/main/java/appeng/me/storage/VoidItemInventory.java b/src/main/java/appeng/me/storage/VoidItemInventory.java index 5400e75bb..57ed06fce 100644 --- a/src/main/java/appeng/me/storage/VoidItemInventory.java +++ b/src/main/java/appeng/me/storage/VoidItemInventory.java @@ -32,7 +32,7 @@ import appeng.tile.misc.TileCondenser; public class VoidItemInventory implements IMEInventoryHandler { - final TileCondenser target; + private final TileCondenser target; public VoidItemInventory( final TileCondenser te ) { diff --git a/src/main/java/appeng/parts/AEBasePart.java b/src/main/java/appeng/parts/AEBasePart.java index c6a9abd78..cd331bead 100644 --- a/src/main/java/appeng/parts/AEBasePart.java +++ b/src/main/java/appeng/parts/AEBasePart.java @@ -44,6 +44,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import appeng.api.AEApi; import appeng.api.config.Upgrades; import appeng.api.definitions.IDefinitions; @@ -77,11 +78,11 @@ import appeng.util.SettingsFrom; public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradeableHost, ICustomNameObject { - protected final AENetworkProxy proxy; - protected final ItemStack is; - protected TileEntity tile = null; - protected IPartHost host = null; - protected AEPartLocation side = null; + private final AENetworkProxy proxy; + private final ItemStack is; + private TileEntity tile = null; + private IPartHost host = null; + private AEPartLocation side = null; public AEBasePart( final ItemStack is ) { @@ -112,7 +113,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, @Override public void securityBreak() { - if( this.is.stackSize > 0 ) + if( this.getItemStack().stackSize > 0 ) { final List items = new ArrayList(); items.add( this.is.copy() ); @@ -192,7 +193,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, @Override public String getCustomName() { - return this.is.getDisplayName(); + return this.getItemStack().getDisplayName(); } @Override @@ -206,12 +207,12 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, @Override public boolean hasCustomName() { - return this.is.hasDisplayName(); + return this.getItemStack().hasDisplayName(); } public void addEntityCrashInfo( final CrashReportCategory crashreportcategory ) { - crashreportcategory.addCrashSection( "Part Side", this.side ); + crashreportcategory.addCrashSection( "Part Side", this.getSide() ); } @Override @@ -314,7 +315,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, @Override public void setPartHostInfo( final AEPartLocation side, final IPartHost host, final TileEntity tile ) { - this.side = side; + this.setSide( side ); this.tile = tile; this.host = host; } @@ -374,7 +375,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, * @param from source of settings * @param compound compound of source */ - public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound ) + private void uploadSettings( final SettingsFrom from, final NBTTagCompound compound ) { if( compound != null ) { @@ -411,7 +412,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, * * @return compound of source */ - public NBTTagCompound downloadSettings( final SettingsFrom from ) + private NBTTagCompound downloadSettings( final SettingsFrom from ) { final NBTTagCompound output = new NBTTagCompound(); @@ -543,8 +544,23 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost, @Override @SideOnly( Side.CLIENT ) - public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer) + public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer ) { return null; } + + public AEPartLocation getSide() + { + return this.side; + } + + private void setSide( final AEPartLocation side ) + { + this.side = side; + } + + public ItemStack getItemStack() + { + return this.is; + } } \ No newline at end of file diff --git a/src/main/java/appeng/parts/BusCollisionHelper.java b/src/main/java/appeng/parts/BusCollisionHelper.java index 4f30dd571..d817c2f7b 100644 --- a/src/main/java/appeng/parts/BusCollisionHelper.java +++ b/src/main/java/appeng/parts/BusCollisionHelper.java @@ -31,7 +31,7 @@ import appeng.api.util.AEPartLocation; public class BusCollisionHelper implements IPartCollisionHelper { - final List boxes; + private final List boxes; private final EnumFacing x; private final EnumFacing y; diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java index e354fffe4..077aea38c 100644 --- a/src/main/java/appeng/parts/CableBusContainer.java +++ b/src/main/java/appeng/parts/CableBusContainer.java @@ -77,10 +77,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I private static final ThreadLocal IS_LOADING = new ThreadLocal(); private final EnumSet myLayerFlags = EnumSet.noneOf( LayerFlags.class ); - public YesNo hasRedstone = YesNo.UNDECIDED; - public IPartHost tcb; - public boolean requiresDynamicRender = false; - boolean inWorld = false; + private YesNo hasRedstone = YesNo.UNDECIDED; + private IPartHost tcb; + private boolean requiresDynamicRender = false; + private boolean inWorld = false; public CableBusContainer( final IPartHost host ) { @@ -327,7 +327,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I { return this.getSide( AEPartLocation.fromFacing( side ) ); } - + @Override public void removePart( final AEPartLocation side, final boolean suppressUpdate ) { @@ -548,7 +548,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I this.hasRedstone = te.getWorld().isBlockIndirectlyGettingPowered( te.getPos() ) != 0 ? YesNo.YES : YesNo.NO; } - public void updateDynamicRender() + private void updateDynamicRender() { this.requiresDynamicRender = false; for( final AEPartLocation s : AEPartLocation.SIDE_LOCATIONS ) @@ -556,7 +556,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I final IPart p = this.getPart( s ); if( p != null ) { - this.requiresDynamicRender = this.requiresDynamicRender || p.requireDynamicRender(); + this.setRequiresDynamicRender( this.isRequiresDynamicRender() || p.requireDynamicRender() ); } } } @@ -1021,7 +1021,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I } } - AEPartLocation getSide( final IPart part ) + private AEPartLocation getSide( final IPart part ) { if( this.getCenter() == part ) { @@ -1142,4 +1142,14 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I } return false; } + + public boolean isRequiresDynamicRender() + { + return this.requiresDynamicRender; + } + + private void setRequiresDynamicRender( final boolean requiresDynamicRender ) + { + this.requiresDynamicRender = requiresDynamicRender; + } } diff --git a/src/main/java/appeng/parts/PartBasicState.java b/src/main/java/appeng/parts/PartBasicState.java index fb1a79629..607db4f1d 100644 --- a/src/main/java/appeng/parts/PartBasicState.java +++ b/src/main/java/appeng/parts/PartBasicState.java @@ -47,12 +47,12 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel protected static final int POWERED_FLAG = 1; protected static final int CHANNEL_FLAG = 2; - protected int clientFlags = 0; // sent as byte. + private int clientFlags = 0; // sent as byte. public PartBasicState( final ItemStack is ) { super( is ); - this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); } @MENetworkEventSubscribe @@ -103,28 +103,28 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel { super.writeToStream( data ); - this.clientFlags = 0; + this.setClientFlags( 0 ); try { - if( this.proxy.getEnergy().isNetworkPowered() ) + if( this.getProxy().getEnergy().isNetworkPowered() ) { - this.clientFlags |= POWERED_FLAG; + this.setClientFlags( this.getClientFlags() | POWERED_FLAG ); } - if( this.proxy.getNode().meetsChannelRequirements() ) + if( this.getProxy().getNode().meetsChannelRequirements() ) { - this.clientFlags |= CHANNEL_FLAG; + this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG ); } - this.clientFlags = this.populateFlags( this.clientFlags ); + this.setClientFlags( this.populateFlags( this.getClientFlags() ) ); } catch( final GridAccessException e ) { // meh } - data.writeByte( (byte) this.clientFlags ); + data.writeByte( (byte) this.getClientFlags() ); } protected int populateFlags( final int cf ) @@ -137,10 +137,10 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel { final boolean eh = super.readFromStream( data ); - final int old = this.clientFlags; - this.clientFlags = data.readByte(); + final int old = this.getClientFlags(); + this.setClientFlags( data.readByte() ); - return eh || old != this.clientFlags; + return eh || old != this.getClientFlags(); } @Override @@ -153,12 +153,22 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel @Override public boolean isPowered() { - return ( this.clientFlags & POWERED_FLAG ) == POWERED_FLAG; + return ( this.getClientFlags() & POWERED_FLAG ) == POWERED_FLAG; } @Override public boolean isActive() { - return ( this.clientFlags & CHANNEL_FLAG ) == CHANNEL_FLAG; + return ( this.getClientFlags() & CHANNEL_FLAG ) == CHANNEL_FLAG; + } + + public int getClientFlags() + { + return this.clientFlags; + } + + private void setClientFlags( final int clientFlags ) + { + this.clientFlags = clientFlags; } } diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java index 46275d094..6bc0d764c 100644 --- a/src/main/java/appeng/parts/PartPlacement.java +++ b/src/main/java/appeng/parts/PartPlacement.java @@ -68,7 +68,7 @@ import com.google.common.base.Optional; public class PartPlacement { - public static float eyeHeight = 0.0f; + private static float eyeHeight = 0.0f; private final ThreadLocal placing = new ThreadLocal(); private boolean wasCanceled = false; @@ -100,7 +100,8 @@ public class PartPlacement if( !world.isRemote ) { final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) ); - final MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.a, dir.b ); + final MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.getA(), dir.getB() ); + if( mop != null ) { final List is = new LinkedList(); @@ -194,27 +195,29 @@ public class PartPlacement } // TODO: IFMP INTEGRATION - // TODO IIMMIBISMICROBLOCKS INTEGRATION - - /* - if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) - { - host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile ); - } + // TODO IIMMIBISMICROBLOCKS INTEGRATION + + /* + * if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) + * { + * host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile ); + * } + * if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( + * IntegrationType.ImmibisMicroblocks ) ) + * { + * host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks ) + * ).getOrCreateHost( player, face, tile ); + * } + */ - if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.ImmibisMicroblocks ) ) - { - host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, face, tile ); - } - */ - // if ( held == null ) { final Block block = world.getBlockState( pos ).getBlock(); if( host != null && player.isSneaking() && block != null ) { final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) ); - final MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.a, dir.b ); + final MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.getA(), dir.getB() ); + if( mop != null ) { mop.hitVec = mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ); @@ -265,20 +268,22 @@ public class PartPlacement } // TODO: IFMP INTEGRATION - // TODO IIMMIBISMICROBLOCKS INTEGRATION - - /* - if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) - { - host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile ); - } + // TODO IIMMIBISMICROBLOCKS INTEGRATION + + /* + * if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) ) + * { + * host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile + * ); + * } + * if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( + * IntegrationType.ImmibisMicroblocks ) ) + * { + * host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( + * IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, side, tile ); + * } + */ - if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.ImmibisMicroblocks ) ) - { - host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, side, tile ); - } - */ - final Optional maybeMultiPartStack = multiPart.maybeStack( 1 ); final Optional maybeMultiPartBlock = multiPart.maybeBlock(); final Optional maybeMultiPartItemBlock = multiPart.maybeItemBlock(); @@ -287,7 +292,7 @@ public class PartPlacement final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent() && maybeMultiPartItemBlock.isPresent(); final boolean canMultiPartBePlaced = maybeMultiPartBlock.get().canPlaceBlockAt( world, te_pos ); - if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get().placeBlockAt( maybeMultiPartStack.get(), player, world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) ) + if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get().placeBlockAt( maybeMultiPartStack.get(), player, world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) ) { if( !world.isRemote ) { @@ -323,7 +328,7 @@ public class PartPlacement if( pass == PlaceType.INTERACT_FIRST_PASS || pass == PlaceType.PLACE_ITEM ) { te_pos = pos.offset( side ); - + final Block blkID = world.getBlockState( te_pos ).getBlock(); tile = world.getTileEntity( te_pos ); @@ -332,7 +337,9 @@ public class PartPlacement host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile ); } - if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) ///&& side != AEPartLocation.INTERNAL ) + if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) // /&& side != + // AEPartLocation.INTERNAL + // ) { return place( held, te_pos, side.getOpposite(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 ); } @@ -344,10 +351,11 @@ public class PartPlacement { final Block block = world.getBlockState( pos ).getBlock(); final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) ); - final MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.a, dir.b ); + final MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.getA(), dir.getB() ); + if( mop != null ) { - final SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) ); + final SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) ); if( sp.part != null ) { @@ -400,7 +408,7 @@ public class PartPlacement return Platform.getEyeOffset( p ); } - return eyeHeight; + return getEyeHeight(); } private static SelectedPart selectPart( final EntityPlayer player, final IPartHost host, final Vec3 pos ) @@ -493,6 +501,16 @@ public class PartPlacement } } + private static float getEyeHeight() + { + return eyeHeight; + } + + public static void setEyeHeight( final float eyeHeight ) + { + PartPlacement.eyeHeight = eyeHeight; + } + public enum PlaceType { PLACE_ITEM, INTERACT_FIRST_PASS, INTERACT_SECOND_PASS diff --git a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java index 3beb8b051..3727fd80e 100644 --- a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java +++ b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java @@ -112,22 +112,22 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab final EnumFacing e = bch.getWorldX(); final EnumFacing u = bch.getWorldY(); - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.getSide() ) ) { minX = 0; } - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.getSide() ) ) { maxX = 16; } - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.getSide() ) ) { minY = 0; } - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.getSide() ) ) { maxY = 16; } @@ -141,7 +141,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, renderer.getIcon( this.is ), SIDE_ICON, SIDE_ICON ); + rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, renderer.getIcon( this.getItemStack() ), SIDE_ICON, SIDE_ICON ); rh.setBounds( 1, 1, 15, 15, 15, 16 ); rh.renderInventoryBox( renderer ); @@ -166,39 +166,37 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab final TileEntity te = this.getHost().getTile(); final BlockPos pos = te.getPos(); - - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) ) + + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.getSide() ) ) { minX = 0; } int maxX = 15; - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.getSide() ) ) { maxX = 16; } int minY = 1; - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.getSide() ) ) { minY = 0; } int maxY = 15; - if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e) ), this.side ) ) + if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.getSide() ) ) { maxY = 16; } - final boolean isActive = ( this.clientFlags & ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ) ) == ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ); - - rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, isActive ? activeIcon : renderer.getIcon( this.is ), SIDE_ICON, SIDE_ICON ); + final boolean isActive = ( this.getClientFlags() & ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ) ) == ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ); + rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, isActive ? activeIcon : renderer.getIcon( this.getItemStack() ), SIDE_ICON, SIDE_ICON ); rh.setBounds( minX, minY, 15, maxX, maxY, 16 ); rh.renderBlock( opos, renderer ); - rh.setTexture( STATUS_ICON, STATUS_ICON, BACK_ICON, isActive ? activeIcon : renderer.getIcon( this.is ), STATUS_ICON, STATUS_ICON ); - + rh.setTexture( STATUS_ICON, STATUS_ICON, BACK_ICON, isActive ? activeIcon : renderer.getIcon( this.getItemStack() ), STATUS_ICON, STATUS_ICON ); rh.setBounds( 5, 5, 14, 11, 11, 15 ); rh.renderBlock( opos, renderer ); @@ -211,7 +209,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab this.isAccepting = true; try { - this.proxy.getTick().alertDevice( this.proxy.getNode() ); + this.getProxy().getTick().alertDevice( this.getProxy().getNode() ); } catch( final GridAccessException e ) { @@ -222,12 +220,12 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab @Override public void onEntityCollision( final Entity entity ) { - if( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.proxy.isActive() ) + if( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.getProxy().isActive() ) { boolean capture = false; - final BlockPos pos = this.tile.getPos(); + final BlockPos pos = this.getTile().getPos(); - switch( this.side ) + switch( this.getSide() ) { case DOWN: case UP: @@ -235,7 +233,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab { if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 ) { - if( ( entity.posY > pos.getY() + 0.9 && this.side == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this.side == AEPartLocation.DOWN ) ) + if( ( entity.posY > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this.getSide() == AEPartLocation.DOWN ) ) { capture = true; } @@ -248,7 +246,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab { if( entity.posY > pos.getY() && entity.posY < pos.getY() + 1 ) { - if( ( entity.posZ > pos.getZ() + 0.9 && this.side == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this.side == AEPartLocation.NORTH ) ) + if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this.getSide() == AEPartLocation.NORTH ) ) { capture = true; } @@ -261,7 +259,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab { if( entity.posY > pos.getY() && entity.posY < pos.getY() + 1 ) { - if( ( entity.posX > pos.getX() + 0.9 && this.side == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this.side == AEPartLocation.WEST ) ) + if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this.getSide() == AEPartLocation.WEST ) ) { capture = true; } @@ -279,7 +277,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab if( changed ) { - ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.tile.getWorld(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.side, false ) ); + ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) ); } } } @@ -319,8 +317,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab final IAEItemStack itemToStore = AEItemStack.create( item ); try { - final IStorageGrid storage = this.proxy.getStorage(); - final IEnergyGrid energy = this.proxy.getEnergy(); + final IStorageGrid storage = this.getProxy().getStorage(); + final IEnergyGrid energy = this.getProxy().getEnergy(); final IAEItemStack overflow = Platform.poweredInsert( energy, storage.getItemInventory(), itemToStore, this.mySrc ); this.isAccepting = overflow == null; @@ -375,7 +373,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab final TileEntity te = this.getTile(); final WorldServer w = (WorldServer) te.getWorld(); - final BlockPos offset = te.getPos().offset( this.side.getFacing() ); + final BlockPos offset = te.getPos().offset( this.getSide().getFacing() ); final BlockPos add = offset.add( .5, .5, .5 ); final double x = add.getX(); final double y = add.getY(); @@ -415,18 +413,17 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab this.getHost().markForUpdate(); } - public TickRateModulation breakBlock( final boolean modulate ) + private TickRateModulation breakBlock( final boolean modulate ) { - if( this.isAccepting && this.proxy.isActive() ) + if( this.isAccepting && this.getProxy().isActive() ) { try { final TileEntity te = this.getTile(); final WorldServer w = (WorldServer) te.getWorld(); - final BlockPos pos = te.getPos().offset( this.side.getFacing() ); - - final IEnergyGrid energy = this.proxy.getEnergy(); + final BlockPos pos = te.getPos().offset( this.getSide().getFacing() ); + final IEnergyGrid energy = this.getProxy().getEnergy(); if( this.canHandleBlock( w, pos ) ) { @@ -442,12 +439,12 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab { energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG ); this.breakBlockAndStoreItems( w, pos, items ); - ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(),pos.getY(),pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(),pos.getY(),pos.getZ(), this.side, true ) ); + ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) ); } else { this.breaking = true; - TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this ); + TickHandler.INSTANCE.addCallable( this.getTile().getWorld(), this ); } return TickRateModulation.URGENT; } @@ -466,7 +463,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.AnnihilationPlane.min, TickRates.AnnihilationPlane.max, false, true ); + return new TickingRequest( TickRates.AnnihilationPlane.getMin(), TickRates.AnnihilationPlane.getMax(), false, true ); } @Override @@ -484,7 +481,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab /** * Checks if this plane can handle the block at the specific coordinates. */ - protected boolean canHandleBlock( final WorldServer w, final BlockPos pos ) + private boolean canHandleBlock( final WorldServer w, final BlockPos pos ) { final Block block = w.getBlockState( pos ).getBlock(); final Material material = block.getMaterial(); @@ -527,13 +524,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab * * @return true, if the network can store at least a single item of all drops or no drops are reported */ - protected boolean canStoreItemStacks( final List itemStacks ) + private boolean canStoreItemStacks( final List itemStacks ) { boolean canStore = itemStacks.isEmpty(); try { - final IStorageGrid storage = this.proxy.getStorage(); + final IStorageGrid storage = this.getProxy().getStorage(); for( final ItemStack itemStack : itemStacks ) { @@ -554,10 +551,10 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab return canStore; } - protected void breakBlockAndStoreItems( final WorldServer w, final BlockPos pos, final List items ) + private void breakBlockAndStoreItems( final WorldServer w, final BlockPos pos, final List items ) { w.setBlockToAir( pos ); - + final AxisAlignedBB box = AxisAlignedBB.fromBounds( pos.getX() - 0.2, pos.getY() - 0.2, pos.getZ() - 0.2, pos.getX() + 1.2, pos.getY() + 1.2, pos.getZ() + 1.2 ); for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) ) { diff --git a/src/main/java/appeng/parts/automation/PartExportBus.java b/src/main/java/appeng/parts/automation/PartExportBus.java index 18d02cd49..252af8895 100644 --- a/src/main/java/appeng/parts/automation/PartExportBus.java +++ b/src/main/java/appeng/parts/automation/PartExportBus.java @@ -103,7 +103,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest @Override protected TickRateModulation doBusWork() { - if( !this.proxy.isActive() || !this.canDoBusWork() ) + if( !this.getProxy().isActive() || !this.canDoBusWork() ) { return TickRateModulation.IDLE; } @@ -114,9 +114,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest try { final InventoryAdaptor destination = this.getHandler(); - final IMEMonitor inv = this.proxy.getStorage().getItemInventory(); - final IEnergyGrid energy = this.proxy.getEnergy(); - final ICraftingGrid cg = this.proxy.getCrafting(); + final IMEMonitor inv = this.getProxy().getStorage().getItemInventory(); + final IEnergyGrid energy = this.getProxy().getEnergy(); + final ICraftingGrid cg = this.getProxy().getCrafting(); final FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ); final SchedulingMode schedulingMode = (SchedulingMode) this.getConfigManager().getSetting( Settings.SCHEDULING_MODE ); @@ -128,13 +128,13 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest { final int slotToExport = this.getStartingSlot( schedulingMode, x ); - final IAEItemStack ais = this.config.getAEStackInSlot( slotToExport ); + final IAEItemStack ais = this.getConfig().getAEStackInSlot( slotToExport ); if( ais == null || this.itemToSend <= 0 || this.craftOnly() ) { if( this.isCraftingEnabled() ) { - this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething; + this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething; } continue; } @@ -159,7 +159,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest if( this.itemToSend == before && this.isCraftingEnabled() ) { - this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething; + this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething; } } @@ -198,7 +198,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() ); + rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() ); rh.setBounds( 4, 4, 12, 12, 12, 14 ); rh.renderInventoryBox( renderer ); @@ -214,7 +214,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() ); + rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() ); rh.setBounds( 4, 4, 12, 12, 12, 14 ); rh.renderBlock( pos, renderer ); @@ -225,7 +225,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest rh.setBounds( 6, 6, 15, 10, 10, 16 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); rh.setBounds( 6, 6, 11, 10, 10, 12 ); rh.renderBlock( pos, renderer ); @@ -249,7 +249,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS ); return true; } @@ -259,7 +259,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.ExportBus.min, TickRates.ExportBus.max, this.isSleeping(), false ); + return new TickingRequest( TickRates.ExportBus.getMin(), TickRates.ExportBus.getMax(), this.isSleeping(), false ); } @Override @@ -287,9 +287,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest try { - if( d != null && this.proxy.isActive() ) + if( d != null && this.getProxy().isActive() ) { - final IEnergyGrid energy = this.proxy.getEnergy(); + final IEnergyGrid energy = this.getProxy().getEnergy(); final double power = items.getStackSize(); if( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 ) diff --git a/src/main/java/appeng/parts/automation/PartFormationPlane.java b/src/main/java/appeng/parts/automation/PartFormationPlane.java index 3cfb95b68..fcb8d99b2 100644 --- a/src/main/java/appeng/parts/automation/PartFormationPlane.java +++ b/src/main/java/appeng/parts/automation/PartFormationPlane.java @@ -86,11 +86,11 @@ import appeng.util.prioitylist.PrecisePriorityList; public class PartFormationPlane extends PartUpgradeable implements ICellContainer, IPriorityHost, IMEInventory { - final MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS ); - final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 ); - int priority = 0; - boolean wasActive = false; - boolean blocked = false; + private final MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS ); + private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 ); + private int priority = 0; + private boolean wasActive = false; + private boolean blocked = false; public PartFormationPlane( final ItemStack is ) { @@ -130,7 +130,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine try { - this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); } catch( final GridAccessException e ) { @@ -148,7 +148,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue ) { this.updateHandler(); - this.host.markForSave(); + this.getHost().markForSave(); } @Override @@ -200,7 +200,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine @MENetworkEventSubscribe public void powerRender( final MENetworkPowerStatusChange c ) { - final boolean currentActive = this.proxy.isActive(); + final boolean currentActive = this.getProxy().isActive(); if( this.wasActive != currentActive ) { this.wasActive = currentActive; @@ -212,7 +212,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine @MENetworkEventSubscribe public void updateChannels( final MENetworkChannelsChanged changedChannels ) { - final boolean currentActive = this.proxy.isActive(); + final boolean currentActive = this.getProxy().isActive(); if( this.wasActive != currentActive ) { this.wasActive = currentActive; @@ -239,22 +239,22 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine final EnumFacing e = bch.getWorldX(); final EnumFacing u = bch.getWorldY(); - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.getSide() ) ) { minX = 0; } - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.getSide() ) ) { maxX = 16; } - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.getSide() ) ) { minY = 0; } - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u ) ), this.getSide() ) ) { maxY = 16; } @@ -268,7 +268,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() ); + rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() ); rh.setBounds( 1, 1, 15, 15, 15, 16 ); rh.renderInventoryBox( renderer ); @@ -289,37 +289,37 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine final TileEntity te = this.getHost().getTile(); final BlockPos pos = te.getPos(); - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.getSide() ) ) { minX = 0; } int maxX = 15; - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.getSide() ) ) { maxX = 16; } int minY = 1; - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.getSide() ) ) { minY = 0; } int maxY = 15; - if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u ) ), this.side ) ) + if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u ) ), this.getSide() ) ) { maxY = 16; } - final boolean isActive = ( this.clientFlags & ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ) ) == ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ); + final boolean isActive = ( this.getClientFlags() & ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ) ) == ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ); - rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : renderer.getIcon( this.is ), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() ); + rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : renderer.getIcon( this.getItemStack() ), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() ); rh.setBounds( minX, minY, 15, maxX, maxY, 16 ); rh.renderBlock( opos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); rh.setBounds( 5, 5, 14, 11, 11, 15 ); rh.renderBlock( opos, renderer ); @@ -330,12 +330,12 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine @Override public void onNeighborChanged() { - final TileEntity te = this.host.getTile(); + final TileEntity te = this.getHost().getTile(); final World w = te.getWorld(); - final AEPartLocation side = this.side; + final AEPartLocation side = this.getSide(); + + final BlockPos tePos = te.getPos().offset( side.getFacing() ); - final BlockPos tePos = te.getPos().offset( side.getFacing() ); - this.blocked = !w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ); } @@ -355,7 +355,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_FORMATION_PLANE ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_FORMATION_PLANE ); return true; } @@ -375,7 +375,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine @Override public List getCellArray( final StorageChannel channel ) { - if( this.proxy.isActive() && channel == StorageChannel.ITEMS ) + if( this.getProxy().isActive() && channel == StorageChannel.ITEMS ) { final List Handler = new ArrayList( 1 ); Handler.add( this.myHandler ); @@ -394,7 +394,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine public void setPriority( final int newValue ) { this.priority = newValue; - this.host.markForSave(); + this.getHost().markForSave(); this.updateHandler(); } @@ -420,9 +420,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine long maxStorage = Math.min( input.getStackSize(), is.getMaxStackSize() ); boolean worked = false; - final TileEntity te = this.host.getTile(); + final TileEntity te = this.getHost().getTile(); final World w = te.getWorld(); - final AEPartLocation side = this.side; + final AEPartLocation side = this.getSide(); final BlockPos tePos = te.getPos().offset( side.getFacing() ); @@ -431,25 +431,25 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i instanceof ItemReed ) ) { final EntityPlayer player = Platform.getPlayer( (WorldServer) w ); - Platform.configurePlayer( player, side, this.tile ); + Platform.configurePlayer( player, side, this.getTile() ); // TODO: LIMIT FIREWORKS /* - if( i instanceof ItemFirework ) - { - Chunk c = w.getChunkFromBlockCoords( tePos ); - int sum = 0; - for( List Z : c.geten ) - { - sum += Z.size(); - } - if( sum > 32 ) - { - return input; - } - } - */ - + * if( i instanceof ItemFirework ) + * { + * Chunk c = w.getChunkFromBlockCoords( tePos ); + * int sum = 0; + * for( List Z : c.geten ) + * { + * sum += Z.size(); + * } + * if( sum > 32 ) + * { + * return input; + * } + * } + */ + maxStorage = is.stackSize; worked = true; if( type == Actionable.MODULATE ) @@ -497,15 +497,15 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine final Chunk c = w.getChunkFromBlockCoords( tePos ); final int sum = 0; - + // TODO: LIMIT OTHER THIGNS! /* - for( List Z : c.entityLists ) - { - sum += Z.size(); - } - */ - + * for( List Z : c.entityLists ) + * { + * sum += Z.size(); + * } + */ + if( sum < AEConfig.instance.formationPlaneEntityLimit ) { if( type == Actionable.MODULATE ) @@ -513,10 +513,10 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine is.stackSize = (int) maxStorage; final EntityItem ei = new EntityItem( w, // w - ( ( side.xOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.xOffset * -0.3 + tePos.getX(), // spawn - ( ( side.yOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.yOffset * -0.3 + tePos.getY(), // spawn - ( ( side.zOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.zOffset * -0.3 + tePos.getZ(), // spawn - is.copy() ); + ( ( side.xOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.xOffset * -0.3 + tePos.getX(), // spawn + ( ( side.yOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.yOffset * -0.3 + tePos.getY(), // spawn + ( ( side.zOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.zOffset * -0.3 + tePos.getZ(), // spawn + is.copy() ); Entity result = ei; diff --git a/src/main/java/appeng/parts/automation/PartImportBus.java b/src/main/java/appeng/parts/automation/PartImportBus.java index a481f1443..8dab88eba 100644 --- a/src/main/java/appeng/parts/automation/PartImportBus.java +++ b/src/main/java/appeng/parts/automation/PartImportBus.java @@ -102,7 +102,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() ); + rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() ); rh.setBounds( 3, 3, 15, 13, 13, 16 ); rh.renderInventoryBox( renderer ); @@ -118,7 +118,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() ); + rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() ); rh.setBounds( 4, 4, 14, 12, 12, 16 ); rh.renderBlock( pos, renderer ); @@ -128,7 +128,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin rh.setBounds( 6, 6, 12, 10, 10, 13 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); rh.setBounds( 6, 6, 11, 10, 10, 12 ); rh.renderBlock( pos, renderer ); @@ -152,7 +152,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS ); return true; } @@ -162,7 +162,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.ImportBus.min, TickRates.ImportBus.max, this.getHandler() == null, false ); + return new TickingRequest( TickRates.ImportBus.getMin(), TickRates.ImportBus.getMax(), this.getHandler() == null, false ); } @Override @@ -174,7 +174,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin @Override protected TickRateModulation doBusWork() { - if( !this.proxy.isActive() || !this.canDoBusWork() ) + if( !this.getProxy().isActive() || !this.canDoBusWork() ) { return TickRateModulation.IDLE; } @@ -189,15 +189,15 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin try { this.itemToSend = this.calculateItemsToSend(); - this.itemToSend = Math.min( this.itemToSend, (int) ( 0.01 + this.proxy.getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) ); + this.itemToSend = Math.min( this.itemToSend, (int) ( 0.01 + this.getProxy().getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) ); - final IMEMonitor inv = this.proxy.getStorage().getItemInventory(); - final IEnergyGrid energy = this.proxy.getEnergy(); + final IMEMonitor inv = this.getProxy().getStorage().getItemInventory(); + final IEnergyGrid energy = this.getProxy().getEnergy(); boolean Configured = false; for( int x = 0; x < this.availableSlots(); x++ ) { - final IAEItemStack ais = this.config.getAEStackInSlot( x ); + final IAEItemStack ais = this.getConfig().getAEStackInSlot( x ); if( ais != null && this.itemToSend > 0 ) { Configured = true; diff --git a/src/main/java/appeng/parts/automation/PartLevelEmitter.java b/src/main/java/appeng/parts/automation/PartLevelEmitter.java index bef418ff7..8f0fc03c6 100644 --- a/src/main/java/appeng/parts/automation/PartLevelEmitter.java +++ b/src/main/java/appeng/parts/automation/PartLevelEmitter.java @@ -86,20 +86,19 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH private static final int FLAG_ON = 4; - final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 1 ); + private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 1 ); - boolean prevState = false; + private boolean prevState = false; - long lastReportedValue = 0; - long reportingValue = 0; + private long lastReportedValue = 0; + private long reportingValue = 0; - IStackWatcher myWatcher; - IEnergyWatcher myEnergyWatcher; - ICraftingWatcher myCraftingWatcher; - double centerX; - double centerY; - double centerZ; - boolean status = false; + private IStackWatcher myWatcher; + private IEnergyWatcher myEnergyWatcher; + private ICraftingWatcher myCraftingWatcher; + private double centerX; + private double centerY; + private double centerZ; @Reflected public PartLevelEmitter( final ItemStack is ) @@ -141,11 +140,11 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH final boolean isOn = this.isLevelEmitterOn(); if( this.prevState != isOn ) { - this.host.markForUpdate(); - final TileEntity te = this.host.getTile(); + this.getHost().markForUpdate(); + final TileEntity te = this.getHost().getTile(); this.prevState = isOn; Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos() ); - Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos().offset( this.side.getFacing() ) ); + Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos().offset( this.getSide().getFacing() ) ); } } @@ -153,10 +152,10 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH { if( Platform.isClient() ) { - return ( this.clientFlags & FLAG_ON ) == FLAG_ON; + return ( this.getClientFlags() & FLAG_ON ) == FLAG_ON; } - if( !this.proxy.isActive() ) + if( !this.getProxy().isActive() ) { return false; } @@ -165,7 +164,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH { try { - return this.proxy.getCrafting().isRequesting( this.config.getAEStackInSlot( 0 ) ); + return this.getProxy().getCrafting().isRequesting( this.config.getAEStackInSlot( 0 ) ); } catch( final GridAccessException e ) { @@ -194,7 +193,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH @Override public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer ) { - return renderer.getIcon( this.is ).getAtlas(); + return renderer.getIcon( this.getItemStack() ).getAtlas(); } @Override @@ -211,7 +210,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH } // update the system... - public void configureWatchers() + private void configureWatchers() { final IAEItemStack myStack = this.config.getAEStackInSlot( 0 ); @@ -232,7 +231,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH try { - this.proxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.proxy.getNode() ) ); + this.getProxy().getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.getProxy().getNode() ) ); } catch( final GridAccessException e1 ) { @@ -259,11 +258,11 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH try { // update to power... - this.lastReportedValue = (long) this.proxy.getEnergy().getStoredPower(); + this.lastReportedValue = (long) this.getProxy().getEnergy().getStoredPower(); this.updateState(); // no more item stuff.. - this.proxy.getStorage().getItemInventory().removeListener( this ); + this.getProxy().getStorage().getItemInventory().removeListener( this ); } catch( final GridAccessException e ) { @@ -277,11 +276,11 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH { if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null ) { - this.proxy.getStorage().getItemInventory().addListener( this, this.proxy.getGrid() ); + this.getProxy().getStorage().getItemInventory().addListener( this, this.getProxy().getGrid() ); } else { - this.proxy.getStorage().getItemInventory().removeListener( this ); + this.getProxy().getStorage().getItemInventory().removeListener( this ); if( this.myWatcher != null ) { @@ -289,7 +288,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH } } - this.updateReportingValue( this.proxy.getStorage().getItemInventory() ); + this.updateReportingValue( this.getProxy().getStorage().getItemInventory() ); } catch( final GridAccessException e ) { @@ -371,7 +370,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH { try { - return this.proxy.getGrid() == effectiveGrid; + return this.getProxy().getGrid() == effectiveGrid; } catch( final GridAccessException e ) { @@ -390,7 +389,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH { try { - this.updateReportingValue( this.proxy.getStorage().getItemInventory() ); + this.updateReportingValue( this.getProxy().getStorage().getItemInventory() ); } catch( final GridAccessException e ) { @@ -414,14 +413,14 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( renderer.getIcon( this.is ) ); + rh.setTexture( renderer.getIcon( this.getItemStack() ) ); this.renderTorchAtAngle( 0, -0.5, 0, renderer ); } public void renderTorchAtAngle( double baseX, double baseY, double baseZ, final ModelGenerator renderer ) { final boolean isOn = this.isLevelEmitterOn(); - final IAESprite offTexture = renderer.getIcon( this.is ); + final IAESprite offTexture = renderer.getIcon( this.getItemStack() ); final IAESprite IIcon = ( isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture ); // this.centerX = baseX + 0.5; @@ -433,11 +432,15 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH // double par11 = 0; /* - * double d5 = (double)TextureAtlasSprite.func_94209_e(); double d6 = (double)TextureAtlasSprite.func_94206_g(); double d7 = + * double d5 = (double)TextureAtlasSprite.func_94209_e(); double d6 = (double)TextureAtlasSprite.func_94206_g(); + * double d7 = * (double)TextureAtlasSprite.func_94212_f(); double d8 = (double)TextureAtlasSprite.func_94210_h(); double d9 = - * (double)TextureAtlasSprite.func_94214_a(7.0D); double d10 = (double)TextureAtlasSprite.func_94207_b(6.0D); double d11 = - * (double)TextureAtlasSprite.func_94214_a(9.0D); double d12 = (double)TextureAtlasSprite.func_94207_b(8.0D); double d13 = - * (double)TextureAtlasSprite.func_94214_a(7.0D); double d14 = (double)TextureAtlasSprite.func_94207_b(13.0D); double d15 = + * (double)TextureAtlasSprite.func_94214_a(7.0D); double d10 = (double)TextureAtlasSprite.func_94207_b(6.0D); + * double d11 = + * (double)TextureAtlasSprite.func_94214_a(9.0D); double d12 = (double)TextureAtlasSprite.func_94207_b(8.0D); + * double d13 = + * (double)TextureAtlasSprite.func_94214_a(7.0D); double d14 = (double)TextureAtlasSprite.func_94207_b(13.0D); + * double d15 = * (double)TextureAtlasSprite.func_94214_a(9.0D); double d16 = (double)TextureAtlasSprite.func_94207_b(15.0D); */ @@ -490,56 +493,56 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH final double var44 = 0.0625D; final double Zero = 0; final double par10 = 0; - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20, var22 ); - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20, var26 ); - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24, var26 ); - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24, var22 ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20, var22 ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20, var26 ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24, var26 ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24, var22 ); final double var422 = 0.1915D + 1.0 / 16.0; - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24b, var22b ); - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24b, var26b ); - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20b, var26b ); - this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20b, var22b ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24b, var22b ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24b, var26b ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20b, var26b ); + this.addVertexWithUV( t, renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20b, var22b ); - this.addVertexWithUV(t,renderer, baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30 ); - this.addVertexWithUV(t,renderer, baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34 ); - this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY, baseZ + var44 + par10, var28, var34 ); - this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY, baseZ - var44 + par10, var28, var30 ); + this.addVertexWithUV( t, renderer, baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30 ); + this.addVertexWithUV( t, renderer, baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34 ); + this.addVertexWithUV( t, renderer, baseX - var44 + Zero, baseY, baseZ + var44 + par10, var28, var34 ); + this.addVertexWithUV( t, renderer, baseX - var44 + Zero, baseY, baseZ - var44 + par10, var28, var30 ); - this.addVertexWithUV(t,renderer, baseX - var44, baseY + 1.0D, var40, var16, var18 ); - this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY + 0.0D, var40 + par10, var16, var19 ); - this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY + 0.0D, var42 + par10, var17, var19 ); - this.addVertexWithUV(t,renderer, baseX - var44, baseY + 1.0D, var42, var17, var18 ); + this.addVertexWithUV( t, renderer, baseX - var44, baseY + 1.0D, var40, var16, var18 ); + this.addVertexWithUV( t, renderer, baseX - var44 + Zero, baseY + 0.0D, var40 + par10, var16, var19 ); + this.addVertexWithUV( t, renderer, baseX - var44 + Zero, baseY + 0.0D, var42 + par10, var17, var19 ); + this.addVertexWithUV( t, renderer, baseX - var44, baseY + 1.0D, var42, var17, var18 ); - this.addVertexWithUV(t,renderer, baseX + var44, baseY + 1.0D, var42, var16, var18 ); - this.addVertexWithUV(t,renderer, baseX + Zero + var44, baseY + 0.0D, var42 + par10, var16, var19 ); - this.addVertexWithUV(t,renderer, baseX + Zero + var44, baseY + 0.0D, var40 + par10, var17, var19 ); - this.addVertexWithUV(t,renderer, baseX + var44, baseY + 1.0D, var40, var17, var18 ); + this.addVertexWithUV( t, renderer, baseX + var44, baseY + 1.0D, var42, var16, var18 ); + this.addVertexWithUV( t, renderer, baseX + Zero + var44, baseY + 0.0D, var42 + par10, var16, var19 ); + this.addVertexWithUV( t, renderer, baseX + Zero + var44, baseY + 0.0D, var40 + par10, var17, var19 ); + this.addVertexWithUV( t, renderer, baseX + var44, baseY + 1.0D, var40, var17, var18 ); - this.addVertexWithUV(t,renderer, var36, baseY + 1.0D, baseZ + var44, var16, var18 ); - this.addVertexWithUV(t,renderer, var36 + Zero, baseY + 0.0D, baseZ + var44 + par10, var16, var19 ); - this.addVertexWithUV(t,renderer, var38 + Zero, baseY + 0.0D, baseZ + var44 + par10, var17, var19 ); - this.addVertexWithUV(t,renderer, var38, baseY + 1.0D, baseZ + var44, var17, var18 ); + this.addVertexWithUV( t, renderer, var36, baseY + 1.0D, baseZ + var44, var16, var18 ); + this.addVertexWithUV( t, renderer, var36 + Zero, baseY + 0.0D, baseZ + var44 + par10, var16, var19 ); + this.addVertexWithUV( t, renderer, var38 + Zero, baseY + 0.0D, baseZ + var44 + par10, var17, var19 ); + this.addVertexWithUV( t, renderer, var38, baseY + 1.0D, baseZ + var44, var17, var18 ); - this.addVertexWithUV(t,renderer, var38, baseY + 1.0D, baseZ - var44, var16, var18 ); - this.addVertexWithUV(t,renderer, var38 + Zero, baseY + 0.0D, baseZ - var44 + par10, var16, var19 ); - this.addVertexWithUV(t,renderer, var36 + Zero, baseY + 0.0D, baseZ - var44 + par10, var17, var19 ); - this.addVertexWithUV(t,renderer, var36, baseY + 1.0D, baseZ - var44, var17, var18 ); + this.addVertexWithUV( t, renderer, var38, baseY + 1.0D, baseZ - var44, var16, var18 ); + this.addVertexWithUV( t, renderer, var38 + Zero, baseY + 0.0D, baseZ - var44 + par10, var16, var19 ); + this.addVertexWithUV( t, renderer, var36 + Zero, baseY + 0.0D, baseZ - var44 + par10, var17, var19 ); + this.addVertexWithUV( t, renderer, var36, baseY + 1.0D, baseZ - var44, var17, var18 ); } - public void addVertexWithUV( final EnumFacing face, final ModelGenerator renderer, double x, double y, double z, final double u, final double v ) + private void addVertexWithUV( final EnumFacing face, final ModelGenerator renderer, double x, double y, double z, final double u, final double v ) { x -= this.centerX; y -= this.centerY; z -= this.centerZ; - if( this.side == AEPartLocation.DOWN ) + if( this.getSide() == AEPartLocation.DOWN ) { y = -y; z = -z; } - if( this.side == AEPartLocation.EAST ) + if( this.getSide() == AEPartLocation.EAST ) { final double m = x; x = y; @@ -547,14 +550,14 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH y = -y; } - if( this.side == AEPartLocation.WEST ) + if( this.getSide() == AEPartLocation.WEST ) { final double m = x; x = -y; y = m; } - if( this.side == AEPartLocation.SOUTH ) + if( this.getSide() == AEPartLocation.SOUTH ) { final double m = z; z = y; @@ -562,7 +565,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH y = -y; } - if( this.side == AEPartLocation.NORTH ) + if( this.getSide() == AEPartLocation.NORTH ) { final double m = z; z = -y; @@ -580,7 +583,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( renderer.getIcon( this.is ) ); + rh.setTexture( renderer.getIcon( this.getItemStack() ) ); // rh.setTexture( CableBusTextures.ItemPartLevelEmitterOn.getIcon() ); // rh.setBounds( 2, 2, 14, 14, 14, 16 ); @@ -589,14 +592,14 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH // rh.setBounds( 7, 7, 10, 9, 9, 15 ); // rh.renderBlock( x, y, z, renderer ); - renderer.renderAllFaces = true; + renderer.setRenderAllFaces( true ); renderer.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().getWorld(), pos ) ); renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F ); - this.renderTorchAtAngle( pos.getX(),pos.getY(),pos.getZ(),renderer ); + this.renderTorchAtAngle( pos.getX(), pos.getY(), pos.getZ(), renderer ); - renderer.renderAllFaces = false; + renderer.setRenderAllFaces( false ); rh.setBounds( 7, 7, 11, 9, 9, 12 ); this.renderLights( pos, rh, renderer ); @@ -624,7 +627,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH { if( this.isLevelEmitterOn() ) { - final AEPartLocation d = this.side; + final AEPartLocation d = this.getSide(); final double d0 = d.xOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D; final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D; @@ -650,7 +653,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_LEVEL_EMITTER ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_LEVEL_EMITTER ); return true; } diff --git a/src/main/java/appeng/parts/automation/PartSharedItemBus.java b/src/main/java/appeng/parts/automation/PartSharedItemBus.java index bd1fd76a8..ac81dbe1c 100644 --- a/src/main/java/appeng/parts/automation/PartSharedItemBus.java +++ b/src/main/java/appeng/parts/automation/PartSharedItemBus.java @@ -37,7 +37,7 @@ import appeng.util.Platform; public abstract class PartSharedItemBus extends PartUpgradeable implements IGridTickable { - protected final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 ); + private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 ); private int adaptorHash = 0; private InventoryAdaptor adaptor; private boolean lastRedstone = false; @@ -57,14 +57,14 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid public void readFromNBT( final net.minecraft.nbt.NBTTagCompound extra ) { super.readFromNBT( extra ); - this.config.readFromNBT( extra, "config" ); + this.getConfig().readFromNBT( extra, "config" ); } @Override public void writeToNBT( final net.minecraft.nbt.NBTTagCompound extra ) { super.writeToNBT( extra ); - this.config.writeToNBT( extra, "config" ); + this.getConfig().writeToNBT( extra, "config" ); } @Override @@ -72,7 +72,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid { if( name.equals( "config" ) ) { - return this.config; + return this.getConfig(); } return super.getInventoryByName( name ); @@ -82,7 +82,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid public void onNeighborChanged() { this.updateState(); - if( this.lastRedstone != this.host.hasRedstone( this.side ) ) + if( this.lastRedstone != this.getHost().hasRedstone( this.getSide() ) ) { this.lastRedstone = !this.lastRedstone; if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE ) @@ -95,7 +95,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid protected InventoryAdaptor getHandler() { final TileEntity self = this.getHost().getTile(); - final TileEntity target = this.getTileEntity( self, self.getPos().offset( this.side.getFacing() ) ); + final TileEntity target = this.getTileEntity( self, self.getPos().offset( this.getSide().getFacing() ) ); final int newAdaptorHash = Platform.generateTileHash( target ); @@ -105,7 +105,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid } this.adaptorHash = newAdaptorHash; - this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getFacing().getOpposite() ); + this.adaptor = InventoryAdaptor.getAdaptor( target, this.getSide().getFacing().getOpposite() ); return this.adaptor; } @@ -118,13 +118,13 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid { return w.getTileEntity( pos ); } - + return null; } protected int availableSlots() { - return Math.min( 1 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 4, this.config.getSizeInventory() ); + return Math.min( 1 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 4, this.getConfig().getSizeInventory() ); } protected int calculateItemsToSend() @@ -155,10 +155,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid protected boolean canDoBusWork() { final TileEntity self = this.getHost().getTile(); - final BlockPos selfPos = self.getPos().offset( this.side.getFacing() ); + final BlockPos selfPos = self.getPos().offset( this.getSide().getFacing() ); final int xCoordinate = selfPos.getX(); final int zCoordinate = selfPos.getZ(); - final World world = self.getWorld(); return world != null && world.getChunkProvider().chunkExists( xCoordinate >> 4, zCoordinate >> 4 ); @@ -170,11 +169,11 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid { if( !this.isSleeping() ) { - this.proxy.getTick().wakeDevice( this.proxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } else { - this.proxy.getTick().sleepDevice( this.proxy.getNode() ); + this.getProxy().getTick().sleepDevice( this.getProxy().getNode() ); } } catch( final GridAccessException e ) @@ -184,4 +183,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid } protected abstract TickRateModulation doBusWork(); + + AppEngInternalAEInventory getConfig() + { + return this.config; + } } diff --git a/src/main/java/appeng/parts/automation/PartUpgradeable.java b/src/main/java/appeng/parts/automation/PartUpgradeable.java index 360018835..9cb268a15 100644 --- a/src/main/java/appeng/parts/automation/PartUpgradeable.java +++ b/src/main/java/appeng/parts/automation/PartUpgradeable.java @@ -41,7 +41,7 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn public PartUpgradeable( final ItemStack is ) { super( is ); - this.upgrades = new StackUpgradeInventory( this.is, this, this.getUpgradeSlots() ); + this.upgrades = new StackUpgradeInventory( this.getItemStack(), this, this.getUpgradeSlots() ); this.upgrades.setMaxStackSize( 1 ); this.manager = new ConfigManager( this ); } @@ -81,7 +81,7 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn return false; case HIGH_SIGNAL: - if( this.host.hasRedstone( this.side ) ) + if( this.getHost().hasRedstone( this.getSide() ) ) { return false; } @@ -89,7 +89,7 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn break; case LOW_SIGNAL: - if( !this.host.hasRedstone( this.side ) ) + if( !this.getHost().hasRedstone( this.getSide() ) ) { return false; } diff --git a/src/main/java/appeng/parts/automation/UpgradeInventory.java b/src/main/java/appeng/parts/automation/UpgradeInventory.java index de13320b1..023de1bcd 100644 --- a/src/main/java/appeng/parts/automation/UpgradeInventory.java +++ b/src/main/java/appeng/parts/automation/UpgradeInventory.java @@ -46,7 +46,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement public UpgradeInventory( final IAEAppEngInventory parent, final int s ) { super( null, s ); - this.te = this; + this.setTileEntity( this ); this.parent = parent; } diff --git a/src/main/java/appeng/parts/layers/InvLayerData.java b/src/main/java/appeng/parts/layers/InvLayerData.java index c7546369e..e3173410d 100644 --- a/src/main/java/appeng/parts/layers/InvLayerData.java +++ b/src/main/java/appeng/parts/layers/InvLayerData.java @@ -67,7 +67,7 @@ public class InvLayerData return this.slots != null && slot >= 0 && slot < this.slots.size(); } - public int getSizeInventory() + int getSizeInventory() { if( this.slots == null ) { @@ -125,7 +125,7 @@ public class InvLayerData return false; } - public void markDirty() + void markDirty() { if( this.inventories != null ) { diff --git a/src/main/java/appeng/parts/layers/InvSot.java b/src/main/java/appeng/parts/layers/InvSot.java index 158fb2fdf..0ecdc9fce 100644 --- a/src/main/java/appeng/parts/layers/InvSot.java +++ b/src/main/java/appeng/parts/layers/InvSot.java @@ -27,8 +27,8 @@ import net.minecraft.util.EnumFacing; public class InvSot { - public final ISidedInventory partInv; - public final int index; + private final ISidedInventory partInv; + private final int index; public InvSot( ISidedInventory part, int slot ) { @@ -41,7 +41,7 @@ public class InvSot return this.partInv.decrStackSize( this.index, j ); } - public ItemStack getStackInSlot() + ItemStack getStackInSlot() { return this.partInv.getStackInSlot( this.index ); } diff --git a/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java b/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java index 512f423c6..3310981f6 100644 --- a/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java +++ b/src/main/java/appeng/parts/layers/LayerIEnergyHandler.java @@ -19,75 +19,75 @@ package appeng.parts.layers; -import cofh.api.energy.IEnergyConnection; -import cofh.api.energy.IEnergyHandler; -import cofh.api.energy.IEnergyProvider; -import cofh.api.energy.IEnergyReceiver; -import appeng.api.parts.IPart; -import appeng.api.parts.LayerBase; -import appeng.api.util.ForgeDirection; - - -public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler -{ - - @Override - public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyReceiver ) - { - return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate ); - } - - return 0; - } - - @Override - public int extractEnergy( ForgeDirection from, int maxExtract, boolean simulate ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyProvider ) - { - return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate ); - } - - return 0; - } - - @Override - public int getEnergyStored( ForgeDirection from ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyProvider ) - { - return ( (IEnergyProvider) part ).getEnergyStored( from ); - } - - return 0; - } - - @Override - public int getMaxEnergyStored( ForgeDirection from ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyProvider ) - { - return ( (IEnergyProvider) part ).getMaxEnergyStored( from ); - } - - return 0; - } - - @Override - public boolean canConnectEnergy( ForgeDirection from ) - { - IPart part = this.getPart( from ); - if( part instanceof IEnergyConnection ) - { - return ( (IEnergyConnection) part ).canConnectEnergy( from ); - } - - return false; - } -} +//import cofh.api.energy.IEnergyConnection; +//import cofh.api.energy.IEnergyHandler; +//import cofh.api.energy.IEnergyProvider; +//import cofh.api.energy.IEnergyReceiver; +//import appeng.api.parts.IPart; +//import appeng.api.parts.LayerBase; +//import appeng.api.util.ForgeDirection; +// +// +//public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler +//{ +// +// @Override +// public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IEnergyReceiver ) +// { +// return ( (IEnergyReceiver) part ).receiveEnergy( from, maxReceive, simulate ); +// } +// +// return 0; +// } +// +// @Override +// public int extractEnergy( ForgeDirection from, int maxExtract, boolean simulate ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IEnergyProvider ) +// { +// return ( (IEnergyProvider) part ).extractEnergy( from, maxExtract, simulate ); +// } +// +// return 0; +// } +// +// @Override +// public int getEnergyStored( ForgeDirection from ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IEnergyProvider ) +// { +// return ( (IEnergyProvider) part ).getEnergyStored( from ); +// } +// +// return 0; +// } +// +// @Override +// public int getMaxEnergyStored( ForgeDirection from ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IEnergyProvider ) +// { +// return ( (IEnergyProvider) part ).getMaxEnergyStored( from ); +// } +// +// return 0; +// } +// +// @Override +// public boolean canConnectEnergy( ForgeDirection from ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IEnergyConnection ) +// { +// return ( (IEnergyConnection) part ).canConnectEnergy( from ); +// } +// +// return false; +// } +// } diff --git a/src/main/java/appeng/parts/layers/LayerIEnergySink.java b/src/main/java/appeng/parts/layers/LayerIEnergySink.java index 1f963e980..84d4473c7 100644 --- a/src/main/java/appeng/parts/layers/LayerIEnergySink.java +++ b/src/main/java/appeng/parts/layers/LayerIEnergySink.java @@ -19,183 +19,183 @@ package appeng.parts.layers; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import ic2.api.energy.tile.IEnergyAcceptor; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.energy.tile.IEnergyTile; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.LayerBase; -import appeng.api.parts.LayerFlags; -import appeng.api.util.ForgeDirection; -import appeng.util.Platform; - - -public class LayerIEnergySink extends LayerBase implements IEnergySink -{ - - private TileEntity getEnergySinkTile() - { - IPartHost host = (IPartHost) this; - return host.getTile(); - } - - private World getEnergySinkWorld() - { - if( this.getEnergySinkTile() == null ) - { - return null; - } - - return this.getEnergySinkTile().getWorld(); - } - - private boolean isTileValid() - { - TileEntity te = this.getEnergySinkTile(); - - if( te == null ) - { - return false; - } - - return !te.isInvalid() && te.getWorld().blockExists( te.xCoord, te.yCoord, te.zCoord ); - } - - private void addToENet() - { - if( this.getEnergySinkWorld() == null ) - { - return; - } - - // re-add - this.removeFromENet(); - - if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) - { - this.getLayerFlags().add( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); - } - } - - private void removeFromENet() - { - if( this.getEnergySinkWorld() == null ) - { - return; - } - - if( this.isInIC2() && Platform.isServer() ) - { - this.getLayerFlags().remove( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); - } - } - - private boolean interestedInIC2() - { - if( !( (IPartHost) this ).isInWorld() ) - { - return false; - } - - int interested = 0; - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergyTile ) - { - interested++; - } - } - return interested == 1;// if more then one tile is interested we need to abandon... - } - - @Override - public void partChanged() - { - super.partChanged(); - - if( this.interestedInIC2() ) - { - this.addToENet(); - } - else - { - this.removeFromENet(); - } - } - - @Override - public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction ) - { - if( !this.isInIC2() ) - { - return false; - } - - IPart part = this.getPart( direction ); - if( part instanceof IEnergySink ) - { - return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction ); - } - return false; - } - - private boolean isInIC2() - { - return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); - } - - @Override - public double getDemandedEnergy() - { - if( !this.isInIC2() ) - { - return 0; - } - - // this is a flawed implementation, that requires a change to the IC2 API. - - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySink ) - { - // use lower number cause ic2 deletes power it sends that isn't received. - return ( (IEnergySink) part ).getDemandedEnergy(); - } - } - - return 0; - } - - @Override - public int getSinkTier() - { - return Integer.MAX_VALUE; // no real options here... - } - - @Override - public double injectEnergy( ForgeDirection directionFrom, double amount, double voltage ) - { - if( !this.isInIC2() ) - { - return amount; - } - - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySink ) - { - return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage ); - } - } - - return amount; - } -} +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.world.World; +//import net.minecraftforge.common.MinecraftForge; +//import ic2.api.energy.tile.IEnergyAcceptor; +//import ic2.api.energy.tile.IEnergySink; +//import ic2.api.energy.tile.IEnergyTile; +//import appeng.api.parts.IPart; +//import appeng.api.parts.IPartHost; +//import appeng.api.parts.LayerBase; +//import appeng.api.parts.LayerFlags; +//import appeng.api.util.ForgeDirection; +//import appeng.util.Platform; +// +// +//public class LayerIEnergySink extends LayerBase implements IEnergySink +//{ +// +// private TileEntity getEnergySinkTile() +// { +// IPartHost host = (IPartHost) this; +// return host.getTile(); +// } +// +// private World getEnergySinkWorld() +// { +// if( this.getEnergySinkTile() == null ) +// { +// return null; +// } +// +// return this.getEnergySinkTile().getWorld(); +// } +// +// private boolean isTileValid() +// { +// TileEntity te = this.getEnergySinkTile(); +// +// if( te == null ) +// { +// return false; +// } +// +// return !te.isInvalid() && te.getWorld().blockExists( te.xCoord, te.yCoord, te.zCoord ); +// } +// +// private void addToENet() +// { +// if( this.getEnergySinkWorld() == null ) +// { +// return; +// } +// +// // re-add +// this.removeFromENet(); +// +// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) +// { +// this.getLayerFlags().add( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); +// } +// } +// +// private void removeFromENet() +// { +// if( this.getEnergySinkWorld() == null ) +// { +// return; +// } +// +// if( this.isInIC2() && Platform.isServer() ) +// { +// this.getLayerFlags().remove( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) ); +// } +// } +// +// private boolean interestedInIC2() +// { +// if( !( (IPartHost) this ).isInWorld() ) +// { +// return false; +// } +// +// int interested = 0; +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergyTile ) +// { +// interested++; +// } +// } +// return interested == 1;// if more then one tile is interested we need to abandon... +// } +// +// @Override +// public void partChanged() +// { +// super.partChanged(); +// +// if( this.interestedInIC2() ) +// { +// this.addToENet(); +// } +// else +// { +// this.removeFromENet(); +// } +// } +// +// @Override +// public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction ) +// { +// if( !this.isInIC2() ) +// { +// return false; +// } +// +// IPart part = this.getPart( direction ); +// if( part instanceof IEnergySink ) +// { +// return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction ); +// } +// return false; +// } +// +// private boolean isInIC2() +// { +// return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); +// } +// +// @Override +// public double getDemandedEnergy() +// { +// if( !this.isInIC2() ) +// { +// return 0; +// } +// +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySink ) +// { +// // use lower number cause ic2 deletes power it sends that isn't received. +// return ( (IEnergySink) part ).getDemandedEnergy(); +// } +// } +// +// return 0; +// } +// +// @Override +// public int getSinkTier() +// { +// return Integer.MAX_VALUE; // no real options here... +// } +// +// @Override +// public double injectEnergy( ForgeDirection directionFrom, double amount, double voltage ) +// { +// if( !this.isInIC2() ) +// { +// return amount; +// } +// +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySink ) +// { +// return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage ); +// } +// } +// +// return amount; +// } +// } diff --git a/src/main/java/appeng/parts/layers/LayerIEnergySource.java b/src/main/java/appeng/parts/layers/LayerIEnergySource.java index 0ca0a273e..1f0fe65db 100644 --- a/src/main/java/appeng/parts/layers/LayerIEnergySource.java +++ b/src/main/java/appeng/parts/layers/LayerIEnergySource.java @@ -19,188 +19,188 @@ package appeng.parts.layers; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import ic2.api.energy.tile.IEnergyEmitter; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.energy.tile.IEnergySource; -import ic2.api.energy.tile.IEnergyTile; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.LayerBase; -import appeng.api.parts.LayerFlags; -import appeng.api.util.ForgeDirection; -import appeng.util.Platform; - - -public class LayerIEnergySource extends LayerBase implements IEnergySource -{ - - private TileEntity getEnergySourceTile() - { - IPartHost host = (IPartHost) this; - return host.getTile(); - } - - private World getEnergySourceWorld() - { - if( this.getEnergySourceTile() == null ) - { - return null; - } - return this.getEnergySourceTile().getWorld(); - } - - private boolean isTileValid() - { - TileEntity te = this.getEnergySourceTile(); - if( te == null ) - { - return false; - } - return !te.isInvalid(); - } - - private void addToENet() - { - if( this.getEnergySourceWorld() == null ) - { - return; - } - - // re-add - this.removeFromENet(); - - if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) - { - this.getLayerFlags().add( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); - } - } - - private void removeFromENet() - { - if( this.getEnergySourceWorld() == null ) - { - return; - } - - if( this.isInIC2() && Platform.isServer() ) - { - this.getLayerFlags().remove( LayerFlags.IC2_ENET ); - MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); - } - } - - private boolean interestedInIC2() - { - if( !( (IPartHost) this ).isInWorld() ) - { - return false; - } - - int interested = 0; - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergyTile ) - { - interested++; - } - } - return interested == 1;// if more then one tile is interested we need to abandon... - } - - @Override - public void partChanged() - { - super.partChanged(); - - if( this.interestedInIC2() ) - { - this.addToENet(); - } - else - { - this.removeFromENet(); - } - } - - @Override - public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction ) - { - if( !this.isInIC2() ) - { - return false; - } - - IPart part = this.getPart( direction ); - if( part instanceof IEnergySink ) - { - return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction ); - } - return false; - } - - private boolean isInIC2() - { - return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); - } - - @Override - public double getOfferedEnergy() - { - if( !this.isInIC2() ) - { - return 0; - } - - // this is a flawed implementation, that requires a change to the IC2 API. - - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySource ) - { - // use lower number cause ic2 deletes power it sends that isn't received. - return ( (IEnergySource) part ).getOfferedEnergy(); - } - } - - return 0; - } - - @Override - public void drawEnergy( double amount ) - { - // this is a flawed implementation, that requires a change to the IC2 API. - - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySource ) - { - ( (IEnergySource) part ).drawEnergy( amount ); - return; - } - } - } - - @Override - public int getSourceTier() - { - // this is a flawed implementation, that requires a change to the IC2 API. - - for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) - { - IPart part = this.getPart( dir ); - if( part instanceof IEnergySource ) - { - return ( (IEnergySource) part ).getSourceTier(); - } - } - - return 0; - } -} +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.world.World; +//import net.minecraftforge.common.MinecraftForge; +//import ic2.api.energy.tile.IEnergyEmitter; +//import ic2.api.energy.tile.IEnergySink; +//import ic2.api.energy.tile.IEnergySource; +//import ic2.api.energy.tile.IEnergyTile; +//import appeng.api.parts.IPart; +//import appeng.api.parts.IPartHost; +//import appeng.api.parts.LayerBase; +//import appeng.api.parts.LayerFlags; +//import appeng.api.util.ForgeDirection; +//import appeng.util.Platform; +// +// +//public class LayerIEnergySource extends LayerBase implements IEnergySource +//{ +// +// private TileEntity getEnergySourceTile() +// { +// IPartHost host = (IPartHost) this; +// return host.getTile(); +// } +// +// private World getEnergySourceWorld() +// { +// if( this.getEnergySourceTile() == null ) +// { +// return null; +// } +// return this.getEnergySourceTile().getWorld(); +// } +// +// private boolean isTileValid() +// { +// TileEntity te = this.getEnergySourceTile(); +// if( te == null ) +// { +// return false; +// } +// return !te.isInvalid(); +// } +// +// private void addToENet() +// { +// if( this.getEnergySourceWorld() == null ) +// { +// return; +// } +// +// // re-add +// this.removeFromENet(); +// +// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) +// { +// this.getLayerFlags().add( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); +// } +// } +// +// private void removeFromENet() +// { +// if( this.getEnergySourceWorld() == null ) +// { +// return; +// } +// +// if( this.isInIC2() && Platform.isServer() ) +// { +// this.getLayerFlags().remove( LayerFlags.IC2_ENET ); +// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) ); +// } +// } +// +// private boolean interestedInIC2() +// { +// if( !( (IPartHost) this ).isInWorld() ) +// { +// return false; +// } +// +// int interested = 0; +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergyTile ) +// { +// interested++; +// } +// } +// return interested == 1;// if more then one tile is interested we need to abandon... +// } +// +// @Override +// public void partChanged() +// { +// super.partChanged(); +// +// if( this.interestedInIC2() ) +// { +// this.addToENet(); +// } +// else +// { +// this.removeFromENet(); +// } +// } +// +// @Override +// public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction ) +// { +// if( !this.isInIC2() ) +// { +// return false; +// } +// +// IPart part = this.getPart( direction ); +// if( part instanceof IEnergySink ) +// { +// return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction ); +// } +// return false; +// } +// +// private boolean isInIC2() +// { +// return this.getLayerFlags().contains( LayerFlags.IC2_ENET ); +// } +// +// @Override +// public double getOfferedEnergy() +// { +// if( !this.isInIC2() ) +// { +// return 0; +// } +// +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySource ) +// { +// // use lower number cause ic2 deletes power it sends that isn't received. +// return ( (IEnergySource) part ).getOfferedEnergy(); +// } +// } +// +// return 0; +// } +// +// @Override +// public void drawEnergy( double amount ) +// { +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySource ) +// { +// ( (IEnergySource) part ).drawEnergy( amount ); +// return; +// } +// } +// } +// +// @Override +// public int getSourceTier() +// { +// // this is a flawed implementation, that requires a change to the IC2 API. +// +// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) +// { +// IPart part = this.getPart( dir ); +// if( part instanceof IEnergySource ) +// { +// return ( (IEnergySource) part ).getSourceTier(); +// } +// } +// +// return 0; +// } +// } diff --git a/src/main/java/appeng/parts/layers/LayerIFluidHandler.java b/src/main/java/appeng/parts/layers/LayerIFluidHandler.java index 9354e70bd..52e74c655 100644 --- a/src/main/java/appeng/parts/layers/LayerIFluidHandler.java +++ b/src/main/java/appeng/parts/layers/LayerIFluidHandler.java @@ -19,82 +19,82 @@ package appeng.parts.layers; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import appeng.api.parts.IPart; -import appeng.api.parts.LayerBase; -import appeng.api.util.ForgeDirection; - - -public class LayerIFluidHandler extends LayerBase implements IFluidHandler -{ - - static final FluidTankInfo[] EMPTY_LIST = new FluidTankInfo[0]; - - @Override - public int fill( ForgeDirection from, FluidStack resource, boolean doFill ) - { - IPart part = this.getPart( from ); - if( part instanceof IFluidHandler ) - { - return ( (IFluidHandler) part ).fill( from, resource, doFill ); - } - return 0; - } - - @Override - public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain ) - { - IPart part = this.getPart( from ); - if( part instanceof IFluidHandler ) - { - return ( (IFluidHandler) part ).drain( from, resource, doDrain ); - } - return null; - } - - @Override - public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain ) - { - IPart part = this.getPart( from ); - if( part instanceof IFluidHandler ) - { - return ( (IFluidHandler) part ).drain( from, maxDrain, doDrain ); - } - return null; - } - - @Override - public boolean canFill( ForgeDirection from, net.minecraftforge.fluids.Fluid fluid ) - { - IPart part = this.getPart( from ); - if( part instanceof IFluidHandler ) - { - return ( (IFluidHandler) part ).canFill( from, fluid ); - } - return false; - } - - @Override - public boolean canDrain( ForgeDirection from, net.minecraftforge.fluids.Fluid fluid ) - { - IPart part = this.getPart( from ); - if( part instanceof IFluidHandler ) - { - return ( (IFluidHandler) part ).canDrain( from, fluid ); - } - return false; - } - - @Override - public FluidTankInfo[] getTankInfo( ForgeDirection from ) - { - IPart part = this.getPart( from ); - if( part instanceof IFluidHandler ) - { - return ( (IFluidHandler) part ).getTankInfo( from ); - } - return EMPTY_LIST; - } -} +//import net.minecraftforge.fluids.FluidStack; +//import net.minecraftforge.fluids.FluidTankInfo; +//import net.minecraftforge.fluids.IFluidHandler; +//import appeng.api.parts.IPart; +//import appeng.api.parts.LayerBase; +//import appeng.api.util.ForgeDirection; +// +// +//public class LayerIFluidHandler extends LayerBase implements IFluidHandler +//{ +// +// private static final FluidTankInfo[] EMPTY_LIST = new FluidTankInfo[0]; +// +// @Override +// public int fill( ForgeDirection from, FluidStack resource, boolean doFill ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IFluidHandler ) +// { +// return ( (IFluidHandler) part ).fill( from, resource, doFill ); +// } +// return 0; +// } +// +// @Override +// public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IFluidHandler ) +// { +// return ( (IFluidHandler) part ).drain( from, resource, doDrain ); +// } +// return null; +// } +// +// @Override +// public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IFluidHandler ) +// { +// return ( (IFluidHandler) part ).drain( from, maxDrain, doDrain ); +// } +// return null; +// } +// +// @Override +// public boolean canFill( ForgeDirection from, net.minecraftforge.fluids.Fluid fluid ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IFluidHandler ) +// { +// return ( (IFluidHandler) part ).canFill( from, fluid ); +// } +// return false; +// } +// +// @Override +// public boolean canDrain( ForgeDirection from, net.minecraftforge.fluids.Fluid fluid ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IFluidHandler ) +// { +// return ( (IFluidHandler) part ).canDrain( from, fluid ); +// } +// return false; +// } +// +// @Override +// public FluidTankInfo[] getTankInfo( ForgeDirection from ) +// { +// IPart part = this.getPart( from ); +// if( part instanceof IFluidHandler ) +// { +// return ( (IFluidHandler) part ).getTankInfo( from ); +// } +// return EMPTY_LIST; +// } +// } diff --git a/src/main/java/appeng/parts/layers/LayerIPipeConnection.java b/src/main/java/appeng/parts/layers/LayerIPipeConnection.java index 79730a9be..42cf778ba 100644 --- a/src/main/java/appeng/parts/layers/LayerIPipeConnection.java +++ b/src/main/java/appeng/parts/layers/LayerIPipeConnection.java @@ -19,26 +19,26 @@ package appeng.parts.layers; -import buildcraft.api.transport.IPipeConnection; -import buildcraft.api.transport.IPipeTile.PipeType; -import appeng.api.parts.IPart; -import appeng.api.parts.LayerBase; -import appeng.api.util.ForgeDirection; -import appeng.helpers.Reflected; - - -@Reflected -public class LayerIPipeConnection extends LayerBase implements IPipeConnection -{ - - @Override - public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) - { - IPart part = this.getPart( with ); - if( part instanceof IPipeConnection ) - { - return ( (IPipeConnection) part ).overridePipeConnection( type, with ); - } - return ConnectOverride.DEFAULT; - } -} +//import buildcraft.api.transport.IPipeConnection; +//import buildcraft.api.transport.IPipeTile.PipeType; +//import appeng.api.parts.IPart; +//import appeng.api.parts.LayerBase; +//import appeng.api.util.ForgeDirection; +//import appeng.helpers.Reflected; +// +// +//@Reflected +//public class LayerIPipeConnection extends LayerBase implements IPipeConnection +//{ +// +// @Override +// public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) +// { +// IPart part = this.getPart( with ); +// if( part instanceof IPipeConnection ) +// { +// return ( (IPipeConnection) part ).overridePipeConnection( type, with ); +// } +// return ConnectOverride.DEFAULT; +// } +// } diff --git a/src/main/java/appeng/parts/layers/LayerISidedInventory.java b/src/main/java/appeng/parts/layers/LayerISidedInventory.java index b46d6fe7f..48c1b8d39 100644 --- a/src/main/java/appeng/parts/layers/LayerISidedInventory.java +++ b/src/main/java/appeng/parts/layers/LayerISidedInventory.java @@ -29,6 +29,7 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; + import appeng.api.parts.IPart; import appeng.api.parts.IPartHost; import appeng.api.parts.LayerBase; @@ -51,7 +52,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory // a simple empty array for empty stuff.. private static final int[] NULL_SIDES = {}; - InvLayerData invLayer = null; + private InvLayerData invLayer = null; /** * Recalculate inventory wrapper cache. @@ -179,7 +180,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory } @Override - public String getName() + public String getCommandSenderName() { return "AEMultiPart"; } @@ -203,12 +204,12 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory } @Override - public void openInventory(EntityPlayer player) + public void openInventory( EntityPlayer player ) { } @Override - public void closeInventory(EntityPlayer player) + public void closeInventory( EntityPlayer player ) { } @@ -279,7 +280,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory int id, int value ) { - + } @Override @@ -291,7 +292,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory @Override public void clear() { - + } @Override diff --git a/src/main/java/appeng/parts/layers/LayerPressure.java b/src/main/java/appeng/parts/layers/LayerPressure.java index 8ef3961b8..0b7816291 100644 --- a/src/main/java/appeng/parts/layers/LayerPressure.java +++ b/src/main/java/appeng/parts/layers/LayerPressure.java @@ -19,31 +19,31 @@ package appeng.parts.layers; -import javax.annotation.Nullable; - -import net.minecraftforge.common.util.ForgeDirection; - -import pneumaticCraft.api.tileentity.IAirHandler; -import pneumaticCraft.api.tileentity.ISidedPneumaticMachine; - -import appeng.api.parts.IPart; -import appeng.api.parts.LayerBase; - - -public class LayerPressure extends LayerBase implements ISidedPneumaticMachine -{ - - @Nullable - @Override - public IAirHandler getAirHandler( ForgeDirection side ) - { - IPart part = this.getPart( side ); - if( part instanceof ISidedPneumaticMachine ) - { - return ( (ISidedPneumaticMachine) part ).getAirHandler( side ); - } - - return null; - } - -} +//import javax.annotation.Nullable; +// +//import net.minecraftforge.common.util.ForgeDirection; +// +//import pneumaticCraft.api.tileentity.IAirHandler; +//import pneumaticCraft.api.tileentity.ISidedPneumaticMachine; +// +//import appeng.api.parts.IPart; +//import appeng.api.parts.LayerBase; +// +// +//public class LayerPressure extends LayerBase implements ISidedPneumaticMachine +//{ +// +// @Nullable +// @Override +// public IAirHandler getAirHandler( ForgeDirection side ) +// { +// IPart part = this.getPart( side ); +// if( part instanceof ISidedPneumaticMachine ) +// { +// return ( (ISidedPneumaticMachine) part ).getAirHandler( side ); +// } +// +// return null; +// } +// +//} diff --git a/src/main/java/appeng/parts/layers/LayerSidedEnvironment.java b/src/main/java/appeng/parts/layers/LayerSidedEnvironment.java index b9d198c80..9df88befa 100644 --- a/src/main/java/appeng/parts/layers/LayerSidedEnvironment.java +++ b/src/main/java/appeng/parts/layers/LayerSidedEnvironment.java @@ -18,44 +18,45 @@ package appeng.parts.layers; -import javax.annotation.Nullable; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.SidedEnvironment; -import appeng.api.parts.IPart; -import appeng.api.parts.LayerBase; -import appeng.api.util.ForgeDirection; -import appeng.core.Registration; -import appeng.helpers.Reflected; - - -/** - * Reflected in {@link Registration#initialize(FMLInitializationEvent)} - */ -@Reflected -public class LayerSidedEnvironment extends LayerBase implements SidedEnvironment -{ - @Nullable - @Override - public Node sidedNode(ForgeDirection side) - { - final IPart part = this.getPart( side ); - if ( part instanceof SidedEnvironment ) - { - return ( (SidedEnvironment) part ).sidedNode( side ); - } - return null; - } - - @Override - public boolean canConnect(ForgeDirection side) - { - final IPart part = this.getPart( side ); - if ( part instanceof SidedEnvironment ) - { - return ( (SidedEnvironment) part ).canConnect( side ); - } - return false; - } -} +//import javax.annotation.Nullable; +// +//import net.minecraftforge.fml.common.event.FMLInitializationEvent; +//import li.cil.oc.api.network.Node; +//import li.cil.oc.api.network.SidedEnvironment; +//import appeng.api.parts.IPart; +//import appeng.api.parts.LayerBase; +//import appeng.api.util.ForgeDirection; +//import appeng.core.Registration; +//import appeng.helpers.Reflected; +// +// +///** +// * Reflected in {@link Registration#initialize(FMLInitializationEvent)} +// */ +//@Reflected +//public class LayerSidedEnvironment extends LayerBase implements SidedEnvironment +//{ +// @Nullable +// @Override +// public Node sidedNode( ForgeDirection side ) +// { +// final IPart part = this.getPart( side ); +// if( part instanceof SidedEnvironment ) +// { +// return ( (SidedEnvironment) part ).sidedNode( side ); +// } +// return null; +// } +// +// @Override +// public boolean canConnect( ForgeDirection side ) +// { +// final IPart part = this.getPart( side ); +// if( part instanceof SidedEnvironment ) +// { +// return ( (SidedEnvironment) part ).canConnect( side ); +// } +// return false; +// } +// } diff --git a/src/main/java/appeng/parts/misc/PartCableAnchor.java b/src/main/java/appeng/parts/misc/PartCableAnchor.java index 6c207d4b1..3210664cf 100644 --- a/src/main/java/appeng/parts/misc/PartCableAnchor.java +++ b/src/main/java/appeng/parts/misc/PartCableAnchor.java @@ -52,9 +52,9 @@ import appeng.client.texture.IAESprite; public class PartCableAnchor implements IPart { - ItemStack is = null; - IPartHost host = null; - AEPartLocation mySide = AEPartLocation.UP; + private ItemStack is = null; + private IPartHost host = null; + private AEPartLocation mySide = AEPartLocation.UP; public PartCableAnchor( final ItemStack is ) { @@ -94,7 +94,7 @@ public class PartCableAnchor implements IPart @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - final IAESprite myIcon = renderer.getIcon( this.is ); + final IAESprite myIcon = renderer.getIcon( this.is ); rh.setTexture( myIcon ); if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null ) { @@ -116,7 +116,7 @@ public class PartCableAnchor implements IPart } @Override - public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer) + public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer ) { return null; } diff --git a/src/main/java/appeng/parts/misc/PartInterface.java b/src/main/java/appeng/parts/misc/PartInterface.java index 8b2995a2d..51ede58d1 100644 --- a/src/main/java/appeng/parts/misc/PartInterface.java +++ b/src/main/java/appeng/parts/misc/PartInterface.java @@ -77,7 +77,7 @@ import appeng.util.inv.IInventoryDestination; public class PartInterface extends PartBasicState implements IGridTickable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, ISidedInventory, IAEAppEngInventory, ITileStorageMonitorable, IPriorityHost { - final DualityInterface duality = new DualityInterface( this.proxy, this ); + private final DualityInterface duality = new DualityInterface( this.getProxy(), this ); @Reflected public PartInterface( final ItemStack is ) @@ -114,7 +114,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderInventoryBox( renderer ); @@ -136,17 +136,17 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); rh.setBounds( 5, 5, 12, 11, 11, 13 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); rh.setBounds( 5, 5, 13, 11, 11, 14 ); rh.renderBlock( pos, renderer ); @@ -209,16 +209,16 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto if( Platform.isServer() ) { - Platform.openGUI( p, this.getTileEntity(), this.side, GuiBridge.GUI_INTERFACE ); + Platform.openGUI( p, this.getTileEntity(), this.getSide(), GuiBridge.GUI_INTERFACE ); } return true; } @Override - public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer) + public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer ) { - return renderer.getIcon( this.is ).getAtlas(); + return renderer.getIcon( this.getItemStack() ).getAtlas(); } @Override @@ -314,13 +314,13 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto @Override public void openInventory( final EntityPlayer player ) { - this.duality.getStorage().openInventory(player); + this.duality.getStorage().openInventory( player ); } @Override public void closeInventory( final EntityPlayer player ) { - this.duality.getStorage().closeInventory(player); + this.duality.getStorage().closeInventory( player ); } @Override @@ -362,7 +362,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto @Override public EnumSet getTargets() { - return EnumSet.of( this.side.getFacing() ); + return EnumSet.of( this.getSide().getFacing() ); } @Override @@ -437,7 +437,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto final int id, final int value ) { - + } @Override @@ -449,7 +449,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto @Override public void clear() { - + } @Override diff --git a/src/main/java/appeng/parts/misc/PartInvertedToggleBus.java b/src/main/java/appeng/parts/misc/PartInvertedToggleBus.java index fddee47b8..1549668c2 100644 --- a/src/main/java/appeng/parts/misc/PartInvertedToggleBus.java +++ b/src/main/java/appeng/parts/misc/PartInvertedToggleBus.java @@ -29,10 +29,10 @@ public class PartInvertedToggleBus extends PartToggleBus public PartInvertedToggleBus( final ItemStack is ) { super( is ); - this.proxy.setIdlePowerUsage( 0.0 ); - this.outerProxy.setIdlePowerUsage( 0.0 ); - this.proxy.setFlags(); - this.outerProxy.setFlags(); + this.getProxy().setIdlePowerUsage( 0.0 ); + this.getOuterProxy().setIdlePowerUsage( 0.0 ); + this.getProxy().setFlags(); + this.getOuterProxy().setFlags(); } @Override diff --git a/src/main/java/appeng/parts/misc/PartStorageBus.java b/src/main/java/appeng/parts/misc/PartStorageBus.java index b1246e4c9..a285d863c 100644 --- a/src/main/java/appeng/parts/misc/PartStorageBus.java +++ b/src/main/java/appeng/parts/misc/PartStorageBus.java @@ -87,16 +87,19 @@ import appeng.util.prioitylist.PrecisePriorityList; // TODO: BC Integration //@Interface( iname = IntegrationType.BuildCraftTransport, iface = "buildcraft.api.transport.IPipeConnection" ) -public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver /*, IPipeConnection*/, IPriorityHost +public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver /* + * , + * IPipeConnection + */, IPriorityHost { - final BaseActionSource mySrc; - final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 ); - int priority = 0; - boolean cached = false; - MEMonitorIInventory monitor = null; - MEInventoryHandler handler = null; - int handlerHash = 0; - boolean wasActive = false; + private final BaseActionSource mySrc; + private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 ); + private int priority = 0; + private boolean cached = false; + private MEMonitorIInventory monitor = null; + private MEInventoryHandler handler = null; + private int handlerHash = 0; + private boolean wasActive = false; private byte resetCacheLogic = 0; @Reflected @@ -118,14 +121,14 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC private void updateStatus() { - final boolean currentActive = this.proxy.isActive(); + final boolean currentActive = this.getProxy().isActive(); if( this.wasActive != currentActive ) { this.wasActive = currentActive; try { - this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); - this.host.markForUpdate(); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getHost().markForUpdate(); } catch( final GridAccessException e ) { @@ -150,7 +153,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue ) { this.resetCache( true ); - this.host.markForSave(); + this.getHost().markForSave(); } @Override @@ -200,7 +203,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC private void resetCache( final boolean fullReset ) { - if( this.host == null || this.host.getTile() == null || this.host.getTile().getWorld() == null || this.host.getTile().getWorld().isRemote ) + if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost().getTile().getWorld().isRemote ) { return; } @@ -216,7 +219,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC try { - this.proxy.getTick().alertDevice( this.proxy.getNode() ); + this.getProxy().getTick().alertDevice( this.getProxy().getNode() ); } catch( final GridAccessException e ) { @@ -235,9 +238,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC { try { - if( this.proxy.isActive() ) + if( this.getProxy().isActive() ) { - this.proxy.getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, this.mySrc ); + this.getProxy().getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, this.mySrc ); } } catch( final GridAccessException e ) @@ -264,7 +267,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); + rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); rh.setBounds( 3, 3, 15, 13, 13, 16 ); rh.renderInventoryBox( renderer ); @@ -280,7 +283,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); + rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); rh.setBounds( 3, 3, 15, 13, 13, 16 ); rh.renderBlock( pos, renderer ); @@ -288,12 +291,12 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC rh.setBounds( 2, 2, 14, 14, 14, 15 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); + rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() ); rh.setBounds( 5, 5, 12, 11, 11, 13 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); rh.setBounds( 5, 5, 13, 11, 11, 14 ); rh.renderBlock( pos, renderer ); @@ -323,7 +326,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_STORAGEBUS ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS ); return true; } @@ -333,7 +336,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.StorageBus.min, TickRates.StorageBus.max, this.monitor == null, true ); + return new TickingRequest( TickRates.StorageBus.getMin(), TickRates.StorageBus.getMax(), this.monitor == null, true ); } @Override @@ -397,8 +400,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC this.cached = true; final TileEntity self = this.getHost().getTile(); - final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.side.getFacing() ) ); - + final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) ); final int newHandlerHash = Platform.generateTileHash( target ); if( this.handlerHash == newHandlerHash && this.handlerHash != 0 ) @@ -409,7 +411,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC try { // force grid to update handlers... - this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); } catch( final GridAccessException e ) { @@ -421,16 +423,16 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC this.monitor = null; if( target != null ) { - final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, this.side.getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc ); + final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, this.getSide().getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc ); if( esh != null ) { - final IMEInventory inv = esh.getInventory( target, this.side.getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc ); + final IMEInventory inv = esh.getInventory( target, this.getSide().getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc ); if( inv instanceof MEMonitorIInventory ) { final MEMonitorIInventory h = (MEMonitorIInventory) inv; - h.mode = (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ); - h.mySource = new MachineSource( this ); + h.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) ); + h.setActionSource( new MachineSource( this ) ); } if( inv instanceof MEMonitorIInventory ) @@ -440,7 +442,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC if( inv != null ) { - this.checkInterfaceVsStorageBus( target, this.side.getOpposite() ); + this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() ); this.handler = new MEInventoryHandler( inv, StorageChannel.ITEMS ); @@ -482,14 +484,14 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC { try { - final ITickManager tm = this.proxy.getTick(); + final ITickManager tm = this.getProxy().getTick(); if( this.monitor == null ) { - tm.sleepDevice( this.proxy.getNode() ); + tm.sleepDevice( this.getProxy().getNode() ); } else { - tm.wakeDevice( this.proxy.getNode() ); + tm.wakeDevice( this.getProxy().getNode() ); } } catch( final GridAccessException e ) @@ -531,7 +533,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC { if( channel == StorageChannel.ITEMS ) { - final IMEInventoryHandler out = this.proxy.isActive() ? this.getInternalHandler() : null; + final IMEInventoryHandler out = this.getProxy().isActive() ? this.getInternalHandler() : null; if( out != null ) { return Collections.singletonList( out ); @@ -550,7 +552,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC public void setPriority( final int newValue ) { this.priority = newValue; - this.host.markForSave(); + this.getHost().markForSave(); this.resetCache( true ); } @@ -561,13 +563,13 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC // TODO: BC PIPE INTEGRATION /* - @Override - @Method( iname = IntegrationType.BuildCraftTransport ) - public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) - { - return type == PipeType.ITEM && with == this.side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT; - } - */ + * @Override + * @Method( iname = IntegrationType.BuildCraftTransport ) + * public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) + * { + * return type == PipeType.ITEM && with == this.getSide() ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT; + * } + */ @Override public void saveChanges( final IMEInventory cellInventory ) { diff --git a/src/main/java/appeng/parts/misc/PartToggleBus.java b/src/main/java/appeng/parts/misc/PartToggleBus.java index 1c93f8d51..4fba6f070 100644 --- a/src/main/java/appeng/parts/misc/PartToggleBus.java +++ b/src/main/java/appeng/parts/misc/PartToggleBus.java @@ -54,25 +54,25 @@ import appeng.util.Platform; public class PartToggleBus extends PartBasicState { private static final int REDSTONE_FLAG = 4; - final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true ); - IGridConnection connection; - boolean hasRedstone = false; + private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true ); + private IGridConnection connection; + private boolean hasRedstone = false; @Reflected public PartToggleBus( final ItemStack is ) { super( is ); - this.proxy.setIdlePowerUsage( 0.0 ); - this.outerProxy.setIdlePowerUsage( 0.0 ); - this.proxy.setFlags(); - this.outerProxy.setFlags(); + this.getProxy().setIdlePowerUsage( 0.0 ); + this.getOuterProxy().setIdlePowerUsage( 0.0 ); + this.getProxy().setFlags(); + this.getOuterProxy().setFlags(); } @Override public void setColors( final ModelGenerator renderer, final boolean hasChan, final boolean hasPower ) { - this.hasRedstone = ( this.clientFlags & REDSTONE_FLAG ) == REDSTONE_FLAG; + this.hasRedstone = ( this.getClientFlags() & REDSTONE_FLAG ) == REDSTONE_FLAG; super.setColors( renderer, hasChan && this.hasRedstone, hasPower && this.hasRedstone ); } @@ -84,13 +84,13 @@ public class PartToggleBus extends PartBasicState protected boolean getIntention() { - return this.getHost().hasRedstone( this.side ); + return this.getHost().hasRedstone( this.getSide() ); } @Override public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer ) { - return renderer.getIcon( this.is ).getAtlas(); + return renderer.getIcon( this.getItemStack() ).getAtlas(); } @Override @@ -102,13 +102,13 @@ public class PartToggleBus extends PartBasicState @Override public void securityBreak() { - if( this.is.stackSize > 0 ) + if( this.getItemStack().stackSize > 0 ) { final List items = new ArrayList(); - items.add( this.is.copy() ); - this.host.removePart( this.side, false ); - Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items ); - this.is.stackSize = 0; + items.add( this.getItemStack().copy() ); + this.getHost().removePart( this.getSide(), false ); + Platform.spawnDrops( this.getTile().getWorld(), this.getTile().getPos(), items ); + this.getItemStack().stackSize = 0; } } @@ -124,7 +124,7 @@ public class PartToggleBus extends PartBasicState { GL11.glTranslated( -0.2, -0.3, 0.0 ); - rh.setTexture( renderer.getIcon( this.is ) ); + rh.setTexture( renderer.getIcon( this.getItemStack() ) ); rh.setBounds( 6, 6, 14 - 4, 10, 10, 16 - 4 ); rh.renderInventoryBox( renderer ); @@ -147,7 +147,7 @@ public class PartToggleBus extends PartBasicState @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( renderer.getIcon( this.is ) ); + rh.setTexture( renderer.getIcon( this.getItemStack() ) ); rh.setBounds( 6, 6, 14, 10, 10, 16 ); rh.renderBlock( pos, renderer ); @@ -155,7 +155,7 @@ public class PartToggleBus extends PartBasicState rh.setBounds( 6, 6, 11, 10, 10, 13 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); + rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() ); rh.setBounds( 6, 6, 13, 10, 10, 14 ); rh.renderBlock( pos, renderer ); @@ -167,7 +167,7 @@ public class PartToggleBus extends PartBasicState public void onNeighborChanged() { final boolean oldHasRedstone = this.hasRedstone; - this.hasRedstone = this.getHost().hasRedstone( this.side ); + this.hasRedstone = this.getHost().hasRedstone( this.getSide() ); if( this.hasRedstone != oldHasRedstone ) { @@ -180,29 +180,29 @@ public class PartToggleBus extends PartBasicState public void readFromNBT( final NBTTagCompound extra ) { super.readFromNBT( extra ); - this.outerProxy.readFromNBT( extra ); + this.getOuterProxy().readFromNBT( extra ); } @Override public void writeToNBT( final NBTTagCompound extra ) { super.writeToNBT( extra ); - this.outerProxy.writeToNBT( extra ); + this.getOuterProxy().writeToNBT( extra ); } @Override public void removeFromWorld() { super.removeFromWorld(); - this.outerProxy.invalidate(); + this.getOuterProxy().invalidate(); } @Override public void addToWorld() { super.addToWorld(); - this.outerProxy.onReady(); - this.hasRedstone = this.getHost().hasRedstone( this.side ); + this.getOuterProxy().onReady(); + this.hasRedstone = this.getHost().hasRedstone( this.getSide() ); this.updateInternalState(); } @@ -216,7 +216,7 @@ public class PartToggleBus extends PartBasicState @Override public IGridNode getExternalFacingNode() { - return this.outerProxy.getNode(); + return this.getOuterProxy().getNode(); } @Override @@ -229,7 +229,7 @@ public class PartToggleBus extends PartBasicState public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side ) { super.onPlacement( player, held, side ); - this.outerProxy.setOwner( player ); + this.getOuterProxy().setOwner( player ); } private void updateInternalState() @@ -237,13 +237,13 @@ public class PartToggleBus extends PartBasicState final boolean intention = this.getIntention(); if( intention == ( this.connection == null ) ) { - if( this.proxy.getNode() != null && this.outerProxy.getNode() != null ) + if( this.getProxy().getNode() != null && this.getOuterProxy().getNode() != null ) { if( intention ) { try { - this.connection = AEApi.instance().createGridConnection( this.proxy.getNode(), this.outerProxy.getNode() ); + this.connection = AEApi.instance().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() ); } catch( final FailedConnection e ) { @@ -258,4 +258,9 @@ public class PartToggleBus extends PartBasicState } } } + + AENetworkProxy getOuterProxy() + { + return this.outerProxy; + } } diff --git a/src/main/java/appeng/parts/networking/PartCable.java b/src/main/java/appeng/parts/networking/PartCable.java index 7cc3fc23d..1a97dc7aa 100644 --- a/src/main/java/appeng/parts/networking/PartCable.java +++ b/src/main/java/appeng/parts/networking/PartCable.java @@ -62,7 +62,6 @@ import appeng.client.texture.IAESprite; import appeng.client.texture.TaughtIcon; import appeng.items.parts.ItemMultiPart; import appeng.me.GridAccessException; -import appeng.me.helpers.AENetworkProxy; import appeng.parts.AEBasePart; import appeng.util.Platform; @@ -70,17 +69,17 @@ import appeng.util.Platform; public class PartCable extends AEBasePart implements IPartCable { - final int[] channelsOnSide = { 0, 0, 0, 0, 0, 0 }; + private final int[] channelsOnSide = { 0, 0, 0, 0, 0, 0 }; - EnumSet connections = EnumSet.noneOf( AEPartLocation.class ); - boolean powered = false; + private EnumSet connections = EnumSet.noneOf( AEPartLocation.class ); + private boolean powered = false; public PartCable( final ItemStack is ) { super( is ); - this.proxy.setFlags( GridFlags.PREFERRED ); - this.proxy.setIdlePowerUsage( 0.0 ); - this.proxy.myColor = AEColor.values()[( (ItemMultiPart) is.getItem() ).variantOf( is.getItemDamage() )]; + this.getProxy().setFlags( GridFlags.PREFERRED ); + this.getProxy().setIdlePowerUsage( 0.0 ); + this.getProxy().setColor( AEColor.values()[( (ItemMultiPart) is.getItem() ).variantOf( is.getItemDamage() )] ); } @Override @@ -92,7 +91,7 @@ public class PartCable extends AEBasePart implements IPartCable @Override public AEColor getCableColor() { - return this.proxy.myColor; + return this.getProxy().getColor(); } @Override @@ -131,7 +130,7 @@ public class PartCable extends AEBasePart implements IPartCable try { - hasPermission = this.proxy.getSecurity().hasPermission( who, SecurityPermissions.BUILD ); + hasPermission = this.getProxy().getSecurity().hasPermission( who, SecurityPermissions.BUILD ); } catch( final GridAccessException e ) { @@ -157,13 +156,13 @@ public class PartCable extends AEBasePart implements IPartCable public void setValidSides( final EnumSet sides ) { - this.proxy.setValidSides( sides ); + this.getProxy().setValidSides( sides ); } @Override public boolean isConnected( final EnumFacing side ) { - return this.connections.contains( AEPartLocation.fromFacing( side ) ); + return this.getConnections().contains( AEPartLocation.fromFacing( side ) ); } public void markForUpdate() @@ -181,11 +180,11 @@ public class PartCable extends AEBasePart implements IPartCable final IGridNode n = this.getGridNode(); if( n != null ) { - this.connections = n.getConnectedSides(); + this.setConnections( n.getConnectedSides() ); } else { - this.connections.clear(); + this.getConnections().clear(); } } @@ -230,7 +229,7 @@ public class PartCable extends AEBasePart implements IPartCable } } - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { switch( of ) { @@ -263,7 +262,7 @@ public class PartCable extends AEBasePart implements IPartCable { GL11.glTranslated( -0.0, -0.0, 0.3 ); - rh.setTexture( this.getTexture( this.getCableColor(),renderer ) ); + rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); rh.setBounds( 6.0f, 6.0f, 2.0f, 10.0f, 10.0f, 14.0f ); rh.renderInventoryBox( renderer ); rh.setTexture( null ); @@ -271,7 +270,7 @@ public class PartCable extends AEBasePart implements IPartCable public IAESprite getTexture( final AEColor c, final ModelGenerator renderer ) { - return this.getGlassTexture( c,renderer ); + return this.getGlassTexture( c, renderer ); } public IAESprite getGlassTexture( final AEColor c, final ModelGenerator renderer ) @@ -319,12 +318,6 @@ public class PartCable extends AEBasePart implements IPartCable return renderer.getIcon( glassCableStack ); } - @Override - public AENetworkProxy getProxy() - { - return this.proxy; - } - @Override @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) @@ -345,9 +338,9 @@ public class PartCable extends AEBasePart implements IPartCable break; } } - else if( this.connections.contains( dir ) ) + else if( this.getConnections().contains( dir ) ) { - final TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( dir.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( pos.offset( dir.getFacing() ) ); final IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; final IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null; if( partHost == null && gh != null && gh.getCableConnectionType( dir ) != AECableType.GLASS ) @@ -363,11 +356,11 @@ public class PartCable extends AEBasePart implements IPartCable } else { - rh.setTexture( this.getTexture( this.getCableColor(),renderer ) ); + rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); } final IPartHost ph = this.getHost(); - for( final AEPartLocation of : EnumSet.complementOf( this.connections ) ) + for( final AEPartLocation of : EnumSet.complementOf( this.getConnections() ) ) { final IPart bp = ph.getPart( of ); if( bp instanceof IGridHost ) @@ -403,7 +396,7 @@ public class PartCable extends AEBasePart implements IPartCable } } - if( this.connections.size() != 2 || !this.nonLinear( this.connections ) || useCovered || requireDetailed ) + if( this.getConnections().size() != 2 || !this.nonLinear( this.getConnections() ) || useCovered || requireDetailed ) { if( useCovered ) { @@ -416,7 +409,7 @@ public class PartCable extends AEBasePart implements IPartCable rh.renderBlock( pos, renderer ); } - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { this.renderGlassConnection( pos, rh, renderer, of ); } @@ -426,7 +419,7 @@ public class PartCable extends AEBasePart implements IPartCable final IAESprite def = this.getTexture( this.getCableColor(), renderer ); rh.setTexture( def ); - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing(), of.getFacing().getOpposite() ) ) ); switch( of ) @@ -437,13 +430,13 @@ public class PartCable extends AEBasePart implements IPartCable break; case EAST: case WEST: - renderer.uvRotateEast = renderer.uvRotateWest = 1; - renderer.uvRotateBottom = renderer.uvRotateTop = 1; + renderer.setUvRotateEast( renderer.setUvRotateWest( 1 ) ); + renderer.setUvRotateBottom( renderer.setUvRotateTop( 1 ) ); renderer.setRenderBounds( 0, 6 / 16.0, 6 / 16.0, 16 / 16.0, 10 / 16.0, 10 / 16.0 ); break; case NORTH: case SOUTH: - renderer.uvRotateNorth = renderer.uvRotateSouth = 1; + renderer.setUvRotateNorth( renderer.setUvRotateSouth( 1 ) ); renderer.setRenderBounds( 6 / 16.0, 6 / 16.0, 0, 10 / 16.0, 10 / 16.0, 16 / 16.0 ); break; default: @@ -498,7 +491,7 @@ public class PartCable extends AEBasePart implements IPartCable final IReadOnlyCollection set = part.getGridNode().getConnections(); for( final IGridConnection gc : set ) { - if( this.proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) ) + if( this.getProxy().getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( this.getProxy().getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) ) { sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * thisSide.ordinal() ); } @@ -516,8 +509,8 @@ public class PartCable extends AEBasePart implements IPartCable final AEPartLocation side = gc.getDirection( n ); if( side != AEPartLocation.INTERNAL ) { - final boolean isTier2a = this.proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY ); - final boolean isTier2b = gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ); + final boolean isTier2a = this.getProxy().getNode().hasFlag( GridFlags.DENSE_CAPACITY ); + final boolean isTier2b = gc.getOtherSide( this.getProxy().getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ); if( isTier2a && isTier2b ) { @@ -534,7 +527,7 @@ public class PartCable extends AEBasePart implements IPartCable try { - if( this.proxy.getEnergy().isNetworkPowered() ) + if( this.getProxy().getEnergy().isNetworkPowered() ) { cs |= ( 1 << AEPartLocation.INTERNAL.ordinal() ); } @@ -554,7 +547,7 @@ public class PartCable extends AEBasePart implements IPartCable final int cs = data.readByte(); final int sideOut = data.readInt(); - final EnumSet myC = this.connections.clone(); + final EnumSet myC = this.getConnections().clone(); final boolean wasPowered = this.powered; this.powered = false; boolean channelsChanged = false; @@ -564,10 +557,10 @@ public class PartCable extends AEBasePart implements IPartCable if( d != AEPartLocation.INTERNAL ) { final int ch = ( sideOut >> ( d.ordinal() * 4 ) ) & 0xF; - if( ch != this.channelsOnSide[d.ordinal()] ) + if( ch != this.getChannelsOnSide( d.ordinal() ) ) { channelsChanged = true; - this.channelsOnSide[d.ordinal()] = ch; + this.setChannelsOnSide( d.ordinal(), ch ); } } @@ -584,16 +577,16 @@ public class PartCable extends AEBasePart implements IPartCable final int id = 1 << d.ordinal(); if( id == ( cs & id ) ) { - this.connections.add( d ); + this.getConnections().add( d ); } else { - this.connections.remove( d ); + this.getConnections().remove( d ); } } } - return !myC.equals( this.connections ) || wasPowered != this.powered || channelsChanged; + return !myC.equals( this.getConnections() ) || wasPowered != this.powered || channelsChanged; } @Override @@ -645,7 +638,7 @@ public class PartCable extends AEBasePart implements IPartCable final AEColoredItemDefinition coveredCable = AEApi.instance().definitions().parts().cableCovered(); final ItemStack coveredCableStack = coveredCable.stack( AEColor.Transparent, 1 ); - return renderer.getIcon( coveredCableStack ); + return renderer.getIcon( coveredCableStack ); } protected boolean nonLinear( final EnumSet sides ) @@ -654,9 +647,9 @@ public class PartCable extends AEBasePart implements IPartCable } @SideOnly( Side.CLIENT ) - public void renderGlassConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final AEPartLocation of ) + private void renderGlassConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final AEPartLocation of ) { - final TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( pos.offset( of.getFacing() ) ); final IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; final IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null; @@ -730,9 +723,9 @@ public class PartCable extends AEBasePart implements IPartCable } @SideOnly( Side.CLIENT ) - public void renderCoveredConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final int channels, final AEPartLocation of ) + protected void renderCoveredConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final int channels, final AEPartLocation of ) { - final TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( pos.offset( of.getFacing() ) ); final IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; final IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; @@ -811,9 +804,9 @@ public class PartCable extends AEBasePart implements IPartCable } @SideOnly( Side.CLIENT ) - public void renderSmartConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final int channels, final AEPartLocation of ) + protected void renderSmartConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final int channels, final AEPartLocation of ) { - final TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( pos.offset( of.getFacing() ) ); final IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; final IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; AEColor myColor = this.getCableColor(); @@ -874,7 +867,7 @@ public class PartCable extends AEBasePart implements IPartCable rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon ); this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer ); - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); } @@ -931,7 +924,7 @@ public class PartCable extends AEBasePart implements IPartCable rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon ); this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer ); - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); } } @@ -977,7 +970,7 @@ public class PartCable extends AEBasePart implements IPartCable final IParts parts = AEApi.instance().definitions().parts(); final ItemStack smartCableStack = parts.cableSmart().stack( AEColor.Transparent, 1 ); - return renderer.getIcon(smartCableStack ); + return renderer.getIcon( smartCableStack ); } @SideOnly( Side.CLIENT ) @@ -987,27 +980,27 @@ public class PartCable extends AEBasePart implements IPartCable { case UP: case DOWN: - renderer.uvRotateTop = 0; - renderer.uvRotateBottom = 0; - renderer.uvRotateSouth = 3; - renderer.uvRotateEast = 3; + renderer.setUvRotateTop( 0 ); + renderer.setUvRotateBottom( 0 ); + renderer.setUvRotateSouth( 3 ); + renderer.setUvRotateEast( 3 ); break; case NORTH: case SOUTH: - renderer.uvRotateTop = 3; - renderer.uvRotateBottom = 3; - renderer.uvRotateNorth = 1; - renderer.uvRotateSouth = 2; - renderer.uvRotateWest = 1; + renderer.setUvRotateTop( 3 ); + renderer.setUvRotateBottom( 3 ); + renderer.setUvRotateNorth( 1 ); + renderer.setUvRotateSouth( 2 ); + renderer.setUvRotateWest( 1 ); break; case EAST: case WEST: - renderer.uvRotateEast = 2; - renderer.uvRotateWest = 1; - renderer.uvRotateBottom = 2; - renderer.uvRotateTop = 1; - renderer.uvRotateSouth = 3; - renderer.uvRotateNorth = 0; + renderer.setUvRotateEast( 2 ); + renderer.setUvRotateWest( 1 ); + renderer.setUvRotateBottom( 2 ); + renderer.setUvRotateTop( 1 ); + renderer.setUvRotateSouth( 3 ); + renderer.setUvRotateNorth( 0 ); break; default: break; @@ -1058,7 +1051,7 @@ public class PartCable extends AEBasePart implements IPartCable @SideOnly( Side.CLIENT ) protected void renderAllFaces( final AEBaseBlock blk, final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setBounds( (float) renderer.renderMinX * 16.0f, (float) renderer.renderMinY * 16.0f, (float) renderer.renderMinZ * 16.0f, (float) renderer.renderMaxX * 16.0f, (float) renderer.renderMaxY * 16.0f, (float) renderer.renderMaxZ * 16.0f ); + rh.setBounds( (float) renderer.getRenderMinX() * 16.0f, (float) renderer.getRenderMinY() * 16.0f, (float) renderer.getRenderMinZ() * 16.0f, (float) renderer.getRenderMaxX() * 16.0f, (float) renderer.getRenderMaxY() * 16.0f, (float) renderer.getRenderMaxZ() * 16.0f ); rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.WEST ), EnumFacing.WEST, renderer ); rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.EAST ), EnumFacing.EAST, renderer ); rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.NORTH ), EnumFacing.NORTH, renderer ); @@ -1066,4 +1059,24 @@ public class PartCable extends AEBasePart implements IPartCable rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.DOWN ), EnumFacing.DOWN, renderer ); rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.UP ), EnumFacing.UP, renderer ); } + + int getChannelsOnSide( int i ) + { + return this.channelsOnSide[i]; + } + + void setChannelsOnSide( int i, int channels ) + { + this.channelsOnSide[i] = channels; + } + + EnumSet getConnections() + { + return this.connections; + } + + void setConnections( final EnumSet connections ) + { + this.connections = connections; + } } diff --git a/src/main/java/appeng/parts/networking/PartCableCovered.java b/src/main/java/appeng/parts/networking/PartCableCovered.java index 45a8415f9..e3cdc8f1e 100644 --- a/src/main/java/appeng/parts/networking/PartCableCovered.java +++ b/src/main/java/appeng/parts/networking/PartCableCovered.java @@ -84,15 +84,15 @@ public class PartCableCovered extends PartCable final IGridNode n = this.getGridNode(); if( n != null ) { - this.connections = n.getConnectedSides(); + this.setConnections( n.getConnectedSides() ); } else { - this.connections.clear(); + this.getConnections().clear(); } } - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { switch( of ) { @@ -167,11 +167,11 @@ public class PartCableCovered extends PartCable { rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); - final EnumSet sides = this.connections.clone(); + final EnumSet sides = this.getConnections().clone(); boolean hasBuses = false; final IPartHost ph = this.getHost(); - for( final AEPartLocation of : EnumSet.complementOf( this.connections ) ) + for( final AEPartLocation of : EnumSet.complementOf( this.getConnections() ) ) { final IPart bp = ph.getPart( of ); if( bp instanceof IGridHost ) @@ -215,9 +215,9 @@ public class PartCableCovered extends PartCable if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses ) { - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { - this.renderCoveredConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of ); + this.renderCoveredConnection( pos, rh, renderer, this.getChannelsOnSide( of.ordinal() ), of ); } rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); @@ -228,7 +228,7 @@ public class PartCableCovered extends PartCable { final IAESprite def = this.getTexture( this.getCableColor(), renderer ); final IAESprite off = new OffsetIcon( def, 0, -12 ); - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { switch( of ) { @@ -240,14 +240,14 @@ public class PartCableCovered extends PartCable case EAST: case WEST: rh.setTexture( off, off, off, off, def, def ); - renderer.uvRotateEast = renderer.uvRotateWest = 1; - renderer.uvRotateBottom = renderer.uvRotateTop = 1; + renderer.setUvRotateEast( renderer.setUvRotateWest( 1 ) ); + renderer.setUvRotateBottom( renderer.setUvRotateTop( 1 ) ); renderer.setRenderBounds( 0, 5 / 16.0, 5 / 16.0, 16 / 16.0, 11 / 16.0, 11 / 16.0 ); break; case NORTH: case SOUTH: rh.setTexture( off, off, def, def, off, off ); - renderer.uvRotateNorth = renderer.uvRotateSouth = 1; + renderer.setUvRotateNorth( renderer.setUvRotateSouth( 1 ) ); renderer.setRenderBounds( 5 / 16.0, 5 / 16.0, 0, 11 / 16.0, 11 / 16.0, 16 / 16.0 ); break; default: @@ -257,7 +257,7 @@ public class PartCableCovered extends PartCable rh.renderBlockCurrentBounds( pos, renderer ); } - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); rh.setTexture( null ); } } diff --git a/src/main/java/appeng/parts/networking/PartCableSmart.java b/src/main/java/appeng/parts/networking/PartCableSmart.java index 9cdefc587..c31adf25a 100644 --- a/src/main/java/appeng/parts/networking/PartCableSmart.java +++ b/src/main/java/appeng/parts/networking/PartCableSmart.java @@ -87,15 +87,15 @@ public class PartCableSmart extends PartCable final IGridNode n = this.getGridNode(); if( n != null ) { - this.connections = n.getConnectedSides(); + this.setConnections( n.getConnectedSides() ); } else { - this.connections.clear(); + this.getConnections().clear(); } } - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { switch( of ) { @@ -184,11 +184,11 @@ public class PartCableSmart extends PartCable { rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); - final EnumSet sides = this.connections.clone(); + final EnumSet sides = this.getConnections().clone(); boolean hasBuses = false; final IPartHost ph = this.getHost(); - for( final AEPartLocation of : EnumSet.complementOf( this.connections ) ) + for( final AEPartLocation of : EnumSet.complementOf( this.getConnections() ) ) { final IPart bp = ph.getPart( of ); if( bp instanceof IGridHost ) @@ -228,8 +228,8 @@ public class PartCableSmart extends PartCable rh.renderBlock( pos, renderer ); this.setSmartConnectionRotations( of, renderer ); - final IAESprite firstIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f ); - final IAESprite secondIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f ); + final IAESprite firstIcon = new TaughtIcon( this.getChannelTex( this.getChannelsOnSide( of.ordinal() ), false ).getIcon(), -0.2f ); + final IAESprite secondIcon = new TaughtIcon( this.getChannelTex( this.getChannelsOnSide( of.ordinal() ), true ).getIcon(), -0.2f ); if( of == AEPartLocation.EAST || of == AEPartLocation.WEST ) { @@ -247,7 +247,7 @@ public class PartCableSmart extends PartCable rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon ); this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer ); - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); } @@ -256,9 +256,9 @@ public class PartCableSmart extends PartCable if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses ) { - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { - this.renderSmartConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of ); + this.renderSmartConnection( pos, rh, renderer, this.getChannelsOnSide( of.ordinal() ), of ); } rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) ); @@ -269,13 +269,13 @@ public class PartCableSmart extends PartCable { AEPartLocation selectedSide = AEPartLocation.INTERNAL; - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { selectedSide = of; break; } - final int channels = this.channelsOnSide[selectedSide.ordinal()]; + final int channels = this.getChannelsOnSide( selectedSide.ordinal() ); final IAESprite def = this.getTexture( this.getCableColor(), renderer ); final IAESprite off = new OffsetIcon( def, 0, -12 ); @@ -293,10 +293,10 @@ public class PartCableSmart extends PartCable rh.setTexture( def, def, off, off, off, off ); rh.renderBlockCurrentBounds( pos, renderer ); - renderer.uvRotateTop = 0; - renderer.uvRotateBottom = 0; - renderer.uvRotateSouth = 3; - renderer.uvRotateEast = 3; + renderer.setUvRotateTop( 0 ); + renderer.setUvRotateBottom( 0 ); + renderer.setUvRotateSouth( 3 ); + renderer.setUvRotateEast( 3 ); renderer.setBrightness( 15 << 20 | 15 << 4 ); @@ -311,12 +311,12 @@ public class PartCableSmart extends PartCable case EAST: case WEST: rh.setTexture( off, off, off, off, def, def ); - renderer.uvRotateEast = 2; - renderer.uvRotateWest = 1; - renderer.uvRotateBottom = 2; - renderer.uvRotateTop = 1; - renderer.uvRotateSouth = 0; - renderer.uvRotateNorth = 0; + renderer.setUvRotateEast( 2 ); + renderer.setUvRotateWest( 1 ); + renderer.setUvRotateBottom( 2 ); + renderer.setUvRotateTop( 1 ); + renderer.setUvRotateSouth( 0 ); + renderer.setUvRotateNorth( 0 ); final AEBaseBlock blk = (AEBaseBlock) rh.getBlock(); final FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST ); @@ -347,11 +347,11 @@ public class PartCableSmart extends PartCable case NORTH: case SOUTH: rh.setTexture( off, off, def, def, off, off ); - renderer.uvRotateTop = 3; - renderer.uvRotateBottom = 3; - renderer.uvRotateNorth = 1; - renderer.uvRotateSouth = 2; - renderer.uvRotateWest = 1; + renderer.setUvRotateTop( 3 ); + renderer.setUvRotateBottom( 3 ); + renderer.setUvRotateNorth( 1 ); + renderer.setUvRotateSouth( 2 ); + renderer.setUvRotateWest( 1 ); renderer.setRenderBounds( 5 / 16.0, 5 / 16.0, 0, 11 / 16.0, 11 / 16.0, 16 / 16.0 ); rh.renderBlockCurrentBounds( pos, renderer ); @@ -370,7 +370,7 @@ public class PartCableSmart extends PartCable } } - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); rh.setTexture( null ); } } diff --git a/src/main/java/appeng/parts/networking/PartDenseCable.java b/src/main/java/appeng/parts/networking/PartDenseCable.java index 9ad1db294..5f8c07e2a 100644 --- a/src/main/java/appeng/parts/networking/PartDenseCable.java +++ b/src/main/java/appeng/parts/networking/PartDenseCable.java @@ -62,7 +62,7 @@ public class PartDenseCable extends PartCable { super( is ); - this.proxy.setFlags( GridFlags.DENSE_CAPACITY, GridFlags.PREFERRED ); + this.getProxy().setFlags( GridFlags.DENSE_CAPACITY, GridFlags.PREFERRED ); } @Override @@ -91,15 +91,15 @@ public class PartDenseCable extends PartCable final IGridNode n = this.getGridNode(); if( n != null ) { - this.connections = n.getConnectedSides(); + this.setConnections( n.getConnectedSides() ); } else { - this.connections.clear(); + this.getConnections().clear(); } } - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { if( this.isDense( of ) ) { @@ -219,10 +219,10 @@ public class PartDenseCable extends PartCable { rh.setTexture( this.getTexture( this.getCableColor(), renderer ) ); - final EnumSet sides = this.connections.clone(); + final EnumSet sides = this.getConnections().clone(); boolean hasBuses = false; - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { if( !this.isDense( of ) ) { @@ -232,19 +232,19 @@ public class PartDenseCable extends PartCable if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses ) { - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { if( this.isDense( of ) ) { - this.renderDenseConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of ); + this.renderDenseConnection( pos, rh, renderer, this.getChannelsOnSide( of.ordinal() ), of ); } else if( this.isSmart( of ) ) { - this.renderSmartConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of ); + this.renderSmartConnection( pos, rh, renderer, this.getChannelsOnSide( of.ordinal() ), of ); } else { - this.renderCoveredConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of ); + this.renderCoveredConnection( pos, rh, renderer, this.getChannelsOnSide( of.ordinal() ), of ); } } @@ -256,13 +256,13 @@ public class PartDenseCable extends PartCable { AEPartLocation selectedSide = AEPartLocation.INTERNAL; - for( final AEPartLocation of : this.connections ) + for( final AEPartLocation of : this.getConnections() ) { selectedSide = of; break; } - final int channels = this.channelsOnSide[selectedSide.ordinal()]; + final int channels = this.getChannelsOnSide( selectedSide.ordinal() ); final IAESprite def = this.getTexture( this.getCableColor(), renderer ); final IAESprite off = new OffsetIcon( def, 0, -12 ); @@ -280,10 +280,10 @@ public class PartDenseCable extends PartCable rh.setTexture( def, def, off, off, off, off ); rh.renderBlockCurrentBounds( pos, renderer ); - renderer.uvRotateTop = 0; - renderer.uvRotateBottom = 0; - renderer.uvRotateSouth = 3; - renderer.uvRotateEast = 3; + renderer.setUvRotateTop( 0 ); + renderer.setUvRotateBottom( 0 ); + renderer.setUvRotateSouth( 3 ); + renderer.setUvRotateEast( 3 ); renderer.setBrightness( 15 << 20 | 15 << 4 ); @@ -298,12 +298,12 @@ public class PartDenseCable extends PartCable case EAST: case WEST: rh.setTexture( off, off, off, off, def, def ); - renderer.uvRotateEast = 2; - renderer.uvRotateWest = 1; - renderer.uvRotateBottom = 2; - renderer.uvRotateTop = 1; - renderer.uvRotateSouth = 0; - renderer.uvRotateNorth = 0; + renderer.setUvRotateEast( 2 ); + renderer.setUvRotateWest( 1 ); + renderer.setUvRotateBottom( 2 ); + renderer.setUvRotateTop( 1 ); + renderer.setUvRotateSouth( 0 ); + renderer.setUvRotateNorth( 0 ); final AEBaseBlock blk = (AEBaseBlock) rh.getBlock(); final FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST ); @@ -331,11 +331,11 @@ public class PartDenseCable extends PartCable case NORTH: case SOUTH: rh.setTexture( off, off, def, def, off, off ); - renderer.uvRotateTop = 3; - renderer.uvRotateBottom = 3; - renderer.uvRotateNorth = 1; - renderer.uvRotateSouth = 2; - renderer.uvRotateWest = 1; + renderer.setUvRotateTop( 3 ); + renderer.setUvRotateBottom( 3 ); + renderer.setUvRotateNorth( 1 ); + renderer.setUvRotateSouth( 2 ); + renderer.setUvRotateWest( 1 ); renderer.setRenderBounds( 3 / 16.0, 3 / 16.0, 0, 13 / 16.0, 13 / 16.0, 16 / 16.0 ); rh.renderBlockCurrentBounds( pos, renderer ); @@ -354,45 +354,45 @@ public class PartDenseCable extends PartCable } } - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); rh.setTexture( null ); } @SideOnly( Side.CLIENT ) public void renderDenseConnection( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer, final int channels, final AEPartLocation of ) { - final TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( pos.offset( of.getFacing() ) ); final IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null; final IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null; AEColor myColor = this.getCableColor(); /* - * ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.GLASS && partHost.getPart( - * of.getOpposite() ) == null ) { isGlass = true; rh.setTexture( getGlassTexture( myColor = partHost.getColor() ) ); + * ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.GLASS && + * partHost.getPart( + * of.getOpposite() ) == null ) { isGlass = true; rh.setTexture( getGlassTexture( myColor = partHost.getColor() + * ) ); * } else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of ) != AECableType.GLASS ) { * rh.setTexture( getSmartTexture( myColor ) ); switch (of) { case DOWN: rh.setBounds( 3, 0, 3, 13, 4, 13 ); * break; case EAST: rh.setBounds( 12, 3, 3, 16, 13, 13 ); break; case NORTH: rh.setBounds( 3, 3, 0, 13, 13, 4 * ); break; case SOUTH: rh.setBounds( 3, 3, 12, 13, 13, 16 ); break; case UP: rh.setBounds( 3, 12, 3, 13, 16, * 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y, * z, renderer ); - * - * if ( true ) { setSmartConnectionRotations( of, renderer ); TextureAtlasSprite firstIcon = new TaughtIcon( getChannelTex( - * channels, false ).getIcon(), -0.2f ); TextureAtlasSprite secondIcon = new TaughtIcon( getChannelTex( channels, true ).getIcon(), + * if ( true ) { setSmartConnectionRotations( of, renderer ); TextureAtlasSprite firstIcon = new TaughtIcon( + * getChannelTex( + * channels, false ).getIcon(), -0.2f ); TextureAtlasSprite secondIcon = new TaughtIcon( getChannelTex( + * channels, true ).getIcon(), * -0.2f ); - * * if ( of == AEPartLocation.EAST || of == AEPartLocation.WEST ) { AEBaseBlock blk = (AEBaseBlock) * rh.getBlock(); FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST ); ico.setFlip( * false, true ); } - * * Tessellator.INSTANCE.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.INSTANCE.setColorOpaque_I( - * myColor.mediumVariant ); rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon ); renderAllFaces( (AEBaseBlock) + * myColor.mediumVariant ); rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon ); + * renderAllFaces( (AEBaseBlock) * rh.getBlock(), x, y, z, renderer ); - * - * Tessellator.INSTANCE.setColorOpaque_I( myColor.whiteVariant ); rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, + * Tessellator.INSTANCE.setColorOpaque_I( myColor.whiteVariant ); rh.setTexture( secondIcon, secondIcon, + * secondIcon, secondIcon, secondIcon, * secondIcon ); renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, renderer ); - * * renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = * renderer.uvRotateTop = renderer.uvRotateWest = 0; } - * * rh.setTexture( getTexture( getCableColor() ) ); } */ @@ -450,13 +450,13 @@ public class PartDenseCable extends PartCable rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon ); this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer ); - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); } } private boolean isSmart( final AEPartLocation of ) { - final TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( of.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( of.getFacing() ) ); if( te instanceof IGridHost ) { final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() ); @@ -504,12 +504,12 @@ public class PartDenseCable extends PartCable default: } - return renderer.getIcon( this.is ); + return renderer.getIcon( this.getItemStack() ); } private boolean isDense( final AEPartLocation of ) { - final TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( of.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( of.getFacing() ) ); if( te instanceof IGridHost ) { final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() ); diff --git a/src/main/java/appeng/parts/networking/PartQuartzFiber.java b/src/main/java/appeng/parts/networking/PartQuartzFiber.java index 8b99404f1..11d98ee4f 100644 --- a/src/main/java/appeng/parts/networking/PartQuartzFiber.java +++ b/src/main/java/appeng/parts/networking/PartQuartzFiber.java @@ -52,13 +52,13 @@ import appeng.parts.AEBasePart; public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider { - final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", this.proxy.getMachineRepresentation(), true ); + private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", this.getProxy().getMachineRepresentation(), true ); public PartQuartzFiber( final ItemStack is ) { super( is ); - this.proxy.setIdlePowerUsage( 0 ); - this.proxy.setFlags( GridFlags.CANNOT_CARRY ); + this.getProxy().setIdlePowerUsage( 0 ); + this.getProxy().setFlags( GridFlags.CANNOT_CARRY ); this.outerProxy.setIdlePowerUsage( 0 ); this.outerProxy.setFlags( GridFlags.CANNOT_CARRY ); } @@ -81,7 +81,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider { GL11.glTranslated( -0.2, -0.3, 0.0 ); - rh.setTexture( renderer.getIcon( this.is ) ); + rh.setTexture( renderer.getIcon( this.getItemStack() ) ); rh.setBounds( 6.0f, 6.0f, 5.0f, 10.0f, 10.0f, 11.0f ); rh.renderInventoryBox( renderer ); rh.setTexture( null ); @@ -91,7 +91,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - final IAESprite myIcon = renderer.getIcon( this.is ); + final IAESprite myIcon = renderer.getIcon( this.getItemStack() ); rh.setTexture( myIcon ); rh.setBounds( 6, 6, 10, 10, 10, 16 ); rh.renderBlock( pos, renderer ); @@ -159,7 +159,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider try { - final IEnergyGrid eg = this.proxy.getEnergy(); + final IEnergyGrid eg = this.getProxy().getEnergy(); acquiredPower += eg.extractAEPower( amt - acquiredPower, mode, seen ); } catch( final GridAccessException e ) @@ -186,7 +186,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider try { - final IEnergyGrid eg = this.proxy.getEnergy(); + final IEnergyGrid eg = this.getProxy().getEnergy(); if( !seen.contains( eg ) ) { return eg.injectAEPower( amt, mode, seen ); @@ -220,7 +220,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider try { - final IEnergyGrid eg = this.proxy.getEnergy(); + final IEnergyGrid eg = this.getProxy().getEnergy(); demand += eg.getEnergyDemand( amt - demand, seen ); } catch( final GridAccessException e ) diff --git a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java index af2d92f22..d63876946 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java +++ b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java @@ -262,4 +262,4 @@ package appeng.parts.p2p; // { // return ic2.api.energy.EnergyNet.instance.getTierFromPower( voltage ); // } -//} +// } diff --git a/src/main/java/appeng/parts/p2p/PartP2PItems.java b/src/main/java/appeng/parts/p2p/PartP2PItems.java index 85fea1d7d..15cedffaf 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PItems.java +++ b/src/main/java/appeng/parts/p2p/PartP2PItems.java @@ -54,13 +54,13 @@ import appeng.util.inv.WrapperMCISidedInventory; // TODO: BC Integration //@Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = IntegrationType.BuildCraftTransport ) -public class PartP2PItems extends PartP2PTunnel implements /*IPipeConnection,*/ ISidedInventory, IGridTickable +public class PartP2PItems extends PartP2PTunnel implements /* IPipeConnection, */ISidedInventory, IGridTickable { - final LinkedList which = new LinkedList(); - int oldSize = 0; - boolean requested; - IInventory cachedInv; + private final LinkedList which = new LinkedList(); + private int oldSize = 0; + private boolean requested; + private IInventory cachedInv; public PartP2PItems( final ItemStack is ) { @@ -72,13 +72,13 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe { this.cachedInv = null; final PartP2PItems input = this.getInput(); - if( input != null && this.output ) + if( input != null && this.isOutput() ) { input.onTunnelNetworkChange(); } } - IInventory getDestination() + private IInventory getDestination() { this.requested = true; @@ -118,13 +118,13 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe return this.cachedInv = new WrapperChainedInventory( outs ); } - IInventory getOutputInv() + private IInventory getOutputInv() { IInventory output = null; - if( this.proxy.isActive() ) + if( this.getProxy().isActive() ) { - final TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( this.side.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( this.getSide().getFacing() ) ); if( this.which.contains( this ) ) { @@ -136,18 +136,18 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) ) { final IBuildCraftTransport buildcraft = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport ); - if( buildcraft.isPipe( te, this.side.getOpposite().getFacing() ) ) + if( buildcraft.isPipe( te, this.getSide().getOpposite().getFacing() ) ) { try { - output = new WrapperBCPipe( te, this.side.getFacing().getOpposite() ); + output = new WrapperBCPipe( te, this.getSide().getFacing().getOpposite() ); } catch( final Throwable ignore ) { } } } - + /* * if ( AppEng.INSTANCE.isIntegrationEnabled( "TE" ) ) { ITE thermal = (ITE) AppEng.INSTANCE.getIntegration( * "TE" ); if ( thermal != null ) { if ( thermal.isPipe( te, side.getOpposite() ) ) { try { output = new @@ -162,7 +162,7 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe } else if( te instanceof ISidedInventory ) { - output = new WrapperMCISidedInventory( (ISidedInventory) te, this.side.getFacing().getOpposite() ); + output = new WrapperMCISidedInventory( (ISidedInventory) te, this.getSide().getFacing().getOpposite() ); } else if( te instanceof IInventory ) { @@ -179,7 +179,7 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.ItemTunnel.min, TickRates.ItemTunnel.max, false, false ); + return new TickingRequest( TickRates.ItemTunnel.getMin(), TickRates.ItemTunnel.getMax(), false, false ); } @Override @@ -199,7 +199,7 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe @MENetworkEventSubscribe public void changeStateA( final MENetworkBootingStatusChange bs ) { - if( !this.output ) + if( !this.isOutput() ) { this.cachedInv = null; final int olderSize = this.oldSize; @@ -214,7 +214,7 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe @MENetworkEventSubscribe public void changeStateB( final MENetworkChannelsChanged bs ) { - if( !this.output ) + if( !this.isOutput() ) { this.cachedInv = null; final int olderSize = this.oldSize; @@ -229,7 +229,7 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe @MENetworkEventSubscribe public void changeStateC( final MENetworkPowerStatusChange bs ) { - if( !this.output ) + if( !this.isOutput() ) { this.cachedInv = null; final int olderSize = this.oldSize; @@ -244,7 +244,7 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe @Override public void onTunnelNetworkChange() { - if( !this.output ) + if( !this.isOutput() ) { this.cachedInv = null; final int olderSize = this.oldSize; @@ -337,12 +337,12 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe } @Override - public void openInventory( final EntityPlayer p) + public void openInventory( final EntityPlayer p ) { } @Override - public void closeInventory( final EntityPlayer p) + public void closeInventory( final EntityPlayer p ) { } @@ -375,12 +375,12 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe return 0; } -// @Override -// @Method( iname = IntegrationType.BuildCraftTransport ) -// public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) -// { -// return 0; -// } + // @Override + // @Method( iname = IntegrationType.BuildCraftTransport ) + // public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) + // { + // return 0; + // } @Override public void setField( @@ -409,10 +409,10 @@ public class PartP2PItems extends PartP2PTunnel implements /*IPipe } // TODO: BC Integration -// @Override -// @Method( iname = "BuildCraftTransport" ) -// public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) -// { -// return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT; -// } + // @Override + // @Method( iname = "BuildCraftTransport" ) + // public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with ) + // { + // return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT; + // } } diff --git a/src/main/java/appeng/parts/p2p/PartP2PLight.java b/src/main/java/appeng/parts/p2p/PartP2PLight.java index fbacf2975..859c42c82 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PLight.java +++ b/src/main/java/appeng/parts/p2p/PartP2PLight.java @@ -40,8 +40,8 @@ import appeng.me.GridAccessException; public class PartP2PLight extends PartP2PTunnel implements IGridTickable { - int lastValue = 0; - float opacity = -1; + private int lastValue = 0; + private float opacity = -1; public PartP2PLight( final ItemStack is ) { @@ -66,7 +66,7 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi public void writeToStream( final ByteBuf data ) throws IOException { super.writeToStream( data ); - data.writeInt( this.output ? this.lastValue : 0 ); + data.writeInt( this.isOutput() ? this.lastValue : 0 ); } @Override @@ -74,13 +74,13 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi { super.readFromStream( data ); this.lastValue = data.readInt(); - this.output = this.lastValue > 0; + this.setOutput( this.lastValue > 0 ); return false; } private boolean doWork() { - if( this.output ) + if( this.isOutput() ) { return false; } @@ -88,9 +88,9 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi final TileEntity te = this.getTile(); final World w = te.getWorld(); - final int newLevel = w.getLight( te.getPos().offset( this.side.getFacing() ) ); + final int newLevel = w.getLight( te.getPos().offset( this.getSide().getFacing() ) ); - if( this.lastValue != newLevel && this.proxy.isActive() ) + if( this.lastValue != newLevel && this.getProxy().isActive() ) { this.lastValue = newLevel; try @@ -116,7 +116,7 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi this.doWork(); - if( this.output ) + if( this.isOutput() ) { this.getHost().markForUpdate(); } @@ -125,7 +125,7 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi @Override public int getLightLevel() { - if( this.output && this.isPowered() ) + if( this.isOutput() && this.isPowered() ) { return this.blockLight( this.lastValue ); } @@ -133,7 +133,7 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi return 0; } - public void setLightLevel( final int out ) + private void setLightLevel( final int out ) { this.lastValue = out; this.getHost().markForUpdate(); @@ -144,7 +144,7 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi if( this.opacity < 0 ) { final TileEntity te = this.getTile(); - this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.side.getFacing() ) ); + this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.getSide().getFacing() ) ); } return (int) ( emit * ( this.opacity / 255.0f ) ); @@ -178,10 +178,10 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi @Override public void onTunnelNetworkChange() { - if( this.output ) + if( this.isOutput() ) { final PartP2PLight src = this.getInput(); - if( src != null && src.proxy.isActive() ) + if( src != null && src.getProxy().isActive() ) { this.setLightLevel( src.lastValue ); } @@ -199,7 +199,7 @@ public class PartP2PLight extends PartP2PTunnel implements IGridTi @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.LightTunnel.min, TickRates.LightTunnel.max, false, false ); + return new TickingRequest( TickRates.LightTunnel.getMin(), TickRates.LightTunnel.getMax(), false, false ); } @Override diff --git a/src/main/java/appeng/parts/p2p/PartP2PLiquids.java b/src/main/java/appeng/parts/p2p/PartP2PLiquids.java index 4c045a6be..af3504eae 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PLiquids.java +++ b/src/main/java/appeng/parts/p2p/PartP2PLiquids.java @@ -37,10 +37,10 @@ import appeng.me.GridAccessException; public class PartP2PLiquids extends PartP2PTunnel implements IFluidHandler { - static final ThreadLocal> DEPTH = new ThreadLocal>(); + private static final ThreadLocal> DEPTH = new ThreadLocal>(); private static final FluidTankInfo[] ACTIVE_TANK = { new FluidTankInfo( null, 10000 ) }; private static final FluidTankInfo[] INACTIVE_TANK = { new FluidTankInfo( null, 0 ) }; - IFluidHandler cachedTank; + private IFluidHandler cachedTank; private int tmpUsed; public PartP2PLiquids( final ItemStack is ) @@ -63,7 +63,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl public void onNeighborChanged() { this.cachedTank = null; - if( this.output ) + if( this.isOutput() ) { final PartP2PLiquids in = this.getInput(); if( in != null ) @@ -98,7 +98,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl final IFluidHandler tank = l.getTarget(); if( tank != null ) { - l.tmpUsed = tank.fill( l.side.getFacing().getOpposite(), resource.copy(), false ); + l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), resource.copy(), false ); } else { @@ -153,7 +153,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl final IFluidHandler tank = l.getTarget(); if( tank != null ) { - l.tmpUsed = tank.fill( l.side.getFacing().getOpposite(), insert.copy(), true ); + l.tmpUsed = tank.fill( l.getSide().getFacing().getOpposite(), insert.copy(), true ); } else { @@ -184,7 +184,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl return s; } - List getOutputs( final Fluid input ) + private List getOutputs( final Fluid input ) { final List outs = new LinkedList(); @@ -195,7 +195,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl final IFluidHandler handler = l.getTarget(); if( handler != null ) { - if( handler.canFill( l.side.getFacing().getOpposite(), input ) ) + if( handler.canFill( l.getSide().getFacing().getOpposite(), input ) ) { outs.add( l ); } @@ -210,9 +210,9 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl return outs; } - IFluidHandler getTarget() + private IFluidHandler getTarget() { - if( !this.proxy.isActive() ) + if( !this.getProxy().isActive() ) { return null; } @@ -222,7 +222,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl return this.cachedTank; } - final TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( this.side.getFacing() ) ); + final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( this.getSide().getFacing() ) ); if( te instanceof IFluidHandler ) { return this.cachedTank = (IFluidHandler) te; @@ -246,7 +246,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl @Override public boolean canFill( final EnumFacing from, final Fluid fluid ) { - return !this.output && from == this.side.getFacing() && !this.getOutputs( fluid ).isEmpty(); + return !this.isOutput() && from == this.getSide().getFacing() && !this.getOutputs( fluid ).isEmpty(); } @Override @@ -258,7 +258,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl @Override public FluidTankInfo[] getTankInfo( final EnumFacing from ) { - if( from == this.side.getFacing() ) + if( from == this.getSide().getFacing() ) { return this.getTank(); } @@ -267,7 +267,7 @@ public class PartP2PLiquids extends PartP2PTunnel implements IFl private FluidTankInfo[] getTank() { - if( this.output ) + if( this.isOutput() ) { final PartP2PLiquids tun = this.getInput(); if( tun != null ) diff --git a/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java b/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java index ca7497f48..5be21b341 100644 --- a/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java +++ b/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java @@ -250,4 +250,4 @@ package appeng.parts.p2p; // return null; // } // } -//} +// } diff --git a/src/main/java/appeng/parts/p2p/PartP2PPressure.java b/src/main/java/appeng/parts/p2p/PartP2PPressure.java index 7e2926635..5f7c26345 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PPressure.java +++ b/src/main/java/appeng/parts/p2p/PartP2PPressure.java @@ -171,4 +171,4 @@ package appeng.parts.p2p; // } // } // -//} +// } diff --git a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java index f8aaed065..c7e35ecb1 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class PartP2PRedstone extends PartP2PTunnel { - int power; - boolean recursive = false; + private int power; + private boolean recursive = false; public PartP2PRedstone( final ItemStack is ) { @@ -52,9 +52,9 @@ public class PartP2PRedstone extends PartP2PTunnel this.setNetworkReady(); } - public void setNetworkReady() + private void setNetworkReady() { - if( this.output ) + if( this.isOutput() ) { final PartP2PRedstone in = this.getInput(); if( in != null ) @@ -64,7 +64,7 @@ public class PartP2PRedstone extends PartP2PTunnel } } - protected void putInput( final Object o ) + private void putInput( final Object o ) { if( this.recursive ) { @@ -72,7 +72,7 @@ public class PartP2PRedstone extends PartP2PTunnel } this.recursive = true; - if( this.output && this.proxy.isActive() ) + if( this.isOutput() && this.getProxy().isActive() ) { final int newPower = (Integer) o; if( this.power != newPower ) @@ -84,15 +84,15 @@ public class PartP2PRedstone extends PartP2PTunnel this.recursive = false; } - public void notifyNeighbors() + private void notifyNeighbors() { - final World worldObj = this.tile.getWorld(); + final World worldObj = this.getTile().getWorld(); - Platform.notifyBlocksOfNeighbors( worldObj, this.tile.getPos()); + Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos() ); // and this cause sometimes it can go thought walls. - for ( final EnumFacing face : EnumFacing.VALUES ) - Platform.notifyBlocksOfNeighbors( worldObj, this.tile.getPos().offset( face ) ); + for( final EnumFacing face : EnumFacing.VALUES ) + Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos().offset( face ) ); } @MENetworkEventSubscribe @@ -135,22 +135,22 @@ public class PartP2PRedstone extends PartP2PTunnel @Override public void onNeighborChanged() { - if( !this.output ) + if( !this.isOutput() ) { - final BlockPos target = this.tile.getPos().offset( this.side.getFacing() ); + final BlockPos target = this.getTile().getPos().offset( this.getSide().getFacing() ); - final IBlockState state = this.tile.getWorld().getBlockState( target ); + final IBlockState state = this.getTile().getWorld().getBlockState( target ); final Block b = state.getBlock(); - if( b != null && !this.output ) + if( b != null && !this.isOutput() ) { - EnumFacing srcSide = this.side.getFacing(); + EnumFacing srcSide = this.getSide().getFacing(); if( b instanceof BlockRedstoneWire ) { srcSide = EnumFacing.UP; } - - this.power = b.isProvidingStrongPower( this.tile.getWorld(), target,state, srcSide ); - this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorld(), target, state, srcSide ) ); + + this.power = b.isProvidingStrongPower( this.getTile().getWorld(), target, state, srcSide ); + this.power = Math.max( this.power, b.isProvidingWeakPower( this.getTile().getWorld(), target, state, srcSide ) ); this.sendToOutput( this.power ); } else @@ -169,13 +169,13 @@ public class PartP2PRedstone extends PartP2PTunnel @Override public int isProvidingStrongPower() { - return this.output ? this.power : 0; + return this.isOutput() ? this.power : 0; } @Override public int isProvidingWeakPower() { - return this.output ? this.power : 0; + return this.isOutput() ? this.power : 0; } private void sendToOutput( final int power ) diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java index ff35a901d..17e3f67cc 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java @@ -62,8 +62,8 @@ import com.google.common.base.Optional; public abstract class PartP2PTunnel extends PartBasicState { private final TunnelCollection type = new TunnelCollection( null, this.getClass() ); - public boolean output; - public long freq; + private boolean output; + private long freq; public PartP2PTunnel( final ItemStack is ) { @@ -81,16 +81,16 @@ public abstract class PartP2PTunnel extends PartBasicSt return null; } - public T getInput() + T getInput() { - if( this.freq == 0 ) + if( this.getFrequency() == 0 ) { return null; } try { - final PartP2PTunnel tunnel = this.proxy.getP2P().getInput( this.freq ); + final PartP2PTunnel tunnel = this.getProxy().getP2P().getInput( this.getFrequency() ); if( this.getClass().isInstance( tunnel ) ) { return (T) tunnel; @@ -103,11 +103,11 @@ public abstract class PartP2PTunnel extends PartBasicSt return null; } - public TunnelCollection getOutputs() throws GridAccessException + TunnelCollection getOutputs() throws GridAccessException { - if( this.proxy.isActive() ) + if( this.getProxy().isActive() ) { - return (TunnelCollection) this.proxy.getP2P().getOutputs( this.freq, this.getClass() ); + return (TunnelCollection) this.getProxy().getP2P().getOutputs( this.getFrequency(), this.getClass() ); } return new TunnelCollection( new ArrayList(), this.getClass() ); } @@ -124,19 +124,19 @@ public abstract class PartP2PTunnel extends PartBasicSt @SideOnly( Side.CLIENT ) public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( this.getTypeTexture(renderer) ); + rh.setTexture( this.getTypeTexture( renderer ) ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderInventoryBox( renderer ); - rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() ); + rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderInventoryBox( renderer ); } /** - * @param renderer + * @param renderer * @return If enabled it returns the icon of an AE quartz block, else vanilla quartz block icon */ protected IAESprite getTypeTexture( final ModelGenerator renderer ) @@ -144,11 +144,11 @@ public abstract class PartP2PTunnel extends PartBasicSt final Optional maybeBlock = AEApi.instance().definitions().blocks().quartz().maybeBlock(); if( maybeBlock.isPresent() ) { - return renderer.getIcon( new ItemStack(maybeBlock.get()) ); + return renderer.getIcon( new ItemStack( maybeBlock.get() ) ); } else { - return renderer.getIcon( new ItemStack(Blocks.quartz_block) ); + return renderer.getIcon( new ItemStack( Blocks.quartz_block ) ); } } @@ -156,12 +156,12 @@ public abstract class PartP2PTunnel extends PartBasicSt @SideOnly( Side.CLIENT ) public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer ) { - rh.setTexture( this.getTypeTexture(renderer) ); + rh.setTexture( this.getTypeTexture( renderer ) ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( pos, renderer ); - rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() ); + rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( pos, renderer ); @@ -201,16 +201,16 @@ public abstract class PartP2PTunnel extends PartBasicSt public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); - this.output = data.getBoolean( "output" ); - this.freq = data.getLong( "freq" ); + this.setOutput( data.getBoolean( "output" ) ); + this.setFrequency( data.getLong( "freq" ) ); } @Override public void writeToNBT( final NBTTagCompound data ) { super.writeToNBT( data ); - data.setBoolean( "output", this.output ); - data.setLong( "freq", this.freq ); + data.setBoolean( "output", this.isOutput() ); + data.setLong( "freq", this.getFrequency() ); } @Override @@ -249,18 +249,18 @@ public abstract class PartP2PTunnel extends PartBasicSt final IPart testPart = ( (IPartItem) newType.getItem() ).createPartFromItemStack( newType ); if( testPart instanceof PartP2PTunnel ) { - this.getHost().removePart( this.side, true ); - final AEPartLocation dir = this.getHost().addPart( newType, this.side, player ); + this.getHost().removePart( this.getSide(), true ); + final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player ); final IPart newBus = this.getHost().getPart( dir ); if( newBus instanceof PartP2PTunnel ) { final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus; - newTunnel.output = true; + newTunnel.setOutput( true ); try { - final P2PCache p2p = newTunnel.proxy.getP2P(); + final P2PCache p2p = newTunnel.getProxy().getP2P(); p2p.updateFreq( newTunnel, freq ); } catch( final GridAccessException e ) @@ -293,31 +293,31 @@ public abstract class PartP2PTunnel extends PartBasicSt } break; - /* - case RF_POWER: - for( ItemStack stack : parts.p2PTunnelRF().maybeStack( 1 ).asSet() ) - { - newType = stack; - } - break; - */ - + /* + * case RF_POWER: + * for( ItemStack stack : parts.p2PTunnelRF().maybeStack( 1 ).asSet() ) + * { + * newType = stack; + * } + * break; + */ + case FLUID: for( final ItemStack stack : parts.p2PTunnelLiquids().maybeStack( 1 ).asSet() ) { newType = stack; } break; - - /* - case IC2_POWER: - for( ItemStack stack : parts.p2PTunnelEU().maybeStack( 1 ).asSet() ) - { - newType = stack; - } - break; - */ - + + /* + * case IC2_POWER: + * for( ItemStack stack : parts.p2PTunnelEU().maybeStack( 1 ).asSet() ) + * { + * newType = stack; + * } + * break; + */ + case ITEM: for( final ItemStack stack : parts.p2PTunnelItems().maybeStack( 1 ).asSet() ) { @@ -338,46 +338,44 @@ public abstract class PartP2PTunnel extends PartBasicSt newType = stack; } break; - - /* - case COMPUTER_MESSAGE: - for( ItemStack stack : parts.p2PTunnelOpenComputers().maybeStack( 1 ).asSet() ) - { - newType = stack; - } - break; - case PRESSURE: - for( ItemStack stack : parts.p2PTunnelPneumaticCraft().maybeStack( 1 ).asSet() ) - { - newType = stack; - } - break; + /* + * case COMPUTER_MESSAGE: + * for( ItemStack stack : parts.p2PTunnelOpenComputers().maybeStack( 1 ).asSet() ) + * { + * newType = stack; + * } + * break; + * case PRESSURE: + * for( ItemStack stack : parts.p2PTunnelPneumaticCraft().maybeStack( 1 ).asSet() ) + * { + * newType = stack; + * } + * break; + */ - */ - default: break; } - if( newType != null && !Platform.isSameItem( newType, this.is ) ) + if( newType != null && !Platform.isSameItem( newType, this.getItemStack() ) ) { - final boolean oldOutput = this.output; - final long myFreq = this.freq; + final boolean oldOutput = this.isOutput(); + final long myFreq = this.getFrequency(); - this.getHost().removePart( this.side, false ); - final AEPartLocation dir = this.getHost().addPart( newType, this.side, player ); + this.getHost().removePart( this.getSide(), false ); + final AEPartLocation dir = this.getHost().addPart( newType, this.getSide(), player ); final IPart newBus = this.getHost().getPart( dir ); if( newBus instanceof PartP2PTunnel ) { final PartP2PTunnel newTunnel = (PartP2PTunnel) newBus; - newTunnel.output = oldOutput; + newTunnel.setOutput( oldOutput ); newTunnel.onTunnelNetworkChange(); try { - final P2PCache p2p = newTunnel.proxy.getP2P(); + final P2PCache p2p = newTunnel.getProxy().getP2P(); p2p.updateFreq( newTunnel, myFreq ); } catch( final GridAccessException e ) @@ -386,7 +384,7 @@ public abstract class PartP2PTunnel extends PartBasicSt } } - Platform.notifyBlocksOfNeighbors( this.tile.getWorld(), this.tile.getPos() ); + Platform.notifyBlocksOfNeighbors( this.getTile().getWorld(), this.getTile().getPos() ); return true; } } @@ -403,18 +401,18 @@ public abstract class PartP2PTunnel extends PartBasicSt final IMemoryCard mc = (IMemoryCard) is.getItem(); final NBTTagCompound data = new NBTTagCompound(); - long newFreq = this.freq; - final boolean wasOutput = this.output; - this.output = false; + long newFreq = this.getFrequency(); + final boolean wasOutput = this.isOutput(); + this.setOutput( false ); - if( wasOutput || this.freq == 0 ) + if( wasOutput || this.getFrequency() == 0 ) { newFreq = System.currentTimeMillis(); } try { - this.proxy.getP2P().updateFreq( this, newFreq ); + this.getProxy().getP2P().updateFreq( this, newFreq ); } catch( final GridAccessException e ) { @@ -427,7 +425,7 @@ public abstract class PartP2PTunnel extends PartBasicSt final String type = p2pItem.getUnlocalizedName(); p2pItem.writeToNBT( data ); - data.setLong( "freq", this.freq ); + data.setLong( "freq", this.getFrequency() ); mc.setMemoryCardContents( is, type + ".name", data ); mc.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED ); @@ -458,11 +456,31 @@ public abstract class PartP2PTunnel extends PartBasicSt try { - this.proxy.getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE ); + this.getProxy().getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE ); } catch( final GridAccessException e ) { // :P } } + + public long getFrequency() + { + return this.freq; + } + + public void setFrequency( final long freq ) + { + this.freq = freq; + } + + public boolean isOutput() + { + return this.output; + } + + void setOutput( final boolean output ) + { + this.output = output; + } } diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java b/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java index 3be587c0a..5991fcb3c 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java @@ -49,13 +49,13 @@ import appeng.me.helpers.AENetworkProxy; public class PartP2PTunnelME extends PartP2PTunnel implements IGridTickable { - public final Connections connection = new Connections( this ); - final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true ); + private final Connections connection = new Connections( this ); + private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true ); public PartP2PTunnelME( final ItemStack is ) { super( is ); - this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.COMPRESSED_CHANNEL ); this.outerProxy.setFlags( GridFlags.DENSE_CAPACITY, GridFlags.CANNOT_CARRY_COMPRESSED ); } @@ -77,11 +77,11 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I public void onTunnelNetworkChange() { super.onTunnelNetworkChange(); - if( !this.output ) + if( !this.isOutput() ) { try { - this.proxy.getTick().wakeDevice( this.proxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } catch( final GridAccessException e ) { @@ -133,7 +133,7 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.METunnel.min, TickRates.METunnel.max, true, false ); + return new TickingRequest( TickRates.METunnel.getMin(), TickRates.METunnel.getMax(), true, false ); } @Override @@ -142,24 +142,24 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I // just move on... try { - if( !this.proxy.getPath().isNetworkBooting() ) + if( !this.getProxy().getPath().isNetworkBooting() ) { - if( !this.proxy.getEnergy().isNetworkPowered() ) + if( !this.getProxy().getEnergy().isNetworkPowered() ) { this.connection.markDestroy(); - TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection ); + TickHandler.INSTANCE.addCallable( this.getTile().getWorld(), this.connection ); } else { - if( this.proxy.isActive() ) + if( this.getProxy().isActive() ) { this.connection.markCreate(); - TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection ); + TickHandler.INSTANCE.addCallable( this.getTile().getWorld(), this.connection ); } else { this.connection.markDestroy(); - TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection ); + TickHandler.INSTANCE.addCallable( this.getTile().getWorld(), this.connection ); } } @@ -176,32 +176,32 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I public void updateConnections( final Connections connections ) { - if( connections.destroy ) + if( connections.isDestroy() ) { - for( final TunnelConnection cw : this.connection.connections.values() ) + for( final TunnelConnection cw : this.connection.getConnections().values() ) { - cw.c.destroy(); + cw.getConnection().destroy(); } - this.connection.connections.clear(); + this.connection.getConnections().clear(); } - else if( connections.create ) + else if( connections.isCreate() ) { - final Iterator i = this.connection.connections.values().iterator(); + final Iterator i = this.connection.getConnections().values().iterator(); while( i.hasNext() ) { final TunnelConnection cw = i.next(); try { - if( cw.tunnel.proxy.getGrid() != this.proxy.getGrid() ) + if( cw.getTunnel().getProxy().getGrid() != this.getProxy().getGrid() ) { - cw.c.destroy(); + cw.getConnection().destroy(); i.remove(); } - else if( !cw.tunnel.proxy.isActive() ) + else if( !cw.getTunnel().getProxy().isActive() ) { - cw.c.destroy(); + cw.getConnection().destroy(); i.remove(); } } @@ -216,7 +216,7 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I { for( final PartP2PTunnelME me : this.getOutputs() ) { - if( me.proxy.isActive() && connections.connections.get( me.getGridNode() ) == null ) + if( me.getProxy().isActive() && connections.getConnections().get( me.getGridNode() ) == null ) { newSides.add( me ); } @@ -226,15 +226,15 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I { try { - connections.connections.put( me.getGridNode(), new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) ); + connections.getConnections().put( me.getGridNode(), new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) ); } catch( final FailedConnection e ) { final TileEntity start = this.getTile(); final TileEntity end = me.getTile(); - AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", - start.getPos().getX(), start.getPos().getY(), start.getPos().getZ(), - end.getPos().getX(), end.getPos().getY(), end.getPos().getZ() ); + AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", + start.getPos().getX(), start.getPos().getY(), start.getPos().getZ(), + end.getPos().getX(), end.getPos().getY(), end.getPos().getZ() ); // :( } } diff --git a/src/main/java/appeng/parts/reporting/AbstractPartDisplay.java b/src/main/java/appeng/parts/reporting/AbstractPartDisplay.java index 064844332..3632cb68a 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartDisplay.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartDisplay.java @@ -59,7 +59,7 @@ public abstract class AbstractPartDisplay extends AbstractPartReporting final IAESprite sideTexture = CableBusTextures.PartMonitorSides.getIcon(); final IAESprite backTexture = CableBusTextures.PartMonitorBack.getIcon(); - rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.is ), sideTexture, sideTexture ); + rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.getItemStack() ), sideTexture, sideTexture ); rh.renderInventoryBox( renderer ); rh.setInvColor( this.getColor().whiteVariant ); @@ -82,7 +82,7 @@ public abstract class AbstractPartDisplay extends AbstractPartReporting final IAESprite sideTexture = CableBusTextures.PartMonitorSides.getIcon(); final IAESprite backTexture = CableBusTextures.PartMonitorBack.getIcon(); - rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.is ), sideTexture, sideTexture ); + rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.getItemStack() ), sideTexture, sideTexture ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( pos, renderer ); @@ -93,7 +93,7 @@ public abstract class AbstractPartDisplay extends AbstractPartReporting renderer.setBrightness( l << 20 | l << 4 ); } - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = this.getSpin(); + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( this.getSpin() ) ) ) ) ) ); renderer.setColorOpaque_I( this.getColor().whiteVariant ); rh.renderFace( pos, this.getFrontBright().getIcon(), EnumFacing.SOUTH, renderer ); @@ -104,11 +104,11 @@ public abstract class AbstractPartDisplay extends AbstractPartReporting renderer.setColorOpaque_I( this.getColor().blackVariant ); rh.renderFace( pos, this.getFrontColored().getIcon(), EnumFacing.SOUTH, renderer ); - renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; + renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) ); final IAESprite sideStatusTexture = CableBusTextures.PartMonitorSidesStatus.getIcon(); - rh.setTexture( sideStatusTexture, sideStatusTexture, backTexture, renderer.getIcon( this.is ), sideStatusTexture, sideStatusTexture ); + rh.setTexture( sideStatusTexture, sideStatusTexture, backTexture, renderer.getIcon( this.getItemStack() ), sideStatusTexture, sideStatusTexture ); rh.setBounds( 4, 4, 13, 12, 12, 14 ); rh.renderBlock( pos, renderer ); diff --git a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java index 0310d4f49..45d4eccb4 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java @@ -166,7 +166,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements return true; } - if( !this.proxy.isActive() ) + if( !this.getProxy().isActive() ) { return false; } @@ -176,7 +176,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements return false; } - final TileEntity te = this.tile; + final TileEntity te = this.getTile(); final ItemStack eq = player.getCurrentEquippedItem(); if( Platform.isWrench( player, eq, te.getPos() ) ) @@ -200,7 +200,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements } // update the system... - public void configureWatchers() + private void configureWatchers() { if( this.myWatcher != null ) { @@ -216,7 +216,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements this.myWatcher.add( this.configuredItem ); } - this.updateReportingValue( this.proxy.getStorage().getItemInventory() ); + this.updateReportingValue( this.getProxy().getStorage().getItemInventory() ); } } catch( final GridAccessException e ) @@ -314,7 +314,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements { // GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - final AEPartLocation d = this.side; + final AEPartLocation d = this.getSide(); GL11.glTranslated( d.xOffset * 0.77, d.yOffset * 0.77, d.zOffset * 0.77 ); switch( d ) { @@ -323,27 +323,27 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( this.getSpin() * 90.0F, 0, 0, 1 ); break; - + case DOWN: GL11.glScalef( 1.0f, -1.0f, 1.0f ); GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f ); GL11.glRotatef( this.getSpin() * -90.0F, 0, 0, 1 ); break; - + case EAST: GL11.glScalef( -1.0f, -1.0f, -1.0f ); GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f ); break; - + case WEST: GL11.glScalef( -1.0f, -1.0f, -1.0f ); GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f ); break; - + case NORTH: GL11.glScalef( -1.0f, -1.0f, -1.0f ); break; - + case SOUTH: GL11.glScalef( -1.0f, -1.0f, -1.0f ); GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f ); @@ -352,7 +352,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements default: break; } - + try { final ItemStack sis = ais.getItemStack(); @@ -370,7 +370,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements // RenderHelper.enableGUIStandardItemLighting(); wr.setColorOpaque_F( 1.0f, 1.0f, 1.0f ); - ClientHelper.proxy.doRenderItem( sis, this.tile.getWorld() ); + ClientHelper.proxy.doRenderItem( sis, this.getTile().getWorld() ); } catch( final Exception e ) { diff --git a/src/main/java/appeng/parts/reporting/AbstractPartPanel.java b/src/main/java/appeng/parts/reporting/AbstractPartPanel.java index ed33654fa..1016cf9d5 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartPanel.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartPanel.java @@ -86,7 +86,7 @@ public abstract class AbstractPartPanel extends AbstractPartReporting final IAESprite sideTexture = CableBusTextures.PartMonitorSides.getIcon(); final IAESprite backTexture = CableBusTextures.PartMonitorBack.getIcon(); - rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.is ), sideTexture, sideTexture ); + rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.getItemStack() ), sideTexture, sideTexture ); rh.renderInventoryBox( renderer ); rh.setInvColor( this.getBrightnessColor() ); @@ -103,7 +103,7 @@ public abstract class AbstractPartPanel extends AbstractPartReporting final IAESprite sideTexture = CableBusTextures.PartMonitorSides.getIcon(); final IAESprite backTexture = CableBusTextures.PartMonitorBack.getIcon(); - rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.is ), sideTexture, sideTexture ); + rh.setTexture( sideTexture, sideTexture, backTexture, renderer.getIcon( this.getItemStack() ), sideTexture, sideTexture ); rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.renderBlock( pos, renderer ); diff --git a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java index 3271d6b5a..ca04eba71 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java @@ -80,12 +80,12 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM if( requireChannel ) { - this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL ); - this.proxy.setIdlePowerUsage( 1.0 / 2.0 ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setIdlePowerUsage( 1.0 / 2.0 ); } else { - this.proxy.setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit. + this.getProxy().setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit. } } @@ -145,17 +145,17 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM try { - if( this.proxy.getEnergy().isNetworkPowered() ) + if( this.getProxy().getEnergy().isNetworkPowered() ) { this.clientFlags = this.getClientFlags() | AbstractPartReporting.POWERED_FLAG; } - if( this.proxy.getPath().isNetworkBooting() ) + if( this.getProxy().getPath().isNetworkBooting() ) { this.clientFlags = this.getClientFlags() | AbstractPartReporting.BOOTING_FLAG; } - if( this.proxy.getNode().meetsChannelRequirements() ) + if( this.getProxy().getNode().meetsChannelRequirements() ) { this.clientFlags = this.getClientFlags() | AbstractPartReporting.CHANNEL_FLAG; } @@ -218,7 +218,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM break; } - this.host.markForUpdate(); + this.getHost().markForUpdate(); this.saveChanges(); } return true; @@ -250,7 +250,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM if( this.opacity < 0 ) { final TileEntity te = this.getTile(); - this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.side.getFacing() ) ); + this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.getSide().getFacing() ) ); } return (int) ( emit * ( this.opacity / 255.0f ) ); @@ -263,7 +263,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM { if( Platform.isServer() ) { - return this.proxy.getEnergy().isNetworkPowered(); + return this.getProxy().getEnergy().isNetworkPowered(); } else { diff --git a/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java b/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java index c8e379f96..d5cfbddc1 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java @@ -121,7 +121,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, this.getGui( player ) ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), this.getGui( player ) ); return true; } @@ -139,7 +139,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement { try { - return this.proxy.getStorage().getItemInventory(); + return this.getProxy().getStorage().getItemInventory(); } catch( final GridAccessException e ) { @@ -153,7 +153,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement { try { - return this.proxy.getStorage().getFluidInventory(); + return this.getProxy().getStorage().getFluidInventory(); } catch( final GridAccessException e ) { @@ -177,6 +177,6 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement @Override public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack ) { - this.host.markForSave(); + this.getHost().markForSave(); } } diff --git a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java index 34a567d7d..f690256ff 100644 --- a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java +++ b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java @@ -60,7 +60,7 @@ public class PartConversionMonitor extends AbstractPartMonitor return true; } - if( !this.proxy.isActive() ) + if( !this.getProxy().isActive() ) { return false; } @@ -83,13 +83,13 @@ public class PartConversionMonitor extends AbstractPartMonitor { try { - if( !this.proxy.isActive() ) + if( !this.getProxy().isActive() ) { return false; } - final IEnergySource energy = this.proxy.getEnergy(); - final IMEMonitor cell = this.proxy.getStorage().getItemInventory(); + final IEnergySource energy = this.getProxy().getEnergy(); + final IMEMonitor cell = this.getProxy().getStorage().getItemInventory(); final IAEItemStack input = AEItemStack.create( item ); if( ModeB ) @@ -128,13 +128,13 @@ public class PartConversionMonitor extends AbstractPartMonitor { try { - if( !this.proxy.isActive() ) + if( !this.getProxy().isActive() ) { return; } - final IEnergySource energy = this.proxy.getEnergy(); - final IMEMonitor cell = this.proxy.getStorage().getItemInventory(); + final IEnergySource energy = this.getProxy().getEnergy(); + final IMEMonitor cell = this.getProxy().getStorage().getItemInventory(); final ItemStack is = input.getItemStack(); input.setStackSize( is.getMaxStackSize() ); @@ -147,9 +147,9 @@ public class PartConversionMonitor extends AbstractPartMonitor newItems = adaptor.addItems( newItems ); if( newItems != null ) { - final TileEntity te = this.tile; + final TileEntity te = this.getTile(); final List list = Collections.singletonList( newItems ); - Platform.spawnDrops( player.worldObj, te.getPos().offset( this.side.getFacing() ), list ); + Platform.spawnDrops( player.worldObj, te.getPos().offset( this.getSide().getFacing() ), list ); } if( player.openContainer != null ) diff --git a/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java b/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java index 2b4b520df..3015d6ee1 100644 --- a/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java @@ -81,12 +81,12 @@ public class PartCraftingTerminal extends AbstractPartTerminal int z = (int) p.posZ; if( this.getHost().getTile() != null ) { - x = this.tile.getPos().getX(); - y = this.tile.getPos().getY(); - z = this.tile.getPos().getZ(); + x = this.getTile().getPos().getX(); + y = this.getTile().getPos().getY(); + z = this.getTile().getPos().getZ(); } - if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.side, p ) ) + if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) ) { return GuiBridge.GUI_CRAFTING_TERMINAL; } diff --git a/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java b/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java index c80c738d2..d1f900d0f 100644 --- a/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java @@ -50,7 +50,7 @@ public class PartInterfaceTerminal extends AbstractPartDisplay return true; } - Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_INTERFACE_TERMINAL ); + Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_INTERFACE_TERMINAL ); return true; } diff --git a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java index 9d78eff85..8d6ea6ec4 100644 --- a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java @@ -96,12 +96,12 @@ public class PartPatternTerminal extends AbstractPartTerminal int z = (int) p.posZ; if( this.getHost().getTile() != null ) { - x = this.tile.getPos().getX(); - y = this.tile.getPos().getY(); - z = this.tile.getPos().getZ(); + x = this.getTile().getPos().getX(); + y = this.getTile().getPos().getY(); + z = this.getTile().getPos().getZ(); } - if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.side, p ) ) + if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) ) { return GuiBridge.GUI_PATTERN_TERMINAL; } @@ -142,7 +142,7 @@ public class PartPatternTerminal extends AbstractPartTerminal this.fixCraftingRecipes(); } - this.host.markForSave(); + this.getHost().markForSave(); } private void fixCraftingRecipes() diff --git a/src/main/java/appeng/recipes/AEItemResolver.java b/src/main/java/appeng/recipes/AEItemResolver.java index 5211c8049..36a8b0d0d 100644 --- a/src/main/java/appeng/recipes/AEItemResolver.java +++ b/src/main/java/appeng/recipes/AEItemResolver.java @@ -123,9 +123,9 @@ public class AEItemResolver implements ISubItemResolver final String materialName = itemName.substring( itemName.indexOf( '.' ) + 1 ); final MaterialType mt = MaterialType.valueOf( materialName ); // itemName = itemName.substring( 0, itemName.indexOf( "." ) ); - if( mt.itemInstance == MultiItem.instance && mt.damageValue >= 0 && mt.isRegistered() ) + if( mt.getItemInstance() == MultiItem.instance && mt.getDamageValue() >= 0 && mt.isRegistered() ) { - return new ResolverResult( "ItemMultiMaterial", mt.damageValue ); + return new ResolverResult( "ItemMultiMaterial", mt.getDamageValue() ); } } diff --git a/src/main/java/appeng/recipes/GroupIngredient.java b/src/main/java/appeng/recipes/GroupIngredient.java index 49e36638b..2d6f29ee3 100644 --- a/src/main/java/appeng/recipes/GroupIngredient.java +++ b/src/main/java/appeng/recipes/GroupIngredient.java @@ -40,8 +40,7 @@ public class GroupIngredient implements IIngredient private final List ingredients; private final int qty; private ItemStack[] baked; - - boolean isInside = false; + private boolean isInside = false; public GroupIngredient( final String myName, final List ingredients, final int qty ) throws RecipeError { @@ -64,7 +63,7 @@ public class GroupIngredient implements IIngredient this.ingredients = ingredients; } - public IIngredient copy( final int qty ) throws RecipeError + IIngredient copy( final int qty ) throws RecipeError { Preconditions.checkState( qty > 0 ); return new GroupIngredient( this.name, this.ingredients, qty ); diff --git a/src/main/java/appeng/recipes/MissedIngredientSet.java b/src/main/java/appeng/recipes/MissedIngredientSet.java index 840f0a6a8..41f398e26 100644 --- a/src/main/java/appeng/recipes/MissedIngredientSet.java +++ b/src/main/java/appeng/recipes/MissedIngredientSet.java @@ -33,7 +33,7 @@ public class MissedIngredientSet extends Throwable this.resolverResultSet = ro; } - public ResolverResultSet getResolverResultSet() + ResolverResultSet getResolverResultSet() { return this.resolverResultSet; } diff --git a/src/main/java/appeng/recipes/RecipeData.java b/src/main/java/appeng/recipes/RecipeData.java index 0e64c15a6..f88cfe98d 100644 --- a/src/main/java/appeng/recipes/RecipeData.java +++ b/src/main/java/appeng/recipes/RecipeData.java @@ -32,12 +32,12 @@ import appeng.api.recipes.ICraftHandler; public class RecipeData { - public final Map aliases = new HashMap(); - public final Map groups = new HashMap(); + final Map aliases = new HashMap(); + final Map groups = new HashMap(); - public final List handlers = new LinkedList(); - public final Set knownItem = new HashSet(); - public boolean crash = true; - public boolean exceptions = true; - public boolean errorOnMissing = true; + final List handlers = new LinkedList(); + final Set knownItem = new HashSet(); + boolean crash = true; + boolean exceptions = true; + boolean errorOnMissing = true; } diff --git a/src/main/java/appeng/recipes/RecipeHandler.java b/src/main/java/appeng/recipes/RecipeHandler.java index 8c662b693..9bcaa1849 100644 --- a/src/main/java/appeng/recipes/RecipeHandler.java +++ b/src/main/java/appeng/recipes/RecipeHandler.java @@ -116,7 +116,7 @@ public class RecipeHandler implements IRecipeHandler return i.getNameSpace() + ':' + i.getItemName(); } - public String getName( final ItemStack is ) throws RecipeError + private String getName( final ItemStack is ) throws RecipeError { Preconditions.checkNotNull( is ); @@ -224,7 +224,7 @@ public class RecipeHandler implements IRecipeHandler return realName; } - public String alias( final String in ) + String alias( final String in ) { Preconditions.checkNotNull( in ); @@ -510,7 +510,7 @@ public class RecipeHandler implements IRecipeHandler } } - public List findRecipe( final ItemStack output ) + private List findRecipe( final ItemStack output ) { final List out = new LinkedList(); diff --git a/src/main/java/appeng/recipes/handlers/Crusher.java b/src/main/java/appeng/recipes/handlers/Crusher.java index 9267f9835..ab3cd6b6a 100644 --- a/src/main/java/appeng/recipes/handlers/Crusher.java +++ b/src/main/java/appeng/recipes/handlers/Crusher.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class Crusher implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/Grind.java b/src/main/java/appeng/recipes/handlers/Grind.java index 733cd8df4..4b464516e 100644 --- a/src/main/java/appeng/recipes/handlers/Grind.java +++ b/src/main/java/appeng/recipes/handlers/Grind.java @@ -35,8 +35,8 @@ import appeng.util.Platform; public class Grind implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/GrindFZ.java b/src/main/java/appeng/recipes/handlers/GrindFZ.java index 12f7ce6a3..f727f755e 100644 --- a/src/main/java/appeng/recipes/handlers/GrindFZ.java +++ b/src/main/java/appeng/recipes/handlers/GrindFZ.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class GrindFZ implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/HCCrusher.java b/src/main/java/appeng/recipes/handlers/HCCrusher.java index 6b7145434..321404c1c 100644 --- a/src/main/java/appeng/recipes/handlers/HCCrusher.java +++ b/src/main/java/appeng/recipes/handlers/HCCrusher.java @@ -37,8 +37,8 @@ import appeng.util.Platform; public class HCCrusher implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/Macerator.java b/src/main/java/appeng/recipes/handlers/Macerator.java index 9f68a15bc..6667df97e 100644 --- a/src/main/java/appeng/recipes/handlers/Macerator.java +++ b/src/main/java/appeng/recipes/handlers/Macerator.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class Macerator implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/MekCrusher.java b/src/main/java/appeng/recipes/handlers/MekCrusher.java index 2c5492efc..7b71dcf0d 100644 --- a/src/main/java/appeng/recipes/handlers/MekCrusher.java +++ b/src/main/java/appeng/recipes/handlers/MekCrusher.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class MekCrusher implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/MekEnrichment.java b/src/main/java/appeng/recipes/handlers/MekEnrichment.java index e1a2073b6..bfbaaefce 100644 --- a/src/main/java/appeng/recipes/handlers/MekEnrichment.java +++ b/src/main/java/appeng/recipes/handlers/MekEnrichment.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class MekEnrichment implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/OreRegistration.java b/src/main/java/appeng/recipes/handlers/OreRegistration.java index 3f1f9b782..239ccdc59 100644 --- a/src/main/java/appeng/recipes/handlers/OreRegistration.java +++ b/src/main/java/appeng/recipes/handlers/OreRegistration.java @@ -33,8 +33,8 @@ import appeng.api.recipes.IIngredient; public class OreRegistration implements ICraftHandler { - final List inputs; - final String name; + private final List inputs; + private final String name; public OreRegistration( final List in, final String out ) { diff --git a/src/main/java/appeng/recipes/handlers/Pulverizer.java b/src/main/java/appeng/recipes/handlers/Pulverizer.java index b2b960733..c6a4b074e 100644 --- a/src/main/java/appeng/recipes/handlers/Pulverizer.java +++ b/src/main/java/appeng/recipes/handlers/Pulverizer.java @@ -36,8 +36,8 @@ import appeng.util.Platform; public class Pulverizer implements ICraftHandler, IWebsiteSerializer { - IIngredient pro_input; - IIngredient[] pro_output; + private IIngredient pro_input; + private IIngredient[] pro_output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/Shaped.java b/src/main/java/appeng/recipes/handlers/Shaped.java index 4778d71aa..1e314e869 100644 --- a/src/main/java/appeng/recipes/handlers/Shaped.java +++ b/src/main/java/appeng/recipes/handlers/Shaped.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class Shaped implements ICraftHandler, IWebsiteSerializer { - List> inputs; - IIngredient output; + private List> inputs; + private IIngredient output; private int rows; private int cols; diff --git a/src/main/java/appeng/recipes/handlers/Shapeless.java b/src/main/java/appeng/recipes/handlers/Shapeless.java index 8d4b99f54..c0f9d96fa 100644 --- a/src/main/java/appeng/recipes/handlers/Shapeless.java +++ b/src/main/java/appeng/recipes/handlers/Shapeless.java @@ -38,8 +38,8 @@ import appeng.util.Platform; public class Shapeless implements ICraftHandler, IWebsiteSerializer { - List inputs; - IIngredient output; + private List inputs; + private IIngredient output; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/recipes/handlers/Smelt.java b/src/main/java/appeng/recipes/handlers/Smelt.java index e3451336d..f86970f16 100644 --- a/src/main/java/appeng/recipes/handlers/Smelt.java +++ b/src/main/java/appeng/recipes/handlers/Smelt.java @@ -35,8 +35,8 @@ import appeng.util.Platform; public class Smelt implements ICraftHandler, IWebsiteSerializer { - IIngredient in; - IIngredient out; + private IIngredient in; + private IIngredient out; @Override public void setup( final List> input, final List> output ) throws RecipeError diff --git a/src/main/java/appeng/server/subcommands/ChunkLogger.java b/src/main/java/appeng/server/subcommands/ChunkLogger.java index 9554603cb..f8c7208d0 100644 --- a/src/main/java/appeng/server/subcommands/ChunkLogger.java +++ b/src/main/java/appeng/server/subcommands/ChunkLogger.java @@ -34,7 +34,7 @@ import appeng.server.ISubCommand; public class ChunkLogger implements ISubCommand { - boolean enabled = false; + private boolean enabled = false; @SubscribeEvent public void onChunkLoadEvent( final ChunkEvent.Load event ) diff --git a/src/main/java/appeng/services/CompassService.java b/src/main/java/appeng/services/CompassService.java index 57deadad0..75f4246b7 100644 --- a/src/main/java/appeng/services/CompassService.java +++ b/src/main/java/appeng/services/CompassService.java @@ -89,12 +89,12 @@ public final class CompassService } } - public int jobSize() + private int jobSize() { return this.jobSize; } - public void cleanUp() + private void cleanUp() { for( final CompassReader cr : this.worldSet.values() ) { diff --git a/src/main/java/appeng/services/compass/CompassException.java b/src/main/java/appeng/services/compass/CompassException.java index 61385442c..e61c09c2d 100644 --- a/src/main/java/appeng/services/compass/CompassException.java +++ b/src/main/java/appeng/services/compass/CompassException.java @@ -24,7 +24,7 @@ public class CompassException extends RuntimeException private static final long serialVersionUID = 8825268683203860877L; - public final Throwable inner; + private final Throwable inner; public CompassException( final Throwable t ) { diff --git a/src/main/java/appeng/services/compass/CompassRegion.java b/src/main/java/appeng/services/compass/CompassRegion.java index ff47c0ef1..c22780655 100644 --- a/src/main/java/appeng/services/compass/CompassRegion.java +++ b/src/main/java/appeng/services/compass/CompassRegion.java @@ -61,7 +61,7 @@ public final class CompassRegion this.openFile( false ); } - public void close() + void close() { try { @@ -79,7 +79,7 @@ public final class CompassRegion } } - public boolean hasBeacon( int cx, int cz ) + boolean hasBeacon( int cx, int cz ) { if( this.hasFile ) { @@ -96,7 +96,7 @@ public final class CompassRegion return false; } - public void setHasBeacon( int cx, int cz, final int cdy, final boolean hasBeacon ) + void setHasBeacon( int cx, int cz, final int cdy, final boolean hasBeacon ) { cx &= 0x3FF; cz &= 0x3FF; diff --git a/src/main/java/appeng/services/export/ExportProcess.java b/src/main/java/appeng/services/export/ExportProcess.java index ab6a4cdc4..fa1623449 100644 --- a/src/main/java/appeng/services/export/ExportProcess.java +++ b/src/main/java/appeng/services/export/ExportProcess.java @@ -22,17 +22,17 @@ package appeng.services.export; import java.io.File; import java.util.List; import java.util.concurrent.TimeUnit; + import javax.annotation.Nonnull; import com.google.common.base.Preconditions; import com.google.common.base.Stopwatch; import net.minecraft.item.Item; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; -import cpw.mods.fml.common.registry.GameData; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; import appeng.core.AELog; diff --git a/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java b/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java index 0ef8b79f5..11fe7978d 100644 --- a/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java +++ b/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java @@ -27,6 +27,7 @@ import java.io.OutputStreamWriter; import java.io.Writer; import java.nio.charset.Charset; import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -43,8 +44,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; - -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import appeng.core.AELog; @@ -73,7 +73,8 @@ final class MinecraftItemCSVExporter implements Exporter /** * @param exportDirectory directory of the resulting export file. Non-null required. - * @param itemRegistry the registry with minecraft items. Needs to be populated at that time, thus the exporting can only happen in init (pre-init is the + * @param itemRegistry the registry with minecraft items. Needs to be populated at that time, thus the exporting can + * only happen in init (pre-init is the * phase when all items are determined) * @param mode mode in which the export should be operated. Resulting CSV will change depending on this. */ @@ -103,7 +104,7 @@ final class MinecraftItemCSVExporter implements Exporter { FileUtils.forceMkdir( this.exportDirectory ); - final Writer writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), Charset.forName("UTF-8") ) ); + final Writer writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), Charset.forName( "UTF-8" ) ) ); final String header = this.mode == ExportMode.MINIMAL ? MINIMAL_HEADER : VERBOSE_HEADER; writer.write( header ); @@ -186,7 +187,6 @@ final class MinecraftItemCSVExporter implements Exporter } } - /** * transforms an item into a row representation of the CSV file */ @@ -229,7 +229,7 @@ final class MinecraftItemCSVExporter implements Exporter AELog.debug( EXPORTING_SUBTYPES_MESSAGE, input.getUnlocalizedName(), input.getHasSubtypes() ); } - final String itemName = this.itemRegistry.getNameForObject( input ); + final String itemName = this.itemRegistry.getNameForObject( input ).toString(); final boolean hasSubtypes = input.getHasSubtypes(); if( hasSubtypes ) { diff --git a/src/main/java/appeng/services/export/ModListChecker.java b/src/main/java/appeng/services/export/ModListChecker.java index cf4e7f8b9..24219fe96 100644 --- a/src/main/java/appeng/services/export/ModListChecker.java +++ b/src/main/java/appeng/services/export/ModListChecker.java @@ -20,13 +20,14 @@ package appeng.services.export; import java.util.List; + import javax.annotation.Nonnull; import com.google.common.base.Preconditions; import org.apache.commons.codec.digest.DigestUtils; -import cpw.mods.fml.common.ModContainer; +import net.minecraftforge.fml.common.ModContainer; /** diff --git a/src/main/java/appeng/spatial/CachedPlane.java b/src/main/java/appeng/spatial/CachedPlane.java index 08808dc87..585b1d21c 100644 --- a/src/main/java/appeng/spatial/CachedPlane.java +++ b/src/main/java/appeng/spatial/CachedPlane.java @@ -45,23 +45,23 @@ import appeng.util.Platform; public class CachedPlane { - final int x_size; - final int z_size; - final int cx_size; - final int cz_size; - final int x_offset; - final int y_offset; - final int z_offset; - final int y_size; - final Chunk[][] myChunks; - final Column[][] myColumns; - final LinkedList tiles = new LinkedList(); - final LinkedList ticks = new LinkedList(); - final World world; - final IMovableRegistry reg = AEApi.instance().registries().movable(); - final LinkedList updates = new LinkedList(); + private final int x_size; + private final int z_size; + private final int cx_size; + private final int cz_size; + private final int x_offset; + private final int y_offset; + private final int z_offset; + private final int y_size; + private final Chunk[][] myChunks; + private final Column[][] myColumns; + private final LinkedList tiles = new LinkedList(); + private final LinkedList ticks = new LinkedList(); + private final World world; + private final IMovableRegistry reg = AEApi.instance().registries().movable(); + private final LinkedList updates = new LinkedList(); private final IBlockDefinition matrixFrame = AEApi.instance().definitions().blocks().matrixFrame(); - int verticalBits; + private int verticalBits; public CachedPlane( final World w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ ) { @@ -121,9 +121,9 @@ public class CachedPlane { final BlockPos cp = tx.getKey(); final TileEntity te = tx.getValue(); - + final BlockPos tePOS = te.getPos(); - if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ ) + if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ ) { if( mr.askToMove( te ) ) { @@ -153,15 +153,15 @@ public class CachedPlane c.getTileEntityMap().remove( cp ); } - final long k = this.world.getTotalWorldTime(); - final List list = this.world.getPendingBlockUpdates( c, false ); + final long k = this.getWorld().getTotalWorldTime(); + final List list = this.getWorld().getPendingBlockUpdates( c, false ); if( list != null ) { for( final Object o : list ) { final NextTickListEntry entry = (NextTickListEntry) o; final BlockPos tePOS = entry.position; - if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ ) + if( tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY && tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ ) { final NextTickListEntry newEntry = new NextTickListEntry( tePOS, entry.getBlock() ); newEntry.scheduledTime = entry.scheduledTime - k; @@ -176,7 +176,7 @@ public class CachedPlane { try { - this.world.loadedTileEntityList.remove( te ); + this.getWorld().loadedTileEntityList.remove( te ); } catch( final Exception e ) { @@ -300,8 +300,8 @@ public class CachedPlane { AELog.error( e ); - final BlockPos pos = new BlockPos( x,y,z); - + final BlockPos pos = new BlockPos( x, y, z ); + // attempt recovery... te.setWorldObj( this.world ); te.setPos( pos ); @@ -353,7 +353,7 @@ public class CachedPlane for( int y = 1; y < 255; y += 32 ) { - WorldData.instance().compassData().service().updateArea( this.world, c.xPosition << 4, y, c.zPosition << 4 ); + WorldData.instance().compassData().service().updateArea( this.getWorld(), c.xPosition << 4, y, c.zPosition << 4 ); } Platform.sendChunk( c, this.verticalBits ); @@ -361,7 +361,17 @@ public class CachedPlane } } - class Column + LinkedList getUpdates() + { + return this.updates; + } + + World getWorld() + { + return this.world; + } + + private class Column { private final int x; @@ -390,7 +400,7 @@ public class CachedPlane } } - public void setBlockIDWithMetadata( final int y, final Object[] blk ) + private void setBlockIDWithMetadata( final int y, final Object[] blk ) { for( final Block matrixFrameBlock : CachedPlane.this.matrixFrame.maybeBlock().asSet() ) { @@ -406,7 +416,7 @@ public class CachedPlane extendedBlockStorage.setExtBlocklightValue( this.x, y & 15, this.z, (Integer) blk[1] ); } - public Object[] getDetails( final int y ) + private Object[] getDetails( final int y ) { final ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4]; this.ch[0] = extendedblockstorage.get( this.x, y & 15, this.z ); @@ -414,7 +424,7 @@ public class CachedPlane return this.ch; } - public boolean doNotSkip( final int y ) + private boolean doNotSkip( final int y ) { final ExtendedBlockStorage extendedblockstorage = this.storage[y >> 4]; if( CachedPlane.this.reg.isBlacklisted( extendedblockstorage.getBlockByExtId( this.x, y & 15, this.z ) ) ) @@ -425,7 +435,7 @@ public class CachedPlane return this.skipThese == null || !this.skipThese.contains( y ); } - public void setSkip( final int yCoord ) + private void setSkip( final int yCoord ) { if( this.skipThese == null ) { diff --git a/src/main/java/appeng/spatial/StorageChunkProvider.java b/src/main/java/appeng/spatial/StorageChunkProvider.java index 67e0222c6..18ddc5444 100644 --- a/src/main/java/appeng/spatial/StorageChunkProvider.java +++ b/src/main/java/appeng/spatial/StorageChunkProvider.java @@ -36,7 +36,7 @@ import appeng.core.AEConfig; public class StorageChunkProvider extends ChunkProviderGenerate { - public static final int SQUARE_CHUNK_SIZE = 256; + private static final int SQUARE_CHUNK_SIZE = 256; private static final Block[] BLOCKS; static @@ -52,7 +52,7 @@ public class StorageChunkProvider extends ChunkProviderGenerate } } - final World world; + private final World world; public StorageChunkProvider( final World world, final long i ) { diff --git a/src/main/java/appeng/spatial/StorageHelper.java b/src/main/java/appeng/spatial/StorageHelper.java index f174abe93..897580582 100644 --- a/src/main/java/appeng/spatial/StorageHelper.java +++ b/src/main/java/appeng/spatial/StorageHelper.java @@ -19,7 +19,6 @@ package appeng.spatial; -import java.lang.reflect.Method; import java.util.List; import net.minecraft.block.Block; @@ -34,6 +33,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.Teleporter; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import appeng.api.AEApi; import appeng.api.util.WorldCoord; import appeng.core.stats.Achievements; @@ -44,7 +44,6 @@ public class StorageHelper { private static StorageHelper instance; - Method onEntityRemoved; public static StorageHelper getInstance() { @@ -59,11 +58,11 @@ public class StorageHelper * Mostly from dimensional doors.. which mostly got it form X-Comp. * * @param entity to be teleported entity - * @param link destination + * @param link destination * * @return teleported entity */ - public Entity teleportEntity( Entity entity, final TelDestination link ) + private Entity teleportEntity( Entity entity, final TelDestination link ) { final WorldServer oldWorld; final WorldServer newWorld; @@ -176,7 +175,7 @@ public class StorageHelper return entity; } - public void transverseEdges( final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ, final ISpatialVisitor visitor ) + private void transverseEdges( final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ, final ISpatialVisitor visitor ) { for( int y = minY; y < maxY; y++ ) { @@ -206,7 +205,9 @@ public class StorageHelper } } - public void swapRegions( final World src /** over world **/, final World dst /** storage cell **/, final int x, final int y, final int z, final int i, final int j, final int k, final int scaleX, final int scaleY, final int scaleZ ) + public void swapRegions( final World src /** over world **/ + , final World dst /** storage cell **/ + , final int x, final int y, final int z, final int i, final int j, final int k, final int scaleX, final int scaleY, final int scaleZ ) { for( final Block matrixFrameBlock : AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().asSet() ) { @@ -236,14 +237,14 @@ public class StorageHelper this.teleportEntity( e, new TelDestination( dst, dstBox, e.posX, e.posY, e.posZ, -x + i, -y + j, -z + k ) ); } - for( final WorldCoord wc : cDst.updates ) + for( final WorldCoord wc : cDst.getUpdates() ) { - cSrc.world.notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK ); + cSrc.getWorld().notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK ); } - for( final WorldCoord wc : cSrc.updates ) + for( final WorldCoord wc : cSrc.getUpdates() ) { - cSrc.world.notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK ); + cSrc.getWorld().notifyBlockOfStateChange( wc.getPos(), Platform.AIR_BLOCK ); } this.transverseEdges( x - 1, y - 1, z - 1, x + scaleX + 1, y + scaleY + 1, z + scaleZ + 1, new TriggerUpdates( src ) ); @@ -253,18 +254,18 @@ public class StorageHelper this.transverseEdges( i, j, k, i + scaleX, j + scaleY, k + scaleZ, new TriggerUpdates( dst ) ); /* - * IChunkProvider cp = destination.getChunkProvider(); if ( cp instanceof ChunkProviderServer ) { ChunkProviderServer + * IChunkProvider cp = destination.getChunkProvider(); if ( cp instanceof ChunkProviderServer ) { + * ChunkProviderServer * srv = (ChunkProviderServer) cp; srv.unloadAllChunks(); } - * * cp.unloadQueuedChunks(); */ } - static class TriggerUpdates implements ISpatialVisitor + private static class TriggerUpdates implements ISpatialVisitor { - final World dst; + private final World dst; public TriggerUpdates( final World dst2 ) { @@ -275,16 +276,15 @@ public class StorageHelper public void visit( final BlockPos pos ) { final Block blk = this.dst.getBlockState( pos ).getBlock(); - blk.onNeighborBlockChange( this.dst, pos, Platform.AIR_BLOCK.getDefaultState(), Platform.AIR_BLOCK); + blk.onNeighborBlockChange( this.dst, pos, Platform.AIR_BLOCK.getDefaultState(), Platform.AIR_BLOCK ); } } - - static class WrapInMatrixFrame implements ISpatialVisitor + private static class WrapInMatrixFrame implements ISpatialVisitor { - final World dst; - final IBlockState state; + private final World dst; + private final IBlockState state; public WrapInMatrixFrame( final IBlockState state, final World dst2 ) { @@ -299,17 +299,16 @@ public class StorageHelper } } - - static class TelDestination + private static class TelDestination { - final World dim; - final double x; - final double y; - final double z; - final int xOff; - final int yOff; - final int zOff; + private final World dim; + private final double x; + private final double y; + private final double z; + private final int xOff; + private final int yOff; + private final int zOff; TelDestination( final World dimension, final AxisAlignedBB srcBox, final double x, final double y, final double z, final int tileX, final int tileY, final int tileZ ) { @@ -323,11 +322,10 @@ public class StorageHelper } } - - static class METeleporter extends Teleporter + private static class METeleporter extends Teleporter { - final TelDestination destination; + private final TelDestination destination; public METeleporter( final WorldServer par1WorldServer, final TelDestination d ) { diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java index 6486945c3..d2cb4733b 100644 --- a/src/main/java/appeng/tile/AEBaseTile.java +++ b/src/main/java/appeng/tile/AEBaseTile.java @@ -65,12 +65,12 @@ import appeng.util.SettingsFrom; public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, ICustomNameObject { - public static final ThreadLocal> DROP_NO_ITEMS = new ThreadLocal>(); + private static final ThreadLocal> DROP_NO_ITEMS = new ThreadLocal>(); private static final Map, Map>> HANDLERS = new HashMap, Map>>(); private static final Map, IStackSrc> ITEM_STACKS = new HashMap, IStackSrc>(); private int renderFragment = 0; @Nullable - public String customName; + private String customName; private EnumFacing forward = null; private EnumFacing up = null; @@ -83,7 +83,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, { return newSate.getBlock() != oldState.getBlock(); // state dosn't change tile entities in AE2. } - + public static void registerTileItem( final Class c, final IStackSrc wat ) { ITEM_STACKS.put( c, wat ); @@ -247,7 +247,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, } } - public final boolean readFromStream( final ByteBuf data ) + private final boolean readFromStream( final ByteBuf data ) { boolean output = false; @@ -260,8 +260,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, final EnumFacing old_Up = this.up; final byte orientation = data.readByte(); - this.forward = EnumFacing.VALUES[ orientation & 0x7 ]; - this.up = EnumFacing.VALUES[ orientation >> 3 ]; + this.forward = EnumFacing.VALUES[orientation & 0x7]; + this.up = EnumFacing.VALUES[orientation >> 3]; output = this.forward != old_Forward || this.up != old_Up; } @@ -306,7 +306,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, } } - public final void writeToStream( final ByteBuf data ) + private final void writeToStream( final ByteBuf data ) { try { @@ -353,7 +353,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, final Class clazz = this.getClass(); final Map> storedHandlers = HANDLERS.get( clazz ); - if ( storedHandlers == null ) + if( storedHandlers == null ) { final Map> newStoredHandlers = new EnumMap>( TileEventType.class ); @@ -377,7 +377,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, } @Nonnull - private List getHandlers( final Map> eventToHandlers, final TileEventType event ) { + private List getHandlers( final Map> eventToHandlers, final TileEventType event ) + { final List oldHandlers = eventToHandlers.get( event ); if( oldHandlers == null ) @@ -438,7 +439,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, /** * depending on the from, different settings will be accepted, don't call this with null * - * @param from source of settings + * @param from source of settings * @param compound compound of source */ public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound ) @@ -477,10 +478,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, /** * returns the contents of the tile entity, into the world, defaults to dropping everything in the inventory. * - * @param w world - * @param x x pos of tile entity - * @param y y pos of tile entity - * @param z z pos of tile entity + * @param w world + * @param x x pos of tile entity + * @param y y pos of tile entity + * @param z z pos of tile entity * @param drops drops of tile entity */ @Override diff --git a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java index b330d0e24..a927394fe 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java @@ -40,13 +40,13 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora { @SideOnly( Side.CLIENT ) - public Integer dspList; + private Integer dspList; @SideOnly( Side.CLIENT ) - public boolean updateList; + private boolean updateList; - IAEItemStack dspPlay; - AEColor paintedColor = AEColor.Transparent; + private IAEItemStack dspPlay; + private AEColor paintedColor = AEColor.Transparent; @TileEvent( TileEventType.NETWORK_READ ) public boolean readFromStream_TileCraftingMonitorTile( final ByteBuf data ) throws IOException @@ -65,7 +65,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora this.dspPlay = null; } - this.updateList = true; + this.setUpdateList( true ); return oldPaintedColor != this.paintedColor; // tesr! } @@ -159,4 +159,24 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora this.markForUpdate(); return true; } + + public Integer getDisplayList() + { + return this.dspList; + } + + public void setDisplayList( final Integer dspList ) + { + this.dspList = dspList; + } + + public boolean isUpdateList() + { + return this.updateList; + } + + public void setUpdateList( final boolean updateList ) + { + this.updateList = updateList; + } } diff --git a/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java b/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java index 56fdbefbc..c189b39cf 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java @@ -27,7 +27,7 @@ import appeng.block.crafting.BlockCraftingUnit; public class TileCraftingStorageTile extends TileCraftingTile { - public static final int KILO_SCALAR = 1024; + private static final int KILO_SCALAR = 1024; @Override protected ItemStack getItemFromTile( final Object obj ) diff --git a/src/main/java/appeng/tile/crafting/TileCraftingTile.java b/src/main/java/appeng/tile/crafting/TileCraftingTile.java index 2f3b86aee..74c528429 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingTile.java @@ -57,17 +57,16 @@ import appeng.util.Platform; public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState { - - private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this ); - public NBTTagCompound previousState = null; - public boolean isCoreBlock = false; - CraftingCPUCluster cluster; + private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this ); + private NBTTagCompound previousState = null; + private boolean isCoreBlock = false; + private CraftingCPUCluster cluster; public TileCraftingTile() { - this.gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL ); - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); } @Override @@ -113,8 +112,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { return false; } - - final BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( this.pos ).getBlock(); + + final BlockCraftingUnit unit = (BlockCraftingUnit) this.worldObj.getBlockState( this.pos ).getBlock(); return unit.type == CraftingUnitType.ACCELERATOR; } @@ -122,7 +121,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP public void onReady() { super.onReady(); - this.gridProxy.setVisualRepresentation( this.getItemFromTile( this ) ); + this.getProxy().setVisualRepresentation( this.getItemFromTile( this ) ); this.updateMultiBlock(); } @@ -152,9 +151,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP final boolean formed = this.isFormed(); boolean power = false; - if( this.gridProxy.isReady() ) + if( this.getProxy().isReady() ) { - power = this.gridProxy.isActive(); + power = this.getProxy().isActive(); } final IBlockState current = this.worldObj.getBlockState( this.pos ); @@ -169,11 +168,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( formed ) { - this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); } else { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); } } } @@ -182,7 +181,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( Platform.isClient() ) { - return (boolean)this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED ); + return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED ); } return this.cluster != null; } @@ -190,8 +189,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_TileCraftingTile( final NBTTagCompound data ) { - data.setBoolean( "core", this.isCoreBlock ); - if( this.isCoreBlock && this.cluster != null ) + data.setBoolean( "core", this.isCoreBlock() ); + if( this.isCoreBlock() && this.cluster != null ) { this.cluster.writeToNBT( data ); } @@ -200,8 +199,8 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_TileCraftingTile( final NBTTagCompound data ) { - this.isCoreBlock = data.getBoolean( "core" ); - if( this.isCoreBlock ) + this.setCoreBlock( data.getBoolean( "core" ) ); + if( this.isCoreBlock() ) { if( this.cluster != null ) { @@ -209,7 +208,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP } else { - this.previousState = (NBTTagCompound) data.copy(); + this.setPreviousState( (NBTTagCompound) data.copy() ); } } } @@ -334,9 +333,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( Platform.isClient() ) { - return (boolean)this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED ); + return (boolean) this.worldObj.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED ); } - return this.gridProxy.isActive(); + return this.getProxy().isActive(); } @Override @@ -344,8 +343,28 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( Platform.isServer() ) { - return this.gridProxy.isActive(); + return this.getProxy().isActive(); } return this.isPowered() && this.isFormed(); } + + public boolean isCoreBlock() + { + return this.isCoreBlock; + } + + public void setCoreBlock( final boolean isCoreBlock ) + { + this.isCoreBlock = isCoreBlock; + } + + public NBTTagCompound getPreviousState() + { + return this.previousState; + } + + public void setPreviousState( final NBTTagCompound previousState ) + { + this.previousState = previousState; + } } diff --git a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java index 47023e6f2..ed43fcd89 100644 --- a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java +++ b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java @@ -100,12 +100,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade this.settings = new ConfigManager( this ); this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE ); this.inv.setMaxStackSize( 1 ); - this.gridProxy.setIdlePowerUsage( 0.0 ); + this.getProxy().setIdlePowerUsage( 0.0 ); this.upgrades = new DefinitionUpgradeInventory( assembler, this, this.getUpgradeSlots() ); this.craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 ); } - protected int getUpgradeSlots() + private int getUpgradeSlots() { return 5; } @@ -150,11 +150,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade { if( this.isAwake ) { - this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } else { - this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().sleepDevice( this.getProxy().getNode() ); } } catch( final GridAccessException e ) @@ -554,7 +554,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade { try { - return (int) ( this.gridProxy.getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax ); + return (int) ( this.getProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax ); } catch( final GridAccessException e ) { @@ -630,7 +630,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade try { - newState = this.gridProxy.isActive() && this.gridProxy.getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001; + newState = this.getProxy().isActive() && this.getProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001; } catch( final GridAccessException ignored ) { @@ -655,4 +655,5 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade { return this.isPowered; } + } diff --git a/src/main/java/appeng/tile/grid/AENetworkInvTile.java b/src/main/java/appeng/tile/grid/AENetworkInvTile.java index 7d2119600..650c01be7 100644 --- a/src/main/java/appeng/tile/grid/AENetworkInvTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkInvTile.java @@ -33,24 +33,24 @@ import appeng.tile.events.TileEventType; public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionHost, IGridProxyable { - protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true ); + private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true ); @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_AENetwork( final NBTTagCompound data ) { - this.gridProxy.readFromNBT( data ); + this.getProxy().readFromNBT( data ); } @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_AENetwork( final NBTTagCompound data ) { - this.gridProxy.writeToNBT( data ); + this.getProxy().writeToNBT( data ); } @Override public AENetworkProxy getProxy() { - return this.gridProxy; + return this.getProxy(); } @Override @@ -62,54 +62,54 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH @Override public IGridNode getGridNode( final AEPartLocation dir ) { - return this.gridProxy.getNode(); + return this.getProxy().getNode(); } @Override public void onChunkUnload() { super.onChunkUnload(); - this.gridProxy.onChunkUnload(); + this.getProxy().onChunkUnload(); } @Override public void onReady() { super.onReady(); - this.gridProxy.onReady(); + this.getProxy().onReady(); } @Override public void invalidate() { super.invalidate(); - this.gridProxy.invalidate(); + this.getProxy().invalidate(); } @Override public void validate() { super.validate(); - this.gridProxy.validate(); + this.getProxy().validate(); } @Override public IGridNode getActionableNode() { - return this.gridProxy.getNode(); + return this.getProxy().getNode(); } - + @Override public int getField( final int id ) { return 0; } - + @Override public int getFieldCount() { return 0; } - + } diff --git a/src/main/java/appeng/tile/grid/AENetworkPowerTile.java b/src/main/java/appeng/tile/grid/AENetworkPowerTile.java index d805f190e..f8101fefe 100644 --- a/src/main/java/appeng/tile/grid/AENetworkPowerTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkPowerTile.java @@ -35,18 +35,18 @@ import appeng.tile.powersink.AEBasePoweredTile; public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IActionHost, IGridProxyable { - protected final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true ); + private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true ); @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_AENetwork( final NBTTagCompound data ) { - this.gridProxy.readFromNBT( data ); + this.getProxy().readFromNBT( data ); } @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_AENetwork( final NBTTagCompound data ) { - this.gridProxy.writeToNBT( data ); + this.getProxy().writeToNBT( data ); } @Override @@ -70,7 +70,7 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA @Override public IGridNode getGridNode( final AEPartLocation dir ) { - return this.gridProxy.getNode(); + return this.getProxy().getNode(); } @Override @@ -83,33 +83,34 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA public void validate() { super.validate(); - this.gridProxy.validate(); + this.getProxy().validate(); } @Override public void invalidate() { super.invalidate(); - this.gridProxy.invalidate(); + this.getProxy().invalidate(); } @Override public void onChunkUnload() { super.onChunkUnload(); - this.gridProxy.onChunkUnload(); + this.getProxy().onChunkUnload(); } @Override public void onReady() { super.onReady(); - this.gridProxy.onReady(); + this.getProxy().onReady(); } @Override public IGridNode getActionableNode() { - return this.gridProxy.getNode(); + return this.getProxy().getNode(); } + } diff --git a/src/main/java/appeng/tile/grid/AENetworkTile.java b/src/main/java/appeng/tile/grid/AENetworkTile.java index 0e2cd911b..d1c23149c 100644 --- a/src/main/java/appeng/tile/grid/AENetworkTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkTile.java @@ -35,18 +35,18 @@ import appeng.tile.events.TileEventType; public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxyable { - protected final AENetworkProxy gridProxy = this.createProxy(); + private final AENetworkProxy gridProxy = this.createProxy(); @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_AENetwork( final NBTTagCompound data ) { - this.gridProxy.readFromNBT( data ); + this.getProxy().readFromNBT( data ); } @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_AENetwork( final NBTTagCompound data ) { - this.gridProxy.writeToNBT( data ); + this.getProxy().writeToNBT( data ); } protected AENetworkProxy createProxy() @@ -57,7 +57,7 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy @Override public IGridNode getGridNode( final AEPartLocation dir ) { - return this.gridProxy.getNode(); + return this.getProxy().getNode(); } @Override @@ -70,28 +70,28 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy public void onChunkUnload() { super.onChunkUnload(); - this.gridProxy.onChunkUnload(); + this.getProxy().onChunkUnload(); } @Override public void onReady() { super.onReady(); - this.gridProxy.onReady(); + this.getProxy().onReady(); } @Override public void invalidate() { super.invalidate(); - this.gridProxy.invalidate(); + this.getProxy().invalidate(); } @Override public void validate() { super.validate(); - this.gridProxy.validate(); + this.getProxy().validate(); } @Override @@ -115,6 +115,6 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy @Override public IGridNode getActionableNode() { - return this.gridProxy.getNode(); + return this.getProxy().getNode(); } } diff --git a/src/main/java/appeng/tile/grindstone/TileCrank.java b/src/main/java/appeng/tile/grindstone/TileCrank.java index 793b02830..12e6ebbdf 100644 --- a/src/main/java/appeng/tile/grindstone/TileCrank.java +++ b/src/main/java/appeng/tile/grindstone/TileCrank.java @@ -43,21 +43,21 @@ import appeng.util.Platform; public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePlayerListBox { - final int ticksPerRotation = 18; + private final int ticksPerRotation = 18; // sided values.. - public float visibleRotation = 0; - public int charge = 0; + private float visibleRotation = 0; + private int charge = 0; - public int hits = 0; - public int rotation = 0; + private int hits = 0; + private int rotation = 0; @TileEvent( TileEventType.TICK ) public void Tick_TileCrank() { if( this.rotation > 0 ) { - this.visibleRotation -= 360 / ( this.ticksPerRotation ); + this.setVisibleRotation( this.getVisibleRotation() - 360 / ( this.ticksPerRotation ) ); this.charge++; if( this.charge >= this.ticksPerRotation ) { @@ -73,7 +73,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl } } - public ICrankable getGrinder() + private ICrankable getGrinder() { if( Platform.isClient() ) { @@ -179,4 +179,14 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePl out.add( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh xOff + 0.85, yOff + 0.85, zOff + 0.85 ) ); } + + public float getVisibleRotation() + { + return this.visibleRotation; + } + + private void setVisibleRotation( final float visibleRotation ) + { + this.visibleRotation = visibleRotation; + } } diff --git a/src/main/java/appeng/tile/grindstone/TileGrinder.java b/src/main/java/appeng/tile/grindstone/TileGrinder.java index c3aeeb891..4aca5e829 100644 --- a/src/main/java/appeng/tile/grindstone/TileGrinder.java +++ b/src/main/java/appeng/tile/grindstone/TileGrinder.java @@ -40,10 +40,10 @@ import appeng.util.inv.WrapperInventoryRange; public class TileGrinder extends AEBaseInvTile implements ICrankable { - final int[] inputs = { 0, 1, 2 }; - final int[] sides = { 0, 1, 2, 3, 4, 5 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 ); - int points; + private final int[] inputs = { 0, 1, 2 }; + private final int[] sides = { 0, 1, 2, 3, 4, 5 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 7 ); + private int points; @Override public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) diff --git a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java index 5f445df8d..a87701ec7 100644 --- a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java @@ -38,10 +38,10 @@ import appeng.util.iterators.InvIterator; public class AppEngInternalAEInventory implements IInventory, Iterable { - protected final IAEAppEngInventory te; - protected final IAEItemStack[] inv; - final int size; - int maxStack; + private final IAEAppEngInventory te; + private final IAEItemStack[] inv; + private final int size; + private int maxStack; public AppEngInternalAEInventory( final IAEAppEngInventory te, final int s ) { @@ -80,7 +80,7 @@ public class AppEngInternalAEInventory implements IInventory, Iterable { - protected final int size; - protected final ItemStack[] inv; - public boolean enableClientEvents = false; - protected IAEAppEngInventory te; - protected int maxStack; + private final int size; + private final ItemStack[] inv; + private boolean enableClientEvents = false; + private IAEAppEngInventory te; + private int maxStack; public AppEngInternalInventory( final IAEAppEngInventory inventory, final int size ) { - this.te = inventory; + this.setTileEntity( inventory ); this.size = size; this.maxStack = 64; this.inv = new ItemStack[size]; @@ -96,9 +96,9 @@ public class AppEngInternalInventory implements IInventory, Iterable ns = split.splitStack( qty ); } - if( this.te != null && this.eventsEnabled() ) + if( this.getTileEntity() != null && this.eventsEnabled() ) { - this.te.onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null ); + this.getTileEntity().onChangeInventory( this, slot, InvOperation.decreaseStackSize, ns, null ); } this.markDirty(); @@ -110,7 +110,7 @@ public class AppEngInternalInventory implements IInventory, Iterable protected boolean eventsEnabled() { - return Platform.isServer() || this.enableClientEvents; + return Platform.isServer() || this.isEnableClientEvents(); } @Override @@ -125,7 +125,7 @@ public class AppEngInternalInventory implements IInventory, Iterable final ItemStack oldStack = this.inv[slot]; this.inv[slot] = newItemStack; - if( this.te != null && this.eventsEnabled() ) + if( this.getTileEntity() != null && this.eventsEnabled() ) { ItemStack removed = oldStack; ItemStack added = newItemStack; @@ -150,7 +150,7 @@ public class AppEngInternalInventory implements IInventory, Iterable } } - this.te.onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added ); + this.getTileEntity().onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added ); this.markDirty(); } @@ -177,9 +177,9 @@ public class AppEngInternalInventory implements IInventory, Iterable @Override public void markDirty() { - if( this.te != null && this.eventsEnabled() ) + if( this.getTileEntity() != null && this.eventsEnabled() ) { - this.te.onChangeInventory( this, -1, InvOperation.markDirty, null, null ); + this.getTileEntity().onChangeInventory( this, -1, InvOperation.markDirty, null, null ); } } @@ -203,9 +203,9 @@ public class AppEngInternalInventory implements IInventory, Iterable // for guis... public void markDirty( final int slotIndex ) { - if( this.te != null && this.eventsEnabled() ) + if( this.getTileEntity() != null && this.eventsEnabled() ) { - this.te.onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null ); + this.getTileEntity().onChangeInventory( this, slotIndex, InvOperation.markDirty, null, null ); } } @@ -216,7 +216,7 @@ public class AppEngInternalInventory implements IInventory, Iterable data.setTag( name, c ); } - public void writeToNBT( final NBTTagCompound target ) + private void writeToNBT( final NBTTagCompound target ) { for( int x = 0; x < this.size; x++ ) { @@ -282,14 +282,14 @@ public class AppEngInternalInventory implements IInventory, Iterable public void openInventory( final EntityPlayer player ) { - + } @Override public void closeInventory( final EntityPlayer player ) { - + } @Override @@ -303,7 +303,7 @@ public class AppEngInternalInventory implements IInventory, Iterable public void setField( final int id, final int value ) - { + { } @Override @@ -317,7 +317,27 @@ public class AppEngInternalInventory implements IInventory, Iterable { for( int x = 0; x < this.size; x++ ) { - this.setInventorySlotContents( x,null ); + this.setInventorySlotContents( x, null ); } } + + private boolean isEnableClientEvents() + { + return this.enableClientEvents; + } + + public void setEnableClientEvents( final boolean enableClientEvents ) + { + this.enableClientEvents = enableClientEvents; + } + + private IAEAppEngInventory getTileEntity() + { + return this.te; + } + + public void setTileEntity( final IAEAppEngInventory te ) + { + this.te = te; + } } diff --git a/src/main/java/appeng/tile/misc/TileCellWorkbench.java b/src/main/java/appeng/tile/misc/TileCellWorkbench.java index 05331d9b3..3b12be89f 100644 --- a/src/main/java/appeng/tile/misc/TileCellWorkbench.java +++ b/src/main/java/appeng/tile/misc/TileCellWorkbench.java @@ -46,18 +46,18 @@ import appeng.util.IConfigManagerHost; public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, IAEAppEngInventory, IConfigManagerHost { - final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 ); - final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 ); - final ConfigManager manager = new ConfigManager( this ); + private final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 ); + private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 ); + private final ConfigManager manager = new ConfigManager( this ); - IInventory cacheUpgrades = null; - IInventory cacheConfig = null; + private IInventory cacheUpgrades = null; + private IInventory cacheConfig = null; private boolean locked = false; public TileCellWorkbench() { this.manager.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE ); - this.cell.enableClientEvents = true; + this.cell.setEnableClientEvents( true ); } public IInventory getCellUpgradeInventory() diff --git a/src/main/java/appeng/tile/misc/TileCharger.java b/src/main/java/appeng/tile/misc/TileCharger.java index ac4f8c019..02d44ba33 100644 --- a/src/main/java/appeng/tile/misc/TileCharger.java +++ b/src/main/java/appeng/tile/misc/TileCharger.java @@ -56,19 +56,19 @@ import appeng.util.item.AEItemStack; public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpdatePlayerListBox { - final int[] sides = { 0 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 ); - int tickTickTimer = 0; + private final int[] sides = { 0 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 ); + private int tickTickTimer = 0; - int lastUpdate = 0; - boolean requiresUpdate = false; + private int lastUpdate = 0; + private boolean requiresUpdate = false; public TileCharger() { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); - this.gridProxy.setFlags(); - this.internalMaxPower = 1500; - this.gridProxy.setIdlePowerUsage( 0 ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setFlags(); + this.setInternalMaxPower( 1500 ); + this.getProxy().setIdlePowerUsage( 0 ); } @Override @@ -124,11 +124,11 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda final ItemStack myItem = this.getStackInSlot( 0 ); // charge from the network! - if( this.internalCurrentPower < 1499 ) + if( this.getInternalCurrentPower() < 1499 ) { try { - this.injectExternalPower( PowerUnits.AE, this.gridProxy.getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.internalCurrentPower ), Actionable.MODULATE, PowerMultiplier.ONE ) ); + this.injectExternalPower( PowerUnits.AE, this.getProxy().getEnergy().extractAEPower( Math.min( 150.0, 1500.0 - this.getInternalCurrentPower() ), Actionable.MODULATE, PowerMultiplier.ONE ) ); this.tickTickTimer = 20; // keep ticking... } catch( final GridAccessException e ) @@ -144,27 +144,27 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda final IMaterials materials = AEApi.instance().definitions().materials(); - if( this.internalCurrentPower > 149 && Platform.isChargeable( myItem ) ) + if( this.getInternalCurrentPower() > 149 && Platform.isChargeable( myItem ) ) { final IAEItemPowerStorage ps = (IAEItemPowerStorage) myItem.getItem(); if( ps.getAEMaxPower( myItem ) > ps.getAECurrentPower( myItem ) ) { - final double oldPower = this.internalCurrentPower; + final double oldPower = this.getInternalCurrentPower(); final double adjustment = ps.injectAEPower( myItem, this.extractAEPower( 150.0, Actionable.MODULATE, PowerMultiplier.CONFIG ) ); - this.internalCurrentPower += adjustment; - if( oldPower > this.internalCurrentPower ) + this.setInternalCurrentPower( this.getInternalCurrentPower() + adjustment ); + if( oldPower > this.getInternalCurrentPower() ) { this.requiresUpdate = true; } this.tickTickTimer = 20; // keep ticking... } } - else if( this.internalCurrentPower > 1499 && materials.certusQuartzCrystal().isSameAs( myItem ) ) + else if( this.getInternalCurrentPower() > 1499 && materials.certusQuartzCrystal().isSameAs( myItem ) ) { if( Platform.getRandomFloat() > 0.8f ) // simulate wait { - this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500 + this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500 for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() ) { @@ -178,7 +178,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) { super.setOrientation( inForward, inUp ); - this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); + this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); this.setPowerSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); } @@ -191,7 +191,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda @Override public boolean canTurn() { - return this.internalCurrentPower < this.internalMaxPower; + return this.getInternalCurrentPower() < this.getInternalMaxPower(); } @Override @@ -200,13 +200,13 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpda this.injectExternalPower( PowerUnits.AE, 150 ); final ItemStack myItem = this.getStackInSlot( 0 ); - if( this.internalCurrentPower > 1499 ) + if( this.getInternalCurrentPower() > 1499 ) { final IMaterials materials = AEApi.instance().definitions().materials(); if( materials.certusQuartzCrystal().isSameAs( myItem ) ) { - this.extractAEPower( this.internalMaxPower, Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500 + this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500 for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() ) { diff --git a/src/main/java/appeng/tile/misc/TileCondenser.java b/src/main/java/appeng/tile/misc/TileCondenser.java index a11c1431c..bab9afd59 100644 --- a/src/main/java/appeng/tile/misc/TileCondenser.java +++ b/src/main/java/appeng/tile/misc/TileCondenser.java @@ -48,11 +48,11 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf { private static final FluidTankInfo[] EMPTY = { new FluidTankInfo( null, 10 ) }; - final int[] sides = { 0, 1 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 ); - final ConfigManager cm = new ConfigManager( this ); + private final int[] sides = { 0, 1 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 3 ); + private final ConfigManager cm = new ConfigManager( this ); - public double storedPower = 0; + private double storedPower = 0; public TileCondenser() { @@ -63,14 +63,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf public void writeToNBT_TileCondenser( final NBTTagCompound data ) { this.cm.writeToNBT( data ); - data.setDouble( "storedPower", this.storedPower ); + data.setDouble( "storedPower", this.getStoredPower() ); } @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_TileCondenser( final NBTTagCompound data ) { this.cm.readFromNBT( data ); - this.storedPower = data.getDouble( "storedPower" ); + this.setStoredPower( data.getDouble( "storedPower" ) ); } public double getStorage() @@ -92,16 +92,16 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf public void addPower( final double rawPower ) { - this.storedPower += rawPower; - this.storedPower = Math.max( 0.0, Math.min( this.getStorage(), this.storedPower ) ); + this.setStoredPower( this.getStoredPower() + rawPower ); + this.setStoredPower( Math.max( 0.0, Math.min( this.getStorage(), this.getStoredPower() ) ) ); final double requiredPower = this.getRequiredPower(); final ItemStack output = this.getOutput(); - while( requiredPower <= this.storedPower && output != null && requiredPower > 0 ) + while( requiredPower <= this.getStoredPower() && output != null && requiredPower > 0 ) { if( this.canAddOutput( output ) ) { - this.storedPower -= requiredPower; + this.setStoredPower( this.getStoredPower() - requiredPower ); this.addOutput( output ); } else @@ -277,4 +277,14 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf { return this.cm; } + + public double getStoredPower() + { + return this.storedPower; + } + + private void setStoredPower( final double storedPower ) + { + this.storedPower = storedPower; + } } diff --git a/src/main/java/appeng/tile/misc/TileInscriber.java b/src/main/java/appeng/tile/misc/TileInscriber.java index e0b735313..72e0fb229 100644 --- a/src/main/java/appeng/tile/misc/TileInscriber.java +++ b/src/main/java/appeng/tile/misc/TileInscriber.java @@ -81,32 +81,32 @@ import com.google.common.collect.Lists; public class TileInscriber extends AENetworkPowerTile implements IGridTickable, IUpgradeableHost, IConfigManagerHost { - public final int maxProcessingTime = 100; - final int[] top = { 0 }; - final int[] bottom = { 1 }; - final int[] sides = { 2, 3 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 ); + private final int maxProcessingTime = 100; + private final int[] top = { 0 }; + private final int[] bottom = { 1 }; + private final int[] sides = { 2, 3 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 4 ); private final IConfigManager settings; private final UpgradeInventory upgrades; - public int processingTime = 0; + private int processingTime = 0; // cycles from 0 - 16, at 8 it preforms the action, at 16 it re-enables the normal routine. - public boolean smash; - public int finalStep; - public long clientStart; + private boolean smash; + private int finalStep; + private long clientStart; @Reflected public TileInscriber() { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); - this.internalMaxPower = 1500; - this.gridProxy.setIdlePowerUsage( 0 ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.setInternalMaxPower( 1500 ); + this.getProxy().setIdlePowerUsage( 0 ); this.settings = new ConfigManager( this ); final ITileDefinition inscriberDefinition = AEApi.instance().definitions().blocks().inscriber(); this.upgrades = new DefinitionUpgradeInventory( inscriberDefinition, this, this.getUpgradeSlots() ); } - protected int getUpgradeSlots() + private int getUpgradeSlots() { return 3; } @@ -138,13 +138,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, { final int slot = data.readByte(); - final boolean oldSmash = this.smash; + final boolean oldSmash = this.isSmash(); final boolean newSmash = ( slot & 64 ) == 64; if( oldSmash != newSmash && newSmash ) { - this.smash = true; - this.clientStart = System.currentTimeMillis(); + this.setSmash( true ); + this.setClientStart( System.currentTimeMillis() ); } for( int num = 0; num < this.inv.getSizeInventory(); num++ ) @@ -165,7 +165,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToStream_TileInscriber( final ByteBuf data ) throws IOException { - int slot = this.smash ? 64 : 0; + int slot = this.isSmash() ? 64 : 0; for( int num = 0; num < this.inv.getSizeInventory(); num++ ) { @@ -190,7 +190,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) { super.setOrientation( inForward, inUp ); - this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) ); + this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) ); this.setPowerSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) ); } @@ -233,7 +233,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, @Override public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) { - if( this.smash ) + if( this.isSmash() ) { return false; } @@ -266,15 +266,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, { if( slot != 3 ) { - this.processingTime = 0; + this.setProcessingTime( 0 ); } - if( !this.smash ) + if( !this.isSmash() ) { this.markForUpdate(); } - this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } } catch( final GridAccessException e ) @@ -286,7 +286,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, @Override public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side ) { - if( this.smash ) + if( this.isSmash() ) { return false; } @@ -313,7 +313,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.Inscriber.min, TickRates.Inscriber.max, !this.hasWork(), false ); + return new TickingRequest( TickRates.Inscriber.getMin(), TickRates.Inscriber.getMax(), !this.hasWork(), false ); } private boolean hasWork() @@ -323,8 +323,8 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, return true; } - this.processingTime = 0; - return this.smash; + this.setProcessingTime( 0 ); + return this.isSmash(); } @Nullable @@ -402,10 +402,10 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, { final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orNull() ) ) && // and... - ( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orNull() ) ); + ( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orNull() ) ); final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orNull() ) ) && // and... - ( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orNull() ) ); + ( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orNull() ) ); if( matchA || matchB ) { @@ -424,7 +424,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, @Override public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall ) { - if( this.smash ) + if( this.isSmash() ) { this.finalStep++; if( this.finalStep == 8 ) @@ -437,7 +437,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, if( ad.addItems( outputCopy ) == null ) { - this.processingTime = 0; + this.setProcessingTime( 0 ); if( out.getProcessType() == InscriberProcessType.Press ) { this.setInventorySlotContents( 0, null ); @@ -452,7 +452,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, else if( this.finalStep == 16 ) { this.finalStep = 0; - this.smash = false; + this.setSmash( false ); this.markForUpdate(); } } @@ -460,7 +460,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, { try { - final IEnergyGrid eg = this.gridProxy.getEnergy(); + final IEnergyGrid eg = this.getProxy().getEnergy(); IEnergySource src = this; // Base 1, increase by 1 for each card @@ -479,13 +479,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, { src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG ); - if( this.processingTime == 0 ) + if( this.getProcessingTime() == 0 ) { - this.processingTime += speedFactor; + this.setProcessingTime( this.getProcessingTime() + speedFactor ); } else { - this.processingTime += ticksSinceLastCall * speedFactor; + this.setProcessingTime( this.getProcessingTime() + ticksSinceLastCall * speedFactor ); } } } @@ -494,9 +494,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, // :P } - if( this.processingTime > this.maxProcessingTime ) + if( this.getProcessingTime() > this.getMaxProcessingTime() ) { - this.processingTime = this.maxProcessingTime; + this.setProcessingTime( this.getMaxProcessingTime() ); final IInscriberRecipe out = this.getTask(); if( out != null ) { @@ -504,7 +504,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), EnumFacing.UP ); if( ad.simulateAdd( outputCopy ) == null ) { - this.smash = true; + this.setSmash( true ); this.finalStep = 0; this.markForUpdate(); } @@ -547,4 +547,39 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue ) { } + + public long getClientStart() + { + return this.clientStart; + } + + private void setClientStart( final long clientStart ) + { + this.clientStart = clientStart; + } + + public boolean isSmash() + { + return this.smash; + } + + public void setSmash( final boolean smash ) + { + this.smash = smash; + } + + public int getMaxProcessingTime() + { + return this.maxProcessingTime; + } + + public int getProcessingTime() + { + return this.processingTime; + } + + private void setProcessingTime( final int processingTime ) + { + this.processingTime = processingTime; + } } diff --git a/src/main/java/appeng/tile/misc/TileInterface.java b/src/main/java/appeng/tile/misc/TileInterface.java index cdbf01b97..e6a243f2b 100644 --- a/src/main/java/appeng/tile/misc/TileInterface.java +++ b/src/main/java/appeng/tile/misc/TileInterface.java @@ -68,8 +68,8 @@ import com.google.common.collect.ImmutableSet; public class TileInterface extends AENetworkInvTile implements IGridTickable, ITileStorageMonitorable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, IPriorityHost { - final DualityInterface duality = new DualityInterface( this.gridProxy, this ); - AEPartLocation pointAt = AEPartLocation.INTERNAL; + private final DualityInterface duality = new DualityInterface( this.getProxy(), this ); + private AEPartLocation pointAt = AEPartLocation.INTERNAL; @MENetworkEventSubscribe public void stateChange( final MENetworkChannelsChanged c ) @@ -123,10 +123,10 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT private void configureNodeSides() { - if ( this.pointAt == AEPartLocation.INTERNAL ) - this.gridProxy.setValidSides( EnumSet.allOf(EnumFacing.class) ); + if( this.pointAt == AEPartLocation.INTERNAL ) + this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); else - this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) ); + this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) ); } @Override @@ -154,6 +154,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT public void onReady() { this.configureNodeSides(); + super.onReady(); this.duality.initialize(); } diff --git a/src/main/java/appeng/tile/misc/TileLightDetector.java b/src/main/java/appeng/tile/misc/TileLightDetector.java index 37f55e029..89e12454c 100644 --- a/src/main/java/appeng/tile/misc/TileLightDetector.java +++ b/src/main/java/appeng/tile/misc/TileLightDetector.java @@ -29,8 +29,8 @@ import appeng.util.Platform; public class TileLightDetector extends AEBaseTile implements IUpdatePlayerListBox { - int lastCheck = 30; - int lastLight = 0; + private int lastCheck = 30; + private int lastLight = 0; public boolean isReady() { diff --git a/src/main/java/appeng/tile/misc/TilePaint.java b/src/main/java/appeng/tile/misc/TilePaint.java index dc65f6d7f..44d6697dc 100644 --- a/src/main/java/appeng/tile/misc/TilePaint.java +++ b/src/main/java/appeng/tile/misc/TilePaint.java @@ -47,10 +47,10 @@ import com.google.common.collect.ImmutableList; public class TilePaint extends AEBaseTile { - static final int LIGHT_PER_DOT = 12; + private static final int LIGHT_PER_DOT = 12; - int isLit = 0; - List dots = null; + private int isLit = 0; + private List dots = null; @Override public boolean canBeRotated() @@ -69,7 +69,7 @@ public class TilePaint extends AEBaseTile } } - void writeBuffer( final ByteBuf out ) + private void writeBuffer( final ByteBuf out ) { if( this.dots == null ) { @@ -94,7 +94,7 @@ public class TilePaint extends AEBaseTile } } - void readBuffer( final ByteBuf in ) + private void readBuffer( final ByteBuf in ) { final byte howMany = in.readByte(); @@ -114,7 +114,7 @@ public class TilePaint extends AEBaseTile this.isLit = 0; for( final Splotch s : this.dots ) { - if( s.lumen ) + if( s.isLumen() ) { this.isLit += LIGHT_PER_DOT; } @@ -180,7 +180,7 @@ public class TilePaint extends AEBaseTile while( i.hasNext() ) { final Splotch s = i.next(); - if( s.side == side ) + if( s.getSide() == side ) { i.remove(); } @@ -195,7 +195,7 @@ public class TilePaint extends AEBaseTile this.isLit = 0; for( final Splotch s : this.dots ) { - if( s.lumen ) + if( s.isLumen() ) { this.isLit += LIGHT_PER_DOT; } diff --git a/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java b/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java index 4a960cb5a..e898aa662 100644 --- a/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java +++ b/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java @@ -40,13 +40,13 @@ import appeng.util.Platform; public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState, ICrystalGrowthAccelerator { - public boolean hasPower = false; + private boolean hasPower = false; public TileQuartzGrowthAccelerator() { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); - this.gridProxy.setFlags(); - this.gridProxy.setIdlePowerUsage( 8 ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setFlags(); + this.getProxy().setIdlePowerUsage( 8 ); } @MENetworkEventSubscribe @@ -64,9 +64,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower @TileEvent( TileEventType.NETWORK_READ ) public boolean readFromStream_TileQuartzGrowthAccelerator( final ByteBuf data ) { - final boolean hadPower = this.hasPower; - this.hasPower = data.readBoolean(); - return this.hasPower != hadPower; + final boolean hadPower = this.isPowered(); + this.setPowered( data.readBoolean() ); + return this.isPowered() != hadPower; } @TileEvent( TileEventType.NETWORK_WRITE ) @@ -74,7 +74,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower { try { - data.writeBoolean( this.gridProxy.getEnergy().isNetworkPowered() ); + data.writeBoolean( this.getProxy().getEnergy().isNetworkPowered() ); } catch( final GridAccessException e ) { @@ -86,7 +86,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) { super.setOrientation( inForward, inUp ); - this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); + this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); } @Override @@ -96,7 +96,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower { try { - return this.gridProxy.getEnergy().isNetworkPowered(); + return this.getProxy().getEnergy().isNetworkPowered(); } catch( final GridAccessException e ) { @@ -112,4 +112,9 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower { return this.isPowered(); } + + private void setPowered( final boolean hasPower ) + { + this.hasPower = hasPower; + } } diff --git a/src/main/java/appeng/tile/misc/TileSecurity.java b/src/main/java/appeng/tile/misc/TileSecurity.java index 805265b69..a43aac63a 100644 --- a/src/main/java/appeng/tile/misc/TileSecurity.java +++ b/src/main/java/appeng/tile/misc/TileSecurity.java @@ -83,18 +83,18 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp { private static int difference = 0; - public final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 ); + private final AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 ); private final IConfigManager cm = new ConfigManager( this ); private final SecurityInventory inventory = new SecurityInventory( this ); private final MEMonitorHandler securityMonitor = new MEMonitorHandler( this.inventory ); - public long securityKey; - AEColor paintedColor = AEColor.Transparent; + private long securityKey; + private AEColor paintedColor = AEColor.Transparent; private boolean isActive = false; public TileSecurity() { - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); - this.gridProxy.setIdlePowerUsage( 2.0 ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setIdlePowerUsage( 2.0 ); difference++; this.securityKey = System.currentTimeMillis() * 10 + difference; @@ -120,12 +120,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp final BlockPos pos, final List drops ) { - if( !this.configSlot.isEmpty() ) + if( !this.getConfigSlot().isEmpty() ) { - drops.add( this.configSlot.getStackInSlot( 0 ) ); + drops.add( this.getConfigSlot().getStackInSlot( 0 ) ); } - for( final IAEItemStack ais : this.inventory.storedItems ) + for( final IAEItemStack ais : this.inventory.getStoredItems() ) { drops.add( ais.getItemStack() ); } @@ -151,7 +151,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToStream_TileSecurity( final ByteBuf data ) { - data.writeBoolean( this.gridProxy.isActive() ); + data.writeBoolean( this.getProxy().isActive() ); data.writeByte( this.paintedColor.ordinal() ); } @@ -162,12 +162,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() ); data.setLong( "securityKey", this.securityKey ); - this.configSlot.writeToNBT( data, "config" ); + this.getConfigSlot().writeToNBT( data, "config" ); final NBTTagCompound storedItems = new NBTTagCompound(); int offset = 0; - for( final IAEItemStack ais : this.inventory.storedItems ) + for( final IAEItemStack ais : this.inventory.getStoredItems() ) { final NBTTagCompound it = new NBTTagCompound(); ais.getItemStack().writeToNBT( it ); @@ -188,7 +188,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp } this.securityKey = data.getLong( "securityKey" ); - this.configSlot.readFromNBT( data, "config" ); + this.getConfigSlot().readFromNBT( data, "config" ); final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" ); for( final Object key : storedItems.getKeySet() ) @@ -196,7 +196,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp final NBTBase obj = storedItems.getTag( (String) key ); if( obj instanceof NBTTagCompound ) { - this.inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) ); + this.inventory.getStoredItems().add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) ); } } } @@ -206,7 +206,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp try { this.saveChanges(); - this.gridProxy.getGrid().postEvent( new MENetworkSecurityChange() ); + this.getProxy().getGrid().postEvent( new MENetworkSecurityChange() ); } catch( final GridAccessException e ) { @@ -290,7 +290,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp public boolean isPowered() { - return this.gridProxy.isActive(); + return this.getProxy().isActive(); } @Override @@ -317,7 +317,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp final IPlayerRegistry pr = AEApi.instance().registries().players(); // read permissions - for( final IAEItemStack ais : this.inventory.storedItems ) + for( final IAEItemStack ais : this.inventory.getStoredItems() ) { final ItemStack is = ais.getItemStack(); final Item i = is.getItem(); @@ -329,19 +329,19 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp } // make sure thea admin is Boss. - playerPerms.put( this.gridProxy.getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) ); + playerPerms.put( this.getProxy().getNode().getPlayerID(), EnumSet.allOf( SecurityPermissions.class ) ); } @Override public boolean isSecurityEnabled() { - return this.isActive && this.gridProxy.isActive(); + return this.isActive && this.getProxy().isActive(); } @Override public int getOwner() { - return this.gridProxy.getNode().getPlayerID(); + return this.getProxy().getNode().getPlayerID(); } @Override @@ -363,4 +363,9 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp this.markForUpdate(); return true; } + + public AppEngInternalInventory getConfigSlot() + { + return this.configSlot; + } } diff --git a/src/main/java/appeng/tile/misc/TileVibrationChamber.java b/src/main/java/appeng/tile/misc/TileVibrationChamber.java index 3b570bda8..743f4a4ad 100644 --- a/src/main/java/appeng/tile/misc/TileVibrationChamber.java +++ b/src/main/java/appeng/tile/misc/TileVibrationChamber.java @@ -57,17 +57,17 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka private static final int MIN_BURN_SPEED = 20; private final IInventory inv = new AppEngInternalInventory( this, 1 ); - public int burnSpeed = 100; - public double burnTime = 0; - public double maxBurnTime = 0; + private int burnSpeed = 100; + private double burnTime = 0; + private double maxBurnTime = 0; // client side.. public boolean isOn; public TileVibrationChamber() { - this.gridProxy.setIdlePowerUsage( 0 ); - this.gridProxy.setFlags(); + this.getProxy().setIdlePowerUsage( 0 ); + this.getProxy().setFlags(); } @Override @@ -91,23 +91,23 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToNetwork( final ByteBuf data ) { - data.writeBoolean( this.burnTime > 0 ); + data.writeBoolean( this.getBurnTime() > 0 ); } @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_TileVibrationChamber( final NBTTagCompound data ) { - data.setDouble( "burnTime", this.burnTime ); - data.setDouble( "maxBurnTime", this.maxBurnTime ); - data.setInteger( "burnSpeed", this.burnSpeed ); + data.setDouble( "burnTime", this.getBurnTime() ); + data.setDouble( "maxBurnTime", this.getMaxBurnTime() ); + data.setInteger( "burnSpeed", this.getBurnSpeed() ); } @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_TileVibrationChamber( final NBTTagCompound data ) { - this.burnTime = data.getDouble( "burnTime" ); - this.maxBurnTime = data.getDouble( "maxBurnTime" ); - this.burnSpeed = data.getInteger( "burnSpeed" ); + this.setBurnTime( data.getDouble( "burnTime" ) ); + this.setMaxBurnTime( data.getDouble( "maxBurnTime" ) ); + this.setBurnSpeed( data.getInteger( "burnSpeed" ) ); } @Override @@ -125,13 +125,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka @Override public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added ) { - if( this.burnTime <= 0 ) + if( this.getBurnTime() <= 0 ) { if( this.canEatFuel() ) { try { - this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } catch( final GridAccessException e ) { @@ -176,44 +176,44 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka @Override public TickingRequest getTickingRequest( final IGridNode node ) { - if( this.burnTime <= 0 ) + if( this.getBurnTime() <= 0 ) { this.eatFuel(); } - return new TickingRequest( TickRates.VibrationChamber.min, TickRates.VibrationChamber.max, this.burnTime <= 0, false ); + return new TickingRequest( TickRates.VibrationChamber.getMin(), TickRates.VibrationChamber.getMax(), this.getBurnTime() <= 0, false ); } @Override public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall ) { - if( this.burnTime <= 0 ) + if( this.getBurnTime() <= 0 ) { this.eatFuel(); - if( this.burnTime > 0 ) + if( this.getBurnTime() > 0 ) { return TickRateModulation.URGENT; } - this.burnSpeed = 100; + this.setBurnSpeed( 100 ); return TickRateModulation.SLEEP; } - this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) ); - final double dilation = this.burnSpeed / DILATION_SCALING; + this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) ); + final double dilation = this.getBurnSpeed() / DILATION_SCALING; double timePassed = ticksSinceLastCall * dilation; - this.burnTime -= timePassed; - if( this.burnTime < 0 ) + this.setBurnTime( this.getBurnTime() - timePassed ); + if( this.getBurnTime() < 0 ) { - timePassed += this.burnTime; - this.burnTime = 0; + timePassed += this.getBurnTime(); + this.setBurnTime( 0 ); } try { - final IEnergyGrid grid = this.gridProxy.getEnergy(); + final IEnergyGrid grid = this.getProxy().getEnergy(); final double newPower = timePassed * POWER_PER_TICK; final double overFlow = grid.injectPower( newPower, Actionable.SIMULATE ); @@ -222,20 +222,20 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka if( overFlow > 0 ) { - this.burnSpeed -= ticksSinceLastCall; + this.setBurnSpeed( this.getBurnSpeed() - ticksSinceLastCall ); } else { - this.burnSpeed += ticksSinceLastCall; + this.setBurnSpeed( this.getBurnSpeed() + ticksSinceLastCall ); } - this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) ); + this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) ); return overFlow > 0 ? TickRateModulation.SLOWER : TickRateModulation.FASTER; } catch( final GridAccessException e ) { - this.burnSpeed -= ticksSinceLastCall; - this.burnSpeed = Math.max( MIN_BURN_SPEED, Math.min( this.burnSpeed, MAX_BURN_SPEED ) ); + this.setBurnSpeed( this.getBurnSpeed() - ticksSinceLastCall ); + this.setBurnSpeed( Math.max( MIN_BURN_SPEED, Math.min( this.getBurnSpeed(), MAX_BURN_SPEED ) ) ); return TickRateModulation.SLOWER; } } @@ -248,8 +248,8 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka final int newBurnTime = TileEntityFurnace.getItemBurnTime( is ); if( newBurnTime > 0 && is.stackSize > 0 ) { - this.burnTime += newBurnTime; - this.maxBurnTime = this.burnTime; + this.setBurnTime( this.getBurnTime() + newBurnTime ); + this.setMaxBurnTime( this.getBurnTime() ); is.stackSize--; if( is.stackSize <= 0 ) { @@ -271,11 +271,11 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } } - if( this.burnTime > 0 ) + if( this.getBurnTime() > 0 ) { try { - this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } catch( final GridAccessException e ) { @@ -284,9 +284,9 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } // state change - if( ( !this.isOn && this.burnTime > 0 ) || ( this.isOn && this.burnTime <= 0 ) ) + if( ( !this.isOn && this.getBurnTime() > 0 ) || ( this.isOn && this.getBurnTime() <= 0 ) ) { - this.isOn = this.burnTime > 0; + this.isOn = this.getBurnTime() > 0; this.markForUpdate(); if ( this.hasWorldObj() ) @@ -295,4 +295,34 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } } } + + public int getBurnSpeed() + { + return this.burnSpeed; + } + + private void setBurnSpeed( final int burnSpeed ) + { + this.burnSpeed = burnSpeed; + } + + public double getMaxBurnTime() + { + return this.maxBurnTime; + } + + private void setMaxBurnTime( final double maxBurnTime ) + { + this.maxBurnTime = maxBurnTime; + } + + public double getBurnTime() + { + return this.burnTime; + } + + private void setBurnTime( final double burnTime ) + { + this.burnTime = burnTime; + } } diff --git a/src/main/java/appeng/tile/networking/TileCableBus.java b/src/main/java/appeng/tile/networking/TileCableBus.java index 6885ce568..a62b62b0a 100644 --- a/src/main/java/appeng/tile/networking/TileCableBus.java +++ b/src/main/java/appeng/tile/networking/TileCableBus.java @@ -60,32 +60,32 @@ import appeng.util.Platform; public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision { - public CableBusContainer cb = new CableBusContainer( this ); + private CableBusContainer cb = new CableBusContainer( this ); + /** * Immibis MB Support */ - - boolean ImmibisMicroblocks_TransformableTileEntityMarker = true; + private boolean ImmibisMicroblocks_TransformableTileEntityMarker = true; private int oldLV = -1; // on re-calculate light when it changes @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_TileCableBus( final NBTTagCompound data ) { - this.cb.readFromNBT( data ); + this.getCableBus().readFromNBT( data ); } @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_TileCableBus( final NBTTagCompound data ) { - this.cb.writeToNBT( data ); + this.getCableBus().writeToNBT( data ); } @TileEvent( TileEventType.NETWORK_READ ) public boolean readFromStream_TileCableBus( final ByteBuf data ) throws IOException { - final boolean ret = this.cb.readFromStream( data ); + final boolean ret = this.getCableBus().readFromStream( data ); - final int newLV = this.cb.getLightValue(); + final int newLV = this.getCableBus().getLightValue(); if( newLV != this.oldLV ) { this.oldLV = newLV; @@ -98,11 +98,11 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl protected void updateTileSetting() { - if( this.cb.requiresDynamicRender ) + if( this.getCableBus().isRequiresDynamicRender() ) { try { - final TileCableBus tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance(); + final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance(); tcb.copyFrom( this ); this.getWorld().setTileEntity( this.pos, tcb ); } @@ -115,16 +115,16 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl protected void copyFrom( final TileCableBus oldTile ) { - final CableBusContainer tmpCB = this.cb; - this.cb = oldTile.cb; + final CableBusContainer tmpCB = this.getCableBus(); + this.setCableBus( oldTile.getCableBus() ); this.oldLV = oldTile.oldLV; - oldTile.cb = tmpCB; + oldTile.setCableBus( tmpCB ); } @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToStream_TileCableBus( final ByteBuf data ) throws IOException { - this.cb.writeToStream( data ); + this.getCableBus().writeToStream( data ); } @Override @@ -137,7 +137,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl public void invalidate() { super.invalidate(); - this.cb.removeFromWorld(); + this.getCableBus().removeFromWorld(); } @Override @@ -150,20 +150,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public IGridNode getGridNode( final AEPartLocation dir ) { - return this.cb.getGridNode( dir ); + return this.getCableBus().getGridNode( dir ); } @Override public AECableType getCableConnectionType( final AEPartLocation side ) { - return this.cb.getCableConnectionType( side ); + return this.getCableBus().getCableConnectionType( side ); } @Override public void onChunkUnload() { super.onChunkUnload(); - this.cb.removeFromWorld(); + this.getCableBus().removeFromWorld(); } @Override @@ -174,7 +174,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl return; } - final int newLV = this.cb.getLightValue(); + final int newLV = this.getCableBus().getLightValue(); if( newLV != this.oldLV ) { this.oldLV = newLV; @@ -194,20 +194,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public void getDrops( final World w, final BlockPos pos, final List drops ) { - this.cb.getDrops( drops ); + this.getCableBus().getDrops( drops ); } @Override public void getNoDrops( final World w, final BlockPos pos, final List drops ) { - this.cb.getNoDrops( drops ); + this.getCableBus().getNoDrops( drops ); } @Override public void onReady() { super.onReady(); - if( this.cb.isEmpty() ) + if( this.getCableBus().isEmpty() ) { if( this.worldObj.getTileEntity( this.pos ) == this ) { @@ -216,32 +216,32 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } else { - this.cb.addToWorld(); + this.getCableBus().addToWorld(); } } @Override public boolean requiresTESR() { - return this.cb.requiresDynamicRender; + return this.getCableBus().isRequiresDynamicRender(); } @Override public IFacadeContainer getFacadeContainer() { - return this.cb.getFacadeContainer(); + return this.getCableBus().getFacadeContainer(); } @Override public boolean canAddPart( final ItemStack is, final AEPartLocation side ) { - return this.cb.canAddPart( is, side ); + return this.getCableBus().canAddPart( is, side ); } @Override public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final EntityPlayer player ) { - return this.cb.addPart( is, side, player ); + return this.getCableBus().addPart( is, side, player ); } @Override @@ -253,13 +253,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public IPart getPart( final EnumFacing side ) { - return this.cb.getPart( side ); + return this.getCableBus().getPart( side ); } @Override public void removePart( final AEPartLocation side, final boolean suppressUpdate ) { - this.cb.removePart( side, suppressUpdate ); + this.getCableBus().removePart( side, suppressUpdate ); } @Override @@ -271,13 +271,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public AEColor getColor() { - return this.cb.getColor(); + return this.getCableBus().getColor(); } @Override public void clearContainer() { - this.cb = new CableBusContainer( this ); + this.setCableBus( new CableBusContainer( this ) ); } @Override @@ -285,17 +285,17 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl { return !this.ImmibisMicroblocks_isSideOpen( side ); } - + @Override public Iterable getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean visual ) { - return this.cb.getSelectedBoundingBoxesFromPool( false, true, e, visual ); + return this.getCableBus().getSelectedBoundingBoxesFromPool( false, true, e, visual ); } @Override public SelectedPart selectPart( final Vec3 pos ) { - return this.cb.selectPart( pos ); + return this.getCableBus().selectPart( pos ); } @Override @@ -313,19 +313,19 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public boolean hasRedstone( final AEPartLocation side ) { - return this.cb.hasRedstone( side ); + return this.getCableBus().hasRedstone( side ); } @Override public boolean isEmpty() { - return this.cb.isEmpty(); + return this.getCableBus().isEmpty(); } @Override public Set getLayerFlags() { - return this.cb.getLayerFlags(); + return this.getCableBus().getLayerFlags(); } @Override @@ -342,7 +342,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl this.getWorld().setBlockToAir( this.pos ); } - + @Override public void addCollidingBlockToList( final World w, @@ -369,17 +369,17 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override public boolean isInWorld() { - return this.cb.isInWorld(); + return this.getCableBus().isInWorld(); } - public boolean ImmibisMicroblocks_isSideOpen( final EnumFacing side ) + private boolean ImmibisMicroblocks_isSideOpen( final EnumFacing side ) { return true; } public void ImmibisMicroblocks_onMicroblocksChanged() { - this.cb.updateConnections(); + this.getCableBus().updateConnections(); } @Override @@ -388,10 +388,17 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl final AEColor colour, final EntityPlayer who ) { - return this.cb.recolourBlock( side, colour, who ); + return this.getCableBus().recolourBlock( side, colour, who ); } + public CableBusContainer getCableBus() + { + return this.cb; + } - + private void setCableBus( final CableBusContainer cb ) + { + this.cb = cb; + } } diff --git a/src/main/java/appeng/tile/networking/TileCableBusTESR.java b/src/main/java/appeng/tile/networking/TileCableBusTESR.java index e153453e9..1de4bee91 100644 --- a/src/main/java/appeng/tile/networking/TileCableBusTESR.java +++ b/src/main/java/appeng/tile/networking/TileCableBusTESR.java @@ -28,11 +28,11 @@ public class TileCableBusTESR extends TileCableBus @Override protected void updateTileSetting() { - if( !this.cb.requiresDynamicRender ) + if( !this.getCableBus().isRequiresDynamicRender() ) { try { - final TileCableBus tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance(); + final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance(); tcb.copyFrom( this ); this.getWorld().setTileEntity( this.pos, tcb ); } diff --git a/src/main/java/appeng/tile/networking/TileController.java b/src/main/java/appeng/tile/networking/TileController.java index 48286b69a..ff815f9cf 100644 --- a/src/main/java/appeng/tile/networking/TileController.java +++ b/src/main/java/appeng/tile/networking/TileController.java @@ -52,10 +52,10 @@ public class TileController extends AENetworkPowerTile public TileController() { - this.internalMaxPower = 8000; - this.internalPublicPowerStorage = true; - this.gridProxy.setIdlePowerUsage( 3 ); - this.gridProxy.setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY ); + this.setInternalMaxPower( 8000 ); + this.setInternalPublicPowerStorage( true ); + this.getProxy().setIdlePowerUsage( 3 ); + this.getProxy().setFlags( GridFlags.CANNOT_CARRY, GridFlags.DENSE_CAPACITY ); } @Override @@ -89,11 +89,11 @@ public class TileController extends AENetworkPowerTile { if( this.isValid ) { - this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); } else { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); } this.updateMeta(); @@ -103,20 +103,20 @@ public class TileController extends AENetworkPowerTile private void updateMeta() { - if( !this.gridProxy.isReady() ) + if( !this.getProxy().isReady() ) { return; } ControllerBlockState metaState = ControllerBlockState.OFFLINE; - + try { - if( this.gridProxy.getEnergy().isNetworkPowered() ) + if( this.getProxy().getEnergy().isNetworkPowered() ) { metaState = ControllerBlockState.ONLINE; - if( this.gridProxy.getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT ) + if( this.getProxy().getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT ) { metaState = ControllerBlockState.CONFLICTED; } @@ -126,12 +126,12 @@ public class TileController extends AENetworkPowerTile { metaState = ControllerBlockState.OFFLINE; } - + if( this.checkController( this.pos ) && this.worldObj.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState ) { this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) ); } - + } @Override @@ -139,7 +139,7 @@ public class TileController extends AENetworkPowerTile { try { - return this.gridProxy.getEnergy().getEnergyDemand( 8000 ); + return this.getProxy().getEnergy().getEnergyDemand( 8000 ); } catch( final GridAccessException e ) { @@ -153,7 +153,7 @@ public class TileController extends AENetworkPowerTile { try { - final double ret = this.gridProxy.getEnergy().injectPower( power, mode ); + final double ret = this.getProxy().getEnergy().injectPower( power, mode ); if( mode == Actionable.SIMULATE ) { return ret; @@ -172,7 +172,7 @@ public class TileController extends AENetworkPowerTile { try { - this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, x ) ); + this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, x ) ); } catch( final GridAccessException e ) { @@ -222,7 +222,7 @@ public class TileController extends AENetworkPowerTile { return this.worldObj.getTileEntity( pos ) instanceof TileController; } - + return false; } } diff --git a/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java b/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java index 8a9dd02ae..8d6618f6d 100644 --- a/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java +++ b/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java @@ -33,7 +33,7 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto public TileCreativeEnergyCell() { - this.gridProxy.setIdlePowerUsage( 0 ); + this.getProxy().setIdlePowerUsage( 0 ); } @Override diff --git a/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java b/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java index 32eb4ee71..7c2a8deef 100644 --- a/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java +++ b/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java @@ -24,6 +24,6 @@ public class TileDenseEnergyCell extends TileEnergyCell public TileDenseEnergyCell() { - this.internalMaxPower = 200000 * 8; + this.setInternalMaxPower( 200000 * 8 ); } } diff --git a/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java b/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java index 111e152bb..c9e8234db 100644 --- a/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java +++ b/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java @@ -36,13 +36,13 @@ import appeng.tile.inventory.InvOperation; public class TileEnergyAcceptor extends AENetworkPowerTile { - static final AppEngInternalInventory INTERNAL_INVENTORY = new AppEngInternalInventory( null, 0 ); - final int[] sides = {}; + private static final AppEngInternalInventory INTERNAL_INVENTORY = new AppEngInternalInventory( null, 0 ); + private final int[] sides = {}; public TileEnergyAcceptor() { - this.gridProxy.setIdlePowerUsage( 0.0 ); - this.internalMaxPower = 0; + this.getProxy().setIdlePowerUsage( 0.0 ); + this.setInternalMaxPower( 0 ); } @Override @@ -72,12 +72,12 @@ public class TileEnergyAcceptor extends AENetworkPowerTile { try { - final IEnergyGrid grid = this.gridProxy.getEnergy(); + final IEnergyGrid grid = this.getProxy().getEnergy(); return grid.getEnergyDemand( maxRequired ); } catch( final GridAccessException e ) { - return this.internalMaxPower; + return this.getInternalMaxPower(); } } @@ -86,7 +86,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile { try { - final IEnergyGrid grid = this.gridProxy.getEnergy(); + final IEnergyGrid grid = this.getProxy().getEnergy(); final double leftOver = grid.injectPower( power, mode ); if( mode == Actionable.SIMULATE ) { diff --git a/src/main/java/appeng/tile/networking/TileEnergyCell.java b/src/main/java/appeng/tile/networking/TileEnergyCell.java index 67906cb30..750358d2e 100644 --- a/src/main/java/appeng/tile/networking/TileEnergyCell.java +++ b/src/main/java/appeng/tile/networking/TileEnergyCell.java @@ -39,15 +39,14 @@ import appeng.util.SettingsFrom; public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage { - - protected double internalCurrentPower = 0.0; - protected double internalMaxPower = 200000.0; + private double internalCurrentPower = 0.0; + private double internalMaxPower = 200000.0; private byte currentMeta = -1; public TileEnergyCell() { - this.gridProxy.setIdlePowerUsage( 0 ); + this.getProxy().setIdlePowerUsage( 0 ); } @Override @@ -60,8 +59,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage public void onReady() { super.onReady(); - final int value = ( Integer ) this.worldObj.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE ); - this.currentMeta = (byte)value; + final int value = (Integer) this.worldObj.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE ); + this.currentMeta = (byte) value; this.changePowerLevel(); } @@ -72,7 +71,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage return; } - byte boundMetadata = (byte) ( 8.0 * ( this.internalCurrentPower / this.internalMaxPower ) ); + byte boundMetadata = (byte) ( 8.0 * ( this.internalCurrentPower / this.getInternalMaxPower() ) ); if( boundMetadata > 7 ) { @@ -86,7 +85,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage if( this.currentMeta != boundMetadata ) { this.currentMeta = boundMetadata; - this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, (int)boundMetadata ) ); + this.worldObj.setBlockState( this.pos, this.worldObj.getBlockState( this.pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, (int) boundMetadata ) ); } } @@ -127,7 +126,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage { final NBTTagCompound tag = new NBTTagCompound(); tag.setDouble( "internalCurrentPower", this.internalCurrentPower ); - tag.setDouble( "internalMaxPower", this.internalMaxPower ); // used for tool tip. + tag.setDouble( "internalMaxPower", this.getInternalMaxPower() ); // used for tool tip. return tag; } return null; @@ -139,9 +138,9 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage if( mode == Actionable.SIMULATE ) { final double fakeBattery = this.internalCurrentPower + amt; - if( fakeBattery > this.internalMaxPower ) + if( fakeBattery > this.getInternalMaxPower() ) { - return fakeBattery - this.internalMaxPower; + return fakeBattery - this.getInternalMaxPower(); } return 0; @@ -149,14 +148,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage if( this.internalCurrentPower < 0.01 && amt > 0.01 ) { - this.gridProxy.getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) ); + this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) ); } this.internalCurrentPower += amt; - if( this.internalCurrentPower > this.internalMaxPower ) + if( this.internalCurrentPower > this.getInternalMaxPower() ) { - amt = this.internalCurrentPower - this.internalMaxPower; - this.internalCurrentPower = this.internalMaxPower; + amt = this.internalCurrentPower - this.getInternalMaxPower(); + this.internalCurrentPower = this.getInternalMaxPower(); this.changePowerLevel(); return amt; @@ -169,7 +168,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage @Override public double getAEMaxPower() { - return this.internalMaxPower; + return this.getInternalMaxPower(); } @Override @@ -207,13 +206,13 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage return this.internalCurrentPower; } - final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001; + final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001; if( wasFull && amt > 0.001 ) { try { - this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) ); + this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) ); } catch( final GridAccessException ignored ) { @@ -235,4 +234,14 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage this.changePowerLevel(); return amt; } + + private double getInternalMaxPower() + { + return this.internalMaxPower; + } + + void setInternalMaxPower( final double internalMaxPower ) + { + this.internalMaxPower = internalMaxPower; + } } diff --git a/src/main/java/appeng/tile/networking/TileWireless.java b/src/main/java/appeng/tile/networking/TileWireless.java index 28813eb42..e0b4e75f0 100644 --- a/src/main/java/appeng/tile/networking/TileWireless.java +++ b/src/main/java/appeng/tile/networking/TileWireless.java @@ -53,22 +53,22 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi public static final int POWERED_FLAG = 1; public static final int CHANNEL_FLAG = 2; - final int[] sides = { 0 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 ); + private final int[] sides = { 0 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 ); - public int clientFlags = 0; + private int clientFlags = 0; public TileWireless() { - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); } @Override public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) { super.setOrientation( inForward, inUp ); - this.gridProxy.setValidSides( EnumSet.of( this.getForward().getOpposite() ) ); + this.getProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) ); } @MENetworkEventSubscribe @@ -86,27 +86,27 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi @TileEvent( TileEventType.NETWORK_READ ) public boolean readFromStream_TileWireless( final ByteBuf data ) { - final int old = this.clientFlags; - this.clientFlags = data.readByte(); + final int old = this.getClientFlags(); + this.setClientFlags( data.readByte() ); - return old != this.clientFlags; + return old != this.getClientFlags(); } @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToStream_TileWireless( final ByteBuf data ) { - this.clientFlags = 0; + this.setClientFlags( 0 ); try { - if( this.gridProxy.getEnergy().isNetworkPowered() ) + if( this.getProxy().getEnergy().isNetworkPowered() ) { - this.clientFlags |= POWERED_FLAG; + this.setClientFlags( this.getClientFlags() | POWERED_FLAG ); } - if( this.gridProxy.getNode().meetsChannelRequirements() ) + if( this.getProxy().getNode().meetsChannelRequirements() ) { - this.clientFlags |= CHANNEL_FLAG; + this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG ); } } catch( final GridAccessException e ) @@ -114,7 +114,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi // meh } - data.writeByte( (byte) this.clientFlags ); + data.writeByte( (byte) this.getClientFlags() ); } @Override @@ -162,7 +162,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi private void updatePower() { - this.gridProxy.setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) ); + this.getProxy().setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) ); } private int getBoosters() @@ -188,10 +188,10 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi { if( Platform.isClient() ) { - return this.isPowered() && ( CHANNEL_FLAG == ( this.clientFlags & CHANNEL_FLAG ) ); + return this.isPowered() && ( CHANNEL_FLAG == ( this.getClientFlags() & CHANNEL_FLAG ) ); } - return this.gridProxy.isActive(); + return this.getProxy().isActive(); } @Override @@ -199,7 +199,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi { try { - return this.gridProxy.getGrid(); + return this.getProxy().getGrid(); } catch( final GridAccessException e ) { @@ -210,6 +210,16 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi @Override public boolean isPowered() { - return POWERED_FLAG == ( this.clientFlags & POWERED_FLAG ); + return POWERED_FLAG == ( this.getClientFlags() & POWERED_FLAG ); + } + + public int getClientFlags() + { + return this.clientFlags; + } + + private void setClientFlags( final int clientFlags ) + { + this.clientFlags = clientFlags; } } diff --git a/src/main/java/appeng/tile/powersink/AERootPoweredTile.java b/src/main/java/appeng/tile/powersink/AERootPoweredTile.java index 7aa91d25c..0f5361cca 100644 --- a/src/main/java/appeng/tile/powersink/AERootPoweredTile.java +++ b/src/main/java/appeng/tile/powersink/AERootPoweredTile.java @@ -37,14 +37,13 @@ import appeng.tile.events.TileEventType; public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowerStorage { - protected final boolean internalCanAcceptPower = true; // values that determine general function, are set by inheriting classes if // needed. These should generally remain static. - protected double internalMaxPower = 10000; - protected boolean internalPublicPowerStorage = false; - protected AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE; + private double internalMaxPower = 10000; + private boolean internalPublicPowerStorage = false; + private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE; // the current power buffer. - protected double internalCurrentPower = 0; + private double internalCurrentPower = 0; private EnumSet internalPowerSides = EnumSet.allOf( EnumFacing.class ); protected EnumSet getPowerSides() @@ -61,13 +60,13 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe @TileEvent( TileEventType.WORLD_NBT_WRITE ) public void writeToNBT_AERootPoweredTile( final NBTTagCompound data ) { - data.setDouble( "internalCurrentPower", this.internalCurrentPower ); + data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() ); } @TileEvent( TileEventType.WORLD_NBT_READ ) public void readFromNBT_AERootPoweredTile( final NBTTagCompound data ) { - this.internalCurrentPower = data.getDouble( "internalCurrentPower" ); + this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) ); } protected final double getExternalPowerDemand( final PowerUnits externalUnit, final double maxPowerRequired ) @@ -77,7 +76,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe protected double getFunnelPowerDemand( final double maxRequired ) { - return this.internalMaxPower - this.internalCurrentPower; + return this.getInternalMaxPower() - this.getInternalCurrentPower(); } public final double injectExternalPower( final PowerUnits input, final double amt ) @@ -100,27 +99,27 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe if( mode == Actionable.SIMULATE ) { - final double fakeBattery = this.internalCurrentPower + amt; + final double fakeBattery = this.getInternalCurrentPower() + amt; - if( fakeBattery > this.internalMaxPower ) + if( fakeBattery > this.getInternalMaxPower() ) { - return fakeBattery - this.internalMaxPower; + return fakeBattery - this.getInternalMaxPower(); } return 0; } else { - if( this.internalCurrentPower < 0.01 && amt > 0.01 ) + if( this.getInternalCurrentPower() < 0.01 && amt > 0.01 ) { this.PowerEvent( PowerEventType.PROVIDE_POWER ); } - this.internalCurrentPower += amt; - if( this.internalCurrentPower > this.internalMaxPower ) + this.setInternalCurrentPower( this.getInternalCurrentPower() + amt ); + if( this.getInternalCurrentPower() > this.getInternalMaxPower() ) { - amt = this.internalCurrentPower - this.internalMaxPower; - this.internalCurrentPower = this.internalMaxPower; + amt = this.getInternalCurrentPower() - this.getInternalMaxPower(); + this.setInternalCurrentPower( this.getInternalMaxPower() ); return amt; } @@ -136,25 +135,25 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe @Override public final double getAEMaxPower() { - return this.internalMaxPower; + return this.getInternalMaxPower(); } @Override public final double getAECurrentPower() { - return this.internalCurrentPower; + return this.getInternalCurrentPower(); } @Override public final boolean isAEPublicPowerStorage() { - return this.internalPublicPowerStorage; + return this.isInternalPublicPowerStorage(); } @Override public final AccessRestriction getPowerFlow() { - return this.internalPowerFlow; + return this.getInternalPowerFlow(); } @Override @@ -167,27 +166,67 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe { if( mode == Actionable.SIMULATE ) { - if( this.internalCurrentPower > amt ) + if( this.getInternalCurrentPower() > amt ) { return amt; } - return this.internalCurrentPower; + return this.getInternalCurrentPower(); } - final boolean wasFull = this.internalCurrentPower >= this.internalMaxPower - 0.001; + final boolean wasFull = this.getInternalCurrentPower() >= this.getInternalMaxPower() - 0.001; if( wasFull && amt > 0.001 ) { this.PowerEvent( PowerEventType.REQUEST_POWER ); } - if( this.internalCurrentPower > amt ) + if( this.getInternalCurrentPower() > amt ) { - this.internalCurrentPower -= amt; + this.setInternalCurrentPower( this.getInternalCurrentPower() - amt ); return amt; } - amt = this.internalCurrentPower; - this.internalCurrentPower = 0; + amt = this.getInternalCurrentPower(); + this.setInternalCurrentPower( 0 ); return amt; } + + public double getInternalCurrentPower() + { + return this.internalCurrentPower; + } + + public void setInternalCurrentPower( final double internalCurrentPower ) + { + this.internalCurrentPower = internalCurrentPower; + } + + public double getInternalMaxPower() + { + return this.internalMaxPower; + } + + public void setInternalMaxPower( final double internalMaxPower ) + { + this.internalMaxPower = internalMaxPower; + } + + private boolean isInternalPublicPowerStorage() + { + return this.internalPublicPowerStorage; + } + + public void setInternalPublicPowerStorage( final boolean internalPublicPowerStorage ) + { + this.internalPublicPowerStorage = internalPublicPowerStorage; + } + + private AccessRestriction getInternalPowerFlow() + { + return this.internalPowerFlow; + } + + public void setInternalPowerFlow( final AccessRestriction internalPowerFlow ) + { + this.internalPowerFlow = internalPowerFlow; + } } diff --git a/src/main/java/appeng/tile/powersink/MekJoules.java b/src/main/java/appeng/tile/powersink/MekJoules.java index 48fddaa16..fc7fe0713 100644 --- a/src/main/java/appeng/tile/powersink/MekJoules.java +++ b/src/main/java/appeng/tile/powersink/MekJoules.java @@ -69,4 +69,4 @@ package appeng.tile.powersink; // { // return this.getPowerSides().contains( side ); // } -//} +// } diff --git a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java index 0c8e0553c..2aae6c3cd 100644 --- a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java +++ b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java @@ -55,25 +55,23 @@ import com.google.common.base.Optional; public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, IUpdatePlayerListBox { - private static final IBlockDefinition RING_DEFINITION = AEApi.instance().definitions().blocks().quantumRing(); - public final byte corner = 16; - final int[] sidesRing = {}; - final int[] sidesLink = { 0 }; - final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 ); - final byte hasSingularity = 32; - final byte powered = 64; + private final byte corner = 16; + private final int[] sidesRing = {}; + private final int[] sidesLink = { 0 }; + private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 ); + private final byte hasSingularity = 32; + private final byte powered = 64; private final QuantumCalculator calc = new QuantumCalculator( this ); - public boolean bridgePowered; - byte constructed = -1; - QuantumCluster cluster; + private byte constructed = -1; + private QuantumCluster cluster; private boolean updateStatus = false; public TileQuantumBridge() { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); - this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY ); - this.gridProxy.setIdlePowerUsage( 22 ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setFlags( GridFlags.DENSE_CAPACITY ); + this.getProxy().setIdlePowerUsage( 22 ); this.internalInventory.setMaxStackSize( 1 ); } @@ -101,7 +99,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock out |= this.hasSingularity; } - if( this.gridProxy.isActive() && this.constructed != -1 ) + if( this.getProxy().isActive() && this.constructed != -1 ) { out |= this.powered; } @@ -114,7 +112,6 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock { final int oldValue = this.constructed; this.constructed = data.readByte(); - this.bridgePowered = ( this.constructed | this.powered ) == this.powered; return this.constructed != oldValue; } @@ -143,7 +140,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock return this.sidesRing; } - public boolean isCenter() + private boolean isCenter() { for( final Block link : AEApi.instance().definitions().blocks().quantumLink().maybeBlock().asSet() ) { @@ -181,7 +178,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock { final ItemStack linkStack = maybeLinkStack.get(); - this.gridProxy.setVisualRepresentation( linkStack ); + this.getProxy().setVisualRepresentation( linkStack ); } } @@ -199,7 +196,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock { if( !affectWorld ) { - this.cluster.updateStatus = false; + this.cluster.setUpdateStatus( false ); } this.cluster.destroy(); @@ -209,7 +206,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock if( affectWorld ) { - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); } } @@ -240,22 +237,22 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock if( this.isCorner() || this.isCenter() ) { final EnumSet sides = EnumSet.noneOf( EnumFacing.class ); - for ( final AEPartLocation dir : this.getConnections() ) - if ( dir != AEPartLocation.INTERNAL ) - sides.add( dir.getFacing()); - - this.gridProxy.setValidSides( sides ); + for( final AEPartLocation dir : this.getConnections() ) + if( dir != AEPartLocation.INTERNAL ) + sides.add( dir.getFacing() ); + + this.getProxy().setValidSides( sides ); } else { - this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); } } } public boolean isCorner() { - return ( this.constructed & this.corner ) == this.corner && this.constructed != -1; + return ( this.constructed & this.getCorner() ) == this.getCorner() && this.constructed != -1; } public EnumSet getConnections() @@ -297,7 +294,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock try { - return this.gridProxy.getEnergy().isNetworkPowered(); + return this.getProxy().getEnergy().isNetworkPowered(); } catch( final GridAccessException e ) { @@ -345,4 +342,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock this.cluster.destroy(); } } + + public byte getCorner() + { + return this.corner; + } } diff --git a/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java b/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java index 7b76256d2..103423a9c 100644 --- a/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java +++ b/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java @@ -53,13 +53,13 @@ import appeng.util.Platform; public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallable { - final int[] sides = { 0, 1 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 ); - YesNo lastRedstoneState = YesNo.UNDECIDED; + private final int[] sides = { 0, 1 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 ); + private YesNo lastRedstoneState = YesNo.UNDECIDED; public TileSpatialIOPort() { - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); } @TileEvent( TileEventType.WORLD_NBT_WRITE ) @@ -128,8 +128,8 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl final ItemStack cell = this.getStackInSlot( 0 ); if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null ) { - final IGrid gi = this.gridProxy.getGrid(); - final IEnergyGrid energy = this.gridProxy.getEnergy(); + final IGrid gi = this.getProxy().getGrid(); + final IEnergyGrid energy = this.getProxy().getEnergy(); final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem(); @@ -179,7 +179,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl @Override public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) { - return ( i == 0 && this.isSpatialCell( itemstack ) ); + return( i == 0 && this.isSpatialCell( itemstack ) ); } @Override diff --git a/src/main/java/appeng/tile/spatial/TileSpatialPylon.java b/src/main/java/appeng/tile/spatial/TileSpatialPylon.java index bc119dacf..257e8bb2d 100644 --- a/src/main/java/appeng/tile/spatial/TileSpatialPylon.java +++ b/src/main/java/appeng/tile/spatial/TileSpatialPylon.java @@ -53,16 +53,17 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock public static final int DISPLAY_ENABLED = 0x10; public static final int DISPLAY_POWERED_ENABLED = 0x20; public static final int NET_STATUS = 0x10 + 0x20; - final SpatialPylonCalculator calc = new SpatialPylonCalculator( this ); - int displayBits = 0; - SpatialPylonCluster cluster; - boolean didHaveLight = false; + + private final SpatialPylonCalculator calc = new SpatialPylonCalculator( this ); + private int displayBits = 0; + private SpatialPylonCluster cluster; + private boolean didHaveLight = false; public TileSpatialPylon() { - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK ); - this.gridProxy.setIdlePowerUsage( 0.5 ); - this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK ); + this.getProxy().setIdlePowerUsage( 0.5 ); + this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); } @Override @@ -122,7 +123,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock public void updateStatus( final SpatialPylonCluster c ) { this.cluster = c; - this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) ); this.recalculateDisplay(); } @@ -134,11 +135,11 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock if( this.cluster != null ) { - if( this.cluster.min.equals( this.getLocation() ) ) + if( this.cluster.getMin().equals( this.getLocation() ) ) { this.displayBits = DISPLAY_END_MIN; } - else if( this.cluster.max.equals( this.getLocation() ) ) + else if( this.cluster.getMax().equals( this.getLocation() ) ) { this.displayBits = DISPLAY_END_MAX; } @@ -147,7 +148,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock this.displayBits = DISPLAY_MIDDLE; } - switch( this.cluster.currentAxis ) + switch( this.cluster.getCurrentAxis() ) { case X: this.displayBits |= DISPLAY_X; @@ -165,12 +166,12 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock try { - if( this.gridProxy.getEnergy().isNetworkPowered() ) + if( this.getProxy().getEnergy().isNetworkPowered() ) { this.displayBits |= DISPLAY_POWERED_ENABLED; } - if( this.cluster.isValid && this.gridProxy.isActive() ) + if( this.cluster.isValid() && this.getProxy().isActive() ) { this.displayBits |= DISPLAY_ENABLED; } diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index 280dfc308..53cf89c4a 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -95,34 +95,34 @@ import appeng.util.item.AEFluidStack; public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, IUpdatePlayerListBox { - static final ChestNoHandler NO_HANDLER = new ChestNoHandler(); - static final int[] SIDES = { 0 }; - static final int[] FRONT = { 1 }; - static final int[] NO_SLOTS = {}; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 ); - final BaseActionSource mySrc = new MachineSource( this ); - final IConfigManager config = new ConfigManager( this ); - ItemStack storageType; - long lastStateChange = 0; - int priority = 0; - int state = 0; - boolean wasActive = false; - AEColor paintedColor = AEColor.Transparent; - boolean isCached = false; + private static final ChestNoHandler NO_HANDLER = new ChestNoHandler(); + private static final int[] SIDES = { 0 }; + private static final int[] FRONT = { 1 }; + private static final int[] NO_SLOTS = {}; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 ); + private final BaseActionSource mySrc = new MachineSource( this ); + private final IConfigManager config = new ConfigManager( this ); + private ItemStack storageType; + private long lastStateChange = 0; + private int priority = 0; + private int state = 0; + private boolean wasActive = false; + private AEColor paintedColor = AEColor.Transparent; + private boolean isCached = false; private ICellHandler cellHandler; private MEMonitorHandler itemCell; private MEMonitorHandler fluidCell; public TileChest() { - this.internalMaxPower = PowerMultiplier.CONFIG.multiply( 40 ); - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); + this.setInternalMaxPower( PowerMultiplier.CONFIG.multiply( 40 ) ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.config.registerSetting( Settings.SORT_BY, SortOrder.NAME ); this.config.registerSetting( Settings.VIEW_MODE, ViewItems.ALL ); this.config.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING ); - this.internalPublicPowerStorage = true; - this.internalPowerFlow = AccessRestriction.WRITE; + this.setInternalPublicPowerStorage( true ); + this.setInternalPowerFlow( AccessRestriction.WRITE ); } @Override @@ -132,7 +132,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { try { - this.gridProxy.getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) ); + this.getProxy().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) ); } catch( final GridAccessException e ) { @@ -163,13 +163,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan this.state &= ~0x40; } - final boolean currentActive = this.gridProxy.isActive(); + final boolean currentActive = this.getProxy().isActive(); if( this.wasActive != currentActive ) { this.wasActive = currentActive; try { - this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); } catch( final GridAccessException e ) { @@ -189,7 +189,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan return 1; } - public IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler + private IMEInventoryHandler getHandler( final StorageChannel channel ) throws ChestNoHandler { if( !this.isCached ) { @@ -217,7 +217,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan power += this.cellHandler.cellIdleDrain( is, fluidCell ); } - this.gridProxy.setIdlePowerUsage( power ); + this.getProxy().setIdlePowerUsage( power ); this.itemCell = this.wrap( itemCell ); this.fluidCell = this.wrap( fluidCell ); @@ -316,7 +316,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { try { - gridPowered = this.gridProxy.getEnergy().isNetworkPowered(); + gridPowered = this.getProxy().getEnergy().isNetworkPowered(); } catch( final GridAccessException ignored ) { @@ -345,7 +345,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan try { - final IEnergyGrid eg = this.gridProxy.getEnergy(); + final IEnergyGrid eg = this.getProxy().getEnergy(); stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE ); if( stash >= amt ) { @@ -369,11 +369,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan return; } - final double idleUsage = this.gridProxy.getIdlePowerUsage(); + final double idleUsage = this.getProxy().getIdlePowerUsage(); try { - if( !this.gridProxy.getEnergy().isNetworkPowered() ) + if( !this.getProxy().getEnergy().isNetworkPowered() ) { final double powerUsed = this.extractAEPower( idleUsage, Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 ) @@ -384,7 +384,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan } catch( final GridAccessException e ) { - final double powerUsed = this.extractAEPower( this.gridProxy.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain + final double powerUsed = this.extractAEPower( this.getProxy().getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG ); // drain if( powerUsed + 0.1 >= idleUsage != ( this.state & 0x40 ) > 0 ) { this.recalculateDisplay(); @@ -531,9 +531,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan try { - this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); - final IStorageGrid gs = this.gridProxy.getStorage(); + final IStorageGrid gs = this.getProxy().getStorage(); Platform.postChanges( gs, removed, added, this.mySrc ); } catch( final GridAccessException ignored ) @@ -638,7 +638,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public List getCellArray( final StorageChannel channel ) { - if( this.gridProxy.isActive() ) + if( this.getProxy().isActive() ) { try { @@ -669,7 +669,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan try { - this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); } catch( final GridAccessException e ) { @@ -773,7 +773,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan @Override public IStorageMonitorable getMonitorable( final EnumFacing side, final BaseActionSource src ) { - if( Platform.canAccess( this.gridProxy, src ) && side != this.getForward() ) + if( Platform.canAccess( this.getProxy(), src ) && side != this.getForward() ) { return this; } @@ -868,11 +868,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan private static final long serialVersionUID = 7995805326136526631L; } - - class ChestNetNotifier> implements IMEMonitorHandlerReceiver + private class ChestNetNotifier> implements IMEMonitorHandlerReceiver { - final StorageChannel chan; + private final StorageChannel chan; public ChestNetNotifier( final StorageChannel chan ) { @@ -900,9 +899,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan { try { - if( TileChest.this.gridProxy.isActive() ) + if( TileChest.this.getProxy().isActive() ) { - TileChest.this.gridProxy.getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc ); + TileChest.this.getProxy().getStorage().postAlterationOfStoredItems( this.chan, change, TileChest.this.mySrc ); } } catch( final GridAccessException e ) @@ -921,8 +920,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan } } - - class ChestMonitorHandler extends MEMonitorHandler + private class ChestMonitorHandler extends MEMonitorHandler { public ChestMonitorHandler( final IMEInventoryHandler t ) @@ -930,7 +928,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan super( t ); } - public IMEInventoryHandler getInternalHandler() + private IMEInventoryHandler getInternalHandler() { final IMEInventoryHandler h = this.getHandler(); if( h instanceof MEInventoryHandler ) diff --git a/src/main/java/appeng/tile/storage/TileDrive.java b/src/main/java/appeng/tile/storage/TileDrive.java index 58f0aebcd..811d088df 100644 --- a/src/main/java/appeng/tile/storage/TileDrive.java +++ b/src/main/java/appeng/tile/storage/TileDrive.java @@ -62,23 +62,23 @@ import appeng.util.Platform; public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost { - final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 ); - final ICellHandler[] handlersBySlot = new ICellHandler[10]; - final DriveWatcher[] invBySlot = new DriveWatcher[10]; - final BaseActionSource mySrc; - boolean isCached = false; - List items = new LinkedList(); - List fluids = new LinkedList(); - long lastStateChange = 0; - int state = 0; - int priority = 0; - boolean wasActive = false; + private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 ); + private final ICellHandler[] handlersBySlot = new ICellHandler[10]; + private final DriveWatcher[] invBySlot = new DriveWatcher[10]; + private final BaseActionSource mySrc; + private boolean isCached = false; + private List items = new LinkedList(); + private List fluids = new LinkedList(); + private long lastStateChange = 0; + private int state = 0; + private int priority = 0; + private boolean wasActive = false; public TileDrive() { this.mySrc = new MachineSource( this ); - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); } @TileEvent( TileEventType.NETWORK_WRITE ) @@ -93,7 +93,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior this.state &= 0x24924924; // just keep the blinks... } - if( this.gridProxy.isActive() ) + if( this.getProxy().isActive() ) { this.state |= 0x80000000; } @@ -160,7 +160,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior return ( this.state & 0x80000000 ) == 0x80000000; } - return this.gridProxy.isActive(); + return this.getProxy().isActive(); } @Override @@ -206,7 +206,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior private void recalculateDisplay() { - final boolean currentActive = this.gridProxy.isActive(); + final boolean currentActive = this.getProxy().isActive(); if( currentActive ) { this.state |= 0x80000000; @@ -221,7 +221,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior this.wasActive = currentActive; try { - this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); } catch( final GridAccessException e ) { @@ -282,9 +282,9 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior try { - this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); - final IStorageGrid gs = this.gridProxy.getStorage(); + final IStorageGrid gs = this.getProxy().getStorage(); Platform.postChanges( gs, removed, added, this.mySrc ); } catch( final GridAccessException ignored ) @@ -300,7 +300,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior return this.sides; } - public void updateState() + private void updateState() { if( !this.isCached ) { @@ -350,7 +350,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior } } - this.gridProxy.setIdlePowerUsage( power ); + this.getProxy().setIdlePowerUsage( power ); this.isCached = true; } @@ -366,7 +366,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior @Override public List getCellArray( final StorageChannel channel ) { - if( this.gridProxy.isActive() ) + if( this.getProxy().isActive() ) { this.updateState(); return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids ); @@ -391,7 +391,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior try { - this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); } catch( final GridAccessException e ) { diff --git a/src/main/java/appeng/tile/storage/TileIOPort.java b/src/main/java/appeng/tile/storage/TileIOPort.java index e0e371a7d..818df9e22 100644 --- a/src/main/java/appeng/tile/storage/TileIOPort.java +++ b/src/main/java/appeng/tile/storage/TileIOPort.java @@ -107,7 +107,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC @Reflected public TileIOPort() { - this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); + this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.manager = new ConfigManager( this ); this.manager.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE ); this.manager.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY ); @@ -159,11 +159,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC { if( this.hasWork() ) { - this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().wakeDevice( this.getProxy().getNode() ); } else { - this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() ); + this.getProxy().getTick().sleepDevice( this.getProxy().getNode() ); } } catch( final GridAccessException e ) @@ -182,7 +182,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC } } - public boolean getRedstoneState() + private boolean getRedstoneState() { if( this.lastRedstoneState == YesNo.UNDECIDED ) { @@ -235,7 +235,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC this.updateTask(); } - boolean hasWork() + private boolean hasWork() { if( this.isEnabled() ) { @@ -308,13 +308,13 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC @Override public TickingRequest getTickingRequest( final IGridNode node ) { - return new TickingRequest( TickRates.IOPort.min, TickRates.IOPort.max, this.hasWork(), false ); + return new TickingRequest( TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), this.hasWork(), false ); } @Override public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall ) { - if( !this.gridProxy.isActive() ) + if( !this.getProxy().isActive() ) { return TickRateModulation.IDLE; } @@ -336,9 +336,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC try { - final IMEInventory itemNet = this.gridProxy.getStorage().getItemInventory(); - final IMEInventory fluidNet = this.gridProxy.getStorage().getFluidInventory(); - final IEnergySource energy = this.gridProxy.getEnergy(); + final IMEInventory itemNet = this.getProxy().getStorage().getItemInventory(); + final IMEInventory fluidNet = this.getProxy().getStorage().getFluidInventory(); + final IEnergySource energy = this.getProxy().getEnergy(); for( int x = 0; x < 6; x++ ) { final ItemStack is = this.cells.getStackInSlot( x ); @@ -556,10 +556,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC /** * Adds the items in the upgrade slots to the drop list. * - * @param w world - * @param x x pos of tile entity - * @param y y pos of tile entity - * @param z z pos of tile entity + * @param w world + * @param x x pos of tile entity + * @param y y pos of tile entity + * @param z z pos of tile entity * @param drops drops of tile entity */ @Override diff --git a/src/main/java/appeng/tile/storage/TileSkyChest.java b/src/main/java/appeng/tile/storage/TileSkyChest.java index 0a2ecaf2e..488890e6d 100644 --- a/src/main/java/appeng/tile/storage/TileSkyChest.java +++ b/src/main/java/appeng/tile/storage/TileSkyChest.java @@ -35,29 +35,29 @@ import appeng.util.Platform; public class TileSkyChest extends AEBaseInvTile { - final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }; - final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 ); + private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }; + private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 ); // server - public int playerOpen; + private int playerOpen; // client.. - public long lastEvent; - public float lidAngle; + private long lastEvent; + private float lidAngle; @TileEvent( TileEventType.NETWORK_WRITE ) public void writeToStream_TileSkyChest( final ByteBuf data ) { - data.writeBoolean( this.playerOpen > 0 ); + data.writeBoolean( this.getPlayerOpen() > 0 ); } @TileEvent( TileEventType.NETWORK_READ ) public boolean readFromStream_TileSkyChest( final ByteBuf data ) { - final int wasOpen = this.playerOpen; - this.playerOpen = data.readBoolean() ? 1 : 0; + final int wasOpen = this.getPlayerOpen(); + this.setPlayerOpen( data.readBoolean() ? 1 : 0 ); - if( wasOpen != this.playerOpen ) + if( wasOpen != this.getPlayerOpen() ) { - this.lastEvent = System.currentTimeMillis(); + this.setLastEvent( System.currentTimeMillis() ); } return false; // TESR yo! @@ -83,9 +83,9 @@ public class TileSkyChest extends AEBaseInvTile return; } - this.playerOpen++; + this.setPlayerOpen( this.getPlayerOpen() + 1 ); - if( this.playerOpen == 1 ) + if( this.getPlayerOpen() == 1 ) { this.getWorld().playSoundEffect( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, "random.chestopen", 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F ); this.markForUpdate(); @@ -100,14 +100,14 @@ public class TileSkyChest extends AEBaseInvTile return; } - this.playerOpen--; + this.setPlayerOpen( this.getPlayerOpen() - 1 ); - if( this.playerOpen < 0 ) + if( this.getPlayerOpen() < 0 ) { - this.playerOpen = 0; + this.setPlayerOpen( 0 ); } - if( this.playerOpen == 0 ) + if( this.getPlayerOpen() == 0 ) { this.getWorld().playSoundEffect( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, "random.chestclosed", 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F ); this.markForUpdate(); @@ -125,4 +125,34 @@ public class TileSkyChest extends AEBaseInvTile { return this.sides; } + + public float getLidAngle() + { + return this.lidAngle; + } + + public void setLidAngle( final float lidAngle ) + { + this.lidAngle = lidAngle; + } + + public int getPlayerOpen() + { + return this.playerOpen; + } + + private void setPlayerOpen( final int playerOpen ) + { + this.playerOpen = playerOpen; + } + + public long getLastEvent() + { + return this.lastEvent; + } + + private void setLastEvent( final long lastEvent ) + { + this.lastEvent = lastEvent; + } } diff --git a/src/main/java/appeng/util/BlockUpdate.java b/src/main/java/appeng/util/BlockUpdate.java index d76b6c70e..f681e3bee 100644 --- a/src/main/java/appeng/util/BlockUpdate.java +++ b/src/main/java/appeng/util/BlockUpdate.java @@ -25,17 +25,17 @@ import net.minecraft.world.World; public class BlockUpdate implements IWorldCallable { - final BlockPos pos; + private final BlockPos pos; - public BlockUpdate( final BlockPos pos ) + BlockUpdate( final BlockPos pos ) { - this.pos=pos; + this.pos = pos; } @Override public Boolean call( final World world ) throws Exception { - if ( world.isBlockLoaded( this.pos ) ) + if( world.isBlockLoaded( this.pos ) ) { world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK ); } diff --git a/src/main/java/appeng/util/InWorldToolOperationResult.java b/src/main/java/appeng/util/InWorldToolOperationResult.java index ff1f1b6fa..6f7848b84 100644 --- a/src/main/java/appeng/util/InWorldToolOperationResult.java +++ b/src/main/java/appeng/util/InWorldToolOperationResult.java @@ -30,8 +30,8 @@ import net.minecraft.item.ItemStack; public class InWorldToolOperationResult { - public final ItemStack BlockItem; - public final List Drops; + private final ItemStack BlockItem; + private final List Drops; public InWorldToolOperationResult() { @@ -74,4 +74,14 @@ public class InWorldToolOperationResult return new InWorldToolOperationResult( b, temp ); } + + public ItemStack getBlockItem() + { + return this.BlockItem; + } + + public List getDrops() + { + return this.Drops; + } } diff --git a/src/main/java/appeng/util/ItemSorters.java b/src/main/java/appeng/util/ItemSorters.java index 6f0ad451d..1de1a82db 100644 --- a/src/main/java/appeng/util/ItemSorters.java +++ b/src/main/java/appeng/util/ItemSorters.java @@ -32,14 +32,15 @@ import appeng.util.item.AEItemStack; public class ItemSorters { - public static SortDir Direction = SortDir.ASCENDING; + private static SortDir Direction = SortDir.ASCENDING; + public static final Comparator CONFIG_BASED_SORT_BY_NAME = new Comparator() { @Override public int compare( final IAEItemStack o1, final IAEItemStack o2 ) { - if( Direction == SortDir.ASCENDING ) + if( getDirection() == SortDir.ASCENDING ) { return Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) ); } @@ -55,7 +56,7 @@ public class ItemSorters final AEItemStack op1 = (AEItemStack) o1; final AEItemStack op2 = (AEItemStack) o2; - if( Direction == SortDir.ASCENDING ) + if( getDirection() == SortDir.ASCENDING ) { return this.secondarySort( op2.getModID().compareToIgnoreCase( op1.getModID() ), o1, o2 ); } @@ -78,7 +79,7 @@ public class ItemSorters @Override public int compare( final IAEItemStack o1, final IAEItemStack o2 ) { - if( Direction == SortDir.ASCENDING ) + if( getDirection() == SortDir.ASCENDING ) { return compareLong( o2.getStackSize(), o1.getStackSize() ); } @@ -99,7 +100,7 @@ public class ItemSorters final int cmp = api.compareItems( o1.getItemStack(), o2.getItemStack() ); - if( Direction == SortDir.ASCENDING ) + if( getDirection() == SortDir.ASCENDING ) { return cmp; } @@ -162,4 +163,14 @@ public class ItemSorters } return 1; } + + private static SortDir getDirection() + { + return Direction; + } + + public static void setDirection( final SortDir direction ) + { + Direction = direction; + } } diff --git a/src/main/java/appeng/util/LookDirection.java b/src/main/java/appeng/util/LookDirection.java index 525a8a118..a05cce613 100644 --- a/src/main/java/appeng/util/LookDirection.java +++ b/src/main/java/appeng/util/LookDirection.java @@ -25,12 +25,22 @@ import net.minecraft.util.Vec3; public class LookDirection { - public final Vec3 a; - public final Vec3 b; + private final Vec3 a; + private final Vec3 b; public LookDirection( final Vec3 a, final Vec3 b ) { this.a = a; this.b = b; } + + public Vec3 getA() + { + return this.a; + } + + public Vec3 getB() + { + return this.b; + } } diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 7570a7f6f..9d09b49ce 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -289,7 +289,7 @@ public class Platform /* * Simple way to cycle an enum... */ - public static T prevEnum( final T ce ) + private static T prevEnum( final T ce ) { final EnumSet valList = EnumSet.allOf( ce.getClass() ); @@ -434,7 +434,7 @@ public class Platform * Lots of silliness to try and account for weird tag related junk, basically requires that two tags have at least * something in their tags before it wasts its time comparing them. */ - public static boolean sameStackStags( final ItemStack a, final ItemStack b ) + private static boolean sameStackStags( final ItemStack a, final ItemStack b ) { if( a == null && b == null ) { @@ -1809,21 +1809,21 @@ public class Platform public static boolean securityCheck( final GridNode a, final GridNode b ) { - if( a.lastSecurityKey == -1 && b.lastSecurityKey == -1 ) + if( a.getLastSecurityKey() == -1 && b.getLastSecurityKey() == -1 ) { return false; } - else if( a.lastSecurityKey == b.lastSecurityKey ) + else if( a.getLastSecurityKey() == b.getLastSecurityKey() ) { return false; } - final boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1; - final boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1; + final boolean a_isSecure = isPowered( a.getGrid() ) && a.getLastSecurityKey() != -1; + final boolean b_isSecure = isPowered( b.getGrid() ) && b.getLastSecurityKey() != -1; if( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) ) { - AELog.info( "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.lastSecurityKey + " vs " + b.lastSecurityKey + " & " + a.playerID + " vs " + b.playerID ); + AELog.info( "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.getLastSecurityKey() + " vs " + b.getLastSecurityKey() + " & " + a.getPlayerID() + " vs " + b.getPlayerID() ); } // can't do that son... @@ -1834,12 +1834,12 @@ public class Platform if( !a_isSecure && b_isSecure ) { - return checkPlayerPermissions( b.getGrid(), a.playerID ); + return checkPlayerPermissions( b.getGrid(), a.getPlayerID() ); } if( a_isSecure && !b_isSecure ) { - return checkPlayerPermissions( a.getGrid(), b.playerID ); + return checkPlayerPermissions( a.getGrid(), b.getPlayerID() ); } return false; diff --git a/src/main/java/appeng/util/inv/AdaptorIInventory.java b/src/main/java/appeng/util/inv/AdaptorIInventory.java index 731a00abb..635ba2c7b 100644 --- a/src/main/java/appeng/util/inv/AdaptorIInventory.java +++ b/src/main/java/appeng/util/inv/AdaptorIInventory.java @@ -316,7 +316,7 @@ public class AdaptorIInventory extends InventoryAdaptor return left; } - boolean canRemoveStackFromSlot( final int x, final ItemStack is ) + private boolean canRemoveStackFromSlot( final int x, final ItemStack is ) { if( this.wrapperEnabled ) { @@ -331,11 +331,11 @@ public class AdaptorIInventory extends InventoryAdaptor return new InvIterator(); } - class InvIterator implements Iterator + private class InvIterator implements Iterator { - final ItemSlot is = new ItemSlot(); - int x = 0; + private final ItemSlot is = new ItemSlot(); + private int x = 0; @Override public boolean hasNext() @@ -348,10 +348,10 @@ public class AdaptorIInventory extends InventoryAdaptor { final ItemStack iss = AdaptorIInventory.this.i.getStackInSlot( this.x ); - this.is.isExtractable = AdaptorIInventory.this.canRemoveStackFromSlot( this.x, iss ); + this.is.setExtractable( AdaptorIInventory.this.canRemoveStackFromSlot( this.x, iss ) ); this.is.setItemStack( iss ); - this.is.slot = this.x; + this.is.setSlot( this.x ); this.x++; return this.is; } diff --git a/src/main/java/appeng/util/inv/IMEAdaptor.java b/src/main/java/appeng/util/inv/IMEAdaptor.java index 94656cd3d..3fc68cbd7 100644 --- a/src/main/java/appeng/util/inv/IMEAdaptor.java +++ b/src/main/java/appeng/util/inv/IMEAdaptor.java @@ -38,9 +38,9 @@ import com.google.common.collect.ImmutableList; public class IMEAdaptor extends InventoryAdaptor { - final IMEInventory target; - final BaseActionSource src; - int maxSlots = 0; + private final IMEInventory target; + private final BaseActionSource src; + private int maxSlots = 0; public IMEAdaptor( final IMEInventory input, final BaseActionSource src ) { @@ -54,7 +54,7 @@ public class IMEAdaptor extends InventoryAdaptor return new IMEAdaptorIterator( this, this.getList() ); } - IItemList getList() + private IItemList getList() { return this.target.getAvailableItems( AEApi.instance().storage().createItemList() ); } @@ -65,7 +65,7 @@ public class IMEAdaptor extends InventoryAdaptor return this.doRemoveItems( amount, filter, destination, Actionable.MODULATE ); } - public ItemStack doRemoveItems( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type ) + private ItemStack doRemoveItems( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type ) { IAEItemStack req = null; @@ -114,7 +114,7 @@ public class IMEAdaptor extends InventoryAdaptor return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.MODULATE, fuzzyMode ); } - public ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode ) + private ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode ) { final IAEItemStack reqFilter = AEItemStack.create( filter ); if( reqFilter == null ) @@ -185,4 +185,14 @@ public class IMEAdaptor extends InventoryAdaptor { return !this.getList().isEmpty(); } + + int getMaxSlots() + { + return this.maxSlots; + } + + void setMaxSlots( final int maxSlots ) + { + this.maxSlots = maxSlots; + } } diff --git a/src/main/java/appeng/util/inv/IMEAdaptorIterator.java b/src/main/java/appeng/util/inv/IMEAdaptorIterator.java index abff1337e..cf064a323 100644 --- a/src/main/java/appeng/util/inv/IMEAdaptorIterator.java +++ b/src/main/java/appeng/util/inv/IMEAdaptorIterator.java @@ -38,7 +38,7 @@ public final class IMEAdaptorIterator implements Iterator public IMEAdaptorIterator( final IMEAdaptor parent, final IItemList availableItems ) { this.stack = availableItems.iterator(); - this.containerSize = parent.maxSlots; + this.containerSize = parent.getMaxSlots(); this.parent = parent; } @@ -52,13 +52,13 @@ public final class IMEAdaptorIterator implements Iterator @Override public ItemSlot next() { - this.slot.slot = this.offset; + this.slot.setSlot( this.offset ); this.offset++; - this.slot.isExtractable = true; + this.slot.setExtractable( true ); - if( this.parent.maxSlots < this.offset ) + if( this.parent.getMaxSlots() < this.offset ) { - this.parent.maxSlots = this.offset; + this.parent.setMaxSlots( this.offset ); } if( this.hasNext ) diff --git a/src/main/java/appeng/util/inv/IMEInventoryDestination.java b/src/main/java/appeng/util/inv/IMEInventoryDestination.java index 5d8e1b5ce..a62fa809e 100644 --- a/src/main/java/appeng/util/inv/IMEInventoryDestination.java +++ b/src/main/java/appeng/util/inv/IMEInventoryDestination.java @@ -29,7 +29,7 @@ import appeng.util.item.AEItemStack; public class IMEInventoryDestination implements IInventoryDestination { - final IMEInventory me; + private final IMEInventory me; public IMEInventoryDestination( final IMEInventory o ) { diff --git a/src/main/java/appeng/util/inv/ItemListIgnoreCrafting.java b/src/main/java/appeng/util/inv/ItemListIgnoreCrafting.java index d361da087..429917c0e 100644 --- a/src/main/java/appeng/util/inv/ItemListIgnoreCrafting.java +++ b/src/main/java/appeng/util/inv/ItemListIgnoreCrafting.java @@ -30,7 +30,7 @@ import appeng.api.storage.data.IItemList; public class ItemListIgnoreCrafting implements IItemList { - final IItemList target; + private final IItemList target; public ItemListIgnoreCrafting( final IItemList cla ) { diff --git a/src/main/java/appeng/util/inv/ItemSlot.java b/src/main/java/appeng/util/inv/ItemSlot.java index bfc8fad11..f8275ad28 100644 --- a/src/main/java/appeng/util/inv/ItemSlot.java +++ b/src/main/java/appeng/util/inv/ItemSlot.java @@ -27,8 +27,8 @@ import appeng.util.item.AEItemStack; public class ItemSlot { - public int slot; - public boolean isExtractable; + private int slot; + private boolean isExtractable; // one or the other.. private IAEItemStack aeItemStack; private ItemStack itemStack; @@ -49,9 +49,29 @@ public class ItemSlot return this.aeItemStack == null ? ( this.itemStack == null ? null : ( this.aeItemStack = AEItemStack.create( this.itemStack ) ) ) : this.aeItemStack; } - public void setAEItemStack( final IAEItemStack is ) + void setAEItemStack( final IAEItemStack is ) { this.aeItemStack = is; this.itemStack = null; } + + public boolean isExtractable() + { + return this.isExtractable; + } + + void setExtractable( final boolean isExtractable ) + { + this.isExtractable = isExtractable; + } + + public int getSlot() + { + return this.slot; + } + + public void setSlot( final int slot ) + { + this.slot = slot; + } } diff --git a/src/main/java/appeng/util/inv/WrapperChainedInventory.java b/src/main/java/appeng/util/inv/WrapperChainedInventory.java index 774492385..d8ef269ff 100644 --- a/src/main/java/appeng/util/inv/WrapperChainedInventory.java +++ b/src/main/java/appeng/util/inv/WrapperChainedInventory.java @@ -35,7 +35,7 @@ import net.minecraft.util.IChatComponent; public class WrapperChainedInventory implements IInventory { - int fullSize = 0; + private int fullSize = 0; private List l; private Map offsets; @@ -44,13 +44,13 @@ public class WrapperChainedInventory implements IInventory this.setInventory( inventories ); } - public void setInventory( final IInventory... a ) + private void setInventory( final IInventory... a ) { this.l = ImmutableList.copyOf( a ); this.calculateSizes(); } - public void calculateSizes() + private void calculateSizes() { this.offsets = new HashMap(); @@ -78,7 +78,7 @@ public class WrapperChainedInventory implements IInventory this.setInventory( inventories ); } - public void setInventory( final List a ) + private void setInventory( final List a ) { this.l = a; this.calculateSizes(); @@ -230,12 +230,12 @@ public class WrapperChainedInventory implements IInventory return false; } - static class InvOffset + private static class InvOffset { - int offset; - int size; - IInventory i; + private int offset; + private int size; + private IInventory i; } @Override diff --git a/src/main/java/appeng/util/inv/WrapperInvSlot.java b/src/main/java/appeng/util/inv/WrapperInvSlot.java index 8203f850d..d1f879aed 100644 --- a/src/main/java/appeng/util/inv/WrapperInvSlot.java +++ b/src/main/java/appeng/util/inv/WrapperInvSlot.java @@ -45,7 +45,7 @@ public class WrapperInvSlot return true; } - class InternalInterfaceWrapper implements IInventory + private class InternalInterfaceWrapper implements IInventory { private final IInventory inv; diff --git a/src/main/java/appeng/util/inv/WrapperInventoryRange.java b/src/main/java/appeng/util/inv/WrapperInventoryRange.java index dbe1dd6c0..fc5f0a1ed 100644 --- a/src/main/java/appeng/util/inv/WrapperInventoryRange.java +++ b/src/main/java/appeng/util/inv/WrapperInventoryRange.java @@ -29,31 +29,31 @@ public class WrapperInventoryRange implements IInventory { private final IInventory src; - protected boolean ignoreValidItems = false; - int[] slots; + private boolean ignoreValidItems = false; + private int[] slots; public WrapperInventoryRange( final IInventory a, final int[] s, final boolean ignoreValid ) { this.src = a; - this.slots = s; + this.setSlots( s ); - if( this.slots == null ) + if( this.getSlots() == null ) { - this.slots = new int[0]; + this.setSlots( new int[0] ); } - this.ignoreValidItems = ignoreValid; + this.setIgnoreValidItems( ignoreValid ); } public WrapperInventoryRange( final IInventory a, final int min, final int size, final boolean ignoreValid ) { this.src = a; - this.slots = new int[size]; + this.setSlots( new int[size] ); for( int x = 0; x < size; x++ ) { - this.slots[x] = min + x; + this.getSlots()[x] = min + x; } - this.ignoreValidItems = ignoreValid; + this.setIgnoreValidItems( ignoreValid ); } public static String concatLines( final int[] s, final String separator ) @@ -77,31 +77,31 @@ public class WrapperInventoryRange implements IInventory @Override public int getSizeInventory() { - return this.slots.length; + return this.getSlots().length; } @Override public ItemStack getStackInSlot( final int var1 ) { - return this.src.getStackInSlot( this.slots[var1] ); + return this.src.getStackInSlot( this.getSlots()[var1] ); } @Override public ItemStack decrStackSize( final int var1, final int var2 ) { - return this.src.decrStackSize( this.slots[var1], var2 ); + return this.src.decrStackSize( this.getSlots()[var1], var2 ); } @Override public ItemStack getStackInSlotOnClosing( final int var1 ) { - return this.src.getStackInSlotOnClosing( this.slots[var1] ); + return this.src.getStackInSlotOnClosing( this.getSlots()[var1] ); } @Override public void setInventorySlotContents( final int var1, final ItemStack var2 ) { - this.src.setInventorySlotContents( this.slots[var1], var2 ); + this.src.setInventorySlotContents( this.getSlots()[var1], var2 ); } @Override @@ -183,11 +183,31 @@ public class WrapperInventoryRange implements IInventory @Override public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) { - if( this.ignoreValidItems ) + if( this.isIgnoreValidItems() ) { return true; } - return this.src.isItemValidForSlot( this.slots[i], itemstack ); + return this.src.isItemValidForSlot( this.getSlots()[i], itemstack ); + } + + boolean isIgnoreValidItems() + { + return this.ignoreValidItems; + } + + private void setIgnoreValidItems( final boolean ignoreValidItems ) + { + this.ignoreValidItems = ignoreValidItems; + } + + int[] getSlots() + { + return this.slots; + } + + private void setSlots( final int[] slots ) + { + this.slots = slots; } } diff --git a/src/main/java/appeng/util/inv/WrapperMCISidedInventory.java b/src/main/java/appeng/util/inv/WrapperMCISidedInventory.java index 2093f1345..fa2180058 100644 --- a/src/main/java/appeng/util/inv/WrapperMCISidedInventory.java +++ b/src/main/java/appeng/util/inv/WrapperMCISidedInventory.java @@ -27,7 +27,7 @@ import net.minecraft.util.EnumFacing; public class WrapperMCISidedInventory extends WrapperInventoryRange implements IInventoryWrapper { - final ISidedInventory side; + private final ISidedInventory side; private final EnumFacing dir; public WrapperMCISidedInventory( final ISidedInventory a, final EnumFacing d ) @@ -51,14 +51,14 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) { - if( this.ignoreValidItems ) + if( this.isIgnoreValidItems() ) { return true; } - if( this.side.isItemValidForSlot( this.slots[i], itemstack ) ) + if( this.side.isItemValidForSlot( this.getSlots()[i], itemstack ) ) { - return this.side.canInsertItem( this.slots[i], itemstack, this.dir ); + return this.side.canInsertItem( this.getSlots()[i], itemstack, this.dir ); } return false; @@ -72,6 +72,6 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I return false; } - return this.side.canExtractItem( this.slots[i], is, this.dir ); + return this.side.canExtractItem( this.getSlots()[i], is, this.dir ); } } diff --git a/src/main/java/appeng/util/item/AEFluidStack.java b/src/main/java/appeng/util/item/AEFluidStack.java index 701e73fed..93a1a35d0 100644 --- a/src/main/java/appeng/util/item/AEFluidStack.java +++ b/src/main/java/appeng/util/item/AEFluidStack.java @@ -47,15 +47,15 @@ import appeng.util.Platform; public final class AEFluidStack extends AEStack implements IAEFluidStack, Comparable { - public int myHash; - Fluid fluid; + private int myHash; + private Fluid fluid; private IAETagCompound tagCompound; private AEFluidStack( final AEFluidStack is ) { this.fluid = is.fluid; - this.stackSize = is.stackSize; + this.setStackSize( is.getStackSize() ); // priority = is.priority; this.setCraftable( is.isCraftable() ); @@ -73,7 +73,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu throw new IllegalArgumentException( "Fluid is null." ); } - this.stackSize = is.amount; + this.setStackSize( is.amount ); this.setCraftable( false ); this.setCountRequestable( 0 ); @@ -89,7 +89,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu } final AEFluidStack fluid = AEFluidStack.create( itemstack ); // fluid.priority = i.getInteger( "Priority" ); - fluid.stackSize = i.getLong( "Cnt" ); + fluid.setStackSize( i.getLong( "Cnt" ) ); fluid.setCountRequestable( i.getLong( "Req" ) ); fluid.setCraftable( i.getBoolean( "Craft" ) ); return fluid; @@ -154,7 +154,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu final AEFluidStack fluid = AEFluidStack.create( fluidStack ); // fluid.priority = (int) priority; - fluid.stackSize = stackSize; + fluid.setStackSize( stackSize ); fluid.setCountRequestable( countRequestable ); fluid.setCraftable( isCraftable ); return fluid; @@ -202,7 +202,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu /* * if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else */ - i.setLong( "Cnt", this.stackSize ); + i.setLong( "Cnt", this.getStackSize() ); /* * if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else @@ -337,7 +337,9 @@ public final class AEFluidStack extends AEStack implements IAEFlu public String toString() { return this.getFluidStack().toString(); - } @Override + } + + @Override public boolean hasTagCompound() { return this.tagCompound != null; @@ -346,7 +348,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu @Override public FluidStack getFluidStack() { - final FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.stackSize ) ); + final FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.getStackSize() ) ); if( this.tagCompound != null ) { is.tag = this.tagCompound.getNBTTagCompoundCopy(); @@ -361,8 +363,6 @@ public final class AEFluidStack extends AEStack implements IAEFlu return this.fluid; } - - @Override void writeIdentity( final ByteBuf i ) throws IOException { diff --git a/src/main/java/appeng/util/item/AEItemDef.java b/src/main/java/appeng/util/item/AEItemDef.java index 0380be6a3..acbf530e5 100644 --- a/src/main/java/appeng/util/item/AEItemDef.java +++ b/src/main/java/appeng/util/item/AEItemDef.java @@ -35,21 +35,22 @@ public class AEItemDef static final AESharedNBT LOW_TAG = new AESharedNBT( Integer.MIN_VALUE ); static final AESharedNBT HIGH_TAG = new AESharedNBT( Integer.MAX_VALUE ); - public final int itemID; - public final Item item; - public int myHash; - public int def; - public int damageValue; - public int displayDamage; - public int maxDamage; - public AESharedNBT tagCompound; + + private final int itemID; + private final Item item; + private int myHash; + private int def; + private int damageValue; + private int displayDamage; + private int maxDamage; + private AESharedNBT tagCompound; @SideOnly( Side.CLIENT ) - public String displayName; + private String displayName; @SideOnly( Side.CLIENT ) - public List tooltip; + private List tooltip; @SideOnly( Side.CLIENT ) - public UniqueIdentifier uniqueID; - public OreReference isOre; + private UniqueIdentifier uniqueID; + private OreReference isOre; public AEItemDef( final Item it ) { @@ -57,15 +58,15 @@ public class AEItemDef this.itemID = Item.getIdFromItem( it ); } - public AEItemDef copy() + AEItemDef copy() { - final AEItemDef t = new AEItemDef( this.item ); + final AEItemDef t = new AEItemDef( this.getItem() ); t.def = this.def; - t.damageValue = this.damageValue; - t.displayDamage = this.displayDamage; - t.maxDamage = this.maxDamage; - t.tagCompound = this.tagCompound; - t.isOre = this.isOre; + t.setDamageValue( this.getDamageValue() ); + t.setDisplayDamage( this.getDisplayDamage() ); + t.setMaxDamage( this.getMaxDamage() ); + t.setTagCompound( this.getTagCompound() ); + t.setIsOre( this.getIsOre() ); return t; } @@ -81,24 +82,24 @@ public class AEItemDef return false; } final AEItemDef other = (AEItemDef) obj; - return other.damageValue == this.damageValue && other.item == this.item && this.tagCompound == other.tagCompound; + return other.getDamageValue() == this.getDamageValue() && other.getItem() == this.getItem() && this.getTagCompound() == other.getTagCompound(); } - public boolean isItem( final ItemStack otherStack ) + boolean isItem( final ItemStack otherStack ) { // hackery! final int dmg = this.getDamageValueHack( otherStack ); - if( this.item == otherStack.getItem() && dmg == this.damageValue ) + if( this.getItem() == otherStack.getItem() && dmg == this.getDamageValue() ) { - if( ( this.tagCompound != null ) == otherStack.hasTagCompound() ) + if( ( this.getTagCompound() != null ) == otherStack.hasTagCompound() ) { return true; } - if( this.tagCompound != null && otherStack.hasTagCompound() ) + if( this.getTagCompound() != null && otherStack.hasTagCompound() ) { - return Platform.NBTEqualityTest( this.tagCompound, otherStack.getTagCompound() ); + return Platform.NBTEqualityTest( this.getTagCompound(), otherStack.getTagCompound() ); } return true; @@ -106,14 +107,116 @@ public class AEItemDef return false; } - public int getDamageValueHack( final ItemStack is ) + int getDamageValueHack( final ItemStack is ) { return Items.blaze_rod.getDamage( is ); } - public void reHash() + void reHash() { - this.def = this.itemID << Platform.DEF_OFFSET | this.damageValue; - this.myHash = this.def ^ ( this.tagCompound == null ? 0 : System.identityHashCode( this.tagCompound ) ); + this.def = this.getItemID() << Platform.DEF_OFFSET | this.getDamageValue(); + this.myHash = this.def ^ ( this.getTagCompound() == null ? 0 : System.identityHashCode( this.getTagCompound() ) ); } + + AESharedNBT getTagCompound() + { + return this.tagCompound; + } + + void setTagCompound( final AESharedNBT tagCompound ) + { + this.tagCompound = tagCompound; + } + + int getDamageValue() + { + return this.damageValue; + } + + int setDamageValue( final int damageValue ) + { + this.damageValue = damageValue; + return damageValue; + } + + Item getItem() + { + return this.item; + } + + int getDisplayDamage() + { + return this.displayDamage; + } + + void setDisplayDamage( final int displayDamage ) + { + this.displayDamage = displayDamage; + } + + String getDisplayName() + { + return this.displayName; + } + + void setDisplayName( final String displayName ) + { + this.displayName = displayName; + } + + List getTooltip() + { + return this.tooltip; + } + + List setTooltip( final List tooltip ) + { + this.tooltip = tooltip; + return tooltip; + } + + UniqueIdentifier getUniqueID() + { + return this.uniqueID; + } + + UniqueIdentifier setUniqueID( final UniqueIdentifier uniqueID ) + { + this.uniqueID = uniqueID; + return uniqueID; + } + + OreReference getIsOre() + { + return this.isOre; + } + + void setIsOre( final OreReference isOre ) + { + this.isOre = isOre; + } + + int getItemID() + { + return this.itemID; + } + + int getMaxDamage() + { + return this.maxDamage; + } + + void setMaxDamage( final int maxDamage ) + { + this.maxDamage = maxDamage; + } + + /** + * TODO: Check if replaceable by hashCode(); + */ + int getMyHash() + { + return this.myHash; + } + } diff --git a/src/main/java/appeng/util/item/AEItemStack.java b/src/main/java/appeng/util/item/AEItemStack.java index 7363d5ff1..abd53e4c4 100644 --- a/src/main/java/appeng/util/item/AEItemStack.java +++ b/src/main/java/appeng/util/item/AEItemStack.java @@ -49,12 +49,12 @@ import appeng.util.Platform; public final class AEItemStack extends AEStack implements IAEItemStack, Comparable { - AEItemDef def; + private AEItemDef def; private AEItemStack( final AEItemStack is ) { - this.def = is.def; - this.stackSize = is.stackSize; + this.setDefinition( is.getDefinition() ); + this.setStackSize( is.getStackSize() ); this.setCraftable( is.isCraftable() ); this.setCountRequestable( is.getCountRequestable() ); } @@ -72,9 +72,9 @@ public final class AEItemStack extends AEStack implements IAEItemS throw new InvalidParameterException( "Contained item is null, thus not a valid ItemStack for AEItemStack." ); } - this.def = new AEItemDef( item ); + this.setDefinition( new AEItemDef( item ) ); - if( this.def.item == null ) + if( this.getDefinition().getItem() == null ) { throw new InvalidParameterException( "This ItemStack is bad, it has a null item." ); } @@ -85,29 +85,28 @@ public final class AEItemStack extends AEStack implements IAEItemS /* * Super hackery. - * * is.itemID = appeng.api.Materials.matQuartz.itemID; damageValue = is.getItemDamage(); is.itemID = itemID; */ /* * Kinda hackery */ - this.def.damageValue = this.def.getDamageValueHack( is ); - this.def.displayDamage = ( int ) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE ); - this.def.maxDamage = is.getMaxDamage(); + this.getDefinition().setDamageValue( this.def.getDamageValueHack( is ) ); + this.getDefinition().setDisplayDamage( (int) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE ) ); + this.getDefinition().setMaxDamage( is.getMaxDamage() ); final NBTTagCompound tagCompound = is.getTagCompound(); if( tagCompound != null ) { - this.def.tagCompound = (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is ); + this.getDefinition().setTagCompound( (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is ) ); } - this.stackSize = is.stackSize; + this.setStackSize( is.stackSize ); this.setCraftable( false ); this.setCountRequestable( 0 ); - this.def.reHash(); - this.def.isOre = OreHelper.INSTANCE.isOre( is ); + this.getDefinition().reHash(); + this.getDefinition().setIsOre( OreHelper.INSTANCE.isOre( is ) ); } public static IAEItemStack loadItemStackFromNBT( final NBTTagCompound i ) @@ -125,7 +124,7 @@ public final class AEItemStack extends AEStack implements IAEItemS final AEItemStack item = AEItemStack.create( itemstack ); // item.priority = i.getInteger( "Priority" ); - item.stackSize = i.getLong( "Cnt" ); + item.setStackSize( i.getLong( "Cnt" ) ); item.setCountRequestable( i.getLong( "Req" ) ); item.setCraftable( i.getBoolean( "Craft" ) ); return item; @@ -181,7 +180,7 @@ public final class AEItemStack extends AEStack implements IAEItemS final AEItemStack item = AEItemStack.create( itemstack ); // item.priority = (int) priority; - item.stackSize = stackSize; + item.setStackSize( stackSize ); item.setCountRequestable( countRequestable ); item.setCraftable( isCraftable ); return item; @@ -218,7 +217,7 @@ public final class AEItemStack extends AEStack implements IAEItemS /* * if ( id != null && id instanceof NBTTagShort ) ((NBTTagShort) id).data = (short) this.def.item.itemID; else */ - i.setShort( "id", (short) Item.itemRegistry.getIDForObject( this.def.item ) ); + i.setShort( "id", (short) Item.itemRegistry.getIDForObject( this.getDefinition().getItem() ) ); /* * if ( Count != null && Count instanceof NBTTagByte ) ((NBTTagByte) Count).data = (byte) 0; else @@ -228,7 +227,7 @@ public final class AEItemStack extends AEStack implements IAEItemS /* * if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else */ - i.setLong( "Cnt", this.stackSize ); + i.setLong( "Cnt", this.getStackSize() ); /* * if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else @@ -245,11 +244,11 @@ public final class AEItemStack extends AEStack implements IAEItemS * if ( Damage != null && Damage instanceof NBTTagShort ) ((NBTTagShort) Damage).data = (short) * this.def.damageValue; else */ - i.setShort( "Damage", (short) this.def.damageValue ); + i.setShort( "Damage", (short) this.getDefinition().getDamageValue() ); - if( this.def.tagCompound != null ) + if( this.getDefinition().getTagCompound() != null ) { - i.setTag( "tag", this.def.tagCompound ); + i.setTag( "tag", this.getDefinition().getTagCompound() ); } else { @@ -271,7 +270,7 @@ public final class AEItemStack extends AEStack implements IAEItemS if( o.getItem() == this.getItem() ) { - if( this.def.item.isDamageable() ) + if( this.getDefinition().getItem().isDamageable() ) { final ItemStack a = this.getItemStack(); final ItemStack b = o.getItemStack(); @@ -286,16 +285,16 @@ public final class AEItemStack extends AEStack implements IAEItemS { final Item ai = a.getItem(); final Item bi = b.getItem(); - + return ( ai.getDurabilityForDisplay( a ) < 0.001f ) == ( bi.getDurabilityForDisplay( b ) < 0.001f ); } else { final Item ai = a.getItem(); final Item bi = b.getItem(); - - final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a); - final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(b); + + final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay( a ); + final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay( b ); return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint ); } @@ -332,7 +331,7 @@ public final class AEItemStack extends AEStack implements IAEItemS if( o.getItem() == this.getItem() ) { - if( this.def.item.isDamageable() ) + if( this.getDefinition().getItem().isDamageable() ) { final ItemStack a = this.getItemStack(); @@ -354,8 +353,8 @@ public final class AEItemStack extends AEStack implements IAEItemS final Item ai = a.getItem(); final Item bi = o.getItem(); - final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a); - final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(o); + final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay( a ); + final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay( o ); return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint ); } @@ -404,7 +403,7 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public IAETagCompound getTagCompound() { - return this.def.tagCompound; + return this.getDefinition().getTagCompound(); } @Override @@ -428,10 +427,10 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public ItemStack getItemStack() { - final ItemStack is = new ItemStack( this.def.item, (int) Math.min( Integer.MAX_VALUE, this.stackSize ), this.def.damageValue ); - if( this.def.tagCompound != null ) + final ItemStack is = new ItemStack( this.getDefinition().getItem(), (int) Math.min( Integer.MAX_VALUE, this.getStackSize() ), this.getDefinition().getDamageValue() ); + if( this.getDefinition().getTagCompound() != null ) { - is.setTagCompound( this.def.tagCompound.getNBTTagCompoundCopy() ); + is.setTagCompound( this.getDefinition().getTagCompound().getNBTTagCompoundCopy() ); } return is; @@ -440,13 +439,13 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public Item getItem() { - return this.def.item; + return this.getDefinition().getItem(); } @Override public int getItemDamage() { - return this.def.damageValue; + return this.getDefinition().getDamageValue(); } @Override @@ -463,7 +462,7 @@ public final class AEItemStack extends AEStack implements IAEItemS return false; } - return this.def.equals( ( (AEItemStack) otherStack ).def ); + return this.getDefinition().equals( ( (AEItemStack) otherStack ).getDefinition() ); } @Override @@ -474,13 +473,13 @@ public final class AEItemStack extends AEStack implements IAEItemS return false; } - return this.def.isItem( otherStack ); + return this.getDefinition().isItem( otherStack ); } @Override public int hashCode() { - return this.def.myHash; + return this.getDefinition().getMyHash(); } @Override @@ -488,15 +487,16 @@ public final class AEItemStack extends AEStack implements IAEItemS { if( ia instanceof AEItemStack ) { - return ( (AEItemStack) ia ).def.equals( this.def );// && def.tagCompound == ((AEItemStack) ia).def.tagCompound; + return ( (AEItemStack) ia ).getDefinition().equals( this.def );// && def.tagCompound == ((AEItemStack) + // ia).def.tagCompound; } else if( ia instanceof ItemStack ) { final ItemStack is = (ItemStack) ia; - if( is.getItem() == this.def.item && is.getItemDamage() == this.def.damageValue ) + if( is.getItem() == this.getDefinition().getItem() && is.getItemDamage() == this.getDefinition().getDamageValue() ) { - final NBTTagCompound ta = this.def.tagCompound; + final NBTTagCompound ta = this.getDefinition().getTagCompound(); final NBTTagCompound tb = is.getTagCompound(); if( ta == tb ) { @@ -533,33 +533,33 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public int compareTo( final AEItemStack b ) { - final int id = this.def.itemID - b.def.itemID; + final int id = this.getDefinition().getItemID() - b.getDefinition().getItemID(); if( id != 0 ) { return id; } - final int damageValue = this.def.damageValue - b.def.damageValue; + final int damageValue = this.getDefinition().getDamageValue() - b.getDefinition().getDamageValue(); if( damageValue != 0 ) { return damageValue; } - final int displayDamage = this.def.displayDamage - b.def.displayDamage; + final int displayDamage = this.getDefinition().getDisplayDamage() - b.getDefinition().getDisplayDamage(); if( displayDamage != 0 ) { return displayDamage; } - return ( this.def.tagCompound == b.def.tagCompound ) ? 0 : this.compareNBT( b.def ); + return ( this.getDefinition().getTagCompound() == b.getDefinition().getTagCompound() ) ? 0 : this.compareNBT( b.getDefinition() ); } private int compareNBT( final AEItemDef b ) { - final int nbt = this.compare( ( this.def.tagCompound == null ? 0 : this.def.tagCompound.getHash() ), ( b.tagCompound == null ? 0 : b.tagCompound.getHash() ) ); + final int nbt = this.compare( ( this.getDefinition().getTagCompound() == null ? 0 : this.getDefinition().getTagCompound().getHash() ), ( b.getTagCompound() == null ? 0 : b.getTagCompound().getHash() ) ); if( nbt == 0 ) { - return this.compare( System.identityHashCode( this.def.tagCompound ), System.identityHashCode( b.tagCompound ) ); + return this.compare( System.identityHashCode( this.getDefinition().getTagCompound() ), System.identityHashCode( b.getTagCompound() ) ); } return nbt; } @@ -572,34 +572,34 @@ public final class AEItemStack extends AEStack implements IAEItemS @SideOnly( Side.CLIENT ) public List getToolTip() { - if( this.def.tooltip != null ) + if( this.getDefinition().getTooltip() != null ) { - return this.def.tooltip; + return this.getDefinition().getTooltip(); } - return this.def.tooltip = Platform.getTooltip( this.getItemStack() ); + return this.getDefinition().setTooltip( Platform.getTooltip( this.getItemStack() ) ); } @SideOnly( Side.CLIENT ) public String getDisplayName() { - if( this.def.displayName != null ) + if( this.getDefinition().getDisplayName() == null ) { - return this.def.displayName; + this.getDefinition().setDisplayName( Platform.getItemDisplayName( this.getItemStack() ) ); } - return this.def.displayName = Platform.getItemDisplayName( this.getItemStack() ); + return this.getDefinition().getDisplayName(); } @SideOnly( Side.CLIENT ) public String getModID() { - if( this.def.uniqueID != null ) + if( this.getDefinition().getUniqueID() != null ) { - return this.getModName( this.def.uniqueID ); + return this.getModName( this.getDefinition().getUniqueID() ); } - return this.getModName( this.def.uniqueID = GameRegistry.findUniqueIdentifierFor( this.def.item ) ); + return this.getModName( this.getDefinition().setUniqueID( GameRegistry.findUniqueIdentifierFor( this.getDefinition().getItem() ) ) ); } private String getModName( final UniqueIdentifier uniqueIdentifier ) @@ -612,101 +612,101 @@ public final class AEItemStack extends AEStack implements IAEItemS return uniqueIdentifier.modId == null ? "** Null" : uniqueIdentifier.modId; } - public IAEItemStack getLow( final FuzzyMode fuzzy, final boolean ignoreMeta ) + IAEItemStack getLow( final FuzzyMode fuzzy, final boolean ignoreMeta ) { final AEItemStack bottom = new AEItemStack( this ); - final AEItemDef newDef = bottom.def = bottom.def.copy(); + final AEItemDef newDef = bottom.setDefinition( bottom.getDefinition().copy() ); if( ignoreMeta ) { - newDef.displayDamage = newDef.damageValue = 0; + newDef.setDisplayDamage( newDef.setDamageValue( 0 ) ); newDef.reHash(); return bottom; } - if( newDef.item.isDamageable() ) + if( newDef.getItem().isDamageable() ) { if( fuzzy == FuzzyMode.IGNORE_ALL ) { - newDef.displayDamage = 0; + newDef.setDisplayDamage( 0 ); } else if( fuzzy == FuzzyMode.PERCENT_99 ) { - if( this.def.damageValue == 0 ) + if( this.getDefinition().getDamageValue() == 0 ) { - newDef.displayDamage = 0; + newDef.setDisplayDamage( 0 ); } else { - newDef.displayDamage = 1; + newDef.setDisplayDamage( 1 ); } } else { - final int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage ); - newDef.displayDamage = breakpoint <= this.def.displayDamage ? breakpoint : 0; + final int breakpoint = fuzzy.calculateBreakPoint( this.getDefinition().getMaxDamage() ); + newDef.setDisplayDamage( breakpoint <= this.getDefinition().getDisplayDamage() ? breakpoint : 0 ); } - newDef.damageValue = newDef.displayDamage; + newDef.setDamageValue( newDef.getDisplayDamage() ); } - newDef.tagCompound = AEItemDef.LOW_TAG; + newDef.setTagCompound( AEItemDef.LOW_TAG ); newDef.reHash(); return bottom; } - public IAEItemStack getHigh( final FuzzyMode fuzzy, final boolean ignoreMeta ) + IAEItemStack getHigh( final FuzzyMode fuzzy, final boolean ignoreMeta ) { final AEItemStack top = new AEItemStack( this ); - final AEItemDef newDef = top.def = top.def.copy(); + final AEItemDef newDef = top.setDefinition( top.getDefinition().copy() ); if( ignoreMeta ) { - newDef.displayDamage = newDef.damageValue = Integer.MAX_VALUE; + newDef.setDisplayDamage( newDef.setDamageValue( Integer.MAX_VALUE ) ); newDef.reHash(); return top; } - if( newDef.item.isDamageable() ) + if( newDef.getItem().isDamageable() ) { if( fuzzy == FuzzyMode.IGNORE_ALL ) { - newDef.displayDamage = this.def.maxDamage + 1; + newDef.setDisplayDamage( this.getDefinition().getMaxDamage() + 1 ); } else if( fuzzy == FuzzyMode.PERCENT_99 ) { - if( this.def.damageValue == 0 ) + if( this.getDefinition().getDamageValue() == 0 ) { - newDef.displayDamage = 0; + newDef.setDisplayDamage( 0 ); } else { - newDef.displayDamage = this.def.maxDamage + 1; + newDef.setDisplayDamage( this.getDefinition().getMaxDamage() + 1 ); } } else { - final int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage ); - newDef.displayDamage = this.def.displayDamage < breakpoint ? breakpoint - 1 : this.def.maxDamage + 1; + final int breakpoint = fuzzy.calculateBreakPoint( this.getDefinition().getMaxDamage() ); + newDef.setDisplayDamage( this.getDefinition().getDisplayDamage() < breakpoint ? breakpoint - 1 : this.getDefinition().getMaxDamage() + 1 ); } - newDef.damageValue = newDef.displayDamage; + newDef.setDamageValue( newDef.getDisplayDamage() ); } - newDef.tagCompound = AEItemDef.HIGH_TAG; + newDef.setTagCompound( AEItemDef.HIGH_TAG ); newDef.reHash(); return top; } public boolean isOre() { - return this.def.isOre != null; + return this.getDefinition().getIsOre() != null; } @Override void writeIdentity( final ByteBuf i ) throws IOException { - i.writeShort( Item.itemRegistry.getIDForObject( this.def.item ) ); + i.writeShort( Item.itemRegistry.getIDForObject( this.getDefinition().getItem() ) ); i.writeShort( this.getItemDamage() ); } @@ -731,6 +731,17 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public boolean hasTagCompound() { - return this.def.tagCompound != null; + return this.getDefinition().getTagCompound() != null; + } + + AEItemDef getDefinition() + { + return this.def; + } + + private AEItemDef setDefinition( final AEItemDef def ) + { + this.def = def; + return def; } } diff --git a/src/main/java/appeng/util/item/AESharedNBT.java b/src/main/java/appeng/util/item/AESharedNBT.java index e0f84f39c..5780a277d 100644 --- a/src/main/java/appeng/util/item/AESharedNBT.java +++ b/src/main/java/appeng/util/item/AESharedNBT.java @@ -43,7 +43,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound private static final WeakHashMap> SHARED_TAG_COMPOUND = new WeakHashMap>(); private final Item item; private final int meta; - public SharedSearchObject sso; + private SharedSearchObject sso; private int hash; private IItemComparison comp; @@ -71,7 +71,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound /* * Returns an NBT Compound that is used for accelerating comparisons. */ - public static synchronized NBTTagCompound getSharedTagCompound( final NBTTagCompound tagCompound, final ItemStack s ) + static synchronized NBTTagCompound getSharedTagCompound( final NBTTagCompound tagCompound, final ItemStack s ) { if( tagCompound.hasNoTags() ) { @@ -98,18 +98,18 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound final SharedSearchObject cg = c.get(); if( cg != null ) { - return cg.shared; // I don't think I really need to check this + return cg.getShared(); // I don't think I really need to check this } // as its already certain to exist.. } final AESharedNBT clone = AESharedNBT.createFromCompound( item, meta, tagCompound ); - sso.compound = (NBTTagCompound) sso.compound.copy(); // prevent + sso.setCompound( (NBTTagCompound) sso.getCompound().copy() ); // prevent // modification // of data based // on original // item. - sso.shared = clone; + sso.setShared( clone ); clone.sso = sso; SHARED_TAG_COMPOUND.put( sso, new WeakReference( sso ) ); @@ -124,7 +124,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound return ta instanceof AESharedNBT; } - public static AESharedNBT createFromCompound( final Item itemID, final int damageValue, final NBTTagCompound c ) + private static AESharedNBT createFromCompound( final Item itemID, final int damageValue, final NBTTagCompound c ) { final AESharedNBT x = new AESharedNBT( itemID, damageValue ); @@ -144,7 +144,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound return x; } - public int getHash() + int getHash() { return this.hash; } diff --git a/src/main/java/appeng/util/item/AEStack.java b/src/main/java/appeng/util/item/AEStack.java index bb51b81a4..f5eb2e785 100644 --- a/src/main/java/appeng/util/item/AEStack.java +++ b/src/main/java/appeng/util/item/AEStack.java @@ -29,9 +29,9 @@ import appeng.api.storage.data.IAEStack; public abstract class AEStack implements IAEStack { - protected boolean isCraftable; - protected long stackSize; - protected long countRequestable; + private boolean isCraftable; + private long stackSize; + private long countRequestable; static long getPacketValue( final byte type, final ByteBuf tag ) { @@ -151,7 +151,7 @@ public abstract class AEStack implements IAEStack implements IAEStack if( ais.isOre() ) { - final OreReference or = ais.def.isOre; + final OreReference or = ais.getDefinition().getIsOre(); if( or.getAEEquivalents().size() == 1 ) { diff --git a/src/main/java/appeng/util/item/ItemModList.java b/src/main/java/appeng/util/item/ItemModList.java index 66e0be9f8..41d9087c1 100644 --- a/src/main/java/appeng/util/item/ItemModList.java +++ b/src/main/java/appeng/util/item/ItemModList.java @@ -30,8 +30,8 @@ import appeng.api.storage.data.IItemContainer; public class ItemModList implements IItemContainer { - final IItemContainer backingStore; - final IItemContainer overrides = AEApi.instance().storage().createItemList(); + private final IItemContainer backingStore; + private final IItemContainer overrides = AEApi.instance().storage().createItemList(); public ItemModList( final IItemContainer backend ) { diff --git a/src/main/java/appeng/util/item/OreHelper.java b/src/main/java/appeng/util/item/OreHelper.java index c21947702..be015d8fe 100644 --- a/src/main/java/appeng/util/item/OreHelper.java +++ b/src/main/java/appeng/util/item/OreHelper.java @@ -111,10 +111,10 @@ public class OreHelper return this.references.get( ir ); } - public boolean sameOre( final AEItemStack aeItemStack, final IAEItemStack is ) + boolean sameOre( final AEItemStack aeItemStack, final IAEItemStack is ) { - final OreReference a = aeItemStack.def.isOre; - final OreReference b = aeItemStack.def.isOre; + final OreReference a = aeItemStack.getDefinition().getIsOre(); + final OreReference b = aeItemStack.getDefinition().getIsOre(); return this.sameOre( a, b ); } @@ -143,9 +143,9 @@ public class OreHelper return false; } - public boolean sameOre( final AEItemStack aeItemStack, final ItemStack o ) + boolean sameOre( final AEItemStack aeItemStack, final ItemStack o ) { - final OreReference a = aeItemStack.def.isOre; + final OreReference a = aeItemStack.getDefinition().getIsOre(); if( a == null ) { return false; @@ -165,7 +165,7 @@ public class OreHelper return false; } - public List getCachedOres( final String oreName ) + List getCachedOres( final String oreName ) { return this.oreDictCache.getUnchecked( oreName ); } diff --git a/src/main/java/appeng/util/item/OreReference.java b/src/main/java/appeng/util/item/OreReference.java index 11d01a93c..4243413cf 100644 --- a/src/main/java/appeng/util/item/OreReference.java +++ b/src/main/java/appeng/util/item/OreReference.java @@ -37,12 +37,12 @@ public class OreReference private final Set ores = new HashSet(); private List aeOtherOptions = null; - public Collection getEquivalents() + Collection getEquivalents() { return this.otherOptions; } - public List getAEEquivalents() + List getAEEquivalents() { if( this.aeOtherOptions == null ) { @@ -64,7 +64,7 @@ public class OreReference return this.aeOtherOptions; } - public Collection getOres() + Collection getOres() { return this.ores; } diff --git a/src/main/java/appeng/util/item/SharedSearchObject.java b/src/main/java/appeng/util/item/SharedSearchObject.java index a7725caec..eb2b1e17d 100644 --- a/src/main/java/appeng/util/item/SharedSearchObject.java +++ b/src/main/java/appeng/util/item/SharedSearchObject.java @@ -27,16 +27,16 @@ import appeng.util.Platform; public class SharedSearchObject { - final int def; - final int hash; - public AESharedNBT shared; - NBTTagCompound compound; + private final int def; + private final int hash; + private AESharedNBT shared; + private NBTTagCompound compound; public SharedSearchObject( final Item itemID, final int damageValue, final NBTTagCompound tagCompound ) { this.def = ( damageValue << Platform.DEF_OFFSET ) | Item.itemRegistry.getIDForObject( itemID ); this.hash = Platform.NBTOrderlessHash( tagCompound ); - this.compound = tagCompound; + this.setCompound( tagCompound ); } @Override @@ -59,8 +59,28 @@ public class SharedSearchObject final SharedSearchObject other = (SharedSearchObject) obj; if( this.def == other.def && this.hash == other.hash ) { - return Platform.NBTEqualityTest( this.compound, other.compound ); + return Platform.NBTEqualityTest( this.getCompound(), other.getCompound() ); } return false; } + + AESharedNBT getShared() + { + return this.shared; + } + + void setShared( final AESharedNBT shared ) + { + this.shared = shared; + } + + NBTTagCompound getCompound() + { + return this.compound; + } + + void setCompound( final NBTTagCompound compound ) + { + this.compound = compound; + } } diff --git a/src/main/java/appeng/util/iterators/StackToSlotIterator.java b/src/main/java/appeng/util/iterators/StackToSlotIterator.java index 7c2d60126..0ab69e6c5 100644 --- a/src/main/java/appeng/util/iterators/StackToSlotIterator.java +++ b/src/main/java/appeng/util/iterators/StackToSlotIterator.java @@ -28,9 +28,9 @@ import appeng.util.inv.ItemSlot; public class StackToSlotIterator implements Iterator { - final ItemSlot iss = new ItemSlot(); - final Iterator is; - int x = 0; + private final ItemSlot iss = new ItemSlot(); + private final Iterator is; + private int x = 0; public StackToSlotIterator( final Iterator is ) { @@ -46,7 +46,7 @@ public class StackToSlotIterator implements Iterator @Override public ItemSlot next() { - this.iss.slot = this.x; + this.iss.setSlot( this.x ); this.x++; this.iss.setItemStack( this.is.next() ); return this.iss; diff --git a/src/main/java/appeng/util/prioitylist/DefaultPriorityList.java b/src/main/java/appeng/util/prioitylist/DefaultPriorityList.java index bde03441b..04339e5d4 100644 --- a/src/main/java/appeng/util/prioitylist/DefaultPriorityList.java +++ b/src/main/java/appeng/util/prioitylist/DefaultPriorityList.java @@ -28,7 +28,7 @@ import appeng.api.storage.data.IAEStack; public class DefaultPriorityList> implements IPartitionList { - static final List NULL_LIST = new ArrayList(); + private static final List NULL_LIST = new ArrayList(); @Override public boolean isListed( final T input ) diff --git a/src/main/java/appeng/util/prioitylist/FuzzyPriorityList.java b/src/main/java/appeng/util/prioitylist/FuzzyPriorityList.java index 9d2d3c475..267b45171 100644 --- a/src/main/java/appeng/util/prioitylist/FuzzyPriorityList.java +++ b/src/main/java/appeng/util/prioitylist/FuzzyPriorityList.java @@ -29,8 +29,8 @@ import appeng.api.storage.data.IItemList; public class FuzzyPriorityList> implements IPartitionList { - final IItemList list; - final FuzzyMode mode; + private final IItemList list; + private final FuzzyMode mode; public FuzzyPriorityList( final IItemList in, final FuzzyMode mode ) { diff --git a/src/main/java/appeng/util/prioitylist/PrecisePriorityList.java b/src/main/java/appeng/util/prioitylist/PrecisePriorityList.java index c43901868..796fcd9da 100644 --- a/src/main/java/appeng/util/prioitylist/PrecisePriorityList.java +++ b/src/main/java/appeng/util/prioitylist/PrecisePriorityList.java @@ -26,7 +26,7 @@ import appeng.api.storage.data.IItemList; public class PrecisePriorityList> implements IPartitionList { - final IItemList list; + private final IItemList list; public PrecisePriorityList( final IItemList in ) { diff --git a/src/main/java/appeng/worldgen/MeteoritePlacer.java b/src/main/java/appeng/worldgen/MeteoritePlacer.java index a320df826..a2b1b82ce 100644 --- a/src/main/java/appeng/worldgen/MeteoritePlacer.java +++ b/src/main/java/appeng/worldgen/MeteoritePlacer.java @@ -56,8 +56,8 @@ import appeng.worldgen.meteorite.MeteoriteBlockPutter; public final class MeteoritePlacer { - public static final double PRESSES_SPAWN_CHANCE = 0.7; - public static final int SKYSTONE_SPAWN_LIMIT = 12; + private static final double PRESSES_SPAWN_CHANCE = 0.7; + private static final int SKYSTONE_SPAWN_LIMIT = 12; private final Collection validSpawn = new HashSet(); private final Collection invalidSpawn = new HashSet(); private final IBlockDefinition skyChestDefinition; @@ -116,7 +116,7 @@ public final class MeteoritePlacer this.type = new Fallout( this.putter, this.skyStoneDefinition ); } - public boolean spawnMeteorite( final IMeteoriteWorld w, final NBTTagCompound meteoriteBlob ) + boolean spawnMeteorite( final IMeteoriteWorld w, final NBTTagCompound meteoriteBlob ) { this.settings = meteoriteBlob; @@ -442,7 +442,7 @@ public final class MeteoritePlacer } } - public double getSqDistance( final int x, final int z ) + double getSqDistance( final int x, final int z ) { final int chunkX = this.settings.getInteger( "x" ) - x; final int chunkZ = this.settings.getInteger( "z" ) - z; @@ -585,7 +585,7 @@ public final class MeteoritePlacer return false; } - public NBTTagCompound getSettings() + NBTTagCompound getSettings() { return this.settings; } diff --git a/src/main/java/appeng/worldgen/MeteoriteWorldGen.java b/src/main/java/appeng/worldgen/MeteoriteWorldGen.java index 30b1feaad..582b9e912 100644 --- a/src/main/java/appeng/worldgen/MeteoriteWorldGen.java +++ b/src/main/java/appeng/worldgen/MeteoriteWorldGen.java @@ -111,12 +111,12 @@ public final class MeteoriteWorldGen implements IWorldGenerator return WorldData.instance().spawnData().getNearByMeteorites( w.provider.getDimensionId(), chunkX, chunkZ ); } - class MeteoriteSpawn implements IWorldCallable + private class MeteoriteSpawn implements IWorldCallable { - final int x; - final int z; - final int depth; + private final int x; + private final int z; + private final int depth; public MeteoriteSpawn( final int x, final int depth, final int z ) { diff --git a/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java b/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java index 3c62e88e3..046cdc73b 100644 --- a/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java +++ b/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java @@ -1,3 +1,4 @@ + package appeng.worldgen.meteorite; @@ -12,10 +13,10 @@ import appeng.util.Platform; public class ChunkOnly extends StandardWorld { - final Chunk target; - final int cx; - final int cz; - int verticalBits = 0; + private final Chunk target; + private final int cx; + private final int cz; + private int verticalBits = 0; public ChunkOnly( final World w, final int cx, final int cz ) { @@ -65,7 +66,7 @@ public class ChunkOnly extends StandardWorld if( this.range( x, y, z ) ) { this.verticalBits |= 1 << ( y >> 4 ); - this.w.setBlockState( new BlockPos( x, y, z), blk.getDefaultState() ); + this.getWorld().setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() ); } } @@ -75,7 +76,7 @@ public class ChunkOnly extends StandardWorld if( this.range( x, y, z ) ) { this.verticalBits |= 1 << ( y >> 4 ); - this.w.setBlockState( new BlockPos( x, y, z ), state, flags & ( ~2 ) ); + this.getWorld().setBlockState( new BlockPos( x, y, z ), state, flags & ( ~2 ) ); } } diff --git a/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java b/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java index a591431e8..c33fa7f6b 100644 --- a/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java +++ b/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java @@ -8,9 +8,9 @@ import appeng.util.Platform; public class FalloutCopy extends Fallout { - public static final double SPECIFIED_BLOCK_THRESHOLD = 0.9; - public static final double AIR_BLOCK_THRESHOLD = 0.8; - public static final double BLOCK_THRESHOLD_STEP = 0.1; + private static final double SPECIFIED_BLOCK_THRESHOLD = 0.9; + private static final double AIR_BLOCK_THRESHOLD = 0.8; + private static final double BLOCK_THRESHOLD_STEP = 0.1; private final IBlockState block; private final MeteoriteBlockPutter putter; diff --git a/src/main/java/appeng/worldgen/meteorite/FalloutSand.java b/src/main/java/appeng/worldgen/meteorite/FalloutSand.java index af2a67458..d9e435c79 100644 --- a/src/main/java/appeng/worldgen/meteorite/FalloutSand.java +++ b/src/main/java/appeng/worldgen/meteorite/FalloutSand.java @@ -7,7 +7,7 @@ import appeng.api.definitions.IBlockDefinition; public class FalloutSand extends FalloutCopy { - public static final double GLASS_THRESHOLD = 0.66; + private static final double GLASS_THRESHOLD = 0.66; private final MeteoriteBlockPutter putter; public FalloutSand( final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition ) diff --git a/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java b/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java index bb1b8ddcb..4a8a5a399 100644 --- a/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java +++ b/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java @@ -7,8 +7,8 @@ import appeng.api.definitions.IBlockDefinition; public class FalloutSnow extends FalloutCopy { - public static final double SNOW_THRESHOLD = 0.7; - public static final double ICE_THRESHOLD = 0.5; + private static final double SNOW_THRESHOLD = 0.7; + private static final double ICE_THRESHOLD = 0.5; private final MeteoriteBlockPutter putter; public FalloutSnow( final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition ) diff --git a/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java b/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java index a42a0a999..f82f258cc 100644 --- a/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java +++ b/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java @@ -1,3 +1,4 @@ + package appeng.worldgen.meteorite; @@ -21,7 +22,7 @@ public class MeteoriteBlockPutter return true; } - public void put( final IMeteoriteWorld w, final int i, final int j, final int k, final IBlockState state, final int meta ) + void put( final IMeteoriteWorld w, final int i, final int j, final int k, final IBlockState state, final int meta ) { if( w.getBlock( i, j, k ) == Blocks.bedrock ) { diff --git a/src/main/java/appeng/worldgen/meteorite/StandardWorld.java b/src/main/java/appeng/worldgen/meteorite/StandardWorld.java index d20d8c619..ee431ab48 100644 --- a/src/main/java/appeng/worldgen/meteorite/StandardWorld.java +++ b/src/main/java/appeng/worldgen/meteorite/StandardWorld.java @@ -1,3 +1,4 @@ + package appeng.worldgen.meteorite; @@ -13,7 +14,7 @@ import appeng.util.Platform; public class StandardWorld implements IMeteoriteWorld { - protected final World w; + private final World w; public StandardWorld( final World w ) { @@ -47,7 +48,7 @@ public class StandardWorld implements IMeteoriteWorld @Override public boolean hasNoSky() { - return !this.w.provider.getHasNoSky(); + return !this.getWorld().provider.getHasNoSky(); } @Override @@ -55,7 +56,7 @@ public class StandardWorld implements IMeteoriteWorld { if( this.range( x, y, z ) ) { - return this.w.getBlockState( new BlockPos( x, y, z ) ).getBlock(); + return this.getWorld().getBlockState( new BlockPos( x, y, z ) ).getBlock(); } return Platform.AIR_BLOCK; } @@ -65,7 +66,7 @@ public class StandardWorld implements IMeteoriteWorld { if( this.range( x, y, z ) ) { - return this.w.canBlockSeeSky( new BlockPos(x,y,z) ); + return this.getWorld().canBlockSeeSky( new BlockPos( x, y, z ) ); } return false; } @@ -75,7 +76,7 @@ public class StandardWorld implements IMeteoriteWorld { if( this.range( x, y, z ) ) { - return this.w.getTileEntity( new BlockPos( x, y, z) ); + return this.getWorld().getTileEntity( new BlockPos( x, y, z ) ); } return null; } @@ -91,7 +92,7 @@ public class StandardWorld implements IMeteoriteWorld { if( this.range( x, y, z ) ) { - this.w.setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() ); + this.getWorld().setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() ); } } @@ -128,7 +129,7 @@ public class StandardWorld implements IMeteoriteWorld { if( this.range( x, y, z ) ) { - return this.w.getBlockState( new BlockPos(x,y,z) ); + return this.w.getBlockState( new BlockPos( x, y, z ) ); } return Blocks.air.getDefaultState(); }