Code Formatting

This commit is contained in:
yueh
2018-08-30 20:31:27 +02:00
parent 044f4c9ed3
commit 66c365d11f
50 changed files with 170 additions and 111 deletions
+6 -2
View File
@@ -37,12 +37,16 @@ public enum Upgrades
/** /**
* Gold Tier Upgrades. * Gold Tier Upgrades.
*/ */
CAPACITY( 0 ), REDSTONE( 0 ), CRAFTING( 0 ), CAPACITY( 0 ),
REDSTONE( 0 ),
CRAFTING( 0 ),
/** /**
* Diamond Tier Upgrades. * Diamond Tier Upgrades.
*/ */
FUZZY( 1 ), SPEED( 1 ), INVERTER( 1 ); FUZZY( 1 ),
SPEED( 1 ),
INVERTER( 1 );
private final int tier; private final int tier;
private final Map<ItemStack, Integer> supportedMax = new HashMap<>(); private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
@@ -47,7 +47,9 @@ public interface IP2PTunnelRegistry
* @param type - the type of tunnel. Nullable, but then ignored * @param type - the type of tunnel. Nullable, but then ignored
*/ */
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type ); void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type ); void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type ); void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type );
/** /**
@@ -23,6 +23,7 @@
package appeng.api.implementations.tiles; package appeng.api.implementations.tiles;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@@ -23,6 +23,7 @@
package appeng.api.implementations.tiles; package appeng.api.implementations.tiles;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@@ -1,3 +1,4 @@
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
+1 -1
View File
@@ -72,7 +72,7 @@ public interface IPartHost extends ICustomCableConnection
* @return null if the item failed to add, the side it was placed on other wise ( may different for cables, * @return null if the item failed to add, the side it was placed on other wise ( may different for cables,
* {@link AEPartLocation}.UNKNOWN ) * {@link AEPartLocation}.UNKNOWN )
*/ */
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand ); AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand );
/** /**
* Get part by side ( center is {@link AEPartLocation}.UNKNOWN ) * Get part by side ( center is {@link AEPartLocation}.UNKNOWN )
@@ -23,6 +23,7 @@
package appeng.api.parts; package appeng.api.parts;
/** /**
* TODO: Consider removing and replacing with capabilities. * TODO: Consider removing and replacing with capabilities.
*/ */
@@ -30,6 +30,7 @@ import appeng.api.exceptions.MissingIngredientException;
import appeng.api.exceptions.RecipeException; import appeng.api.exceptions.RecipeException;
import appeng.api.exceptions.RegistrationException; import appeng.api.exceptions.RegistrationException;
@Deprecated @Deprecated
public interface ICraftHandler public interface ICraftHandler
{ {
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientException; import appeng.api.exceptions.MissingIngredientException;
import appeng.api.exceptions.RegistrationException; import appeng.api.exceptions.RegistrationException;
@Deprecated @Deprecated
public interface IIngredient public interface IIngredient
{ {
@@ -28,6 +28,7 @@ import java.io.BufferedReader;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@Deprecated @Deprecated
public interface IRecipeLoader public interface IRecipeLoader
{ {
+12 -6
View File
@@ -74,25 +74,30 @@ public enum AEColor
TRANSPARENT( "gui.appliedenergistics2.Fluix", null, 0x1B2344, 0x895CA8, 0xD7BBEC ); TRANSPARENT( "gui.appliedenergistics2.Fluix", null, 0x1B2344, 0x895CA8, 0xD7BBEC );
public static final List<AEColor> VALID_COLORS = Arrays.asList( WHITE, ORANGE, MAGENTA, LIGHT_BLUE, YELLOW, LIME, PINK, GRAY, LIGHT_GRAY, CYAN, PURPLE, BLUE, BROWN, GREEN, RED, BLACK ); public static final List<AEColor> VALID_COLORS = Arrays.asList( WHITE, ORANGE, MAGENTA, LIGHT_BLUE, YELLOW, LIME, PINK, GRAY, LIGHT_GRAY, CYAN, PURPLE,
BLUE, BROWN, GREEN, RED, BLACK );
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #blackVariant dark variant} of the apprioriate AE color. * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #blackVariant dark
* variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_DARK = 1; public static final int TINTINDEX_DARK = 1;
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #mediumVariant medium variant} of the apprioriate AE color. * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #mediumVariant medium
* variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_MEDIUM = 2; public static final int TINTINDEX_MEDIUM = 2;
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #whiteVariant bright variant} of the apprioriate AE color. * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #whiteVariant bright
* variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_BRIGHT = 3; public static final int TINTINDEX_BRIGHT = 3;
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get a color between the {@link #mediumVariant medium} * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get a color between the
* {@link #mediumVariant medium}
* and {@link #whiteVariant bright variant} of the apprioriate AE color. * and {@link #whiteVariant bright variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_MEDIUM_BRIGHT = 4; public static final int TINTINDEX_MEDIUM_BRIGHT = 4;
@@ -141,7 +146,8 @@ public enum AEColor
{ {
switch( tintIndex ) switch( tintIndex )
{ {
// Please note that tintindex 0 is hardcoded for the block breaking particles. Returning anything other than -1 for tintindex=0 here // Please note that tintindex 0 is hardcoded for the block breaking particles. Returning anything other than
// -1 for tintindex=0 here
// will cause issues with those particles // will cause issues with those particles
case 0: case 0:
return -1; return -1;
@@ -23,8 +23,10 @@
package appeng.api.util; package appeng.api.util;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
/** /**
* Implement on Tile or part to customize if the info gui opens, or an action is preformed. * Implement on Tile or part to customize if the info gui opens, or an action is preformed.
*/ */
@@ -1,10 +1,13 @@
package appeng.bootstrap.components; package appeng.bootstrap.components;
import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
import appeng.bootstrap.IBootstrapComponent; import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface @FunctionalInterface
public interface IEntityRegistrationComponent extends IBootstrapComponent public interface IEntityRegistrationComponent extends IBootstrapComponent
{ {
@@ -78,8 +78,9 @@ public class GuiPatternTerm extends GuiMEMonitorable
if( this.tabCraftButton == btn || this.tabProcessButton == btn ) if( this.tabCraftButton == btn || this.tabProcessButton == btn )
{ {
NetworkHandler.instance().sendToServer( NetworkHandler.instance()
new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING ) ); .sendToServer(
new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING ) );
} }
if( this.encodeBtn == btn ) if( this.encodeBtn == btn )
@@ -94,8 +95,9 @@ public class GuiPatternTerm extends GuiMEMonitorable
if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn ) if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn )
{ {
NetworkHandler.instance().sendToServer( NetworkHandler.instance()
new PacketValueConfig( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) ); .sendToServer(
new PacketValueConfig( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
} }
} }
catch( final IOException e ) catch( final IOException e )
@@ -41,6 +41,7 @@ import net.minecraft.util.EnumFacing;
public class DummyFluidBakedModel implements IBakedModel public class DummyFluidBakedModel implements IBakedModel
{ {
private final ImmutableList<BakedQuad> quads; private final ImmutableList<BakedQuad> quads;
public DummyFluidBakedModel( ImmutableList<BakedQuad> quads ) public DummyFluidBakedModel( ImmutableList<BakedQuad> quads )
{ {
this.quads = quads; this.quads = quads;
@@ -78,7 +78,7 @@ public class DummyFluidItemModel implements IModel
{ {
IBakedModel bakedBaseModel = this.getBaseModel().bake( state, format, bakedTextureGetter ); IBakedModel bakedBaseModel = this.getBaseModel().bake( state, format, bakedTextureGetter );
return new DummyFluidDispatcherBakedModel( bakedBaseModel, format, bakedTextureGetter ); return new DummyFluidDispatcherBakedModel( bakedBaseModel, format, bakedTextureGetter );
} }
@Override @Override
@@ -247,8 +247,10 @@ public enum UVLModelLoader implements ICustomModelLoader
{ {
String s = modelLocation.getResourcePath(); String s = modelLocation.getResourcePath();
iresource = Minecraft.getMinecraft().getResourceManager().getResource( iresource = Minecraft.getMinecraft()
new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) ); .getResourceManager()
.getResource(
new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) );
reader = new InputStreamReader( iresource.getInputStream(), Charsets.UTF_8 ); reader = new InputStreamReader( iresource.getInputStream(), Charsets.UTF_8 );
lvt_5_1_ = JsonUtils.gsonDeserialize( this.UVLSERIALIZER, reader, ModelBlock.class, false ); lvt_5_1_ = JsonUtils.gsonDeserialize( this.UVLSERIALIZER, reader, ModelBlock.class, false );
@@ -468,8 +468,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
final ItemStack failed = real.getStackInSlot( x ); final ItemStack failed = real.getStackInSlot( x );
if( !failed.isEmpty() ) if( !failed.isEmpty() )
{ {
this.getCellInventory().injectItems( AEItemStack.fromItemStack( failed ), Actionable.MODULATE, this.getCellInventory()
new MachineSource( this.getPatternTerminal() ) ); .injectItems( AEItemStack.fromItemStack( failed ), Actionable.MODULATE,
new MachineSource( this.getPatternTerminal() ) );
} }
} }
} }
@@ -34,7 +34,7 @@ public class AEFluidTank extends FluidTank implements IAEFluidTank
{ {
super( capacity ); super( capacity );
this.host = host; this.host = host;
if (host instanceof TileEntity) if( host instanceof TileEntity )
{ {
this.setTileEntity( (TileEntity) host ); this.setTileEntity( (TileEntity) host );
} }
@@ -90,7 +90,6 @@ public class FluidSorters
} }
}; };
private static SortDir getDirection() private static SortDir getDirection()
{ {
return Direction; return Direction;
@@ -18,10 +18,12 @@
package appeng.helpers; package appeng.helpers;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
public interface IPriorityHost public interface IPriorityHost
{ {
@@ -77,8 +77,9 @@ final class IntegrationNode
final ModAPIManager apiManager = ModAPIManager.INSTANCE; final ModAPIManager apiManager = ModAPIManager.INSTANCE;
boolean enabled = this.modID == null || Loader.isModLoaded( this.modID ) || apiManager.hasAPI( this.modID ); boolean enabled = this.modID == null || Loader.isModLoaded( this.modID ) || apiManager.hasAPI( this.modID );
AEConfig.instance().addCustomCategoryComment( "ModIntegration", AEConfig.instance()
"Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." ); .addCustomCategoryComment( "ModIntegration",
"Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." );
final String mode = AEConfig.instance().get( "ModIntegration", this.displayName.replace( " ", "" ), "AUTO" ).getString(); final String mode = AEConfig.instance().get( "ModIntegration", this.displayName.replace( " ", "" ), "AUTO" ).getString();
if( mode.toUpperCase().equals( "ON" ) ) if( mode.toUpperCase().equals( "ON" ) )
@@ -79,10 +79,12 @@ public class JEIPlugin implements IModPlugin
this.registerDescriptions( definitions, registry ); this.registerDescriptions( definitions, registry );
// Allow recipe transfer from JEI to crafting and pattern terminal // Allow recipe transfer from JEI to crafting and pattern terminal
registry.getRecipeTransferRegistry().addRecipeTransferHandler( new RecipeTransferHandler<>( ContainerCraftingTerm.class ), registry.getRecipeTransferRegistry()
VanillaRecipeCategoryUid.CRAFTING ); .addRecipeTransferHandler( new RecipeTransferHandler<>( ContainerCraftingTerm.class ),
registry.getRecipeTransferRegistry().addRecipeTransferHandler( new RecipeTransferHandler<>( ContainerPatternTerm.class ), VanillaRecipeCategoryUid.CRAFTING );
VanillaRecipeCategoryUid.CRAFTING ); registry.getRecipeTransferRegistry()
.addRecipeTransferHandler( new RecipeTransferHandler<>( ContainerPatternTerm.class ),
VanillaRecipeCategoryUid.CRAFTING );
} }
private void registerDescriptions( IDefinitions definitions, IModRegistry registry ) private void registerDescriptions( IDefinitions definitions, IModRegistry registry )
@@ -225,7 +225,8 @@ public enum PartType
FORMATION_PLANE( 320, "formation_plane", EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ), FORMATION_PLANE( 320, "formation_plane", EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFluidFormationPlane.class ), FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
.noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
PATTERN_TERMINAL( 340, "pattern_terminal", EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ), PATTERN_TERMINAL( 340, "pattern_terminal", EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
@@ -80,8 +80,11 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
@Override @Override
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips ) public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
{ {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, final IMEInventoryHandler<?> inventory = AEApi.instance()
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); .registries()
.cell()
.getCellInventory( stack, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
if( inventory instanceof ICellInventoryHandler ) if( inventory instanceof ICellInventoryHandler )
{ {
@@ -157,9 +157,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
BlockPos offset = manager.getCellDimensionOrigin( cellid ); BlockPos offset = manager.getCellDimensionOrigin( cellid );
this.setStorageCell( is, cellid, targetSize ); this.setStorageCell( is, cellid, targetSize );
StorageHelper.getInstance().swapRegions( w, min.x + 1, min.y + 1, min.z + 1, manager.getWorld(), offset.getX(), offset.getY(), StorageHelper.getInstance()
offset.getZ(), targetX - 1, targetY - 1, .swapRegions( w, min.x + 1, min.y + 1, min.z + 1, manager.getWorld(), offset.getX(), offset.getY(),
targetZ - 1 ); offset.getZ(), targetX - 1, targetY - 1,
targetZ - 1 );
return new TransitionResult( true, 0 ); return new TransitionResult( true, 0 );
} }
+12 -10
View File
@@ -47,20 +47,22 @@ public class ChestLoot
final IMaterials materials = AEApi.instance().definitions().materials(); final IMaterials materials = AEApi.instance().definitions().materials();
materials.certusQuartzCrystal().maybeStack( 1 ).ifPresent( is -> materials.certusQuartzCrystal().maybeStack( 1 ).ifPresent( is ->
{ {
event.getTable().addPool( new LootPool( new LootEntry[] { event.getTable()
new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { .addPool( new LootPool( new LootEntry[] {
new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] {
new RandomChance( 1 ) }, "AE2 Crystal_" + is.getItemDamage() ) new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] {
}, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) ); new RandomChance( 1 ) }, "AE2 Crystal_" + is.getItemDamage() )
}, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) );
} ); } );
materials.certusQuartzDust().maybeStack( 1 ).ifPresent( is -> materials.certusQuartzDust().maybeStack( 1 ).ifPresent( is ->
{ {
event.getTable().addPool( new LootPool( new LootEntryItem[] { event.getTable()
new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { .addPool( new LootPool( new LootEntryItem[] {
new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] {
new RandomChance( 1 ) }, "AE2 Dust_" + is.getItemDamage() ) new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] {
}, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 DUSTS" ) ); new RandomChance( 1 ) }, "AE2 Dust_" + is.getItemDamage() )
}, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 DUSTS" ) );
} ); } );
} }
@@ -777,8 +777,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( details.isCraftable() ) if( details.isCraftable() )
{ {
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ), FMLCommonHandler.instance()
details.getOutput( ic, this.getWorld() ), ic ); .firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ),
details.getOutput( ic, this.getWorld() ), ic );
for( int x = 0; x < ic.getSizeInventory(); x++ ) for( int x = 0; x < ic.getSizeInventory(); x++ )
{ {
@@ -156,8 +156,10 @@ public class QuantumCluster implements ILocatable, IAECluster
} }
} }
sideA.connection = sideB.connection = new ConnectionWrapper( AEApi.instance().grid().createGridConnection( sideA.getNode(), sideA.connection = sideB.connection = new ConnectionWrapper( AEApi.instance()
sideB.getNode() ) ); .grid()
.createGridConnection( sideA.getNode(),
sideB.getNode() ) );
} }
catch( final FailedConnectionException e ) catch( final FailedConnectionException e )
{ {
@@ -239,9 +239,12 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
{ {
try try
{ {
connections.getConnections().put( me.getGridNode(), connections.getConnections()
new TunnelConnection( me, AEApi.instance().grid().createGridConnection( this.outerProxy.getNode(), .put( me.getGridNode(),
me.outerProxy.getNode() ) ) ); new TunnelConnection( me, AEApi.instance()
.grid()
.createGridConnection( this.outerProxy.getNode(),
me.outerProxy.getNode() ) ) );
} }
catch( final FailedConnectionException e ) catch( final FailedConnectionException e )
{ {
@@ -105,8 +105,11 @@ public final class DisassembleRecipe extends net.minecraftforge.registries.IForg
{ {
ItemStack storageCellStack = maybeCellOutput.get(); ItemStack storageCellStack = maybeCellOutput.get();
// make sure the storage cell stackInSlot empty... // make sure the storage cell stackInSlot empty...
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( stackInSlot, null, final IMEInventory<IAEItemStack> cellInv = AEApi.instance()
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); .registries()
.cell()
.getCellInventory( stackInSlot, null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
if( cellInv != null ) if( cellInv != null )
{ {
final IItemList<IAEItemStack> list = cellInv final IItemList<IAEItemStack> list = cellInv
@@ -521,8 +521,10 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{ {
try try
{ {
return (int) ( this.getProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, return (int) ( this.getProxy()
PowerMultiplier.CONFIG ) / acceleratorTax ); .getEnergy()
.extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE,
PowerMultiplier.CONFIG ) / acceleratorTax );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -177,8 +177,11 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
{ {
if( existing.isEmpty() ) if( existing.isEmpty() )
{ {
this.inv[slot] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.inv[slot] = AEApi.instance()
reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack ); .storage()
.getStorageChannel( IItemStorageChannel.class )
.createStack(
reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack );
} }
else else
{ {
@@ -197,7 +197,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
if( c != null ) if( c != null )
{ {
ItemHandlerUtil.copy( this.config, c, false ); ItemHandlerUtil.copy( this.config, c, false );
//copy items back. The ConfigInventory may changed the items on insert // copy items back. The ConfigInventory may changed the items on insert
ItemHandlerUtil.copy( c, this.config, false ); ItemHandlerUtil.copy( c, this.config, false );
} }
this.locked = false; this.locked = false;
@@ -97,8 +97,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
if( this.getPlayerOpen() == 1 ) 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, this.getWorld()
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F ); .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(); this.markForUpdate();
} }
} }
@@ -120,8 +121,9 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
if( this.getPlayerOpen() == 0 ) 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, this.getWorld()
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F ); .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(); this.markForUpdate();
} }
} }
@@ -203,8 +203,9 @@ public final class MeteoritePlacer
} }
} }
for( final Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class, for( final Object o : w.getWorld()
new AxisAlignedBB( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) ) .getEntitiesWithinAABB( EntityItem.class,
new AxisAlignedBB( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) )
{ {
final Entity e = (Entity) o; final Entity e = (Entity) o;
e.setDead(); e.setDead();
@@ -89,7 +89,7 @@ public class UVLightmapJsonTest
FeatureFactory fact = Api.INSTANCE.definitions().getRegistry(); FeatureFactory fact = Api.INSTANCE.definitions().getRegistry();
fact.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( uvlblock ) ); fact.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( uvlblock ) );
fact.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( uvlblockItem ) ); fact.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( uvlblockItem ) );
fact.addBootstrapComponent( new ItemVariantsComponent( uvlblockItem, Arrays.asList( uvlblockR ) )); fact.addBootstrapComponent( new ItemVariantsComponent( uvlblockItem, Arrays.asList( uvlblockR ) ) );
fact.addBootstrapComponent( new ItemModelComponent( uvlblockItem, ImmutableMap.of( 0, new ModelResourceLocation( uvlblockR, "inventory" ) ) ) ); fact.addBootstrapComponent( new ItemModelComponent( uvlblockItem, ImmutableMap.of( 0, new ModelResourceLocation( uvlblockR, "inventory" ) ) ) );
} }
} }
@@ -1,13 +1,16 @@
package appeng.core.worlddata; package appeng.core.worlddata;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class SpatialDimensionManagerTest public class SpatialDimensionManagerTest
{ {
private static final BlockPos CONTENT = new BlockPos(1, 1, 1); private static final BlockPos CONTENT = new BlockPos( 1, 1, 1 );
private static final int ID_1 = 0; private static final int ID_1 = 0;
private static final int ID_2 = 1; private static final int ID_2 = 1;
@@ -22,40 +25,38 @@ public class SpatialDimensionManagerTest
private static final int ID_B = 10; private static final int ID_B = 10;
private static final int ID_C = 11; private static final int ID_C = 11;
private static final BlockPos POS_1 = new BlockPos( -320, 64, -320 );
private static final BlockPos POS_2 = new BlockPos( 192, 64, -320 );
private static final BlockPos POS_3 = new BlockPos( -320, 64, 192 );
private static final BlockPos POS_4 = new BlockPos( 192, 64, 192 );
private static final BlockPos POS_1 = new BlockPos( -320, 64, -320); private static final BlockPos POS_5 = new BlockPos( -832, 64, -320 );
private static final BlockPos POS_2 = new BlockPos( 192, 64, -320); private static final BlockPos POS_6 = new BlockPos( 704, 64, -320 );
private static final BlockPos POS_3 = new BlockPos( -320, 64, 192); private static final BlockPos POS_7 = new BlockPos( -832, 64, 192 );
private static final BlockPos POS_4 = new BlockPos( 192, 64, 192); private static final BlockPos POS_8 = new BlockPos( 704, 64, 192 );
private static final BlockPos POS_5 = new BlockPos( -832, 64, -320);
private static final BlockPos POS_6 = new BlockPos( 704, 64, -320);
private static final BlockPos POS_7 = new BlockPos( -832, 64, 192);
private static final BlockPos POS_8 = new BlockPos( 704, 64, 192);
private static final BlockPos POS_9 = new BlockPos( -320, 64, -832);
private static final BlockPos POS_A = new BlockPos( 192, 64, -832);
private static final BlockPos POS_B = new BlockPos( -320, 64, 704);
private static final BlockPos POS_C = new BlockPos( 192, 64, 704);
private static final BlockPos POS_9 = new BlockPos( -320, 64, -832 );
private static final BlockPos POS_A = new BlockPos( 192, 64, -832 );
private static final BlockPos POS_B = new BlockPos( -320, 64, 704 );
private static final BlockPos POS_C = new BlockPos( 192, 64, 704 );
@Test @Test
public void testBlockPosGeneration() public void testBlockPosGeneration()
{ {
SpatialDimensionManager manager = new SpatialDimensionManager( null ); SpatialDimensionManager manager = new SpatialDimensionManager( null );
Assert.assertEquals( ID_1, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_1, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_2, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_2, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_3, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_3, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_4, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_4, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_5, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_5, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_6, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_6, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_7, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_7, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_8, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_8, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_9, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_9, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_A, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_A, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_B, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_B, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_C, manager.createNewCellDimension( CONTENT, -1 )); Assert.assertEquals( ID_C, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( POS_1, manager.getCellDimensionOrigin( ID_1 ) ); Assert.assertEquals( POS_1, manager.getCellDimensionOrigin( ID_1 ) );
Assert.assertEquals( POS_2, manager.getCellDimensionOrigin( ID_2 ) ); Assert.assertEquals( POS_2, manager.getCellDimensionOrigin( ID_2 ) );