Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c91e852ec | |||
| 52f516299b | |||
| c74166b02a | |||
| 26e86a114c | |||
| fc834036a0 | |||
| f96f7d82c5 | |||
| c592f54a77 | |||
| 89609a83ea | |||
| e67969f52f | |||
| 32a0496bc2 | |||
| 6df311c11a | |||
| 2e23b92763 | |||
| 41a029ffb4 | |||
| 9c8f914f42 | |||
| d75cdc9696 | |||
| 77bb28ded6 | |||
| 0e7981d717 | |||
| fbb0c05c7f | |||
| efa0ab7e4e | |||
| 70fe5189e0 | |||
| 3a8d6d0bcd | |||
| 7ac817e9ae | |||
| 0ceb4765a2 | |||
| 7ce9654402 | |||
| 5328627d7a | |||
| fe1a67ffaa | |||
| 4253d659f1 | |||
| b3560aaa00 | |||
| 005392911d | |||
| 7f02562e0c | |||
| 84bc00fa20 | |||
| c1483d87c7 | |||
| f5e4a202cb |
+4
-1
@@ -25,4 +25,7 @@
|
||||
!codeformat/
|
||||
|
||||
# Github specific files and directories
|
||||
!.github/
|
||||
!.github/
|
||||
|
||||
# Explicit ignores
|
||||
Thumbs.db
|
||||
+16
-19
@@ -40,7 +40,6 @@ repositories {
|
||||
|
||||
apply from: 'gradle/scripts/dependencies.gradle'
|
||||
apply from: 'gradle/scripts/artifacts.gradle'
|
||||
apply from: 'gradle/scripts/integration.gradle'
|
||||
apply from: 'gradle/scripts/optional.gradle'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
@@ -56,6 +55,9 @@ jar {
|
||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
||||
}
|
||||
|
||||
from sourceSets.api.output
|
||||
dependsOn apiClasses
|
||||
|
||||
// specify which files are really included, can control which APIs should be in
|
||||
include "appeng/**"
|
||||
include "assets/**"
|
||||
@@ -82,26 +84,21 @@ minecraft {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs += 'src/api/java'
|
||||
srcDirs += 'src/main/java/'
|
||||
}
|
||||
|
||||
resources {
|
||||
srcDir "src/main/resources/"
|
||||
include "assets/appliedenergistics2/recipes/**/*.recipe",
|
||||
"assets/appliedenergistics2/recipes/README.html",
|
||||
"assets/appliedenergistics2/lang/*.lang",
|
||||
"assets/appliedenergistics2/blockstates/**/*.json",
|
||||
"assets/appliedenergistics2/models/**/*.json",
|
||||
"assets/appliedenergistics2/textures/**/*.png",
|
||||
"assets/appliedenergistics2/textures/**/*.mcmeta",
|
||||
"assets/appliedenergistics2/meta/*",
|
||||
"mcmod.info",
|
||||
"pack.mcmeta"
|
||||
}
|
||||
api
|
||||
|
||||
// This source set will contain third party API code that we need to compile, but which is not shipped with the jar
|
||||
thirdparty {
|
||||
// Third Party APIs often need access to Minecraft classes (i.e. EnumFacing), so set this up here
|
||||
compileClasspath += configurations.forgeGradleMc + configurations.forgeGradleMcDeps
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile sourceSets.thirdparty.output
|
||||
}
|
||||
|
||||
processResources
|
||||
|
||||
@@ -46,7 +46,7 @@ task apiJar(type: Jar) {
|
||||
from sourceSets.api.java
|
||||
include "appeng/api/**"
|
||||
|
||||
from sourceSets.main.output
|
||||
from sourceSets.api.output
|
||||
include "appeng/api/**"
|
||||
|
||||
classifier = 'api'
|
||||
|
||||
@@ -1,29 +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>.
|
||||
*/
|
||||
|
||||
// Should be provided by ForgeGradle, some idea user should confirm it.
|
||||
apply plugin: 'idea'
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
|
||||
// excludes integration due to not being available upon port
|
||||
excludeDirs += file('src/main/java/appeng/parts/layers/')
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public interface IParts
|
||||
|
||||
IItemDefinition p2PTunnelLiquids();
|
||||
|
||||
// IItemDefinition p2PTunnelEU();
|
||||
IItemDefinition p2PTunnelEU();
|
||||
|
||||
// IItemDefinition p2PTunnelRF();
|
||||
|
||||
|
||||
@@ -75,10 +75,22 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
return super.getActualState( state, worldIn, pos ).withProperty( POWERED, powered );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT)
|
||||
/**
|
||||
* NOTE: This is only used to determine how to render an item being held in hand.
|
||||
* For determining block rendering, the method below is used (canRenderInLayer).
|
||||
*/
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public boolean canRenderInLayer( BlockRenderLayer layer )
|
||||
{
|
||||
return layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state)
|
||||
|
||||
@@ -69,9 +69,6 @@ import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -349,10 +346,6 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
{
|
||||
out = ( (TileCableBus) te ).getCableBus();
|
||||
}
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
out = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getCableContainer( te );
|
||||
}
|
||||
|
||||
return out == null ? NULL_CABLE_BUS : out;
|
||||
}
|
||||
|
||||
@@ -161,12 +161,6 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
super.drawScreen( mouseX, mouseY, btn );
|
||||
|
||||
final boolean hasClicked = Mouse.isButtonDown( 0 );
|
||||
if( hasClicked && this.getScrollBar() != null )
|
||||
{
|
||||
this.getScrollBar().click( this, mouseX - this.guiLeft, mouseY - this.guiTop );
|
||||
}
|
||||
|
||||
for( final Object c : this.buttonList )
|
||||
{
|
||||
if( c instanceof ITooltip )
|
||||
@@ -217,7 +211,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
// All lines after the first are colored gray
|
||||
for( int i = 1; i < lines.size(); i++ )
|
||||
{
|
||||
lines.set(i, TextFormatting.GRAY + lines.get(i));
|
||||
lines.set( i, TextFormatting.GRAY + lines.get( i ) );
|
||||
}
|
||||
|
||||
this.drawHoveringText( lines, x, y, fontRendererObj );
|
||||
@@ -258,13 +252,15 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
if( fs.isEnabled() )
|
||||
{
|
||||
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 );
|
||||
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
|
||||
18 );
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
|
||||
GlStateManager.enableBlend();
|
||||
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 );
|
||||
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
|
||||
18 );
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
}
|
||||
@@ -290,6 +286,11 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getScrollBar() != null )
|
||||
{
|
||||
this.getScrollBar().click( this, xCoord - this.guiLeft, yCoord - this.guiTop );
|
||||
}
|
||||
|
||||
super.mouseClicked( xCoord, yCoord, btn );
|
||||
}
|
||||
|
||||
@@ -299,6 +300,11 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
final Slot slot = this.getSlot( x, y );
|
||||
final ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if( this.getScrollBar() != null )
|
||||
{
|
||||
this.getScrollBar().click( this, x - this.guiLeft, y - this.guiTop );
|
||||
}
|
||||
|
||||
if( slot instanceof SlotFake && itemstack != null )
|
||||
{
|
||||
this.drag_click.add( slot );
|
||||
@@ -317,7 +323,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 1.9.4 aftermath - Whole ClickType thing, to be checked.
|
||||
// TODO 1.9.4 aftermath - Whole ClickType thing, to be checked.
|
||||
@Override
|
||||
protected void handleMouseClick( final Slot slot, final int slotIdx, final int mouseButton, final ClickType clickType )
|
||||
{
|
||||
@@ -325,7 +331,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
|
||||
if( slot instanceof SlotFake )
|
||||
{
|
||||
final InventoryAction action = isCtrlKeyDown() ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
final InventoryAction action = mouseButton == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
|
||||
if( this.drag_click.size() > 1 )
|
||||
{
|
||||
@@ -369,7 +375,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
else
|
||||
{
|
||||
// Craft stack on right-click, craft single on left-click
|
||||
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||
}
|
||||
|
||||
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
|
||||
@@ -409,10 +415,10 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
switch( clickType )
|
||||
{
|
||||
case PICKUP: // pickup / set-down.
|
||||
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
break;
|
||||
case QUICK_MOVE:
|
||||
action = isCtrlKeyDown() ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
break;
|
||||
|
||||
case CLONE: // creative dupe:
|
||||
@@ -445,7 +451,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
switch( clickType )
|
||||
{
|
||||
case PICKUP: // pickup / set-down.
|
||||
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack() == null )
|
||||
@@ -455,7 +461,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
|
||||
break;
|
||||
case QUICK_MOVE:
|
||||
action = isCtrlKeyDown() ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
break;
|
||||
|
||||
@@ -515,7 +521,9 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
final List<Slot> slots = this.getInventorySlots();
|
||||
for( final Slot inventorySlot : slots )
|
||||
{
|
||||
if( inventorySlot != null && inventorySlot.canTakeStack( this.mc.thePlayer ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot( inventorySlot, this.dbl_whichItem, true ) )
|
||||
if( inventorySlot != null && inventorySlot.canTakeStack(
|
||||
this.mc.thePlayer ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot(
|
||||
inventorySlot, this.dbl_whichItem, true ) )
|
||||
{
|
||||
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 1, clickType );
|
||||
}
|
||||
@@ -759,11 +767,15 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
final float f1 = 0.00390625F;
|
||||
final float f = 0.00390625F;
|
||||
final float par6 = 16;
|
||||
vb.pos( par1 + 0, par2 + par6, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + 0, par2 + par6, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ).color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() ).endVertex();
|
||||
final float par5 = 16;
|
||||
vb.pos( par1 + par5, par2 + par6, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + par5, par2 + 0, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + 0, par2 + 0, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + par5, par2 + par6, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ).color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + par5, par2 + 0, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + 0, par2 + 0, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() ).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
}
|
||||
@@ -777,7 +789,8 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.NotAvailable )
|
||||
{
|
||||
boolean isValid = s.isItemValid( is ) || s instanceof SlotOutput || s instanceof AppEngCraftingSlot || s instanceof SlotDisabled || s instanceof SlotInaccessible || s instanceof SlotFake || s instanceof SlotRestrictedInput || s instanceof SlotDisconnected;
|
||||
boolean isValid = s.isItemValid(
|
||||
is ) || s instanceof SlotOutput || s instanceof AppEngCraftingSlot || s instanceof SlotDisabled || s instanceof SlotInaccessible || s instanceof SlotFake || s instanceof SlotRestrictedInput || s instanceof SlotDisconnected;
|
||||
if( isValid && s instanceof SlotRestrictedInput )
|
||||
{
|
||||
try
|
||||
@@ -848,6 +861,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
final ResourceLocation loc = new ResourceLocation( AppEng.MOD_ID, "textures/" + file );
|
||||
this.mc.getTextureManager().bindTexture( loc );
|
||||
}
|
||||
|
||||
protected GuiScrollbar getScrollBar()
|
||||
{
|
||||
return this.myScrollBar;
|
||||
|
||||
@@ -24,8 +24,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerSkyChest;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
|
||||
|
||||
@@ -55,6 +54,6 @@ public class GuiSkyChest extends AEBaseGui
|
||||
@Override
|
||||
protected boolean enableSpaceClicking()
|
||||
{
|
||||
return !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks );
|
||||
return !Integrations.invTweaks().isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.integration.modules.JEI;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.ItemSorters;
|
||||
import appeng.util.Platform;
|
||||
@@ -58,7 +58,6 @@ public class ItemRepo
|
||||
private String searchString = "";
|
||||
private IPartitionList<IAEItemStack> myPartitionList;
|
||||
private String innerSearch = "";
|
||||
private String jeiSearch = null;
|
||||
private boolean hasPower;
|
||||
|
||||
public ItemRepo( final IScrollSource src, final ISortSource sortSrc )
|
||||
@@ -244,7 +243,7 @@ public class ItemRepo
|
||||
|
||||
private void updateJEI( String filter )
|
||||
{
|
||||
JEI.instance.getJei().setSearchText( filter );
|
||||
Integrations.jei().setSearchText( filter );
|
||||
}
|
||||
|
||||
public int size()
|
||||
|
||||
@@ -108,8 +108,9 @@ public class FacadeDispatcherBakedModel implements IBakedModel
|
||||
ItemFacade itemFacade = (ItemFacade) stack.getItem();
|
||||
|
||||
IBlockState state = itemFacade.getTextureBlockState( stack );
|
||||
ItemStack textureItem = itemFacade.getTextureItem( stack );
|
||||
|
||||
return new FacadeWithBlockBakedModel( baseModel, state, format );
|
||||
return new FacadeWithBlockBakedModel( baseModel, state, textureItem, format );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
@@ -53,10 +54,13 @@ public class FacadeWithBlockBakedModel implements IBakedModel
|
||||
|
||||
private final VertexFormat format;
|
||||
|
||||
public FacadeWithBlockBakedModel( IBakedModel baseModel, IBlockState blockState, VertexFormat format )
|
||||
private final ItemStack textureItem;
|
||||
|
||||
public FacadeWithBlockBakedModel( IBakedModel baseModel, IBlockState blockState, ItemStack textureItem, VertexFormat format )
|
||||
{
|
||||
this.baseModel = baseModel;
|
||||
this.blockState = blockState;
|
||||
this.textureItem = textureItem;
|
||||
this.textureModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( blockState );
|
||||
this.format = format;
|
||||
}
|
||||
@@ -69,10 +73,14 @@ public class FacadeWithBlockBakedModel implements IBakedModel
|
||||
{
|
||||
List<BakedQuad> quads = new ArrayList<>( 1 );
|
||||
CubeBuilder builder = new CubeBuilder( format, quads );
|
||||
TextureAtlasSprite sprite = FacadeBuilder.getSprite( textureModel, blockState, side, rand );
|
||||
if ( sprite != null )
|
||||
FacadeBuilder.TextureAtlasAndTint sprite = FacadeBuilder.getSprite( textureModel, blockState, side, rand );
|
||||
if ( sprite != null && sprite.getSprite() != null )
|
||||
{
|
||||
builder.setTexture( sprite );
|
||||
if( sprite.getTint() != -1 )
|
||||
{
|
||||
builder.setColor( Minecraft.getMinecraft().getItemColors().getColorFromItemstack( textureItem, sprite.getTint() ) );
|
||||
}
|
||||
builder.setTexture( sprite.getSprite() );
|
||||
builder.setDrawFaces( EnumSet.of( EnumFacing.NORTH ) );
|
||||
builder.addCube( 0, 0, 0, 16, 16, 16 );
|
||||
return quads;
|
||||
|
||||
@@ -36,7 +36,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
@@ -60,8 +59,6 @@ public class FacadeBuilder
|
||||
|
||||
private static final ResourceLocation TEXTURE_FACADE = new ResourceLocation( AppEng.MOD_ID, "parts/cable_anchor" );
|
||||
|
||||
private final BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
|
||||
|
||||
private final VertexFormat format;
|
||||
|
||||
private final TextureAtlasSprite facadeTexture;
|
||||
@@ -87,7 +84,7 @@ public class FacadeBuilder
|
||||
|
||||
CubeBuilder builder = new CubeBuilder( format, quads );
|
||||
|
||||
facadesState.forEach( ( side, textureItem ) ->
|
||||
facadesState.forEach( ( side, state ) ->
|
||||
{
|
||||
AxisAlignedBB facadeBox = getFacadeBox( side, thinFacades );
|
||||
AEAxisAlignedBB cutOutBox = getCutOutBox( facadeBox, partBoxes );
|
||||
@@ -104,10 +101,10 @@ public class FacadeBuilder
|
||||
} );
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite getSprite( IBakedModel blockModel, IBlockState state, EnumFacing facing, long rand)
|
||||
public static TextureAtlasAndTint getSprite( IBakedModel blockModel, IBlockState state, EnumFacing facing, long rand)
|
||||
{
|
||||
|
||||
TextureAtlasSprite firstFound = null;
|
||||
TextureAtlasAndTint firstFound = null;
|
||||
BlockRenderLayer orgLayer = MinecraftForgeClient.getRenderLayer();
|
||||
|
||||
try
|
||||
@@ -120,18 +117,18 @@ public class FacadeBuilder
|
||||
|
||||
for( BakedQuad bakedQuad : blockModel.getQuads( state, facing, rand ) )
|
||||
{
|
||||
return bakedQuad.getSprite();
|
||||
return new TextureAtlasAndTint( bakedQuad );
|
||||
}
|
||||
|
||||
for( BakedQuad bakedQuad : blockModel.getQuads( state, null, rand ) )
|
||||
{
|
||||
if( firstFound == null )
|
||||
{
|
||||
firstFound = bakedQuad.getSprite();
|
||||
firstFound = new TextureAtlasAndTint( bakedQuad );
|
||||
}
|
||||
if( bakedQuad.getFace() == facing )
|
||||
{
|
||||
return bakedQuad.getSprite();
|
||||
return new TextureAtlasAndTint( bakedQuad );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +151,7 @@ public class FacadeBuilder
|
||||
{
|
||||
try
|
||||
{
|
||||
return blockModel.getParticleTexture();
|
||||
return new TextureAtlasAndTint( blockModel.getParticleTexture(), -1 );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -177,6 +174,9 @@ public class FacadeBuilder
|
||||
|
||||
builder.setDrawFaces( EnumSet.allOf( EnumFacing.class ) );
|
||||
|
||||
// Reset to no color multiplicator
|
||||
builder.setColorRGB( 0xFFFFFF );
|
||||
|
||||
// We only render the stilt if we don't intersect with any part directly, and if there's no part on our side
|
||||
if( renderStilt && busBounds == null && layer == BlockRenderLayer.CUTOUT )
|
||||
{
|
||||
@@ -215,36 +215,42 @@ public class FacadeBuilder
|
||||
|
||||
IBakedModel blockModel = blockRendererDispatcher.getModelForState( blockState );
|
||||
|
||||
int color = 0xffffff;
|
||||
try
|
||||
{
|
||||
blockColors.getColor( blockState );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
}
|
||||
|
||||
final int color;
|
||||
if( translucent )
|
||||
{
|
||||
color &= 0xFFFFFF;
|
||||
color |= 0x4C000000;
|
||||
builder.setColor( color );
|
||||
color = 0x4CFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.setColorRGB( color );
|
||||
color = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
// TODO: Cache this
|
||||
for( EnumFacing facing : facadeState.getOpenFaces() )
|
||||
{
|
||||
TextureAtlasSprite sprite = getSprite( blockModel, blockState, facing, rand );
|
||||
if( sprite != null )
|
||||
TextureAtlasAndTint spriteAndTint = getSprite( blockModel, blockState, facing, rand );
|
||||
if( spriteAndTint != null && spriteAndTint.sprite != null )
|
||||
{
|
||||
builder.setTexture( facing, sprite );
|
||||
// Use the tint color from the item stack here, which is based upon the assumption that the
|
||||
// model used for the block will use the same meaning for tint indices as the item model does
|
||||
if( spriteAndTint.tint != -1 )
|
||||
{
|
||||
int tintColor = facadeState.resolveTintColor( spriteAndTint.tint );
|
||||
|
||||
// Still apply the transparency color
|
||||
tintColor &= 0xFFFFFF;
|
||||
tintColor |= color & 0xFF000000;
|
||||
builder.setColor( tintColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.setColor( color );
|
||||
}
|
||||
builder.setTexture( facing, spriteAndTint.sprite );
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.setColor( color );
|
||||
builder.setTexture( facing, facadeTexture );
|
||||
}
|
||||
}
|
||||
@@ -460,4 +466,34 @@ public class FacadeBuilder
|
||||
throw new IllegalArgumentException( "Unsupported face: " + side );
|
||||
}
|
||||
}
|
||||
|
||||
public static class TextureAtlasAndTint
|
||||
{
|
||||
private final TextureAtlasSprite sprite;
|
||||
private final int tint;
|
||||
|
||||
private TextureAtlasAndTint( BakedQuad quad )
|
||||
{
|
||||
this.sprite = quad.getSprite();
|
||||
this.tint = quad.getTintIndex();
|
||||
}
|
||||
|
||||
private TextureAtlasAndTint( TextureAtlasSprite sprite, int tint )
|
||||
{
|
||||
this.sprite = sprite;
|
||||
this.tint = tint;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getSprite()
|
||||
{
|
||||
return sprite;
|
||||
}
|
||||
|
||||
public int getTint()
|
||||
{
|
||||
return tint;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ package appeng.client.render.cablebus;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
@@ -19,10 +21,14 @@ public class FacadeRenderState
|
||||
// Which faces of the cube should be rendered for this particular facade
|
||||
private final EnumSet<EnumFacing> openFaces;
|
||||
|
||||
public FacadeRenderState( IBlockState sourceBlock, EnumSet<EnumFacing> openFaces )
|
||||
// For resolving the tint indices of a facade
|
||||
private final ItemStack textureItem;
|
||||
|
||||
public FacadeRenderState( IBlockState sourceBlock, EnumSet<EnumFacing> openFaces, ItemStack textureItem )
|
||||
{
|
||||
this.sourceBlock = sourceBlock;
|
||||
this.openFaces = openFaces;
|
||||
this.textureItem = textureItem;
|
||||
}
|
||||
|
||||
public IBlockState getSourceBlock()
|
||||
@@ -35,4 +41,9 @@ public class FacadeRenderState
|
||||
return openFaces;
|
||||
}
|
||||
|
||||
public int resolveTintColor( int tintIndex )
|
||||
{
|
||||
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack( textureItem, tintIndex );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
if( hand == null )
|
||||
{
|
||||
is.stackSize--;
|
||||
is.stackSize = Math.max( 1, is.stackSize - 1 );
|
||||
}
|
||||
else if( hand.isItemEqual( is ) )
|
||||
{
|
||||
|
||||
@@ -97,7 +97,10 @@ public class SyncData
|
||||
}
|
||||
else if( val instanceof Long || val.getClass() == long.class )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( this.channel, (Long) val ), (EntityPlayerMP) o );
|
||||
if( o instanceof EntityPlayerMP )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( this.channel, (Long) val ), (EntityPlayerMP) o );
|
||||
}
|
||||
}
|
||||
else if( val instanceof Boolean || val.getClass() == boolean.class )
|
||||
{
|
||||
|
||||
@@ -186,15 +186,18 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
if( sideLocal != sideRemote )
|
||||
{
|
||||
this.clientCM.putSetting( set, sideLocal );
|
||||
for( final Object crafter : this.listeners )
|
||||
for( final IContainerListener crafter : this.listeners )
|
||||
{
|
||||
try
|
||||
if( crafter instanceof EntityPlayerMP )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (EntityPlayerMP) crafter );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (EntityPlayerMP) crafter );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,6 +261,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void updatePowerStatus()
|
||||
@@ -340,7 +344,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeListener( final IContainerListener c )
|
||||
{
|
||||
|
||||
@@ -88,6 +88,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
public boolean enableEffects = true;
|
||||
public boolean useLargeFonts = false;
|
||||
public boolean useColoredCraftingStatus;
|
||||
public boolean removeCrashingItemsOnLoad = false;
|
||||
public int wirelessTerminalBattery = 1600000;
|
||||
public int entropyManipulatorBattery = 200000;
|
||||
public int matterCannonBattery = 200000;
|
||||
@@ -126,6 +127,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
CondenserOutput.MATTER_BALLS.requiredPower = this.get( "Condenser", "MatterBalls", 256 ).getInt( 256 );
|
||||
CondenserOutput.SINGULARITY.requiredPower = this.get( "Condenser", "Singularity", 256000 ).getInt( 256000 );
|
||||
|
||||
this.removeCrashingItemsOnLoad = this.get( "general", "removeCrashingItemsOnLoad", false, "Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!" ).getBoolean();
|
||||
|
||||
this.grinderOres = this.get( "GrindStone", "grinderOres", this.grinderOres ).getStringList();
|
||||
this.oreDoublePercentage = this.get( "GrindStone", "oreDoublePercentage", this.oreDoublePercentage ).getDouble( this.oreDoublePercentage );
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.stats.PlayerStatsRegistration;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.items.materials.ItemMaterial;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.loot.ChestLoot;
|
||||
@@ -84,7 +85,6 @@ import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.recipes.handlers.Crusher;
|
||||
import appeng.recipes.handlers.Grind;
|
||||
import appeng.recipes.handlers.GrindFZ;
|
||||
import appeng.recipes.handlers.HCCrusher;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.recipes.handlers.Macerator;
|
||||
@@ -214,7 +214,6 @@ public final class Registration
|
||||
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 );
|
||||
|
||||
@@ -246,13 +245,11 @@ public final class Registration
|
||||
final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
||||
recipeLoader.run();
|
||||
|
||||
// TODO readd layers
|
||||
|
||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
|
||||
// {
|
||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||
// }
|
||||
if( Integrations.ic2().isEnabled() )
|
||||
{
|
||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||
}
|
||||
//
|
||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) )
|
||||
// {
|
||||
@@ -334,8 +331,6 @@ public final class Registration
|
||||
PlayerMessages.values();
|
||||
GuiText.values();
|
||||
|
||||
Api.INSTANCE.partHelper().initFMPSupport();
|
||||
|
||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
|
||||
|
||||
// Interface
|
||||
|
||||
@@ -28,7 +28,10 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
@@ -53,9 +56,6 @@ import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
@@ -64,80 +64,91 @@ import appeng.tile.networking.TileCableBus;
|
||||
public class ApiPart implements IPartHelper
|
||||
{
|
||||
|
||||
private final Map<String, Class<? extends AEBaseTile>> tileImplementations = new HashMap<>();
|
||||
private final Map<Class<?>, String> interfaces2Layer = new HashMap<Class<?>, String>();
|
||||
private final Map<String, Class> roots = new HashMap<String, Class>();
|
||||
private final LoadingCache<CacheKey, Class<? extends AEBaseTile>> cache = CacheBuilder.newBuilder().build( new CacheLoader<CacheKey, Class<? extends AEBaseTile>>()
|
||||
{
|
||||
@Override
|
||||
public Class<? extends AEBaseTile> load( CacheKey key ) throws Exception
|
||||
{
|
||||
return generateCombinedClass( key );
|
||||
}
|
||||
} );
|
||||
|
||||
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
|
||||
private final List<String> desc = new LinkedList<String>();
|
||||
|
||||
public void initFMPSupport()
|
||||
{
|
||||
for( final Class layerInterface : this.interfaces2Layer.keySet() )
|
||||
{
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).registerPassThrough( layerInterface );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a chain of all registered layers.
|
||||
* <p/>
|
||||
* To accomplish this, it takes the first registered layer, replaces it's inheritance from LayerBase with an inheritance from the given baseClass,
|
||||
* and uses the resulting class as the parent class for the next registered layer, for which it repeats this process. This process is then repeated
|
||||
* until a class hierarchy of all layers is formed. While janking out the inheritance from LayerBase, it'll make also sure that calls to that
|
||||
* classes method will instead be forwarded to the superclass that was inserted as part of the described process.
|
||||
* <p/>
|
||||
* Example: If layers A and B are registered, and TileCableBus is passed in as the baseClass, a synthetic class A_B_TileCableBus should be returned,
|
||||
* which has A_B_TileCableBus -extends-> B_TileCableBus -extends-> TileCableBus as it's class hierarchy, where A_B_TileCableBus has been generated
|
||||
* from A, and B_TileCableBus has been generated from B.
|
||||
*/
|
||||
public Class<? extends AEBaseTile> getCombinedInstance( final Class<? extends AEBaseTile> baseClass )
|
||||
{
|
||||
String base = baseClass.getName();
|
||||
|
||||
if( this.desc.isEmpty() )
|
||||
{
|
||||
// No layers registered...
|
||||
return baseClass;
|
||||
}
|
||||
|
||||
final String description = base + ':' + Joiner.on( ";" ).skipNulls().join( this.desc.iterator() );
|
||||
|
||||
if( this.tileImplementations.get( description ) != null )
|
||||
{
|
||||
return this.tileImplementations.get( description );
|
||||
}
|
||||
|
||||
String f = base;// TileCableBus.class.getName();
|
||||
String Addendum = baseClass.getSimpleName();
|
||||
Class<? extends AEBaseTile> myClass = baseClass;
|
||||
|
||||
String path = f;
|
||||
|
||||
for( final String name : this.desc )
|
||||
{
|
||||
try
|
||||
{
|
||||
final String newPath = path + ';' + name;
|
||||
myClass = this.getClassByDesc( baseClass.getSimpleName(), newPath, f, this.interfaces2Layer.get( Class.forName( name ) ) );
|
||||
path = newPath;
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.warn( "Error loading " + name );
|
||||
AELog.debug( t );
|
||||
}
|
||||
f = myClass.getName();
|
||||
}
|
||||
|
||||
this.tileImplementations.put( description, myClass );
|
||||
|
||||
return myClass;
|
||||
return cache.getUnchecked( new CacheKey( baseClass, this.desc ) );
|
||||
}
|
||||
|
||||
private Class getClassByDesc( final String addendum, final String fullPath, final String root, final String next )
|
||||
private Class<? extends AEBaseTile> generateCombinedClass( CacheKey cacheKey )
|
||||
{
|
||||
if( this.roots.get( fullPath ) != null )
|
||||
final Class<? extends AEBaseTile> parentClass;
|
||||
|
||||
// Get the list of interfaces that still need to be implemented beyond the current one
|
||||
List<String> remainingInterfaces = cacheKey.getInterfaces().subList( 1, cacheKey.getInterfaces().size() );
|
||||
|
||||
// We are not at the root of the class hierarchy yet
|
||||
if( !remainingInterfaces.isEmpty() )
|
||||
{
|
||||
return this.roots.get( fullPath );
|
||||
CacheKey parentKey = new CacheKey( cacheKey.getBaseClass(), remainingInterfaces );
|
||||
parentClass = cache.getUnchecked( parentKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
parentClass = cacheKey.getBaseClass();
|
||||
}
|
||||
|
||||
// Which interface should be implemented in this layer?
|
||||
String interfaceName = cacheKey.getInterfaces().get( 0 );
|
||||
|
||||
try
|
||||
{
|
||||
// This is the particular interface that this layer was registered for. Loading the class may fail if i.e. an API is broken or not present
|
||||
// and in this case, the layer will be skipped!
|
||||
Class<?> interfaceClass = Class.forName( interfaceName );
|
||||
String layerImpl = this.interfaces2Layer.get( interfaceClass );
|
||||
|
||||
return this.getClassByDesc( parentClass, layerImpl );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.warn( "Error loading " + interfaceName );
|
||||
AELog.debug( t );
|
||||
return parentClass;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private Class<? extends AEBaseTile> getClassByDesc( Class<? extends AEBaseTile> baseClass, final String next )
|
||||
{
|
||||
final ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
|
||||
final ClassNode n = this.getReader( next );
|
||||
final String originalName = n.name;
|
||||
|
||||
try
|
||||
{
|
||||
n.name = n.name + '_' + addendum;
|
||||
n.superName = Class.forName( root ).getName().replace( ".", "/" );
|
||||
n.name = n.name + '_' + baseClass.getSimpleName();
|
||||
n.superName = baseClass.getName().replace( '.', '/' );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
@@ -167,14 +178,13 @@ public class ApiPart implements IPartHelper
|
||||
try
|
||||
{
|
||||
final Object fish = clazz.newInstance();
|
||||
final Class rootC = Class.forName( root );
|
||||
|
||||
boolean hasError = false;
|
||||
|
||||
if( !rootC.isInstance( fish ) )
|
||||
if( !baseClass.isInstance( fish ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement " + root + " did not." );
|
||||
AELog.error( "Error, Expected layer to implement " + baseClass + " did not." );
|
||||
}
|
||||
|
||||
if( fish instanceof LayerBase )
|
||||
@@ -183,19 +193,16 @@ public class ApiPart implements IPartHelper
|
||||
AELog.error( "Error, Expected layer to NOT implement LayerBase but it DID." );
|
||||
}
|
||||
|
||||
if( !fullPath.contains( ".fmp." ) )
|
||||
if( !( fish instanceof TileCableBus ) )
|
||||
{
|
||||
if( !( fish instanceof TileCableBus ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement TileCableBus did not." );
|
||||
}
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement TileCableBus did not." );
|
||||
}
|
||||
|
||||
if( !( fish instanceof TileEntity ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement TileEntity did not." );
|
||||
}
|
||||
if( !( fish instanceof TileEntity ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.error( "Error, Expected layer to implement TileEntity did not." );
|
||||
}
|
||||
|
||||
if( !hasError )
|
||||
@@ -209,7 +216,6 @@ public class ApiPart implements IPartHelper
|
||||
AELog.debug( t );
|
||||
}
|
||||
|
||||
this.roots.put( fullPath, clazz );
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@@ -260,10 +266,19 @@ public class ApiPart implements IPartHelper
|
||||
defineClassMethod.setAccessible( true );
|
||||
try
|
||||
{
|
||||
final Object[] argsA = { name, name, b };
|
||||
final Object[] argsA = {
|
||||
name,
|
||||
name,
|
||||
b
|
||||
};
|
||||
b = (byte[]) runTransformersMethod.invoke( loader, argsA );
|
||||
|
||||
final Object[] args = { name, b, 0, b.length };
|
||||
final Object[] args = {
|
||||
name,
|
||||
b,
|
||||
0,
|
||||
b.length
|
||||
};
|
||||
clazz = (Class) defineClassMethod.invoke( loader, args );
|
||||
}
|
||||
finally
|
||||
@@ -319,7 +334,7 @@ public class ApiPart implements IPartHelper
|
||||
private static class DefaultPackageClassNameRemapper extends Remapper
|
||||
{
|
||||
|
||||
private final HashMap<String, String> inputOutput = new HashMap<String, String>();
|
||||
private final HashMap<String, String> inputOutput = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public String map( final String typeName )
|
||||
@@ -332,4 +347,53 @@ public class ApiPart implements IPartHelper
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class CacheKey
|
||||
{
|
||||
private final Class<? extends AEBaseTile> baseClass;
|
||||
|
||||
private final List<String> interfaces;
|
||||
|
||||
private CacheKey( Class<? extends AEBaseTile> baseClass, List<String> interfaces )
|
||||
{
|
||||
this.baseClass = baseClass;
|
||||
this.interfaces = ImmutableList.copyOf( interfaces );
|
||||
}
|
||||
|
||||
private Class<? extends AEBaseTile> getBaseClass()
|
||||
{
|
||||
return baseClass;
|
||||
}
|
||||
|
||||
private List<String> getInterfaces()
|
||||
{
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if( o == null || getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheKey cacheKey = (CacheKey) o;
|
||||
|
||||
return baseClass.equals( cacheKey.baseClass ) && interfaces.equals( cacheKey.interfaces );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = baseClass.hashCode();
|
||||
result = 31 * result + interfaces.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public final class ApiParts implements IParts
|
||||
private final IItemDefinition p2PTunnelRedstone;
|
||||
private final IItemDefinition p2PTunnelItems;
|
||||
private final IItemDefinition p2PTunnelLiquids;
|
||||
// private final IItemDefinition p2PTunnelEU;
|
||||
private final IItemDefinition p2PTunnelEU;
|
||||
// private final IItemDefinition p2PTunnelRF;
|
||||
private final IItemDefinition p2PTunnelLight;
|
||||
// private final IItemDefinition p2PTunnelOpenComputers;
|
||||
@@ -113,7 +113,7 @@ public final class ApiParts implements IParts
|
||||
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2PTunnelRedstone ) );
|
||||
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2PTunnelItems ) );
|
||||
this.p2PTunnelLiquids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelLiquids ) );
|
||||
// this.p2PTunnelEU = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelEU ) );
|
||||
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) );
|
||||
// this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) );
|
||||
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2PTunnelLight ) );
|
||||
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
||||
@@ -286,13 +286,13 @@ public final class ApiParts implements IParts
|
||||
return this.p2PTunnelLiquids;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override
|
||||
* public IItemDefinition p2PTunnelEU()
|
||||
* {
|
||||
* return this.p2PTunnelEU;
|
||||
* }
|
||||
* @Override
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelEU()
|
||||
{
|
||||
return this.p2PTunnelEU;
|
||||
}
|
||||
|
||||
/* @Override
|
||||
* public IItemDefinition p2PTunnelRF()
|
||||
* {
|
||||
* return this.p2PTunnelRF;
|
||||
|
||||
@@ -37,6 +37,8 @@ public enum TickRates
|
||||
|
||||
Inscriber( 1, 1 ),
|
||||
|
||||
Charger( 10, 120 ),
|
||||
|
||||
IOPort( 1, 5 ),
|
||||
|
||||
VibrationChamber( 10, 40 ),
|
||||
|
||||
@@ -38,7 +38,6 @@ import appeng.core.sync.packets.PacketLightning;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.core.sync.packets.PacketMatterCannon;
|
||||
import appeng.core.sync.packets.PacketMockExplosion;
|
||||
import appeng.core.sync.packets.PacketMultiPart;
|
||||
import appeng.core.sync.packets.PacketJEIRecipe;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.core.sync.packets.PacketPaintedEntity;
|
||||
@@ -68,8 +67,6 @@ public class AppEngPacketHandlerBase
|
||||
|
||||
PACKET_CONFIG_BUTTON( PacketConfigButton.class ),
|
||||
|
||||
PACKET_MULTIPART( PacketMultiPart.class ),
|
||||
|
||||
PACKET_PART_PLACEMENT( PacketPartPlacement.class ),
|
||||
|
||||
PACKET_LIGHTNING( PacketLightning.class ),
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
|
||||
|
||||
public class PacketMultiPart extends AppEngPacket
|
||||
{
|
||||
|
||||
// automatic.
|
||||
public PacketMultiPart( final ByteBuf stream )
|
||||
{
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketMultiPart()
|
||||
{
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( this.getPacketID() );
|
||||
|
||||
this.configureWrite( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
{
|
||||
final IFMP fmp = (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP );
|
||||
if( fmp != null )
|
||||
{
|
||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||
MinecraftForge.EVENT_BUS.post( fmp.newFMPPacketEvent( sender ) ); // when received it just posts this event.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -45,8 +43,8 @@ public class TileChunkLoader extends AEBaseTile implements ITickable
|
||||
private boolean requestTicket = true;
|
||||
private Ticket ct = null;
|
||||
|
||||
@TileEvent( TileEventType.TICK )
|
||||
public void onTickEvent()
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if( this.requestTicket )
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@ import net.minecraft.util.text.TextComponentString;
|
||||
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -43,8 +41,8 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
|
||||
private int countdown = 20 * 10;
|
||||
private EntityPlayer who = null;
|
||||
|
||||
@TileEvent( TileEventType.TICK )
|
||||
public void onTickEvent()
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if( this.is != null && Platform.isServer() )
|
||||
{
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.Optional;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -35,9 +33,6 @@ import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.parts.CableBusStorage;
|
||||
|
||||
@@ -136,29 +131,16 @@ public class FacadeContainer implements IFacadeContainer
|
||||
{
|
||||
ids[0] = out.readInt();
|
||||
ids[1] = out.readInt();
|
||||
final boolean isBC = ids[0] < 0;
|
||||
ids[0] = Math.abs( ids[0] );
|
||||
|
||||
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
final IBlockState state = Block.getStateById( ids[0] );
|
||||
final IFacadePart created = bc.createFacadePart( state, side );
|
||||
changed = changed || this.storage.getFacade( x ) == null;
|
||||
|
||||
this.storage.setFacade( x, created );
|
||||
}
|
||||
else if( !isBC )
|
||||
{
|
||||
Optional<Item> maybeFacadeItem = AEApi.instance().definitions().items().facade().maybeItem();
|
||||
if (maybeFacadeItem.isPresent()) {
|
||||
final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
|
||||
final ItemStack facade = ifa.createFromIDs( ids );
|
||||
if( facade != null )
|
||||
{
|
||||
changed = changed || this.storage.getFacade( x ) == null;
|
||||
this.storage.setFacade( x, ifa.createPartFromItemStack( facade, side ) );
|
||||
}
|
||||
Optional<Item> maybeFacadeItem = AEApi.instance().definitions().items().facade().maybeItem();
|
||||
if (maybeFacadeItem.isPresent()) {
|
||||
final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
|
||||
final ItemStack facade = ifa.createFromIDs( ids );
|
||||
if( facade != null )
|
||||
{
|
||||
changed = changed || this.storage.getFacade( x ) == null;
|
||||
this.storage.setFacade( x, ifa.createPartFromItemStack( facade, side ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,17 +172,6 @@ public class FacadeContainer implements IFacadeContainer
|
||||
{
|
||||
this.storage.setFacade( x, ( (IFacadeItem) i ).createPartFromItemStack( is, AEPartLocation.fromOrdinal( x ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
if( bc.isFacade( is ) )
|
||||
{
|
||||
this.storage.setFacade( x, bc.createFacadePart( is, AEPartLocation.fromOrdinal( x ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,26 @@ package appeng.integration;
|
||||
|
||||
public interface IIntegrationModule
|
||||
{
|
||||
void init() throws Throwable;
|
||||
|
||||
void postInit();
|
||||
default boolean isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
default void init() throws Throwable
|
||||
{
|
||||
}
|
||||
|
||||
default void postInit()
|
||||
{
|
||||
}
|
||||
|
||||
class Stub implements IIntegrationModule
|
||||
{
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,42 +19,38 @@
|
||||
package appeng.integration;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModAPIManager;
|
||||
|
||||
import appeng.api.exceptions.ModNotInstalled;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.integration.modules.ic2.IC2Module;
|
||||
import appeng.integration.modules.jei.JEIModule;
|
||||
import appeng.integration.modules.waila.WailaModule;
|
||||
|
||||
|
||||
public final class IntegrationNode
|
||||
final class IntegrationNode
|
||||
{
|
||||
|
||||
private final String displayName;
|
||||
private final String modID;
|
||||
private final IntegrationType shortName;
|
||||
private final IntegrationType type;
|
||||
private IntegrationStage state = IntegrationStage.PRE_INIT;
|
||||
private IntegrationStage failedStage = IntegrationStage.PRE_INIT;
|
||||
private Throwable exception = null;
|
||||
private String name = null;
|
||||
private Class<?> classValue = null;
|
||||
private Object instance;
|
||||
private IIntegrationModule mod = null;
|
||||
|
||||
public IntegrationNode( final String displayName, final String modID, final IntegrationType shortName, final String name )
|
||||
IntegrationNode( final String displayName, final String modID, final IntegrationType type )
|
||||
{
|
||||
this.displayName = displayName;
|
||||
this.shortName = shortName;
|
||||
this.type = type;
|
||||
this.modID = modID;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.getShortName().name() + ':' + this.getState().name();
|
||||
return this.getType().name() + ':' + this.getState().name();
|
||||
}
|
||||
|
||||
boolean isActive()
|
||||
@@ -98,10 +94,18 @@ public final class IntegrationNode
|
||||
|
||||
if( enabled )
|
||||
{
|
||||
this.classValue = this.getClass().getClassLoader().loadClass( this.name );
|
||||
this.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance();
|
||||
final Field f = this.classValue.getField( "instance" );
|
||||
f.set( this.classValue, this.setInstance( this.mod ) );
|
||||
switch( type )
|
||||
{
|
||||
case IC2:
|
||||
this.mod = Integrations.setIc2( new IC2Module() );
|
||||
break;
|
||||
case JEI:
|
||||
this.mod = Integrations.setJei( new JEIModule() );
|
||||
break;
|
||||
case Waila:
|
||||
this.mod = new WailaModule();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -128,7 +132,6 @@ public final class IntegrationNode
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
this.failedStage = stage;
|
||||
this.exception = t;
|
||||
this.setState( IntegrationStage.FAILED );
|
||||
}
|
||||
@@ -151,20 +154,9 @@ public final class IntegrationNode
|
||||
}
|
||||
}
|
||||
|
||||
Object getInstance()
|
||||
IntegrationType getType()
|
||||
{
|
||||
return this.instance;
|
||||
}
|
||||
|
||||
private Object setInstance( final Object instance )
|
||||
{
|
||||
this.instance = instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
IntegrationType getShortName()
|
||||
{
|
||||
return this.shortName;
|
||||
return this.type;
|
||||
}
|
||||
|
||||
IntegrationStage getState()
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.integration;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@@ -32,8 +30,6 @@ public enum IntegrationRegistry
|
||||
{
|
||||
INSTANCE;
|
||||
|
||||
private static final String PACKAGE_PREFIX = "appeng.integration.modules.";
|
||||
|
||||
private final Collection<IntegrationNode> modules = new LinkedList<IntegrationNode>();
|
||||
|
||||
public void add( final IntegrationType type )
|
||||
@@ -48,7 +44,7 @@ public enum IntegrationRegistry
|
||||
return;
|
||||
}
|
||||
|
||||
this.modules.add( new IntegrationNode( type.dspName, type.modID, type, PACKAGE_PREFIX + type.name() ) );
|
||||
this.modules.add( new IntegrationNode( type.dspName, type.modID, type ) );
|
||||
}
|
||||
|
||||
public void init()
|
||||
@@ -83,7 +79,7 @@ public enum IntegrationRegistry
|
||||
builder.append( ", " );
|
||||
}
|
||||
|
||||
final String integrationState = node.getShortName() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" );
|
||||
final String integrationState = node.getType() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" );
|
||||
builder.append( integrationState );
|
||||
}
|
||||
|
||||
@@ -94,7 +90,7 @@ public enum IntegrationRegistry
|
||||
{
|
||||
for( final IntegrationNode node : this.modules )
|
||||
{
|
||||
if( node.getShortName() == name )
|
||||
if( node.getType() == name )
|
||||
{
|
||||
return node.isActive();
|
||||
}
|
||||
@@ -102,18 +98,4 @@ public enum IntegrationRegistry
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Object getInstance( final IntegrationType name )
|
||||
{
|
||||
for( final IntegrationNode node : this.modules )
|
||||
{
|
||||
if( node.getShortName() == name && node.isActive() )
|
||||
{
|
||||
return node.getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException( "integration with " + name.name() + " is disabled." );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.integration;
|
||||
|
||||
|
||||
public enum IntegrationSide
|
||||
enum IntegrationSide
|
||||
{
|
||||
CLIENT, SERVER, BOTH
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.integration;
|
||||
|
||||
|
||||
public enum IntegrationStage
|
||||
enum IntegrationStage
|
||||
{
|
||||
|
||||
PRE_INIT, INIT, POST_INIT,
|
||||
|
||||
@@ -23,46 +23,22 @@ public enum IntegrationType
|
||||
{
|
||||
IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" ),
|
||||
|
||||
RotaryCraft( IntegrationSide.BOTH, "Rotary Craft", "RotaryCraft" ),
|
||||
|
||||
RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ),
|
||||
|
||||
BuildCraftCore( IntegrationSide.BOTH, "BuildCraft Core", "BuildCraft|Core" ),
|
||||
|
||||
BuildCraftTransport( IntegrationSide.BOTH, "BuildCraft Transport", "BuildCraft|Transport" ),
|
||||
|
||||
BuildCraftBuilder( IntegrationSide.BOTH, "BuildCraft Builders", "BuildCraft|Builders" ),
|
||||
|
||||
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
|
||||
|
||||
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ),
|
||||
|
||||
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ),
|
||||
|
||||
DSU( IntegrationSide.BOTH, "Deep Storage Unit", null ),
|
||||
|
||||
FZ( IntegrationSide.BOTH, "Factorization", "factorization" ),
|
||||
|
||||
FMP( IntegrationSide.BOTH, "Forge MultiPart", "McMultipart" ),
|
||||
|
||||
RB( IntegrationSide.BOTH, "Rotatable Blocks", "RotatableBlocks" ),
|
||||
|
||||
CLApi( IntegrationSide.BOTH, "Colored Lights Core", "coloredlightscore" ),
|
||||
|
||||
Waila( IntegrationSide.BOTH, "Waila", "Waila" ),
|
||||
|
||||
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
|
||||
|
||||
JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" ),
|
||||
|
||||
CraftGuide( IntegrationSide.CLIENT, "Craft Guide", "craftguide" ),
|
||||
|
||||
Mekanism( IntegrationSide.BOTH, "Mekanism", "Mekanism" ),
|
||||
|
||||
ImmibisMicroblocks( IntegrationSide.BOTH, "ImmibisMicroblocks", "ImmibisMicroblocks" ),
|
||||
|
||||
BetterStorage( IntegrationSide.BOTH, "BetterStorage", "betterstorage" ),
|
||||
|
||||
OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" );
|
||||
|
||||
public final IntegrationSide side;
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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.integration;
|
||||
|
||||
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
import appeng.integration.abstraction.IInvTweaks;
|
||||
import appeng.integration.abstraction.IJEI;
|
||||
import appeng.integration.abstraction.IMekanism;
|
||||
import appeng.integration.abstraction.IRC;
|
||||
|
||||
|
||||
/**
|
||||
* Provides convenient access to various integrations with other mods.
|
||||
*/
|
||||
public final class Integrations
|
||||
{
|
||||
|
||||
static IIC2 ic2 = new IIC2.Stub();
|
||||
|
||||
static IJEI jei = new IJEI.Stub();
|
||||
|
||||
static IRC rc = new IRC.Stub();
|
||||
|
||||
static IMekanism mekanism = new IMekanism.Stub();
|
||||
|
||||
static IInvTweaks invTweaks = new IInvTweaks.Stub();
|
||||
|
||||
private Integrations()
|
||||
{
|
||||
}
|
||||
|
||||
public static IIC2 ic2()
|
||||
{
|
||||
return ic2;
|
||||
}
|
||||
|
||||
public static IJEI jei()
|
||||
{
|
||||
return jei;
|
||||
}
|
||||
|
||||
public static IRC rc()
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
public static IMekanism mekanism()
|
||||
{
|
||||
return mekanism;
|
||||
}
|
||||
|
||||
public static IInvTweaks invTweaks()
|
||||
{
|
||||
return invTweaks;
|
||||
}
|
||||
|
||||
static IIC2 setIc2( IIC2 ic2 )
|
||||
{
|
||||
Integrations.ic2 = ic2;
|
||||
return ic2;
|
||||
}
|
||||
|
||||
static IJEI setJei( IJEI jei )
|
||||
{
|
||||
Integrations.jei = jei;
|
||||
return jei;
|
||||
}
|
||||
|
||||
static IRC setRc( IRC rc )
|
||||
{
|
||||
Integrations.rc = rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static IMekanism setMekanism( IMekanism mekanism )
|
||||
{
|
||||
Integrations.mekanism = mekanism;
|
||||
return mekanism;
|
||||
}
|
||||
|
||||
static IInvTweaks setInvTweaks( IInvTweaks invTweaks )
|
||||
{
|
||||
Integrations.invTweaks = invTweaks;
|
||||
return invTweaks;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +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.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
|
||||
public interface IBetterStorage
|
||||
{
|
||||
|
||||
boolean isStorageCrate( Object te );
|
||||
|
||||
InventoryAdaptor getAdaptor( Object te, EnumFacing d );
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
||||
/**
|
||||
* Contains wrench behaviour
|
||||
*
|
||||
* and registers the engines as P2P attunements for RF tunnels (since BC 7, they are part of BC Core) The attunement is
|
||||
* currently not public anymore, because it
|
||||
* was only used internally
|
||||
*
|
||||
* @author AlgorithmX2
|
||||
* @version rv3
|
||||
* @since rv0
|
||||
*/
|
||||
public interface IBuildCraftCore
|
||||
{
|
||||
/**
|
||||
* @param eq to be checked item, can be {@code null}
|
||||
*
|
||||
* @return {@code true} if it is an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
boolean isWrench( @Nullable Item eq );
|
||||
|
||||
/**
|
||||
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
|
||||
* @param wrencher wrenching player, can be probably {@code null}, but not sure
|
||||
* @param pos pos
|
||||
*
|
||||
* @return {@code true} if player can wrench with that {@code wrench}
|
||||
*
|
||||
* @throws NullPointerException if {@code wrench} is {@code null}
|
||||
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, BlockPos pos );
|
||||
|
||||
/**
|
||||
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
|
||||
* @param wrencher wrenching player, can be probably {@code null}, but not sure
|
||||
* @param pos pos
|
||||
*
|
||||
* @throws NullPointerException if {@code wrench} is {@code null}
|
||||
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
|
||||
*/
|
||||
void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, BlockPos pos );
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
|
||||
/**
|
||||
* Contains facade logic to interchange BC facades with AE facades,
|
||||
*
|
||||
* pipe logic to interact between storage buses and pipes
|
||||
*
|
||||
* and using pipes for attunements
|
||||
* The attunement is currently not public anymore,
|
||||
* because it was only used internally
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3 - 12.06.2015
|
||||
* @since rv3 12.06.2015
|
||||
*/
|
||||
public interface IBuildCraftTransport
|
||||
{
|
||||
/**
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return {@code true} if the checked item is a {@link buildcraft.api.facades.IFacadeItem}
|
||||
*/
|
||||
boolean isFacade( @Nullable ItemStack is );
|
||||
|
||||
/**
|
||||
* @param blk block used for the ae facade
|
||||
* @param meta meta of the block
|
||||
* @param side side of the ae facade
|
||||
*
|
||||
* @return ae facade through bc facade system
|
||||
*/
|
||||
@Nullable
|
||||
IFacadePart createFacadePart( @Nullable IBlockState blk, @Nonnull AEPartLocation side );
|
||||
|
||||
/**
|
||||
* @param held create facade for that item
|
||||
* @param side on which side should the part be rendered, should rather be not {@code null}
|
||||
*
|
||||
* @return new instance using the {@code held} and side as direct argument, no logic in between
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code held} is {@code null}
|
||||
*/
|
||||
IFacadePart createFacadePart( @Nonnull ItemStack held, @Nonnull AEPartLocation side );
|
||||
|
||||
/**
|
||||
* @param facade buildcraft facade
|
||||
*
|
||||
* @return item with the block and metadata based on the facade or {@code null} if {@code facade} was not a facade
|
||||
*
|
||||
* @throws NullPointerException if {@code facade} is {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getTextureForFacade( @Nonnull ItemStack facade );
|
||||
|
||||
/**
|
||||
* @param te the to be checked {@link TileEntity}
|
||||
* @param dir direction of the {@link TileEntity}
|
||||
*
|
||||
* @return {@code true} if {@code te} is a buildcraft pipe, but not plugged
|
||||
*
|
||||
* @throws NullPointerException if {@code dir} is {@code null}
|
||||
*/
|
||||
boolean isPipe( @Nullable TileEntity te, @Nonnull EnumFacing dir );
|
||||
|
||||
/**
|
||||
* checks weather if the {@code te} is injectable and simulates to inject the item
|
||||
*
|
||||
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
|
||||
* @param is to be injected item
|
||||
* @param dir direction of the pipe
|
||||
*
|
||||
* @return {@code true} if items were simulated successfully being added
|
||||
*/
|
||||
boolean canAddItemsToPipe( TileEntity te, ItemStack is, EnumFacing dir );
|
||||
|
||||
/**
|
||||
* checks weather if the {@code te} is injectable, simulates the inject and tries to inject the item
|
||||
*
|
||||
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
|
||||
* @param is to be injected item
|
||||
* @param dir direction of the pipe
|
||||
*
|
||||
* @return {@code true} if items were added to the buildcraft pipe
|
||||
*/
|
||||
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull EnumFacing dir );
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.ic2;
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
@@ -1,29 +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.integration.abstraction;
|
||||
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
|
||||
public interface ICLApi
|
||||
{
|
||||
|
||||
int colorLight( AEColor color, int light );
|
||||
}
|
||||
@@ -1,33 +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.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.storage.IMEInventory;
|
||||
|
||||
|
||||
public interface IDSU
|
||||
{
|
||||
|
||||
IMEInventory getDSU( TileEntity te );
|
||||
|
||||
boolean isDSU( TileEntity te );
|
||||
}
|
||||
@@ -1,46 +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.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.storage.IMEInventory;
|
||||
|
||||
|
||||
public interface IFZ
|
||||
{
|
||||
|
||||
ItemStack barrelGetItem( TileEntity te );
|
||||
|
||||
int barrelGetMaxItemCount( TileEntity te );
|
||||
|
||||
int barrelGetItemCount( TileEntity te );
|
||||
|
||||
void setItemType( TileEntity te, ItemStack input );
|
||||
|
||||
void barrelSetCount( TileEntity te, int max );
|
||||
|
||||
IMEInventory getFactorizationBarrel( TileEntity te );
|
||||
|
||||
boolean isBarrel( TileEntity te );
|
||||
|
||||
void grinderRecipe( ItemStack is, ItemStack itemStack );
|
||||
}
|
||||
@@ -1,29 +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.integration.abstraction;
|
||||
|
||||
|
||||
import appeng.api.features.IItemComparisonProvider;
|
||||
|
||||
|
||||
public interface IForestry
|
||||
{
|
||||
|
||||
IItemComparisonProvider getGeneticsComparisonProvider();
|
||||
}
|
||||
@@ -1,33 +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.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.storage.IMEInventory;
|
||||
|
||||
|
||||
public interface IGT
|
||||
{
|
||||
|
||||
boolean isQuantumChest( TileEntity te );
|
||||
|
||||
IMEInventory getQuantumChest( TileEntity te );
|
||||
}
|
||||
@@ -20,11 +20,29 @@ package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.modules.ic2.IC2PowerSinkStub;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
public interface IIC2
|
||||
public interface IIC2 extends IIntegrationModule
|
||||
{
|
||||
|
||||
void maceratorRecipe( ItemStack in, ItemStack out );
|
||||
default void maceratorRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an IC2 power sink for the given external sink.
|
||||
*/
|
||||
default IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) {
|
||||
return IC2PowerSinkStub.INSTANCE;
|
||||
}
|
||||
|
||||
class Stub extends IIntegrationModule.Stub implements IIC2
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +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.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
||||
|
||||
public interface IImmibisMicroblocks
|
||||
{
|
||||
|
||||
IPartHost getOrCreateHost( EntityPlayer player, int side, TileEntity te );
|
||||
|
||||
/**
|
||||
* @param te to be left tile entity
|
||||
*
|
||||
* @return true if this worked..
|
||||
*/
|
||||
boolean leaveParts( TileEntity te );
|
||||
}
|
||||
@@ -21,9 +21,19 @@ package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public interface IInvTweaks
|
||||
|
||||
public interface IInvTweaks extends IIntegrationModule
|
||||
{
|
||||
|
||||
int compareItems( ItemStack i, ItemStack j );
|
||||
default int compareItems( ItemStack i, ItemStack j )
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
class Stub extends IIntegrationModule.Stub implements IInvTweaks
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,43 @@
|
||||
/*
|
||||
* 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.integration.abstraction;
|
||||
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
|
||||
/**
|
||||
* Abstracts access to the JEI API functionality.
|
||||
*/
|
||||
public interface IJEI
|
||||
public interface IJEI extends IIntegrationModule
|
||||
{
|
||||
|
||||
boolean isEnabled();
|
||||
default String getSearchText()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
String getSearchText();
|
||||
default void setSearchText( String searchText )
|
||||
{
|
||||
}
|
||||
|
||||
void setSearchText( String searchText );
|
||||
class Stub extends IIntegrationModule.Stub implements IJEI
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +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.integration.abstraction;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.storage.IMEInventory;
|
||||
|
||||
|
||||
public interface ILP
|
||||
{
|
||||
|
||||
List<ItemStack> getCraftedItems( TileEntity te );
|
||||
|
||||
List<ItemStack> getProvidedItems( TileEntity te );
|
||||
|
||||
boolean isRequestPipe( TileEntity te );
|
||||
|
||||
List<ItemStack> performRequest( TileEntity te, ItemStack wanted );
|
||||
|
||||
IMEInventory getInv( TileEntity te );
|
||||
|
||||
Object getGetPowerPipe( TileEntity te );
|
||||
|
||||
boolean isPowerSource( TileEntity tt );
|
||||
|
||||
boolean canUseEnergy( Object pp, int ceil, List<Object> providersToIgnore );
|
||||
|
||||
boolean useEnergy( Object pp, int ceil, List<Object> providersToIgnore );
|
||||
}
|
||||
@@ -21,11 +21,21 @@ package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public interface IMekanism
|
||||
|
||||
public interface IMekanism extends IIntegrationModule
|
||||
{
|
||||
|
||||
void addCrusherRecipe( ItemStack in, ItemStack out );
|
||||
default void addCrusherRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
}
|
||||
|
||||
void addEnrichmentChamberRecipe( ItemStack in, ItemStack out );
|
||||
default void addEnrichmentChamberRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
}
|
||||
|
||||
class Stub extends IIntegrationModule.Stub implements IMekanism
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,16 @@ package appeng.integration.abstraction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
public interface IRC
|
||||
|
||||
public interface IRC extends IIntegrationModule
|
||||
{
|
||||
|
||||
void rockCrusher( ItemStack input, ItemStack output );
|
||||
default void rockCrusher( ItemStack input, ItemStack output ) {
|
||||
}
|
||||
|
||||
class Stub extends IIntegrationModule.Stub implements IRC {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,38 +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.integration.abstraction;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
|
||||
public interface ITE
|
||||
{
|
||||
|
||||
void addPulverizerRecipe( int i, ItemStack blkQuartz, ItemStack blockDust );
|
||||
|
||||
void addPulverizerRecipe( int i, ItemStack blkQuartzOre, ItemStack matQuartz, ItemStack matQuartzDust );
|
||||
|
||||
boolean isPipe( TileEntity te, AEPartLocation opposite );
|
||||
|
||||
ItemStack addItemsToPipe( TileEntity ad, ItemStack itemstack, AEPartLocation dir );
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package appeng.integration.modules;
|
||||
|
||||
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IJEI;
|
||||
import appeng.integration.modules.jei.NullJEI;
|
||||
|
||||
|
||||
public class JEI implements IIntegrationModule
|
||||
{
|
||||
|
||||
@Reflected
|
||||
public static JEI instance;
|
||||
|
||||
private IJEI jei = new NullJEI();
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setJei( IJEI jei )
|
||||
{
|
||||
this.jei = jei;
|
||||
}
|
||||
|
||||
public IJEI getJei()
|
||||
{
|
||||
return jei;
|
||||
}
|
||||
|
||||
}
|
||||
+8
-25
@@ -16,11 +16,9 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
package appeng.integration.modules.ic2;
|
||||
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -29,36 +27,21 @@ import ic2.api.recipe.RecipeInputItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
import appeng.integration.modules.ic2.IC2PowerSink;
|
||||
import appeng.integration.modules.ic2.IC2PowerSinkAdapter;
|
||||
import appeng.integration.modules.ic2.IC2PowerSinkStub;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
public class IC2 implements IIntegrationModule, IIC2
|
||||
public class IC2Module implements IIC2
|
||||
{
|
||||
|
||||
@Reflected
|
||||
public static IC2 instance;
|
||||
|
||||
public IC2()
|
||||
public IC2Module()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
|
||||
}
|
||||
|
||||
private static BiFunction<TileEntity, IExternalPowerSink, IC2PowerSink> powerSinkFactory = ( ( te, sink ) -> IC2PowerSinkStub.INSTANCE );
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
powerSinkFactory = IC2PowerSinkAdapter::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
@@ -76,7 +59,7 @@ public class IC2 implements IIntegrationModule, IIC2
|
||||
reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER );
|
||||
}
|
||||
|
||||
public ItemStack getItem( final String name )
|
||||
private ItemStack getItem( final String name )
|
||||
{
|
||||
return ic2.api.item.IC2Items.getItem( name );
|
||||
}
|
||||
@@ -84,9 +67,10 @@ public class IC2 implements IIntegrationModule, IIC2
|
||||
/**
|
||||
* Create an IC2 power sink for the given external sink.
|
||||
*/
|
||||
public static IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
|
||||
@Override
|
||||
public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
|
||||
{
|
||||
return powerSinkFactory.apply( tileEntity, externalSink );
|
||||
return new IC2PowerSinkAdapter( tileEntity, externalSink );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,5 +78,4 @@ public class IC2 implements IIntegrationModule, IIC2
|
||||
{
|
||||
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import ic2.api.energy.prefab.BasicSink;
|
||||
import ic2.api.energy.tile.IEnergyEmitter;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
package appeng.integration.modules.ic2;
|
||||
|
||||
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of IC2PowerSink that just stubs out all methods and does nothing.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
+30
-12
@@ -16,25 +16,43 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.parts.CableBusContainer;
|
||||
import appeng.integration.abstraction.IJEI;
|
||||
|
||||
|
||||
public interface IFMP
|
||||
public class JEIModule implements IJEI
|
||||
{
|
||||
|
||||
IPartHost getOrCreateHost( TileEntity tile );
|
||||
private IJEI jei = new IJEI.Stub();
|
||||
|
||||
CableBusContainer getCableContainer( TileEntity te );
|
||||
public void setJei( IJEI jei )
|
||||
{
|
||||
this.jei = jei;
|
||||
}
|
||||
|
||||
void registerPassThrough( Class<?> layerInterface );
|
||||
public IJEI getJei()
|
||||
{
|
||||
return jei;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchText()
|
||||
{
|
||||
return jei.getSearchText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchText( String searchText )
|
||||
{
|
||||
jei.setSearchText( searchText );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return jei.isEnabled();
|
||||
}
|
||||
|
||||
Event newFMPPacketEvent( EntityPlayerMP sender );
|
||||
}
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
@@ -26,9 +44,7 @@ import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.modules.JEI;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
|
||||
|
||||
@@ -180,7 +196,7 @@ public class JEIPlugin extends BlankModPlugin
|
||||
@Override
|
||||
public void onRuntimeAvailable( IJeiRuntime jeiRuntime )
|
||||
{
|
||||
JEI jeiModule = (JEI) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.JEI );
|
||||
JEIModule jeiModule = (JEIModule) Integrations.jei();
|
||||
jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import appeng.integration.abstraction.IJEI;
|
||||
|
||||
|
||||
public class NullJEI implements IJEI
|
||||
{
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchText()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchText( String searchText )
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* 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.integration.modules.jei;
|
||||
|
||||
|
||||
|
||||
+3
-13
@@ -16,7 +16,7 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules;
|
||||
package appeng.integration.modules.waila;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
@@ -24,21 +24,15 @@ import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import appeng.integration.modules.waila.PartWailaDataProvider;
|
||||
import appeng.integration.modules.waila.TileWailaDataProvider;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class Waila implements IIntegrationModule
|
||||
public class WailaModule implements IIntegrationModule
|
||||
{
|
||||
@Reflected
|
||||
public static Waila instance;
|
||||
|
||||
@Reflected
|
||||
public Waila()
|
||||
public WailaModule()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class );
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class );
|
||||
@@ -67,8 +61,4 @@ public class Waila implements IIntegrationModule
|
||||
FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -80,10 +80,14 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
final NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
final byte usedChannels = this.getUsedChannels( part, tag, this.cache );
|
||||
final byte maxChannels = (byte) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
||||
|
||||
final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels );
|
||||
currentToolTip.add( formattedToolTip );
|
||||
if( usedChannels >= 0 )
|
||||
{
|
||||
final byte maxChannels = (byte) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
||||
|
||||
final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels );
|
||||
currentToolTip.add( formattedToolTip );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
@@ -116,7 +120,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
}
|
||||
else
|
||||
{
|
||||
usedChannels = 0;
|
||||
usedChannels = -1;
|
||||
}
|
||||
|
||||
return usedChannels;
|
||||
|
||||
+9
-5
@@ -92,12 +92,16 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
final NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
final long internalCurrentPower = this.getInternalCurrentPower( tag, te );
|
||||
final long internalMaxPower = (long) ( 100 * maxPower );
|
||||
|
||||
final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
|
||||
final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
|
||||
if( internalCurrentPower >= 0 )
|
||||
{
|
||||
final long internalMaxPower = (long) ( 100 * maxPower );
|
||||
|
||||
currentToolTip.add( WailaText.Contains.getLocal() + ": " + formatCurrentPower + " / " + formatMaxPower );
|
||||
final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
|
||||
final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
|
||||
|
||||
currentToolTip.add( WailaText.Contains.getLocal() + ": " + formatCurrentPower + " / " + formatMaxPower );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +166,7 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
}
|
||||
else
|
||||
{
|
||||
internalCurrentPower = 0;
|
||||
internalCurrentPower = -1;
|
||||
}
|
||||
|
||||
return internalCurrentPower;
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -49,13 +48,9 @@ import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
|
||||
@@ -110,16 +105,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
}
|
||||
}
|
||||
|
||||
boolean enabled = true;
|
||||
for( final AEFeature f : mat.getFeature() )
|
||||
{
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
}
|
||||
|
||||
for( final IntegrationType integrationType : mat.getIntegrations() )
|
||||
{
|
||||
enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType );
|
||||
}
|
||||
boolean enabled = mat.isEnabled();
|
||||
|
||||
final int partDamage = mat.getBaseDamage() + varID;
|
||||
final ActivityState state = ActivityState.from( enabled );
|
||||
|
||||
@@ -37,9 +37,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
@@ -57,6 +59,7 @@ import appeng.parts.networking.PartCableGlass;
|
||||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCable;
|
||||
import appeng.parts.networking.PartQuartzFiber;
|
||||
import appeng.parts.p2p.PartP2PIC2Power;
|
||||
import appeng.parts.p2p.PartP2PItems;
|
||||
import appeng.parts.p2p.PartP2PLight;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
@@ -222,8 +225,15 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
// P2PTunnelEU( 465, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), EnumSet.of( IntegrationType.IC2 ),
|
||||
// PartP2PIC2Power.class, GuiText.EUTunnel ),
|
||||
P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), EnumSet.of( IntegrationType.IC2 ),
|
||||
PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||
{
|
||||
@Override
|
||||
String getUnlocalizedName()
|
||||
{
|
||||
return "P2PTunnel";
|
||||
}
|
||||
},
|
||||
|
||||
// P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), EnumSet.of( IntegrationType.RF ),
|
||||
// PartP2PRFPower.class, GuiText.RFTunnel ),
|
||||
@@ -249,6 +259,7 @@ public enum PartType
|
||||
@SideOnly( Side.CLIENT )
|
||||
private List<ModelResourceLocation> itemModels;
|
||||
private final Set<ResourceLocation> models;
|
||||
private final boolean enabled;
|
||||
private Constructor<? extends IPart> constructor;
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
|
||||
@@ -263,16 +274,34 @@ public enum PartType
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
this.myPart = c;
|
||||
this.extraName = en;
|
||||
if ( Platform.isClient() )
|
||||
|
||||
// The part is enabled if all features + integrations it needs are enabled
|
||||
this.enabled = features.stream().allMatch( AEConfig.instance::isFeatureEnabled )
|
||||
&& integrations.stream().allMatch( IntegrationRegistry.INSTANCE::isEnabled );
|
||||
|
||||
if( enabled )
|
||||
{
|
||||
this.itemModels = createItemModels( itemModel );
|
||||
}
|
||||
if( c != null )
|
||||
{
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
// Only load models if the part is enabled, otherwise we also run into class-loading issues while
|
||||
// scanning for annotations
|
||||
if( Platform.isClientInstall() )
|
||||
{
|
||||
this.itemModels = createItemModels( itemModel );
|
||||
}
|
||||
if( c != null )
|
||||
{
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Platform.isClientInstall() )
|
||||
{
|
||||
this.itemModels = Collections.emptyList();
|
||||
}
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
@@ -289,6 +318,11 @@ public enum PartType
|
||||
return new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "part/" + baseName ), "inventory" );
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
int getBaseDamage()
|
||||
{
|
||||
return this.baseDamage;
|
||||
|
||||
@@ -283,7 +283,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
{
|
||||
return this.disassembleDrive( stack, world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
return this.disassembleDrive( stack, world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,6 +107,10 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
else if( player.isSneaking() )
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( te instanceof INetworkToolAgent && !( (INetworkToolAgent) te ).showNetworkInfo( mop ) )
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
public abstract class AEBasePoweredItem extends AERootPoweredItem
|
||||
public abstract class AEBasePoweredItem extends RedstoneFlux
|
||||
{
|
||||
public AEBasePoweredItem( final double powerCapacity )
|
||||
{
|
||||
|
||||
@@ -146,6 +146,27 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
return currentStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject power into this item using an external unit.
|
||||
*/
|
||||
double injectExternalPower( PowerUnits inputUnit, final ItemStack is, final double amount, final boolean simulate )
|
||||
{
|
||||
if( simulate )
|
||||
{
|
||||
final int requiredExt = (int) PowerUnits.AE.convertTo( inputUnit, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
if( amount < requiredExt )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return amount - requiredExt;
|
||||
}
|
||||
else
|
||||
{
|
||||
final double powerRemainder = this.injectAEPower( is, inputUnit.convertTo( PowerUnits.AE, amount ) );
|
||||
return PowerUnits.AE.convertTo( inputUnit, powerRemainder );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectAEPower( final ItemStack is, final double amt )
|
||||
{
|
||||
|
||||
@@ -19,126 +19,107 @@
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
//import java.util.Optional;
|
||||
//
|
||||
//import net.minecraft.entity.EntityLivingBase;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//import ic2.api.item.IElectricItemManager;
|
||||
//import ic2.api.item.ISpecialElectricItem;
|
||||
//
|
||||
//import appeng.api.config.PowerUnits;
|
||||
//import appeng.integration.IntegrationType;
|
||||
//import appeng.transformer.annotations.Integration.Interface;
|
||||
//import appeng.transformer.annotations.Integration.InterfaceList;
|
||||
//import appeng.transformer.annotations.Integration.Method;
|
||||
//
|
||||
//
|
||||
//@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 ) } )
|
||||
//public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
||||
//{
|
||||
// public IC2( double powerCapacity, Optional<String> subName )
|
||||
// {
|
||||
// super( powerCapacity, subName );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
||||
// {
|
||||
// double addedAmt = amount;
|
||||
// double limit = this.getTransferLimit( is );
|
||||
//
|
||||
// if( !ignoreTransferLimit && amount > limit )
|
||||
// {
|
||||
// addedAmt = limit;
|
||||
// }
|
||||
//
|
||||
// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getCharge( ItemStack is )
|
||||
// {
|
||||
// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canUse( ItemStack is, double amount )
|
||||
// {
|
||||
// return this.getCharge( is ) > amount;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
||||
// {
|
||||
// if( this.canUse( is, amount ) )
|
||||
// {
|
||||
// // use the power..
|
||||
// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
||||
// {
|
||||
// // wtf?
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getToolTip( ItemStack itemStack )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canProvideEnergy( ItemStack itemStack )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Item getChargedItem( ItemStack itemStack )
|
||||
// {
|
||||
// return itemStack.getItem();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Item getEmptyItem( ItemStack itemStack )
|
||||
// {
|
||||
// return itemStack.getItem();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getMaxCharge( ItemStack itemStack )
|
||||
// {
|
||||
// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getTier( ItemStack itemStack )
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getTransferLimit( ItemStack itemStack )
|
||||
// {
|
||||
// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Method( iname = IntegrationType.IC2 )
|
||||
// public IElectricItemManager getManager( ItemStack itemStack )
|
||||
// {
|
||||
// return this;
|
||||
// }
|
||||
// }
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import ic2.api.item.IElectricItemManager;
|
||||
import ic2.api.item.ISpecialElectricItem;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
import appeng.transformer.annotations.Integration.InterfaceList;
|
||||
import appeng.transformer.annotations.Integration.Method;
|
||||
|
||||
|
||||
@InterfaceList( value = {
|
||||
@Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
|
||||
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
|
||||
} )
|
||||
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
||||
{
|
||||
public IC2( double powerCapacity )
|
||||
{
|
||||
super( powerCapacity );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
||||
{
|
||||
double addedAmt = amount;
|
||||
double limit = this.getTransferLimit( is );
|
||||
|
||||
if( !ignoreTransferLimit && amount > limit )
|
||||
{
|
||||
addedAmt = limit;
|
||||
}
|
||||
|
||||
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCharge( ItemStack is )
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse( ItemStack is, double amount )
|
||||
{
|
||||
return this.getCharge( is ) > amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
||||
{
|
||||
if( this.canUse( is, amount ) )
|
||||
{
|
||||
// use the power..
|
||||
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
||||
{
|
||||
// wtf?
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTip( ItemStack itemStack )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge( ItemStack itemStack )
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier( ItemStack itemStack )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
private double getTransferLimit( ItemStack itemStack )
|
||||
{
|
||||
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method( iname = IntegrationType.IC2 )
|
||||
public IElectricItemManager getManager( ItemStack itemStack )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.items.tools.powered.powersink;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
|
||||
|
||||
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
|
||||
public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
|
||||
{
|
||||
public RedstoneFlux( final double powerCapacity )
|
||||
{
|
||||
super( powerCapacity );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy( final ItemStack is, final int maxReceive, final boolean simulate )
|
||||
{
|
||||
return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy( final ItemStack container, final int maxExtract, final boolean simulate )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored( final ItemStack is )
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored( final ItemStack is )
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) );
|
||||
}
|
||||
}
|
||||
@@ -185,9 +185,8 @@ public class NetworkEventBus
|
||||
catch( final Throwable e1 )
|
||||
{
|
||||
AELog.error( "[AppEng] Network Event caused exception:" );
|
||||
AELog.error( "Offending Class: " + obj.getClass().getName() );
|
||||
AELog.error( "Offending Object: " + obj.toString() );
|
||||
AELog.debug( e1 );
|
||||
AELog.error( "Class: %1s, Object: %2s", obj.getClass().getName(), obj.toString() );
|
||||
AELog.info( e1 );
|
||||
throw new IllegalStateException( e1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
@@ -442,23 +444,60 @@ public class CellInventory implements ICellInventory
|
||||
|
||||
final int types = (int) this.getStoredItemTypes();
|
||||
|
||||
for( int x = 0; x < types; x++ )
|
||||
for( int slot = 0; slot < types; slot++ )
|
||||
{
|
||||
final ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( itemSlots[x] ) );
|
||||
if( t != null )
|
||||
{
|
||||
t.stackSize = this.tagCompound.getInteger( itemSlotCount[x] );
|
||||
|
||||
if( t.stackSize > 0 )
|
||||
{
|
||||
this.cellItems.add( AEItemStack.create( t ) );
|
||||
}
|
||||
}
|
||||
NBTTagCompound compoundTag = this.tagCompound.getCompoundTag( itemSlots[slot] );
|
||||
int stackSize = this.tagCompound.getInteger( itemSlotCount[slot] );
|
||||
loadCellItem( compoundTag, stackSize );
|
||||
}
|
||||
|
||||
// cellItems.clean();
|
||||
}
|
||||
|
||||
private void loadCellItem( NBTTagCompound compoundTag, int stackSize )
|
||||
{
|
||||
|
||||
// Now load the item stack
|
||||
final ItemStack t;
|
||||
try
|
||||
{
|
||||
t = ItemStack.loadItemStackFromNBT( compoundTag );
|
||||
if( t == null )
|
||||
{
|
||||
AELog.warn( "Removing item " + compoundTag + " from storage cell because the associated item type couldn't be found." );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch( Throwable ex )
|
||||
{
|
||||
if( AEConfig.instance.removeCrashingItemsOnLoad )
|
||||
{
|
||||
AELog.warn( ex, "Removing item " + compoundTag + " from storage cell because loading the ItemStack crashed." );
|
||||
return;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
t.stackSize = stackSize;
|
||||
|
||||
if( t.stackSize > 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.cellItems.add( AEItemStack.create( t ) );
|
||||
}
|
||||
catch( Throwable ex )
|
||||
{
|
||||
if( AEConfig.instance.removeCrashingItemsOnLoad )
|
||||
{
|
||||
AELog.warn( ex, "Removing item " + t + " from storage cell because processing the loaded item crashed." );
|
||||
return;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList getAvailableItems( final IItemList out )
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ import appeng.api.storage.data.IAEStack;
|
||||
public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
|
||||
{
|
||||
|
||||
private final int oldStatus = 0;
|
||||
private int oldStatus = 0;
|
||||
private final ItemStack is;
|
||||
private final ICellHandler handler;
|
||||
private final IChestOrDrive cord;
|
||||
@@ -52,13 +52,14 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
|
||||
|
||||
final T a = super.injectItems( input, type, src );
|
||||
|
||||
if( a == null || a.getStackSize() != size )
|
||||
if( type == Actionable.MODULATE && ( a == null || a.getStackSize() != size ) )
|
||||
{
|
||||
final int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
|
||||
|
||||
if( newStatus != this.oldStatus )
|
||||
{
|
||||
this.cord.blinkCell( this.getSlot() );
|
||||
this.oldStatus = newStatus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,13 +71,14 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
|
||||
{
|
||||
final T a = super.extractItems( request, type, src );
|
||||
|
||||
if( a != null )
|
||||
if( type == Actionable.MODULATE && a != null )
|
||||
{
|
||||
final int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
|
||||
|
||||
if( newStatus != this.oldStatus )
|
||||
{
|
||||
this.cord.blinkCell( this.getSlot() );
|
||||
this.oldStatus = newStatus;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,9 +70,6 @@ import appeng.client.render.cablebus.FacadeRenderState;
|
||||
import appeng.core.AELog;
|
||||
import appeng.facade.FacadeContainer;
|
||||
import appeng.helpers.AEMultiTile;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.ICLApi;
|
||||
import appeng.me.GridConnection;
|
||||
import appeng.parts.networking.PartCable;
|
||||
import appeng.util.Platform;
|
||||
@@ -904,11 +901,6 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
}
|
||||
}
|
||||
|
||||
if( light > 0 && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.CLApi ) )
|
||||
{
|
||||
return ( (ICLApi) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.CLApi ) ).colorLight( this.getColor(), light );
|
||||
}
|
||||
|
||||
return light;
|
||||
}
|
||||
|
||||
@@ -1261,12 +1253,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
IFacadePart facade = getFacade( side.ordinal() );
|
||||
if( facade != null )
|
||||
{
|
||||
|
||||
ItemStack textureItem = facade.getTextureItem();
|
||||
IBlockState blockState = facade.getBlockState();
|
||||
if( blockState != null )
|
||||
if( blockState != null && textureItem != null )
|
||||
{
|
||||
EnumSet<EnumFacing> openFaces = calculateFaceOpenFaces( side );
|
||||
return new FacadeRenderState( blockState, openFaces );
|
||||
return new FacadeRenderState( blockState, openFaces, textureItem );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,10 +60,6 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.core.sync.packets.PacketPartPlacement;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -198,22 +194,6 @@ public class PartPlacement
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: IFMP INTEGRATION
|
||||
// TODO IIMMIBISMICROBLOCKS INTEGRATION
|
||||
|
||||
/*
|
||||
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
* {
|
||||
* host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
|
||||
* }
|
||||
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled(
|
||||
* IntegrationType.ImmibisMicroblocks ) )
|
||||
* {
|
||||
* host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks )
|
||||
* ).getOrCreateHost( player, face, tile );
|
||||
* }
|
||||
*/
|
||||
|
||||
// if ( held == null )
|
||||
{
|
||||
final Block block = world.getBlockState( pos ).getBlock();
|
||||
@@ -271,23 +251,6 @@ public class PartPlacement
|
||||
host = (IPartHost) tile;
|
||||
}
|
||||
|
||||
// TODO: IFMP INTEGRATION
|
||||
// TODO IIMMIBISMICROBLOCKS INTEGRATION
|
||||
|
||||
/*
|
||||
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
* {
|
||||
* host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile
|
||||
* );
|
||||
* }
|
||||
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled(
|
||||
* IntegrationType.ImmibisMicroblocks ) )
|
||||
* {
|
||||
* host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance(
|
||||
* IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, side, tile );
|
||||
* }
|
||||
*/
|
||||
|
||||
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
|
||||
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
|
||||
final Optional<ItemBlock> maybeMultiPartItemBlock = multiPart.maybeItemBlock();
|
||||
@@ -334,16 +297,8 @@ public class PartPlacement
|
||||
te_pos = pos.offset( side );
|
||||
|
||||
final Block blkID = world.getBlockState( te_pos ).getBlock();
|
||||
tile = world.getTileEntity( te_pos );
|
||||
|
||||
if( tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
|
||||
}
|
||||
|
||||
if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) // /&& side !=
|
||||
// AEPartLocation.INTERNAL
|
||||
// )
|
||||
if( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null )
|
||||
{
|
||||
return place( held, te_pos, side.getOpposite(), player, hand, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
|
||||
}
|
||||
@@ -429,15 +384,6 @@ public class PartPlacement
|
||||
return ( (IFacadeItem) held.getItem() ).createPartFromItemStack( held, side );
|
||||
}
|
||||
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
|
||||
{
|
||||
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
|
||||
if( bc.isFacade( held ) )
|
||||
{
|
||||
return bc.createFacadePart( held, side );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +447,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
|
||||
if( w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ) )
|
||||
{
|
||||
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item.getItemFromBlock( Blocks.REEDS ) ) )
|
||||
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item.getItemFromBlock(
|
||||
Blocks.REEDS ) ) )
|
||||
{
|
||||
final EntityPlayer player = Platform.getPlayer( (WorldServer) w );
|
||||
Platform.configurePlayer( player, side, this.getTile() );
|
||||
@@ -479,17 +480,20 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
|
||||
if( side.xOffset == 0 && side.zOffset == 0 )
|
||||
{
|
||||
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing() ), null, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
|
||||
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing() ), null, side.getFacing().getOpposite(), side.xOffset,
|
||||
side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if( !Worked && side.xOffset == 0 && side.zOffset == 0 )
|
||||
{
|
||||
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing().getOpposite() ), null, side.getFacing(), side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
|
||||
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing().getOpposite() ), null, side.getFacing(), side.xOffset,
|
||||
side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if( !Worked && side.yOffset == 0 )
|
||||
{
|
||||
Worked = i.onItemUse( is, player, w, tePos.offset( EnumFacing.DOWN ), null, EnumFacing.UP, side.xOffset, side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
|
||||
Worked = i.onItemUse( is, player, w, tePos.offset( EnumFacing.DOWN ), null, EnumFacing.UP, side.xOffset, side.yOffset,
|
||||
side.zOffset ) == EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if( !Worked )
|
||||
@@ -529,13 +533,12 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
if( type == Actionable.MODULATE )
|
||||
{
|
||||
|
||||
is.stackSize = (int) maxStorage;
|
||||
final EntityItem ei = new EntityItem( w, // w
|
||||
( ( side.xOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.xOffset * -0.3 + tePos.getX(), // spawn
|
||||
( ( side.yOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.yOffset * -0.3 + tePos.getY(), // spawn
|
||||
( ( side.zOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.zOffset * -0.3 + tePos.getZ(), // spawn
|
||||
is.copy() );
|
||||
final double x = ( side.xOffset != 0 ? 0 : .7 * ( Platform.getRandomFloat() - .5 ) ) + side.xOffset + .5 + te.getPos().getX();
|
||||
final double y = ( side.yOffset != 0 ? 0 : .7 * ( Platform.getRandomFloat() - .5 ) ) + side.yOffset + .5 + te.getPos().getY();
|
||||
final double z = ( side.zOffset != 0 ? 0 : .7 * ( Platform.getRandomFloat() - .5 ) ) + side.zOffset + .5 + te.getPos().getZ();
|
||||
|
||||
final EntityItem ei = new EntityItem( w, x, y, z, is.copy() );
|
||||
|
||||
Entity result = ei;
|
||||
|
||||
|
||||
@@ -1,147 +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.parts.layers;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
public class InvLayerData
|
||||
{
|
||||
|
||||
// a simple empty array for empty stuff..
|
||||
private static final int[] NULL_SIDES = {};
|
||||
|
||||
// cache of inventory state.
|
||||
private final int[][] sides;
|
||||
private final List<ISidedInventory> inventories;
|
||||
private final List<InvSot> slots;
|
||||
|
||||
public InvLayerData( final int[][] a, final List<ISidedInventory> b, final List<InvSot> c )
|
||||
{
|
||||
this.sides = a;
|
||||
this.inventories = b;
|
||||
this.slots = c;
|
||||
}
|
||||
|
||||
public ItemStack decreaseStackSize( final int slot, final int amount )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).decreaseStackSize( amount );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a slot index is valid, prevent crashes from bad code :)
|
||||
*
|
||||
* @param slot slot index
|
||||
*
|
||||
* @return true, if the slot exists.
|
||||
*/
|
||||
boolean isSlotValid( final int slot )
|
||||
{
|
||||
return this.slots != null && slot >= 0 && slot < this.slots.size();
|
||||
}
|
||||
|
||||
int getSizeInventory()
|
||||
{
|
||||
if( this.slots == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.slots.size();
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot( final int slot )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).getStackInSlot();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isItemValidForSlot( final int slot, final ItemStack itemstack )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).isItemValidForSlot( itemstack );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setInventorySlotContents( final int slot, final ItemStack itemstack )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
this.slots.get( slot ).setInventorySlotContents( itemstack );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canExtractItem( final int slot, final ItemStack itemstack, final EnumFacing side )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).canExtractItem( itemstack, side );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canInsertItem( final int slot, final ItemStack itemstack, final EnumFacing side )
|
||||
{
|
||||
if( this.isSlotValid( slot ) )
|
||||
{
|
||||
return this.slots.get( slot ).canInsertItem( itemstack, side );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void markDirty()
|
||||
{
|
||||
if( this.inventories != null )
|
||||
{
|
||||
for( final IInventory inv : this.inventories )
|
||||
{
|
||||
inv.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getSlotsForFace( final EnumFacing side )
|
||||
{
|
||||
if( this.sides == null || side == null )
|
||||
{
|
||||
return NULL_SIDES;
|
||||
}
|
||||
return this.sides[side.ordinal()];
|
||||
}
|
||||
}
|
||||
@@ -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.parts.layers;
|
||||
|
||||
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
public class InvSot
|
||||
{
|
||||
|
||||
private final ISidedInventory partInv;
|
||||
private final int index;
|
||||
|
||||
public InvSot( final ISidedInventory part, final int slot )
|
||||
{
|
||||
this.partInv = part;
|
||||
this.index = slot;
|
||||
}
|
||||
|
||||
public ItemStack decreaseStackSize( final int j )
|
||||
{
|
||||
return this.partInv.decrStackSize( this.index, j );
|
||||
}
|
||||
|
||||
ItemStack getStackInSlot()
|
||||
{
|
||||
return this.partInv.getStackInSlot( this.index );
|
||||
}
|
||||
|
||||
public boolean isItemValidForSlot( final ItemStack itemstack )
|
||||
{
|
||||
return this.partInv.isItemValidForSlot( this.index, itemstack );
|
||||
}
|
||||
|
||||
public void setInventorySlotContents( final ItemStack itemstack )
|
||||
{
|
||||
this.partInv.setInventorySlotContents( this.index, itemstack );
|
||||
}
|
||||
|
||||
public boolean canExtractItem( final ItemStack itemstack, final EnumFacing side )
|
||||
{
|
||||
return this.partInv.canExtractItem( this.index, itemstack, side );
|
||||
}
|
||||
|
||||
public boolean canInsertItem( final ItemStack itemstack, final EnumFacing side )
|
||||
{
|
||||
return this.partInv.canInsertItem( this.index, itemstack, side );
|
||||
}
|
||||
}
|
||||
@@ -19,183 +19,186 @@
|
||||
package appeng.parts.layers;
|
||||
|
||||
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.world.World;
|
||||
//import net.minecraftforge.common.MinecraftForge;
|
||||
//import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
//import ic2.api.energy.tile.IEnergySink;
|
||||
//import ic2.api.energy.tile.IEnergyTile;
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.api.parts.IPartHost;
|
||||
//import appeng.api.parts.LayerBase;
|
||||
//import appeng.api.parts.LayerFlags;
|
||||
//import appeng.api.util.ForgeDirection;
|
||||
//import appeng.util.Platform;
|
||||
//
|
||||
//
|
||||
//public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
//{
|
||||
//
|
||||
// private TileEntity getEnergySinkTile()
|
||||
// {
|
||||
// IPartHost host = (IPartHost) this;
|
||||
// return host.getTile();
|
||||
// }
|
||||
//
|
||||
// private World getEnergySinkWorld()
|
||||
// {
|
||||
// if( this.getEnergySinkTile() == null )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// return this.getEnergySinkTile().getWorld();
|
||||
// }
|
||||
//
|
||||
// private boolean isTileValid()
|
||||
// {
|
||||
// TileEntity te = this.getEnergySinkTile();
|
||||
//
|
||||
// if( te == null )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return !te.isInvalid() && te.getWorld().blockExists( te.xCoord, te.yCoord, te.zCoord );
|
||||
// }
|
||||
//
|
||||
// private void addToENet()
|
||||
// {
|
||||
// if( this.getEnergySinkWorld() == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // re-add
|
||||
// this.removeFromENet();
|
||||
//
|
||||
// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
||||
// {
|
||||
// this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void removeFromENet()
|
||||
// {
|
||||
// if( this.getEnergySinkWorld() == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if( this.isInIC2() && Platform.isServer() )
|
||||
// {
|
||||
// this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private boolean interestedInIC2()
|
||||
// {
|
||||
// if( !( (IPartHost) this ).isInWorld() )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// int interested = 0;
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergyTile )
|
||||
// {
|
||||
// interested++;
|
||||
// }
|
||||
// }
|
||||
// return interested == 1;// if more then one tile is interested we need to abandon...
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void partChanged()
|
||||
// {
|
||||
// super.partChanged();
|
||||
//
|
||||
// if( this.interestedInIC2() )
|
||||
// {
|
||||
// this.addToENet();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.removeFromENet();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction )
|
||||
// {
|
||||
// if( !this.isInIC2() )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// IPart part = this.getPart( direction );
|
||||
// if( part instanceof IEnergySink )
|
||||
// {
|
||||
// return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction );
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// private boolean isInIC2()
|
||||
// {
|
||||
// return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getDemandedEnergy()
|
||||
// {
|
||||
// if( !this.isInIC2() )
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
||||
//
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergySink )
|
||||
// {
|
||||
// // use lower number cause ic2 deletes power it sends that isn't received.
|
||||
// return ( (IEnergySink) part ).getDemandedEnergy();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getSinkTier()
|
||||
// {
|
||||
// return Integer.MAX_VALUE; // no real options here...
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double injectEnergy( ForgeDirection directionFrom, double amount, double voltage )
|
||||
// {
|
||||
// if( !this.isInIC2() )
|
||||
// {
|
||||
// return amount;
|
||||
// }
|
||||
//
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergySink )
|
||||
// {
|
||||
// return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return amount;
|
||||
// }
|
||||
// }
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
import ic2.api.energy.tile.IEnergyEmitter;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.api.parts.LayerFlags;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class LayerIEnergySink extends LayerBase implements IEnergySink
|
||||
{
|
||||
|
||||
private TileEntity getEnergySinkTile()
|
||||
{
|
||||
IPartHost host = (IPartHost) this;
|
||||
return host.getTile();
|
||||
}
|
||||
|
||||
private World getEnergySinkWorld()
|
||||
{
|
||||
if( this.getEnergySinkTile() == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.getEnergySinkTile().getWorld();
|
||||
}
|
||||
|
||||
private boolean isTileValid()
|
||||
{
|
||||
TileEntity te = this.getEnergySinkTile();
|
||||
|
||||
if( te == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !te.isInvalid() && te.getWorld().isBlockLoaded( te.getPos() );
|
||||
}
|
||||
|
||||
private void addToENet()
|
||||
{
|
||||
if( this.getEnergySinkWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// re-add
|
||||
this.removeFromENet();
|
||||
|
||||
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
||||
{
|
||||
this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFromENet()
|
||||
{
|
||||
if( this.getEnergySinkWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isInIC2() && Platform.isServer() )
|
||||
{
|
||||
this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean interestedInIC2()
|
||||
{
|
||||
if( !( (IPartHost) this ).isInWorld() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int interested = 0;
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergyTile )
|
||||
{
|
||||
interested++;
|
||||
}
|
||||
}
|
||||
return interested == 1;// if more then one tile is interested we need to abandon...
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partChanged()
|
||||
{
|
||||
super.partChanged();
|
||||
|
||||
if( this.interestedInIC2() )
|
||||
{
|
||||
this.addToENet();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeFromENet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing direction )
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IPart part = this.getPart( direction );
|
||||
if( part instanceof IEnergySink )
|
||||
{
|
||||
return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInIC2()
|
||||
{
|
||||
return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergySink )
|
||||
{
|
||||
// use lower number cause ic2 deletes power it sends that isn't received.
|
||||
return ( (IEnergySink) part ).getDemandedEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSinkTier()
|
||||
{
|
||||
return Integer.MAX_VALUE; // no real options here...
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergySink )
|
||||
{
|
||||
return ( (IEnergySink) part ).injectEnergy( directionFrom, amount, voltage );
|
||||
}
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,188 +19,189 @@
|
||||
package appeng.parts.layers;
|
||||
|
||||
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.world.World;
|
||||
//import net.minecraftforge.common.MinecraftForge;
|
||||
//import ic2.api.energy.tile.IEnergyEmitter;
|
||||
//import ic2.api.energy.tile.IEnergySink;
|
||||
//import ic2.api.energy.tile.IEnergySource;
|
||||
//import ic2.api.energy.tile.IEnergyTile;
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.api.parts.IPartHost;
|
||||
//import appeng.api.parts.LayerBase;
|
||||
//import appeng.api.parts.LayerFlags;
|
||||
//import appeng.api.util.ForgeDirection;
|
||||
//import appeng.util.Platform;
|
||||
//
|
||||
//
|
||||
//public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
//{
|
||||
//
|
||||
// private TileEntity getEnergySourceTile()
|
||||
// {
|
||||
// IPartHost host = (IPartHost) this;
|
||||
// return host.getTile();
|
||||
// }
|
||||
//
|
||||
// private World getEnergySourceWorld()
|
||||
// {
|
||||
// if( this.getEnergySourceTile() == null )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// return this.getEnergySourceTile().getWorld();
|
||||
// }
|
||||
//
|
||||
// private boolean isTileValid()
|
||||
// {
|
||||
// TileEntity te = this.getEnergySourceTile();
|
||||
// if( te == null )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// return !te.isInvalid();
|
||||
// }
|
||||
//
|
||||
// private void addToENet()
|
||||
// {
|
||||
// if( this.getEnergySourceWorld() == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // re-add
|
||||
// this.removeFromENet();
|
||||
//
|
||||
// if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
||||
// {
|
||||
// this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void removeFromENet()
|
||||
// {
|
||||
// if( this.getEnergySourceWorld() == null )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if( this.isInIC2() && Platform.isServer() )
|
||||
// {
|
||||
// this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
||||
// MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private boolean interestedInIC2()
|
||||
// {
|
||||
// if( !( (IPartHost) this ).isInWorld() )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// int interested = 0;
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergyTile )
|
||||
// {
|
||||
// interested++;
|
||||
// }
|
||||
// }
|
||||
// return interested == 1;// if more then one tile is interested we need to abandon...
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void partChanged()
|
||||
// {
|
||||
// super.partChanged();
|
||||
//
|
||||
// if( this.interestedInIC2() )
|
||||
// {
|
||||
// this.addToENet();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.removeFromENet();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction )
|
||||
// {
|
||||
// if( !this.isInIC2() )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// IPart part = this.getPart( direction );
|
||||
// if( part instanceof IEnergySink )
|
||||
// {
|
||||
// return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction );
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// private boolean isInIC2()
|
||||
// {
|
||||
// return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getOfferedEnergy()
|
||||
// {
|
||||
// if( !this.isInIC2() )
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
||||
//
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergySource )
|
||||
// {
|
||||
// // use lower number cause ic2 deletes power it sends that isn't received.
|
||||
// return ( (IEnergySource) part ).getOfferedEnergy();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawEnergy( double amount )
|
||||
// {
|
||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
||||
//
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergySource )
|
||||
// {
|
||||
// ( (IEnergySource) part ).drawEnergy( amount );
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getSourceTier()
|
||||
// {
|
||||
// // this is a flawed implementation, that requires a change to the IC2 API.
|
||||
//
|
||||
// for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
// {
|
||||
// IPart part = this.getPart( dir );
|
||||
// if( part instanceof IEnergySource )
|
||||
// {
|
||||
// return ( (IEnergySource) part ).getSourceTier();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
import ic2.api.energy.tile.IEnergyEmitter;
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.api.parts.LayerFlags;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class LayerIEnergySource extends LayerBase implements IEnergySource
|
||||
{
|
||||
|
||||
private TileEntity getEnergySourceTile()
|
||||
{
|
||||
IPartHost host = (IPartHost) this;
|
||||
return host.getTile();
|
||||
}
|
||||
|
||||
private World getEnergySourceWorld()
|
||||
{
|
||||
if( this.getEnergySourceTile() == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.getEnergySourceTile().getWorld();
|
||||
}
|
||||
|
||||
private boolean isTileValid()
|
||||
{
|
||||
TileEntity te = this.getEnergySourceTile();
|
||||
return te != null && !te.isInvalid();
|
||||
}
|
||||
|
||||
private void addToENet()
|
||||
{
|
||||
if( this.getEnergySourceWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// re-add
|
||||
this.removeFromENet();
|
||||
|
||||
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
|
||||
{
|
||||
this.getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFromENet()
|
||||
{
|
||||
if( this.getEnergySourceWorld() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isInIC2() && Platform.isServer() )
|
||||
{
|
||||
this.getLayerFlags().remove( LayerFlags.IC2_ENET );
|
||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean interestedInIC2()
|
||||
{
|
||||
if( !( (IPartHost) this ).isInWorld() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int interested = 0;
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergyTile )
|
||||
{
|
||||
interested++;
|
||||
}
|
||||
}
|
||||
return interested == 1;// if more then one tile is interested we need to abandon...
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partChanged()
|
||||
{
|
||||
super.partChanged();
|
||||
|
||||
if( this.interestedInIC2() )
|
||||
{
|
||||
this.addToENet();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeFromENet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing direction )
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IPart part = this.getPart( direction );
|
||||
if( part instanceof IEnergyEmitter )
|
||||
{
|
||||
return ( (IEnergyEmitter) part ).emitsEnergyTo( receiver, direction );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInIC2()
|
||||
{
|
||||
return this.getLayerFlags().contains( LayerFlags.IC2_ENET );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getOfferedEnergy()
|
||||
{
|
||||
if( !this.isInIC2() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergySource )
|
||||
{
|
||||
// use lower number cause ic2 deletes power it sends that isn't received.
|
||||
return ( (IEnergySource) part ).getOfferedEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEnergy( double amount )
|
||||
{
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergySource )
|
||||
{
|
||||
( (IEnergySource) part ).drawEnergy( amount );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceTier()
|
||||
{
|
||||
// this is a flawed implementation, that requires a change to the IC2 API.
|
||||
|
||||
for( EnumFacing dir : EnumFacing.values() )
|
||||
{
|
||||
IPart part = this.getPart( dir );
|
||||
if( part instanceof IEnergySource )
|
||||
{
|
||||
return ( (IEnergySource) part ).getSourceTier();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,100 +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.parts.layers;
|
||||
|
||||
|
||||
//import net.minecraftforge.fluids.FluidStack;
|
||||
//import net.minecraftforge.fluids.FluidTankInfo;
|
||||
//import net.minecraftforge.fluids.IFluidHandler;
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.api.parts.LayerBase;
|
||||
//import appeng.api.util.ForgeDirection;
|
||||
//
|
||||
//
|
||||
//public class LayerIFluidHandler extends LayerBase implements IFluidHandler
|
||||
//{
|
||||
//
|
||||
// private static final FluidTankInfo[] EMPTY_LIST = new FluidTankInfo[0];
|
||||
//
|
||||
// @Override
|
||||
// public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
|
||||
// {
|
||||
// IPart part = this.getPart( from );
|
||||
// if( part instanceof IFluidHandler )
|
||||
// {
|
||||
// return ( (IFluidHandler) part ).fill( from, resource, doFill );
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain )
|
||||
// {
|
||||
// IPart part = this.getPart( from );
|
||||
// if( part instanceof IFluidHandler )
|
||||
// {
|
||||
// return ( (IFluidHandler) part ).drain( from, resource, doDrain );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain )
|
||||
// {
|
||||
// IPart part = this.getPart( from );
|
||||
// if( part instanceof IFluidHandler )
|
||||
// {
|
||||
// return ( (IFluidHandler) part ).drain( from, maxDrain, doDrain );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canFill( ForgeDirection from, net.minecraftforge.fluids.Fluid fluid )
|
||||
// {
|
||||
// IPart part = this.getPart( from );
|
||||
// if( part instanceof IFluidHandler )
|
||||
// {
|
||||
// return ( (IFluidHandler) part ).canFill( from, fluid );
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canDrain( ForgeDirection from, net.minecraftforge.fluids.Fluid fluid )
|
||||
// {
|
||||
// IPart part = this.getPart( from );
|
||||
// if( part instanceof IFluidHandler )
|
||||
// {
|
||||
// return ( (IFluidHandler) part ).canDrain( from, fluid );
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public FluidTankInfo[] getTankInfo( ForgeDirection from )
|
||||
// {
|
||||
// IPart part = this.getPart( from );
|
||||
// if( part instanceof IFluidHandler )
|
||||
// {
|
||||
// return ( (IFluidHandler) part ).getTankInfo( from );
|
||||
// }
|
||||
// return EMPTY_LIST;
|
||||
// }
|
||||
// }
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.parts.layers;
|
||||
|
||||
|
||||
//import buildcraft.api.transport.IPipeConnection;
|
||||
//import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.api.parts.LayerBase;
|
||||
//import appeng.api.util.ForgeDirection;
|
||||
//import appeng.helpers.Reflected;
|
||||
//
|
||||
//
|
||||
//@Reflected
|
||||
//public class LayerIPipeConnection extends LayerBase implements IPipeConnection
|
||||
//{
|
||||
//
|
||||
// @Override
|
||||
// public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
|
||||
// {
|
||||
// IPart part = this.getPart( with );
|
||||
// if( part instanceof IPipeConnection )
|
||||
// {
|
||||
// return ( (IPipeConnection) part ).overridePipeConnection( type, with );
|
||||
// }
|
||||
// return ConnectOverride.DEFAULT;
|
||||
// }
|
||||
// }
|
||||
@@ -1,300 +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.parts.layers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
|
||||
/**
|
||||
* Inventory wrapper for parts,
|
||||
*
|
||||
* this is considerably more complicated then the other wrappers as it requires creating a "unified inventory".
|
||||
*
|
||||
* You must use {@link ISidedInventory} instead of {@link IInventory}.
|
||||
*
|
||||
* If your inventory changes in between placement and removal, you must trigger a PartChange on the {@link IPartHost} so
|
||||
* it can recalculate the inventory wrapper.
|
||||
*/
|
||||
public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
||||
{
|
||||
|
||||
// a simple empty array for empty stuff..
|
||||
private static final int[] NULL_SIDES = {};
|
||||
|
||||
private InvLayerData invLayer = null;
|
||||
|
||||
/**
|
||||
* Recalculate inventory wrapper cache.
|
||||
*/
|
||||
@Override
|
||||
public void notifyNeighbors()
|
||||
{
|
||||
// cache of inventory state.
|
||||
int[][] sideData = null;
|
||||
List<ISidedInventory> inventories = null;
|
||||
List<InvSot> slots = null;
|
||||
|
||||
inventories = new ArrayList<ISidedInventory>();
|
||||
int slotCount = 0;
|
||||
|
||||
for( final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
final IPart bp = this.getPart( side );
|
||||
if( bp instanceof ISidedInventory )
|
||||
{
|
||||
final ISidedInventory part = (ISidedInventory) bp;
|
||||
slotCount += part.getSizeInventory();
|
||||
inventories.add( part );
|
||||
}
|
||||
}
|
||||
|
||||
if( inventories.isEmpty() || slotCount == 0 )
|
||||
{
|
||||
inventories = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
sideData = new int[][] { NULL_SIDES, NULL_SIDES, NULL_SIDES, NULL_SIDES, NULL_SIDES, NULL_SIDES };
|
||||
slots = new ArrayList<InvSot>( Collections.nCopies( slotCount, (InvSot) null ) );
|
||||
|
||||
int offsetForLayer = 0;
|
||||
int offsetForPart = 0;
|
||||
for( final ISidedInventory sides : inventories )
|
||||
{
|
||||
offsetForPart = 0;
|
||||
slotCount = sides.getSizeInventory();
|
||||
|
||||
AEPartLocation currentSide = AEPartLocation.INTERNAL;
|
||||
for( final AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
if( this.getPart( side ) == sides )
|
||||
{
|
||||
currentSide = side;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final int[] cSidesList = sideData[currentSide.ordinal()] = new int[slotCount];
|
||||
for( int cSlot = 0; cSlot < slotCount; cSlot++ )
|
||||
{
|
||||
cSidesList[cSlot] = offsetForLayer;
|
||||
slots.set( offsetForLayer, new InvSot( sides, offsetForPart ) );
|
||||
offsetForLayer++;
|
||||
offsetForPart++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( sideData == null || slots == null )
|
||||
{
|
||||
this.invLayer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.invLayer = new InvLayerData( sideData, inventories, slots );
|
||||
}
|
||||
|
||||
// make sure inventory is updated before we call FMP.
|
||||
super.notifyNeighbors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.invLayer.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot( final int slot )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.invLayer.getStackInSlot( slot );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize( final int slot, final int amount )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.invLayer.decreaseStackSize( slot, amount );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot( final int slot )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents( final int slot, final ItemStack itemstack )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.invLayer.setInventorySlotContents( slot, itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "AEMultiPart";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64; // no options here.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory( final EntityPlayer player )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory( final EntityPlayer player )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int slot, final ItemStack itemstack )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.invLayer.isItemValidForSlot( slot, itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
if( this.invLayer != null )
|
||||
{
|
||||
this.invLayer.markDirty();
|
||||
}
|
||||
|
||||
super.markForSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace( final EnumFacing side )
|
||||
{
|
||||
if( this.invLayer != null )
|
||||
{
|
||||
return this.invLayer.getSlotsForFace( side );
|
||||
}
|
||||
|
||||
return NULL_SIDES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( final int slot, final ItemStack itemstack, final EnumFacing side )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.invLayer.canInsertItem( slot, itemstack, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( final int slot, final ItemStack itemstack, final EnumFacing side )
|
||||
{
|
||||
if( this.invLayer == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.invLayer.canExtractItem( slot, itemstack, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField( final int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField( final int id, final int value )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user