Basic reformat, hit once, hope never again
This commit is contained in:
@@ -64,14 +64,14 @@ public final class AEBlockFeatureHandler implements IFeatureHandler
|
||||
@Override
|
||||
public void register()
|
||||
{
|
||||
if ( this.enabled )
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setBlockName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( this.featured.getTileEntityClass(), this.featured );
|
||||
}
|
||||
|
||||
@@ -18,73 +18,74 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
public enum AEFeature
|
||||
{
|
||||
Core(null), // stuff that has no reason for ever being turned off, or that
|
||||
// is just flat out required by tons of
|
||||
// important stuff.
|
||||
Core( null ), // stuff that has no reason for ever being turned off, or that
|
||||
// is just flat out required by tons of
|
||||
// important stuff.
|
||||
|
||||
CertusQuartzWorldGen("World"), MeteoriteWorldGen("World"),
|
||||
CertusQuartzWorldGen( "World" ), MeteoriteWorldGen( "World" ),
|
||||
|
||||
DecorativeLights("World"), DecorativeQuartzBlocks("World"), SkyStoneChests("World"), SpawnPressesInMeteorites("World"),
|
||||
DecorativeLights( "World" ), DecorativeQuartzBlocks( "World" ), SkyStoneChests( "World" ), SpawnPressesInMeteorites( "World" ),
|
||||
|
||||
GrindStone("World"), Flour("World"), Inscriber("World"),
|
||||
GrindStone( "World" ), Flour( "World" ), Inscriber( "World" ),
|
||||
|
||||
ChestLoot("World"), VillagerTrading("World"),
|
||||
ChestLoot( "World" ), VillagerTrading( "World" ),
|
||||
|
||||
TinyTNT("World"),
|
||||
TinyTNT( "World" ),
|
||||
|
||||
PoweredTools("ToolsClassifications"),
|
||||
PoweredTools( "ToolsClassifications" ),
|
||||
|
||||
CertusQuartzTools("ToolsClassifications"),
|
||||
CertusQuartzTools( "ToolsClassifications" ),
|
||||
|
||||
NetherQuartzTools("ToolsClassifications"),
|
||||
NetherQuartzTools( "ToolsClassifications" ),
|
||||
|
||||
QuartzHoe("Tools"), QuartzSpade("Tools"), QuartzSword("Tools"), QuartzPickaxe("Tools"), QuartzAxe("Tools"), QuartzKnife("Tools"), QuartzWrench("Tools"),
|
||||
QuartzHoe( "Tools" ), QuartzSpade( "Tools" ), QuartzSword( "Tools" ), QuartzPickaxe( "Tools" ), QuartzAxe( "Tools" ), QuartzKnife( "Tools" ), QuartzWrench( "Tools" ),
|
||||
|
||||
ChargedStaff("Tools"), EntropyManipulator("Tools"), MatterCannon("Tools"), WirelessAccessTerminal("Tools"), ColorApplicator("Tools"),
|
||||
ChargedStaff( "Tools" ), EntropyManipulator( "Tools" ), MatterCannon( "Tools" ), WirelessAccessTerminal( "Tools" ), ColorApplicator( "Tools" ),
|
||||
|
||||
CraftingCPU("CraftingFeatures"), PowerGen("NetworkFeatures"), Security("NetworkFeatures"),
|
||||
CraftingCPU( "CraftingFeatures" ), PowerGen( "NetworkFeatures" ), Security( "NetworkFeatures" ),
|
||||
|
||||
SpatialIO("NetworkFeatures"), QuantumNetworkBridge("NetworkFeatures"), Channels("NetworkFeatures"),
|
||||
SpatialIO( "NetworkFeatures" ), QuantumNetworkBridge( "NetworkFeatures" ), Channels( "NetworkFeatures" ),
|
||||
|
||||
LevelEmitter("NetworkBuses"), CraftingTerminal("NetworkBuses"), StorageMonitor("NetworkBuses"), P2PTunnel("NetworkBuses"), FormationPlane("NetworkBuses"), AnnihilationPlane(
|
||||
"NetworkBuses"), ImportBus("NetworkBuses"), ExportBus("NetworkBuses"), StorageBus("NetworkBuses"), PartConversionMonitor("NetworkBuses"),
|
||||
LevelEmitter( "NetworkBuses" ), CraftingTerminal( "NetworkBuses" ), StorageMonitor( "NetworkBuses" ), P2PTunnel( "NetworkBuses" ), FormationPlane( "NetworkBuses" ), AnnihilationPlane( "NetworkBuses" ), ImportBus( "NetworkBuses" ), ExportBus( "NetworkBuses" ), StorageBus( "NetworkBuses" ), PartConversionMonitor( "NetworkBuses" ),
|
||||
|
||||
StorageCells("Storage"), PortableCell("PortableCell"), MEChest("Storage"), MEDrive("Storage"), IOPort("Storage"),
|
||||
StorageCells( "Storage" ), PortableCell( "PortableCell" ), MEChest( "Storage" ), MEDrive( "Storage" ), IOPort( "Storage" ),
|
||||
|
||||
NetworkTool("NetworkTool"),
|
||||
NetworkTool( "NetworkTool" ),
|
||||
|
||||
DenseEnergyCells("HigherCapacity"), DenseCables("HigherCapacity"),
|
||||
DenseEnergyCells( "HigherCapacity" ), DenseCables( "HigherCapacity" ),
|
||||
|
||||
P2PTunnelRF("P2PTunnels"), P2PTunnelME("P2PTunnels"), P2PTunnelItems("P2PTunnels"), P2PTunnelRedstone("P2PTunnels"), P2PTunnelEU("P2PTunnels"), P2PTunnelMJ(
|
||||
"P2PTunnels"), P2PTunnelLiquids("P2PTunnels"), P2PTunnelLight("P2PTunnels"),
|
||||
P2PTunnelRF( "P2PTunnels" ), P2PTunnelME( "P2PTunnels" ), P2PTunnelItems( "P2PTunnels" ), P2PTunnelRedstone( "P2PTunnels" ), P2PTunnelEU( "P2PTunnels" ), P2PTunnelMJ( "P2PTunnels" ), P2PTunnelLiquids( "P2PTunnels" ), P2PTunnelLight( "P2PTunnels" ),
|
||||
|
||||
MassCannonBlockDamage("BlockFeatures"), TinyTNTBlockDamage("BlockFeatures"), Facades("Facades"),
|
||||
MassCannonBlockDamage( "BlockFeatures" ), TinyTNTBlockDamage( "BlockFeatures" ), Facades( "Facades" ),
|
||||
|
||||
UnsupportedDeveloperTools("Misc", false), Creative("Misc"),
|
||||
UnsupportedDeveloperTools( "Misc", false ), Creative( "Misc" ),
|
||||
|
||||
GrinderLogging("Misc", false), Logging("Misc"), IntegrationLogging("Misc", false), CustomRecipes("Crafting", false), WebsiteRecipes("Misc", false),
|
||||
GrinderLogging( "Misc", false ), Logging( "Misc" ), IntegrationLogging( "Misc", false ), CustomRecipes( "Crafting", false ), WebsiteRecipes( "Misc", false ),
|
||||
|
||||
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false),
|
||||
enableFacadeCrafting( "Crafting" ), inWorldSingularity( "Crafting" ), inWorldFluix( "Crafting" ), inWorldPurification( "Crafting" ), UpdateLogging( "Misc", false ),
|
||||
|
||||
AlphaPass("Rendering"), PaintBalls("Tools"), PacketLogging("Misc", false), CraftingLog("Misc", false), InterfaceTerminal("Crafting"), LightDetector("Misc"),
|
||||
AlphaPass( "Rendering" ), PaintBalls( "Tools" ), PacketLogging( "Misc", false ), CraftingLog( "Misc", false ), InterfaceTerminal( "Crafting" ), LightDetector( "Misc" ),
|
||||
|
||||
enableDisassemblyCrafting("Crafting"), MolecularAssembler("CraftingFeatures"), MeteoriteCompass("Tools"), Patterns("CraftingFeatures"),
|
||||
enableDisassemblyCrafting( "Crafting" ), MolecularAssembler( "CraftingFeatures" ), MeteoriteCompass( "Tools" ), Patterns( "CraftingFeatures" ),
|
||||
|
||||
ChunkLoggerTrace("Commands", false), LogSecurityAudits("Misc", false), Achievements("Misc");
|
||||
ChunkLoggerTrace( "Commands", false ), LogSecurityAudits( "Misc", false ), Achievements( "Misc" );
|
||||
|
||||
public final String category;
|
||||
public final boolean isVisible;
|
||||
public final boolean defaultValue;
|
||||
|
||||
AEFeature( String cat ) {
|
||||
AEFeature( String cat )
|
||||
{
|
||||
this.category = cat;
|
||||
this.isVisible = !this.name().equals( "Core" );
|
||||
this.defaultValue = true;
|
||||
}
|
||||
|
||||
AEFeature( String cat, boolean defaultValue ) {
|
||||
AEFeature( String cat, boolean defaultValue )
|
||||
{
|
||||
this.category = cat;
|
||||
this.isVisible = !this.name().equals( "Core" );
|
||||
this.defaultValue = defaultValue;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
@Override
|
||||
public Optional<ItemBlock> maybeItemBlock()
|
||||
{
|
||||
if ( this.enabled )
|
||||
if( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemBlock( this.block ) );
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
@Override
|
||||
public final Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
if ( this.enabled )
|
||||
if( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemStack( this.block ) );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -26,68 +27,68 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
|
||||
|
||||
public final class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
{
|
||||
|
||||
final ItemStackSrc[] colors = new ItemStackSrc[17];
|
||||
|
||||
public void add( AEColor v, ItemStackSrc is )
|
||||
{
|
||||
this.colors[v.ordinal()] = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item(AEColor color)
|
||||
public Block block( AEColor color )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item( AEColor color )
|
||||
{
|
||||
ItemStackSrc is = this.colors[color.ordinal()];
|
||||
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return null;
|
||||
|
||||
return is.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(AEColor color, int stackSize)
|
||||
public Class<? extends TileEntity> entity( AEColor color )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack( AEColor color, int stackSize )
|
||||
{
|
||||
ItemStackSrc is = this.colors[color.ordinal()];
|
||||
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return null;
|
||||
|
||||
return is.stack( stackSize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAs(AEColor color, ItemStack comparableItem)
|
||||
{
|
||||
ItemStackSrc is = this.colors[color.ordinal()];
|
||||
|
||||
if ( comparableItem == null || is == null )
|
||||
return false;
|
||||
|
||||
return comparableItem.getItem() == is.item && comparableItem.getItemDamage() == is.damage;
|
||||
}
|
||||
|
||||
public void add(AEColor v, ItemStackSrc is)
|
||||
{
|
||||
this.colors[v.ordinal()] = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block block(AEColor color)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity(AEColor color)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] allStacks(int stackSize)
|
||||
public ItemStack[] allStacks( int stackSize )
|
||||
{
|
||||
ItemStack[] is = new ItemStack[this.colors.length];
|
||||
for (int x = 0; x < is.length; x++)
|
||||
for( int x = 0; x < is.length; x++ )
|
||||
is[x] = this.colors[x].stack( 1 );
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAs( AEColor color, ItemStack comparableItem )
|
||||
{
|
||||
ItemStackSrc is = this.colors[color.ordinal()];
|
||||
|
||||
if( comparableItem == null || is == null )
|
||||
return false;
|
||||
|
||||
return comparableItem.getItem() == is.item && comparableItem.getItemDamage() == is.damage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class DamagedItemDefinition implements IItemDefinition
|
||||
@Override
|
||||
public boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
if ( comparableStack == null )
|
||||
if( comparableStack == null )
|
||||
return false;
|
||||
|
||||
return comparableStack.getItem() == this.source.getItem() && comparableStack.getItemDamage() == this.source.getDamage();
|
||||
|
||||
@@ -92,6 +92,7 @@ public final class DefinitionConverter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class AEItem extends AEComparable
|
||||
{
|
||||
private final IItemDefinition definition;
|
||||
@@ -118,6 +119,7 @@ public final class DefinitionConverter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class AEBlock extends AEItem
|
||||
{
|
||||
private final IBlockDefinition definition;
|
||||
@@ -137,6 +139,7 @@ public final class DefinitionConverter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class AETile extends AEBlock
|
||||
{
|
||||
private final ITileDefinition definition;
|
||||
@@ -155,6 +158,4 @@ public final class DefinitionConverter
|
||||
return this.definition.maybeEntity().orNull();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -43,29 +43,29 @@ public class FeatureNameExtractor
|
||||
{
|
||||
String name = this.clazz.getSimpleName();
|
||||
|
||||
if ( name.startsWith( "ItemMultiPart" ) )
|
||||
if( name.startsWith( "ItemMultiPart" ) )
|
||||
{
|
||||
name = PATTERN_ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
|
||||
}
|
||||
else if ( name.startsWith( "ItemMultiMaterial" ) )
|
||||
else if( name.startsWith( "ItemMultiMaterial" ) )
|
||||
{
|
||||
name = PATTERN_ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
|
||||
}
|
||||
|
||||
if ( this.subName.isPresent() )
|
||||
if( this.subName.isPresent() )
|
||||
{
|
||||
final String subName = this.subName.get();
|
||||
// simple hack to allow me to do get nice names for these without
|
||||
// mode code outside of AEBaseItem
|
||||
if ( subName.startsWith( "P2PTunnel" ) )
|
||||
if( subName.startsWith( "P2PTunnel" ) )
|
||||
{
|
||||
return "ItemPart.P2PTunnel";
|
||||
}
|
||||
else if ( subName.equals( "CertusQuartzTools" ) )
|
||||
else if( subName.equals( "CertusQuartzTools" ) )
|
||||
{
|
||||
return PATTERN_QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
|
||||
}
|
||||
else if ( subName.equals( "NetherQuartzTools" ) )
|
||||
else if( subName.equals( "NetherQuartzTools" ) )
|
||||
{
|
||||
return PATTERN_QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ public class FeaturedActiveChecker
|
||||
|
||||
public ActivityState getActivityState()
|
||||
{
|
||||
for ( AEFeature f : this.features )
|
||||
for( AEFeature f : this.features )
|
||||
{
|
||||
if ( !AEConfig.instance.isFeatureEnabled( f ) )
|
||||
if( !AEConfig.instance.isFeatureEnabled( f ) )
|
||||
{
|
||||
return ActivityState.Disabled;
|
||||
}
|
||||
|
||||
@@ -18,16 +18,17 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public interface IStackSrc
|
||||
{
|
||||
|
||||
ItemStack stack(int i);
|
||||
ItemStack stack( int i );
|
||||
|
||||
Item getItem();
|
||||
|
||||
int getDamage();
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ItemDefinition implements IItemDefinition
|
||||
@Override
|
||||
public Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
if ( this.enabled )
|
||||
if( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemStack( this.item ) );
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ public final class ItemFeatureHandler implements IFeatureHandler
|
||||
@Override
|
||||
public void register()
|
||||
{
|
||||
if ( this.enabled )
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.item.setTextureName( "appliedenergistics2:" + name );
|
||||
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
|
||||
|
||||
if ( this.item instanceof ItemFacade )
|
||||
if( this.item instanceof ItemFacade )
|
||||
{
|
||||
this.item.setCreativeTab( CreativeTabFacade.instance );
|
||||
}
|
||||
@@ -80,11 +80,11 @@ public final class ItemFeatureHandler implements IFeatureHandler
|
||||
this.item.setCreativeTab( CreativeTab.instance );
|
||||
}
|
||||
|
||||
if ( name.equals( "ItemMaterial" ) )
|
||||
if( name.equals( "ItemMaterial" ) )
|
||||
{
|
||||
name = "ItemMultiMaterial";
|
||||
}
|
||||
else if ( name.equals( "ItemPart" ) )
|
||||
else if( name.equals( "ItemPart" ) )
|
||||
{
|
||||
name = "ItemMultiPart";
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public class ItemStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
@@ -29,25 +31,27 @@ public class ItemStackSrc implements IStackSrc
|
||||
public final Block block;
|
||||
public final int damage;
|
||||
|
||||
public ItemStackSrc(Item i, int dmg) {
|
||||
public ItemStackSrc( Item i, int dmg )
|
||||
{
|
||||
this.block = null;
|
||||
this.item = i;
|
||||
this.damage = dmg;
|
||||
}
|
||||
|
||||
public ItemStackSrc(Block b, int dmg) {
|
||||
public ItemStackSrc( Block b, int dmg )
|
||||
{
|
||||
this.item = null;
|
||||
this.block = b;
|
||||
this.damage = dmg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(int i)
|
||||
public ItemStack stack( int i )
|
||||
{
|
||||
if ( this.block != null )
|
||||
if( this.block != null )
|
||||
return new ItemStack( this.block, i, this.damage );
|
||||
|
||||
if ( this.item != null )
|
||||
if( this.item != null )
|
||||
return new ItemStack( this.item, i, this.damage );
|
||||
|
||||
return null;
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class NameResolver
|
||||
|
||||
private final Class<? extends AEBaseItem> withOriginalName;
|
||||
|
||||
public NameResolver( Class<? extends AEBaseItem> withOriginalName)
|
||||
public NameResolver( Class<? extends AEBaseItem> withOriginalName )
|
||||
{
|
||||
this.withOriginalName = withOriginalName;
|
||||
}
|
||||
@@ -50,21 +50,21 @@ public final class NameResolver
|
||||
{
|
||||
String name = this.withOriginalName.getSimpleName();
|
||||
|
||||
if ( name.startsWith( "ItemMultiPart" ) )
|
||||
if( name.startsWith( "ItemMultiPart" ) )
|
||||
name = ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
|
||||
else if ( name.startsWith( "ItemMultiMaterial" ) )
|
||||
else if( name.startsWith( "ItemMultiMaterial" ) )
|
||||
name = ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
|
||||
|
||||
if ( subName != null )
|
||||
if( subName != null )
|
||||
{
|
||||
// simple hack to allow me to do get nice names for these without
|
||||
// mode code outside of AEBaseItem
|
||||
if ( subName.startsWith( "P2PTunnel" ) )
|
||||
if( subName.startsWith( "P2PTunnel" ) )
|
||||
return "ItemPart.P2PTunnel";
|
||||
|
||||
if ( subName.equals( "CertusQuartzTools" ) )
|
||||
if( subName.equals( "CertusQuartzTools" ) )
|
||||
return QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
|
||||
if ( subName.equals( "NetherQuartzTools" ) )
|
||||
if( subName.equals( "NetherQuartzTools" ) )
|
||||
return QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
|
||||
|
||||
name += '.' + subName;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class StairBlockFeatureHandler implements IFeatureHandler
|
||||
@Override
|
||||
public final void register()
|
||||
{
|
||||
if ( this.enabled )
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.stairs.setCreativeTab( CreativeTab.instance );
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class WrappedDamageItemDefinition implements ITileDefinition
|
||||
@Override
|
||||
public boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
if ( comparableStack == null )
|
||||
if( comparableStack == null )
|
||||
return false;
|
||||
|
||||
return this.definition.isSameAs( comparableStack ) && comparableStack.getItemDamage() == this.damage;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,41 +30,43 @@ import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
|
||||
public class CellRegistry implements ICellRegistry
|
||||
{
|
||||
|
||||
final List<ICellHandler> handlers;
|
||||
|
||||
public CellRegistry() {
|
||||
public CellRegistry()
|
||||
{
|
||||
this.handlers = new ArrayList<ICellHandler>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCellHandler(ICellHandler h)
|
||||
public void addCellHandler( ICellHandler h )
|
||||
{
|
||||
if ( h != null )
|
||||
if( h != null )
|
||||
this.handlers.add( h );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellHandled(ItemStack is)
|
||||
public boolean isCellHandled( ItemStack is )
|
||||
{
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return false;
|
||||
for (ICellHandler ch : this.handlers)
|
||||
if ( ch.isCell( is ) )
|
||||
for( ICellHandler ch : this.handlers )
|
||||
if( ch.isCell( is ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICellHandler getHandler(ItemStack is)
|
||||
public ICellHandler getHandler( ItemStack is )
|
||||
{
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return null;
|
||||
for (ICellHandler ch : this.handlers)
|
||||
for( ICellHandler ch : this.handlers )
|
||||
{
|
||||
if ( ch.isCell( is ) )
|
||||
if( ch.isCell( is ) )
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
@@ -72,13 +75,13 @@ public class CellRegistry implements ICellRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack is, ISaveProvider container, StorageChannel chan)
|
||||
public IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider container, StorageChannel chan )
|
||||
{
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return null;
|
||||
for (ICellHandler ch : this.handlers)
|
||||
for( ICellHandler ch : this.handlers )
|
||||
{
|
||||
if ( ch.isCell( is ) )
|
||||
if( ch.isCell( is ) )
|
||||
{
|
||||
return ch.getCellInventory( is, container, chan );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,35 +31,36 @@ import appeng.api.storage.IExternalStorageRegistry;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.core.features.registries.entries.ExternalIInv;
|
||||
|
||||
|
||||
public class ExternalStorageRegistry implements IExternalStorageRegistry
|
||||
{
|
||||
|
||||
final List<IExternalStorageHandler> Handlers;
|
||||
final ExternalIInv lastHandler = new ExternalIInv();
|
||||
|
||||
public ExternalStorageRegistry() {
|
||||
public ExternalStorageRegistry()
|
||||
{
|
||||
this.Handlers = new ArrayList<IExternalStorageHandler>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageHandler getHandler(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc)
|
||||
{
|
||||
for (IExternalStorageHandler x : this.Handlers)
|
||||
{
|
||||
if ( x.canHandle( te, d, chan, mySrc ) )
|
||||
return x;
|
||||
}
|
||||
|
||||
if ( this.lastHandler.canHandle( te, d, chan, mySrc ) )
|
||||
return this.lastHandler;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExternalStorageInterface(IExternalStorageHandler ei)
|
||||
public void addExternalStorageInterface( IExternalStorageHandler ei )
|
||||
{
|
||||
this.Handlers.add( ei );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageHandler getHandler( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
|
||||
{
|
||||
for( IExternalStorageHandler x : this.Handlers )
|
||||
{
|
||||
if( x.canHandle( te, d, chan, mySrc ) )
|
||||
return x;
|
||||
}
|
||||
|
||||
if( this.lastHandler.canHandle( te, d, chan, mySrc ) )
|
||||
return this.lastHandler;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -26,33 +27,34 @@ import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.core.AELog;
|
||||
|
||||
|
||||
public class GridCacheRegistry implements IGridCacheRegistry
|
||||
{
|
||||
|
||||
final private HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>>();
|
||||
|
||||
@Override
|
||||
public void registerGridCache(Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation)
|
||||
public void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation )
|
||||
{
|
||||
if ( iface.isAssignableFrom( implementation ) )
|
||||
if( iface.isAssignableFrom( implementation ) )
|
||||
this.caches.put( iface, implementation );
|
||||
else
|
||||
throw new RuntimeException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance(IGrid g)
|
||||
public HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid g )
|
||||
{
|
||||
HashMap<Class<? extends IGridCache>, IGridCache> map = new HashMap<Class<? extends IGridCache>, IGridCache>();
|
||||
|
||||
for (Class<? extends IGridCache> iface : this.caches.keySet())
|
||||
for( Class<? extends IGridCache> iface : this.caches.keySet() )
|
||||
{
|
||||
try
|
||||
{
|
||||
Constructor<? extends IGridCache> c = this.caches.get( iface ).getConstructor( IGrid.class );
|
||||
map.put( iface, c.newInstance( g ) );
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
|
||||
throw new RuntimeException( e );
|
||||
|
||||
@@ -85,7 +85,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
@Override
|
||||
public void addRecipe( ItemStack in, ItemStack out, int cost )
|
||||
{
|
||||
if ( in == null || out == null )
|
||||
if( in == null || out == null )
|
||||
{
|
||||
this.log( "Invalid Grinder Recipe Specified." );
|
||||
return;
|
||||
@@ -98,7 +98,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
@Override
|
||||
public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, int cost )
|
||||
{
|
||||
if ( in == null || ( optional == null && out == null ) )
|
||||
if( in == null || ( optional == null && out == null ) )
|
||||
{
|
||||
this.log( "Invalid Grinder Recipe Specified." );
|
||||
return;
|
||||
@@ -111,7 +111,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
@Override
|
||||
public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost )
|
||||
{
|
||||
if ( in == null || ( optional == null && out == null && optional2 == null ) )
|
||||
if( in == null || ( optional == null && out == null && optional2 == null ) )
|
||||
{
|
||||
this.log( "Invalid Grinder Recipe Specified." );
|
||||
return;
|
||||
@@ -123,8 +123,8 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
private void injectRecipe( AppEngGrinderRecipe appEngGrinderRecipe )
|
||||
{
|
||||
for ( IGrinderEntry gr : this.recipes )
|
||||
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||
for( IGrinderEntry gr : this.recipes )
|
||||
if( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
|
||||
return;
|
||||
|
||||
this.recipes.add( appEngGrinderRecipe );
|
||||
@@ -132,7 +132,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
private ItemStack copy( ItemStack is )
|
||||
{
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
return is.copy();
|
||||
return null;
|
||||
}
|
||||
@@ -141,11 +141,11 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
public IGrinderEntry getRecipeForInput( ItemStack input )
|
||||
{
|
||||
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
|
||||
if ( input != null )
|
||||
if( input != null )
|
||||
{
|
||||
for ( IGrinderEntry r : this.recipes )
|
||||
for( IGrinderEntry r : this.recipes )
|
||||
{
|
||||
if ( Platform.isSameItem( input, r.getInput() ) )
|
||||
if( Platform.isSameItem( input, r.getInput() ) )
|
||||
{
|
||||
this.log( "Recipe for " + input.getUnlocalizedName() + " found " + Platform.getItemDisplayName( r.getOutput() ) );
|
||||
return r;
|
||||
@@ -165,28 +165,28 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
private int getDustToOreRatio( String name )
|
||||
{
|
||||
if ( name.equals( "Obsidian" ) )
|
||||
if( name.equals( "Obsidian" ) )
|
||||
return 1;
|
||||
if ( name.equals( "Charcoal" ) )
|
||||
if( name.equals( "Charcoal" ) )
|
||||
return 1;
|
||||
if ( name.equals( "Coal" ) )
|
||||
if( name.equals( "Coal" ) )
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
private void addOre( String name, ItemStack item )
|
||||
{
|
||||
if ( item == null )
|
||||
if( item == null )
|
||||
return;
|
||||
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
|
||||
this.ores.put( item, name );
|
||||
|
||||
if ( this.dusts.containsKey( name ) )
|
||||
if( this.dusts.containsKey( name ) )
|
||||
{
|
||||
ItemStack is = this.dusts.get( name ).copy();
|
||||
int ratio = this.getDustToOreRatio( name );
|
||||
if ( ratio > 1 )
|
||||
if( ratio > 1 )
|
||||
{
|
||||
ItemStack extra = is.copy();
|
||||
extra.stackSize = ratio - 1;
|
||||
@@ -199,13 +199,13 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
private void addIngot( String name, ItemStack item )
|
||||
{
|
||||
if ( item == null )
|
||||
if( item == null )
|
||||
return;
|
||||
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
|
||||
this.ingots.put( item, name );
|
||||
|
||||
if ( this.dusts.containsKey( name ) )
|
||||
if( this.dusts.containsKey( name ) )
|
||||
{
|
||||
this.addRecipe( item, this.dusts.get( name ), 4 );
|
||||
}
|
||||
@@ -213,9 +213,9 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
private void addDust( String name, ItemStack item )
|
||||
{
|
||||
if ( item == null )
|
||||
if( item == null )
|
||||
return;
|
||||
if ( this.dusts.containsKey( name ) )
|
||||
if( this.dusts.containsKey( name ) )
|
||||
{
|
||||
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
|
||||
return;
|
||||
@@ -225,13 +225,13 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
this.dusts.put( name, item );
|
||||
|
||||
for ( Entry<ItemStack, String> d : this.ores.entrySet() )
|
||||
if ( name.equals( d.getValue() ) )
|
||||
for( Entry<ItemStack, String> d : this.ores.entrySet() )
|
||||
if( name.equals( d.getValue() ) )
|
||||
{
|
||||
ItemStack is = item.copy();
|
||||
is.stackSize = 1;
|
||||
int ratio = this.getDustToOreRatio( name );
|
||||
if ( ratio > 1 )
|
||||
if( ratio > 1 )
|
||||
{
|
||||
ItemStack extra = is.copy();
|
||||
extra.stackSize = ratio - 1;
|
||||
@@ -241,27 +241,27 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
this.addRecipe( d.getKey(), is, 8 );
|
||||
}
|
||||
|
||||
for ( Entry<ItemStack, String> d : this.ingots.entrySet() )
|
||||
if ( name.equals( d.getValue() ) )
|
||||
for( Entry<ItemStack, String> d : this.ingots.entrySet() )
|
||||
if( name.equals( d.getValue() ) )
|
||||
this.addRecipe( d.getKey(), item, 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oreRegistered( String name, ItemStack item )
|
||||
{
|
||||
if ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) )
|
||||
if( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) )
|
||||
{
|
||||
for ( String ore : AEConfig.instance.grinderOres )
|
||||
for( String ore : AEConfig.instance.grinderOres )
|
||||
{
|
||||
if ( name.equals( "ore" + ore ) )
|
||||
if( name.equals( "ore" + ore ) )
|
||||
{
|
||||
this.addOre( ore, item );
|
||||
}
|
||||
else if ( name.equals( "crystal" + ore ) || name.equals( "ingot" + ore ) || name.equals( "gem" + ore ) )
|
||||
else if( name.equals( "crystal" + ore ) || name.equals( "ingot" + ore ) || name.equals( "gem" + ore ) )
|
||||
{
|
||||
this.addIngot( ore, item );
|
||||
}
|
||||
else if ( name.equals( "dust" + ore ) )
|
||||
else if( name.equals( "dust" + ore ) )
|
||||
{
|
||||
this.addDust( ore, item );
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ public final class LocatableRegistry implements ILocatableRegistry
|
||||
@SubscribeEvent
|
||||
public void updateLocatable( LocatableEventAnnounce e )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return; // IGNORE!
|
||||
|
||||
if ( e.change == LocatableEvent.Register )
|
||||
if( e.change == LocatableEvent.Register )
|
||||
{
|
||||
this.set.put( e.target.getLocatableSerial(), e.target );
|
||||
}
|
||||
else if ( e.change == LocatableEvent.Unregister )
|
||||
else if( e.change == LocatableEvent.Unregister )
|
||||
{
|
||||
this.set.remove( e.target.getLocatableSerial() );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
@@ -28,29 +29,39 @@ import appeng.recipes.ores.IOreListener;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
|
||||
{
|
||||
|
||||
private final HashMap<ItemStack, Double> DamageModifiers = new HashMap<ItemStack, Double>();
|
||||
|
||||
public MatterCannonAmmoRegistry()
|
||||
{
|
||||
OreDictionaryHandler.INSTANCE.observe( this );
|
||||
this.registerAmmo( new ItemStack( Items.gold_nugget ), 196.96655 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAmmo(ItemStack ammo, double weight)
|
||||
public void registerAmmo( ItemStack ammo, double weight )
|
||||
{
|
||||
this.DamageModifiers.put( ammo, weight );
|
||||
}
|
||||
|
||||
private void considerItem(String ore, ItemStack item, String Name, double weight)
|
||||
@Override
|
||||
public float getPenetration( ItemStack is )
|
||||
{
|
||||
if ( ore.equals( "berry" + Name ) || ore.equals( "nugget" + Name ) )
|
||||
for( ItemStack o : this.DamageModifiers.keySet() )
|
||||
{
|
||||
this.registerAmmo( item, weight );
|
||||
if( Platform.isSameItem( o, is ) )
|
||||
return this.DamageModifiers.get( o ).floatValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oreRegistered(String name, ItemStack item)
|
||||
public void oreRegistered( String name, ItemStack item )
|
||||
{
|
||||
if ( !(name.startsWith( "berry" ) || name.startsWith( "nugget" )) )
|
||||
if( !( name.startsWith( "berry" ) || name.startsWith( "nugget" ) ) )
|
||||
return;
|
||||
|
||||
// addNugget( "Cobble", 18 ); // ?
|
||||
@@ -122,24 +133,15 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
|
||||
this.considerItem( name, item, "Plutonium", 244 );
|
||||
|
||||
// TE stuff...
|
||||
this.considerItem( name, item, "Invar", (58.6934 + 55.845 + 55.845) / 3.0 );
|
||||
this.considerItem( name, item, "Electrum", (107.8682 + 196.96655) / 2.0 );
|
||||
this.considerItem( name, item, "Invar", ( 58.6934 + 55.845 + 55.845 ) / 3.0 );
|
||||
this.considerItem( name, item, "Electrum", ( 107.8682 + 196.96655 ) / 2.0 );
|
||||
}
|
||||
|
||||
public MatterCannonAmmoRegistry() {
|
||||
OreDictionaryHandler.INSTANCE.observe( this );
|
||||
this.registerAmmo( new ItemStack( Items.gold_nugget ), 196.96655 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPenetration(ItemStack is)
|
||||
private void considerItem( String ore, ItemStack item, String Name, double weight )
|
||||
{
|
||||
for (ItemStack o : this.DamageModifiers.keySet())
|
||||
if( ore.equals( "berry" + Name ) || ore.equals( "nugget" + Name ) )
|
||||
{
|
||||
if ( Platform.isSameItem( o, is ) )
|
||||
return this.DamageModifiers.get( o ).floatValue();
|
||||
this.registerAmmo( item, weight );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
@@ -31,6 +32,7 @@ import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import appeng.spatial.DefaultSpatialHandler;
|
||||
|
||||
|
||||
public class MovableTileRegistry implements IMovableRegistry
|
||||
{
|
||||
|
||||
@@ -43,14 +45,53 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
|
||||
private final IMovableHandler nullHandler = new DefaultSpatialHandler();
|
||||
|
||||
private IMovableHandler testClass(Class myClass, TileEntity te)
|
||||
@Override
|
||||
public void blacklistBlock( Block blk )
|
||||
{
|
||||
this.blacklisted.add( blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whiteListTileEntity( Class<? extends TileEntity> c )
|
||||
{
|
||||
|
||||
if( c.getName().equals( TileEntity.class.getName() ) )
|
||||
{
|
||||
throw new RuntimeException( new AppEngException( "Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) );
|
||||
}
|
||||
|
||||
this.test.add( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean askToMove( TileEntity te )
|
||||
{
|
||||
Class myClass = te.getClass();
|
||||
IMovableHandler canMove = this.Valid.get( myClass );
|
||||
|
||||
if( canMove == null )
|
||||
canMove = this.testClass( myClass, te );
|
||||
|
||||
if( canMove != this.nullHandler )
|
||||
{
|
||||
if( te instanceof IMovableTile )
|
||||
( (IMovableTile) te ).prepareToMove();
|
||||
|
||||
te.invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private IMovableHandler testClass( Class myClass, TileEntity te )
|
||||
{
|
||||
IMovableHandler handler = null;
|
||||
|
||||
// ask handlers...
|
||||
for (IMovableHandler han : this.handlers)
|
||||
for( IMovableHandler han : this.handlers )
|
||||
{
|
||||
if ( han.canHandle( myClass, te ) )
|
||||
if( han.canHandle( myClass, te ) )
|
||||
{
|
||||
handler = han;
|
||||
break;
|
||||
@@ -58,24 +99,23 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
}
|
||||
|
||||
// if you have a handler your opted in
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
{
|
||||
this.Valid.put( myClass, handler );
|
||||
return handler;
|
||||
|
||||
}
|
||||
|
||||
// if your movable our opted in
|
||||
if ( te instanceof IMovableTile )
|
||||
if( te instanceof IMovableTile )
|
||||
{
|
||||
this.Valid.put( myClass, this.dsh );
|
||||
return this.dsh;
|
||||
}
|
||||
|
||||
// if you are on the white list your opted in.
|
||||
for (Class<? extends TileEntity> testClass : this.test)
|
||||
for( Class<? extends TileEntity> testClass : this.test )
|
||||
{
|
||||
if ( testClass.isAssignableFrom( myClass ) )
|
||||
if( testClass.isAssignableFrom( myClass ) )
|
||||
{
|
||||
this.Valid.put( myClass, this.dsh );
|
||||
return this.dsh;
|
||||
@@ -87,30 +127,9 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean askToMove(TileEntity te)
|
||||
public void doneMoving( TileEntity te )
|
||||
{
|
||||
Class myClass = te.getClass();
|
||||
IMovableHandler canMove = this.Valid.get( myClass );
|
||||
|
||||
if ( canMove == null )
|
||||
canMove = this.testClass( myClass, te );
|
||||
|
||||
if ( canMove != this.nullHandler )
|
||||
{
|
||||
if ( te instanceof IMovableTile )
|
||||
((IMovableTile) te).prepareToMove();
|
||||
|
||||
te.invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving(TileEntity te)
|
||||
{
|
||||
if ( te instanceof IMovableTile )
|
||||
if( te instanceof IMovableTile )
|
||||
{
|
||||
IMovableTile mt = (IMovableTile) te;
|
||||
mt.doneMoving();
|
||||
@@ -118,26 +137,13 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whiteListTileEntity(Class<? extends TileEntity> c)
|
||||
{
|
||||
|
||||
if ( c.getName().equals( TileEntity.class.getName() ) )
|
||||
{
|
||||
throw new RuntimeException( new AppEngException(
|
||||
"Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) );
|
||||
}
|
||||
|
||||
this.test.add( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHandler(IMovableHandler han)
|
||||
public void addHandler( IMovableHandler han )
|
||||
{
|
||||
this.handlers.add( han );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMovableHandler getHandler(TileEntity te)
|
||||
public IMovableHandler getHandler( TileEntity te )
|
||||
{
|
||||
Class myClass = te.getClass();
|
||||
IMovableHandler h = this.Valid.get( myClass );
|
||||
@@ -151,15 +157,8 @@ public class MovableTileRegistry implements IMovableRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blacklistBlock(Block blk)
|
||||
{
|
||||
this.blacklisted.add( blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklisted(Block blk)
|
||||
public boolean isBlacklisted( Block blk )
|
||||
{
|
||||
return this.blacklisted.contains( blk );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -38,22 +39,12 @@ import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
{
|
||||
|
||||
final HashMap<ItemStack, TunnelType> Tunnels = new HashMap<ItemStack, TunnelType>();
|
||||
|
||||
public ItemStack getModItem(String modID, String Name, int meta)
|
||||
{
|
||||
ItemStack myItemStack = GameRegistry.findItemStack( modID, Name, 1 );
|
||||
|
||||
if ( myItemStack == null )
|
||||
return null;
|
||||
|
||||
myItemStack.setItemDamage( meta );
|
||||
return myItemStack;
|
||||
}
|
||||
|
||||
public void configure()
|
||||
{
|
||||
/**
|
||||
@@ -111,7 +102,7 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
this.addNewAttunement( this.getModItem( "ExtraUtilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
||||
this.addNewAttunement( this.getModItem( "EnderIO", "itemLiquidConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
|
||||
|
||||
for (AEColor c : AEColor.values())
|
||||
for( AEColor c : AEColor.values() )
|
||||
{
|
||||
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
|
||||
@@ -120,42 +111,52 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewAttunement( ItemStack trigger, TunnelType type )
|
||||
{
|
||||
if( type == null || trigger == null )
|
||||
return;
|
||||
|
||||
this.Tunnels.put( trigger, type );
|
||||
}
|
||||
|
||||
public ItemStack getModItem( String modID, String Name, int meta )
|
||||
{
|
||||
ItemStack myItemStack = GameRegistry.findItemStack( modID, Name, 1 );
|
||||
|
||||
if( myItemStack == null )
|
||||
return null;
|
||||
|
||||
myItemStack.setItemDamage( meta );
|
||||
return myItemStack;
|
||||
}
|
||||
|
||||
private void addNewAttunement( IItemDefinition definition, TunnelType type )
|
||||
{
|
||||
for ( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addNewAttunement( definitionStack, type );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewAttunement(ItemStack trigger, TunnelType type)
|
||||
public TunnelType getTunnelTypeByItem( ItemStack trigger )
|
||||
{
|
||||
if ( type == null || trigger == null )
|
||||
return;
|
||||
|
||||
this.Tunnels.put( trigger, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunnelType getTunnelTypeByItem(ItemStack trigger)
|
||||
{
|
||||
if ( trigger != null )
|
||||
if( trigger != null )
|
||||
{
|
||||
if ( FluidContainerRegistry.isContainer( trigger ) )
|
||||
if( FluidContainerRegistry.isContainer( trigger ) )
|
||||
return TunnelType.FLUID;
|
||||
|
||||
for (ItemStack is : this.Tunnels.keySet())
|
||||
for( ItemStack is : this.Tunnels.keySet() )
|
||||
{
|
||||
if ( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
|
||||
if( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
|
||||
return this.Tunnels.get( is );
|
||||
|
||||
if ( Platform.isSameItem( is, trigger ) )
|
||||
if( Platform.isSameItem( is, trigger ) )
|
||||
return this.Tunnels.get( is );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,32 +18,33 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
import appeng.core.WorldSettings;
|
||||
|
||||
|
||||
public class PlayerRegistry implements IPlayerRegistry
|
||||
{
|
||||
|
||||
@Override
|
||||
public int getID(GameProfile username)
|
||||
public int getID( GameProfile username )
|
||||
{
|
||||
return WorldSettings.getInstance().getPlayerID( username );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID(EntityPlayer player)
|
||||
public int getID( EntityPlayer player )
|
||||
{
|
||||
return WorldSettings.getInstance().getPlayerID( player.getGameProfile() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer findPlayer(int playerID)
|
||||
public EntityPlayer findPlayer( int playerID )
|
||||
{
|
||||
return WorldSettings.getInstance().getPlayerFromID( playerID );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@@ -28,6 +29,7 @@ import appeng.api.recipes.ISubItemResolver;
|
||||
import appeng.core.AELog;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
|
||||
|
||||
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
|
||||
{
|
||||
|
||||
@@ -35,22 +37,28 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
|
||||
final LinkedList<ISubItemResolver> resolvers = new LinkedList<ISubItemResolver>();
|
||||
|
||||
@Override
|
||||
public void addNewCraftHandler(String name, Class<? extends ICraftHandler> handler)
|
||||
public void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler )
|
||||
{
|
||||
this.handlers.put( name.toLowerCase(), handler );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftHandler getCraftHandlerFor(String name)
|
||||
public void addNewSubItemResolver( ISubItemResolver sir )
|
||||
{
|
||||
this.resolvers.add( sir );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftHandler getCraftHandlerFor( String name )
|
||||
{
|
||||
Class<? extends ICraftHandler> clz = this.handlers.get( name );
|
||||
if ( clz == null )
|
||||
if( clz == null )
|
||||
return null;
|
||||
try
|
||||
{
|
||||
return clz.newInstance();
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.severe( "Error Caused when trying to construct " + clz.getName() );
|
||||
AELog.error( e );
|
||||
@@ -66,15 +74,9 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewSubItemResolver(ISubItemResolver sir)
|
||||
public Object resolveItem( String nameSpace, String itemName )
|
||||
{
|
||||
this.resolvers.add( sir );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveItem(String nameSpace, String itemName)
|
||||
{
|
||||
for (ISubItemResolver sir : this.resolvers)
|
||||
for( ISubItemResolver sir : this.resolvers )
|
||||
{
|
||||
Object rr = null;
|
||||
|
||||
@@ -82,16 +84,15 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
|
||||
{
|
||||
rr = sir.resolveItemByName( nameSpace, itemName );
|
||||
}
|
||||
catch (Throwable t)
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
}
|
||||
|
||||
if ( rr != null )
|
||||
if( rr != null )
|
||||
return rr;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.ILocatableRegistry;
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
@@ -33,6 +34,7 @@ import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IExternalStorageRegistry;
|
||||
|
||||
|
||||
public class RegistryContainer implements IRegistryContainer
|
||||
{
|
||||
|
||||
@@ -49,6 +51,30 @@ public class RegistryContainer implements IRegistryContainer
|
||||
private final PlayerRegistry playerRegistry = new PlayerRegistry();
|
||||
private final IRecipeHandlerRegistry recipeReg = new RecipeHandlerRegistry();
|
||||
|
||||
@Override
|
||||
public IMovableRegistry movable()
|
||||
{
|
||||
return this.MovableReg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridCacheRegistry gridCache()
|
||||
{
|
||||
return this.GridCacheRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageRegistry externalStorage()
|
||||
{
|
||||
return this.ExternalStorageHandlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialComparisonRegistry specialComparison()
|
||||
{
|
||||
return this.SpecialComparisonRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWirelessTermRegistry wireless()
|
||||
{
|
||||
@@ -67,36 +93,12 @@ public class RegistryContainer implements IRegistryContainer
|
||||
return this.GrinderRecipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpecialComparisonRegistry specialComparison()
|
||||
{
|
||||
return this.SpecialComparisonRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExternalStorageRegistry externalStorage()
|
||||
{
|
||||
return this.ExternalStorageHandlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILocatableRegistry locatable()
|
||||
{
|
||||
return this.LocatableRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridCacheRegistry gridCache()
|
||||
{
|
||||
return this.GridCacheRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMovableRegistry movable()
|
||||
{
|
||||
return this.MovableReg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IP2PTunnelRegistry p2pTunnel()
|
||||
{
|
||||
@@ -126,5 +128,4 @@ public class RegistryContainer implements IRegistryContainer
|
||||
{
|
||||
return WorldGenRegistry.INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,22 +28,24 @@ import appeng.api.features.IItemComparison;
|
||||
import appeng.api.features.IItemComparisonProvider;
|
||||
import appeng.api.features.ISpecialComparisonRegistry;
|
||||
|
||||
|
||||
public class SpecialComparisonRegistry implements ISpecialComparisonRegistry
|
||||
{
|
||||
|
||||
private final List<IItemComparisonProvider> CompRegistry;
|
||||
|
||||
public SpecialComparisonRegistry() {
|
||||
public SpecialComparisonRegistry()
|
||||
{
|
||||
this.CompRegistry = new ArrayList<IItemComparisonProvider>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemComparison getSpecialComparison(ItemStack stack)
|
||||
public IItemComparison getSpecialComparison( ItemStack stack )
|
||||
{
|
||||
for (IItemComparisonProvider i : this.CompRegistry)
|
||||
for( IItemComparisonProvider i : this.CompRegistry )
|
||||
{
|
||||
IItemComparison comp = i.getComparison( stack );
|
||||
if ( comp != null )
|
||||
if( comp != null )
|
||||
{
|
||||
return comp;
|
||||
}
|
||||
@@ -52,9 +55,8 @@ public class SpecialComparisonRegistry implements ISpecialComparisonRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComparisonProvider(IItemComparisonProvider prov)
|
||||
public void addComparisonProvider( IItemComparisonProvider prov )
|
||||
{
|
||||
this.CompRegistry.add( prov );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,17 +18,19 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
||||
public class WirelessRangeResult
|
||||
{
|
||||
|
||||
public WirelessRangeResult(TileEntity t, float d) {
|
||||
this.dist = d;
|
||||
this.te = t;
|
||||
}
|
||||
|
||||
final public float dist;
|
||||
final public TileEntity te;
|
||||
|
||||
public WirelessRangeResult( TileEntity t, float d )
|
||||
{
|
||||
this.dist = d;
|
||||
this.te = t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,50 +34,52 @@ import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class WirelessRegistry implements IWirelessTermRegistry
|
||||
{
|
||||
private final List<IWirelessTermHandler> handlers;
|
||||
|
||||
public WirelessRegistry() {
|
||||
public WirelessRegistry()
|
||||
{
|
||||
this.handlers = new ArrayList<IWirelessTermHandler>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWirelessHandler(IWirelessTermHandler handler)
|
||||
public void registerWirelessHandler( IWirelessTermHandler handler )
|
||||
{
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
this.handlers.add( handler );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWirelessTerminal(ItemStack is)
|
||||
public boolean isWirelessTerminal( ItemStack is )
|
||||
{
|
||||
for (IWirelessTermHandler h : this.handlers)
|
||||
for( IWirelessTermHandler h : this.handlers )
|
||||
{
|
||||
if ( h.canHandle( is ) )
|
||||
if( h.canHandle( is ) )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWirelessTermHandler getWirelessTerminalHandler(ItemStack is)
|
||||
public IWirelessTermHandler getWirelessTerminalHandler( ItemStack is )
|
||||
{
|
||||
for (IWirelessTermHandler h : this.handlers)
|
||||
for( IWirelessTermHandler h : this.handlers )
|
||||
{
|
||||
if ( h.canHandle( is ) )
|
||||
if( h.canHandle( is ) )
|
||||
return h;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openWirelessTerminalGui(ItemStack item, World w, EntityPlayer player)
|
||||
public void openWirelessTerminalGui( ItemStack item, World w, EntityPlayer player )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return;
|
||||
|
||||
if ( !this.isWirelessTerminal( item ) )
|
||||
if( !this.isWirelessTerminal( item ) )
|
||||
{
|
||||
player.addChatMessage( PlayerMessages.DeviceNotWirelessTerminal.get() );
|
||||
return;
|
||||
@@ -85,7 +87,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry
|
||||
|
||||
final IWirelessTermHandler handler = this.getWirelessTerminalHandler( item );
|
||||
final String unparsedKey = handler.getEncryptionKey( item );
|
||||
if ( unparsedKey.length() == 0 )
|
||||
if( unparsedKey.length() == 0 )
|
||||
{
|
||||
player.addChatMessage( PlayerMessages.DeviceNotLinked.get() );
|
||||
return;
|
||||
@@ -93,19 +95,17 @@ public final class WirelessRegistry implements IWirelessTermRegistry
|
||||
|
||||
final long parsedKey = Long.parseLong( unparsedKey );
|
||||
final ILocatable securityStation = AEApi.instance().registries().locatable().getLocatableBy( parsedKey );
|
||||
if ( securityStation == null )
|
||||
if( securityStation == null )
|
||||
{
|
||||
player.addChatMessage( PlayerMessages.StationCanNotBeLocated.get() );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( handler.hasPower( player, 0.5, item ) )
|
||||
if( handler.hasPower( player, 0.5, item ) )
|
||||
{
|
||||
Platform.openGUI( player, null, null, GuiBridge.GUI_WIRELESS_TERM );
|
||||
}
|
||||
else
|
||||
player.addChatMessage( PlayerMessages.DeviceNotPowered.get() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
@@ -25,75 +26,49 @@ import net.minecraft.world.WorldProvider;
|
||||
|
||||
import appeng.api.features.IWorldGen;
|
||||
|
||||
|
||||
public final class WorldGenRegistry implements IWorldGen
|
||||
{
|
||||
|
||||
private static class TypeSet
|
||||
{
|
||||
|
||||
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
|
||||
final HashSet<Integer> badDimensions = new HashSet<Integer>();
|
||||
final HashSet<Integer> enabledDimensions = new HashSet<Integer>();
|
||||
|
||||
}
|
||||
|
||||
static final public WorldGenRegistry INSTANCE = new WorldGenRegistry();
|
||||
final TypeSet[] types;
|
||||
|
||||
static final public WorldGenRegistry INSTANCE = new WorldGenRegistry();
|
||||
|
||||
private WorldGenRegistry() {
|
||||
private WorldGenRegistry()
|
||||
{
|
||||
|
||||
this.types = new TypeSet[WorldGenType.values().length];
|
||||
|
||||
for (WorldGenType type : WorldGenType.values())
|
||||
for( WorldGenType type : WorldGenType.values() )
|
||||
{
|
||||
this.types[type.ordinal()] = new TypeSet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWorldGenEnabled(WorldGenType type, World w)
|
||||
public void disableWorldGenForProviderID( WorldGenType type, Class<? extends WorldProvider> provider )
|
||||
{
|
||||
if ( type == null )
|
||||
if( type == null )
|
||||
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||
|
||||
if ( w == null )
|
||||
throw new IllegalArgumentException( "Bad Provider Passed" );
|
||||
|
||||
boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() );
|
||||
boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.dimensionId );
|
||||
boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId );
|
||||
|
||||
if ( isBadProvider || isBadDimension )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !isGoodDimension && type == WorldGenType.Meteorites)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWorldGenForProviderID(WorldGenType type, Class<? extends WorldProvider> provider)
|
||||
{
|
||||
if ( type == null )
|
||||
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||
|
||||
if ( provider == null )
|
||||
if( provider == null )
|
||||
throw new IllegalArgumentException( "Bad Provider Passed" );
|
||||
|
||||
this.types[type.ordinal()].badProviders.add( provider );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWorldGenForDimension(WorldGenType type, int dimensionID)
|
||||
public void enableWorldGenForDimension( WorldGenType type, int dimensionID )
|
||||
{
|
||||
if ( type == null )
|
||||
if( type == null )
|
||||
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||
|
||||
this.types[type.ordinal()].enabledDimensions.add( dimensionID );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWorldGenForDimension( WorldGenType type, int dimensionID )
|
||||
{
|
||||
if( type == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||
}
|
||||
@@ -102,12 +77,36 @@ public final class WorldGenRegistry implements IWorldGen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableWorldGenForDimension(WorldGenType type, int dimensionID)
|
||||
public boolean isWorldGenEnabled( WorldGenType type, World w )
|
||||
{
|
||||
if ( type == null )
|
||||
if( type == null )
|
||||
throw new IllegalArgumentException( "Bad Type Passed" );
|
||||
|
||||
this.types[type.ordinal()].enabledDimensions.add( dimensionID );
|
||||
if( w == null )
|
||||
throw new IllegalArgumentException( "Bad Provider Passed" );
|
||||
|
||||
boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() );
|
||||
boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.dimensionId );
|
||||
boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.dimensionId );
|
||||
|
||||
if( isBadProvider || isBadDimension )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !isGoodDimension && type == WorldGenType.Meteorites )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class TypeSet
|
||||
{
|
||||
|
||||
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
|
||||
final HashSet<Integer> badDimensions = new HashSet<Integer>();
|
||||
final HashSet<Integer> enabledDimensions = new HashSet<Integer>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
|
||||
|
||||
public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
{
|
||||
|
||||
@@ -36,13 +38,15 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
|
||||
private int energy;
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, int cost) {
|
||||
public AppEngGrinderRecipe( ItemStack a, ItemStack b, int cost )
|
||||
{
|
||||
this.in = a;
|
||||
this.out = b;
|
||||
this.energy = cost;
|
||||
}
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, ItemStack c, float chance, int cost) {
|
||||
public AppEngGrinderRecipe( ItemStack a, ItemStack b, ItemStack c, float chance, int cost )
|
||||
{
|
||||
this.in = a;
|
||||
this.out = b;
|
||||
|
||||
@@ -52,7 +56,8 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
this.energy = cost;
|
||||
}
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, ItemStack c, ItemStack d, float chance, float chance2, int cost) {
|
||||
public AppEngGrinderRecipe( ItemStack a, ItemStack b, ItemStack c, ItemStack d, float chance, float chance2, int cost )
|
||||
{
|
||||
this.in = a;
|
||||
this.out = b;
|
||||
|
||||
@@ -72,7 +77,7 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInput(ItemStack i)
|
||||
public void setInput( ItemStack i )
|
||||
{
|
||||
this.in = i.copy();
|
||||
}
|
||||
@@ -84,23 +89,11 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutput(ItemStack o)
|
||||
public void setOutput( ItemStack o )
|
||||
{
|
||||
this.out = o.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost()
|
||||
{
|
||||
return this.energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyCost(int c)
|
||||
{
|
||||
this.energy = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOptionalOutput()
|
||||
{
|
||||
@@ -108,7 +101,13 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionalOutput(ItemStack output, float chance)
|
||||
public ItemStack getSecondOptionalOutput()
|
||||
{
|
||||
return this.optionalOutput2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionalOutput( ItemStack output, float chance )
|
||||
{
|
||||
this.optionalOutput = output.copy();
|
||||
this.optionalChance = chance;
|
||||
@@ -121,13 +120,7 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSecondOptionalOutput()
|
||||
{
|
||||
return this.optionalOutput2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecondOptionalOutput(ItemStack output, float chance)
|
||||
public void setSecondOptionalOutput( ItemStack output, float chance )
|
||||
{
|
||||
this.optionalChance2 = chance;
|
||||
this.optionalOutput2 = output.copy();
|
||||
@@ -139,4 +132,15 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
return this.optionalChance2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost()
|
||||
{
|
||||
return this.energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyCost( int c )
|
||||
{
|
||||
this.energy = c;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -37,29 +38,24 @@ import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BasicCellHandler implements ICellHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean isCell(ItemStack is)
|
||||
public boolean isCell( ItemStack is )
|
||||
{
|
||||
return CellInventory.isCell( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack is, ISaveProvider container, StorageChannel channel)
|
||||
public IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider container, StorageChannel channel )
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS )
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
return CellInventory.getCell( is, container );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Dark()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Light()
|
||||
{
|
||||
@@ -73,15 +69,21 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
|
||||
public IIcon getTopTexture_Dark()
|
||||
{
|
||||
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell(ItemStack is, IMEInventory handler)
|
||||
public int getStatusForCell( ItemStack is, IMEInventory handler )
|
||||
{
|
||||
if ( handler instanceof CellInventoryHandler )
|
||||
if( handler instanceof CellInventoryHandler )
|
||||
{
|
||||
CellInventoryHandler ci = (CellInventoryHandler) handler;
|
||||
return ci.getStatusForCell();
|
||||
@@ -90,9 +92,9 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain(ItemStack is, IMEInventory handler)
|
||||
public double cellIdleDrain( ItemStack is, IMEInventory handler )
|
||||
{
|
||||
ICellInventory inv = ((ICellInventoryHandler) handler).getCellInv();
|
||||
ICellInventory inv = ( (ICellInventoryHandler) handler ).getCellInv();
|
||||
return inv.getIdleDrain();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -35,41 +36,24 @@ import appeng.me.storage.CreativeCellInventory;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class CreativeCellHandler implements ICellHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean isCell(ItemStack is)
|
||||
public boolean isCell( ItemStack is )
|
||||
{
|
||||
return is != null && is.getItem() instanceof ItemCreativeStorageCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack is, ISaveProvider container, StorageChannel channel)
|
||||
public IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider container, StorageChannel channel )
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS && is != null && is.getItem() instanceof ItemCreativeStorageCell )
|
||||
if( channel == StorageChannel.ITEMS && is != null && is.getItem() instanceof ItemCreativeStorageCell )
|
||||
return CreativeCellInventory.getCell( is );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
|
||||
{
|
||||
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Light()
|
||||
{
|
||||
@@ -88,4 +72,21 @@ public class CreativeCellHandler implements ICellHandler
|
||||
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell( ItemStack is, IMEInventory handler )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain( ItemStack is, IMEInventory handler )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -29,24 +30,24 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
|
||||
public class ExternalIInv implements IExternalStorageHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc)
|
||||
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc )
|
||||
{
|
||||
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src)
|
||||
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src )
|
||||
{
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, d );
|
||||
|
||||
if ( channel == StorageChannel.ITEMS && ad != null )
|
||||
if( channel == StorageChannel.ITEMS && ad != null )
|
||||
return new MEMonitorIInventory( ad );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user