Format sourcecode

This commit is contained in:
yueh
2017-07-20 21:17:10 +02:00
parent 66437897be
commit 621910df91
295 changed files with 2142 additions and 1562 deletions
+4 -2
View File
@@ -130,7 +130,8 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
}
@Override
public boolean hasCustomName() {
public boolean hasCustomName()
{
return this.hasCustomInventoryName();
}
@@ -145,7 +146,8 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
{
final double squaredMCReach = 64.0D;
return this.world.getTileEntity( this.pos ) == this && p.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D ) <= squaredMCReach;
return this.world.getTileEntity( this.pos ) == this && p.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D,
this.pos.getZ() + 0.5D ) <= squaredMCReach;
}
@Override
@@ -552,7 +552,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
try
{
return (int) ( this.getProxy().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 )
{
@@ -21,7 +21,8 @@ package appeng.tile.events;
public enum TileEventType
{
WORLD_NBT_READ, WORLD_NBT_WRITE,
WORLD_NBT_READ,
WORLD_NBT_WRITE,
/**
* Methods annotated with this need to return a boolean
@@ -168,7 +168,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
final double xOff = -0.15 * this.getUp().getFrontOffsetX();
final double yOff = -0.15 * this.getUp().getFrontOffsetY();
final double zOff = -0.15 * this.getUp().getFrontOffsetZ();
out.add( new AxisAlignedBB( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
out.add( new AxisAlignedBB( xOff + 0.15, yOff + 0.15, zOff + 0.15, // ahh
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@@ -113,7 +113,8 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
return ItemStack.EMPTY;
}
private ItemStack getOldStack( int slot ) {
private ItemStack getOldStack( int slot )
{
if( this.inv[slot] == null )
return ItemStack.EMPTY;
@@ -123,7 +124,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
@Override
public void setInventorySlotContents( final int slot, final ItemStack newItemStack )
{
final ItemStack oldStack = getOldStack(slot);
final ItemStack oldStack = getOldStack( slot );
this.inv[slot] = newItemStack;
if( this.getTileEntity() != null && this.eventsEnabled() )
@@ -257,7 +257,8 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
{
try
{
this.injectExternalPower( PowerUnits.AE, this.getProxy().getEnergy().extractAEPower( Math.min( 500.0, 1500.0 - this.getInternalCurrentPower() ), Actionable.MODULATE, PowerMultiplier.ONE ) );
this.injectExternalPower( PowerUnits.AE, this.getProxy().getEnergy().extractAEPower( Math.min( 500.0, 1500.0 - this.getInternalCurrentPower() ),
Actionable.MODULATE, PowerMultiplier.ONE ) );
}
catch( final GridAccessException e )
{
@@ -118,7 +118,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
final double requiredPower = this.getRequiredPower();
final ItemStack output = this.getOutput();
while( requiredPower <= this.getStoredPower() && !output.isEmpty() && requiredPower > 0 )
while( requiredPower <= this.getStoredPower() && !output.isEmpty() && requiredPower > 0 )
{
if( this.canAddOutput( output ) )
{
@@ -293,21 +293,21 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
// :P
}
}
//
// @Override
// public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
// {
// if( !this.isItemValidForSlot( slotIndex, insertingItem ) )
// {
// return false;
// }
// if( !getStackInSlot( slotIndex ).isEmpty() )
// {
// return false;
// }
// return true;
// }
//
// @Override
// public boolean canInsertItem( final int slotIndex, final ItemStack insertingItem, final EnumFacing side )
// {
// if( !this.isItemValidForSlot( slotIndex, insertingItem ) )
// {
// return false;
// }
// if( !getStackInSlot( slotIndex ).isEmpty() )
// {
// return false;
// }
// return true;
// }
@Override
public boolean canExtractItem( final int slotIndex, final ItemStack extractedItem, final EnumFacing side )
{
@@ -347,8 +347,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
@Override
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
{
return this.duality.hasCapability( capability, facing )
|| super.hasCapability( capability, facing );
return this.duality.hasCapability( capability, facing ) || super.hasCapability( capability, facing );
}
@Override
@@ -69,7 +69,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
* Given a fill factor, return the storage level (0-7) used for the state of the block.
* This is also used for determining the item model.
*/
public static int getStorageLevelFromFillFactor( double fillFactor ) {
public static int getStorageLevelFromFillFactor( double fillFactor )
{
byte boundMetadata = (byte) ( 8.0 * ( fillFactor ) );
if( boundMetadata > 7 )
@@ -1,5 +1,5 @@
package appeng.tile.powersink;
package appeng.tile.powersink;
import net.minecraftforge.energy.IEnergyStorage;
@@ -41,7 +41,7 @@ class ForgeEnergyAdapter implements IEnergyStorage
}
@Override
public final int getMaxEnergyStored( )
public final int getMaxEnergyStored()
{
return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, sink.getAEMaxPower() ) );
}
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.tile.powersink;
@@ -142,7 +142,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
private boolean isCenter()
{
return AEApi.instance().definitions().blocks().quantumLink().maybeBlock()
return AEApi.instance()
.definitions()
.blocks()
.quantumLink()
.maybeBlock()
.map( link -> getBlockType() == link )
.orElse( false );
}
@@ -970,13 +970,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
}
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
private class FluidHandler implements IFluidHandler
{
@@ -241,7 +241,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@MENetworkEventSubscribe
public void channelRender( final MENetworkChannelsChanged c )
{
this.recalculateDisplay();
this.recalculateDisplay();
}
@Override
@@ -92,8 +92,10 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
private final ConfigManager manager;
private final int[] input = { INPUT_SLOT_INDEX_TOP_LEFT, INPUT_SLOT_INDEX_TOP_RIGHT, INPUT_SLOT_INDEX_CENTER_LEFT, INPUT_SLOT_INDEX_CENTER_RIGHT, INPUT_SLOT_INDEX_BOTTOM_LEFT, INPUT_SLOT_INDEX_BOTTOM_RIGHT };
private final int[] output = { OUTPUT_SLOT_INDEX_TOP_LEFT, OUTPUT_SLOT_INDEX_TOP_RIGHT, OUTPUT_SLOT_INDEX_CENTER_LEFT, OUTPUT_SLOT_INDEX_CENTER_RIGHT, OUTPUT_SLOT_INDEX_BOTTOM_LEFT, OUTPUT_SLOT_INDEX_BOTTOM_RIGHT };
private final int[] input = { INPUT_SLOT_INDEX_TOP_LEFT, INPUT_SLOT_INDEX_TOP_RIGHT, INPUT_SLOT_INDEX_CENTER_LEFT, INPUT_SLOT_INDEX_CENTER_RIGHT,
INPUT_SLOT_INDEX_BOTTOM_LEFT, INPUT_SLOT_INDEX_BOTTOM_RIGHT };
private final int[] output = { OUTPUT_SLOT_INDEX_TOP_LEFT, OUTPUT_SLOT_INDEX_TOP_RIGHT, OUTPUT_SLOT_INDEX_CENTER_LEFT, OUTPUT_SLOT_INDEX_CENTER_RIGHT,
OUTPUT_SLOT_INDEX_BOTTOM_LEFT, OUTPUT_SLOT_INDEX_BOTTOM_RIGHT };
private final AppEngInternalInventory cells;
private final UpgradeInventory upgrades;
@@ -134,7 +134,8 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
if( this.getPlayerOpen() == 1 )
{
this.getWorld().playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.getWorld().playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
@@ -157,7 +158,8 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
if( this.getPlayerOpen() == 0 )
{
this.getWorld().playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.getWorld().playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}