Fixes #675 No disabled feature should log spam or crash anymore.

Deprecates the old usage of the AEItemDefinitions via the direct method access of

* blocks()
* parts()
* items()
* materials()

and thus use the new re-direct via definitions().

All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
thatsIch
2015-01-03 02:53:14 +01:00
parent 3dd81433ac
commit 9986ffc458
385 changed files with 12477 additions and 8292 deletions
@@ -30,10 +30,11 @@ import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerUnits;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
@@ -66,11 +67,21 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
private double getMaxEnergyCapacity()
{
Block blk = Block.getBlockFromItem( this );
if ( blk == AEApi.instance().blocks().blockEnergyCell.block() )
return 200000;
else
return 8 * 200000;
Block blockID = Block.getBlockFromItem( this );
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
for ( Block block : energyCell.maybeBlock().asSet() )
{
if ( blockID == block )
{
return 200000;
}
else
{
return 8 * 200000;
}
}
return 0;
}
private double getInternal(ItemStack is)
@@ -18,8 +18,10 @@
package appeng.block.crafting;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -35,15 +37,38 @@ import appeng.client.render.blocks.RenderBlockCraftingCPUMonitor;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.crafting.TileCraftingMonitorTile;
public class BlockCraftingMonitor extends BlockCraftingUnit
{
public BlockCraftingMonitor() {
public BlockCraftingMonitor()
{
super( BlockCraftingMonitor.class );
this.setTileEntity( TileCraftingMonitorTile.class );
}
@Override
public IIcon getIcon( int direction, int metadata )
{
if ( direction != ForgeDirection.SOUTH.ordinal() )
{
for ( Block craftingUnitBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
{
return craftingUnitBlock.getIcon( direction, metadata );
}
}
switch ( metadata )
{
default:
case 0:
return super.getIcon( 0, 0 );
case FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon();
}
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
@@ -51,24 +76,8 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
}
@Override
public IIcon getIcon(int direction, int metadata)
{
if ( direction != ForgeDirection.SOUTH.ordinal() )
return AEApi.instance().blocks().blockCraftingUnit.block().getIcon( direction, metadata );
switch (metadata)
{
default:
case 0:
return super.getIcon( 0, 0 );
case FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon();
}
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
itemStacks.add( new ItemStack( this, 1, 0 ) );
}
@@ -42,7 +42,11 @@ public class ItemCraftingStorage extends AEBaseItemBlock
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
return AEApi.instance().blocks().blockCraftingUnit.stack( 1 );
}
for ( ItemStack stack : AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 ).asSet() )
{
return stack;
}
return null;
}
}
@@ -97,9 +97,9 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
if ( tile instanceof TileCharger )
{
TileCharger tc = (TileCharger) tile;
if ( AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( tc.getStackInSlot( 0 ) ) )
{
if ( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getStackInSlot( 0 ) ) )
{
double xOff = 0.0;
double yOff = 0.0;
double zOff = 0.0;
@@ -112,7 +112,6 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
}
}
}
@@ -424,10 +424,10 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
public void setupTile()
{
this.setTileEntity( noTesrTile = Api.INSTANCE.partHelper.getCombinedInstance( TileCableBus.class.getName() ) );
this.setTileEntity( noTesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBus.class.getName() ) );
if ( Platform.isClient() )
{
tesrTile = Api.INSTANCE.partHelper.getCombinedInstance( TileCableBusTESR.class.getName() );
tesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this );
}
@@ -21,6 +21,8 @@ package appeng.block.solids;
import java.util.EnumSet;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -30,6 +32,7 @@ import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinition;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderQuartzOre;
@@ -37,12 +40,11 @@ import appeng.core.features.AEFeature;
public class OreQuartz extends AEBaseBlock
{
private int boostBrightnessLow;
private int boostBrightnessHigh;
private boolean enhanceBrightness;
public int boostBrightnessLow;
public int boostBrightnessHigh;
public boolean enhanceBrightness;
public OreQuartz(Class self) {
public OreQuartz(Class<? extends OreQuartz> self) {
super( self, Material.rock );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setHardness( 3.0F );
@@ -73,9 +75,13 @@ public class OreQuartz extends AEBaseBlock
j1 = Math.max( j1 >> 20, j1 >> 4 );
if ( j1 > 4 )
{
j1 += this.boostBrightnessHigh;
}
else
{
j1 += this.boostBrightnessLow;
}
if ( j1 > 15 )
j1 = 15;
@@ -88,21 +94,27 @@ public class OreQuartz extends AEBaseBlock
this( OreQuartz.class );
}
ItemStack getItemDropped()
{
return AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 );
}
@Nullable
@Override
public Item getItemDropped(int id, Random rand, int meta)
{
return this.getItemDropped().getItem();
for ( Item crystalItem : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeItem().asSet() )
{
return crystalItem;
}
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
}
@Override
public int damageDropped(int id)
{
return this.getItemDropped().getItemDamage();
for ( ItemStack crystalStack : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeStack( 1 ).asSet() )
{
return crystalStack.getItemDamage();
}
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
}
@Override
@@ -144,4 +156,18 @@ public class OreQuartz extends AEBaseBlock
}
}
public void setBoostBrightnessLow( int boostBrightnessLow )
{
this.boostBrightnessLow = boostBrightnessLow;
}
public void setBoostBrightnessHigh( int boostBrightnessHigh )
{
this.boostBrightnessHigh = boostBrightnessHigh;
}
public void setEnhanceBrightness( boolean enhanceBrightness )
{
this.enhanceBrightness = enhanceBrightness;
}
}
@@ -19,15 +19,17 @@
package appeng.block.solids;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinition;
import appeng.client.render.effects.ChargedOreFX;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
@@ -37,14 +39,20 @@ public class OreQuartzCharged extends OreQuartz
public OreQuartzCharged() {
super( OreQuartzCharged.class );
this.boostBrightnessLow = 2;
this.boostBrightnessHigh = 5;
this.setBoostBrightnessLow( 2 );
this.setBoostBrightnessHigh( 5 );
}
@Nullable
@Override
ItemStack getItemDropped()
public Item getItemDropped( int id, Random rand, int meta )
{
return AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 );
for ( Item charged : AEApi.instance().definitions().materials().certusQuartzCrystalCharged().maybeItem().asSet() )
{
return charged;
}
throw new MissingDefinition( "Tried to access charged certus quartz crystal, even though they are disabled" );
}
@Override
@@ -21,15 +21,16 @@ package appeng.block.stair;
import java.util.EnumSet;
import net.minecraft.block.Block;
import appeng.block.AEBaseStairBlock;
import appeng.block.solids.BlockQuartzChiseled;
import appeng.core.features.AEFeature;
public class ChiseledQuartzStairBlock extends AEBaseStairBlock
{
public ChiseledQuartzStairBlock( BlockQuartzChiseled block )
public ChiseledQuartzStairBlock( Block block )
{
super( block, 0, EnumSet.of( AEFeature.Core ) );
super( block, 0, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -31,6 +31,6 @@ public class FluixStairBlock extends AEBaseStairBlock
{
public FluixStairBlock( Block block )
{
super( block, 0, EnumSet.of( AEFeature.Core ) );
super( block, 0, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -21,15 +21,16 @@ package appeng.block.stair;
import java.util.EnumSet;
import net.minecraft.block.Block;
import appeng.block.AEBaseStairBlock;
import appeng.block.solids.BlockQuartzPillar;
import appeng.core.features.AEFeature;
public class QuartzPillarStairBlock extends AEBaseStairBlock
{
public QuartzPillarStairBlock( BlockQuartzPillar block )
public QuartzPillarStairBlock( Block block )
{
super( block, 0, EnumSet.of( AEFeature.Core ) );
super( block, 0, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -21,15 +21,16 @@ package appeng.block.stair;
import java.util.EnumSet;
import net.minecraft.block.Block;
import appeng.block.AEBaseStairBlock;
import appeng.block.solids.BlockQuartz;
import appeng.core.features.AEFeature;
public class QuartzStairBlock extends AEBaseStairBlock
{
public QuartzStairBlock( BlockQuartz block )
public QuartzStairBlock( Block block )
{
super( block, 0, EnumSet.of( AEFeature.Core ) );
super( block, 0, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -31,6 +31,6 @@ public class SkyStoneBlockStairBlock extends AEBaseStairBlock
{
public SkyStoneBlockStairBlock( Block block, Integer meta )
{
super( block, meta, EnumSet.of( AEFeature.Core ) );
super( block, meta, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -31,6 +31,6 @@ public class SkyStoneBrickStairBlock extends AEBaseStairBlock
{
public SkyStoneBrickStairBlock( Block block, Integer meta )
{
super( block, meta, EnumSet.of( AEFeature.Core ) );
super( block, meta, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -31,6 +31,6 @@ public class SkyStoneSmallBrickStairBlock extends AEBaseStairBlock
{
public SkyStoneSmallBrickStairBlock( Block block, int meta )
{
super( block, meta, EnumSet.of( AEFeature.Core ) );
super( block, meta, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -31,6 +31,6 @@ public class SkyStoneStairBlock extends AEBaseStairBlock
{
public SkyStoneStairBlock( Block block, Integer meta )
{
super( block, meta, EnumSet.of( AEFeature.Core ) );
super( block, meta, EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -23,11 +23,13 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
@@ -81,9 +83,12 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
@SideOnly(Side.CLIENT)
public IIcon getIcon(int direction, int metadata)
{
if ( metadata == 1 )
return AEApi.instance().blocks().blockSkyStone.block().getIcon( direction, 1 );
return AEApi.instance().blocks().blockSkyStone.block().getIcon( direction, metadata );
for ( Block skyStoneBlock : AEApi.instance().definitions().blocks().skyStone().maybeBlock().asSet() )
{
return skyStoneBlock.getIcon( direction, metadata );
}
return Blocks.stone.getIcon( direction, metadata );
}
@Override
@@ -18,9 +18,6 @@
package appeng.client;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.ENTITY;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -86,6 +83,9 @@ import appeng.server.ServerHelper;
import appeng.transformer.MissingCoreMod;
import appeng.util.Platform;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.ENTITY;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
public class ClientHelper extends ServerHelper
{
@@ -290,7 +290,7 @@ public class ClientHelper extends ServerHelper
public void bindTileEntitySpecialRenderer(Class tile, AEBaseBlock blk)
{
BaseBlockRender bbr = blk.getRendererInstance().rendererInstance;
if ( bbr.hasTESR && tile != null )
if ( bbr.hasTESR() && tile != null )
ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) );
}
@@ -23,6 +23,8 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiNumberBox;
@@ -35,6 +37,7 @@ import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.helpers.Reflected;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
@@ -42,23 +45,23 @@ import appeng.parts.reporting.PartTerminal;
public class GuiCraftAmount extends AEBaseGui
{
private GuiNumberBox amountToCraft;
private GuiTabButton originalGuiBtn;
GuiNumberBox amountToCraft;
GuiTabButton originalGuiBtn;
private GuiButton next;
GuiButton next;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
private GuiButton plus1000;
private GuiButton minus1;
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
GuiButton plus1;
GuiButton plus10;
GuiButton plus100;
GuiButton plus1000;
GuiButton minus1;
GuiButton minus10;
GuiButton minus100;
GuiButton minus1000;
GuiBridge OriginalGui;
private GuiBridge originalGui;
@Reflected
public GuiCraftAmount(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( new ContainerCraftAmount( inventoryPlayer, te ) );
}
@@ -87,33 +90,50 @@ public class GuiCraftAmount extends AEBaseGui
ItemStack myIcon = null;
Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if ( target instanceof WirelessTerminalGuiObject )
{
myIcon = AEApi.instance().items().itemWirelessTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
for ( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
{
myIcon = wirelessTerminalStack;
}
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if ( target instanceof PartTerminal )
{
myIcon = AEApi.instance().parts().partTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_ME;
for ( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_ME;
}
if ( target instanceof PartCraftingTerminal )
{
myIcon = AEApi.instance().parts().partCraftingTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
for ( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if ( target instanceof PartPatternTerminal )
{
myIcon = AEApi.instance().parts().partPatternTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
for ( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
if ( this.OriginalGui != null )
if ( this.originalGui != null && myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
}
this.amountToCraft = new GuiNumberBox( this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Integer.class );
this.amountToCraft.setEnableBackgroundDrawing( false );
@@ -134,7 +154,7 @@ public class GuiCraftAmount extends AEBaseGui
if ( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
if ( btn == this.next )
@@ -160,22 +180,22 @@ public class GuiCraftAmount extends AEBaseGui
{
try
{
String Out = this.amountToCraft.getText();
String out = this.amountToCraft.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
out = out.substring( 1 );
fixed = true;
}
if ( Fixed )
this.amountToCraft.setText( Out );
if ( fixed )
this.amountToCraft.setText( out );
if ( Out.length() == 0 )
Out = "0";
if ( out.length() == 0 )
out = "0";
long result = Integer.parseInt( Out );
long result = Integer.parseInt( out );
if ( result == 1 && i > 1 )
result = 0;
@@ -184,9 +204,9 @@ public class GuiCraftAmount extends AEBaseGui
if ( result < 1 )
result = 1;
Out = Long.toString( result );
Integer.parseInt( Out );
this.amountToCraft.setText( Out );
out = Long.toString( result );
Integer.parseInt( out );
this.amountToCraft.setText( out );
}
catch (NumberFormatException e)
{
@@ -208,22 +228,22 @@ public class GuiCraftAmount extends AEBaseGui
{
try
{
String Out = this.amountToCraft.getText();
String out = this.amountToCraft.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
out = out.substring( 1 );
fixed = true;
}
if ( Fixed )
this.amountToCraft.setText( Out );
if ( fixed )
this.amountToCraft.setText( out );
if ( Out.length() == 0 )
Out = "0";
if ( out.length() == 0 )
out = "0";
long result = Long.parseLong( Out );
long result = Long.parseLong( out );
if ( result < 0 )
{
this.amountToCraft.setText( "1" );
@@ -128,7 +128,7 @@ public class GuiCraftConfirm extends AEBaseGui
private void updateCPUButtonText()
{
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if ( this.ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
if ( this.ccc.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if ( this.ccc.myName.length() > 0 )
{
@@ -30,6 +30,8 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingStatus;
@@ -47,41 +49,56 @@ import appeng.parts.reporting.PartTerminal;
public class GuiCraftingStatus extends GuiCraftingCPU
{
final ContainerCraftingStatus ccc;
final ContainerCraftingStatus status;
GuiButton selectCPU;
GuiTabButton originalGuiBtn;
GuiBridge OriginalGui;
GuiBridge originalGui;
ItemStack myIcon = null;
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
this.ccc = (ContainerCraftingStatus) this.inventorySlots;
Object target = this.ccc.getTarget();
this.status = (ContainerCraftingStatus) this.inventorySlots;
Object target = this.status.getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if ( target instanceof WirelessTerminalGuiObject )
{
this.myIcon = AEApi.instance().items().itemWirelessTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
for ( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = wirelessTerminalStack;
}
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if ( target instanceof PartTerminal )
{
this.myIcon = AEApi.instance().parts().partTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_ME;
for ( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_ME;
}
if ( target instanceof PartCraftingTerminal )
{
this.myIcon = AEApi.instance().parts().partCraftingTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
for ( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if ( target instanceof PartPatternTerminal )
{
this.myIcon = AEApi.instance().parts().partPatternTerminal.stack( 1 );
this.OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
for ( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
}
@@ -106,7 +123,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
if ( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
}
@@ -136,27 +153,27 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
String btnTextText = GuiText.NoCraftingJobs.getLocal();
if ( this.ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
if ( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if ( this.ccc.myName.length() > 0 )
if ( this.status.myName.length() > 0 )
{
String name = this.ccc.myName.substring( 0, Math.min( 20, this.ccc.myName.length() ) );
String name = this.status.myName.substring( 0, Math.min( 20, this.status.myName.length() ) );
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
}
else
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.ccc.selectedCpu;
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.status.selectedCpu;
}
if ( this.ccc.noCPU )
if ( this.status.noCPU )
btnTextText = GuiText.NoCraftingJobs.getLocal();
this.selectCPU.displayString = btnTextText;
}
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen(int mouseX, int mouseY, float btn)
{
this.updateCPUButtonText();
super.drawScreen( mouse_x, mouse_y, btn );
super.drawScreen( mouseX, mouseY, btn );
}
}
@@ -22,12 +22,14 @@ import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.api.definitions.IDefinitions;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerIOPort;
import appeng.core.localization.GuiText;
@@ -50,8 +52,18 @@ public class GuiIOPort extends GuiUpgradeable
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.drawItem( offsetX + 66 - 8, offsetY + 17, AEApi.instance().items().itemCell1k.stack( 1 ) );
this.drawItem( offsetX + 94 + 8, offsetY + 17, AEApi.instance().blocks().blockDrive.stack( 1 ) );
final IDefinitions definitions = AEApi.instance().definitions();
for ( ItemStack cell1kStack : definitions.items().cell1k().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack );
}
for ( ItemStack driveStack : definitions.blocks().drive().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 94 + 8, offsetY + 17, driveStack );
}
}
@Override
@@ -25,6 +25,9 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.widgets.GuiTabButton;
@@ -88,44 +91,68 @@ public class GuiPriority extends AEBaseGui
ItemStack myIcon = null;
Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
final IBlocks blocks = definitions.blocks();
if ( target instanceof PartStorageBus )
{
myIcon = AEApi.instance().parts().partStorageBus.stack( 1 );
for ( ItemStack storageBusStack :parts.storageBus().maybeStack( 1 ).asSet() )
{
myIcon = storageBusStack;
}
this.OriginalGui = GuiBridge.GUI_STORAGEBUS;
}
if ( target instanceof PartFormationPlane )
{
myIcon = AEApi.instance().parts().partFormationPlane.stack( 1 );
for ( ItemStack formationPlaneStack : parts.formationPlane().maybeStack( 1 ).asSet() )
{
myIcon = formationPlaneStack;
}
this.OriginalGui = GuiBridge.GUI_FORMATION_PLANE;
}
if ( target instanceof TileDrive )
{
myIcon = AEApi.instance().blocks().blockDrive.stack( 1 );
for ( ItemStack driveStack : blocks.drive().maybeStack( 1 ).asSet() )
{
myIcon = driveStack;
}
this.OriginalGui = GuiBridge.GUI_DRIVE;
}
if ( target instanceof TileChest )
{
myIcon = AEApi.instance().blocks().blockChest.stack( 1 );
for ( ItemStack chestStack : blocks.chest().maybeStack( 1 ).asSet() )
{
myIcon = chestStack;
}
this.OriginalGui = GuiBridge.GUI_CHEST;
}
if ( target instanceof TileInterface )
{
myIcon = AEApi.instance().blocks().blockInterface.stack( 1 );
for ( ItemStack interfaceStack : blocks.iface().maybeStack( 1 ).asSet() )
{
myIcon = interfaceStack;
}
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if ( target instanceof PartInterface )
{
myIcon = AEApi.instance().parts().partInterface.stack( 1 );
for ( ItemStack interfaceStack : parts.iface().maybeStack( 1 ).asSet() )
{
myIcon = interfaceStack;
}
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if ( this.OriginalGui != null )
if ( this.OriginalGui != null && myIcon != null )
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
this.priority = new GuiNumberBox( this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Long.class );
@@ -158,27 +185,27 @@ public class GuiPriority extends AEBaseGui
{
try
{
String Out = this.priority.getText();
String out = this.priority.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
out = out.substring( 1 );
fixed = true;
}
if ( Fixed )
this.priority.setText( Out );
if ( fixed )
this.priority.setText( out );
if ( Out.length() == 0 )
Out = "0";
if ( out.length() == 0 )
out = "0";
long result = Long.parseLong( Out );
long result = Long.parseLong( out );
result += i;
this.priority.setText( Out = Long.toString( result ) );
this.priority.setText( out = Long.toString( result ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", Out ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch(NumberFormatException e )
{
@@ -201,22 +228,22 @@ public class GuiPriority extends AEBaseGui
{
try
{
String Out = this.priority.getText();
String out = this.priority.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
out = out.substring( 1 );
fixed = true;
}
if ( Fixed )
this.priority.setText( Out );
if ( fixed )
this.priority.setText( out );
if ( Out.length() == 0 )
Out = "0";
if ( out.length() == 0 )
out = "0";
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", Out ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch (IOException e)
{
@@ -85,10 +85,9 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.registerApp( 16 * 10, Settings.POWER_UNITS, PowerUnits.AE, ButtonToolTips.PowerUnits, PowerUnits.AE.unlocalizedName );
this.registerApp( 16 * 10 + 1, Settings.POWER_UNITS, PowerUnits.EU, ButtonToolTips.PowerUnits, PowerUnits.EU.unlocalizedName );
this.registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MJ, ButtonToolTips.PowerUnits, PowerUnits.MJ.unlocalizedName );
this.registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.MK, ButtonToolTips.PowerUnits, PowerUnits.MK.unlocalizedName );
this.registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.WA, ButtonToolTips.PowerUnits, PowerUnits.WA.unlocalizedName );
this.registerApp( 16 * 10 + 5, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
this.registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MK, ButtonToolTips.PowerUnits, PowerUnits.MK.unlocalizedName );
this.registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.WA, ButtonToolTips.PowerUnits, PowerUnits.WA.unlocalizedName );
this.registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
this.registerApp( 3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode, ButtonToolTips.AlwaysActive );
this.registerApp( 0, Settings.REDSTONE_CONTROLLED, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithoutSignal );
@@ -51,47 +51,29 @@ import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
public class BaseBlockRender
{
final int ORIENTATION_BITS = 7;
final static int FLIP_H_BIT = 8;
final static int FLIP_V_BIT = 16;
final double MAX_DISTANCE;
final public boolean hasTESR;
private static final int ORIENTATION_BITS = 7;
private static final int FLIP_H_BIT = 8;
private static final int FLIP_V_BIT = 16;
private static final byte[][][] ORIENTATION_MAP = new byte[6][6][6];
protected int adjustBrightness(int v, double d)
private final boolean hasTESR;
private final double renderDistance;
private final FloatBuffer rotMat = BufferUtils.createFloatBuffer( 16 );
public BaseBlockRender()
{
int r = 0xff & (v >> 16);
int g = 0xff & (v >> 8);
int b = 0xff & ( v );
r *= d;
g *= d;
b *= d;
r = Math.min( 255, Math.max( 0, r ) );
g = Math.min( 255, Math.max( 0, g ) );
b = Math.min( 255, Math.max( 0, b ) );
return (r << 16) | (g << 8) | b;
this( false, 20 );
}
static public int getOrientation(ForgeDirection in, ForgeDirection forward, ForgeDirection up)
public BaseBlockRender( boolean enableTESR, double tileEntitySpecialRendererRange )
{
if ( in == null || in == ForgeDirection.UNKNOWN // 1
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
|| up == null || up == ForgeDirection.UNKNOWN )
return 0;
int a = in.ordinal();
int b = forward.ordinal();
int c = up.ordinal();
return ORIENTATION_MAP[a][b][c];
this.hasTESR = enableTESR;
this.renderDistance = tileEntitySpecialRendererRange;
setOriMap();
}
static public void setOriMap()
@@ -271,30 +253,76 @@ public class BaseBlockRender
ORIENTATION_MAP[5][2][4] = 1 | FLIP_H_BIT;
}
public BaseBlockRender() {
this( false, 20 );
public boolean hasTESR()
{
return this.hasTESR;
}
public BaseBlockRender(boolean enableTESR, double tileEntitySpecialRendererRange) {
this.hasTESR = enableTESR;
this.MAX_DISTANCE = tileEntitySpecialRendererRange;
setOriMap();
protected int adjustBrightness( int v, double d )
{
int r = 0xff & ( v >> 16 );
int g = 0xff & ( v >> 8 );
int b = 0xff & ( v );
r *= d;
g *= d;
b *= d;
r = Math.min( 255, Math.max( 0, r ) );
g = Math.min( 255, Math.max( 0, g ) );
b = Math.min( 255, Math.max( 0, b ) );
return ( r << 16 ) | ( g << 8 ) | b;
}
public double getTesrRenderDistance()
{
return this.MAX_DISTANCE;
return this.renderDistance;
}
public IIcon firstNotNull(IIcon... s)
public void renderInventory( AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] data )
{
for (IIcon o : s)
if ( o != null )
return o;
return ExtraBlockTextures.getMissing();
Tessellator tess = Tessellator.instance;
BlockRenderInfo info = block.getRendererInstance();
if ( info.isValid() )
{
if ( block.hasSubtypes() )
block.setRenderStateByMeta( item.getItemDamage() );
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( getOrientation( ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( getOrientation( ForgeDirection.WEST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( getOrientation( ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( getOrientation( ForgeDirection.SOUTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
}
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), block, item, tess, 0xffffff, renderer );
if ( block.hasSubtypes() )
info.setTemporaryRenderIcon( null );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
}
public void renderInvBlock(EnumSet<ForgeDirection> sides, AEBaseBlock block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer)
static public int getOrientation( ForgeDirection in, ForgeDirection forward, ForgeDirection up )
{
if ( in == null || in == ForgeDirection.UNKNOWN // 1
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
|| up == null || up == ForgeDirection.UNKNOWN )
return 0;
int a = in.ordinal();
int b = forward.ordinal();
int c = up.ordinal();
return ORIENTATION_MAP[a][b][c];
}
public void renderInvBlock( EnumSet<ForgeDirection> sides, AEBaseBlock block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer )
{
if ( Platform.isDrawing( tess ) )
tess.draw();
@@ -308,13 +336,7 @@ public class BaseBlockRender
tess.startDrawingQuads();
tess.setNormal( 0.0F, -1.0F, 0.0F );
tess.setColorOpaque_I( color );
renderer.renderFaceYNeg(
block,
0.0D,
0.0D,
0.0D,
this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.DOWN ),
block.getIcon( ForgeDirection.DOWN.ordinal(), meta ) ) );
renderer.renderFaceYNeg( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.DOWN ), block.getIcon( ForgeDirection.DOWN.ordinal(), meta ) ) );
tess.draw();
}
@@ -323,13 +345,7 @@ public class BaseBlockRender
tess.startDrawingQuads();
tess.setNormal( 0.0F, 1.0F, 0.0F );
tess.setColorOpaque_I( color );
renderer.renderFaceYPos(
block,
0.0D,
0.0D,
0.0D,
this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.UP ),
block.getIcon( ForgeDirection.UP.ordinal(), meta ) ) );
renderer.renderFaceYPos( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.UP ), block.getIcon( ForgeDirection.UP.ordinal(), meta ) ) );
tess.draw();
}
@@ -338,13 +354,7 @@ public class BaseBlockRender
tess.startDrawingQuads();
tess.setNormal( 0.0F, 0.0F, -1.0F );
tess.setColorOpaque_I( color );
renderer.renderFaceZNeg(
block,
0.0D,
0.0D,
0.0D,
this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.NORTH ),
block.getIcon( ForgeDirection.NORTH.ordinal(), meta ) ) );
renderer.renderFaceZNeg( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.NORTH ), block.getIcon( ForgeDirection.NORTH.ordinal(), meta ) ) );
tess.draw();
}
@@ -353,13 +363,7 @@ public class BaseBlockRender
tess.startDrawingQuads();
tess.setNormal( 0.0F, 0.0F, 1.0F );
tess.setColorOpaque_I( color );
renderer.renderFaceZPos(
block,
0.0D,
0.0D,
0.0D,
this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.SOUTH ),
block.getIcon( ForgeDirection.SOUTH.ordinal(), meta ) ) );
renderer.renderFaceZPos( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.SOUTH ), block.getIcon( ForgeDirection.SOUTH.ordinal(), meta ) ) );
tess.draw();
}
@@ -368,13 +372,7 @@ public class BaseBlockRender
tess.startDrawingQuads();
tess.setNormal( -1.0F, 0.0F, 0.0F );
tess.setColorOpaque_I( color );
renderer.renderFaceXNeg(
block,
0.0D,
0.0D,
0.0D,
this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.WEST ),
block.getIcon( ForgeDirection.WEST.ordinal(), meta ) ) );
renderer.renderFaceXNeg( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.WEST ), block.getIcon( ForgeDirection.WEST.ordinal(), meta ) ) );
tess.draw();
}
@@ -383,60 +381,30 @@ public class BaseBlockRender
tess.startDrawingQuads();
tess.setNormal( 1.0F, 0.0F, 0.0F );
tess.setColorOpaque_I( color );
renderer.renderFaceXPos(
block,
0.0D,
0.0D,
0.0D,
this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.EAST ),
block.getIcon( ForgeDirection.EAST.ordinal(), meta ) ) );
renderer.renderFaceXPos( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.EAST ), block.getIcon( ForgeDirection.EAST.ordinal(), meta ) ) );
tess.draw();
}
}
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] data)
public IIcon firstNotNull( IIcon... s )
{
Tessellator tess = Tessellator.instance;
BlockRenderInfo info = block.getRendererInstance();
if ( info.isValid() )
{
if ( block.hasSubtypes() )
block.setRenderStateByMeta( item.getItemDamage() );
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip(
getOrientation( ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip(
getOrientation( ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip(
getOrientation( ForgeDirection.WEST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip(
getOrientation( ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip(
getOrientation( ForgeDirection.SOUTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
}
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), block, item, tess, 0xffffff, renderer );
if ( block.hasSubtypes() )
info.setTemporaryRenderIcon( null );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
for ( IIcon o : s )
if ( o != null )
return o;
return ExtraBlockTextures.getMissing();
}
public IOrientable getOrientable(AEBaseBlock block, IBlockAccess w, int x, int y, int z)
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
if ( block.hasBlockTileEntity() )
return (AEBaseTile) block.getTileEntity( w, x, y, z );
else if ( block instanceof IOrientableBlock )
return ((IOrientableBlock) block).getOrientable( w, x, y, z );
return null;
this.preRenderInWorld( block, world, x, y, z, renderer );
boolean o = renderer.renderStandardBlock( block, x, y, z );
this.postRenderInWorld( renderer );
return o;
}
public void preRenderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public void preRenderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
ForgeDirection forward = ForgeDirection.SOUTH;
ForgeDirection up = ForgeDirection.UP;
@@ -457,80 +425,34 @@ public class BaseBlockRender
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( getOrientation( ForgeDirection.NORTH, forward, up ) );
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( getOrientation( ForgeDirection.SOUTH, forward, up ) );
}
}
public void postRenderInWorld(RenderBlocks renderer)
public void postRenderInWorld( RenderBlocks renderer )
{
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
}
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
public IOrientable getOrientable( AEBaseBlock block, IBlockAccess w, int x, int y, int z )
{
this.preRenderInWorld( block, world, x, y, z, renderer );
boolean o = renderer.renderStandardBlock( block, x, y, z );
this.postRenderInWorld( renderer );
return o;
if ( block.hasBlockTileEntity() )
return (AEBaseTile) block.getTileEntity( w, x, y, z );
else if ( block instanceof IOrientableBlock )
return ( (IOrientableBlock) block ).getOrientable( w, x, y, z );
return null;
}
final FloatBuffer rotMat = BufferUtils.createFloatBuffer( 16 );
protected void applyTESRRotation(double x, double y, double z, ForgeDirection forward, ForgeDirection up)
{
if ( forward != null && up != null )
{
if ( forward == ForgeDirection.UNKNOWN )
forward = ForgeDirection.SOUTH;
if ( up == ForgeDirection.UNKNOWN )
up = ForgeDirection.UP;
ForgeDirection west = Platform.crossProduct( forward, up );
this.rotMat.put( 0, west.offsetX );
this.rotMat.put( 1, west.offsetY );
this.rotMat.put( 2, west.offsetZ );
this.rotMat.put( 3, 0 );
this.rotMat.put( 4, up.offsetX );
this.rotMat.put( 5, up.offsetY );
this.rotMat.put( 6, up.offsetZ );
this.rotMat.put( 7, 0 );
this.rotMat.put( 8, forward.offsetX );
this.rotMat.put( 9, forward.offsetY );
this.rotMat.put( 10, forward.offsetZ );
this.rotMat.put( 11, 0 );
this.rotMat.put( 12, 0 );
this.rotMat.put( 13, 0 );
this.rotMat.put( 14, 0 );
this.rotMat.put( 15, 1 );
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
GL11.glMultMatrix( this.rotMat );
GL11.glTranslated( -0.5, -0.5, -0.5 );
GL11.glCullFace( GL11.GL_FRONT );
}
else
{
GL11.glTranslated( x, y, z );
}
}
protected void setInvRenderBounds(RenderBlocks renderer, int i, int j, int k, int l, int m, int n)
protected void setInvRenderBounds( RenderBlocks renderer, int i, int j, int k, int l, int m, int n )
{
renderer.setRenderBounds( i / 16.0, j / 16.0, k / 16.0, l / 16.0, m / 16.0, n / 16.0 );
}
protected void renderBlockBounds(RenderBlocks renderer,
protected void renderBlockBounds( RenderBlocks renderer,
double minX, double minY, double minZ,
double minX, double minY, double minZ,
double maxX, double maxY, double maxZ,
double maxX, double maxY, double maxZ,
ForgeDirection x, ForgeDirection y, ForgeDirection z)
ForgeDirection x, ForgeDirection y, ForgeDirection z )
{
minX /= 16.0;
minY /= 16.0;
@@ -573,36 +495,8 @@ public class BaseBlockRender
renderer.renderMaxZ = Math.max( aZ, bZ );
}
@SideOnly(Side.CLIENT)
private void renderFace(Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz,
double ua, double ub, double va, double vb, IIcon ico, boolean flip)
{
if ( flip )
{
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ),
ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ),
ico.getInterpolatedV( vb * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ),
ico.getInterpolatedV( vb * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ),
ico.getInterpolatedV( va * 16.0 ) );
}
else
{
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ),
ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ),
ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ),
ico.getInterpolatedV( vb * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ),
ico.getInterpolatedV( vb * 16.0 ) );
}
}
@SideOnly(Side.CLIENT)
protected void renderCutoutFace(Block block, IIcon ico, int x, int y, int z, RenderBlocks renderer, ForgeDirection orientation, float edgeThickness)
@SideOnly( Side.CLIENT )
protected void renderCutoutFace( Block block, IIcon ico, int x, int y, int z, RenderBlocks renderer, ForgeDirection orientation, float edgeThickness )
{
Tessellator tess = Tessellator.instance;
@@ -617,52 +511,52 @@ public class BaseBlockRender
double layerBZ = 0.0;
boolean flip = false;
switch (orientation)
switch ( orientation )
{
case NORTH:
case NORTH:
layerAX = 1.0;
layerBY = 1.0;
flip = true;
layerAX = 1.0;
layerBY = 1.0;
flip = true;
break;
case SOUTH:
break;
case SOUTH:
layerAX = 1.0;
layerBY = 1.0;
offsetZ = 1.0;
layerAX = 1.0;
layerBY = 1.0;
offsetZ = 1.0;
break;
case EAST:
break;
case EAST:
flip = true;
layerAZ = 1.0;
layerBY = 1.0;
offsetX = 1.0;
flip = true;
layerAZ = 1.0;
layerBY = 1.0;
offsetX = 1.0;
break;
case WEST:
break;
case WEST:
layerAZ = 1.0;
layerBY = 1.0;
layerAZ = 1.0;
layerBY = 1.0;
break;
case UP:
break;
case UP:
flip = true;
layerAX = 1.0;
layerBZ = 1.0;
offsetY = 1.0;
flip = true;
layerAX = 1.0;
layerBZ = 1.0;
offsetY = 1.0;
break;
case DOWN:
break;
case DOWN:
layerAX = 1.0;
layerBZ = 1.0;
layerAX = 1.0;
layerBZ = 1.0;
break;
default:
break;
break;
default:
break;
}
offsetX += x;
@@ -670,82 +564,101 @@ public class BaseBlockRender
offsetZ += z;
this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
// u -> u
// u -> u
0, 1.0,
// v -> v
0, edgeThickness, ico, flip );
this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
// u -> u
// u -> u
0.0, edgeThickness,
// v -> v
edgeThickness, 1.0 - edgeThickness, ico, flip );
this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
// u -> u
// u -> u
1.0 - edgeThickness, 1.0,
// v -> v
edgeThickness, 1.0 - edgeThickness, ico, flip );
this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
// u -> u
// u -> u
0, 1.0,
// v -> v
1.0 - edgeThickness, 1.0, ico, flip );
}
@SideOnly(Side.CLIENT)
protected void renderFace(int x, int y, int z, Block block, IIcon ico, RenderBlocks renderer, ForgeDirection orientation)
@SideOnly( Side.CLIENT )
private void renderFace( Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz, double ua, double ub, double va, double vb, IIcon ico, boolean flip )
{
switch (orientation)
if ( flip )
{
case NORTH:
renderer.renderFaceZNeg( block, x, y, z, ico );
break;
case SOUTH:
renderer.renderFaceZPos( block, x, y, z, ico );
break;
case EAST:
renderer.renderFaceXPos( block, x, y, z, ico );
break;
case WEST:
renderer.renderFaceXNeg( block, x, y, z, ico );
break;
case UP:
renderer.renderFaceYPos( block, x, y, z, ico );
break;
case DOWN:
renderer.renderFaceYNeg( block, x, y, z, ico );
break;
default:
break;
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
}
else
{
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
}
}
public void selectFace(RenderBlocks renderer, ForgeDirection west, ForgeDirection up, ForgeDirection forward, int u1, int u2, int v1, int v2)
@SideOnly( Side.CLIENT )
protected void renderFace( int x, int y, int z, Block block, IIcon ico, RenderBlocks renderer, ForgeDirection orientation )
{
switch ( orientation )
{
case NORTH:
renderer.renderFaceZNeg( block, x, y, z, ico );
break;
case SOUTH:
renderer.renderFaceZPos( block, x, y, z, ico );
break;
case EAST:
renderer.renderFaceXPos( block, x, y, z, ico );
break;
case WEST:
renderer.renderFaceXNeg( block, x, y, z, ico );
break;
case UP:
renderer.renderFaceYPos( block, x, y, z, ico );
break;
case DOWN:
renderer.renderFaceYNeg( block, x, y, z, ico );
break;
default:
break;
}
}
public void selectFace( RenderBlocks renderer, ForgeDirection west, ForgeDirection up, ForgeDirection forward, int u1, int u2, int v1, int v2 )
{
v1 = 16 - v1;
v2 = 16 - v2;
double minX = (forward.offsetX > 0 ? 1 : 0) + this.mapFaceUV( west.offsetX, u1 ) + this.mapFaceUV( up.offsetX, v1 );
double minY = (forward.offsetY > 0 ? 1 : 0) + this.mapFaceUV( west.offsetY, u1 ) + this.mapFaceUV( up.offsetY, v1 );
double minZ = (forward.offsetZ > 0 ? 1 : 0) + this.mapFaceUV( west.offsetZ, u1 ) + this.mapFaceUV( up.offsetZ, v1 );
double minX = ( forward.offsetX > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetX, u1 ) + this.mapFaceUV( up.offsetX, v1 );
double minY = ( forward.offsetY > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetY, u1 ) + this.mapFaceUV( up.offsetY, v1 );
double minZ = ( forward.offsetZ > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetZ, u1 ) + this.mapFaceUV( up.offsetZ, v1 );
double maxX = (forward.offsetX > 0 ? 1 : 0) + this.mapFaceUV( west.offsetX, u2 ) + this.mapFaceUV( up.offsetX, v2 );
double maxY = (forward.offsetY > 0 ? 1 : 0) + this.mapFaceUV( west.offsetY, u2 ) + this.mapFaceUV( up.offsetY, v2 );
double maxZ = (forward.offsetZ > 0 ? 1 : 0) + this.mapFaceUV( west.offsetZ, u2 ) + this.mapFaceUV( up.offsetZ, v2 );
double maxX = ( forward.offsetX > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetX, u2 ) + this.mapFaceUV( up.offsetX, v2 );
double maxY = ( forward.offsetY > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetY, u2 ) + this.mapFaceUV( up.offsetY, v2 );
double maxZ = ( forward.offsetZ > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetZ, u2 ) + this.mapFaceUV( up.offsetZ, v2 );
renderer.renderMinX = Math.max( 0.0, Math.min( minX, maxX ) - (forward.offsetX != 0 ? 0 : 0.001) );
renderer.renderMaxX = Math.min( 1.0, Math.max( minX, maxX ) + (forward.offsetX != 0 ? 0 : 0.001) );
renderer.renderMinX = Math.max( 0.0, Math.min( minX, maxX ) - ( forward.offsetX != 0 ? 0 : 0.001 ) );
renderer.renderMaxX = Math.min( 1.0, Math.max( minX, maxX ) + ( forward.offsetX != 0 ? 0 : 0.001 ) );
renderer.renderMinY = Math.max( 0.0, Math.min( minY, maxY ) - (forward.offsetY != 0 ? 0 : 0.001) );
renderer.renderMaxY = Math.min( 1.0, Math.max( minY, maxY ) + (forward.offsetY != 0 ? 0 : 0.001) );
renderer.renderMinY = Math.max( 0.0, Math.min( minY, maxY ) - ( forward.offsetY != 0 ? 0 : 0.001 ) );
renderer.renderMaxY = Math.min( 1.0, Math.max( minY, maxY ) + ( forward.offsetY != 0 ? 0 : 0.001 ) );
renderer.renderMinZ = Math.max( 0.0, Math.min( minZ, maxZ ) - (forward.offsetZ != 0 ? 0 : 0.001) );
renderer.renderMaxZ = Math.min( 1.0, Math.max( minZ, maxZ ) + (forward.offsetZ != 0 ? 0 : 0.001) );
renderer.renderMinZ = Math.max( 0.0, Math.min( minZ, maxZ ) - ( forward.offsetZ != 0 ? 0 : 0.001 ) );
renderer.renderMaxZ = Math.min( 1.0, Math.max( minZ, maxZ ) + ( forward.offsetZ != 0 ? 0 : 0.001 ) );
}
private double mapFaceUV(int offset, int uv)
private double mapFaceUV( int offset, int uv )
{
if ( offset == 0 )
return 0;
@@ -753,10 +666,10 @@ public class BaseBlockRender
if ( offset > 0 )
return uv / 16.0;
return (16.0 - uv) / 16.0;
return ( 16.0 - uv ) / 16.0;
}
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
ForgeDirection forward = ForgeDirection.SOUTH;
ForgeDirection up = ForgeDirection.UP;
@@ -789,7 +702,49 @@ public class BaseBlockRender
renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0;
}
public void doRenderItem(ItemStack itemstack, TileEntity par1EntityItemFrame)
protected void applyTESRRotation( double x, double y, double z, ForgeDirection forward, ForgeDirection up )
{
if ( forward != null && up != null )
{
if ( forward == ForgeDirection.UNKNOWN )
forward = ForgeDirection.SOUTH;
if ( up == ForgeDirection.UNKNOWN )
up = ForgeDirection.UP;
ForgeDirection west = Platform.crossProduct( forward, up );
this.rotMat.put( 0, west.offsetX );
this.rotMat.put( 1, west.offsetY );
this.rotMat.put( 2, west.offsetZ );
this.rotMat.put( 3, 0 );
this.rotMat.put( 4, up.offsetX );
this.rotMat.put( 5, up.offsetY );
this.rotMat.put( 6, up.offsetZ );
this.rotMat.put( 7, 0 );
this.rotMat.put( 8, forward.offsetX );
this.rotMat.put( 9, forward.offsetY );
this.rotMat.put( 10, forward.offsetZ );
this.rotMat.put( 11, 0 );
this.rotMat.put( 12, 0 );
this.rotMat.put( 13, 0 );
this.rotMat.put( 14, 0 );
this.rotMat.put( 15, 1 );
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
GL11.glMultMatrix( this.rotMat );
GL11.glTranslated( -0.5, -0.5, -0.5 );
GL11.glCullFace( GL11.GL_FRONT );
}
else
{
GL11.glTranslated( x, y, z );
}
}
public void doRenderItem( ItemStack itemstack, TileEntity par1EntityItemFrame )
{
if ( itemstack != null )
{
@@ -811,5 +766,4 @@ public class BaseBlockRender
GL11.glPopMatrix();
}
}
}
@@ -18,7 +18,9 @@
package appeng.client.render;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
@@ -29,7 +31,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinition;
import appeng.api.parts.IBoxProvider;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
@@ -39,43 +45,143 @@ import appeng.block.networking.BlockCableBus;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
@SideOnly(Side.CLIENT)
public class BusRenderHelper implements IPartRenderHelper
@SideOnly( Side.CLIENT )
public final class BusRenderHelper implements IPartRenderHelper
{
public static final BusRenderHelper INSTANCE = new BusRenderHelper();
private static final int HEX_WHITE = 0xffffff;
final public static BusRenderHelper INSTANCE = new BusRenderHelper();
private final BoundBoxCalculator bbc;
private final boolean noAlphaPass;
private final BaseBlockRender bbr;
private final Optional<Block> maybeBlock;
private final Optional<AEBaseBlock> maybeBaseBlock;
private int renderingForPass;
private int currentPass;
private int itemsRendered;
private double minX;
private double minY;
private double minZ;
private double maxX;
private double maxY;
private double maxZ;
private ForgeDirection ax;
private ForgeDirection ay;
private ForgeDirection az;
private int color;
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 16;
double maxY = 16;
double maxZ = 16;
final AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
final BaseBlockRender bbr = new BaseBlockRender();
private ForgeDirection ax = ForgeDirection.EAST;
private ForgeDirection ay = ForgeDirection.UP;
private ForgeDirection az = ForgeDirection.SOUTH;
int color = 0xffffff;
class BoundBoxCalculator implements IPartCollisionHelper
public BusRenderHelper()
{
this.bbc = new BoundBoxCalculator( this );
this.noAlphaPass = !AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass );
this.bbr = new BaseBlockRender();
this.renderingForPass = 0;
this.currentPass = 0;
this.itemsRendered = 0;
this.minX = 0;
this.minY = 0;
this.minZ = 0;
this.maxX = 16;
this.maxY = 16;
this.maxZ = 16;
this.ax = ForgeDirection.EAST;
this.az = ForgeDirection.SOUTH;
this.ay = ForgeDirection.UP;
this.color = HEX_WHITE;
this.maybeBlock = AEApi.instance().definitions().blocks().multiPart().maybeBlock();
this.maybeBaseBlock = this.maybeBlock.transform( new BaseBlockTransformFunction() );
}
public boolean started = false;
public int getItemsRendered()
{
return this.itemsRendered;
}
float minX;
float minY;
float minZ;
public void setPass( int pass )
{
this.renderingForPass = 0;
this.currentPass = pass;
this.itemsRendered = 0;
}
float maxX;
float maxY;
float maxZ;
public double getBound( ForgeDirection side )
{
switch ( side )
{
default:
case UNKNOWN:
return 0.5;
case DOWN:
return this.minY;
case EAST:
return this.maxX;
case NORTH:
return this.minZ;
case SOUTH:
return this.maxZ;
case UP:
return this.maxY;
case WEST:
return this.minX;
}
}
public void setRenderColor( int color )
{
for ( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
{
final BlockCableBus cableBus = (BlockCableBus) block;
cableBus.setRenderColor( color );
}
}
public void setOrientation( ForgeDirection dx, ForgeDirection dy, ForgeDirection dz )
{
this.ax = dx == null ? ForgeDirection.EAST : dx;
this.ay = dy == null ? ForgeDirection.UP : dy;
this.az = dz == null ? ForgeDirection.SOUTH : dz;
}
public double[] getBounds()
{
return new double[] { this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ };
}
public void setBounds( double[] bounds )
{
if ( bounds == null || bounds.length != 6 )
return;
this.minX = bounds[0];
this.minY = bounds[1];
this.minZ = bounds[2];
this.maxX = bounds[3];
this.maxY = bounds[4];
this.maxZ = bounds[5];
}
private static class BoundBoxCalculator implements IPartCollisionHelper
{
private final BusRenderHelper helper;
private boolean started = false;
private float minX;
private float minY;
private float minZ;
private float maxX;
private float maxY;
private float maxZ;
public BoundBoxCalculator( BusRenderHelper helper )
{
this.helper = helper;
}
@Override
public void addBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
public void addBox( double minX, double minY, double minZ, double maxX, double maxY, double maxZ )
{
if ( this.started )
{
@@ -101,19 +207,19 @@ public class BusRenderHelper implements IPartRenderHelper
@Override
public ForgeDirection getWorldX()
{
return BusRenderHelper.this.ax;
return this.helper.ax;
}
@Override
public ForgeDirection getWorldY()
{
return BusRenderHelper.this.ay;
return this.helper.ay;
}
@Override
public ForgeDirection getWorldZ()
{
return BusRenderHelper.this.az;
return this.helper.az;
}
@Override
@@ -121,34 +227,14 @@ public class BusRenderHelper implements IPartRenderHelper
{
return false;
}
}
final BoundBoxCalculator bbc = new BoundBoxCalculator();
int renderingForPass = 0;
int currentPass = 0;
int itemsRendered = 0;
final boolean noAlphaPass = !AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass );
public int getItemsRendered()
{
return this.itemsRendered;
}
public void setPass(int pass)
{
this.renderingForPass = 0;
this.currentPass = pass;
this.itemsRendered = 0;
}
@Override
public void renderForPass(int pass)
} @Override
public void renderForPass( int pass )
{
this.renderingForPass = pass;
}
public boolean renderThis()
{
if ( this.renderingForPass == this.currentPass || this.noAlphaPass )
@@ -169,11 +255,11 @@ public class BusRenderHelper implements IPartRenderHelper
}
@Override
public ISimplifiedBundle useSimplifiedRendering(int x, int y, int z, IBoxProvider p, ISimplifiedBundle sim)
public ISimplifiedBundle useSimplifiedRendering( int x, int y, int z, IBoxProvider p, ISimplifiedBundle sim )
{
RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
if ( sim != null && rbw.similarLighting( this.blk, rbw.blockAccess, x, y, z, sim ) )
if ( sim != null && this.maybeBlock.isPresent() && rbw.similarLighting( this.maybeBlock.get(), rbw.blockAccess, x, y, z, sim ) )
{
rbw.populate( sim );
rbw.faces = EnumSet.allOf( ForgeDirection.class );
@@ -217,7 +303,11 @@ public class BusRenderHelper implements IPartRenderHelper
this.setBounds( this.bbc.minX, this.bbc.minY, this.bbc.minZ, this.bbc.maxX, this.bbc.maxY, this.bbc.maxZ );
this.bbr.renderBlockBounds( rbw, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
rbw.renderStandardBlock( this.blk, x, y, z );
for ( Block block : this.maybeBlock.asSet() )
{
rbw.renderStandardBlock( block, x, y, z );
}
rbw.faces = EnumSet.allOf( ForgeDirection.class );
rbw.renderAllFaces = allFaces;
@@ -229,7 +319,7 @@ public class BusRenderHelper implements IPartRenderHelper
}
@Override
public void setBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
public void setBounds( float minX, float minY, float minZ, float maxX, float maxY, float maxZ )
{
this.minX = minX;
this.minY = minY;
@@ -239,43 +329,23 @@ public class BusRenderHelper implements IPartRenderHelper
this.maxZ = maxZ;
}
public double getBound(ForgeDirection side)
{
switch (side)
{
default:
case UNKNOWN:
return 0.5;
case DOWN:
return this.minY;
case EAST:
return this.maxX;
case NORTH:
return this.minZ;
case SOUTH:
return this.maxZ;
case UP:
return this.maxY;
case WEST:
return this.minX;
}
}
@Override
public void setInvColor(int newColor)
public void setInvColor( int newColor )
{
this.color = newColor;
}
@Override
public void setTexture(IIcon ico)
public void setTexture( IIcon ico )
{
this.blk.getRendererInstance().setTemporaryRenderIcon( ico );
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
baseBlock.getRendererInstance().setTemporaryRenderIcon( ico );
}
}
@Override
public void setTexture(IIcon Down, IIcon Up, IIcon North, IIcon South, IIcon West, IIcon East)
public void setTexture( IIcon Down, IIcon Up, IIcon North, IIcon South, IIcon West, IIcon East )
{
IIcon[] list = new IIcon[6];
@@ -286,13 +356,13 @@ public class BusRenderHelper implements IPartRenderHelper
list[4] = West;
list[5] = East;
this.blk.getRendererInstance().setTemporaryRenderIcons( list[this.mapRotation( ForgeDirection.UP ).ordinal()],
list[this.mapRotation( ForgeDirection.DOWN ).ordinal()], list[this.mapRotation( ForgeDirection.SOUTH ).ordinal()],
list[this.mapRotation( ForgeDirection.NORTH ).ordinal()], list[this.mapRotation( ForgeDirection.EAST ).ordinal()],
list[this.mapRotation( ForgeDirection.WEST ).ordinal()] );
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
baseBlock.getRendererInstance().setTemporaryRenderIcons( list[this.mapRotation( ForgeDirection.UP ).ordinal()], list[this.mapRotation( ForgeDirection.DOWN ).ordinal()], list[this.mapRotation( ForgeDirection.SOUTH ).ordinal()], list[this.mapRotation( ForgeDirection.NORTH ).ordinal()], list[this.mapRotation( ForgeDirection.EAST ).ordinal()], list[this.mapRotation( ForgeDirection.WEST ).ordinal()] );
}
}
public ForgeDirection mapRotation(ForgeDirection dir)
public ForgeDirection mapRotation( ForgeDirection dir )
{
ForgeDirection forward = this.az;
ForgeDirection up = this.ay;
@@ -305,7 +375,7 @@ public class BusRenderHelper implements IPartRenderHelper
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
for (ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS)
for ( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
if ( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
west = dx;
@@ -328,146 +398,166 @@ public class BusRenderHelper implements IPartRenderHelper
}
@Override
public void renderInventoryBox(RenderBlocks renderer)
public void renderInventoryBox( RenderBlocks renderer )
{
renderer.setRenderBounds( this.minX / 16.0, this.minY / 16.0, this.minZ / 16.0, this.maxX / 16.0, this.maxY / 16.0, this.maxZ / 16.0 );
this.bbr.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), this.blk, null, Tessellator.instance, this.color, renderer );
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
this.bbr.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), baseBlock, null, Tessellator.instance, this.color, renderer );
}
}
@Override
public void renderInventoryFace(IIcon IIcon, ForgeDirection face, RenderBlocks renderer)
public void renderInventoryFace( IIcon IIcon, ForgeDirection face, RenderBlocks renderer )
{
renderer.setRenderBounds( this.minX / 16.0, this.minY / 16.0, this.minZ / 16.0, this.maxX / 16.0, this.maxY / 16.0, this.maxZ / 16.0 );
this.setTexture( IIcon );
this.bbr.renderInvBlock( EnumSet.of( face ), this.blk, null, Tessellator.instance, this.color, renderer );
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
{
this.bbr.renderInvBlock( EnumSet.of( face ), baseBlock, null, Tessellator.instance, this.color, renderer );
}
}
@Override
public void renderBlock(int x, int y, int z, RenderBlocks renderer)
public void renderBlock( int x, int y, int z, RenderBlocks renderer )
{
if ( !this.renderThis() )
return;
AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
BlockRenderInfo info = blk.getRendererInstance();
ForgeDirection forward = BusRenderHelper.INSTANCE.az;
ForgeDirection up = BusRenderHelper.INSTANCE.ay;
for ( Block multiPart : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
{
final AEBaseBlock block = (AEBaseBlock) multiPart;
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.DOWN, forward, up ) );
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.UP, forward, up ) );
BlockRenderInfo info = block.getRendererInstance();
ForgeDirection forward = BusRenderHelper.INSTANCE.az;
ForgeDirection up = BusRenderHelper.INSTANCE.ay;
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.EAST, forward, up ) );
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.WEST, forward, up ) );
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.DOWN, forward, up ) );
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.UP, forward, up ) );
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.NORTH, forward, up ) );
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.SOUTH, forward, up ) );
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.EAST, forward, up ) );
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.WEST, forward, up ) );
this.bbr.renderBlockBounds( renderer, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.NORTH, forward, up ) );
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.SOUTH, forward, up ) );
renderer.renderStandardBlock( blk, x, y, z );
this.bbr.renderBlockBounds( renderer, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
renderer.renderStandardBlock( block, x, y, z );
}
}
@Override
public Block getBlock()
{
return AEApi.instance().blocks().blockMultiPart.block();
for ( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
{
return block;
}
throw new MissingDefinition( "Tried to access the multi part block." );
}
public void setRenderColor(int color)
{
BlockCableBus blk = (BlockCableBus) AEApi.instance().blocks().blockMultiPart.block();
blk.setRenderColor( color );
}
public void prepareBounds(RenderBlocks renderer)
public void prepareBounds( RenderBlocks renderer )
{
this.bbr.renderBlockBounds( renderer, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
}
@Override
public void setFacesToRender(EnumSet<ForgeDirection> faces)
public void setFacesToRender( EnumSet<ForgeDirection> faces )
{
BusRenderer.INSTANCE.renderer.renderFaces = faces;
}
@Override
public void renderBlockCurrentBounds(int x, int y, int z, RenderBlocks renderer)
public void renderBlockCurrentBounds( int x, int y, int z, RenderBlocks renderer )
{
if ( !this.renderThis() )
return;
renderer.renderStandardBlock( this.blk, x, y, z );
for ( Block block : this.maybeBlock.asSet() )
{
renderer.renderStandardBlock( block, x, y, z );
}
}
@Override
public void renderFaceCutout(int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer)
public void renderFaceCutout( int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer )
{
if ( !this.renderThis() )
return;
switch (face)
switch ( face )
{
case DOWN:
face = this.ay.getOpposite();
break;
case EAST:
face = this.ax;
break;
case NORTH:
face = this.az.getOpposite();
break;
case SOUTH:
face = this.az;
break;
case UP:
face = this.ay;
break;
case WEST:
face = this.ax.getOpposite();
break;
case UNKNOWN:
break;
default:
break;
case DOWN:
face = this.ay.getOpposite();
break;
case EAST:
face = this.ax;
break;
case NORTH:
face = this.az.getOpposite();
break;
case SOUTH:
face = this.az;
break;
case UP:
face = this.ay;
break;
case WEST:
face = this.ax.getOpposite();
break;
case UNKNOWN:
break;
default:
break;
}
this.bbr.renderCutoutFace( this.blk, ico, x, y, z, renderer, face, edgeThickness );
for ( Block block : this.maybeBlock.asSet() )
{
this.bbr.renderCutoutFace( block, ico, x, y, z, renderer, face, edgeThickness );
}
}
@Override
public void renderFace(int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer)
public void renderFace( int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer )
{
if ( !this.renderThis() )
return;
this.prepareBounds( renderer );
switch (face)
switch ( face )
{
case DOWN:
face = this.ay.getOpposite();
break;
case EAST:
face = this.ax;
break;
case NORTH:
face = this.az.getOpposite();
break;
case SOUTH:
face = this.az;
break;
case UP:
face = this.ay;
break;
case WEST:
face = this.ax.getOpposite();
break;
case UNKNOWN:
break;
default:
break;
case DOWN:
face = this.ay.getOpposite();
break;
case EAST:
face = this.ax;
break;
case NORTH:
face = this.az.getOpposite();
break;
case SOUTH:
face = this.az;
break;
case UP:
face = this.ay;
break;
case WEST:
face = this.ax.getOpposite();
break;
case UNKNOWN:
break;
default:
break;
}
this.bbr.renderFace( x, y, z, this.blk, ico, renderer, face );
for ( Block block : this.maybeBlock.asSet() )
{
this.bbr.renderFace( x, y, z, block, ico, renderer, face );
}
}
@Override
@@ -488,29 +578,18 @@ public class BusRenderHelper implements IPartRenderHelper
return this.az;
}
public void setOrientation(ForgeDirection dx, ForgeDirection dy, ForgeDirection dz)
private static final class BaseBlockTransformFunction implements Function<Block, AEBaseBlock>
{
this.ax = dx == null ? ForgeDirection.EAST : dx;
this.ay = dy == null ? ForgeDirection.UP : dy;
this.az = dz == null ? ForgeDirection.SOUTH : dz;
@Nullable
@Override
public AEBaseBlock apply( Block input )
{
if ( input instanceof AEBaseBlock )
{
return ( (AEBaseBlock) input );
}
return null;
}
}
public double[] getBounds()
{
return new double[] { this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ };
}
public void setBounds(double[] bounds)
{
if ( bounds == null || bounds.length != 6 )
return;
this.minX = bounds[0];
this.minY = bounds[1];
this.minZ = bounds[2];
this.maxX = bounds[3];
this.maxY = bounds[4];
this.maxZ = bounds[5];
}
}
@@ -20,6 +20,7 @@ package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
@@ -70,7 +71,12 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
IIcon nonForward = theIcon;
if ( isMonitor )
nonForward = AEApi.instance().blocks().blockCraftingUnit.block().getIcon( 0, meta | (formed ? 8 : 0) );
{
for ( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
{
nonForward = craftingBlock.getIcon( 0, meta | ( formed ? 8 : 0 ) );
}
}
if ( formed && renderer.overrideBlockTexture == null )
{
@@ -18,8 +18,10 @@
package appeng.client.render.blocks;
import java.util.Collection;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
@@ -30,8 +32,10 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.texture.ExtraBlockTextures;
@@ -40,50 +44,50 @@ import appeng.tile.qnb.TileQuantumBridge;
public class RenderQNB extends BaseBlockRender
{
public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull,
EnumSet<ForgeDirection> connections)
public void renderCableAt(double thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull,
Collection<ForgeDirection> connections)
{
block.getRendererInstance().setTemporaryRenderIcon( texture );
if ( connections.contains( ForgeDirection.UNKNOWN ) )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness, 0.5D + Thickness, 0.5D + Thickness );
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D - thickness, 0.5D + thickness, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.WEST ) )
{
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
renderer.setRenderBounds( 0.0D, 0.5D - thickness, 0.5D - thickness, 0.5D - thickness - pull, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.EAST ) )
{
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
renderer.setRenderBounds( 0.5D + thickness + pull, 0.5D - thickness, 0.5D - thickness, 1.0D, 0.5D + thickness, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.NORTH ) )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.0D, 0.5D + thickness, 0.5D + thickness, 0.5D - thickness - pull );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.SOUTH ) )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D + thickness + pull, 0.5D + thickness, 0.5D + thickness, 1.0D );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.DOWN ) )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
renderer.setRenderBounds( 0.5D - thickness, 0.0D, 0.5D - thickness, 0.5D + thickness, 0.5D - thickness - pull, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
if ( connections.contains( ForgeDirection.UP ) )
{
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
renderer.setRenderBounds( 0.5D - thickness, 0.5D + thickness + pull, 0.5D - thickness, 0.5D + thickness, 1.0D, 0.5D + thickness );
renderer.renderStandardBlock( block, x, y, z );
}
@@ -109,92 +113,91 @@ public class RenderQNB extends BaseBlockRender
renderer.renderAllFaces = true;
if ( tqb.getBlockType() == AEApi.instance().blocks().blockQuantumLink.block() )
final IDefinitions definitions = AEApi.instance().definitions();
final IBlocks blocks = definitions.blocks();
final IParts parts = definitions.parts();
for ( Block linkBlock : blocks.quantumLink().maybeBlock().asSet() )
{
if ( tqb.isFormed() )
if ( tqb.getBlockType() == linkBlock )
{
AEColoredItemDefinition glassCableDefinition = AEApi.instance().parts().partCableGlass;
Item transparentGlassCable = glassCableDefinition.item( AEColor.Transparent );
if ( tqb.isFormed() )
{
EnumSet<ForgeDirection> sides = tqb.getConnections();
AEColoredItemDefinition coveredCableDefinition = AEApi.instance().parts().partCableCovered;
Item transparentCoveredCable = coveredCableDefinition.item( AEColor.Transparent );
Item transGlassCable = parts.cableGlass().item( AEColor.Transparent );
this.renderCableAt( 0.11D, world, x, y, z, block, renderer, transGlassCable.getIconIndex( parts.cableGlass().stack( AEColor.Transparent, 1 ) ), 0.141D, sides );
EnumSet<ForgeDirection> sides = tqb.getConnections();
this.renderCableAt( 0.11D, world, x, y, z, block, renderer, transparentGlassCable.getIconIndex( glassCableDefinition.stack( AEColor.Transparent, 1 ) ), 0.141D, sides );
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transparentCoveredCable.getIconIndex( coveredCableDefinition.stack( AEColor.Transparent, 1 ) ), 0.1875D, sides );
}
Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.1875D, sides );
}
float renderMin = 2.0f / 16.0f;
float renderMax = 14.0f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
// super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
}
else
{
if ( !tqb.isFormed() )
{
float renderMin = 2.0f / 16.0f;
float renderMax = 14.0f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
}
else if ( tqb.isCorner() )
{
// renderCableAt(0.11D, world, x, y, z, block, modelId,
// renderer,
// AppEngTextureRegistry.Blocks.MECable.get(), true, 0.0D);
AEColoredItemDefinition coveredCableDefinition = AEApi.instance().parts().partCableCovered;
Item transparentCoveredCable = coveredCableDefinition.item( AEColor.Transparent );
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transparentCoveredCable.getIconIndex( coveredCableDefinition.stack( AEColor.Transparent, 1 ) ), 0.05D,
tqb.getConnections() );
float renderMin = 4.0f / 16.0f;
float renderMax = 12.0f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
if ( tqb.isPowered() )
{
renderMin = 3.9f / 16.0f;
renderMax = 12.1f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
}
}
else
{
float renderMin = 2.0f / 16.0f;
float renderMax = 14.0f / 16.0f;
renderer.setRenderBounds( 0, renderMin, renderMin, 1, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
renderer.setRenderBounds( renderMin, 0, renderMin, renderMax, 1, renderMax );
renderer.renderStandardBlock( block, x, y, z );
renderer.setRenderBounds( renderMin, renderMin, 0, renderMax, renderMax, 1 );
renderer.renderStandardBlock( block, x, y, z );
if ( tqb.isPowered() )
if ( !tqb.isFormed() )
{
renderMin = -0.01f / 16.0f;
renderMax = 16.01f / 16.0f;
float renderMin = 2.0f / 16.0f;
float renderMax = 14.0f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
}
else if ( tqb.isCorner() )
{
Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D,
tqb.getConnections() );
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
float renderMin = 4.0f / 16.0f;
float renderMax = 12.0f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
if ( tqb.isPowered() )
{
renderMin = 3.9f / 16.0f;
renderMax = 12.1f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
}
}
else
{
float renderMin = 2.0f / 16.0f;
float renderMax = 14.0f / 16.0f;
renderer.setRenderBounds( 0, renderMin, renderMin, 1, renderMax, renderMax );
renderer.renderStandardBlock( block, x, y, z );
renderer.setRenderBounds( renderMin, 0, renderMin, renderMax, 1, renderMax );
renderer.renderStandardBlock( block, x, y, z );
renderer.setRenderBounds( renderMin, renderMin, 0, renderMax, renderMax, 1 );
renderer.renderStandardBlock( block, x, y, z );
if ( tqb.isPowered() )
{
renderMin = -0.01f / 16.0f;
renderMax = 16.01f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
}
}
}
}
@@ -56,8 +56,17 @@ public class RenderQuartzGlass extends BaseBlockRender
boolean isGlass(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
{
return world.getBlock( x, y, z ) == AEApi.instance().blocks().blockQuartzGlass.block()
|| world.getBlock( x, y, z ) == AEApi.instance().blocks().blockQuartzVibrantGlass.block();
return this.isQuartzGlass( world, x, y, z ) || this.isVibrantQuartzGlass( world, x, y, z );
}
private boolean isQuartzGlass( IBlockAccess world, int x, int y, int z )
{
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, x, y, z );
}
private boolean isVibrantQuartzGlass( IBlockAccess world, int x, int y, int z )
{
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, x, y, z );
}
void renderEdge(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction)
@@ -48,9 +48,9 @@ public class RenderQuartzOre extends BaseBlockRender
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
{
OreQuartz blk = (OreQuartz) block;
blk.enhanceBrightness = true;
blk.setEnhanceBrightness( true );
super.renderInWorld( block, world, x, y, z, renderer );
blk.enhanceBrightness = false;
blk.setEnhanceBrightness( false );
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
boolean out = super.renderInWorld( block, world, x, y, z, renderer );
@@ -23,6 +23,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IItemDefinition;
import appeng.container.guisync.GuiSync;
import appeng.container.interfaces.IProgressProvider;
import appeng.container.slot.SlotOutput;
@@ -140,8 +141,11 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
otherSlot = this.top.getStack();
// name presses
if ( AEApi.instance().materials().materialNamePress.sameAsStack( otherSlot ) )
return AEApi.instance().materials().materialNamePress.sameAsStack( is );
final IItemDefinition namePress = AEApi.instance().definitions().materials().namePress();
if ( namePress.isSameAs( otherSlot ) )
{
return namePress.isSameAs( is );
}
// everything else
for (InscriberRecipe i : Inscribe.RECIPES )
@@ -163,10 +163,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
if ( this.monitor != this.host.getItemInventory() )
this.isContainerValid = false;
for (Enum set : this.serverCM.getSettings())
for (Settings set : this.serverCM.getSettings())
{
Enum sideLocal = this.serverCM.getSetting( set );
Enum sideRemote = this.clientCM.getSetting( set );
Enum<?> sideLocal = this.serverCM.getSetting( set );
Enum<?> sideRemote = this.clientCM.getSetting( set );
if ( sideLocal != sideRemote )
{
@@ -39,6 +39,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.definitions.IDefinitions;
import appeng.api.networking.security.MachineSource;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.ITerminalHost;
@@ -218,7 +219,11 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
this.patternSlotIN.putStack( null );
// add a new encoded pattern.
this.patternSlotOUT.putStack( output = AEApi.instance().items().itemEncodedPattern.stack( 1 ) );
for ( ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 ).asSet() )
{
output = encodedPatternStack;
this.patternSlotOUT.putStack( output );
}
}
// encode the slot.
@@ -303,7 +308,12 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
if ( output == null )
return false;
return AEApi.instance().items().itemEncodedPattern.sameAsStack( output ) || AEApi.instance().materials().materialBlankPattern.sameAsStack( output );
final IDefinitions definitions = AEApi.instance().definitions();
boolean isPattern = definitions.items().encodedPattern().isSameAs( output );
isPattern |= definitions.materials().blankPattern().isSameAs( output );
return isPattern;
}
@Override
@@ -120,10 +120,13 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
{
if ( this.myName.length() > 0 )
{
ItemStack name = AEApi.instance().materials().materialNamePress.stack( 1 );
NBTTagCompound c = Platform.openNbtData( name );
c.setString( "InscribeName", this.myName );
return name;
for ( ItemStack namePressStack : AEApi.instance().definitions().materials().namePress().maybeStack( 1 ).asSet() )
{
final NBTTagCompound compound = Platform.openNbtData( namePressStack );
compound.setString( "InscribeName", this.myName );
return namePressStack;
}
}
}
@@ -29,7 +29,9 @@ import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials;
import appeng.api.features.INetworkEncodable;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.implementations.items.IBiometricCard;
@@ -80,9 +82,7 @@ public class SlotRestrictedInput extends AppEngSlot
{
ICraftingPatternDetails ap = is.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) is.getItem()).getPatternForItem( is, theWorld )
: null;
if ( ap != null )
return true;
return false;
return ap != null;
}
return true;
}
@@ -142,96 +142,101 @@ public class SlotRestrictedInput extends AppEngSlot
if ( !this.inventory.isItemValidForSlot( this.getSlotIndex(), i ) )
return false;
IAppEngApi api = AEApi.instance();
if ( !this.allowEdit )
return false;
final IDefinitions definitions = AEApi.instance().definitions();
final IMaterials materials = definitions.materials();
final IItems items = definitions.items();
switch (this.which)
{
case ENCODED_CRAFTING_PATTERN:
if ( i.getItem() instanceof ICraftingPatternItem )
{
ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.worldObj );
if ( de != null )
return de.isCraftable();
case ENCODED_CRAFTING_PATTERN:
if ( i.getItem() instanceof ICraftingPatternItem )
{
ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.worldObj );
if ( de != null )
return de.isCraftable();
}
return false;
case VALID_ENCODED_PATTERN_W_OUTPUT:
case ENCODED_PATTERN_W_OUTPUT:
case ENCODED_PATTERN: {
if ( i.getItem() instanceof ICraftingPatternItem )
return true;
// ICraftingPatternDetails pattern = i.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem)
// i.getItem()).getPatternForItem( i ) : null;
return false;// pattern != null;
}
return false;
case VALID_ENCODED_PATTERN_W_OUTPUT:
case ENCODED_PATTERN_W_OUTPUT:
case ENCODED_PATTERN: {
if ( i.getItem() instanceof ICraftingPatternItem )
return true;
// ICraftingPatternDetails pattern = i.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem)
// i.getItem()).getPatternForItem( i ) : null;
return false;// pattern != null;
}
case BLANK_PATTERN:
return AEApi.instance().materials().materialBlankPattern.sameAsStack( i );
case PATTERN:
case BLANK_PATTERN:
return materials.blankPattern().isSameAs( i );
if ( i.getItem() instanceof ICraftingPatternItem )
return true;
case PATTERN:
return AEApi.instance().materials().materialBlankPattern.sameAsStack( i );
case INSCRIBER_PLATE:
if ( AEApi.instance().materials().materialNamePress.sameAsStack( i ) )
return true;
for (ItemStack is : Inscribe.PLATES )
if ( Platform.isSameItemPrecise( is, i ) )
if ( i.getItem() instanceof ICraftingPatternItem )
return true;
return false;
return materials.blankPattern().isSameAs( i );
case INSCRIBER_INPUT:
return true;/*
* for (ItemStack is : Inscribe.inputs) if ( Platform.isSameItemPrecise( is, i ) ) return true;
*
* return false;
*/
case INSCRIBER_PLATE:
if ( materials.namePress().isSameAs( i ) )
{
return true;
}
case METAL_INGOTS:
for (ItemStack is : Inscribe.PLATES )
if ( Platform.isSameItemPrecise( is, i ) )
return true;
return isMetalIngot( i );
case VIEW_CELL:
return AEApi.instance().items().itemViewCell.sameAsStack( i );
case ORE:
return appeng.api.AEApi.instance().registries().grinder().getRecipeForInput( i ) != null;
case FUEL:
return TileEntityFurnace.getItemBurnTime( i ) > 0;
case POWERED_TOOL:
return Platform.isChargeable( i );
case QE_SINGULARITY:
return api.materials().materialQESingularity.sameAsStack( i );
case RANGE_BOOSTER:
return api.materials().materialWirelessBooster.sameAsStack( i );
case SPATIAL_STORAGE_CELLS:
return i.getItem() instanceof ISpatialStorageCell && ((ISpatialStorageCell) i.getItem()).isSpatialStorage( i );
case STORAGE_CELLS:
return AEApi.instance().registries().cell().isCellHandled( i );
case WORKBENCH_CELL:
return i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i );
case STORAGE_COMPONENT:
return i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i );
case TRASH:
if ( AEApi.instance().registries().cell().isCellHandled( i ) )
return false;
if ( i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i ) )
return false;
return true;
case ENCODABLE_ITEM:
return i.getItem() instanceof INetworkEncodable || AEApi.instance().registries().wireless().isWirelessTerminal( i );
case BIOMETRIC_CARD:
return i.getItem() instanceof IBiometricCard;
case UPGRADES:
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType( i ) != null;
default:
break;
case INSCRIBER_INPUT:
return true;/*
* for (ItemStack is : Inscribe.inputs) if ( Platform.isSameItemPrecise( is, i ) ) return true;
*
* return false;
*/
case METAL_INGOTS:
return isMetalIngot( i );
case VIEW_CELL:
return items.viewCell().isSameAs( i );
case ORE:
return appeng.api.AEApi.instance().registries().grinder().getRecipeForInput( i ) != null;
case FUEL:
return TileEntityFurnace.getItemBurnTime( i ) > 0;
case POWERED_TOOL:
return Platform.isChargeable( i );
case QE_SINGULARITY:
return materials.qESingularity().isSameAs( i );
case RANGE_BOOSTER:
return materials.wirelessBooster().isSameAs( i );
case SPATIAL_STORAGE_CELLS:
return i.getItem() instanceof ISpatialStorageCell && ((ISpatialStorageCell) i.getItem()).isSpatialStorage( i );
case STORAGE_CELLS:
return AEApi.instance().registries().cell().isCellHandled( i );
case WORKBENCH_CELL:
return i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i );
case STORAGE_COMPONENT:
return i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i );
case TRASH:
if ( AEApi.instance().registries().cell().isCellHandled( i ) )
return false;
return !( i.getItem() instanceof IStorageComponent && ( (IStorageComponent) i.getItem() ).isStorageComponent( i ) );
case ENCODABLE_ITEM:
return i.getItem() instanceof INetworkEncodable || AEApi.instance().registries().wireless().isWirelessTerminal( i );
case BIOMETRIC_CARD:
return i.getItem() instanceof IBiometricCard;
case UPGRADES:
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType( i ) != null;
default:
break;
}
return false;
+3 -3
View File
@@ -193,10 +193,10 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
this.levelByStacks[btnNum] = Math.min( this.levelByStacks[btnNum], buttonCap );
}
for (Enum e : this.settings.getSettings())
for (Settings e : this.settings.getSettings())
{
String Category = "Client"; // e.getClass().getSimpleName();
Enum value = this.settings.getSetting( e );
Enum<?> value = this.settings.getSetting( e );
Property p = this.get( Category, e.name(), value.name(), this.getListComment( value ) );
@@ -376,7 +376,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
@Override
public void updateSetting(IConfigManager manager, Enum setting, Enum newValue)
{
for (Enum e : this.settings.getSettings())
for (Settings e : this.settings.getSettings())
{
if ( e == setting )
{
+1 -1
View File
@@ -29,7 +29,7 @@ import appeng.util.Platform;
public final class AELog
{
public static final FMLRelaunchLog instance = FMLRelaunchLog.log;
public static final FMLRelaunchLog INSTANCE = FMLRelaunchLog.log;
private AELog() {
}
+41 -23
View File
@@ -18,6 +18,7 @@
package appeng.core;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.IAppEngApi;
@@ -41,28 +42,47 @@ import appeng.util.Platform;
public final class Api implements IAppEngApi
{
public static final Api INSTANCE = new Api();
private Api() {
}
private final ApiPart partHelper;
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
private final RegistryContainer rc = new RegistryContainer();
private final ApiStorage storageHelper = new ApiStorage();
private final IRegistryContainer registryContainer;
private final IStorageHelper storageHelper;
private final Materials materials;
private final Items items;
private final Blocks blocks;
private final Parts parts;
private final ApiDefinitions definitions;
public final ApiPart partHelper = new ApiPart();
private final Materials materials = new Materials();
private final Items items = new Items();
private final Blocks blocks = new Blocks();
private final Parts parts = new Parts();
private Api()
{
this.parts = new Parts();
this.blocks = new Blocks();
this.items = new Items();
this.materials = new Materials();
this.storageHelper = new ApiStorage();
this.registryContainer = new RegistryContainer();
this.partHelper = new ApiPart();
this.definitions = new ApiDefinitions( this.partHelper );
}
@Override
public IRegistryContainer registries()
{
return this.rc;
return this.registryContainer;
}
@Override
public IStorageHelper storage()
{
return this.storageHelper;
}
@Override
public IPartHelper partHelper()
{
return this.partHelper;
}
@Override
@@ -90,19 +110,13 @@ public final class Api implements IAppEngApi
}
@Override
public IStorageHelper storage()
public ApiDefinitions definitions()
{
return this.storageHelper;
return this.definitions;
}
@Override
public IPartHelper partHelper()
{
return this.partHelper;
}
@Override
public IGridNode createGridNode(IGridBlock blk)
public IGridNode createGridNode( IGridBlock blk )
{
if ( Platform.isClient() )
throw new RuntimeException( "Grid Features are Server Side Only." );
@@ -110,9 +124,13 @@ public final class Api implements IAppEngApi
}
@Override
public IGridConnection createGridConnection(IGridNode a, IGridNode b) throws FailedConnection
public IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection
{
return new GridConnection( a, b, ForgeDirection.UNKNOWN );
}
public ApiPart getPartHelper()
{
return this.partHelper;
}
}
@@ -0,0 +1,89 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core;
import appeng.api.definitions.IDefinitions;
import appeng.api.parts.IPartHelper;
import appeng.core.api.definitions.ApiBlocks;
import appeng.core.api.definitions.ApiItems;
import appeng.core.api.definitions.ApiMaterials;
import appeng.core.api.definitions.ApiParts;
import appeng.core.api.definitions.DefinitionConstructor;
/**
* Internal implementation of the definitions for the API
*/
public final class ApiDefinitions implements IDefinitions
{
private final ApiBlocks blocks;
private final ApiItems items;
private final ApiMaterials materials;
private final ApiParts parts;
private final FeatureHandlerRegistry handlers;
private final FeatureRegistry features;
public ApiDefinitions( IPartHelper partHelper )
{
this.features = new FeatureRegistry();
this.handlers = new FeatureHandlerRegistry();
final DefinitionConstructor constructor = new DefinitionConstructor( this.features, this.handlers );
this.blocks = new ApiBlocks( constructor );
this.items = new ApiItems( constructor );
this.materials = new ApiMaterials( constructor );
this.parts = new ApiParts( constructor, partHelper );
}
public FeatureHandlerRegistry getFeatureHandlerRegistry()
{
return this.handlers;
}
public FeatureRegistry getFeatureRegistry()
{
return this.features;
}
@Override
public ApiBlocks blocks()
{
return this.blocks;
}
@Override
public ApiItems items()
{
return this.items;
}
@Override
public ApiMaterials materials()
{
return this.materials;
}
@Override
public ApiParts parts()
{
return this.parts;
}
}
+1 -1
View File
@@ -193,7 +193,7 @@ public class AppEng
}
@EventHandler
public void serverStarting( FMLServerAboutToStartEvent evt )
public void serverAboutToStart( FMLServerAboutToStartEvent evt )
{
WorldSettings.getInstance().init();
}
+14 -18
View File
@@ -25,15 +25,15 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.definitions.Items;
import appeng.api.definitions.Materials;
import appeng.api.util.AEItemDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials;
public final class CreativeTab extends CreativeTabs
{
public static CreativeTab instance = null;
public CreativeTab()
@@ -55,25 +55,21 @@ public final class CreativeTab extends CreativeTabs
@Override
public ItemStack getIconItemStack()
{
final IAppEngApi api = AEApi.instance();
final appeng.api.definitions.Blocks blocks = api.blocks();
final Items items = api.items();
final Materials materials = api.materials();
final IDefinitions definitions = AEApi.instance().definitions();
final IBlocks blocks = definitions.blocks();
final IItems items = definitions.items();
final IMaterials materials = definitions.materials();
return this.findFirst( blocks.blockController, blocks.blockChest, blocks.blockCellWorkbench, blocks.blockFluix, items.itemCell1k, items.itemNetworkTool, materials.materialFluixCrystal, materials.materialCertusQuartzCrystal );
return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluix(), items.cell1k(), items.networkTool(), materials.fluixCrystal(), materials.certusQuartzCrystal() );
}
private ItemStack findFirst( AEItemDefinition... choices )
private ItemStack findFirst( IItemDefinition... choices )
{
for ( AEItemDefinition a : choices )
for ( IItemDefinition definition : choices )
{
if ( a != null )
for ( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
{
ItemStack is = a.stack( 1 );
if ( is != null )
{
return is;
}
return definitionStack;
}
}
@@ -19,9 +19,12 @@
package appeng.core;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.items.parts.ItemFacade;
@@ -43,7 +46,13 @@ public final class CreativeTabFacade extends CreativeTabs
@Override
public ItemStack getIconItemStack()
{
return ((ItemFacade) AEApi.instance().items().itemFacade.item()).getCreativeTabIcon();
final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem();
if ( maybeFacade.isPresent() )
{
return ((ItemFacade) maybeFacade.get()).getCreativeTabIcon();
}
return new ItemStack( Blocks.planks );
}
public static void init()
@@ -0,0 +1,41 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core;
import java.util.HashSet;
import java.util.Set;
import appeng.core.features.IFeatureHandler;
public final class FeatureHandlerRegistry
{
private final Set<IFeatureHandler> registry = new HashSet<IFeatureHandler>();
public void addFeatureHandler( IFeatureHandler feature )
{
this.registry.add( feature );
}
public Set<IFeatureHandler> getRegisteredFeatureHandlers()
{
return this.registry;
}
}
@@ -0,0 +1,41 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core;
import java.util.HashSet;
import java.util.Set;
import appeng.core.features.IAEFeature;
public final class FeatureRegistry
{
private final Set<IAEFeature> registry = new HashSet<IAEFeature>();
public void addFeature( IAEFeature feature )
{
this.registry.add( feature );
}
public Set<IAEFeature> getRegisteredFeatures()
{
return this.registry;
}
}
+395 -415
View File
@@ -19,8 +19,9 @@
package appeng.core;
import java.lang.reflect.Field;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase;
@@ -37,14 +38,15 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import com.google.common.base.Optional;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.Upgrades;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials;
import appeng.api.definitions.IParts;
import appeng.api.definitions.Items;
import appeng.api.definitions.Materials;
import appeng.api.definitions.Parts;
@@ -62,116 +64,23 @@ import appeng.api.networking.spatial.ISpatialCache;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.parts.IPartHelper;
import appeng.api.util.AEColor;
import appeng.api.util.AEItemDefinition;
import appeng.block.crafting.BlockCraftingMonitor;
import appeng.block.crafting.BlockCraftingStorage;
import appeng.block.crafting.BlockCraftingUnit;
import appeng.block.crafting.BlockMolecularAssembler;
import appeng.block.grindstone.BlockCrank;
import appeng.block.grindstone.BlockGrinder;
import appeng.block.misc.BlockCellWorkbench;
import appeng.block.misc.BlockCharger;
import appeng.block.misc.BlockCondenser;
import appeng.block.misc.BlockInscriber;
import appeng.block.misc.BlockInterface;
import appeng.block.misc.BlockLightDetector;
import appeng.block.misc.BlockPaint;
import appeng.block.misc.BlockQuartzGrowthAccelerator;
import appeng.block.misc.BlockQuartzTorch;
import appeng.block.misc.BlockSecurity;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.misc.BlockTinyTNT;
import appeng.block.misc.BlockVibrationChamber;
import appeng.block.networking.BlockCableBus;
import appeng.block.networking.BlockController;
import appeng.block.networking.BlockCreativeEnergyCell;
import appeng.block.networking.BlockDenseEnergyCell;
import appeng.block.networking.BlockEnergyAcceptor;
import appeng.block.networking.BlockEnergyCell;
import appeng.block.networking.BlockWireless;
import appeng.block.qnb.BlockQuantumLinkChamber;
import appeng.block.qnb.BlockQuantumRing;
import appeng.block.solids.BlockFluix;
import appeng.block.solids.BlockQuartz;
import appeng.block.solids.BlockQuartzChiseled;
import appeng.block.solids.BlockQuartzGlass;
import appeng.block.solids.BlockQuartzLamp;
import appeng.block.solids.BlockQuartzPillar;
import appeng.block.solids.BlockSkyStone;
import appeng.block.solids.OreQuartz;
import appeng.block.solids.OreQuartzCharged;
import appeng.block.spatial.BlockMatrixFrame;
import appeng.block.spatial.BlockSpatialIOPort;
import appeng.block.spatial.BlockSpatialPylon;
import appeng.block.stair.ChiseledQuartzStairBlock;
import appeng.block.stair.FluixStairBlock;
import appeng.block.stair.QuartzPillarStairBlock;
import appeng.block.stair.QuartzStairBlock;
import appeng.block.stair.SkyStoneBlockStairBlock;
import appeng.block.stair.SkyStoneBrickStairBlock;
import appeng.block.stair.SkyStoneSmallBrickStairBlock;
import appeng.block.stair.SkyStoneStairBlock;
import appeng.block.storage.BlockChest;
import appeng.block.storage.BlockDrive;
import appeng.block.storage.BlockIOPort;
import appeng.block.storage.BlockSkyChest;
import appeng.core.features.AEFeature;
import appeng.core.features.ColoredItemDefinition;
import appeng.core.features.DamagedItemDefinition;
import appeng.core.features.DefinitionConverter;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
import appeng.core.features.IStackSrc;
import appeng.core.features.ItemStackSrc;
import appeng.core.features.NullItemDefinition;
import appeng.core.features.WrappedDamageItemDefinition;
import appeng.core.features.registries.P2PTunnelRegistry;
import appeng.core.features.registries.entries.BasicCellHandler;
import appeng.core.features.registries.entries.CreativeCellHandler;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration;
import appeng.debug.BlockChunkloader;
import appeng.debug.BlockCubeGenerator;
import appeng.debug.BlockItemGen;
import appeng.debug.BlockPhantomNode;
import appeng.debug.ToolDebugCard;
import appeng.debug.ToolEraser;
import appeng.debug.ToolMeteoritePlacer;
import appeng.debug.ToolReplicatorCard;
import appeng.hooks.AETrading;
import appeng.hooks.MeteoriteWorldGen;
import appeng.hooks.QuartzWorldGen;
import appeng.worldgen.MeteoriteWorldGen;
import appeng.worldgen.QuartzWorldGen;
import appeng.hooks.TickHandler;
import appeng.integration.IntegrationType;
import appeng.items.materials.ItemMultiMaterial;
import appeng.items.materials.MaterialType;
import appeng.items.misc.ItemCrystalSeed;
import appeng.items.misc.ItemEncodedPattern;
import appeng.items.misc.ItemPaintBall;
import appeng.items.parts.ItemFacade;
import appeng.items.parts.ItemMultiPart;
import appeng.items.parts.PartType;
import appeng.items.storage.ItemBasicStorageCell;
import appeng.items.storage.ItemCreativeStorageCell;
import appeng.items.storage.ItemSpatialStorageCell;
import appeng.items.storage.ItemViewCell;
import appeng.items.tools.ToolBiometricCard;
import appeng.items.tools.ToolMemoryCard;
import appeng.items.tools.ToolNetworkTool;
import appeng.items.tools.powered.ToolChargedStaff;
import appeng.items.tools.powered.ToolColorApplicator;
import appeng.items.tools.powered.ToolEntropyManipulator;
import appeng.items.tools.powered.ToolMassCannon;
import appeng.items.tools.powered.ToolPortableCell;
import appeng.items.tools.powered.ToolWirelessTerminal;
import appeng.items.tools.quartz.ToolQuartzAxe;
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
import appeng.items.tools.quartz.ToolQuartzHoe;
import appeng.items.tools.quartz.ToolQuartzPickaxe;
import appeng.items.tools.quartz.ToolQuartzSpade;
import appeng.items.tools.quartz.ToolQuartzSword;
import appeng.items.tools.quartz.ToolQuartzWrench;
import appeng.me.cache.CraftingGridCache;
import appeng.me.cache.EnergyGridCache;
import appeng.me.cache.GridStorageCache;
@@ -207,7 +116,6 @@ import appeng.recipes.ores.OreDictionaryHandler;
import appeng.spatial.BiomeGenStorage;
import appeng.spatial.StorageWorldProvider;
import appeng.tile.AEBaseTile;
import appeng.util.ClassInstantiation;
import appeng.util.Platform;
@@ -216,37 +124,22 @@ public final class Registration
final public static Registration INSTANCE = new Registration();
private final RecipeHandler recipeHandler;
private final Multimap<AEFeature, Class<? extends IAEFeature>> featuresToEntities;
private final DefinitionConverter converter;
public BiomeGenBase storageBiome;
private Registration()
{
this.converter = new DefinitionConverter();
this.recipeHandler = new RecipeHandler();
this.featuresToEntities = ArrayListMultimap.create();
}
public void preInitialize( FMLPreInitializationEvent event )
{
this.registerSpatial( false );
IRecipeHandlerRegistry recipeRegistry = AEApi.instance().registries().recipes();
recipeRegistry.addNewSubItemResolver( new AEItemResolver() );
recipeRegistry.addNewCraftHandler( "hccrusher", HCCrusher.class );
recipeRegistry.addNewCraftHandler( "mekcrusher", MekCrusher.class );
recipeRegistry.addNewCraftHandler( "mekechamber", MekEnrichment.class );
recipeRegistry.addNewCraftHandler( "grind", Grind.class );
recipeRegistry.addNewCraftHandler( "crusher", Crusher.class );
recipeRegistry.addNewCraftHandler( "grindfz", GrindFZ.class );
recipeRegistry.addNewCraftHandler( "pulverizer", Pulverizer.class );
recipeRegistry.addNewCraftHandler( "macerator", Macerator.class );
recipeRegistry.addNewCraftHandler( "smelt", Smelt.class );
recipeRegistry.addNewCraftHandler( "inscribe", Inscribe.class );
recipeRegistry.addNewCraftHandler( "press", Press.class );
recipeRegistry.addNewCraftHandler( "shaped", Shaped.class );
recipeRegistry.addNewCraftHandler( "shapeless", Shapeless.class );
final Api api = Api.INSTANCE;
IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
this.registerCraftHandlers( recipeRegistry );
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
@@ -254,219 +147,33 @@ public final class Registration
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
Items items = Api.INSTANCE.items();
Materials materials = Api.INSTANCE.materials();
Parts parts = Api.INSTANCE.parts();
Blocks blocks = Api.INSTANCE.blocks();
final ApiDefinitions definitions = api.definitions();
AEItemDefinition materialItem = this.addFeature( ItemMultiMaterial.class );
final IBlocks apiBlocks = definitions.blocks();
final IItems apiItems = definitions.items();
final IMaterials apiMaterials = definitions.materials();
final IParts apiParts = definitions.parts();
Class<?> materialClass = materials.getClass();
for ( MaterialType mat : MaterialType.values() )
final Items items = api.items();
final Materials materials = api.materials();
final Parts parts = api.parts();
final Blocks blocks = api.blocks();
this.assignMaterials( materials, apiMaterials );
this.assignParts( parts, apiParts );
this.assignBlocks( blocks, apiBlocks );
this.assignItems( items, apiItems );
// Register all detected handlers and features (items, blocks) in pre-init
for ( IFeatureHandler handler : definitions.getFeatureHandlerRegistry().getRegisteredFeatureHandlers() )
{
try
{
if ( mat == MaterialType.InvalidType )
( ( ItemMultiMaterial ) materialItem.item() ).createMaterial( mat );
else
{
Field f = materialClass.getField( "material" + mat.name() );
IStackSrc is = ( ( ItemMultiMaterial ) materialItem.item() ).createMaterial( mat );
if ( is != null )
f.set( materials, new DamagedItemDefinition( is ) );
else
f.set( materials, new NullItemDefinition() );
}
}
catch ( Throwable err )
{
AELog.severe( "Error creating material: " + mat.name() );
throw new RuntimeException( err );
}
handler.register();
}
AEItemDefinition partItem = this.addFeature( ItemMultiPart.class );
Class<?> partClass = parts.getClass();
for ( PartType type : PartType.values() )
for ( IAEFeature feature : definitions.getFeatureRegistry().getRegisteredFeatures() )
{
try
{
if ( type == PartType.InvalidType )
( ( ItemMultiPart ) partItem.item() ).createPart( type, null );
else
{
Field f = partClass.getField( "part" + type.name() );
Enum<AEColor>[] variants = type.getVariants();
if ( variants == null )
{
ItemStackSrc is = ( ( ItemMultiPart ) partItem.item() ).createPart( type, null );
if ( is != null )
f.set( parts, new DamagedItemDefinition( is ) );
else
f.set( parts, new NullItemDefinition() );
}
else
{
if ( variants[0] instanceof AEColor )
{
ColoredItemDefinition def = new ColoredItemDefinition();
for ( Enum<AEColor> v : variants )
{
ItemStackSrc is = ( ( ItemMultiPart ) partItem.item() ).createPart( type, v );
if ( is != null )
def.add( ( AEColor ) v, is );
}
f.set( parts, def );
}
}
}
}
catch ( Throwable err )
{
AELog.severe( "Error creating part: " + type.name() );
throw new RuntimeException( err );
}
feature.postInit();
}
// very important block!
blocks.blockMultiPart = this.addFeature( BlockCableBus.class );
blocks.blockCraftingUnit = this.addFeature( BlockCraftingUnit.class );
blocks.blockCraftingAccelerator = new WrappedDamageItemDefinition( blocks.blockCraftingUnit, 1 );
blocks.blockCraftingMonitor = this.addFeature( BlockCraftingMonitor.class );
blocks.blockCraftingStorage1k = this.addFeature( BlockCraftingStorage.class );
blocks.blockCraftingStorage4k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 1 );
blocks.blockCraftingStorage16k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 2 );
blocks.blockCraftingStorage64k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 3 );
blocks.blockMolecularAssembler = this.addFeature( BlockMolecularAssembler.class );
blocks.blockQuartzOre = this.addFeature( OreQuartz.class );
blocks.blockQuartzOreCharged = this.addFeature( OreQuartzCharged.class );
blocks.blockMatrixFrame = this.addFeature( BlockMatrixFrame.class );
blocks.blockQuartz = this.addFeature( BlockQuartz.class );
blocks.blockFluix = this.addFeature( BlockFluix.class );
blocks.blockSkyStone = this.addFeature( BlockSkyStone.class );
blocks.blockSkyChest = this.addFeature( BlockSkyChest.class );
blocks.blockSkyCompass = this.addFeature( BlockSkyCompass.class );
blocks.blockQuartzGlass = this.addFeature( BlockQuartzGlass.class );
blocks.blockQuartzVibrantGlass = this.addFeature( BlockQuartzLamp.class );
blocks.blockQuartzPillar = this.addFeature( BlockQuartzPillar.class );
blocks.blockQuartzChiseled = this.addFeature( BlockQuartzChiseled.class );
blocks.blockQuartzTorch = this.addFeature( BlockQuartzTorch.class );
blocks.blockLightDetector = this.addFeature( BlockLightDetector.class );
blocks.blockCharger = this.addFeature( BlockCharger.class );
blocks.blockQuartzGrowthAccelerator = this.addFeature( BlockQuartzGrowthAccelerator.class );
blocks.blockGrindStone = this.addFeature( BlockGrinder.class );
blocks.blockCrankHandle = this.addFeature( BlockCrank.class );
blocks.blockInscriber = this.addFeature( BlockInscriber.class );
blocks.blockWireless = this.addFeature( BlockWireless.class );
blocks.blockTinyTNT = this.addFeature( BlockTinyTNT.class );
blocks.blockQuantumRing = this.addFeature( BlockQuantumRing.class );
blocks.blockQuantumLink = this.addFeature( BlockQuantumLinkChamber.class );
blocks.blockSpatialPylon = this.addFeature( BlockSpatialPylon.class );
blocks.blockSpatialIOPort = this.addFeature( BlockSpatialIOPort.class );
blocks.blockController = this.addFeature( BlockController.class );
blocks.blockDrive = this.addFeature( BlockDrive.class );
blocks.blockChest = this.addFeature( BlockChest.class );
blocks.blockInterface = this.addFeature( BlockInterface.class );
blocks.blockCellWorkbench = this.addFeature( BlockCellWorkbench.class );
blocks.blockIOPort = this.addFeature( BlockIOPort.class );
blocks.blockCondenser = this.addFeature( BlockCondenser.class );
blocks.blockEnergyAcceptor = this.addFeature( BlockEnergyAcceptor.class );
blocks.blockVibrationChamber = this.addFeature( BlockVibrationChamber.class );
blocks.blockEnergyCell = this.addFeature( BlockEnergyCell.class );
blocks.blockEnergyCellDense = this.addFeature( BlockDenseEnergyCell.class );
blocks.blockEnergyCellCreative = this.addFeature( BlockCreativeEnergyCell.class );
blocks.blockSecurity = this.addFeature( BlockSecurity.class );
blocks.blockPaint = this.addFeature( BlockPaint.class );
items.itemCellCreative = this.addFeature( ItemCreativeStorageCell.class );
items.itemViewCell = this.addFeature( ItemViewCell.class );
items.itemEncodedPattern = this.addFeature( ItemEncodedPattern.class );
items.itemCell1k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell1kPart, 1 );
items.itemCell4k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell4kPart, 4 );
items.itemCell16k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell16kPart, 16 );
items.itemCell64k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell64kPart, 64 );
items.itemSpatialCell2 = this.addFeature( ItemSpatialStorageCell.class, MaterialType.Cell2SpatialPart, 2 );
items.itemSpatialCell16 = this.addFeature( ItemSpatialStorageCell.class, MaterialType.Cell16SpatialPart, 16 );
items.itemSpatialCell128 = this.addFeature( ItemSpatialStorageCell.class, MaterialType.Cell128SpatialPart, 128 );
items.itemCertusQuartzKnife = this.addFeature( ToolQuartzCuttingKnife.class, AEFeature.CertusQuartzTools );
items.itemCertusQuartzWrench = this.addFeature( ToolQuartzWrench.class, AEFeature.CertusQuartzTools );
items.itemCertusQuartzAxe = this.addFeature( ToolQuartzAxe.class, AEFeature.CertusQuartzTools );
items.itemCertusQuartzHoe = this.addFeature( ToolQuartzHoe.class, AEFeature.CertusQuartzTools );
items.itemCertusQuartzPick = this.addFeature( ToolQuartzPickaxe.class, AEFeature.CertusQuartzTools );
items.itemCertusQuartzShovel = this.addFeature( ToolQuartzSpade.class, AEFeature.CertusQuartzTools );
items.itemCertusQuartzSword = this.addFeature( ToolQuartzSword.class, AEFeature.CertusQuartzTools );
items.itemNetherQuartzKnife = this.addFeature( ToolQuartzCuttingKnife.class, AEFeature.NetherQuartzTools );
items.itemNetherQuartzWrench = this.addFeature( ToolQuartzWrench.class, AEFeature.NetherQuartzTools );
items.itemNetherQuartzAxe = this.addFeature( ToolQuartzAxe.class, AEFeature.NetherQuartzTools );
items.itemNetherQuartzHoe = this.addFeature( ToolQuartzHoe.class, AEFeature.NetherQuartzTools );
items.itemNetherQuartzPick = this.addFeature( ToolQuartzPickaxe.class, AEFeature.NetherQuartzTools );
items.itemNetherQuartzShovel = this.addFeature( ToolQuartzSpade.class, AEFeature.NetherQuartzTools );
items.itemNetherQuartzSword = this.addFeature( ToolQuartzSword.class, AEFeature.NetherQuartzTools );
items.itemMassCannon = this.addFeature( ToolMassCannon.class );
items.itemMemoryCard = this.addFeature( ToolMemoryCard.class );
items.itemChargedStaff = this.addFeature( ToolChargedStaff.class );
items.itemEntropyManipulator = this.addFeature( ToolEntropyManipulator.class );
items.itemColorApplicator = this.addFeature( ToolColorApplicator.class );
items.itemWirelessTerminal = this.addFeature( ToolWirelessTerminal.class );
items.itemNetworkTool = this.addFeature( ToolNetworkTool.class );
items.itemPortableCell = this.addFeature( ToolPortableCell.class );
items.itemBiometricCard = this.addFeature( ToolBiometricCard.class );
items.itemFacade = this.addFeature( ItemFacade.class );
items.itemCrystalSeed = this.addFeature( ItemCrystalSeed.class );
ColoredItemDefinition paintBall;
ColoredItemDefinition lumenPaintBall;
items.itemPaintBall = paintBall = new ColoredItemDefinition();
items.itemLumenPaintBall = lumenPaintBall = new ColoredItemDefinition();
AEItemDefinition pb = this.addFeature( ItemPaintBall.class );
for ( AEColor c : AEColor.values() )
{
if ( c != AEColor.Transparent )
{
paintBall.add( c, new ItemStackSrc( pb.item(), c.ordinal() ) );
lumenPaintBall.add( c, new ItemStackSrc( pb.item(), 20 + c.ordinal() ) );
}
}
// stairs
this.addFeature( SkyStoneStairBlock.class, blocks.blockSkyStone.block(), 0 );
this.addFeature( SkyStoneBlockStairBlock.class, blocks.blockSkyStone.block(), 1 );
this.addFeature( SkyStoneBrickStairBlock.class, blocks.blockSkyStone.block(), 2 );
this.addFeature( SkyStoneSmallBrickStairBlock.class, blocks.blockSkyStone.block(), 3 );
this.addFeature( FluixStairBlock.class, blocks.blockFluix.block() );
this.addFeature( QuartzStairBlock.class, blocks.blockQuartz.block() );
this.addFeature( ChiseledQuartzStairBlock.class, blocks.blockQuartzChiseled.block() );
this.addFeature( QuartzPillarStairBlock.class, blocks.blockQuartzPillar.block() );
// unsupported developer tools
this.addFeature( ToolEraser.class );
this.addFeature( ToolMeteoritePlacer.class );
this.addFeature( ToolDebugCard.class );
this.addFeature( ToolReplicatorCard.class );
this.addFeature( BlockItemGen.class );
this.addFeature( BlockChunkloader.class );
this.addFeature( BlockPhantomNode.class );
this.addFeature( BlockCubeGenerator.class );
}
private void registerSpatial( boolean force )
@@ -508,40 +215,296 @@ public final class Registration
}
}
private AEItemDefinition addFeature( Class<? extends IAEFeature> featureClass, Object... args )
private void registerCraftHandlers( IRecipeHandlerRegistry registry )
{
final ClassInstantiation<IAEFeature> instantiation = new ClassInstantiation<IAEFeature>( featureClass, args );
final Optional<IAEFeature> instance = instantiation.get();
registry.addNewSubItemResolver( new AEItemResolver() );
if ( instance.isPresent() )
{
final IAEFeature feature = instance.get();
final IFeatureHandler handler = feature.handler();
if ( handler.isFeatureAvailable() )
{
for ( AEFeature f : handler.getFeatures() )
{
this.featuresToEntities.put( f, featureClass );
}
registry.addNewCraftHandler( "hccrusher", HCCrusher.class );
registry.addNewCraftHandler( "mekcrusher", MekCrusher.class );
registry.addNewCraftHandler( "mekechamber", MekEnrichment.class );
registry.addNewCraftHandler( "grind", Grind.class );
registry.addNewCraftHandler( "crusher", Crusher.class );
registry.addNewCraftHandler( "grindfz", GrindFZ.class );
registry.addNewCraftHandler( "pulverizer", Pulverizer.class );
registry.addNewCraftHandler( "macerator", Macerator.class );
handler.register();
feature.postInit();
registry.addNewCraftHandler( "smelt", Smelt.class );
registry.addNewCraftHandler( "inscribe", Inscribe.class );
registry.addNewCraftHandler( "press", Press.class );
return handler.getDefinition();
}
else
{
return null;
}
}
else
{
throw new RuntimeException( "Error upon Class Instantiation with Feature: " + featureClass.getName() );
}
registry.addNewCraftHandler( "shaped", Shaped.class );
registry.addNewCraftHandler( "shapeless", Shapeless.class );
}
/**
* Assigns materials from the new API to the old API
*
* Uses direct cast, since its only a temporary solution anyways
*
* @param target old API
* @param source new API
*
* @deprecated to be removed when the public definition API is removed
*/
@Deprecated
private void assignMaterials( Materials target, IMaterials source )
{
target.materialCell2SpatialPart = this.converter.of( source.cell2SpatialPart() );
target.materialCell16SpatialPart = this.converter.of( source.cell16SpatialPart() );
target.materialCell128SpatialPart = this.converter.of( source.cell128SpatialPart() );
target.materialSilicon = this.converter.of( source.silicon() );
target.materialSkyDust = this.converter.of( source.skyDust() );
target.materialCalcProcessorPress = this.converter.of( source.calcProcessorPress() );
target.materialEngProcessorPress = this.converter.of( source.engProcessorPress() );
target.materialLogicProcessorPress = this.converter.of( source.logicProcessorPress() );
target.materialCalcProcessorPrint = this.converter.of( source.calcProcessorPrint() );
target.materialEngProcessorPrint = this.converter.of( source.engProcessorPrint() );
target.materialLogicProcessorPrint = this.converter.of( source.logicProcessorPrint() );
target.materialSiliconPress = this.converter.of( source.siliconPress() );
target.materialSiliconPrint = this.converter.of( source.siliconPrint() );
target.materialNamePress = this.converter.of( source.namePress() );
target.materialLogicProcessor = this.converter.of( source.logicProcessor() );
target.materialCalcProcessor = this.converter.of( source.calcProcessor() );
target.materialEngProcessor = this.converter.of( source.engProcessor() );
target.materialBasicCard = this.converter.of( source.basicCard() );
target.materialAdvCard = this.converter.of( source.advCard() );
target.materialPurifiedCertusQuartzCrystal = this.converter.of( source.purifiedCertusQuartzCrystal() );
target.materialPurifiedNetherQuartzCrystal = this.converter.of( source.purifiedNetherQuartzCrystal() );
target.materialPurifiedFluixCrystal = this.converter.of( source.purifiedFluixCrystal() );
target.materialCell1kPart = this.converter.of( source.cell1kPart() );
target.materialCell4kPart = this.converter.of( source.cell4kPart() );
target.materialCell16kPart = this.converter.of( source.cell16kPart() );
target.materialCell64kPart = this.converter.of( source.cell64kPart() );
target.materialEmptyStorageCell = this.converter.of( source.emptyStorageCell() );
target.materialCardRedstone = this.converter.of( source.cardRedstone() );
target.materialCardSpeed = this.converter.of( source.cardSpeed() );
target.materialCardCapacity = this.converter.of( source.cardCapacity() );
target.materialCardFuzzy = this.converter.of( source.cardFuzzy() );
target.materialCardInverter = this.converter.of( source.cardInverter() );
target.materialCardCrafting = this.converter.of( source.cardCrafting() );
target.materialEnderDust = this.converter.of( source.enderDust() );
target.materialFlour = this.converter.of( source.flour() );
target.materialGoldDust = this.converter.of( source.goldDust() );
target.materialIronDust = this.converter.of( source.ironDust() );
target.materialFluixDust = this.converter.of( source.fluixDust() );
target.materialCertusQuartzDust = this.converter.of( source.certusQuartzDust() );
target.materialNetherQuartzDust = this.converter.of( source.netherQuartzDust() );
target.materialMatterBall = this.converter.of( source.matterBall() );
target.materialIronNugget = this.converter.of( source.ironNugget() );
target.materialCertusQuartzCrystal = this.converter.of( source.certusQuartzCrystal() );
target.materialCertusQuartzCrystalCharged = this.converter.of( source.certusQuartzCrystalCharged() );
target.materialFluixCrystal = this.converter.of( source.fluixCrystal() );
target.materialFluixPearl = this.converter.of( source.fluixPearl() );
target.materialWoodenGear = this.converter.of( source.woodenGear() );
target.materialWireless = this.converter.of( source.wireless() );
target.materialWirelessBooster = this.converter.of( source.wirelessBooster() );
target.materialAnnihilationCore = this.converter.of( source.annihilationCore() );
target.materialFormationCore = this.converter.of( source.formationCore() );
target.materialSingularity = this.converter.of( source.singularity() );
target.materialQESingularity = this.converter.of( source.qESingularity() );
target.materialBlankPattern = this.converter.of( source.blankPattern() );
}
/**
* Assigns parts from the new API to the old API
*
* @param target old API
* @param source new API
*
* @deprecated to be removed when the public definition API is removed
*/
@Deprecated
private void assignParts( Parts target, IParts source )
{
target.partCableSmart = source.cableSmart();
target.partCableCovered = source.cableCovered();
target.partCableGlass = source.cableGlass();
target.partCableDense = source.cableDense();
// target.partLumenCableSmart = source.lumenCableSmart();
// target.partLumenCableCovered = source.lumenCableCovered();
// target.partLumenCableGlass = source.lumenCableGlass();
// target.partLumenCableDense = source.lumenCableDense();
target.partQuartzFiber = this.converter.of( source.quartzFiber() );
target.partToggleBus = this.converter.of( source.toggleBus() );
target.partInvertedToggleBus = this.converter.of( source.invertedToggleBus() );
target.partStorageBus = this.converter.of( source.storageBus() );
target.partImportBus = this.converter.of( source.importBus() );
target.partExportBus = this.converter.of( source.exportBus() );
target.partInterface = this.converter.of( source.iface() );
target.partLevelEmitter = this.converter.of( source.levelEmitter() );
target.partAnnihilationPlane = this.converter.of( source.annihilationPlane() );
target.partFormationPlane = this.converter.of( source.formationPlane() );
target.partCableAnchor = this.converter.of( source.cableAnchor() );
target.partP2PTunnelLight = target.partCableAnchor;
target.partP2PTunnelRF = target.partP2PTunnelLight;
target.partP2PTunnelEU = target.partP2PTunnelRF;
target.partP2PTunnelLiquids = target.partP2PTunnelEU;
target.partP2PTunnelItems = target.partP2PTunnelLiquids;
target.partP2PTunnelRedstone = target.partP2PTunnelItems;
target.partP2PTunnelME = target.partP2PTunnelRedstone;
target.partMonitor = this.converter.of( source.monitor() );
target.partSemiDarkMonitor = this.converter.of( source.semiDarkMonitor() );
target.partDarkMonitor = this.converter.of( source.darkMonitor() );
target.partInterfaceTerminal = this.converter.of( source.interfaceTerminal() );
target.partPatternTerminal = this.converter.of( source.patternTerminal() );
target.partCraftingTerminal = this.converter.of( source.craftingTerminal() );
target.partTerminal = this.converter.of( source.terminal() );
target.partStorageMonitor = this.converter.of( source.storageMonitor() );
target.partConversionMonitor = this.converter.of( source.conversionMonitor() );
}
/**
* Assigns blocks from the new API to the old API
*
* @param target old API
* @param source new API
*
* @deprecated to be removed when the public definition API is removed
*/
@Deprecated
private void assignBlocks( Blocks target, IBlocks source )
{
target.blockMultiPart = this.converter.of( source.multiPart() );
target.blockCraftingUnit = this.converter.of( source.craftingUnit() );
target.blockCraftingAccelerator = this.converter.of( source.craftingAccelerator() );
target.blockCraftingMonitor = this.converter.of( source.craftingMonitor() );
target.blockCraftingStorage1k = this.converter.of( source.craftingStorage1k() );
target.blockCraftingStorage4k = this.converter.of( source.craftingStorage4k() );
target.blockCraftingStorage16k = this.converter.of( source.craftingStorage16k() );
target.blockCraftingStorage64k = this.converter.of( source.craftingStorage64k() );
target.blockMolecularAssembler = this.converter.of( source.molecularAssembler() );
target.blockQuartzOre = this.converter.of( source.quartzOre() );
target.blockQuartzOreCharged = this.converter.of( source.quartzOreCharged() );
target.blockMatrixFrame = this.converter.of( source.matrixFrame() );
target.blockQuartz = this.converter.of( source.quartz() );
target.blockFluix = this.converter.of( source.fluix() );
target.blockSkyStone = this.converter.of( source.skyStone() );
target.blockSkyChest = this.converter.of( source.skyChest() );
target.blockSkyCompass = this.converter.of( source.skyCompass() );
target.blockQuartzGlass = this.converter.of( source.quartzGlass() );
target.blockQuartzVibrantGlass = this.converter.of( source.quartzVibrantGlass() );
target.blockQuartzPillar = this.converter.of( source.quartzPillar() );
target.blockQuartzChiseled = this.converter.of( source.quartzChiseled() );
target.blockQuartzTorch = this.converter.of( source.quartzTorch() );
target.blockLightDetector = this.converter.of( source.lightDetector() );
target.blockCharger = this.converter.of( source.charger() );
target.blockQuartzGrowthAccelerator = this.converter.of( source.quartzGrowthAccelerator() );
target.blockGrindStone = this.converter.of( source.grindStone() );
target.blockCrankHandle = this.converter.of( source.crankHandle() );
target.blockInscriber = this.converter.of( source.inscriber() );
target.blockWireless = this.converter.of( source.wireless() );
target.blockTinyTNT = this.converter.of( source.tinyTNT() );
target.blockQuantumRing = this.converter.of( source.quantumRing() );
target.blockQuantumLink = this.converter.of( source.quantumLink() );
target.blockSpatialPylon = this.converter.of( source.spatialPylon() );
target.blockSpatialIOPort = this.converter.of( source.spatialIOPort() );
target.blockController = this.converter.of( source.controller() );
target.blockDrive = this.converter.of( source.drive() );
target.blockChest = this.converter.of( source.chest() );
target.blockInterface = this.converter.of( source.iface() );
target.blockCellWorkbench = this.converter.of( source.cellWorkbench() );
target.blockIOPort = this.converter.of( source.iOPort() );
target.blockCondenser = this.converter.of( source.condenser() );
target.blockEnergyAcceptor = this.converter.of( source.energyAcceptor() );
target.blockVibrationChamber = this.converter.of( source.vibrationChamber() );
target.blockEnergyCell = this.converter.of( source.energyCell() );
target.blockEnergyCellDense = this.converter.of( source.energyCellDense() );
target.blockEnergyCellCreative = this.converter.of( source.energyCellCreative() );
target.blockSecurity = this.converter.of( source.security() );
target.blockPaint = this.converter.of( source.paint() );
}
/**
* Assigns materials from the new API to the old API
*
* @param target old API
* @param source new API
*
* @deprecated to be removed when the public definition API is removed
*/
@Deprecated
private void assignItems( Items target, IItems source )
{
target.itemCellCreative = this.converter.of( source.cellCreative() );
target.itemViewCell = this.converter.of( source.viewCell() );
target.itemEncodedPattern = this.converter.of( source.encodedPattern() );
target.itemCell1k = this.converter.of( source.cell1k() );
target.itemCell4k = this.converter.of( source.cell4k() );
target.itemCell16k = this.converter.of( source.cell16k() );
target.itemCell64k = this.converter.of( source.cell64k() );
target.itemSpatialCell2 = this.converter.of( source.spatialCell2() );
target.itemSpatialCell16 = this.converter.of( source.spatialCell16() );
target.itemSpatialCell128 = this.converter.of( source.spatialCell128() );
target.itemCertusQuartzKnife = this.converter.of( source.certusQuartzKnife() );
target.itemCertusQuartzWrench = this.converter.of( source.certusQuartzWrench() );
target.itemCertusQuartzAxe = this.converter.of( source.certusQuartzAxe() );
target.itemCertusQuartzHoe = this.converter.of( source.certusQuartzHoe() );
target.itemCertusQuartzPick = this.converter.of( source.certusQuartzPick() );
target.itemCertusQuartzShovel = this.converter.of( source.certusQuartzShovel() );
target.itemCertusQuartzSword = this.converter.of( source.certusQuartzSword() );
target.itemNetherQuartzKnife = this.converter.of( source.netherQuartzKnife() );
target.itemNetherQuartzWrench = this.converter.of( source.netherQuartzWrench() );
target.itemNetherQuartzAxe = this.converter.of( source.netherQuartzAxe() );
target.itemNetherQuartzHoe = this.converter.of( source.netherQuartzHoe() );
target.itemNetherQuartzPick = this.converter.of( source.netherQuartzPick() );
target.itemNetherQuartzShovel = this.converter.of( source.netherQuartzShovel() );
target.itemNetherQuartzSword = this.converter.of( source.netherQuartzSword() );
target.itemMassCannon = this.converter.of( source.massCannon() );
target.itemMemoryCard = this.converter.of( source.memoryCard() );
target.itemChargedStaff = this.converter.of( source.chargedStaff() );
target.itemEntropyManipulator = this.converter.of( source.entropyManipulator() );
target.itemColorApplicator = this.converter.of( source.colorApplicator() );
target.itemWirelessTerminal = this.converter.of( source.wirelessTerminal() );
target.itemNetworkTool = this.converter.of( source.networkTool() );
target.itemPortableCell = this.converter.of( source.portableCell() );
target.itemBiometricCard = this.converter.of( source.biometricCard() );
target.itemFacade = this.converter.of( source.facade() );
target.itemCrystalSeed = this.converter.of( source.crystalSeed() );
target.itemPaintBall = source.coloredPaintBall();
target.itemLumenPaintBall = source.coloredLumenPaintBall();
}
public void initialize( FMLInitializationEvent event )
{
final IAppEngApi api = AEApi.instance();
final IPartHelper partHelper = api.partHelper();
final IRegistryContainer registries = api.registries();
// Perform ore camouflage!
ItemMultiMaterial.instance.makeUnique();
@@ -550,19 +513,18 @@ public final class Registration
else
this.recipeHandler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" );
IPartHelper ph = AEApi.instance().partHelper();
ph.registerNewLayer( "appeng.parts.layers.LayerISidedInventory", "net.minecraft.inventory.ISidedInventory" );
ph.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler", "net.minecraftforge.fluids.IFluidHandler" );
ph.registerNewLayer( "appeng.parts.layers.LayerITileStorageMonitorable", "appeng.api.implementations.tiles.ITileStorageMonitorable" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerISidedInventory", "net.minecraft.inventory.ISidedInventory" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler", "net.minecraftforge.fluids.IFluidHandler" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerITileStorageMonitorable", "appeng.api.implementations.tiles.ITileStorageMonitorable" );
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
}
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
@@ -571,7 +533,7 @@ public final class Registration
MinecraftForge.EVENT_BUS.register( pp );
FMLCommonHandler.instance().bus().register( pp );
IGridCacheRegistry gcr = AEApi.instance().registries().gridCache();
IGridCacheRegistry gcr = registries.gridCache();
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
@@ -581,12 +543,17 @@ public final class Registration
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new AEExternalHandler() );
registries.externalStorage().addExternalStorageInterface( new AEExternalHandler() );
AEApi.instance().registries().cell().addCellHandler( new BasicCellHandler() );
AEApi.instance().registries().cell().addCellHandler( new CreativeCellHandler() );
registries.cell().addCellHandler( new BasicCellHandler() );
registries.cell().addCellHandler( new CreativeCellHandler() );
AEApi.instance().registries().matterCannon().registerAmmo( AEApi.instance().materials().materialMatterBall.stack( 1 ), 32.0 );
for ( ItemStack ammoStack : api.definitions().materials().matterBall().maybeStack( 1 ).asSet() )
{
final double weight = 32;
registries.matterCannon().registerAmmo( ammoStack, weight );
}
this.recipeHandler.injectRecipes();
@@ -607,95 +574,108 @@ public final class Registration
final IAppEngApi api = AEApi.instance();
final IRegistryContainer registries = api.registries();
final Parts parts = api.parts();
final Blocks blocks = api.blocks();
final Items items = api.items();
final IDefinitions definitions = api.definitions();
final IParts parts = definitions.parts();
final IBlocks blocks = definitions.blocks();
final IItems items = definitions.items();
// default settings..
( ( P2PTunnelRegistry ) registries.p2pTunnel() ).configure();
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
// add to localization..
PlayerMessages.values();
GuiText.values();
Api.INSTANCE.partHelper.initFMPSupport();
( ( BlockCableBus ) blocks.blockMultiPart.block() ).setupTile();
Api.INSTANCE.getPartHelper().initFMPSupport();
for ( Block block : blocks.multiPart().maybeBlock().asSet() )
{
( (BlockCableBus) block ).setupTile();
}
// Interface
Upgrades.CRAFTING.registerItem( parts.partInterface, 1 );
Upgrades.CRAFTING.registerItem( blocks.blockInterface, 1 );
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
Upgrades.CRAFTING.registerItem( blocks.iface(), 1 );
// IO Port!
Upgrades.SPEED.registerItem( blocks.blockIOPort, 3 );
Upgrades.REDSTONE.registerItem( blocks.blockIOPort, 1 );
Upgrades.SPEED.registerItem( blocks.iOPort(), 3 );
Upgrades.REDSTONE.registerItem( blocks.iOPort(), 1 );
// Level Emitter!
Upgrades.FUZZY.registerItem( parts.partLevelEmitter, 1 );
Upgrades.CRAFTING.registerItem( parts.partLevelEmitter, 1 );
Upgrades.FUZZY.registerItem( parts.levelEmitter(), 1 );
Upgrades.CRAFTING.registerItem( parts.levelEmitter(), 1 );
// Import Bus
Upgrades.FUZZY.registerItem( parts.partImportBus, 1 );
Upgrades.REDSTONE.registerItem( parts.partImportBus, 1 );
Upgrades.CAPACITY.registerItem( parts.partImportBus, 2 );
Upgrades.SPEED.registerItem( parts.partImportBus, 4 );
Upgrades.FUZZY.registerItem( parts.importBus(), 1 );
Upgrades.REDSTONE.registerItem( parts.importBus(), 1 );
Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
Upgrades.SPEED.registerItem( parts.importBus(), 4 );
// Export Bus
Upgrades.FUZZY.registerItem( parts.partExportBus, 1 );
Upgrades.REDSTONE.registerItem( parts.partExportBus, 1 );
Upgrades.CAPACITY.registerItem( parts.partExportBus, 2 );
Upgrades.SPEED.registerItem( parts.partExportBus, 4 );
Upgrades.CRAFTING.registerItem( parts.partExportBus, 1 );
Upgrades.FUZZY.registerItem( parts.exportBus(), 1 );
Upgrades.REDSTONE.registerItem( parts.exportBus(), 1 );
Upgrades.CAPACITY.registerItem( parts.exportBus(), 2 );
Upgrades.SPEED.registerItem( parts.exportBus(), 4 );
Upgrades.CRAFTING.registerItem( parts.exportBus(), 1 );
// Storage Cells
Upgrades.FUZZY.registerItem( items.itemCell1k, 1 );
Upgrades.INVERTER.registerItem( items.itemCell1k, 1 );
Upgrades.FUZZY.registerItem( items.cell1k(), 1 );
Upgrades.INVERTER.registerItem( items.cell1k(), 1 );
Upgrades.FUZZY.registerItem( items.itemCell4k, 1 );
Upgrades.INVERTER.registerItem( items.itemCell4k, 1 );
Upgrades.FUZZY.registerItem( items.cell4k(), 1 );
Upgrades.INVERTER.registerItem( items.cell4k(), 1 );
Upgrades.FUZZY.registerItem( items.itemCell16k, 1 );
Upgrades.INVERTER.registerItem( items.itemCell16k, 1 );
Upgrades.FUZZY.registerItem( items.cell16k(), 1 );
Upgrades.INVERTER.registerItem( items.cell16k(), 1 );
Upgrades.FUZZY.registerItem( items.itemCell64k, 1 );
Upgrades.INVERTER.registerItem( items.itemCell64k, 1 );
Upgrades.FUZZY.registerItem( items.cell64k(), 1 );
Upgrades.INVERTER.registerItem( items.cell64k(), 1 );
Upgrades.FUZZY.registerItem( items.itemPortableCell, 1 );
Upgrades.INVERTER.registerItem( items.itemPortableCell, 1 );
Upgrades.FUZZY.registerItem( items.portableCell(), 1 );
Upgrades.INVERTER.registerItem( items.portableCell(), 1 );
Upgrades.FUZZY.registerItem( items.itemViewCell, 1 );
Upgrades.INVERTER.registerItem( items.itemViewCell, 1 );
Upgrades.FUZZY.registerItem( items.viewCell(), 1 );
Upgrades.INVERTER.registerItem( items.viewCell(), 1 );
// Storage Bus
Upgrades.FUZZY.registerItem( parts.partStorageBus, 1 );
Upgrades.INVERTER.registerItem( parts.partStorageBus, 1 );
Upgrades.CAPACITY.registerItem( parts.partStorageBus, 5 );
Upgrades.FUZZY.registerItem( parts.storageBus(), 1 );
Upgrades.INVERTER.registerItem( parts.storageBus(), 1 );
Upgrades.CAPACITY.registerItem( parts.storageBus(), 5 );
// Formation Plane
Upgrades.FUZZY.registerItem( parts.partFormationPlane, 1 );
Upgrades.INVERTER.registerItem( parts.partFormationPlane, 1 );
Upgrades.CAPACITY.registerItem( parts.partFormationPlane, 5 );
Upgrades.FUZZY.registerItem( parts.formationPlane(), 1 );
Upgrades.INVERTER.registerItem( parts.formationPlane(), 1 );
Upgrades.CAPACITY.registerItem( parts.formationPlane(), 5 );
// Matter Cannon
Upgrades.FUZZY.registerItem( items.itemMassCannon, 1 );
Upgrades.INVERTER.registerItem( items.itemMassCannon, 1 );
Upgrades.SPEED.registerItem( items.itemMassCannon, 4 );
Upgrades.FUZZY.registerItem( items.massCannon(), 1 );
Upgrades.INVERTER.registerItem( items.massCannon(), 1 );
Upgrades.SPEED.registerItem( items.massCannon(), 4 );
// Molecular Assembler
Upgrades.SPEED.registerItem( blocks.blockMolecularAssembler, 5 );
Upgrades.SPEED.registerItem( blocks.molecularAssembler(), 5 );
// Inscriber
Upgrades.SPEED.registerItem( blocks.blockInscriber, 3 );
Upgrades.SPEED.registerItem( blocks.inscriber(), 3 );
if ( items.itemWirelessTerminal != null )
for ( Item wirelessTerminalItem : items.wirelessTerminal().maybeItem().asSet() )
{
registries.wireless().registerWirelessHandler( ( IWirelessTermHandler ) items.itemWirelessTerminal.item() );
registries.wireless().registerWirelessHandler( (IWirelessTermHandler) wirelessTerminalItem );
}
if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
{
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
d.addItem( new WeightedRandomChestContent( api.materials().materialCertusQuartzCrystal.stack( 1 ), 1, 4, 2 ) );
d.addItem( new WeightedRandomChestContent( api.materials().materialCertusQuartzDust.stack( 1 ), 1, 4, 2 ) );
final IMaterials materials = definitions.materials();
for ( ItemStack crystal : materials.certusQuartzCrystal().maybeStack( 1 ).asSet() )
{
d.addItem( new WeightedRandomChestContent( crystal, 1, 4, 2 ) );
}
for ( ItemStack dust : materials.certusQuartzDust().maybeStack( 1 ).asSet() )
{
d.addItem( new WeightedRandomChestContent( dust, 1, 4, 2 ) );
}
}
// add villager trading to black smiths for a few basic materials
+1 -1
View File
@@ -92,7 +92,7 @@ public class WorldSettings extends Configuration
}
final ConfigCategory playerList = this.getCategory( "players" );
this.mappings = new PlayerMappings( playerList, AELog.instance );
this.mappings = new PlayerMappings( playerList, AELog.INSTANCE );
}
public static WorldSettings getInstance()
@@ -0,0 +1,599 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.api.definitions;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition;
import appeng.api.util.IOrientableBlock;
import appeng.block.crafting.BlockCraftingMonitor;
import appeng.block.crafting.BlockCraftingStorage;
import appeng.block.crafting.BlockCraftingUnit;
import appeng.block.crafting.BlockMolecularAssembler;
import appeng.block.grindstone.BlockCrank;
import appeng.block.grindstone.BlockGrinder;
import appeng.block.misc.BlockCellWorkbench;
import appeng.block.misc.BlockCharger;
import appeng.block.misc.BlockCondenser;
import appeng.block.misc.BlockInscriber;
import appeng.block.misc.BlockInterface;
import appeng.block.misc.BlockLightDetector;
import appeng.block.misc.BlockPaint;
import appeng.block.misc.BlockQuartzGrowthAccelerator;
import appeng.block.misc.BlockQuartzTorch;
import appeng.block.misc.BlockSecurity;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.misc.BlockTinyTNT;
import appeng.block.misc.BlockVibrationChamber;
import appeng.block.networking.BlockCableBus;
import appeng.block.networking.BlockController;
import appeng.block.networking.BlockCreativeEnergyCell;
import appeng.block.networking.BlockDenseEnergyCell;
import appeng.block.networking.BlockEnergyAcceptor;
import appeng.block.networking.BlockEnergyCell;
import appeng.block.networking.BlockWireless;
import appeng.block.qnb.BlockQuantumLinkChamber;
import appeng.block.qnb.BlockQuantumRing;
import appeng.block.solids.BlockFluix;
import appeng.block.solids.BlockQuartz;
import appeng.block.solids.BlockQuartzChiseled;
import appeng.block.solids.BlockQuartzGlass;
import appeng.block.solids.BlockQuartzLamp;
import appeng.block.solids.BlockQuartzPillar;
import appeng.block.solids.BlockSkyStone;
import appeng.block.solids.OreQuartz;
import appeng.block.solids.OreQuartzCharged;
import appeng.block.spatial.BlockMatrixFrame;
import appeng.block.spatial.BlockSpatialIOPort;
import appeng.block.spatial.BlockSpatialPylon;
import appeng.block.stair.ChiseledQuartzStairBlock;
import appeng.block.stair.FluixStairBlock;
import appeng.block.stair.QuartzPillarStairBlock;
import appeng.block.stair.QuartzStairBlock;
import appeng.block.stair.SkyStoneBlockStairBlock;
import appeng.block.stair.SkyStoneBrickStairBlock;
import appeng.block.stair.SkyStoneSmallBrickStairBlock;
import appeng.block.stair.SkyStoneStairBlock;
import appeng.block.storage.BlockChest;
import appeng.block.storage.BlockDrive;
import appeng.block.storage.BlockIOPort;
import appeng.block.storage.BlockSkyChest;
import appeng.core.features.WrappedDamageItemDefinition;
import appeng.debug.BlockChunkloader;
import appeng.debug.BlockCubeGenerator;
import appeng.debug.BlockItemGen;
import appeng.debug.BlockPhantomNode;
/**
* Internal implementation for the API blocks
*/
public final class ApiBlocks implements IBlocks
{
private final IBlockDefinition quartzOre;
private final IBlockDefinition quartzOreCharged;
private final IBlockDefinition matrixFrame;
private final IBlockDefinition quartz;
private final IBlockDefinition quartzPillar;
private final IBlockDefinition quartzChiseled;
private final IBlockDefinition quartzGlass;
private final IBlockDefinition quartzVibrantGlass;
private final IBlockDefinition quartzTorch;
private final IBlockDefinition fluix;
private final IBlockDefinition skyStone;
private final IBlockDefinition skyChest;
private final IBlockDefinition skyCompass;
private final ITileDefinition grindStone;
private final ITileDefinition crankHandle;
private final ITileDefinition inscriber;
private final ITileDefinition wireless;
private final ITileDefinition charger;
private final ITileDefinition tinyTNT;
private final ITileDefinition security;
private final ITileDefinition quantumRing;
private final ITileDefinition quantumLink;
private final ITileDefinition spatialPylon;
private final ITileDefinition spatialIOPort;
private final ITileDefinition multiPart;
private final ITileDefinition controller;
private final ITileDefinition drive;
private final ITileDefinition chest;
private final ITileDefinition iface;
private final ITileDefinition cellWorkbench;
private final ITileDefinition iOPort;
private final ITileDefinition condenser;
private final ITileDefinition energyAcceptor;
private final ITileDefinition vibrationChamber;
private final ITileDefinition quartzGrowthAccelerator;
private final ITileDefinition energyCell;
private final ITileDefinition energyCellDense;
private final ITileDefinition energyCellCreative;
private final ITileDefinition craftingUnit;
private final ITileDefinition craftingAccelerator;
private final ITileDefinition craftingStorage1k;
private final ITileDefinition craftingStorage4k;
private final ITileDefinition craftingStorage16k;
private final ITileDefinition craftingStorage64k;
private final ITileDefinition craftingMonitor;
private final ITileDefinition molecularAssembler;
private final ITileDefinition lightDetector;
private final ITileDefinition paint;
private final IBlockDefinition skyStoneStair;
private final IBlockDefinition skyStoneBlockStair;
private final IBlockDefinition skyStoneBrickStair;
private final IBlockDefinition skyStoneSmallBrickStair;
private final IBlockDefinition fluixStair;
private final IBlockDefinition quartzStair;
private final IBlockDefinition chiseledQuartzStair;
private final IBlockDefinition quartzPillarStair;
private final IBlockDefinition itemGen;
private final IBlockDefinition chunkLoader;
private final IBlockDefinition phantomNode;
private final IBlockDefinition cubeGenerator;
private final Set<IOrientableBlock> orientables;
public ApiBlocks( DefinitionConstructor constructor )
{
final BlockLightDetector lightDetector = new BlockLightDetector();
final BlockQuartzPillar quartzPillar = new BlockQuartzPillar();
final BlockSkyStone skyStone = new BlockSkyStone();
final BlockFluix fluixBlock = new BlockFluix();
final BlockQuartzGrowthAccelerator cga = new BlockQuartzGrowthAccelerator();
final BlockQuartzTorch quartzTorch = new BlockQuartzTorch();
final BlockQuartz quartzBlock = new BlockQuartz();
final BlockQuartzChiseled chiseldQuartz = new BlockQuartzChiseled();
this.orientables = ImmutableSet.<IOrientableBlock>of( lightDetector, quartzPillar, skyStone, cga, quartzTorch );
this.quartzOre = constructor.registerBlockDefinition( new OreQuartz() );
this.quartzOreCharged = constructor.registerBlockDefinition( new OreQuartzCharged() );
this.matrixFrame = constructor.registerBlockDefinition( new BlockMatrixFrame() );
this.quartz = constructor.registerBlockDefinition( quartzBlock );
this.quartzPillar = constructor.registerBlockDefinition( quartzPillar );
this.quartzChiseled = constructor.registerBlockDefinition( chiseldQuartz );
this.quartzGlass = constructor.registerBlockDefinition( new BlockQuartzGlass() );
this.quartzVibrantGlass = constructor.registerBlockDefinition( new BlockQuartzLamp() );
this.quartzTorch = constructor.registerBlockDefinition( quartzTorch );
this.fluix = constructor.registerBlockDefinition( fluixBlock );
this.skyStone = constructor.registerBlockDefinition( skyStone );
this.skyChest = constructor.registerBlockDefinition( new BlockSkyChest() );
this.skyCompass = constructor.registerBlockDefinition( new BlockSkyCompass() );
this.grindStone = constructor.registerTileDefinition( new BlockGrinder() );
this.crankHandle = constructor.registerTileDefinition( new BlockCrank() );
this.inscriber = constructor.registerTileDefinition( new BlockInscriber() );
this.wireless = constructor.registerTileDefinition( new BlockWireless() );
this.charger = constructor.registerTileDefinition( new BlockCharger() );
this.tinyTNT = constructor.registerTileDefinition( new BlockTinyTNT() );
this.security = constructor.registerTileDefinition( new BlockSecurity() );
this.quantumRing = constructor.registerTileDefinition( new BlockQuantumRing() );
this.quantumLink = constructor.registerTileDefinition( new BlockQuantumLinkChamber() );
this.spatialPylon = constructor.registerTileDefinition( new BlockSpatialPylon() );
this.spatialIOPort = constructor.registerTileDefinition( new BlockSpatialIOPort() );
this.multiPart = constructor.registerTileDefinition( new BlockCableBus() );
this.controller = constructor.registerTileDefinition( new BlockController() );
this.drive = constructor.registerTileDefinition( new BlockDrive() );
this.chest = constructor.registerTileDefinition( new BlockChest() );
this.iface = constructor.registerTileDefinition( new BlockInterface() );
this.cellWorkbench = constructor.registerTileDefinition( new BlockCellWorkbench() );
this.iOPort = constructor.registerTileDefinition( new BlockIOPort() );
this.condenser = constructor.registerTileDefinition( new BlockCondenser() );
this.energyAcceptor = constructor.registerTileDefinition( new BlockEnergyAcceptor() );
this.vibrationChamber = constructor.registerTileDefinition( new BlockVibrationChamber() );
this.quartzGrowthAccelerator = constructor.registerTileDefinition( cga );
this.energyCell = constructor.registerTileDefinition( new BlockEnergyCell() );
this.energyCellDense = constructor.registerTileDefinition( new BlockDenseEnergyCell() );
this.energyCellCreative = constructor.registerTileDefinition( new BlockCreativeEnergyCell() );
this.craftingUnit = constructor.registerTileDefinition( new BlockCraftingUnit() );
this.craftingAccelerator = new WrappedDamageItemDefinition( this.craftingUnit, 1 );
this.craftingStorage1k = constructor.registerTileDefinition( new BlockCraftingStorage() );
this.craftingStorage4k = new WrappedDamageItemDefinition( this.craftingStorage1k, 1 );
this.craftingStorage16k = new WrappedDamageItemDefinition( this.craftingStorage1k, 2 );
this.craftingStorage64k = new WrappedDamageItemDefinition( this.craftingStorage1k, 3 );
this.craftingMonitor = constructor.registerTileDefinition( new BlockCraftingMonitor() );
this.molecularAssembler = constructor.registerTileDefinition( new BlockMolecularAssembler() );
this.lightDetector = constructor.registerTileDefinition( lightDetector );
this.paint = constructor.registerTileDefinition( new BlockPaint() );
this.skyStoneStair = constructor.registerBlockDefinition( new SkyStoneStairBlock( skyStone, 0 ) );
this.skyStoneBlockStair = constructor.registerBlockDefinition( new SkyStoneBlockStairBlock( skyStone, 1 ) );
this.skyStoneBrickStair = constructor.registerBlockDefinition( new SkyStoneBrickStairBlock( skyStone, 2 ) );
this.skyStoneSmallBrickStair = constructor.registerBlockDefinition( new SkyStoneSmallBrickStairBlock( skyStone, 3 ) );
this.fluixStair = constructor.registerBlockDefinition( new FluixStairBlock( fluixBlock ) );
this.quartzStair = constructor.registerBlockDefinition( new QuartzStairBlock( quartzBlock ) );
this.chiseledQuartzStair = constructor.registerBlockDefinition( new ChiseledQuartzStairBlock( chiseldQuartz ) );
this.quartzPillarStair = constructor.registerBlockDefinition( new QuartzPillarStairBlock( quartzPillar ) );
this.itemGen = constructor.registerBlockDefinition( new BlockItemGen() );
this.chunkLoader = constructor.registerBlockDefinition( new BlockChunkloader() );
this.phantomNode = constructor.registerBlockDefinition( new BlockPhantomNode() );
this.cubeGenerator = constructor.registerBlockDefinition( new BlockCubeGenerator() );
}
@Override
public IBlockDefinition quartzOre()
{
return this.quartzOre;
}
@Override
public IBlockDefinition quartzOreCharged()
{
return this.quartzOreCharged;
}
@Override
public IBlockDefinition matrixFrame()
{
return this.matrixFrame;
}
@Override
public IBlockDefinition quartz()
{
return this.quartz;
}
@Override
public IBlockDefinition quartzPillar()
{
return this.quartzPillar;
}
@Override
public IBlockDefinition quartzChiseled()
{
return this.quartzChiseled;
}
@Override
public IBlockDefinition quartzGlass()
{
return this.quartzGlass;
}
@Override
public IBlockDefinition quartzVibrantGlass()
{
return this.quartzVibrantGlass;
}
@Override
public IBlockDefinition quartzTorch()
{
return this.quartzTorch;
}
@Override
public IBlockDefinition fluix()
{
return this.fluix;
}
@Override
public IBlockDefinition skyStone()
{
return this.skyStone;
}
@Override
public IBlockDefinition skyChest()
{
return this.skyChest;
}
@Override
public IBlockDefinition skyCompass()
{
return this.skyCompass;
}
@Override
public IBlockDefinition skyStoneStair()
{
return this.skyStoneStair;
}
@Override
public IBlockDefinition skyStoneBlockStair()
{
return this.skyStoneBlockStair;
}
@Override
public IBlockDefinition skyStoneBrickStair()
{
return this.skyStoneBrickStair;
}
@Override
public IBlockDefinition skyStoneSmallBrickStair()
{
return this.skyStoneSmallBrickStair;
}
@Override
public IBlockDefinition fluixStair()
{
return this.fluixStair;
}
@Override
public IBlockDefinition quartzStair()
{
return this.quartzStair;
}
@Override
public IBlockDefinition chiseledQuartzStair()
{
return this.chiseledQuartzStair;
}
@Override
public IBlockDefinition quartzPillarStair()
{
return this.quartzPillarStair;
}
@Override
public ITileDefinition grindStone()
{
return this.grindStone;
}
@Override
public ITileDefinition crankHandle()
{
return this.crankHandle;
}
@Override
public ITileDefinition inscriber()
{
return this.inscriber;
}
@Override
public ITileDefinition wireless()
{
return this.wireless;
}
@Override
public ITileDefinition charger()
{
return this.charger;
}
@Override
public ITileDefinition tinyTNT()
{
return this.tinyTNT;
}
@Override
public ITileDefinition security()
{
return this.security;
}
@Override
public ITileDefinition quantumRing()
{
return this.quantumRing;
}
@Override
public ITileDefinition quantumLink()
{
return this.quantumLink;
}
@Override
public ITileDefinition spatialPylon()
{
return this.spatialPylon;
}
@Override
public ITileDefinition spatialIOPort()
{
return this.spatialIOPort;
}
@Override
public ITileDefinition multiPart()
{
return this.multiPart;
}
@Override
public ITileDefinition controller()
{
return this.controller;
}
@Override
public ITileDefinition drive()
{
return this.drive;
}
@Override
public ITileDefinition chest()
{
return this.chest;
}
@Override
public ITileDefinition iface()
{
return this.iface;
}
@Override
public ITileDefinition cellWorkbench()
{
return this.cellWorkbench;
}
@Override
public ITileDefinition iOPort()
{
return this.iOPort;
}
@Override
public ITileDefinition condenser()
{
return this.condenser;
}
@Override
public ITileDefinition energyAcceptor()
{
return this.energyAcceptor;
}
@Override
public ITileDefinition vibrationChamber()
{
return this.vibrationChamber;
}
@Override
public ITileDefinition quartzGrowthAccelerator()
{
return this.quartzGrowthAccelerator;
}
@Override
public ITileDefinition energyCell()
{
return this.energyCell;
}
@Override
public ITileDefinition energyCellDense()
{
return this.energyCellDense;
}
@Override
public ITileDefinition energyCellCreative()
{
return this.energyCellCreative;
}
@Override
public ITileDefinition craftingUnit()
{
return this.craftingUnit;
}
@Override
public ITileDefinition craftingAccelerator()
{
return this.craftingAccelerator;
}
@Override
public ITileDefinition craftingStorage1k()
{
return this.craftingStorage1k;
}
@Override
public ITileDefinition craftingStorage4k()
{
return this.craftingStorage4k;
}
@Override
public ITileDefinition craftingStorage16k()
{
return this.craftingStorage16k;
}
@Override
public ITileDefinition craftingStorage64k()
{
return this.craftingStorage64k;
}
@Override
public ITileDefinition craftingMonitor()
{
return this.craftingMonitor;
}
@Override
public ITileDefinition molecularAssembler()
{
return this.molecularAssembler;
}
@Override
public ITileDefinition lightDetector()
{
return this.lightDetector;
}
@Override
public ITileDefinition paint()
{
return this.paint;
}
public IBlockDefinition chunkLoader()
{
return this.chunkLoader;
}
public IBlockDefinition itemGen()
{
return this.itemGen;
}
public IBlockDefinition phantomNode()
{
return this.phantomNode;
}
public IBlockDefinition cubeGenerator()
{
return this.cubeGenerator;
}
public Set<IOrientableBlock> orientables()
{
return this.orientables;
}
}
@@ -0,0 +1,418 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.api.definitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IItems;
import appeng.api.util.AEColoredItemDefinition;
import appeng.core.features.AEFeature;
import appeng.debug.ToolDebugCard;
import appeng.debug.ToolEraser;
import appeng.debug.ToolMeteoritePlacer;
import appeng.debug.ToolReplicatorCard;
import appeng.items.materials.MaterialType;
import appeng.items.misc.ItemCrystalSeed;
import appeng.items.misc.ItemEncodedPattern;
import appeng.items.misc.ItemPaintBall;
import appeng.items.parts.ItemFacade;
import appeng.items.storage.ItemBasicStorageCell;
import appeng.items.storage.ItemCreativeStorageCell;
import appeng.items.storage.ItemSpatialStorageCell;
import appeng.items.storage.ItemViewCell;
import appeng.items.tools.ToolBiometricCard;
import appeng.items.tools.ToolMemoryCard;
import appeng.items.tools.ToolNetworkTool;
import appeng.items.tools.powered.ToolChargedStaff;
import appeng.items.tools.powered.ToolColorApplicator;
import appeng.items.tools.powered.ToolEntropyManipulator;
import appeng.items.tools.powered.ToolMassCannon;
import appeng.items.tools.powered.ToolPortableCell;
import appeng.items.tools.powered.ToolWirelessTerminal;
import appeng.items.tools.quartz.ToolQuartzAxe;
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
import appeng.items.tools.quartz.ToolQuartzHoe;
import appeng.items.tools.quartz.ToolQuartzPickaxe;
import appeng.items.tools.quartz.ToolQuartzSpade;
import appeng.items.tools.quartz.ToolQuartzSword;
import appeng.items.tools.quartz.ToolQuartzWrench;
/**
* Internal implementation for the API items
*/
public final class ApiItems implements IItems
{
private final IItemDefinition certusQuartzAxe;
private final IItemDefinition certusQuartzHoe;
private final IItemDefinition certusQuartzShovel;
private final IItemDefinition certusQuartzPick;
private final IItemDefinition certusQuartzSword;
private final IItemDefinition certusQuartzWrench;
private final IItemDefinition certusQuartzKnife;
private final IItemDefinition netherQuartzAxe;
private final IItemDefinition netherQuartzHoe;
private final IItemDefinition netherQuartzShovel;
private final IItemDefinition netherQuartzPick;
private final IItemDefinition netherQuartzSword;
private final IItemDefinition netherQuartzWrench;
private final IItemDefinition netherQuartzKnife;
private final IItemDefinition entropyManipulator;
private final IItemDefinition wirelessTerminal;
private final IItemDefinition biometricCard;
private final IItemDefinition chargedStaff;
private final IItemDefinition massCannon;
private final IItemDefinition memoryCard;
private final IItemDefinition networkTool;
private final IItemDefinition portableCell;
private final IItemDefinition cellCreative;
private final IItemDefinition viewCell;
private final IItemDefinition cell1k;
private final IItemDefinition cell4k;
private final IItemDefinition cell16k;
private final IItemDefinition cell64k;
private final IItemDefinition spatialCell2;
private final IItemDefinition spatialCell16;
private final IItemDefinition spatialCell128;
private final IItemDefinition facade;
private final IItemDefinition crystalSeed;
// rv1
private final IItemDefinition encodedPattern;
private final IItemDefinition colorApplicator;
private final IItemDefinition paintBall;
private final AEColoredItemDefinition coloredPaintBall;
private final AEColoredItemDefinition coloredLumenPaintBall;
// unsupported dev tools
private final IItemDefinition toolEraser;
private final IItemDefinition toolMeteoritePlacer;
private final IItemDefinition toolDebugCard;
private final IItemDefinition toolReplicatorCard;
public ApiItems( DefinitionConstructor constructor )
{
this.certusQuartzAxe = constructor.registerItemDefinition( new ToolQuartzAxe( AEFeature.CertusQuartzTools ) );
this.certusQuartzHoe = constructor.registerItemDefinition( new ToolQuartzHoe( AEFeature.CertusQuartzTools ) );
this.certusQuartzShovel = constructor.registerItemDefinition( new ToolQuartzSpade( AEFeature.CertusQuartzTools ) );
this.certusQuartzPick = constructor.registerItemDefinition( new ToolQuartzPickaxe( AEFeature.CertusQuartzTools ) );
this.certusQuartzSword = constructor.registerItemDefinition( new ToolQuartzSword( AEFeature.CertusQuartzTools ) );
this.certusQuartzWrench = constructor.registerItemDefinition( new ToolQuartzWrench( AEFeature.CertusQuartzTools ) );
this.certusQuartzKnife = constructor.registerItemDefinition( new ToolQuartzCuttingKnife( AEFeature.CertusQuartzTools ) );
this.netherQuartzAxe = constructor.registerItemDefinition( new ToolQuartzAxe( AEFeature.NetherQuartzTools ) );
this.netherQuartzHoe = constructor.registerItemDefinition( new ToolQuartzHoe( AEFeature.NetherQuartzTools ) );
this.netherQuartzShovel = constructor.registerItemDefinition( new ToolQuartzSpade( AEFeature.NetherQuartzTools ) );
this.netherQuartzPick = constructor.registerItemDefinition( new ToolQuartzPickaxe( AEFeature.NetherQuartzTools ) );
this.netherQuartzSword = constructor.registerItemDefinition( new ToolQuartzSword( AEFeature.NetherQuartzTools ) );
this.netherQuartzWrench = constructor.registerItemDefinition( new ToolQuartzWrench( AEFeature.NetherQuartzTools ) );
this.netherQuartzKnife = constructor.registerItemDefinition( new ToolQuartzCuttingKnife( AEFeature.NetherQuartzTools ) );
this.entropyManipulator = constructor.registerItemDefinition( new ToolEntropyManipulator() );
this.wirelessTerminal = constructor.registerItemDefinition( new ToolWirelessTerminal() );
this.biometricCard = constructor.registerItemDefinition( new ToolBiometricCard() );
this.chargedStaff = constructor.registerItemDefinition( new ToolChargedStaff() );
this.massCannon = constructor.registerItemDefinition( new ToolMassCannon() );
this.memoryCard = constructor.registerItemDefinition( new ToolMemoryCard() );
this.networkTool = constructor.registerItemDefinition( new ToolNetworkTool() );
this.portableCell = constructor.registerItemDefinition( new ToolPortableCell() );
this.cellCreative = constructor.registerItemDefinition( new ItemCreativeStorageCell() );
this.viewCell = constructor.registerItemDefinition( new ItemViewCell() );
this.cell1k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell1kPart, 1 ) );
this.cell4k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell4kPart, 4 ) );
this.cell16k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell16kPart, 16 ) );
this.cell64k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell64kPart, 64 ) );
this.spatialCell2 = constructor.registerItemDefinition( new ItemSpatialStorageCell( 2 ) );
this.spatialCell16 = constructor.registerItemDefinition( new ItemSpatialStorageCell( 16 ) );
this.spatialCell128 = constructor.registerItemDefinition( new ItemSpatialStorageCell( 128 ) );
this.facade = constructor.registerItemDefinition( new ItemFacade() );
this.crystalSeed = constructor.registerItemDefinition( new ItemCrystalSeed() );
// rv1
this.encodedPattern = constructor.registerItemDefinition( new ItemEncodedPattern() );
this.colorApplicator = constructor.registerItemDefinition( new ToolColorApplicator() );
this.paintBall = constructor.registerItemDefinition( new ItemPaintBall() );
this.coloredPaintBall = constructor.constructColoredDefinition( this.paintBall, 0 );
this.coloredLumenPaintBall = constructor.constructColoredDefinition( this.paintBall, 20 );
this.toolEraser = constructor.registerItemDefinition( new ToolEraser() );
this.toolMeteoritePlacer = constructor.registerItemDefinition( new ToolMeteoritePlacer() );
this.toolDebugCard = constructor.registerItemDefinition( new ToolDebugCard() );
this.toolReplicatorCard = constructor.registerItemDefinition( new ToolReplicatorCard() );
}
@Override
public IItemDefinition certusQuartzAxe()
{
return this.certusQuartzAxe;
}
@Override
public IItemDefinition certusQuartzHoe()
{
return this.certusQuartzHoe;
}
@Override
public IItemDefinition certusQuartzShovel()
{
return this.certusQuartzShovel;
}
@Override
public IItemDefinition certusQuartzPick()
{
return this.certusQuartzPick;
}
@Override
public IItemDefinition certusQuartzSword()
{
return this.certusQuartzSword;
}
@Override
public IItemDefinition certusQuartzWrench()
{
return this.certusQuartzWrench;
}
@Override
public IItemDefinition certusQuartzKnife()
{
return this.certusQuartzKnife;
}
@Override
public IItemDefinition netherQuartzAxe()
{
return this.netherQuartzAxe;
}
@Override
public IItemDefinition netherQuartzHoe()
{
return this.netherQuartzHoe;
}
@Override
public IItemDefinition netherQuartzShovel()
{
return this.netherQuartzShovel;
}
@Override
public IItemDefinition netherQuartzPick()
{
return this.netherQuartzPick;
}
@Override
public IItemDefinition netherQuartzSword()
{
return this.netherQuartzSword;
}
@Override
public IItemDefinition netherQuartzWrench()
{
return this.netherQuartzWrench;
}
@Override
public IItemDefinition netherQuartzKnife()
{
return this.netherQuartzKnife;
}
@Override
public IItemDefinition entropyManipulator()
{
return this.entropyManipulator;
}
@Override
public IItemDefinition wirelessTerminal()
{
return this.wirelessTerminal;
}
@Override
public IItemDefinition biometricCard()
{
return this.biometricCard;
}
@Override
public IItemDefinition chargedStaff()
{
return this.memoryCard;
}
@Override
public IItemDefinition massCannon()
{
return this.massCannon;
}
@Override
public IItemDefinition memoryCard()
{
return this.memoryCard;
}
@Override
public IItemDefinition networkTool()
{
return this.networkTool;
}
@Override
public IItemDefinition portableCell()
{
return this.portableCell;
}
@Override
public IItemDefinition cellCreative()
{
return this.cellCreative;
}
@Override
public IItemDefinition viewCell()
{
return this.viewCell;
}
@Override
public IItemDefinition cell1k()
{
return this.cell1k;
}
@Override
public IItemDefinition cell4k()
{
return this.cell4k;
}
@Override
public IItemDefinition cell16k()
{
return this.cell16k;
}
@Override
public IItemDefinition cell64k()
{
return this.cell64k;
}
@Override
public IItemDefinition spatialCell2()
{
return this.spatialCell2;
}
@Override
public IItemDefinition spatialCell16()
{
return this.spatialCell16;
}
@Override
public IItemDefinition spatialCell128()
{
return this.spatialCell128;
}
@Override
public IItemDefinition facade()
{
return this.facade;
}
@Override
public IItemDefinition crystalSeed()
{
return this.crystalSeed;
}
@Override
public IItemDefinition encodedPattern()
{
return this.encodedPattern;
}
@Override
public IItemDefinition colorApplicator()
{
return this.colorApplicator;
}
@Override
public AEColoredItemDefinition coloredPaintBall()
{
return this.coloredPaintBall;
}
@Override
public AEColoredItemDefinition coloredLumenPaintBall()
{
return this.coloredLumenPaintBall;
}
public IItemDefinition paintBall()
{
return this.paintBall;
}
public IItemDefinition toolEraser()
{
return this.toolEraser;
}
public IItemDefinition toolMeteoritePlacer()
{
return this.toolMeteoritePlacer;
}
public IItemDefinition toolDebugCard()
{
return this.toolDebugCard;
}
public IItemDefinition toolReplicatorCard()
{
return this.toolReplicatorCard;
}
}
@@ -0,0 +1,507 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.api.definitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IMaterials;
import appeng.core.features.DamagedItemDefinition;
import appeng.items.materials.ItemMultiMaterial;
import appeng.items.materials.MaterialType;
/**
* Internal implementation for the API materials
*/
public final class ApiMaterials implements IMaterials
{
private final IItemDefinition cell2SpatialPart;
private final IItemDefinition cell16SpatialPart;
private final IItemDefinition cell128SpatialPart;
private final IItemDefinition silicon;
private final IItemDefinition skyDust;
private final IItemDefinition calcProcessorPress;
private final IItemDefinition engProcessorPress;
private final IItemDefinition logicProcessorPress;
private final IItemDefinition calcProcessorPrint;
private final IItemDefinition engProcessorPrint;
private final IItemDefinition logicProcessorPrint;
private final IItemDefinition siliconPress;
private final IItemDefinition siliconPrint;
private final IItemDefinition namePress;
private final IItemDefinition logicProcessor;
private final IItemDefinition calcProcessor;
private final IItemDefinition engProcessor;
private final IItemDefinition basicCard;
private final IItemDefinition advCard;
private final IItemDefinition purifiedCertusQuartzCrystal;
private final IItemDefinition purifiedNetherQuartzCrystal;
private final IItemDefinition purifiedFluixCrystal;
private final IItemDefinition cell1kPart;
private final IItemDefinition cell4kPart;
private final IItemDefinition cell16kPart;
private final IItemDefinition cell64kPart;
private final IItemDefinition emptyStorageCell;
private final IItemDefinition cardRedstone;
private final IItemDefinition cardSpeed;
private final IItemDefinition cardCapacity;
private final IItemDefinition cardFuzzy;
private final IItemDefinition cardInverter;
private final IItemDefinition cardCrafting;
private final IItemDefinition enderDust;
private final IItemDefinition flour;
private final IItemDefinition goldDust;
private final IItemDefinition ironDust;
private final IItemDefinition fluixDust;
private final IItemDefinition certusQuartzDust;
private final IItemDefinition netherQuartzDust;
private final IItemDefinition matterBall;
private final IItemDefinition ironNugget;
private final IItemDefinition certusQuartzCrystal;
private final IItemDefinition certusQuartzCrystalCharged;
private final IItemDefinition fluixCrystal;
private final IItemDefinition fluixPearl;
private final IItemDefinition woodenGear;
private final IItemDefinition wireless;
private final IItemDefinition wirelessBooster;
private final IItemDefinition annihilationCore;
private final IItemDefinition formationCore;
private final IItemDefinition singularity;
private final IItemDefinition qESingularity;
private final IItemDefinition blankPattern;
public ApiMaterials( DefinitionConstructor constructor )
{
final ItemMultiMaterial itemMultiMaterial = new ItemMultiMaterial();
constructor.registerItemDefinition( itemMultiMaterial );
this.cell2SpatialPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell2SpatialPart ) );
this.cell16SpatialPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell16SpatialPart ) );
this.cell128SpatialPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell128SpatialPart ) );
this.silicon = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Silicon ) );
this.skyDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.SkyDust ) );
this.calcProcessorPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CalcProcessorPress ) );
this.engProcessorPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EngProcessorPress ) );
this.logicProcessorPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.LogicProcessorPress ) );
this.calcProcessorPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CalcProcessorPrint ) );
this.engProcessorPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EngProcessorPrint ) );
this.logicProcessorPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.LogicProcessorPrint ) );
this.siliconPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.SiliconPress ) );
this.siliconPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.SiliconPrint ) );
this.namePress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.NamePress ) );
this.logicProcessor = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.LogicProcessor ) );
this.calcProcessor = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CalcProcessor ) );
this.engProcessor = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EngProcessor ) );
this.basicCard = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.BasicCard ) );
this.advCard = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.AdvCard ) );
this.purifiedCertusQuartzCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.PurifiedCertusQuartzCrystal ) );
this.purifiedNetherQuartzCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.PurifiedNetherQuartzCrystal ) );
this.purifiedFluixCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.PurifiedFluixCrystal ) );
this.cell1kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell1kPart ) );
this.cell4kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell4kPart ) );
this.cell16kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell16kPart ) );
this.cell64kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell64kPart ) );
this.emptyStorageCell = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EmptyStorageCell ) );
this.cardRedstone = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardRedstone ) );
this.cardSpeed = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardSpeed ) );
this.cardCapacity = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardCapacity ) );
this.cardFuzzy = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardFuzzy ) );
this.cardInverter = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardInverter ) );
this.cardCrafting = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardCrafting ) );
this.enderDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EnderDust ) );
this.flour = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Flour ) );
this.goldDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.GoldDust ) );
this.ironDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.IronDust ) );
this.fluixDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FluixDust ) );
this.certusQuartzDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CertusQuartzDust ) );
this.netherQuartzDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.NetherQuartzDust ) );
this.matterBall = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.MatterBall ) );
this.ironNugget = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.IronNugget ) );
this.certusQuartzCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CertusQuartzCrystal ) );
this.certusQuartzCrystalCharged = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CertusQuartzCrystalCharged ) );
this.fluixCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FluixCrystal ) );
this.fluixPearl = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FluixPearl ) );
this.woodenGear = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.WoodenGear ) );
this.wireless = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Wireless ) );
this.wirelessBooster = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.WirelessBooster ) );
this.annihilationCore = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.AnnihilationCore ) );
this.formationCore = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FormationCore ) );
this.singularity = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Singularity ) );
this.qESingularity = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.QESingularity ) );
this.blankPattern = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.BlankPattern ) );
}
@Override
public IItemDefinition cell2SpatialPart()
{
return this.cell2SpatialPart;
}
@Override
public IItemDefinition cell16SpatialPart()
{
return this.cell16SpatialPart;
}
@Override
public IItemDefinition cell128SpatialPart()
{
return this.cell128SpatialPart;
}
@Override
public IItemDefinition silicon()
{
return this.silicon;
}
@Override
public IItemDefinition skyDust()
{
return this.skyDust;
}
@Override
public IItemDefinition calcProcessorPress()
{
return this.calcProcessorPress;
}
@Override
public IItemDefinition engProcessorPress()
{
return this.engProcessorPress;
}
@Override
public IItemDefinition logicProcessorPress()
{
return this.logicProcessorPress;
}
@Override
public IItemDefinition calcProcessorPrint()
{
return this.calcProcessorPrint;
}
@Override
public IItemDefinition engProcessorPrint()
{
return this.engProcessorPrint;
}
@Override
public IItemDefinition logicProcessorPrint()
{
return this.logicProcessorPrint;
}
@Override
public IItemDefinition siliconPress()
{
return this.siliconPress;
}
@Override
public IItemDefinition siliconPrint()
{
return this.siliconPrint;
}
@Override
public IItemDefinition namePress()
{
return this.namePress;
}
@Override
public IItemDefinition logicProcessor()
{
return this.logicProcessor;
}
@Override
public IItemDefinition calcProcessor()
{
return this.calcProcessor;
}
@Override
public IItemDefinition engProcessor()
{
return this.engProcessor;
}
@Override
public IItemDefinition basicCard()
{
return this.basicCard;
}
@Override
public IItemDefinition advCard()
{
return this.advCard;
}
@Override
public IItemDefinition purifiedCertusQuartzCrystal()
{
return this.purifiedCertusQuartzCrystal;
}
@Override
public IItemDefinition purifiedNetherQuartzCrystal()
{
return this.purifiedNetherQuartzCrystal;
}
@Override
public IItemDefinition purifiedFluixCrystal()
{
return this.purifiedFluixCrystal;
}
@Override
public IItemDefinition cell1kPart()
{
return this.cell1kPart;
}
@Override
public IItemDefinition cell4kPart()
{
return this.cell4kPart;
}
@Override
public IItemDefinition cell16kPart()
{
return this.cell16kPart;
}
@Override
public IItemDefinition cell64kPart()
{
return this.cell64kPart;
}
@Override
public IItemDefinition emptyStorageCell()
{
return this.emptyStorageCell;
}
@Override
public IItemDefinition cardRedstone()
{
return this.cardRedstone;
}
@Override
public IItemDefinition cardSpeed()
{
return this.cardSpeed;
}
@Override
public IItemDefinition cardCapacity()
{
return this.cardCapacity;
}
@Override
public IItemDefinition cardFuzzy()
{
return this.cardFuzzy;
}
@Override
public IItemDefinition cardInverter()
{
return this.cardInverter;
}
@Override
public IItemDefinition cardCrafting()
{
return this.cardCrafting;
}
@Override
public IItemDefinition enderDust()
{
return this.enderDust;
}
@Override
public IItemDefinition flour()
{
return this.flour;
}
@Override
public IItemDefinition goldDust()
{
return this.goldDust;
}
@Override
public IItemDefinition ironDust()
{
return this.ironDust;
}
@Override
public IItemDefinition fluixDust()
{
return this.fluixDust;
}
@Override
public IItemDefinition certusQuartzDust()
{
return this.certusQuartzDust;
}
@Override
public IItemDefinition netherQuartzDust()
{
return this.netherQuartzDust;
}
@Override
public IItemDefinition matterBall()
{
return this.matterBall;
}
@Override
public IItemDefinition ironNugget()
{
return this.ironNugget;
}
@Override
public IItemDefinition certusQuartzCrystal()
{
return this.certusQuartzCrystal;
}
@Override
public IItemDefinition certusQuartzCrystalCharged()
{
return this.certusQuartzCrystalCharged;
}
@Override
public IItemDefinition fluixCrystal()
{
return this.fluixCrystal;
}
@Override
public IItemDefinition fluixPearl()
{
return this.fluixPearl;
}
@Override
public IItemDefinition woodenGear()
{
return this.woodenGear;
}
@Override
public IItemDefinition wireless()
{
return this.wireless;
}
@Override
public IItemDefinition wirelessBooster()
{
return this.wirelessBooster;
}
@Override
public IItemDefinition annihilationCore()
{
return this.annihilationCore;
}
@Override
public IItemDefinition formationCore()
{
return this.formationCore;
}
@Override
public IItemDefinition singularity()
{
return this.singularity;
}
@Override
public IItemDefinition qESingularity()
{
return this.qESingularity;
}
@Override
public IItemDefinition blankPattern()
{
return this.blankPattern;
}
}
@@ -0,0 +1,328 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.api.definitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IParts;
import appeng.api.exceptions.MissingDefinition;
import appeng.api.parts.IPartHelper;
import appeng.api.util.AEColoredItemDefinition;
import appeng.core.features.DamagedItemDefinition;
import appeng.items.parts.ItemMultiPart;
import appeng.items.parts.PartType;
/**
* Internal implementation for the API parts
*/
public final class ApiParts implements IParts
{
private final AEColoredItemDefinition cableSmart;
private final AEColoredItemDefinition cableCovered;
private final AEColoredItemDefinition cableGlass;
private final AEColoredItemDefinition cableDense;
// private final AEColoredItemDefinition lumenCableSmart;
// private final AEColoredItemDefinition lumenCableCovered;
// private final AEColoredItemDefinition lumenCableGlass;
// private final AEColoredItemDefinition lumenCableDense;
private final IItemDefinition quartzFiber;
private final IItemDefinition toggleBus;
private final IItemDefinition invertedToggleBus;
private final IItemDefinition storageBus;
private final IItemDefinition importBus;
private final IItemDefinition exportBus;
private final IItemDefinition iface;
private final IItemDefinition levelEmitter;
private final IItemDefinition annihilationPlane;
private final IItemDefinition formationPlane;
private final IItemDefinition p2PTunnelME;
private final IItemDefinition p2PTunnelRedstone;
private final IItemDefinition p2PTunnelItems;
private final IItemDefinition p2PTunnelLiquids;
private final IItemDefinition p2PTunnelEU;
private final IItemDefinition p2PTunnelRF;
private final IItemDefinition p2PTunnelLight;
private final IItemDefinition cableAnchor;
private final IItemDefinition monitor;
private final IItemDefinition semiDarkMonitor;
private final IItemDefinition darkMonitor;
private final IItemDefinition interfaceTerminal;
private final IItemDefinition patternTerminal;
private final IItemDefinition craftingTerminal;
private final IItemDefinition terminal;
private final IItemDefinition storageMonitor;
private final IItemDefinition conversionMonitor;
public ApiParts( DefinitionConstructor constructor, IPartHelper partHelper )
{
final ItemMultiPart itemMultiPart = new ItemMultiPart( partHelper );
constructor.registerItemDefinition( itemMultiPart );
this.cableSmart = constructor.constructColoredDefinition( itemMultiPart, PartType.CableSmart );
this.cableCovered = constructor.constructColoredDefinition( itemMultiPart, PartType.CableCovered );
this.cableGlass = constructor.constructColoredDefinition( itemMultiPart, PartType.CableGlass );
this.cableDense = constructor.constructColoredDefinition( itemMultiPart, PartType.CableDense );
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableDense = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
this.quartzFiber = new DamagedItemDefinition( itemMultiPart.createPart( PartType.QuartzFiber ) );
this.toggleBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ToggleBus ) );
this.invertedToggleBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.InvertedToggleBus ) );
this.storageBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.StorageBus ) );
this.importBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ImportBus ) );
this.exportBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ExportBus ) );
this.iface = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Interface ) );
this.levelEmitter = new DamagedItemDefinition( itemMultiPart.createPart( PartType.LevelEmitter ) );
this.annihilationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.AnnihilationPlane ) );
this.formationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.FormationPlane ) );
this.p2PTunnelME = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRedstone ) );
this.p2PTunnelItems = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelItems ) );
this.p2PTunnelLiquids = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelLiquids ) );
this.p2PTunnelEU = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelEU ) );
this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) );
this.p2PTunnelLight = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelLight ) );
this.cableAnchor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.CableAnchor ) );
this.monitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Monitor ) );
this.semiDarkMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.SemiDarkMonitor ) );
this.darkMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.DarkMonitor ) );
this.interfaceTerminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.InterfaceTerminal ) );
this.patternTerminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.PatternTerminal ) );
this.craftingTerminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.CraftingTerminal ) );
this.terminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Terminal ) );
this.storageMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.StorageMonitor ) );
this.conversionMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ConversionMonitor ) );
}
@Override
public AEColoredItemDefinition cableSmart()
{
return this.cableSmart;
}
@Override
public AEColoredItemDefinition cableCovered()
{
return this.cableCovered;
}
@Override
public AEColoredItemDefinition cableGlass()
{
return this.cableGlass;
}
@Override
public AEColoredItemDefinition cableDense()
{
return this.cableDense;
}
@Override
public AEColoredItemDefinition lumenCableSmart()
{
throw new MissingDefinition( "Lumen Smart Cable has yet to be implemented." );
// return this.lumenCableSmart;
}
@Override
public AEColoredItemDefinition lumenCableCovered()
{
throw new MissingDefinition( "Lumen Covered Cable has yet to be implemented." );
// return this.lumenCableCovered;
}
@Override
public AEColoredItemDefinition lumenCableGlass()
{
throw new MissingDefinition( "Lumen Glass Cable has yet to be implemented." );
// return this.lumenCableGlass;
}
@Override
public AEColoredItemDefinition lumenCableDense()
{
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
// return this.lumenCableDense;
}
@Override
public IItemDefinition quartzFiber()
{
return this.quartzFiber;
}
@Override
public IItemDefinition toggleBus()
{
return this.toggleBus;
}
@Override
public IItemDefinition invertedToggleBus()
{
return this.invertedToggleBus;
}
@Override
public IItemDefinition storageBus()
{
return this.storageBus;
}
@Override
public IItemDefinition importBus()
{
return this.importBus;
}
@Override
public IItemDefinition exportBus()
{
return this.exportBus;
}
@Override
public IItemDefinition iface()
{
return this.iface;
}
@Override
public IItemDefinition levelEmitter()
{
return this.levelEmitter;
}
@Override
public IItemDefinition annihilationPlane()
{
return this.annihilationPlane;
}
@Override
public IItemDefinition formationPlane()
{
return this.formationPlane;
}
@Override
public IItemDefinition p2PTunnelME()
{
return this.p2PTunnelME;
}
@Override
public IItemDefinition p2PTunnelRedstone()
{
return this.p2PTunnelRedstone;
}
@Override
public IItemDefinition p2PTunnelItems()
{
return this.p2PTunnelItems;
}
@Override
public IItemDefinition p2PTunnelLiquids()
{
return this.p2PTunnelLiquids;
}
@Override
public IItemDefinition p2PTunnelEU()
{
return this.p2PTunnelEU;
}
@Override
public IItemDefinition p2PTunnelRF()
{
return this.p2PTunnelRF;
}
@Override
public IItemDefinition p2PTunnelLight()
{
return this.p2PTunnelLight;
}
@Override
public IItemDefinition cableAnchor()
{
return this.cableAnchor;
}
@Override
public IItemDefinition monitor()
{
return this.monitor;
}
@Override
public IItemDefinition semiDarkMonitor()
{
return this.semiDarkMonitor;
}
@Override
public IItemDefinition darkMonitor()
{
return this.darkMonitor;
}
@Override
public IItemDefinition interfaceTerminal()
{
return this.interfaceTerminal;
}
@Override
public IItemDefinition patternTerminal()
{
return this.patternTerminal;
}
@Override
public IItemDefinition craftingTerminal()
{
return this.craftingTerminal;
}
@Override
public IItemDefinition terminal()
{
return this.terminal;
}
@Override
public IItemDefinition storageMonitor()
{
return this.storageMonitor;
}
@Override
public IItemDefinition conversionMonitor()
{
return this.conversionMonitor;
}
}
@@ -0,0 +1,105 @@
package appeng.core.api.definitions;
import net.minecraft.item.Item;
import com.google.common.base.Optional;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.ITileDefinition;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
import appeng.core.FeatureHandlerRegistry;
import appeng.core.FeatureRegistry;
import appeng.core.features.ColoredItemDefinition;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
import appeng.core.features.ItemStackSrc;
import appeng.items.parts.ItemMultiPart;
import appeng.items.parts.PartType;
public class DefinitionConstructor
{
private final FeatureRegistry features;
private final FeatureHandlerRegistry handlers;
public DefinitionConstructor( FeatureRegistry features, FeatureHandlerRegistry handlers )
{
this.features = features;
this.handlers = handlers;
}
public final ITileDefinition registerTileDefinition( IAEFeature feature )
{
final IBlockDefinition definition = this.registerBlockDefinition( feature );
if ( definition instanceof ITileDefinition )
{
return ( (ITileDefinition) definition );
}
throw new RuntimeException( "No tile definition" );
}
public final IBlockDefinition registerBlockDefinition( IAEFeature feature )
{
final IItemDefinition definition = this.registerItemDefinition( feature );
if ( definition instanceof IBlockDefinition )
{
return ( (IBlockDefinition) definition );
}
throw new RuntimeException( "No block definition" );
}
public final IItemDefinition registerItemDefinition( IAEFeature feature )
{
final IFeatureHandler handler = feature.handler();
if ( handler.isFeatureAvailable() )
{
this.handlers.addFeatureHandler( handler );
this.features.addFeature( feature );
}
final IItemDefinition definition = handler.getDefinition();
return definition;
}
public final AEColoredItemDefinition constructColoredDefinition( IItemDefinition target, int offset )
{
final ColoredItemDefinition definition = new ColoredItemDefinition();
for ( Item targetItem : target.maybeItem().asSet() )
{
for ( AEColor color : AEColor.VALID_COLORS )
{
definition.add( color, new ItemStackSrc( targetItem, offset + color.ordinal() ) );
}
}
return definition;
}
public final AEColoredItemDefinition constructColoredDefinition( ItemMultiPart target, PartType type )
{
final ColoredItemDefinition definition = new ColoredItemDefinition();
for ( AEColor color : AEColor.values() )
{
ItemStackSrc multiPartSource = target.createPart( type, color );
final Optional<ItemStackSrc> maybeSource = Optional.fromNullable( multiPartSource );
if ( maybeSource.isPresent() )
{
definition.add( color, multiPartSource );
}
}
return definition;
}
}
@@ -21,11 +21,11 @@ package appeng.core.features;
import java.util.EnumSet;
import com.google.common.base.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
import appeng.api.definitions.ITileDefinition;
import appeng.block.AEBaseBlock;
import appeng.block.AEBaseItemBlock;
import appeng.core.CommonHelper;
@@ -33,21 +33,21 @@ import appeng.core.CreativeTab;
import appeng.util.Platform;
public class AEBlockFeatureHandler implements IFeatureHandler
public final class AEBlockFeatureHandler implements IFeatureHandler
{
private final EnumSet<AEFeature> features;
private final AEBaseBlock featured;
private final FeatureNameExtractor extractor;
private final boolean enabled;
private final AEBlockDefinition definition;
private final TileDefinition definition;
public AEBlockFeatureHandler( EnumSet<AEFeature> features, AEBaseBlock featured, Optional<String> subName )
{
this.features = features;
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
this.featured = featured;
this.extractor = new FeatureNameExtractor( featured.getClass(), subName );
this.enabled = new FeaturedActiveChecker( features ).get();
this.definition = new AEBlockDefinition( featured, this.enabled );
this.enabled = state == ActivityState.Enabled;
this.definition = new TileDefinition( featured, state );
}
@Override
@@ -57,13 +57,7 @@ public class AEBlockFeatureHandler implements IFeatureHandler
}
@Override
public EnumSet<AEFeature> getFeatures()
{
return this.features;
}
@Override
public AEItemDefinition getDefinition()
public ITileDefinition getDefinition()
{
return this.definition;
}
@@ -1,266 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features;
import java.util.EnumSet;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.util.AEItemDefinition;
import appeng.block.AEBaseBlock;
import appeng.block.AEBaseItemBlock;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.CreativeTab;
import appeng.core.CreativeTabFacade;
import appeng.items.parts.ItemFacade;
import appeng.util.Platform;
public class AEFeatureHandler implements AEItemDefinition
{
private static final Pattern PATTERN_ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
private static final Pattern PATTERN_ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
private static final Pattern PATTERN_QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
private final EnumSet<AEFeature> features;
private final String subName;
private final IAEFeature feature;
private Item ItemData;
private Block BlockData;
private BlockStairs stairData;
public AEFeatureHandler( EnumSet<AEFeature> features, IAEFeature feature, String subName )
{
this.features = features;
this.feature = feature;
this.subName = subName;
}
public void register()
{
if ( this.isFeatureAvailable() )
{
if ( this.feature instanceof Item )
{
this.initItem( ( Item ) this.feature );
}
else if ( this.feature instanceof BlockStairs )
{
this.initStairBlock( ( BlockStairs ) this.feature );
}
else if ( this.feature instanceof Block )
{
this.initBlock( ( Block ) this.feature );
}
}
}
public boolean isFeatureAvailable()
{
boolean enabled = true;
for ( AEFeature f : this.features )
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
return enabled;
}
private void initItem( Item i )
{
this.ItemData = i;
String name = getName( i.getClass(), this.subName );
i.setTextureName( "appliedenergistics2:" + name );
i.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
if ( i instanceof ItemFacade )
i.setCreativeTab( CreativeTabFacade.instance );
else
i.setCreativeTab( CreativeTab.instance );
if ( name.equals( "ItemMaterial" ) )
name = "ItemMultiMaterial";
else if ( name.equals( "ItemPart" ) )
name = "ItemMultiPart";
GameRegistry.registerItem( i, "item." + name );
}
private void initStairBlock( BlockStairs stair )
{
this.stairData = stair;
String name = getName( stair.getClass(), this.subName );
stair.setCreativeTab( CreativeTab.instance );
stair.setBlockName( /* "tile." */"appliedenergistics2." + name );
stair.setBlockTextureName( "appliedenergistics2:" + name );
GameRegistry.registerBlock( stair, "tile." + name );
}
private void initBlock( Block b )
{
this.BlockData = b;
String name = getName( b.getClass(), this.subName );
b.setCreativeTab( CreativeTab.instance );
b.setBlockName( /* "tile." */"appliedenergistics2." + name );
b.setBlockTextureName( "appliedenergistics2:" + name );
if ( Platform.isClient() && this.BlockData instanceof AEBaseBlock )
{
AEBaseBlock bb = ( AEBaseBlock ) b;
CommonHelper.proxy.bindTileEntitySpecialRenderer( bb.getTileEntityClass(), bb );
}
Class<? extends AEBaseItemBlock> itemBlock = AEBaseItemBlock.class;
if ( b instanceof AEBaseBlock )
itemBlock = ( ( AEBaseBlock ) b ).getItemBlockClass();
GameRegistry.registerBlock( b, itemBlock, "tile." + name );
}
public static String getName( Class o, String subName )
{
String name = o.getSimpleName();
if ( name.startsWith( "ItemMultiPart" ) )
name = PATTERN_ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
else if ( name.startsWith( "ItemMultiMaterial" ) )
name = PATTERN_ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
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" ) )
return "ItemPart.P2PTunnel";
if ( subName.equals( "CertusQuartzTools" ) )
return PATTERN_QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
if ( subName.equals( "NetherQuartzTools" ) )
return PATTERN_QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
name += '.' + subName;
}
return name;
}
public EnumSet<AEFeature> getFeatures()
{
return this.features.clone();
}
@Override
public Block block()
{
return this.BlockData;
}
@Override
public Item item()
{
if ( this.ItemData != null )
{
return this.ItemData;
}
else if ( this.BlockData != null )
{
return Item.getItemFromBlock( this.BlockData );
}
else if ( this.stairData != null )
{
return Item.getItemFromBlock( this.stairData );
}
return null;
}
@Override
public Class<? extends TileEntity> entity()
{
if ( this.BlockData instanceof AEBaseBlock )
{
AEBaseBlock bb = ( AEBaseBlock ) this.BlockData;
return bb.getTileEntityClass();
}
return null;
}
@Override
public ItemStack stack( int stackSize )
{
if ( this.isFeatureAvailable() )
{
ItemStack rv;
if ( this.ItemData != null )
rv = new ItemStack( this.ItemData );
else
rv = new ItemStack( this.BlockData );
rv.stackSize = stackSize;
return rv;
}
return null;
}
@Override
public boolean sameAsStack( ItemStack is )
{
return this.isFeatureAvailable() && Platform.isSameItemType( is, this.stack( 1 ) );
}
/**
* block at xyz in world is same if:
*
* - the feature is available
* - the stored block data is not null
* - and the stored block data is equal
*
* @param world world of block
* @param x x pos of block
* @param y y pos of block
* @param z z pos of block
*
* @return true if feature is available and the blocks are equal
*/
@Override
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
{
return this.isFeatureAvailable() && this.BlockData != null && world.getBlock( x, y, z ) == this.BlockData;
}
}
@@ -0,0 +1,7 @@
package appeng.core.features;
public enum ActivityState
{
Enabled, Disabled
}
@@ -21,62 +21,61 @@ package appeng.core.features;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import appeng.api.util.AEItemDefinition;
import appeng.util.Platform;
import com.google.common.base.Optional;
import appeng.api.definitions.IBlockDefinition;
public class BlockDefinition implements AEItemDefinition
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
{
private final Block block;
private final boolean enabled;
public BlockDefinition( Block block, boolean enabled )
public BlockDefinition( Block block, ActivityState state )
{
super( Item.getItemFromBlock( block ), state );
this.block = block;
this.enabled = enabled;
this.enabled = state == ActivityState.Enabled;
}
@Override
public Block block()
public Optional<Block> maybeBlock()
{
return this.block;
return Optional.of( this.block );
}
@Override
public Item item()
{
return Item.getItemFromBlock( this.block );
}
@Override
public Class<? extends TileEntity> entity()
{
return null;
}
@Override
public ItemStack stack( int stackSize )
public Optional<ItemBlock> maybeItemBlock()
{
if ( this.enabled )
{
return new ItemStack( this.block );
return Optional.of( new ItemBlock( this.block ) );
}
else
{
return Optional.absent();
}
return null;
}
@Override
public boolean sameAsStack( ItemStack comparableItem )
public final Optional<ItemStack> maybeStack( int stackSize )
{
return this.enabled && Platform.isSameItemType( comparableItem, this.stack( 1 ) );
if ( this.enabled )
{
return Optional.of( new ItemStack( this.block ) );
}
else
{
return Optional.absent();
}
}
@Override
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
public final boolean isSameAs( IBlockAccess world, int x, int y, int z )
{
return this.enabled && world.getBlock( x, y, z ) == this.block;
}
@@ -26,7 +26,7 @@ import net.minecraft.tileentity.TileEntity;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
public class ColoredItemDefinition implements AEColoredItemDefinition
public final class ColoredItemDefinition implements AEColoredItemDefinition
{
final ItemStackSrc[] colors = new ItemStackSrc[17];
@@ -18,60 +18,53 @@
package appeng.core.features;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
public class DamagedItemDefinition implements AEItemDefinition
import appeng.api.definitions.IItemDefinition;
public final class DamagedItemDefinition implements IItemDefinition
{
private final IStackSrc source;
final IStackSrc src;
public DamagedItemDefinition(IStackSrc is) {
this.src = is;
public DamagedItemDefinition( IStackSrc source )
{
this.source = source;
}
@Override
public Block block()
public Optional<Item> maybeItem()
{
return null;
final Item item = this.source.getItem();
return Optional.fromNullable( item );
}
@Override
public Item item()
public Optional<ItemStack> maybeStack( int stackSize )
{
return this.src.getItem();
final ItemStack stack = this.source.stack( stackSize );
return Optional.fromNullable( stack );
}
@Override
public Class<? extends TileEntity> entity()
public boolean isSameAs( ItemStack comparableStack )
{
return null;
}
@Override
public ItemStack stack(int stackSize)
{
return this.src.stack( stackSize );
}
@Override
public boolean sameAsStack(ItemStack comparableItem)
{
if ( comparableItem == null )
if ( comparableStack == null )
return false;
return comparableItem.getItem() == this.src.getItem() && comparableItem.getItemDamage() == this.src.getDamage();
return comparableStack.getItem() == this.source.getItem() && comparableStack.getItemDamage() == this.source.getDamage();
}
@Override
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
{
return false;
}
}
@@ -0,0 +1,160 @@
package appeng.core.features;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IComparableDefinition;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.ITileDefinition;
import appeng.api.util.AEItemDefinition;
/**
* @deprecated
*/
@Deprecated
public final class DefinitionConverter
{
public AEItemDefinition of( ITileDefinition definition )
{
return new AETile( definition );
}
public AEItemDefinition of( IBlockDefinition definition )
{
return new AEBlock( definition );
}
public AEItemDefinition of( IItemDefinition definition )
{
return new AEItem( definition );
}
public AEItemDefinition of( IComparableDefinition definition )
{
return new AEComparable( definition );
}
private static class AEComparable implements AEItemDefinition
{
private final IComparableDefinition definition;
public AEComparable( IComparableDefinition definition )
{
this.definition = definition;
}
@Nullable
@Override
public Block block()
{
return null;
}
@Nullable
@Override
public Item item()
{
return null;
}
@Nullable
@Override
public Class<? extends TileEntity> entity()
{
return null;
}
@Nullable
@Override
public ItemStack stack( int stackSize )
{
return null;
}
@Override
public boolean sameAsStack( ItemStack comparableItem )
{
return this.definition.isSameAs( comparableItem );
}
@Override
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
{
return this.definition.isSameAs( world, x, y, z );
}
}
private static class AEItem extends AEComparable
{
private final IItemDefinition definition;
public AEItem( IItemDefinition definition )
{
super( definition );
this.definition = definition;
}
@Nullable
@Override
public ItemStack stack( int stackSize )
{
return this.definition.maybeStack( stackSize ).orNull();
}
@Nullable
@Override
public Item item()
{
return this.definition.maybeItem().orNull();
}
}
private static class AEBlock extends AEItem
{
private final IBlockDefinition definition;
public AEBlock( IBlockDefinition definition )
{
super( definition );
this.definition = definition;
}
@Nullable
@Override
public Block block()
{
return this.definition.maybeBlock().orNull();
}
}
private static class AETile extends AEBlock
{
private final ITileDefinition definition;
public AETile( ITileDefinition definition )
{
super( definition );
this.definition = definition;
}
@Nullable
@Override
public Class<? extends TileEntity> entity()
{
return this.definition.maybeEntity().orNull();
}
}
}
@@ -19,30 +19,30 @@
package appeng.core.features;
import java.util.EnumSet;
import java.util.Set;
import appeng.core.AEConfig;
public class FeaturedActiveChecker
{
private final EnumSet<AEFeature> features;
private final Set<AEFeature> features;
public FeaturedActiveChecker( EnumSet<AEFeature> features )
public FeaturedActiveChecker( Set<AEFeature> features )
{
this.features = features;
}
public boolean get()
public ActivityState getActivityState()
{
for ( AEFeature f : this.features )
{
if ( !AEConfig.instance.isFeatureEnabled( f ) )
{
return false;
return ActivityState.Disabled;
}
}
return true;
return ActivityState.Enabled;
}
}
@@ -19,18 +19,14 @@
package appeng.core.features;
import java.util.EnumSet;
import appeng.api.util.AEItemDefinition;
import appeng.api.definitions.IItemDefinition;
public interface IFeatureHandler
{
boolean isFeatureAvailable();
EnumSet<AEFeature> getFeatures();
AEItemDefinition getDefinition();
IItemDefinition getDefinition();
void register();
}
@@ -19,66 +19,54 @@
package appeng.core.features;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
import appeng.api.definitions.IItemDefinition;
import appeng.util.Platform;
public class ItemDefinition implements AEItemDefinition
public class ItemDefinition implements IItemDefinition
{
private final Item item;
private final boolean enabled;
public ItemDefinition( Item item, boolean enabled )
public ItemDefinition( Item item, ActivityState state )
{
this.item = item;
this.enabled = enabled;
this.enabled = state == ActivityState.Enabled;
}
@Override
public Block block()
public final Optional<Item> maybeItem()
{
return null;
return Optional.of( this.item );
}
@Override
public Item item()
{
return this.item;
}
@Override
public Class<? extends TileEntity> entity()
{
return null;
}
@Override
public ItemStack stack( int stackSize )
public Optional<ItemStack> maybeStack( int stackSize )
{
if ( this.enabled )
{
return new ItemStack( this.item );
return Optional.of( new ItemStack( this.item ) );
}
else
{
return null;
return Optional.absent();
}
}
@Override
public boolean sameAsStack( ItemStack comparableItem )
public final boolean isSameAs( ItemStack comparableStack )
{
return this.enabled && Platform.isSameItemType( comparableItem, this.stack( 1 ) );
return this.enabled && Platform.isSameItemType( comparableStack, this.maybeStack( 1 ).get() );
}
@Override
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
{
return false;
}
@@ -21,21 +21,20 @@ package appeng.core.features;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
import appeng.api.definitions.IItemDefinition;
import appeng.core.CreativeTab;
import appeng.core.CreativeTabFacade;
import appeng.items.parts.ItemFacade;
public class ItemFeatureHandler implements IFeatureHandler
public final class ItemFeatureHandler implements IFeatureHandler
{
private final EnumSet<AEFeature> features;
private final Item item;
private final FeatureNameExtractor extractor;
private final boolean enabled;
@@ -43,11 +42,12 @@ public class ItemFeatureHandler implements IFeatureHandler
public ItemFeatureHandler( EnumSet<AEFeature> features, Item item, IAEFeature featured, Optional<String> subName )
{
this.features = features;
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
this.item = item;
this.extractor = new FeatureNameExtractor( featured.getClass(), subName );
this.enabled = new FeaturedActiveChecker( features ).get();
this.definition = new ItemDefinition( item, this.enabled );
this.enabled = state == ActivityState.Enabled;
this.definition = new ItemDefinition( item, state );
}
@Override
@@ -57,13 +57,7 @@ public class ItemFeatureHandler implements IFeatureHandler
}
@Override
public EnumSet<AEFeature> getFeatures()
{
return this.features;
}
@Override
public AEItemDefinition getDefinition()
public IItemDefinition getDefinition()
{
return this.definition;
}
@@ -71,28 +65,31 @@ public class ItemFeatureHandler implements IFeatureHandler
@Override
public void register()
{
String name = this.extractor.get();
this.item.setTextureName( "appliedenergistics2:" + name );
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
if ( this.enabled )
{
String name = this.extractor.get();
this.item.setTextureName( "appliedenergistics2:" + name );
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
if ( this.item instanceof ItemFacade )
{
this.item.setCreativeTab( CreativeTabFacade.instance );
}
else
{
this.item.setCreativeTab( CreativeTab.instance );
}
if ( this.item instanceof ItemFacade )
{
this.item.setCreativeTab( CreativeTabFacade.instance );
}
else
{
this.item.setCreativeTab( CreativeTab.instance );
}
if ( name.equals( "ItemMaterial" ) )
{
name = "ItemMultiMaterial";
}
else if ( name.equals( "ItemPart" ) )
{
name = "ItemMultiPart";
}
if ( name.equals( "ItemMaterial" ) )
{
name = "ItemMultiMaterial";
}
else if ( name.equals( "ItemPart" ) )
{
name = "ItemMultiPart";
}
GameRegistry.registerItem( this.item, "item." + name );
GameRegistry.registerItem( this.item, "item." + name );
}
}
}
@@ -18,24 +18,27 @@
package appeng.core.features;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import appeng.items.materials.MaterialType;
public class MaterialStackSrc implements IStackSrc
{
final MaterialType src;
public MaterialStackSrc(MaterialType src) {
public MaterialStackSrc( MaterialType src )
{
assert src != null;
this.src = src;
if ( src == null )
throw new RuntimeException( "Invalid Item Stack" );
}
@Override
public ItemStack stack(int stackSize)
public ItemStack stack( int stackSize )
{
return this.src.stack( stackSize );
}
@@ -51,5 +54,4 @@ public class MaterialStackSrc implements IStackSrc
{
return this.src.damageValue;
}
}
@@ -0,0 +1,75 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features;
import java.util.regex.Pattern;
import appeng.items.AEBaseItem;
/**
* This class is used to rename items to match the persistent stored items.
*
* This can be removed, when a new iteration of minecraft arrives or a new world is used.
* Remember to differentiate the currently renamed items later on correctly.
*
* @deprecated only a temporary solution for a rename
*/
@Deprecated
public final class NameResolver
{
private static final Pattern ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
private static final Pattern ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
private static final Pattern QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
private final Class<? extends AEBaseItem> withOriginalName;
public NameResolver( Class<? extends AEBaseItem> withOriginalName)
{
this.withOriginalName = withOriginalName;
}
public String getName( String subName )
{
String name = this.withOriginalName.getSimpleName();
if ( name.startsWith( "ItemMultiPart" ) )
name = ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
else if ( name.startsWith( "ItemMultiMaterial" ) )
name = ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
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" ) )
return "ItemPart.P2PTunnel";
if ( subName.equals( "CertusQuartzTools" ) )
return QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
if ( subName.equals( "NetherQuartzTools" ) )
return QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
name += '.' + subName;
}
return name;
}
}
@@ -1,68 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import appeng.api.util.AEItemDefinition;
public class NullItemDefinition implements AEItemDefinition
{
@Override
public Block block()
{
return null;
}
@Override
public Item item()
{
return null;
}
@Override
public Class<? extends TileEntity> entity()
{
return null;
}
@Override
public ItemStack stack(int stackSize)
{
return null;
}
@Override
public boolean sameAsStack(ItemStack comparableItem)
{
return false;
}
@Override
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
{
return false;
}
}
@@ -21,19 +21,18 @@ package appeng.core.features;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.block.BlockStairs;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
import appeng.api.definitions.IBlockDefinition;
import appeng.core.CreativeTab;
public class StairBlockFeatureHandler implements IFeatureHandler
{
private final EnumSet<AEFeature> features;
private final BlockStairs stairs;
private final FeatureNameExtractor extractor;
private final boolean enabled;
@@ -41,39 +40,37 @@ public class StairBlockFeatureHandler implements IFeatureHandler
public StairBlockFeatureHandler( EnumSet<AEFeature> features, BlockStairs stairs, Optional<String> subName )
{
this.features = features;
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
this.stairs = stairs;
this.extractor = new FeatureNameExtractor( stairs.getClass(), subName );
this.enabled = new FeaturedActiveChecker( features ).get();
this.definition = new BlockDefinition( stairs, this.enabled );
this.enabled = state == ActivityState.Enabled;
this.definition = new BlockDefinition( stairs, state );
}
@Override
public boolean isFeatureAvailable()
public final boolean isFeatureAvailable()
{
return this.enabled;
}
@Override
public EnumSet<AEFeature> getFeatures()
{
return this.features;
}
@Override
public AEItemDefinition getDefinition()
public final IBlockDefinition getDefinition()
{
return this.definition;
}
@Override
public void register()
public final void register()
{
String name = this.extractor.get();
this.stairs.setCreativeTab( CreativeTab.instance );
this.stairs.setBlockName( "appliedenergistics2." + name );
this.stairs.setBlockTextureName( "appliedenergistics2:" + name );
if ( this.enabled )
{
String name = this.extractor.get();
this.stairs.setCreativeTab( CreativeTab.instance );
this.stairs.setBlockName( "appliedenergistics2." + name );
this.stairs.setBlockTextureName( "appliedenergistics2:" + name );
GameRegistry.registerBlock( this.stairs, "tile." + name );
GameRegistry.registerBlock( this.stairs, "tile." + name );
}
}
}
@@ -21,23 +21,28 @@ package appeng.core.features;
import net.minecraft.tileentity.TileEntity;
import com.google.common.base.Optional;
import appeng.api.definitions.ITileDefinition;
import appeng.block.AEBaseBlock;
public class AEBlockDefinition extends BlockDefinition
public final class TileDefinition extends BlockDefinition implements ITileDefinition
{
private final AEBaseBlock block;
public AEBlockDefinition( AEBaseBlock block, boolean enabled )
public TileDefinition( AEBaseBlock block, ActivityState state )
{
super( block, enabled );
super( block, state );
this.block = block;
}
@Override
public Class<? extends TileEntity> entity()
public Optional<? extends Class<? extends TileEntity>> maybeEntity()
{
return this.block.getTileEntityClass();
final Class<? extends TileEntity> entity = this.block.getTileEntityClass();
return Optional.of( entity );
}
}
@@ -18,67 +18,92 @@
package appeng.core.features;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Function;
import com.google.common.base.Optional;
public class WrappedDamageItemDefinition implements AEItemDefinition
import appeng.api.definitions.ITileDefinition;
public final class WrappedDamageItemDefinition implements ITileDefinition
{
private final ITileDefinition definition;
private final int damage;
final AEItemDefinition baseItem;
final int damage;
public WrappedDamageItemDefinition(AEItemDefinition def, int dmg) {
this.baseItem = def;
this.damage = dmg;
public WrappedDamageItemDefinition( ITileDefinition definition, int damage )
{
this.definition = definition;
this.damage = damage;
}
@Override
public Block block()
public Optional<? extends Class<? extends TileEntity>> maybeEntity()
{
return this.baseItem.block();
return this.definition.maybeEntity();
}
@Override
public Item item()
public Optional<Block> maybeBlock()
{
return this.baseItem.item();
return this.definition.maybeBlock();
}
@Override
public Class<? extends TileEntity> entity()
public Optional<ItemBlock> maybeItemBlock()
{
return this.baseItem.entity();
return this.definition.maybeItemBlock();
}
@Override
public ItemStack stack(int stackSize)
public Optional<Item> maybeItem()
{
if ( this.baseItem == null )
return null;
return new ItemStack( this.baseItem.block(), stackSize, this.damage );
return this.definition.maybeItem();
}
@Override
public boolean sameAsStack(ItemStack comparableItem)
public Optional<ItemStack> maybeStack( final int stackSize )
{
if ( comparableItem == null )
return this.definition.maybeBlock().transform( new BlockTransformFunction( stackSize ) );
}
@Override
public boolean isSameAs( ItemStack comparableStack )
{
if ( comparableStack == null )
return false;
return comparableItem.getItem() == this.baseItem.item() && comparableItem.getItemDamage() == this.damage;
return this.definition.isSameAs( comparableStack ) && comparableStack.getItemDamage() == this.damage;
}
@Override
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
{
if ( this.block() != null )
return world.getBlock( x, y, z ) == this.block() && world.getBlockMetadata( x, y, z ) == this.damage;
return false;
return this.definition.isSameAs( world, x, y, z ) && world.getBlockMetadata( x, y, z ) == this.damage;
}
private class BlockTransformFunction implements Function<Block, ItemStack>
{
private final int stackSize;
public BlockTransformFunction( int stackSize )
{
this.stackSize = stackSize;
}
@Nullable
@Override
public ItemStack apply( Block input )
{
return new ItemStack( input, this.stackSize, WrappedDamageItemDefinition.this.damage );
}
}
}
@@ -30,7 +30,10 @@ import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.definitions.Parts;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IParts;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.util.AEColor;
import appeng.util.Platform;
@@ -78,14 +81,16 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
/**
* attune based on lots of random item related stuff
*/
appeng.api.definitions.Blocks AEBlocks = AEApi.instance().blocks();
Parts Parts = AEApi.instance().parts();
final IDefinitions definitions = AEApi.instance().definitions();
final IBlocks blocks = definitions.blocks();
final IParts parts = definitions.parts();
this.addNewAttunement( blocks.iface(), TunnelType.ITEM );
this.addNewAttunement( parts.iface(), TunnelType.ITEM );
this.addNewAttunement( parts.storageBus(), TunnelType.ITEM );
this.addNewAttunement( parts.importBus(), TunnelType.ITEM );
this.addNewAttunement( parts.exportBus(), TunnelType.ITEM );
this.addNewAttunement( AEBlocks.blockInterface.stack( 1 ), TunnelType.ITEM );
this.addNewAttunement( Parts.partInterface.stack( 1 ), TunnelType.ITEM );
this.addNewAttunement( Parts.partStorageBus.stack( 1 ), TunnelType.ITEM );
this.addNewAttunement( Parts.partImportBus.stack( 1 ), TunnelType.ITEM );
this.addNewAttunement( Parts.partExportBus.stack( 1 ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.hopper ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.chest ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.trapped_chest ), TunnelType.ITEM );
@@ -108,10 +113,18 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
for (AEColor c : AEColor.values())
{
this.addNewAttunement( Parts.partCableGlass.stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( Parts.partCableCovered.stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( Parts.partCableSmart.stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( Parts.partCableDense.stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( parts.cableSmart().stack( c, 1 ), TunnelType.ME );
this.addNewAttunement( parts.cableDense().stack( c, 1 ), TunnelType.ME );
}
}
private void addNewAttunement( IItemDefinition definition, TunnelType type )
{
for ( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
{
this.addNewAttunement( definitionStack, type );
}
}
@@ -24,88 +24,87 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import appeng.api.AEApi;
import appeng.api.definitions.IItemDefinition;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
import appeng.api.util.AEItemDefinition;
public enum Achievements
{
// done
Compass( -2, -4, AEApi.instance().definitions().blocks().skyCompass(), AchievementType.Craft ),
// done
Compass( -2, -4, AEApi.instance().blocks().blockSkyCompass, AchievementType.Craft ),
Presses( -2, -2, AEApi.instance().definitions().materials().logicProcessorPress(), AchievementType.Custom ),
// done
Presses( -2, -2, AEApi.instance().materials().materialLogicProcessorPress, AchievementType.Custom ),
SpatialIO( -4, -4, AEApi.instance().definitions().blocks().spatialIOPort(), AchievementType.Craft ),
// done
SpatialIO( -4, -4, AEApi.instance().blocks().blockSpatialIOPort, AchievementType.Craft ),
SpatialIOExplorer( -4, -2, AEApi.instance().definitions().items().spatialCell128(), AchievementType.Custom ),
// done
SpatialIOExplorer( -4, -2, AEApi.instance().items().itemSpatialCell128, AchievementType.Custom ),
StorageCell( -6, -4, AEApi.instance().definitions().items().cell64k(), AchievementType.CraftItem ),
// done
StorageCell( -6, -4, AEApi.instance().items().itemCell64k, AchievementType.CraftItem ),
IOPort( -6, -2, AEApi.instance().definitions().blocks().iOPort(), AchievementType.Craft ),
// done
IOPort( -6, -2, AEApi.instance().blocks().blockIOPort, AchievementType.Craft ),
CraftingTerminal( -8, -4, AEApi.instance().definitions().parts().craftingTerminal(), AchievementType.Craft ),
// done
CraftingTerminal( -8, -4, AEApi.instance().parts().partCraftingTerminal, AchievementType.Craft ),
PatternTerminal( -8, -2, AEApi.instance().definitions().parts().patternTerminal(), AchievementType.Craft ),
// done
PatternTerminal( -8, -2, AEApi.instance().parts().partPatternTerminal, AchievementType.Craft ),
ChargedQuartz( 0, -4, AEApi.instance().definitions().materials().certusQuartzCrystalCharged(), AchievementType.Pickup ),
// done
ChargedQuartz( 0, -4, AEApi.instance().materials().materialCertusQuartzCrystalCharged, AchievementType.Pickup ),
Fluix( 0, -2, AEApi.instance().definitions().materials().fluixCrystal(), AchievementType.Pickup ),
// done
Fluix( 0, -2, AEApi.instance().materials().materialFluixCrystal, AchievementType.Pickup ),
Charger( 0, 0, AEApi.instance().definitions().blocks().charger(), AchievementType.Craft ),
// done
Charger( 0, 0, AEApi.instance().blocks().blockCharger, AchievementType.Craft ),
CrystalGrowthAccelerator( -2, 0, AEApi.instance().definitions().blocks().quartzGrowthAccelerator(), AchievementType.Craft ),
// done
CrystalGrowthAccelerator( -2, 0, AEApi.instance().blocks().blockQuartzGrowthAccelerator, AchievementType.Craft ),
GlassCable( 2, 0, AEApi.instance().definitions().parts().cableGlass(), AchievementType.Craft ),
// done
GlassCable( 2, 0, AEApi.instance().parts().partCableGlass, AchievementType.Craft ),
Networking1( 4, -6, AEApi.instance().definitions().parts().cableCovered(), AchievementType.Custom ),
// done
Networking1( 4, -6, AEApi.instance().parts().partCableCovered, AchievementType.Custom ),
Controller( 4, -4, AEApi.instance().definitions().blocks().controller(), AchievementType.Craft ),
// done
Controller( 4, -4, AEApi.instance().blocks().blockController, AchievementType.Craft ),
Networking2( 4, 0, AEApi.instance().definitions().parts().cableSmart(), AchievementType.Custom ),
// done
Networking2( 4, 0, AEApi.instance().parts().partCableSmart, AchievementType.Custom ),
Networking3( 4, 2, AEApi.instance().definitions().parts().cableDense(), AchievementType.Custom ),
// done
Networking3( 4, 2, AEApi.instance().parts().partCableDense, AchievementType.Custom ),
P2P( 2, -2, AEApi.instance().definitions().parts().p2PTunnelME(), AchievementType.Craft ),
// done
P2P( 2, -2, AEApi.instance().parts().partP2PTunnelME, AchievementType.Craft ),
Recursive( 6, -2, AEApi.instance().definitions().blocks().iface(), AchievementType.Craft ),
// done
Recursive( 6, -2, AEApi.instance().blocks().blockInterface, AchievementType.Craft ),
CraftingCPU( 6, 0, AEApi.instance().definitions().blocks().craftingStorage64k(), AchievementType.CraftItem ),
// done
CraftingCPU( 6, 0, AEApi.instance().blocks().blockCraftingStorage64k, AchievementType.CraftItem ),
Facade( 6, 2, AEApi.instance().definitions().items().facade(), AchievementType.CraftItem ),
// done
Facade( 6, 2, AEApi.instance().items().itemFacade, AchievementType.CraftItem ),
NetworkTool( 8, 0, AEApi.instance().definitions().items().networkTool(), AchievementType.Craft ),
// done
NetworkTool( 8, 0, AEApi.instance().items().itemNetworkTool, AchievementType.Craft ),
PortableCell( 8, 2, AEApi.instance().definitions().items().portableCell(), AchievementType.Craft ),
// done
PortableCell( 8, 2, AEApi.instance().items().itemPortableCell, AchievementType.Craft ),
StorageBus( 10, 0, AEApi.instance().definitions().parts().storageBus(), AchievementType.Craft ),
// done
StorageBus( 10, 0, AEApi.instance().parts().partStorageBus, AchievementType.Craft ),
// done
QNB( 10, 2, AEApi.instance().blocks().blockQuantumLink, AchievementType.Craft );
QNB( 10, 2, AEApi.instance().definitions().blocks().quantumLink(), AchievementType.Craft );
public final ItemStack stack;
public final AchievementType type;
@@ -139,9 +138,9 @@ public enum Achievements
this.y = y;
}
Achievements( int x, int y, AEItemDefinition which, AchievementType type )
Achievements( int x, int y, IItemDefinition which, AchievementType type )
{
this.stack = (which != null) ? which.stack( 1 ) : null;
this.stack = which.maybeStack( 1 ).orNull();
this.type = type;
this.x = x;
this.y = y;
+27 -7
View File
@@ -20,6 +20,7 @@ package appeng.core.sync;
import java.lang.reflect.Constructor;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -32,9 +33,12 @@ import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.relauncher.ReflectionHelper;
import com.google.common.collect.Lists;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.definitions.Materials;
import appeng.api.definitions.IComparableDefinition;
import appeng.api.definitions.IMaterials;
import appeng.api.exceptions.AppEngException;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.implementations.IUpgradeableHost;
@@ -273,12 +277,8 @@ public enum GuiBridge implements IGuiHandler
{
ItemStack is = ((Slot) so).getStack();
Materials m = AEApi.instance().materials();
if ( m.materialLogicProcessorPress.sameAsStack( is ) || m.materialEngProcessorPress.sameAsStack( is )
|| m.materialCalcProcessorPress.sameAsStack( is ) || m.materialSiliconPress.sameAsStack( is ) )
{
Achievements.Presses.addToPlayer( inventory.player );
}
final IMaterials materials = AEApi.instance().definitions().materials();
this.addPressAchievementToPlayer( is, materials, inventory.player );
}
}
}
@@ -291,6 +291,26 @@ public enum GuiBridge implements IGuiHandler
}
}
private void addPressAchievementToPlayer( ItemStack newItem, IMaterials possibleMaterials, EntityPlayer player )
{
final IComparableDefinition logic = possibleMaterials.logicProcessorPress();
final IComparableDefinition eng = possibleMaterials.engProcessorPress();
final IComparableDefinition calc = possibleMaterials.calcProcessorPress();
final IComparableDefinition silicon = possibleMaterials.siliconPress();
final List<IComparableDefinition> presses = Lists.newArrayList( logic, eng, calc, silicon );
for ( IComparableDefinition press : presses )
{
if ( press.isSameAs( newItem ) )
{
Achievements.Presses.addToPlayer( player );
return;
}
}
}
public Object ConstructGui(InventoryPlayer inventory, ForgeDirection side, Object tE)
{
try
@@ -25,6 +25,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IComparableDefinition;
import appeng.api.definitions.IItems;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.core.sync.AppEngPacket;
@@ -58,21 +60,30 @@ public class PacketClick extends AppEngPacket
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
ItemStack is = player.inventory.getCurrentItem();
if ( is != null && is.getItem() instanceof ToolNetworkTool )
final IItems items = AEApi.instance().definitions().items();
final IComparableDefinition maybeMemoryCard = items.memoryCard();
final IComparableDefinition maybeColorApplicator = items.colorApplicator();
if ( is != null )
{
ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
tnt.serverSideToolLogic( is, player, player.worldObj, this.x, this.y, this.z, this.side, this.hitX, this.hitY, this.hitZ );
}
else if ( is != null && AEApi.instance().items().itemMemoryCard.sameAsStack( is ) )
{
IMemoryCard mem = (IMemoryCard) is.getItem();
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
is.setTagCompound( null );
}
else if ( is != null && AEApi.instance().items().itemColorApplicator.sameAsStack( is ) )
{
ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
mem.cycleColors( is, mem.getColor( is ), 1 );
if ( is.getItem() instanceof ToolNetworkTool )
{
ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
tnt.serverSideToolLogic( is, player, player.worldObj, this.x, this.y, this.z, this.side, this.hitX, this.hitY, this.hitZ );
}
else if ( maybeMemoryCard.isSameAs( is ) )
{
IMemoryCard mem = (IMemoryCard) is.getItem();
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
is.setTagCompound( null );
}
else if ( maybeColorApplicator.isSameAs( is ) )
{
ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
mem.cycleColors( is, mem.getColor( is ), 1 );
}
}
}
@@ -34,6 +34,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.implementations.GuiCraftingCPU;
@@ -183,11 +184,11 @@ public class PacketValueConfig extends AppEngPacket
{
IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
for (Enum e : cm.getSettings())
for (Settings e : cm.getSettings())
{
if ( e.name().equals( this.Name ) )
{
Enum def = cm.getSetting( e );
Enum<?> def = cm.getSetting( e );
try
{
@@ -228,11 +229,11 @@ public class PacketValueConfig extends AppEngPacket
{
IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
for (Enum e : cm.getSettings())
for (Settings e : cm.getSettings())
{
if ( e.name().equals( this.Name ) )
{
Enum def = cm.getSetting( e );
Enum<?> def = cm.getSetting( e );
try
{
+28 -25
View File
@@ -18,9 +18,12 @@
package appeng.debug;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -48,24 +51,16 @@ import appeng.parts.p2p.PartP2PTunnel;
import appeng.tile.networking.TileController;
import appeng.util.Platform;
public class ToolDebugCard extends AEBaseItem
{
public ToolDebugCard() {
super( ToolDebugCard.class );
public ToolDebugCard()
{
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
}
public String timeMeasurement(long nanos)
{
long ms = nanos / 100000;
if ( nanos <= 100000 )
return nanos + "ns";
return (ms / 10.0f) + "ms";
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( Platform.isClient() )
return false;
@@ -75,7 +70,7 @@ public class ToolDebugCard extends AEBaseItem
int grids = 0;
int totalNodes = 0;
for (Grid g : TickHandler.INSTANCE.getGridList())
for ( Grid g : TickHandler.INSTANCE.getGridList() )
{
grids++;
totalNodes += g.getNodes().size();
@@ -90,7 +85,7 @@ public class ToolDebugCard extends AEBaseItem
if ( te instanceof IGridHost )
{
GridNode node = (GridNode) ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
GridNode node = (GridNode) ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
if ( node != null )
{
Grid g = node.getInternalGrid();
@@ -103,14 +98,15 @@ public class ToolDebugCard extends AEBaseItem
{
int length = 0;
HashSet<IGridNode> next = new HashSet<IGridNode>();
Set<IGridNode> next = new HashSet<IGridNode>();
next.add( node );
int maxLength = 10000;
outer: while ( ! next.isEmpty() )
outer:
while ( !next.isEmpty() )
{
HashSet<IGridNode> current = next;
Iterable<IGridNode> current = next;
next = new HashSet<IGridNode>();
for ( IGridNode n : current )
@@ -133,15 +129,15 @@ public class ToolDebugCard extends AEBaseItem
if ( center.getMachine() instanceof PartP2PTunnel )
{
this.outputMsg( player, "Freq: " + ((PartP2PTunnel) center.getMachine()).freq );
this.outputMsg( player, "Freq: " + ( (PartP2PTunnel) center.getMachine() ).freq );
}
TickManagerCache tmc = g.getCache( ITickManager.class );
for (Class c : g.getMachineClasses())
for ( Class<? extends IGridHost> c : g.getMachineClasses() )
{
int o = 0;
long nanos = 0;
for (IGridNode oj : g.getMachines( c ))
for ( IGridNode oj : g.getMachines( c ) )
{
o++;
nanos += tmc.getAvgNanoTime( oj );
@@ -165,13 +161,13 @@ public class ToolDebugCard extends AEBaseItem
if ( te instanceof IPartHost )
{
IPart center = ((IPartHost) te).getPart( ForgeDirection.UNKNOWN );
((IPartHost) te).markForUpdate();
IPart center = ( (IPartHost) te ).getPart( ForgeDirection.UNKNOWN );
( (IPartHost) te ).markForUpdate();
if ( center != null )
{
GridNode n = (GridNode) center.getGridNode();
this.outputMsg( player, "Node Channels: " + n.usedChannels() );
for (IGridConnection gc : n.getConnections())
for ( IGridConnection gc : n.getConnections() )
{
ForgeDirection fd = gc.getDirection( n );
if ( fd != ForgeDirection.UNKNOWN )
@@ -187,7 +183,7 @@ public class ToolDebugCard extends AEBaseItem
if ( te instanceof IGridHost )
{
IGridNode node = ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
IGridNode node = ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
if ( node != null && node.getGrid() != null )
{
IEnergyGrid eg = node.getGrid().getCache( IEnergyGrid.class );
@@ -199,9 +195,16 @@ public class ToolDebugCard extends AEBaseItem
return true;
}
private void outputMsg(EntityPlayer player, String string)
private void outputMsg( ICommandSender player, String string )
{
player.addChatMessage( new ChatComponentText( string ) );
}
public String timeMeasurement( long nanos )
{
long ms = nanos / 100000;
if ( nanos <= 100000 )
return nanos + "ns";
return ( ms / 10.0f ) + "ms";
}
}
+23 -21
View File
@@ -18,6 +18,8 @@
package appeng.debug;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
@@ -35,16 +37,25 @@ import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ToolEraser extends AEBaseItem
{
public ToolEraser() {
super( ToolEraser.class );
public static final int BLOCK_ERASE_LIMIT = 90000;
public ToolEraser()
{
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public void registerIcons( IIconRegister par1IconRegister )
{
this.itemIcon = new MissingIcon( this );
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( Platform.isClient() )
return false;
@@ -56,13 +67,12 @@ public class ToolEraser extends AEBaseItem
List<WorldCoord> next = new LinkedList<WorldCoord>();
next.add( new WorldCoord( x, y, z ) );
while (blocks < 90000 && !next.isEmpty())
while ( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
{
List<WorldCoord> c = next;
next = new LinkedList<WorldCoord>();
for (WorldCoord wc : c)
for ( WorldCoord wc : c )
{
Block c_blk = world.getBlock( wc.x, wc.y, wc.z );
int c_meta = world.getBlockMetadata( wc.x, wc.y, wc.z );
@@ -72,15 +82,14 @@ public class ToolEraser extends AEBaseItem
blocks++;
world.setBlock( wc.x, wc.y, wc.z, Platform.AIR );
this.check( world, wc.x + 1, wc.y, wc.z, next );
this.check( world, wc.x - 1, wc.y, wc.z, next );
this.check( world, wc.x, wc.y + 1, wc.z, next );
this.check( world, wc.x, wc.y - 1, wc.z, next );
this.check( world, wc.x, wc.y, wc.z + 1, next );
this.check( world, wc.x, wc.y, wc.z - 1, next );
this.wrappedAdd( world, wc.x + 1, wc.y, wc.z, next );
this.wrappedAdd( world, wc.x - 1, wc.y, wc.z, next );
this.wrappedAdd( world, wc.x, wc.y + 1, wc.z, next );
this.wrappedAdd( world, wc.x, wc.y - 1, wc.z, next );
this.wrappedAdd( world, wc.x, wc.y, wc.z + 1, next );
this.wrappedAdd( world, wc.x, wc.y, wc.z - 1, next );
}
}
}
AELog.info( "Delete " + blocks + " blocks" );
@@ -88,15 +97,8 @@ public class ToolEraser extends AEBaseItem
return true;
}
private void check(World world, int i, int y, int z, List<WorldCoord> next)
private void wrappedAdd( World world, int i, int y, int z, Collection<WorldCoord> next )
{
next.add( new WorldCoord( i, y, z ) );
}
@Override
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = new MissingIcon( this );
}
}
@@ -18,6 +18,7 @@
package appeng.debug;
import java.util.EnumSet;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -28,37 +29,37 @@ import net.minecraft.world.World;
import appeng.client.texture.MissingIcon;
import appeng.core.features.AEFeature;
import appeng.helpers.MeteoritePlacer;
import appeng.worldgen.MeteoritePlacer;
import appeng.worldgen.meteorite.StandardWorld;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ToolMeteoritePlacer extends AEBaseItem
{
public ToolMeteoritePlacer() {
super( ToolMeteoritePlacer.class );
public ToolMeteoritePlacer()
{
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public void registerIcons( IIconRegister par1IconRegister )
{
this.itemIcon = new MissingIcon( this );
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( Platform.isClient() )
return false;
MeteoritePlacer mp = new MeteoritePlacer();
boolean worked = mp.spawnMeteorite( new MeteoritePlacer.StandardWorld( world ), x, y, z );
boolean worked = mp.spawnMeteorite( new StandardWorld( world ), x, y, z );
if ( !worked )
player.addChatMessage( new ChatComponentText( "Un-suitable Location." ) );
return true;
}
@Override
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = new MissingIcon( this );
}
}
@@ -18,9 +18,11 @@
package appeng.debug;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -39,16 +41,16 @@ import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ToolReplicatorCard extends AEBaseItem
{
public ToolReplicatorCard() {
super( ToolReplicatorCard.class );
public ToolReplicatorCard()
{
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( Platform.isClient() )
return false;
@@ -114,9 +116,9 @@ public class ToolReplicatorCard extends AEBaseItem
int scale_y = max.y - min.y;
int scale_z = max.z - min.z;
for (int i = 1; i < scale_x; i++)
for (int j = 1; j < scale_y; j++)
for (int k = 1; k < scale_z; k++)
for ( int i = 1; i < scale_x; i++ )
for ( int j = 1; j < scale_y; j++ )
for ( int k = 1; k < scale_z; k++ )
{
Block blk = src_w.getBlock( min_x + i, min_y + j, min_z + k );
int meta = src_w.getBlockMetadata( min_x + i, min_y + j, min_z + k );
@@ -133,7 +135,6 @@ public class ToolReplicatorCard extends AEBaseItem
}
world.markBlockForUpdate( i + rel_x, j + rel_y, k + rel_z );
}
}
else
this.outputMsg( player, "requires valid spatial pylon setup." );
@@ -153,9 +154,8 @@ public class ToolReplicatorCard extends AEBaseItem
return true;
}
private void outputMsg(EntityPlayer player, String string)
private void outputMsg( ICommandSender player, String string )
{
player.addChatMessage( new ChatComponentText( string ) );
}
}
@@ -30,10 +30,12 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
import appeng.client.EffectType;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.helpers.Reflected;
import appeng.util.Platform;
final public class EntityChargedQuartz extends AEBaseEntityItem
@@ -42,6 +44,7 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
int delay = 0;
int transformTime = 0;
@Reflected
public EntityChargedQuartz(World w)
{
super( w );
@@ -88,7 +91,9 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
public boolean transform()
{
ItemStack item = this.getEntityItem();
if ( AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( item ) )
final IMaterials materials = AEApi.instance().definitions().materials();
if ( materials.certusQuartzCrystalCharged().isSameAs( item ) )
{
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( this.posX - 1, this.posY - 1, this.posZ - 1, this.posX + 1, this.posY + 1, this.posZ + 1 );
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
@@ -127,12 +132,17 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
if ( netherQuartz.getEntityItem().stackSize <= 0 )
netherQuartz.setDead();
ItemStack Output = AEApi.instance().materials().materialFluixCrystal.stack( 2 );
this.worldObj.spawnEntityInWorld( new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, Output ) );
for ( ItemStack fluixCrystalStack : materials.fluixCrystal().maybeStack( 2 ).asSet() )
{
final EntityItem entity = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, fluixCrystalStack );
this.worldObj.spawnEntityInWorld( entity );
}
return true;
}
}
return false;
}
}
@@ -32,8 +32,10 @@ import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.helpers.Reflected;
import appeng.util.Platform;
@@ -42,6 +44,7 @@ final public class EntitySingularity extends AEBaseEntityItem
static private int randTickSeed = 0;
@Reflected
public EntitySingularity( World w )
{
super( w );
@@ -73,7 +76,10 @@ final public class EntitySingularity extends AEBaseEntityItem
return;
ItemStack item = this.getEntityItem();
if ( AEApi.instance().materials().materialSingularity.sameAsStack( item ) )
final IMaterials materials = AEApi.instance().definitions().materials();
if ( materials.singularity().isSameAs( item ) )
{
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4 );
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
@@ -116,13 +122,16 @@ final public class EntitySingularity extends AEBaseEntityItem
if ( other.stackSize == 0 )
e.setDead();
ItemStack Output = AEApi.instance().materials().materialQESingularity.stack( 2 );
NBTTagCompound cmp = Platform.openNbtData( Output );
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
randTickSeed++;
item.stackSize--;
for ( ItemStack singularityStack : materials.qESingularity().maybeStack( 2 ).asSet() )
{
NBTTagCompound cmp = Platform.openNbtData( singularityStack );
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
randTickSeed++;
item.stackSize--;
this.worldObj.spawnEntityInWorld( new EntitySingularity( this.worldObj, this.posX, this.posY, this.posZ, Output ) );
final EntitySingularity entity = new EntitySingularity( this.worldObj, this.posX, this.posY, this.posZ, singularityStack );
this.worldObj.spawnEntityInWorld( entity );
}
}
if ( item.stackSize <= 0 )
@@ -26,6 +26,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.Explosion;
@@ -38,11 +39,12 @@ import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.core.sync.packets.PacketMockExplosion;
import appeng.helpers.Reflected;
import appeng.util.Platform;
final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
{
@Reflected
public EntityTinyTNTPrimed(World w) {
super( w );
this.setSize( 0.35F, 0.35F );
@@ -80,15 +82,20 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
if ( this.isInWater() && Platform.isServer() ) // put out the fuse.
{
EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, AEApi.instance().blocks().blockTinyTNT.stack( 1 ) );
item.motionX = this.motionX;
item.motionY = this.motionY;
item.motionZ = this.motionZ;
item.prevPosX = this.prevPosX;
item.prevPosY = this.prevPosY;
item.prevPosZ = this.prevPosZ;
this.worldObj.spawnEntityInWorld( item );
this.setDead();
for ( ItemStack tntStack : AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).asSet() )
{
final EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, tntStack );
item.motionX = this.motionX;
item.motionY = this.motionY;
item.motionZ = this.motionZ;
item.prevPosX = this.prevPosX;
item.prevPosY = this.prevPosY;
item.prevPosZ = this.prevPosZ;
this.worldObj.spawnEntityInWorld( item );
this.setDead();
}
}
if ( this.fuse <= 0 )
@@ -99,12 +99,15 @@ public class FacadeContainer implements IFacadeContainer
}
else if ( !isBC )
{
ItemFacade ifa = (ItemFacade) AEApi.instance().items().itemFacade.item();
ItemStack facade = ifa.createFromIDs( ids );
if ( facade != null )
for ( Item facadeItem : AEApi.instance().definitions().items().facade().maybeItem().asSet() )
{
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, ifa.createPartFromItemStack( facade, side ) );
ItemFacade ifa = (ItemFacade) facadeItem;
ItemStack facade = ifa.createFromIDs( ids );
if ( facade != null )
{
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, ifa.createPartFromItemStack( facade, side ) );
}
}
}
}
+1 -1
View File
@@ -51,7 +51,7 @@ public enum PartRegistry
try
{
if ( this == CableBusPart )
return (TMultiPart) Api.INSTANCE.partHelper.getCombinedInstance( this.part.getName() ).newInstance();
return (TMultiPart) Api.INSTANCE.getPartHelper().getCombinedInstance( this.part.getName() ).newInstance();
else
return this.part.getConstructor( int.class ).newInstance( meta );
}
@@ -31,6 +31,8 @@ import codechicken.multipart.minecraft.McBlockPart;
import codechicken.multipart.minecraft.McSidedMetaPart;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinition;
public class QuartzTorchPart extends McSidedMetaPart implements IRandomDisplayTick
{
@@ -52,7 +54,12 @@ public class QuartzTorchPart extends McSidedMetaPart implements IRandomDisplayTi
@Override
public Block getBlock()
{
return AEApi.instance().blocks().blockQuartzTorch.block();
for ( Block torchBlock : AEApi.instance().definitions().blocks().quartzTorch().maybeBlock().asSet() )
{
return torchBlock;
}
throw new MissingDefinition( "Tried to retrieve a quartz torch, even though it is disabled." );
}
@Override
@@ -18,6 +18,7 @@
package appeng.helpers;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
@@ -25,8 +26,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
@@ -41,6 +40,8 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.collect.ImmutableSet;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.Settings;
@@ -79,6 +80,7 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.me.storage.MEMonitorIInventory;
import appeng.me.storage.MEMonitorPassThrough;
import appeng.me.storage.NullInventory;
import appeng.parts.automation.StackUpgradeInventory;
import appeng.parts.automation.UpgradeInventory;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.AppEngInternalInventory;
@@ -217,7 +219,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
this.gridProxy = networkProxy;
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.upgrades = new UpgradeInventory( this.gridProxy.getMachineRepresentation(), this, 1 );
this.upgrades = new StackUpgradeInventory( this.gridProxy.getMachineRepresentation(), this, 1 );
this.cm.registerSetting( Settings.BLOCK, YesNo.NO );
this.cm.registerSetting( Settings.INTERFACE_TERMINAL, YesNo.YES );
@@ -1,846 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.helpers;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.core.AEConfig;
import appeng.core.WorldSettings;
import appeng.core.features.AEFeature;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
public class MeteoritePlacer
{
private class Fallout
{
public int adjustCrater()
{
return 0;
}
public void getRandomFall(IMeteoriteWorld w, int x, int y, int z)
{
double a = Math.random();
if ( a > 0.9 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.stone );
else if ( a > 0.8 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.cobblestone );
else if ( a > 0.7 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.dirt );
else if ( a > 0.7 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.gravel );
}
public void getRandomInset(IMeteoriteWorld w, int x, int y, int z)
{
double a = Math.random();
if ( a > 0.9 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.cobblestone );
else if ( a > 0.8 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.stone );
else if ( a > 0.7 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.grass );
else if ( a > 0.6 )
MeteoritePlacer.this.put( w, x, y, z, MeteoritePlacer.this.skystone );
else if ( a > 0.5 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.gravel );
else if ( a > 0.5 )
MeteoritePlacer.this.put( w, x, y, z, Platform.AIR );
}
}
private class FalloutCopy extends Fallout
{
final Block blk;
final int meta;
public FalloutCopy(IMeteoriteWorld w, int x, int y, int z) {
this.blk = w.getBlock( x, y, z );
this.meta = w.getBlockMetadata( x, y, z );
}
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
{
}
@Override
public void getRandomFall(IMeteoriteWorld w, int x, int y, int z)
{
double a = Math.random();
if ( a > 0.9 )
MeteoritePlacer.this.put( w, x, y, z, this.blk, this.meta );
else
this.getOther( w, x, y, z, a );
}
@Override
public void getRandomInset(IMeteoriteWorld w, int x, int y, int z)
{
double a = Math.random();
if ( a > 0.9 )
MeteoritePlacer.this.put( w, x, y, z, this.blk, this.meta );
else if ( a > 0.8 )
MeteoritePlacer.this.put( w, x, y, z, Platform.AIR );
else
this.getOther( w, x, y, z, a - 0.1 );
}
}
private class FalloutSand extends FalloutCopy
{
public FalloutSand(IMeteoriteWorld w, int x, int y, int z) {
super( w, x, y, z );
}
@Override
public int adjustCrater()
{
return 2;
}
@Override
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
{
if ( a > 0.66 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.glass );
}
}
private class FalloutSnow extends FalloutCopy
{
public FalloutSnow(IMeteoriteWorld w, int x, int y, int z) {
super( w, x, y, z );
}
@Override
public int adjustCrater()
{
return 2;
}
@Override
public void getOther(IMeteoriteWorld w, int x, int y, int z, double a)
{
if ( a > 0.7 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.snow );
else if ( a > 0.5 )
MeteoritePlacer.this.put( w, x, y, z, Blocks.ice );
}
}
public interface IMeteoriteWorld
{
int minX(int in);
int minZ(int in);
int maxX(int in);
int maxZ(int in);
boolean hasNoSky();
int getBlockMetadata(int x, int y, int z);
Block getBlock(int x, int y, int z);
boolean canBlockSeeTheSky(int i, int j, int k);
TileEntity getTileEntity(int x, int y, int z);
World getWorld();
void setBlock(int i, int j, int k, Block blk);
void setBlock(int i, int j, int k, Block blk_b, int meta_b, int l);
void done();
}
static public class StandardWorld implements IMeteoriteWorld
{
protected final World w;
public StandardWorld(World w) {
this.w = w;
}
@Override
public boolean hasNoSky()
{
return !this.w.provider.hasNoSky;
}
@Override
public int getBlockMetadata(int x, int y, int z)
{
if ( this.range( x, y, z ) )
return this.w.getBlockMetadata( x, y, z );
return 0;
}
@Override
public Block getBlock(int x, int y, int z)
{
if ( this.range( x, y, z ) )
return this.w.getBlock( x, y, z );
return Platform.AIR;
}
@Override
public boolean canBlockSeeTheSky(int x, int y, int z)
{
if ( this.range( x, y, z ) )
return this.w.canBlockSeeTheSky( x, y, z );
return false;
}
@Override
public TileEntity getTileEntity(int x, int y, int z)
{
if ( this.range( x, y, z ) )
return this.w.getTileEntity( x, y, z );
return null;
}
@Override
public World getWorld()
{
return this.w;
}
@Override
public void setBlock(int x, int y, int z, Block blk)
{
if ( this.range( x, y, z ) )
this.w.setBlock( x, y, z, blk );
}
@Override
public void setBlock(int x, int y, int z, Block blk, int metadata, int flags)
{
if ( this.range( x, y, z ) )
this.w.setBlock( x, y, z, blk, metadata, flags );
}
public boolean range(int x, int y, int z)
{
return true;
}
@Override
public int minX(int in)
{
return in;
}
@Override
public int minZ(int in)
{
return in;
}
@Override
public int maxX(int in)
{
return in;
}
@Override
public int maxZ(int in)
{
return in;
}
@Override
public void done()
{
}
}
static public class ChunkOnly extends StandardWorld
{
final Chunk target;
int verticalBits = 0;
final int cx;
final int cz;
public ChunkOnly(World w, int cx, int cz) {
super( w );
this.target = w.getChunkFromChunkCoords( cx, cz );
this.cx = cx;
this.cz = cz;
}
@Override
public void done()
{
if ( this.verticalBits != 0 )
Platform.sendChunk( this.target, this.verticalBits );
}
@Override
public void setBlock(int x, int y, int z, Block blk)
{
if ( this.range( x, y, z ) )
{
this.verticalBits |= 1 << (y >> 4);
this.w.setBlock( x, y, z, blk, 0, 1 );
}
}
@Override
public void setBlock(int x, int y, int z, Block blk, int metadata, int flags)
{
if ( this.range( x, y, z ) )
{
this.verticalBits |= 1 << (y >> 4);
this.w.setBlock( x, y, z, blk, metadata, flags & (~2) );
}
}
@Override
public Block getBlock(int x, int y, int z)
{
if ( this.range( x, y, z ) )
return this.target.getBlock( x & 0xF, y, z & 0xF );
return Platform.AIR;
}
@Override
public int getBlockMetadata(int x, int y, int z)
{
if ( this.range( x, y, z ) )
return this.target.getBlockMetadata( x & 0xF, y, z & 0xF );
return 0;
}
@Override
public boolean range(int x, int y, int z)
{
return this.cx == (x >> 4) && this.cz == (z >> 4);
}
@Override
public int minX(int in)
{
return Math.max( in, this.cx << 4 );
}
@Override
public int minZ(int in)
{
return Math.max( in, this.cz << 4 );
}
@Override
public int maxX(int in)
{
return Math.min( in, (this.cx + 1) << 4 );
}
@Override
public int maxZ(int in)
{
return Math.min( in, (this.cz + 1) << 4 );
}
}
final int minBLocks = 200;
final HashSet<Block> validSpawn = new HashSet<Block>();
final HashSet<Block> invalidSpawn = new HashSet<Block>();
Fallout type = new Fallout();
final Block skystone = AEApi.instance().blocks().blockSkyStone.block();
final Block skychest;
double real_sizeOfMeteorite = (Math.random() * 6.0) + 2;
double realCrater = this.real_sizeOfMeteorite * 2 + 5;
double sizeOfMeteorite = this.real_sizeOfMeteorite * this.real_sizeOfMeteorite;
double crater = this.realCrater * this.realCrater;
public MeteoritePlacer() {
if ( AEApi.instance().blocks().blockSkyChest.block() == null )
this.skychest = Blocks.chest;
else
this.skychest = AEApi.instance().blocks().blockSkyChest.block();
this.validSpawn.add( Blocks.stone );
this.validSpawn.add( Blocks.cobblestone );
this.validSpawn.add( Blocks.grass );
this.validSpawn.add( Blocks.sand );
this.validSpawn.add( Blocks.dirt );
this.validSpawn.add( Blocks.gravel );
this.validSpawn.add( Blocks.netherrack );
this.validSpawn.add( Blocks.iron_ore );
this.validSpawn.add( Blocks.gold_ore );
this.validSpawn.add( Blocks.diamond_ore );
this.validSpawn.add( Blocks.redstone_ore );
this.validSpawn.add( Blocks.hardened_clay );
this.validSpawn.add( Blocks.ice );
this.validSpawn.add( Blocks.snow );
this.invalidSpawn.add( this.skystone );
this.invalidSpawn.add( Blocks.planks );
this.invalidSpawn.add( Blocks.iron_door );
this.invalidSpawn.add( Blocks.iron_bars );
this.invalidSpawn.add( Blocks.wooden_door );
this.invalidSpawn.add( Blocks.brick_block );
this.invalidSpawn.add( Blocks.clay );
this.invalidSpawn.add( Blocks.water );
this.invalidSpawn.add( Blocks.log );
this.invalidSpawn.add( Blocks.log2 );
}
NBTTagCompound settings;
public boolean spawnMeteorite(IMeteoriteWorld w, NBTTagCompound meteoriteBlob)
{
this.settings = meteoriteBlob;
int x = this.settings.getInteger( "x" );
int y = this.settings.getInteger( "y" );
int z = this.settings.getInteger( "z" );
this.real_sizeOfMeteorite = this.settings.getDouble( "real_sizeOfMeteorite" );
this.realCrater = this.settings.getDouble( "realCrater" );
this.sizeOfMeteorite = this.settings.getDouble( "sizeOfMeteorite" );
this.crater = this.settings.getDouble( "crater" );
Block blk = Block.getBlockById( this.settings.getInteger( "blk" ) );
if ( blk == Blocks.sand )
this.type = new FalloutSand( w, x, y, z );
else if ( blk == Blocks.hardened_clay )
this.type = new FalloutCopy( w, x, y, z );
else if ( blk == Blocks.ice || blk == Blocks.snow )
this.type = new FalloutSnow( w, x, y, z );
int skyMode = this.settings.getInteger( "skyMode" );
// creator
if ( skyMode > 10 )
this.placeCrater( w, x, y, z );
this.placeMeteorite( w, x, y, z );
// collapse blocks...
if ( skyMode > 3 )
this.Decay( w, x, y, z );
w.done();
return true;
}
public double getSqDistance(int x, int z)
{
int Cx = this.settings.getInteger( "x" ) - x;
int Cz = this.settings.getInteger( "z" ) - z;
return Cx * Cx + Cz * Cz;
}
public boolean spawnMeteorite(IMeteoriteWorld w, int x, int y, int z)
{
int validBlocks = 0;
if ( !w.hasNoSky() )
return false;
Block blk = w.getBlock( x, y, z );
if ( !this.validSpawn.contains( blk ) )
return false; // must spawn on a valid block..
this.settings = new NBTTagCompound();
this.settings.setInteger( "x", x );
this.settings.setInteger( "y", y );
this.settings.setInteger( "z", z );
this.settings.setInteger( "blk", Block.getIdFromBlock( blk ) );
this.settings.setDouble( "real_sizeOfMeteorite", this.real_sizeOfMeteorite );
this.settings.setDouble( "realCrater", this.realCrater );
this.settings.setDouble( "sizeOfMeteorite", this.sizeOfMeteorite );
this.settings.setDouble( "crater", this.crater );
this.settings.setBoolean( "lava", Math.random() > 0.9 );
if ( blk == Blocks.sand )
this.type = new FalloutSand( w, x, y, z );
else if ( blk == Blocks.hardened_clay )
this.type = new FalloutCopy( w, x, y, z );
else if ( blk == Blocks.ice || blk == Blocks.snow )
this.type = new FalloutSnow( w, x, y, z );
int realValidBlocks = 0;
for (int i = x - 6; i < x + 6; i++)
for (int j = y - 6; j < y + 6; j++)
for (int k = z - 6; k < z + 6; k++)
{
blk = w.getBlock( i, j, k );
if ( this.validSpawn.contains( blk ) )
realValidBlocks++;
}
for (int i = x - 15; i < x + 15; i++)
for (int j = y - 15; j < y + 15; j++)
for (int k = z - 15; k < z + 15; k++)
{
blk = w.getBlock( i, j, k );
if ( this.invalidSpawn.contains( blk ) )
return false;
if ( this.validSpawn.contains( blk ) )
validBlocks++;
}
if ( validBlocks > this.minBLocks && realValidBlocks > 80 )
{
// we can spawn here!
int skyMode = 0;
for (int i = x - 15; i < x + 15; i++)
for (int j = y - 15; j < y + 11; j++)
for (int k = z - 15; k < z + 15; k++)
{
if ( w.canBlockSeeTheSky( i, j, k ) )
skyMode++;
}
boolean solid = true;
for (int j = y - 15; j < y - 1; j++)
{
if ( w.getBlock( x, j, z ) == Platform.AIR )
solid = false;
}
if ( !solid )
skyMode = 0;
// creator
if ( skyMode > 10 )
this.placeCrater( w, x, y, z );
this.placeMeteorite( w, x, y, z );
// collapse blocks...
if ( skyMode > 3 )
this.Decay( w, x, y, z );
this.settings.setInteger( "skyMode", skyMode );
w.done();
WorldSettings.getInstance().addNearByMeteorites( w.getWorld().provider.dimensionId, x >> 4, z >> 4, this.settings );
return true;
}
return false;
}
private void placeCrater(IMeteoriteWorld w, int x, int y, int z)
{
boolean lava = this.settings.getBoolean( "lava" );
int maxY = 255;
int minX = w.minX( x - 200 );
int maxX = w.maxX( x + 200 );
int minZ = w.minZ( z - 200 );
int maxZ = w.maxZ( z + 200 );
for (int j = y - 5; j < maxY; j++)
{
boolean changed = false;
for (int i = minX; i < maxX; i++)
for (int k = minZ; k < maxZ; k++)
{
double dx = i - x;
double dz = k - z;
double h = y - this.real_sizeOfMeteorite + 1 + this.type.adjustCrater();
double distanceFrom = dx * dx + dz * dz;
if ( j > h + distanceFrom * 0.02 )
{
if ( lava && j < y && w.getBlock( x, y - 1, z ).isBlockSolid( w.getWorld(), i, j, k, 0 ) )
{
if ( j > h + distanceFrom * 0.02 )
this.put( w, i, j, k, Blocks.lava );
}
else
changed = this.put( w, i, j, k, Platform.AIR ) || changed;
}
}
}
for (Object o : w.getWorld().getEntitiesWithinAABB( EntityItem.class,
AxisAlignedBB.getBoundingBox( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ))
{
Entity e = (Entity) o;
e.setDead();
}
}
private void placeMeteorite(IMeteoriteWorld w, int x, int y, int z)
{
int meteorXLength = w.minX( x - 8 );
int meteorXHeight = w.maxX( x + 8 );
int meteorZLength = w.minZ( z - 8 );
int meteorZHeight = w.maxZ( z + 8 );
// spawn meteor
for (int i = meteorXLength; i < meteorXHeight; i++)
for (int j = y - 8; j < y + 8; j++)
for (int k = meteorZLength; k < meteorZHeight; k++)
{
double dx = i - x;
double dy = j - y;
double dz = k - z;
if ( dx * dx * 0.7 + dy * dy * (j > y ? 1.4 : 0.8) + dz * dz * 0.7 < this.sizeOfMeteorite )
this.put( w, i, j, k, this.skystone );
}
if ( AEConfig.instance.isFeatureEnabled( AEFeature.SpawnPressesInMeteorites ) )
{
this.put( w, x, y, z, this.skychest );
TileEntity te = w.getTileEntity( x, y, z );
if ( te instanceof IInventory )
{
InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, ForgeDirection.UP );
int primary = Math.max( 1, (int) (Math.random() * 4) );
if ( primary > 3 ) // in case math breaks...
primary = 3;
for (int zz = 0; zz < primary; zz++)
{
int r = 0;
boolean duplicate = false;
do
{
duplicate = false;
if ( Math.random() > 0.7 )
r = WorldSettings.getInstance().getNextOrderedValue( "presses" );
else
r = (int) (Math.random() * 1000);
ItemStack toAdd = null;
switch (r % 4)
{
case 0:
toAdd = AEApi.instance().materials().materialCalcProcessorPress.stack( 1 );
break;
case 1:
toAdd = AEApi.instance().materials().materialEngProcessorPress.stack( 1 );
break;
case 2:
toAdd = AEApi.instance().materials().materialLogicProcessorPress.stack( 1 );
break;
case 3:
toAdd = AEApi.instance().materials().materialSiliconPress.stack( 1 );
break;
default:
}
if ( toAdd != null )
{
if ( ap.simulateRemove( 1, toAdd, null ) == null )
ap.addItems( toAdd );
else
duplicate = true;
}
}
while (duplicate);
}
int secondary = Math.max( 1, (int) (Math.random() * 3) );
for (int zz = 0; zz < secondary; zz++)
{
switch ((int) (Math.random() * 1000) % 3)
{
case 0:
ap.addItems( AEApi.instance().blocks().blockSkyStone.stack( (int) (Math.random() * 12) + 1 ) );
break;
case 1:
List<ItemStack> possibles = new LinkedList<ItemStack>();
possibles.addAll( OreDictionary.getOres( "nuggetIron" ) );
possibles.addAll( OreDictionary.getOres( "nuggetCopper" ) );
possibles.addAll( OreDictionary.getOres( "nuggetTin" ) );
possibles.addAll( OreDictionary.getOres( "nuggetSilver" ) );
possibles.addAll( OreDictionary.getOres( "nuggetLead" ) );
possibles.addAll( OreDictionary.getOres( "nuggetPlatinum" ) );
possibles.addAll( OreDictionary.getOres( "nuggetNickel" ) );
possibles.addAll( OreDictionary.getOres( "nuggetAluminium" ) );
possibles.addAll( OreDictionary.getOres( "nuggetElectrum" ) );
possibles.add( new ItemStack( net.minecraft.init.Items.gold_nugget ) );
ItemStack nugget = Platform.pickRandom( possibles );
if ( nugget != null )
{
nugget = nugget.copy();
nugget.stackSize = (int) (Math.random() * 12) + 1;
ap.addItems( nugget );
}
break;
}
}
}
}
}
private void Decay(IMeteoriteWorld w, int x, int y, int z)
{
double randomShit = 0;
int meteorXLength = w.minX( x - 30 );
int meteorXHeight = w.maxX( x + 30 );
int meteorZLength = w.minZ( z - 30 );
int meteorZHeight = w.maxZ( z + 30 );
for (int i = meteorXLength; i < meteorXHeight; i++)
for (int k = meteorZLength; k < meteorZHeight; k++)
for (int j = y - 9; j < y + 30; j++)
{
Block blk = w.getBlock( i, j, k );
if ( blk == Blocks.lava )
continue;
if ( blk.isReplaceable( w.getWorld(), i, j, k ) )
{
blk = Platform.AIR;
Block blk_b = w.getBlock( i, j + 1, k );
if ( blk_b != blk )
{
int meta_b = w.getBlockMetadata( i, j + 1, k );
w.setBlock( i, j, k, blk_b, meta_b, 3 );
w.setBlock( i, j + 1, k, blk );
}
else if ( randomShit < 100 * this.crater )
{
double dx = i - x;
double dy = j - y;
double dz = k - z;
double dist = dx * dx + dy * dy + dz * dz;
Block xf = w.getBlock( i, j - 1, k );
if ( !xf.isReplaceable( w.getWorld(), i, j - 1, k ) )
{
double extraRange = Math.random() * 0.6;
double height = this.crater * (extraRange + 0.2) - Math.abs( dist - this.crater * 1.7 );
if ( xf != blk && height > 0 && Math.random() > 0.6 )
{
randomShit++;
this.type.getRandomFall( w, i, j, k );
}
}
}
}
else
{
// decay.
Block blk_b = w.getBlock( i, j + 1, k );
if ( blk_b == Platform.AIR )
{
if ( Math.random() > 0.4 )
{
double dx = i - x;
double dy = j - y;
double dz = k - z;
if ( dx * dx + dy * dy + dz * dz < this.crater * 1.6 )
{
this.type.getRandomInset( w, i, j, k );
}
}
}
}
}
}
private boolean put(IMeteoriteWorld w, int i, int j, int k, Block blk)
{
Block original = w.getBlock( i, j, k );
if ( original == Blocks.bedrock || original == blk )
return false;
w.setBlock( i, j, k, blk );
return true;
}
private void put(IMeteoriteWorld w, int i, int j, int k, Block blk, int meta)
{
if ( w.getBlock( i, j, k ) == Blocks.bedrock )
return;
w.setBlock( i, j, k, blk, meta, 3 );
}
public NBTTagCompound getSettings()
{
return this.settings;
}
}
@@ -0,0 +1,18 @@
package appeng.helpers;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker interface to help identify invocation of reflection
*/
@Retention( RetentionPolicy.SOURCE )
@Target( { ElementType.CONSTRUCTOR, ElementType.FIELD } )
public @interface Reflected
{
}
+52 -40
View File
@@ -28,7 +28,12 @@ import net.minecraft.village.MerchantRecipeList;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IMaterials;
public class AETrading implements IVillageTradeHandler
{
@@ -48,60 +53,67 @@ public class AETrading implements IVillageTradeHandler
l.add( new MerchantRecipe( a, b ) );
}
private void addTrade(MerchantRecipeList list, ItemStack a, ItemStack b, Random rand, int conversion_Variance)
private void addTrade(MerchantRecipeList list, IItemDefinition inputDefinition, IItemDefinition outputDefinition, Random rand, int conversionVariance)
{
// Sell
ItemStack From = a.copy();
ItemStack To = b.copy();
final Optional<ItemStack> maybeInputStack = inputDefinition.maybeStack( 1 );
final Optional<ItemStack> maybeOutputStack = outputDefinition.maybeStack( 1 );
From.stackSize = 1 + (Math.abs( rand.nextInt() ) % (1 + conversion_Variance));
To.stackSize = 1;
if ( maybeInputStack.isPresent() && maybeOutputStack.isPresent() )
{
// Sell
ItemStack inputStack = maybeInputStack.get().copy();
ItemStack outputStack = maybeOutputStack.get().copy();
this.addToList( list, From, To );
inputStack.stackSize = 1 + (Math.abs( rand.nextInt() ) % (1 + conversionVariance));
outputStack.stackSize = 1;
this.addToList( list, inputStack, outputStack );
}
}
private void addMerchant(MerchantRecipeList list, ItemStack item, int emera, Random rand, int greed)
private void addMerchant(MerchantRecipeList list, IItemDefinition item, int emera, Random rand, int greed)
{
if ( item == null )
return;
// Sell
ItemStack From = item.copy();
ItemStack To = new ItemStack( Items.emerald );
int multiplier = (Math.abs( rand.nextInt() ) % 6);
emera += (Math.abs( rand.nextInt() ) % greed) - multiplier;
int mood = rand.nextInt() % 2;
From.stackSize = multiplier + mood;
To.stackSize = multiplier * emera - mood;
if ( To.stackSize < 0 )
for ( ItemStack itemStack : item.maybeStack( 1 ).asSet() )
{
From.stackSize -= To.stackSize;
To.stackSize -= To.stackSize;
// Sell
ItemStack from = itemStack.copy();
ItemStack to = new ItemStack( Items.emerald );
int multiplier = (Math.abs( rand.nextInt() ) % 6);
final int emeraldCost = emera + (Math.abs( rand.nextInt() ) % greed) - multiplier;
int mood = rand.nextInt() % 2;
from.stackSize = multiplier + mood;
to.stackSize = multiplier * emeraldCost - mood;
if ( to.stackSize < 0 )
{
from.stackSize -= to.stackSize;
to.stackSize -= to.stackSize;
}
this.addToList( list, from, to );
// Buy
ItemStack reverseTo = from.copy();
ItemStack reverseFrom = to.copy();
reverseFrom.stackSize *= rand.nextFloat() * 3.0f + 1.0f;
this.addToList( list, reverseFrom, reverseTo );
}
this.addToList( list, From, To );
// Buy
ItemStack reverseTo = From.copy();
ItemStack reverseFrom = To.copy();
reverseFrom.stackSize *= rand.nextFloat() * 3.0f + 1.0f;
this.addToList( list, reverseFrom, reverseTo );
}
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
this.addMerchant( recipeList, AEApi.instance().materials().materialSilicon.stack( 1 ), 1, random, 2 );
this.addMerchant( recipeList, AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), 2, random, 4 );
this.addMerchant( recipeList, AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ), 1, random, 3 );
final IMaterials materials = AEApi.instance().definitions().materials();
this.addTrade( recipeList, AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ),
AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), random, 2 );
this.addMerchant( recipeList, materials.silicon(), 1, random, 2 );
this.addMerchant( recipeList, materials.certusQuartzCrystal(), 2, random, 4 );
this.addMerchant( recipeList, materials.certusQuartzDust(), 1, random, 3 );
this.addTrade( recipeList, materials.certusQuartzDust(), materials.certusQuartzCrystal(), random, 2 );
}
}
+138 -121
View File
@@ -19,7 +19,7 @@
package appeng.integration.modules;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -44,8 +44,10 @@ import buildcraft.transport.ItemFacade;
import buildcraft.transport.PipeIconProvider;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.TunnelType;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IFacadePart;
import appeng.api.util.AEItemDefinition;
@@ -58,56 +60,58 @@ import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
import appeng.integration.modules.BCHelpers.BCPipeHandler;
public final class BC extends BaseModule implements IBC
{
public static BC instance;
public BC() {
public BC()
{
this.testClassExistence( IPipeConnection.class );
this.testClassExistence( ItemFacade.class );
this.testClassExistence( IToolWrench.class );
}
@Override
public void addFacade(ItemStack item)
{
if ( item != null )
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
}
@Override
public boolean isWrench(Item eq)
public boolean isWrench( Item eq )
{
return eq instanceof IToolWrench;
}
@Override
public boolean isPipe(TileEntity te, ForgeDirection dir)
public boolean canWrench( Item i, EntityPlayer p, int x, int y, int z )
{
if ( te instanceof IPipeTile )
return ( (IToolWrench) i ).canWrench( p, x, y, z );
}
@Override
public void wrenchUsed( Item i, EntityPlayer p, int x, int y, int z )
{
( (IToolWrench) i ).wrenchUsed( p, x, y, z );
}
@Override
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
{
if ( is != null && te != null && te instanceof IInjectable )
{
final IPipeTile pipeTile = (IPipeTile) te;
return !pipeTile.hasPipePluggable( dir.getOpposite() );
IInjectable pt = (IInjectable) te;
if ( pt.canInjectItems( dir ) )
{
int amt = pt.injectItem( is, false, dir, null );
if ( amt == is.stackSize )
{
return true;
}
}
}
return false;
}
@Override
public boolean canWrench(Item i, EntityPlayer p, int x, int y, int z)
{
return ((IToolWrench) i).canWrench( p, x, y, z );
}
@Override
public void wrenchUsed(Item i, EntityPlayer p, int x, int y, int z)
{
((IToolWrench) i).wrenchUsed( p, x, y, z );
}
@Override
public boolean addItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
public boolean addItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
{
if ( is != null && te != null && te instanceof IInjectable )
{
@@ -127,7 +131,7 @@ public final class BC extends BaseModule implements IBC
}
@Override
public boolean isFacade(ItemStack is)
public boolean isFacade( ItemStack is )
{
if ( is == null )
return false;
@@ -136,24 +140,24 @@ public final class BC extends BaseModule implements IBC
}
@Override
public boolean canAddItemsToPipe(TileEntity te, ItemStack is, ForgeDirection dir)
public boolean isPipe( TileEntity te, ForgeDirection dir )
{
if ( is != null && te != null && te instanceof IInjectable )
if ( te instanceof IPipeTile )
{
IInjectable pt = (IInjectable) te;
if ( pt.canInjectItems( dir ) )
{
int amt = pt.injectItem( is, false, dir, null );
if ( amt == is.stackSize )
{
return true;
}
}
final IPipeTile pipeTile = (IPipeTile) te;
return !pipeTile.hasPipePluggable( dir.getOpposite() );
}
return false;
}
@Override
public void addFacade( ItemStack item )
{
if ( item != null )
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
}
@Override
public void registerPowerP2P()
{
@@ -201,82 +205,7 @@ public final class BC extends BaseModule implements IBC
}
@Override
public void init()
{
AEApi.instance().partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
Blocks b = AEApi.instance().blocks();
this.addFacade( b.blockFluix.stack( 1 ) );
this.addFacade( b.blockQuartz.stack( 1 ) );
this.addFacade( b.blockQuartzChiseled.stack( 1 ) );
this.addFacade( b.blockQuartzPillar.stack( 1 ) );
try
{
this.initBuilderSupport();
}
catch (Throwable builderSupport)
{
// not supported?
}
Block skyStone = b.blockSkyStone.block();
if ( skyStone != null )
{
this.addFacade( new ItemStack( skyStone, 1, 0 ) );
this.addFacade( new ItemStack( skyStone, 1, 1 ) );
this.addFacade( new ItemStack( skyStone, 1, 2 ) );
this.addFacade( new ItemStack( skyStone, 1, 3 ) );
}
}
private void initBuilderSupport()
{
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
Blocks blocks = AEApi.instance().blocks();
Block cable = blocks.blockMultiPart.block();
for (Field f : blocks.getClass().getFields())
{
AEItemDefinition def;
try
{
def = (AEItemDefinition) f.get( blocks );
if ( def != null )
{
Block myBlock = def.block();
if ( myBlock instanceof IOrientableBlock && ((IOrientableBlock) myBlock).usesMetadata() && def.entity() == null )
{
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
}
else if ( myBlock == cable )
{
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
}
else if ( def.entity() != null )
{
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
}
}
}
catch (Throwable t)
{
// :P
}
}
}
@Override
public void postInit()
{
this.registerPowerP2P();
this.registerItemP2P();
this.registerLiquidsP2P();
}
@Override
public IFacadePart createFacadePart(Block blk, int meta, ForgeDirection side)
public IFacadePart createFacadePart( Block blk, int meta, ForgeDirection side )
{
try
{
@@ -285,7 +214,7 @@ public final class BC extends BaseModule implements IBC
return new FacadePart( facade, side );
}
catch (Throwable ignored)
catch ( Throwable ignored )
{
}
@@ -294,17 +223,17 @@ public final class BC extends BaseModule implements IBC
}
@Override
public IFacadePart createFacadePart(ItemStack fs, ForgeDirection side)
public IFacadePart createFacadePart( ItemStack fs, ForgeDirection side )
{
return new FacadePart( fs, side );
}
@Override
public ItemStack getTextureForFacade(ItemStack facade)
public ItemStack getTextureForFacade( ItemStack facade )
{
final Item maybeFacadeItem = facade.getItem();
if ( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem)
if ( maybeFacadeItem instanceof buildcraft.api.facades.IFacadeItem )
{
final buildcraft.api.facades.IFacadeItem facadeItem = (buildcraft.api.facades.IFacadeItem) maybeFacadeItem;
@@ -327,11 +256,99 @@ public final class BC extends BaseModule implements IBC
{
return BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
}
catch (Throwable ignored)
catch ( Throwable ignored )
{
}
return null;
// Pipe
}
private void addFacadeStack( IBlockDefinition definition )
{
for ( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
{
this.addFacade( facadeStack );
}
}
@Override
public void init()
{
final IAppEngApi api = AEApi.instance();
api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
final IBlocks blocks = api.definitions().blocks();
this.addFacadeStack( blocks.fluix() );
this.addFacadeStack( blocks.quartz() );
this.addFacadeStack( blocks.quartzChiseled() );
this.addFacadeStack( blocks.quartzPillar() );
try
{
this.initBuilderSupport();
}
catch ( Throwable builderSupport )
{
// not supported?
}
for ( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
{
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) );
this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) );
}
}
private void initBuilderSupport()
{
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
final IBlocks blocks = AEApi.instance().definitions().blocks();
final IBlockDefinition maybeMultiPart = blocks.multiPart();
for ( Method blockDefinition : blocks.getClass().getMethods() )
{
AEItemDefinition def;
try
{
def = (AEItemDefinition) blockDefinition.invoke( blocks );
Block myBlock = def.block();
if ( myBlock instanceof IOrientableBlock && ( (IOrientableBlock) myBlock ).usesMetadata() && def.entity() == null )
{
schematicRegistry.registerSchematicBlock( myBlock, AERotatableBlockSchematic.class );
}
else if ( maybeMultiPart.isSameAs( new ItemStack( myBlock ) ) )
{
schematicRegistry.registerSchematicBlock( myBlock, AECableSchematicTile.class );
}
else if ( def.entity() != null )
{
schematicRegistry.registerSchematicBlock( myBlock, AEGenericSchematicTile.class );
}
}
catch ( Throwable t )
{
// :P
}
}
}
@Override
public void postInit()
{
this.registerPowerP2P();
this.registerItemP2P();
this.registerLiquidsP2P();
}
private void registerOrientableBlocks()
{
}
}
@@ -18,7 +18,8 @@
package appeng.integration.modules;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -36,9 +37,11 @@ import codechicken.multipart.MultiPartRegistry.IPartFactory;
import codechicken.multipart.MultipartGenerator;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;
import com.google.common.collect.Lists;
import appeng.api.AEApi;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.parts.IPartHost;
import appeng.core.AELog;
import appeng.fmp.CableBusPart;
@@ -86,13 +89,15 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
@Override
public void init() throws Throwable
{
this.createAndRegister( AEApi.instance().blocks().blockQuartz.block(), 0 );
this.createAndRegister( AEApi.instance().blocks().blockQuartzPillar.block(), 0 );
this.createAndRegister( AEApi.instance().blocks().blockQuartzChiseled.block(), 0 );
this.createAndRegister( AEApi.instance().blocks().blockSkyStone.block(), 0 );
this.createAndRegister( AEApi.instance().blocks().blockSkyStone.block(), 1 );
this.createAndRegister( AEApi.instance().blocks().blockSkyStone.block(), 2 );
this.createAndRegister( AEApi.instance().blocks().blockSkyStone.block(), 3 );
final IBlocks blocks = AEApi.instance().definitions().blocks();
this.createAndRegister( blocks.quartz(), 0 );
this.createAndRegister( blocks.quartzPillar(), 0 );
this.createAndRegister( blocks.quartzChiseled(), 0 );
this.createAndRegister( blocks.skyStone(), 0 );
this.createAndRegister( blocks.skyStone(), 1 );
this.createAndRegister( blocks.skyStone(), 2 );
this.createAndRegister( blocks.skyStone(), 3 );
PartRegistry[] reg = PartRegistry.values();
@@ -106,10 +111,12 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
MultipartGenerator.registerPassThroughInterface( "appeng.helpers.AEMultiTile" );
}
private void createAndRegister(Block block, int i)
private void createAndRegister(IBlockDefinition definition, int i)
{
if ( block != null )
for ( Block block : definition.maybeBlock().asSet() )
{
BlockMicroMaterial.createAndRegister( block, i );
}
}
@Override
@@ -186,8 +193,20 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
@Override
public Iterable<Block> blockTypes()
{
Blocks def = AEApi.instance().blocks();
return Arrays.asList( def.blockMultiPart.block(), def.blockQuartzTorch.block() );
final IBlocks blocks = AEApi.instance().definitions().blocks();
final List<Block> blockTypes = Lists.newArrayListWithCapacity( 2 );
this.addBlockTypes( blockTypes, blocks.multiPart() );
this.addBlockTypes( blockTypes, blocks.quartzTorch() );
return blockTypes;
}
private void addBlockTypes( Collection<Block> blockTypes, IBlockDefinition definition )
{
for ( Block block : definition.maybeBlock().asSet() )
{
blockTypes.add( block );
}
}
}
@@ -27,21 +27,24 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.google.common.base.Optional;
import mods.immibis.core.api.multipart.ICoverSystem;
import mods.immibis.core.api.multipart.IMultipartTile;
import mods.immibis.core.api.multipart.IPartContainer;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartItem;
import appeng.core.AELog;
import appeng.helpers.Reflected;
import appeng.integration.BaseModule;
import appeng.integration.abstraction.IImmibisMicroblocks;
public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblocks
{
@Reflected
public static ImmibisMicroblocks INSTANCE;
private boolean canConvertTiles = false;
@@ -102,19 +105,28 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
if ( te instanceof IMultipartTile && this.canConvertTiles && isPartItem )
{
final Block blk = AEApi.instance().blocks().blockMultiPart.block();
final ItemStack what = AEApi.instance().blocks().blockMultiPart.stack( 1 );
final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
try
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent();
if ( multiPartPresent )
{
// ItemStack.class, EntityPlayer.class, World.class,
// int.class, int.class, int.class, int.class, Block.class, int.class );
this.mergeIntoMicroblockContainer.invoke( null, what, player, w, x, y, z, side, blk, 0 );
}
catch ( Throwable e )
{
this.canConvertTiles = false;
return null;
final Block multiPartBlock = maybeMultiPartBlock.get();
final ItemStack multiPartStack = maybeMultiPartStack.get();
try
{
// ItemStack.class, EntityPlayer.class, World.class,
// int.class, int.class, int.class, int.class, Block.class, int.class );
this.mergeIntoMicroblockContainer.invoke( null, multiPartStack, player, w, x, y, z, side, multiPartBlock, 0 );
}
catch ( Throwable e )
{
this.canConvertTiles = false;
return null;
}
}
}
@@ -18,7 +18,8 @@
package appeng.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
@@ -36,14 +37,25 @@ import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItemDefinition;
import appeng.core.localization.GuiText;
import appeng.facade.IFacadeItem;
import appeng.items.parts.ItemFacade;
public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
{
final ItemFacade facade;
final IItemDefinition anchorDefinition;
final ItemFacade ifa = (ItemFacade) AEApi.instance().items().itemFacade.item();
final ItemStack cable_anchor = AEApi.instance().parts().partCableAnchor.stack( 1 );
public NEIFacadeRecipeHandler()
{
final IDefinitions definitions = AEApi.instance().definitions();
this.facade = (ItemFacade) definitions.items().facade();
this.anchorDefinition = definitions.parts().cableAnchor();
}
@Override
public void loadTransferRects()
@@ -52,29 +64,19 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
}
@Override
public Class<? extends GuiContainer> getGuiClass()
public void loadCraftingRecipes( String outputId, Object... results )
{
return GuiCrafting.class;
}
@Override
public String getRecipeName()
{
return GuiText.FacadeCrafting.getLocal();
}
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if ( (outputId.equals( "crafting" )) && (this.getClass() == NEIFacadeRecipeHandler.class) )
if ( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) )
{
ItemFacade ifa = (ItemFacade) AEApi.instance().items().itemFacade.item();
List<ItemStack> facades = ifa.getFacades();
for (ItemStack is : facades)
final List<ItemStack> facades = this.facade.getFacades();
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( is );
recipe.computeVisuals();
this.arecipes.add( recipe );
for ( ItemStack is : facades )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
recipe.computeVisuals();
this.arecipes.add( recipe );
}
}
}
else
@@ -84,31 +86,37 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
}
@Override
public void loadCraftingRecipes(ItemStack result)
public void loadCraftingRecipes( ItemStack result )
{
if ( result.getItem() == this.ifa )
if ( result.getItem() == this.facade )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( result );
recipe.computeVisuals();
this.arecipes.add( recipe );
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, result );
recipe.computeVisuals();
this.arecipes.add( recipe );
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient)
public void loadUsageRecipes( ItemStack ingredient )
{
List<ItemStack> facades = this.ifa.getFacades();
for (ItemStack is : facades)
List<ItemStack> facades = this.facade.getFacades();
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( is );
if ( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
for ( ItemStack is : facades )
{
recipe.computeVisuals();
if ( recipe.contains( recipe.ingredients, ingredient ) )
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
if ( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
{
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
this.arecipes.add( recipe );
recipe.computeVisuals();
if ( recipe.contains( recipe.ingredients, ingredient ) )
{
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
this.arecipes.add( recipe );
}
}
}
}
@@ -127,13 +135,19 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
}
@Override
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
public Class<? extends GuiContainer> getGuiClass()
{
return (super.hasOverlay( gui, container, recipe )) || ((this.isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
return GuiCrafting.class;
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
if ( renderer != null )
@@ -147,7 +161,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
}
@Override
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
if ( handler != null )
@@ -156,39 +170,45 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
public boolean isRecipe2x2(int recipe)
public boolean isRecipe2x2( int recipe )
{
for (PositionedStack stack : this.getIngredientStacks( recipe ))
for ( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
if ( (stack.relx > 43) || (stack.rely > 24) )
if ( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
return false;
}
return true;
}
public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
@Override
public String getRecipeName()
{
return GuiText.FacadeCrafting.getLocal();
}
private final class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final ArrayList<PositionedStack> ingredients;
public final PositionedStack result;
public CachedShapedRecipe(ItemStack output) {
public CachedShapedRecipe( IFacadeItem facade, ItemStack anchor, ItemStack output )
{
output.stackSize = 4;
this.result = new PositionedStack( output, 119, 24 );
this.ingredients = new ArrayList<PositionedStack>();
ItemStack in = NEIFacadeRecipeHandler.this.ifa.getTextureItem( output );
this.setIngredients( 3, 3, new Object[] { null, NEIFacadeRecipeHandler.this.cable_anchor, null, NEIFacadeRecipeHandler.this.cable_anchor, in, NEIFacadeRecipeHandler.this.cable_anchor, null, NEIFacadeRecipeHandler.this.cable_anchor, null } );
ItemStack in = facade.getTextureItem( output );
this.setIngredients( 3, 3, new Object[] { null, anchor, null, anchor, in, anchor, null, anchor, null } );
}
public void setIngredients(int width, int height, Object[] items)
public void setIngredients( int width, int height, Object[] items )
{
for (int x = 0; x < width; x++)
for ( int x = 0; x < width; x++ )
{
for (int y = 0; y < height; y++)
for ( int y = 0; y < height; y++ )
{
if ( items[(y * width + x)] != null )
if ( items[( y * width + x )] != null )
{
ItemStack is = (ItemStack) items[(y * width + x)];
ItemStack is = (ItemStack) items[( y * width + x )];
PositionedStack stack = new PositionedStack( is, 25 + x * 18, 6 + y * 18, false );
stack.setMaxSize( 1 );
this.ingredients.add( stack );
@@ -197,21 +217,21 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
}
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIFacadeRecipeHandler.this.cycleticks / 20, this.ingredients );
}
@Override
public PositionedStack getResult()
{
return this.result;
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIFacadeRecipeHandler.this.cycleticks / 20, this.ingredients );
}
public void computeVisuals()
{
for (PositionedStack p : this.ingredients)
for ( PositionedStack p : this.ingredients )
{
p.generatePermutations();
}
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL11;
@@ -40,7 +41,9 @@ import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
import appeng.api.AEApi;
import appeng.api.util.AEItemDefinition;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IMaterials;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
@@ -48,49 +51,64 @@ import appeng.core.localization.GuiText;
public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
{
final HashMap<AEItemDefinition, String> details = new HashMap<AEItemDefinition, String>();
final List<AEItemDefinition> offsets = new LinkedList<AEItemDefinition>();
final List<PositionedStack> outputs = new LinkedList<PositionedStack>();
private final Map<IItemDefinition, String> details = new HashMap<IItemDefinition, String>();
private final List<IItemDefinition> offsets = new LinkedList<IItemDefinition>();
private final List<PositionedStack> outputs = new LinkedList<PositionedStack>();
ItemStack target;
private ItemStack target;
private void addRecipe(AEItemDefinition def, String msg)
private void addRecipe(IItemDefinition def, String msg)
{
if ( NEIServerUtils.areStacksSameTypeCrafting( def.stack( 1 ), this.target ) )
for ( ItemStack definitionStack : def.maybeStack( 1 ).asSet() )
{
this.offsets.add( def );
this.outputs.add( new PositionedStack( def.stack( 1 ), 75, 4 ) );
this.details.put( def, msg );
if ( NEIServerUtils.areStacksSameTypeCrafting( definitionStack, this.target ) )
{
this.offsets.add( def );
this.outputs.add( new PositionedStack( definitionStack, 75, 4 ) );
this.details.put( def, msg );
}
}
}
private void addRecipes()
{
final IDefinitions definitions = AEApi.instance().definitions();
final IMaterials materials = definitions.materials();
final String message;
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
this.addRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged,
GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal() );
{
message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal();
}
else
this.addRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged, GuiText.ChargedQuartzFind.getLocal() );
{
message = GuiText.ChargedQuartzFind.getLocal();
}
this.addRecipe( materials.certusQuartzCrystalCharged(), message );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
{
this.addRecipe( AEApi.instance().materials().materialLogicProcessorPress, GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( AEApi.instance().materials().materialCalcProcessorPress, GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( AEApi.instance().materials().materialEngProcessorPress, GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
}
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
this.addRecipe( AEApi.instance().materials().materialFluixCrystal, GuiText.inWorldFluix.getLocal() );
{
this.addRecipe( materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() );
}
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
this.addRecipe( AEApi.instance().materials().materialQESingularity, GuiText.inWorldSingularity.getLocal() );
{
this.addRecipe( materials.qESingularity(), GuiText.inWorldSingularity.getLocal() );
}
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
{
this.addRecipe( AEApi.instance().materials().materialPurifiedCertusQuartzCrystal, GuiText.inWorldPurificationCertus.getLocal() );
this.addRecipe( AEApi.instance().materials().materialPurifiedNetherQuartzCrystal, GuiText.inWorldPurificationNether.getLocal() );
this.addRecipe( AEApi.instance().materials().materialPurifiedFluixCrystal, GuiText.inWorldPurificationFluix.getLocal() );
this.addRecipe( materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() );
this.addRecipe( materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() );
this.addRecipe( materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() );
}
}
@@ -18,6 +18,7 @@
package appeng.integration.modules.helpers;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@@ -30,30 +31,25 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.util.item.AEItemStack;
public class BSCrate implements IMEInventory<IAEItemStack>
{
private final ICrateStorage crateStorage;
private final ForgeDirection side;
final ICrateStorage cs;
final ForgeDirection side;
public BSCrate(Object object, ForgeDirection d) {
this.cs = (ICrateStorage) object;
public BSCrate( Object object, ForgeDirection d )
{
this.crateStorage = (ICrateStorage) object;
this.side = d;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
@Override
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
{
if ( mode == Actionable.SIMULATE )
return null;
ItemStack failed = this.cs.insertItems( input.getItemStack() );
ItemStack failed = this.crateStorage.insertItems( input.getItemStack() );
if ( failed == null )
return null;
input.setStackSize( failed.stackSize );
@@ -61,26 +57,31 @@ public class BSCrate implements IMEInventory<IAEItemStack>
}
@Override
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
{
if ( mode == Actionable.SIMULATE )
{
int howMany = this.cs.getItemCount( request.getItemStack() );
int howMany = this.crateStorage.getItemCount( request.getItemStack() );
return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany );
}
ItemStack Obtained = this.cs.extractItems( request.getItemStack(), (int) request.getStackSize() );
return AEItemStack.create( Obtained );
ItemStack obtained = this.crateStorage.extractItems( request.getItemStack(), (int) request.getStackSize() );
return AEItemStack.create( obtained );
}
@Override
public IItemList getAvailableItems(IItemList out)
public IItemList getAvailableItems( IItemList out )
{
for (ItemStack is : this.cs.getContents())
for ( ItemStack is : this.crateStorage.getContents() )
{
out.add( AEItemStack.create( is ) );
}
return out;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
}
+8 -8
View File
@@ -22,12 +22,12 @@ package appeng.items;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.FeatureNameExtractor;
import appeng.core.features.IAEFeature;
@@ -35,22 +35,22 @@ import appeng.core.features.IFeatureHandler;
import appeng.core.features.ItemFeatureHandler;
public class AEBaseItem extends Item implements IAEFeature
public abstract class AEBaseItem extends Item implements IAEFeature
{
private final String fullName;
private final Optional<String> subName;
private IFeatureHandler feature;
public AEBaseItem( Class c )
public AEBaseItem()
{
this( c, Optional.<String> absent() );
this.canRepair = false;
this( Optional.<String> absent() );
this.setNoRepair();
}
public AEBaseItem( Class<?> c, Optional<String> subName )
public AEBaseItem( Optional<String> subName )
{
this.subName = subName;
this.fullName = new FeatureNameExtractor( c, subName ).get();
this.fullName = new FeatureNameExtractor( this.getClass(), subName ).get();
}
@Override
@@ -18,18 +18,20 @@
package appeng.items.contents;
import net.minecraft.item.ItemStack;
import appeng.parts.automation.UpgradeInventory;
import appeng.parts.automation.StackUpgradeInventory;
import appeng.util.Platform;
public class CellUpgrades extends UpgradeInventory
{
public final class CellUpgrades extends StackUpgradeInventory
{
final ItemStack is;
public CellUpgrades(ItemStack is, int upgrades) {
super( is.getItem(), null, upgrades );
public CellUpgrades( ItemStack is, int upgrades )
{
super( is, null, upgrades );
this.is = is;
this.readFromNBT( Platform.openNbtData( is ), "upgrades" );
}
@@ -39,5 +41,4 @@ public class CellUpgrades extends UpgradeInventory
{
this.writeToNBT( Platform.openNbtData( this.is ), "upgrades" );
}
}
@@ -19,7 +19,6 @@
package appeng.items.materials;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
@@ -27,12 +26,11 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.collect.ImmutableSet;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
@@ -49,70 +47,45 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import com.google.common.collect.ImmutableSet;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.implementations.items.IStorageComponent;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.parts.IPartHost;
import appeng.api.parts.SelectedPart;
import appeng.client.texture.MissingIcon;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IStackSrc;
import appeng.core.features.MaterialStackSrc;
import appeng.core.features.NameResolver;
import appeng.items.AEBaseItem;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent, IUpgradeModule
{
final HashMap<Integer, MaterialType> dmgToMaterial = new HashMap<Integer, MaterialType>();
public static final int KILO = 1024;
public static ItemMultiMaterial instance;
public ItemMultiMaterial() {
super( ItemMultiMaterial.class );
private final Map<Integer, MaterialType> dmgToMaterial = new HashMap<Integer, MaterialType>();
private final NameResolver nameResolver;
public ItemMultiMaterial()
{
this.nameResolver = new NameResolver( this.getClass() );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setHasSubtypes( true );
instance = this;
}
static class SlightlyBetterSort implements Comparator<String>
{
final Pattern p;
public SlightlyBetterSort(Pattern p) {
this.p = p;
}
@Override
public int compare(String o1, String o2)
{
try
{
Matcher a = this.p.matcher( o1 );
Matcher b = this.p.matcher( o2 );
if ( a.find() && b.find() )
{
int ia = Integer.parseInt( a.group( 1 ) );
int ib = Integer.parseInt( b.group( 1 ) );
return Integer.compare( ia, ib );
}
}
catch (Throwable t)
{
// ek!
}
return o1.compareTo( o2 );
}
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
@@ -130,7 +103,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
if ( u != null )
{
List<String> textList = new LinkedList<String>();
for (Entry<ItemStack, Integer> j : u.getSupported().entrySet())
for ( Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
{
String name = null;
@@ -141,11 +114,11 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
IItemGroup ig = (IItemGroup) j.getKey().getItem();
String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
if ( str != null )
name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ')' : "");
name = Platform.gui_localize( str ) + ( limit > 1 ? " (" + limit + ')' : "" );
}
if ( name == null )
name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ')' : "");
name = j.getKey().getDisplayName() + ( limit > 1 ? " (" + limit + ')' : "" );
if ( !textList.contains( name ) )
textList.add( name );
@@ -158,12 +131,41 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
}
}
public IStackSrc createMaterial(MaterialType mat)
public MaterialType getTypeByStack( ItemStack is )
{
if ( this.dmgToMaterial.containsKey( is.getItemDamage() ) )
return this.dmgToMaterial.get( is.getItemDamage() );
return MaterialType.InvalidType;
}
@Override
public Upgrades getType( ItemStack itemstack )
{
switch ( this.getTypeByStack( itemstack ) )
{
case CardCapacity:
return Upgrades.CAPACITY;
case CardFuzzy:
return Upgrades.FUZZY;
case CardRedstone:
return Upgrades.REDSTONE;
case CardSpeed:
return Upgrades.SPEED;
case CardInverter:
return Upgrades.INVERTER;
case CardCrafting:
return Upgrades.CRAFTING;
default:
return null;
}
}
public IStackSrc createMaterial( MaterialType mat )
{
if ( !mat.isRegistered() )
{
boolean enabled = true;
for (AEFeature f : mat.getFeature())
for ( AEFeature f : mat.getFeature() )
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
if ( enabled )
@@ -172,17 +174,17 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
int newMaterialNum = mat.damageValue;
mat.markReady();
IStackSrc output = mat.stackSrc = new MaterialStackSrc( mat );
mat.stackSrc = new MaterialStackSrc( mat );
if ( this.dmgToMaterial.get( newMaterialNum ) == null )
this.dmgToMaterial.put( newMaterialNum, mat );
else
throw new RuntimeException( "Meta Overlap detected." );
return output;
return mat.stackSrc;
}
return null;
return mat.stackSrc;
}
else
throw new RuntimeException( "Cannot create the same material twice..." );
@@ -190,7 +192,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
public void makeUnique()
{
for (MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ))
for ( MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) )
{
if ( mt.getOreName() != null )
{
@@ -198,15 +200,15 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
String[] names = mt.getOreName().split( "," );
for (String name : names)
for ( String name : names )
{
if ( replacement != null )
break;
ArrayList<ItemStack> options = OreDictionary.getOres( name );
List<ItemStack> options = OreDictionary.getOres( name );
if ( options != null && options.size() > 0 )
{
for (ItemStack is : options)
for ( ItemStack is : options )
{
if ( is != null && is.getItem() != null )
{
@@ -220,7 +222,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
if ( replacement == null || AEConfig.instance.useAEVersion( mt ) )
{
// continue using the AE2 item.
for (String name : names)
for ( String name : names )
OreDictionary.registerOre( name, mt.stack( 1 ) );
}
else
@@ -231,27 +233,25 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
mt.itemInstance = replacement.getItem();
mt.damageValue = replacement.getItemDamage();
}
}
}
}
public MaterialType getTypeByStack(ItemStack is)
{
if ( this.dmgToMaterial.containsKey( is.getItemDamage() ) )
return this.dmgToMaterial.get( is.getItemDamage() );
return MaterialType.InvalidType;
}
@Override
public IIcon getIconFromDamage(int dmg)
public IIcon getIconFromDamage( int dmg )
{
if ( this.dmgToMaterial.containsKey( dmg ) )
return this.dmgToMaterial.get( dmg ).IIcon;
return new MissingIcon( this );
}
private String nameOf(ItemStack is)
@Override
public String getUnlocalizedName( ItemStack is )
{
return "item.appliedenergistics2." + this.nameOf( is );
}
private String nameOf( ItemStack is )
{
if ( is == null )
return "null";
@@ -260,19 +260,34 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
if ( mt == null )
return "null";
return AEFeatureHandler.getName( ItemMultiMaterial.class, mt.name() );
return this.nameResolver.getName( mt.name() );
}
@Override
public String getUnlocalizedName(ItemStack is)
public void getSubItems( Item par1, CreativeTabs par2CreativeTabs, List cList )
{
return "item.appliedenergistics2." + this.nameOf( is );
List<MaterialType> types = Arrays.asList( MaterialType.values() );
Collections.sort( types, new Comparator<MaterialType>()
{
@Override
public int compare( MaterialType o1, MaterialType o2 )
{
return o1.name().compareTo( o2.name() );
}
} );
for ( MaterialType mat : types )
{
if ( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
cList.add( new ItemStack( this, 1, mat.damageValue ) );
}
}
@Override
public void registerIcons(IIconRegister icoRegister)
public void registerIcons( IIconRegister icoRegister )
{
for (MaterialType mat : MaterialType.values())
for ( MaterialType mat : MaterialType.values() )
{
if ( mat.damageValue != -1 )
{
@@ -287,94 +302,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
public boolean hasCustomEntity(ItemStack is)
{
return this.getTypeByStack( is ).hasCustomEntity();
}
@Override
public Entity createEntity(World w, Entity location, ItemStack itemstack)
{
Class<? extends Entity> droppedEntity = this.getTypeByStack( itemstack ).getCustomEntityClass();
Entity eqi;
try
{
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class ).newInstance( w, location.posX,
location.posY, location.posZ, itemstack );
}
catch (Throwable t)
{
throw new RuntimeException( t );
}
eqi.motionX = location.motionX;
eqi.motionY = location.motionY;
eqi.motionZ = location.motionZ;
if ( location instanceof EntityItem && eqi instanceof EntityItem )
((EntityItem) eqi).delayBeforeCanPickup = ((EntityItem) location).delayBeforeCanPickup;
return eqi;
}
@Override
public int getBytes(ItemStack is)
{
switch (this.getTypeByStack( is ))
{
case Cell1kPart:
return 1024;
case Cell4kPart:
return 1024 * 4;
case Cell16kPart:
return 1024 * 16;
case Cell64kPart:
return 1024 * 64;
default:
}
return 0;
}
@Override
public boolean isStorageComponent(ItemStack is)
{
switch (this.getTypeByStack( is ))
{
case Cell1kPart:
case Cell4kPart:
case Cell16kPart:
case Cell64kPart:
return true;
default:
}
return false;
}
@Override
public Upgrades getType(ItemStack itemstack)
{
switch (this.getTypeByStack( itemstack ))
{
case CardCapacity:
return Upgrades.CAPACITY;
case CardFuzzy:
return Upgrades.FUZZY;
case CardRedstone:
return Upgrades.REDSTONE;
case CardSpeed:
return Upgrades.SPEED;
case CardInverter:
return Upgrades.INVERTER;
case CardCrafting:
return Upgrades.CRAFTING;
default:
return null;
}
}
@Override
public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public boolean onItemUseFirst( ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( player.isSneaking() )
{
@@ -383,12 +311,12 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
if ( te instanceof IPartHost )
{
SelectedPart sp = ((IPartHost) te).selectPart( Vec3.createVectorHelper( hitX, hitY, hitZ ) );
SelectedPart sp = ( (IPartHost) te ).selectPart( Vec3.createVectorHelper( hitX, hitY, hitZ ) );
if ( sp.part instanceof IUpgradeableHost )
upgrades = ((IUpgradeableHost) sp.part).getInventoryByName( "upgrades" );
upgrades = ( (ISegmentedInventory) sp.part ).getInventoryByName( "upgrades" );
}
else if ( te instanceof IUpgradeableHost )
upgrades = ((IUpgradeableHost) te).getInventoryByName( "upgrades" );
upgrades = ( (ISegmentedInventory) te ).getInventoryByName( "upgrades" );
if ( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule )
{
@@ -414,23 +342,97 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List cList)
public boolean hasCustomEntity( ItemStack is )
{
List<MaterialType> types = Arrays.asList( MaterialType.values() );
Collections.sort( types, new Comparator<MaterialType>() {
return this.getTypeByStack( is ).hasCustomEntity();
}
@Override
public int compare(MaterialType o1, MaterialType o2)
{
return o1.name().compareTo( o2.name() );
}
@Override
public Entity createEntity( World w, Entity location, ItemStack itemstack )
{
Class<? extends Entity> droppedEntity = this.getTypeByStack( itemstack ).getCustomEntityClass();
Entity eqi;
} );
for (MaterialType mat : types)
try
{
if ( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
cList.add( new ItemStack( this, 1, mat.damageValue ) );
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class ).newInstance( w, location.posX, location.posY, location.posZ, itemstack );
}
catch ( Throwable t )
{
throw new RuntimeException( t );
}
eqi.motionX = location.motionX;
eqi.motionY = location.motionY;
eqi.motionZ = location.motionZ;
if ( location instanceof EntityItem && eqi instanceof EntityItem )
( (EntityItem) eqi ).delayBeforeCanPickup = ( (EntityItem) location ).delayBeforeCanPickup;
return eqi;
}
@Override
public int getBytes( ItemStack is )
{
switch ( this.getTypeByStack( is ) )
{
case Cell1kPart:
return KILO;
case Cell4kPart:
return KILO * 4;
case Cell16kPart:
return KILO * 16;
case Cell64kPart:
return KILO * 64;
default:
}
return 0;
}
@Override
public boolean isStorageComponent( ItemStack is )
{
switch ( this.getTypeByStack( is ) )
{
case Cell1kPart:
case Cell4kPart:
case Cell16kPart:
case Cell64kPart:
return true;
default:
}
return false;
}
private static class SlightlyBetterSort implements Comparator<String>
{
private final Pattern pattern;
public SlightlyBetterSort( Pattern pattern )
{
this.pattern = pattern;
}
@Override
public int compare( String o1, String o2 )
{
try
{
Matcher a = this.pattern.matcher( o1 );
Matcher b = this.pattern.matcher( o2 );
if ( a.find() && b.find() )
{
int ia = Integer.parseInt( a.group( 1 ) );
int ib = Integer.parseInt( b.group( 1 ) );
return Integer.compare( ia, ib );
}
}
catch ( Throwable t )
{
// ek!
}
return o1.compareTo( o2 );
}
}
}
@@ -18,8 +18,10 @@
package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -38,6 +40,7 @@ import net.minecraft.world.World;
import cpw.mods.fml.common.registry.EntityRegistry;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
import appeng.api.implementations.items.IGrowableCrystal;
import appeng.api.recipes.ResolverResult;
import appeng.core.AppEng;
@@ -48,6 +51,7 @@ import appeng.entity.EntityIds;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
@@ -63,7 +67,36 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
final IIcon[] fluix = new IIcon[3];
final IIcon[] nether = new IIcon[3];
private int getProgress(ItemStack is)
public ItemCrystalSeed()
{
this.setHasSubtypes( true );
this.setFeature( EnumSet.of( AEFeature.Core ) );
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance, 16, 4, true );
}
@Nullable
public static ResolverResult getResolver( int certus2 )
{
ResolverResult resolver = null;
for ( ItemStack crystalSeedStack : AEApi.instance().definitions().items().crystalSeed().maybeStack( 1 ).asSet() )
{
crystalSeedStack.setItemDamage( certus2 );
crystalSeedStack = newStyle( crystalSeedStack );
resolver = new ResolverResult( "ItemCrystalSeed", crystalSeedStack.getItemDamage(), crystalSeedStack.getTagCompound() );
}
return resolver;
}
private static ItemStack newStyle( ItemStack itemStack )
{
( (ItemCrystalSeed) itemStack.getItem() ).getProgress( itemStack );
return itemStack;
}
private int getProgress( ItemStack is )
{
if ( is.hasTagCompound() )
{
@@ -74,35 +107,74 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
int progress;
NBTTagCompound comp = Platform.openNbtData( is );
comp.setInteger( "progress", progress = is.getItemDamage() );
is.setItemDamage( (is.getItemDamage() / SINGLE_OFFSET) * SINGLE_OFFSET );
is.setItemDamage( ( is.getItemDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
return progress;
}
}
private void setProgress(ItemStack is, int newDamage)
@Nullable
@Override
public ItemStack triggerGrowth( ItemStack is )
{
int newDamage = this.getProgress( is ) + 1;
final IMaterials materials = AEApi.instance().definitions().materials();
final int size = is.stackSize;
if ( newDamage == Certus + SINGLE_OFFSET )
{
for ( ItemStack quartzStack : materials.purifiedCertusQuartzCrystal().maybeStack( size ).asSet() )
{
return quartzStack;
}
}
if ( newDamage == Nether + SINGLE_OFFSET )
{
for ( ItemStack quartzStack : materials.purifiedNetherQuartzCrystal().maybeStack( size ).asSet() )
{
return quartzStack;
}
}
if ( newDamage == Fluix + SINGLE_OFFSET )
{
for ( ItemStack quartzStack : materials.purifiedFluixCrystal().maybeStack( size ).asSet() )
{
return quartzStack;
}
}
if ( newDamage > END )
return null;
this.setProgress( is, newDamage );
return is;
}
private void setProgress( ItemStack is, int newDamage )
{
NBTTagCompound comp = Platform.openNbtData( is );
comp.setInteger( "progress", newDamage );
is.setItemDamage( is.getItemDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
}
public ItemCrystalSeed() {
super( ItemCrystalSeed.class );
this.setHasSubtypes( true );
this.setFeature( EnumSet.of( AEFeature.Core ) );
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ),
AppEng.instance, 16, 4, true );
}
@Override
public int getEntityLifespan(ItemStack itemStack, World world)
} @Override
public int getEntityLifespan( ItemStack itemStack, World world )
{
return Integer.MAX_VALUE;
}
@Override
public String getUnlocalizedName(ItemStack is)
public float getMultiplier( Block blk, Material mat )
{
return 0.5f;
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
int progress = this.getProgress( stack ) % SINGLE_OFFSET;
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
} @Override
public String getUnlocalizedName( ItemStack is )
{
int damage = this.getProgress( is );
@@ -118,23 +190,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
return this.getUnlocalizedName();
}
@Override
public ItemStack triggerGrowth(ItemStack is)
{
int newDamage = this.getProgress( is ) + 1;
if ( newDamage == Certus + SINGLE_OFFSET )
return AEApi.instance().materials().materialPurifiedCertusQuartzCrystal.stack( is.stackSize );
if ( newDamage == Nether + SINGLE_OFFSET )
return AEApi.instance().materials().materialPurifiedNetherQuartzCrystal.stack( is.stackSize );
if ( newDamage == Fluix + SINGLE_OFFSET )
return AEApi.instance().materials().materialPurifiedFluixCrystal.stack( is.stackSize );
if ( newDamage > END )
return null;
this.setProgress( is, newDamage );
return is;
}
@Override
public boolean isDamageable()
@@ -143,35 +199,25 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
int progress = this.getProgress( stack ) % SINGLE_OFFSET;
lines.add( Math.floor( (float) progress / (float) (SINGLE_OFFSET / 100) ) + "%" );
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
}
@Override
public boolean isDamaged(ItemStack stack)
public boolean isDamaged( ItemStack stack )
{
return false;
}
@Override
public int getMaxDamage(ItemStack stack)
public int getMaxDamage( ItemStack stack )
{
return END;
}
@Override
public IIcon getIcon(ItemStack stack, int pass)
public IIcon getIcon( ItemStack stack, int pass )
{
return this.getIconIndex( stack );
}
@Override
public IIcon getIconIndex(ItemStack stack)
public IIcon getIconIndex( ItemStack stack )
{
IIcon[] list = null;
@@ -204,13 +250,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
@Override
public float getMultiplier(Block blk, Material mat)
{
return 0.5f;
}
@Override
public void registerIcons(IIconRegister ir)
public void registerIcons( IIconRegister ir )
{
String preFix = "appliedenergistics2:ItemCrystalSeed.";
@@ -228,13 +268,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
@Override
public boolean hasCustomEntity(ItemStack stack)
public boolean hasCustomEntity( ItemStack stack )
{
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack)
public Entity createEntity( World world, Entity location, ItemStack itemstack )
{
EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.posX, location.posY, location.posZ, itemstack );
@@ -243,13 +283,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
egc.motionZ = location.motionZ;
if ( location instanceof EntityItem )
egc.delayBeforeCanPickup = ((EntityItem) location).delayBeforeCanPickup;
egc.delayBeforeCanPickup = ( (EntityItem) location ).delayBeforeCanPickup;
return egc;
}
@Override
public void getSubItems(Item i, CreativeTabs t, List l)
public void getSubItems( Item i, CreativeTabs t, List l )
{
// lvl 0
l.add( newStyle( new ItemStack( this, 1, Certus ) ) );
@@ -267,18 +307,5 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + Fluix ) ) );
}
private static ItemStack newStyle(ItemStack itemStack)
{
((ItemCrystalSeed) itemStack.getItem()).getProgress( itemStack );
return itemStack;
}
public static ResolverResult getResolver(int certus2)
{
ItemStack is = AEApi.instance().items().itemCrystalSeed.stack( 1 );
is.setItemDamage( certus2 );
is = newStyle( is );
return new ResolverResult( "ItemCrystalSeed", is.getItemDamage(), is.getTagCompound() );
}
}
@@ -21,6 +21,7 @@ package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import net.minecraft.entity.player.EntityPlayer;
@@ -42,18 +43,35 @@ import appeng.helpers.PatternHelper;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternItem
{
// rather simple client side caching.
private static final Map<ItemStack, ItemStack> SIMPLE_CACHE = new WeakHashMap<ItemStack, ItemStack>();
public ItemEncodedPattern() {
super( ItemEncodedPattern.class );
public ItemEncodedPattern()
{
this.setFeature( EnumSet.of( AEFeature.Patterns ) );
this.setMaxStackSize( 1 );
if ( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, new ItemEncodedPatternRenderer() );
}
private boolean clearPattern(ItemStack stack, EntityPlayer player)
@Override
public ItemStack onItemRightClick( ItemStack stack, World w, EntityPlayer player )
{
this.clearPattern( stack, player );
return stack;
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
return this.clearPattern( stack, player );
}
private boolean clearPattern( ItemStack stack, EntityPlayer player )
{
if ( player.isSneaking() )
{
@@ -62,11 +80,15 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
InventoryPlayer inv = player.inventory;
for (int s = 0; s < player.inventory.getSizeInventory(); s++)
for ( int s = 0; s < player.inventory.getSizeInventory(); s++ )
{
if ( inv.getStackInSlot( s ) == stack )
{
inv.setInventorySlotContents( s, AEApi.instance().materials().materialBlankPattern.stack( stack.stackSize ) );
for ( ItemStack blankPattern : AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).asSet() )
{
inv.setInventorySlotContents( s, blankPattern );
}
return true;
}
}
@@ -76,20 +98,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
return this.clearPattern( stack, player );
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World w, EntityPlayer player)
{
this.clearPattern( stack, player );
return stack;
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
@@ -104,39 +113,49 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
IAEItemStack[] in = details.getCondensedInputs();
IAEItemStack[] out = details.getCondensedOutputs();
String label = (isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal()) + ": ";
String label = ( isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
String and = ' ' + GuiText.And.getLocal() + ' ';
String with = GuiText.With.getLocal() + ": ";
boolean first = true;
for (IAEItemStack anOut : out)
for ( IAEItemStack anOut : out )
{
if ( anOut == null )
{
continue;
}
lines.add( (first ? label : and) + anOut.getStackSize() + ' ' + Platform.getItemDisplayName( anOut ) );
lines.add( ( first ? label : and ) + anOut.getStackSize() + ' ' + Platform.getItemDisplayName( anOut ) );
first = false;
}
first = true;
for (IAEItemStack anIn : in)
for ( IAEItemStack anIn : in )
{
if ( anIn == null )
{
continue;
}
lines.add( (first ? with : and) + anIn.getStackSize() + ' ' + Platform.getItemDisplayName( anIn ) );
lines.add( ( first ? with : and ) + anIn.getStackSize() + ' ' + Platform.getItemDisplayName( anIn ) );
first = false;
}
}
// rather simple client side caching.
static final WeakHashMap<ItemStack, ItemStack> SIMPLE_CACHE = new WeakHashMap<ItemStack, ItemStack>();
@Override
public ICraftingPatternDetails getPatternForItem( ItemStack is, World w )
{
try
{
return new PatternHelper( is, w );
}
catch ( Throwable t )
{
return null;
}
}
public ItemStack getOutput(ItemStack item)
public ItemStack getOutput( ItemStack item )
{
ItemStack out = SIMPLE_CACHE.get( item );
if ( out != null )
@@ -154,18 +173,4 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].getItemStack() );
return out;
}
@Override
public ICraftingPatternDetails getPatternForItem(ItemStack is, World w)
{
try
{
return new PatternHelper( is, w );
}
catch (Throwable t)
{
return null;
}
}
}
@@ -34,33 +34,37 @@ import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemPaintBall extends AEBaseItem
{
public ItemPaintBall() {
super( ItemPaintBall.class );
public static final int DAMAGE_THRESHOLD = 20;
public ItemPaintBall()
{
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
this.hasSubtypes = true;
this.setHasSubtypes( true );
if ( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, new PaintBallRender() );
}
@Override
public String getItemStackDisplayName(ItemStack is)
public String getItemStackDisplayName( ItemStack is )
{
return super.getItemStackDisplayName( is ) + " - " + this.getExtraName( is );
}
public String getExtraName(ItemStack is)
public String getExtraName( ItemStack is )
{
return (is.getItemDamage() >= 20 ? GuiText.Lumen.getLocal() + ' ' : "") + this.getColor( is );
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
}
public AEColor getColor(ItemStack is)
public AEColor getColor( ItemStack is )
{
int dmg = is.getItemDamage();
if ( dmg >= 20 )
dmg -= 20;
if ( dmg >= DAMAGE_THRESHOLD )
dmg -= DAMAGE_THRESHOLD;
if ( dmg >= AEColor.values().length )
return AEColor.Transparent;
@@ -69,21 +73,20 @@ public class ItemPaintBall extends AEBaseItem
}
@Override
public void getSubItems(Item i, CreativeTabs ct, List l)
public void getSubItems( Item i, CreativeTabs ct, List l )
{
for (AEColor c : AEColor.values())
for ( AEColor c : AEColor.values() )
if ( c != AEColor.Transparent )
l.add( new ItemStack( this, 1, c.ordinal() ) );
for (AEColor c : AEColor.values())
for ( AEColor c : AEColor.values() )
if ( c != AEColor.Transparent )
l.add( new ItemStack( this, 1, 20 + c.ordinal() ) );
l.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
}
public boolean isLumen(ItemStack is)
public boolean isLumen( ItemStack is )
{
int dmg = is.getItemDamage();
return dmg >= 20;
return dmg >= DAMAGE_THRESHOLD;
}
}
@@ -18,6 +18,7 @@
package appeng.items.parts;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@@ -42,6 +43,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinition;
import appeng.api.parts.IAlphaPassItem;
import appeng.block.solids.OreQuartz;
import appeng.client.render.BusRenderer;
@@ -52,11 +54,14 @@ import appeng.facade.IFacadeItem;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassItem
{
public ItemFacade() {
super( ItemFacade.class );
private List<ItemStack> subTypes = null;
public ItemFacade()
{
this.setFeature( EnumSet.of( AEFeature.Facades ) );
this.setHasSubtypes( true );
if ( Platform.isClient() )
@@ -64,20 +69,46 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
public int getSpriteNumber()
{
return 0;
}
@Override
public boolean onItemUse(ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
return AEApi.instance().partHelper().placeBus( is, x, y, z, side, player, w );
}
@Override
public FacadePart createPartFromItemStack(ItemStack is, ForgeDirection side)
public String getItemStackDisplayName( ItemStack is )
{
try
{
ItemStack in = this.getTextureItem( is );
if ( in != null )
{
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
}
}
catch ( Throwable ignored )
{
}
return super.getItemStackDisplayName( is );
}
@Override
public void getSubItems( Item number, CreativeTabs tab, List list )
{
this.calculateSubTypes();
list.addAll( this.subTypes );
}
@Override
public FacadePart createPartFromItemStack( ItemStack is, ForgeDirection side )
{
ItemStack in = this.getTextureItem( is );
if ( in != null )
@@ -85,40 +116,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return null;
}
List<ItemStack> subTypes = null;
public List<ItemStack> getFacades()
{
this.calculateSubTypes();
return this.subTypes;
}
public ItemStack getCreativeTabIcon()
{
this.calculateSubTypes();
if ( this.subTypes.isEmpty() )
return new ItemStack( Items.cake );
return this.subTypes.get( 0 );
}
@Override
public void getSubItems(Item number, CreativeTabs tab, List list)
{
this.calculateSubTypes();
list.addAll( this.subTypes );
}
public ItemStack createFromIDs(int[] ids)
{
ItemStack is = new ItemStack( AEApi.instance().items().itemFacade.item() );
NBTTagCompound data = new NBTTagCompound();
data.setIntArray( "x", ids.clone() );
is.setTagCompound( data );
return is;
}
@Override
public ItemStack getTextureItem(ItemStack is)
public ItemStack getTextureItem( ItemStack is )
{
Block blk = this.getBlock( is );
if ( blk != null )
@@ -126,12 +125,51 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return null;
}
@Override
public int getMeta( ItemStack is )
{
NBTTagCompound data = is.getTagCompound();
if ( data != null )
{
int[] blk = data.getIntArray( "x" );
if ( blk != null && blk.length == 2 )
return blk[1];
}
return 0;
}
@Override
public Block getBlock( ItemStack is )
{
NBTTagCompound data = is.getTagCompound();
if ( data != null )
{
if ( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
{
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
}
else
{
int[] blk = data.getIntArray( "x" );
if ( blk != null && blk.length == 2 )
return Block.getBlockById( blk[0] );
}
}
return Blocks.glass;
}
public List<ItemStack> getFacades()
{
this.calculateSubTypes();
return this.subTypes;
}
private void calculateSubTypes()
{
if ( this.subTypes == null )
{
this.subTypes = new ArrayList<ItemStack>();
for (Object blk : Block.blockRegistry)
for ( Object blk : Block.blockRegistry )
{
Block b = (Block) blk;
try
@@ -140,14 +178,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
List<ItemStack> tmpList = new ArrayList<ItemStack>();
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
for (ItemStack l : tmpList)
for ( ItemStack l : tmpList )
{
ItemStack facade = this.createFacadeForItem( l, false );
if ( facade != null )
this.subTypes.add( facade );
}
}
catch (Throwable t)
catch ( Throwable t )
{
// just absorb..
}
@@ -156,10 +194,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if ( FacadeConfig.instance.hasChanged() )
FacadeConfig.instance.save();
}
}
public ItemStack createFacadeForItem(ItemStack l, boolean returnItem)
public ItemStack createFacadeForItem( ItemStack l, boolean returnItem )
{
if ( l == null )
return null;
@@ -174,7 +211,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
boolean disableOre = b instanceof OreQuartz;
boolean defaultValue = (b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre) || enableGlass;
boolean defaultValue = ( b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
if ( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
{
if ( returnItem )
@@ -195,60 +232,30 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return null;
}
@Override
public Block getBlock(ItemStack is)
public ItemStack getCreativeTabIcon()
{
NBTTagCompound data = is.getTagCompound();
if ( data != null )
this.calculateSubTypes();
if ( this.subTypes.isEmpty() )
return new ItemStack( Items.cake );
return this.subTypes.get( 0 );
}
public ItemStack createFromIDs( int[] ids )
{
for ( ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
{
if ( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
{
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
}
else
{
int[] blk = data.getIntArray( "x" );
if ( blk != null && blk.length == 2 )
return Block.getBlockById( blk[0] );
}
NBTTagCompound facadeTag = new NBTTagCompound();
facadeTag.setIntArray( "x", ids.clone() );
facadeStack.setTagCompound( facadeTag );
return facadeStack;
}
return Blocks.glass;
throw new MissingDefinition( "Tried to create a facade, while facades are being deactivated." );
}
@Override
public int getMeta(ItemStack is)
{
NBTTagCompound data = is.getTagCompound();
if ( data != null )
{
int[] blk = data.getIntArray( "x" );
if ( blk != null && blk.length == 2 )
return blk[1];
}
return 0;
}
@Override
public String getItemStackDisplayName(ItemStack is)
{
try
{
ItemStack in = this.getTextureItem( is );
if ( in != null )
{
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
}
}
catch (Throwable ignored)
{
}
return super.getItemStackDisplayName( is );
}
@Override
public boolean useAlphaPass(ItemStack is)
public boolean useAlphaPass( ItemStack is )
{
ItemStack out = this.getTextureItem( is );
@@ -261,5 +268,4 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return false;
}
}
@@ -24,9 +24,12 @@ import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -41,40 +44,80 @@ import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHelper;
import appeng.api.parts.IPartItem;
import appeng.api.util.AEColor;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.NameResolver;
import appeng.core.features.ItemStackSrc;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
{
private final NameResolver nameResolver;
static class PartTypeIst
private static class PartTypeIst
{
PartType part;
int variant;
private PartType part;
private int variant;
@SideOnly(Side.CLIENT)
IIcon ico;
private IIcon ico;
}
final HashMap<Integer, PartTypeIst> dmgToPart = new HashMap<Integer, PartTypeIst>();
private final Map<Integer, PartTypeIst> dmgToPart = new HashMap<Integer, PartTypeIst>();
public static ItemMultiPart instance;
public ItemMultiPart() {
super( ItemMultiPart.class );
public ItemMultiPart( IPartHelper partHelper ) {
this.nameResolver = new NameResolver( this.getClass() );
this.setFeature( EnumSet.of( AEFeature.Core ) );
AEApi.instance().partHelper().setItemBusRenderer( this );
partHelper.setItemBusRenderer( this );
this.setHasSubtypes( true );
instance = this;
}
public final ItemStackSrc createPart( PartType mat )
{
int varID = 0;
// verify
for (PartTypeIst p : this.dmgToPart.values())
{
if ( p.part == mat && p.variant == varID )
throw new RuntimeException( "Cannot create the same material twice..." );
}
boolean enabled = true;
for (AEFeature f : mat.getFeature())
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
int newPartNum = mat.baseDamage + varID;
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
if ( enabled )
{
PartTypeIst pti = new PartTypeIst();
pti.part = mat;
pti.variant = varID;
if ( this.dmgToPart.get( newPartNum ) == null )
{
this.dmgToPart.put( newPartNum, pti );
return output;
}
else
{
throw new RuntimeException( "Meta Overlap detected." );
}
}
return output;
}
public ItemStackSrc createPart(PartType mat, Enum variant)
{
try
@@ -86,6 +129,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
catch (Throwable e)
{
AELog.integration( e );
e.printStackTrace();
return null; // part not supported..
}
@@ -133,6 +177,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
return -1;
}
@Nullable
public PartType getTypeByStack(ItemStack is)
{
if ( is == null )
@@ -166,7 +211,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
public String getName(ItemStack is)
{
return AEFeatureHandler.getName( ItemMultiPart.class, this.getTypeByStack( is ).name() );
return this.nameResolver.getName( this.getTypeByStack( is ).name() );
}
@Override
@@ -176,10 +221,12 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
if ( pt == null )
return "Unnamed";
Enum[] variants = pt.getVariants();
if ( pt.isCable() )
{
final AEColor[] variants = AEColor.values();
if ( variants != null )
return super.getItemStackDisplayName( is ) + " - " + variants[this.dmgToPart.get( is.getItemDamage() ).variant].toString();
}
if ( pt.getExtraName() != null )
return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal();

Some files were not shown because too many files have changed in this diff Show More