Compare commits

..

32 Commits

Author SHA1 Message Date
yueh 77bb28ded6 Fixes #2585: Hide WAILA data when it cannot be retrieved. (#2586) 2016-11-06 20:28:36 +01:00
shartte 0e7981d717 Cleaning Up Mod Integrations (#2581)
* Cleaned up unused Mod integrations other than for mods that are likely to be integrated soon.
* Introduced an easier Facade class to access mod integration abstractions (called Integrations).
* Removed the link between IntegrationType and integration abstraction. Integrations are now explicitly instantiated inside of IntegrationNode.
2016-11-06 20:23:14 +01:00
Sebastian Hartte fbb0c05c7f Fixes #2577: Use the item stacks color handler to color tinted quads of the block model. 2016-11-06 03:35:56 +01:00
Sebastian Hartte efa0ab7e4e Fixes #2582: Right-Clicking with a Storage Cell would prevent further interaction even if the storage cell wasn't being disassembled. 2016-11-06 02:17:25 +01:00
yueh 70fe5189e0 Followup #2556, #2579: Prevent negative stacksizes. 2016-11-05 23:38:57 +01:00
Sebastian Hartte 3a8d6d0bcd Simplified handling of rotations inside getCapability() for TileInscriber. 2016-11-05 23:33:24 +01:00
yueh 7ac817e9ae Fixes #2556, #2579: Restore old click behaviour. 2016-11-05 23:28:27 +01:00
Sebastian Hartte 0ceb4765a2 Fixes #2580: The inscriber's rotation is not taken into account when returning the IItemHandler capability. 2016-11-05 23:27:52 +01:00
yueh 7ce9654402 Merge pull request #2576 from AppliedEnergistics/fix-2575
Fixes #2575: Removed ITickable from AEBaseTile
2016-11-05 22:07:59 +01:00
yueh 5328627d7a Fixes #2575: Removed ITickable from AEBaseTile
Removed TileEventType.TICK, use ITickable when really needed.
The few tiles needing to tick and are not a grid tile now implement ITickable.
Charger is no longer implementing ITickable.
2016-11-05 21:43:49 +01:00
yueh fe1a67ffaa Reduced drive update rate. (#2574)
Limits drive updates to modulate.
Code cleanup of the TileDrive.
2016-11-05 19:28:09 +01:00
shartte 4253d659f1 Add Config to Remove Crashing Items from Storage Cells (#2573)
Added a configuration option to enable players to recover their world if any of their items in storage cause crashes on load.
2016-11-05 13:50:54 +01:00
Sebastian Hartte b3560aaa00 Fixes #2571: Only call getDurabilityForDisplay if the item is damageable. 2016-11-05 12:58:15 +01:00
yueh 005392911d Fixed DriverWatcher constantly calling blinkCell instead when changed. 2016-11-05 00:11:02 +01:00
Sebastian Hartte 7f02562e0c Fixes sidedness issues when starting up the server. 2016-11-04 21:02:10 +01:00
yueh 84bc00fa20 Fixes #2567: Use heightmap for very low sea levels. 2016-11-04 16:13:27 +01:00
Sebastian Hartte c1483d87c7 Fixes #2549: A block being rendered in the translucent layer will cause the item renderer to completely disable depth-writing causing silly looking models when held in hand. 2016-11-04 11:51:24 +01:00
shartte f5e4a202cb Layers and IC2 Tunnel (#2565)
* Re-Activated the IC2 layers to implement an IC2 P2P tunnel.
2016-11-04 11:20:56 +01:00
yueh 6f15c2921a Fixes #2561: Do not use unchecked casts for IContainerListener. 2016-11-04 09:40:21 +01:00
DeadSix27 d891e5da15 Made memory card messages more clearly. (#2511)
* Made Memory card messages more clearly and easier to understand for newcomers.
2016-11-04 09:31:52 +01:00
Alexey Krainev 6607c8cd2f Updated russion translation (#2552)
* Added "P2P Waila Text"
* Changed "NEI to JEI"
2016-11-04 09:29:25 +01:00
yueh 1e20086799 Extracts item comparison from Platform into their own helper. (#2555)
* Extracts item comparison from Platform into their own helper.

Renamed methods to be more more fitting for the actual comparison.
Added documentation about each methods behaviour.
2016-11-04 09:27:52 +01:00
Sebastian Hartte f85ab7ddc2 Fixes Macerator recipes when IC2 integration is enabled. 2016-11-02 23:45:22 +01:00
Sebastian Hartte c3700737c3 Re-enables this IF-branch for ore dictionary tokens in the recipe files, which was inactive due to the recipe files all using lower-case verbs. 2016-11-02 23:34:04 +01:00
Sebastian Hartte 2f8013a49b Fixes registration of recipes when one of the recipes throws an unexpected unchecked exception during registration. Before, the registration would simply cancel and not log any errors in this case. Fixes issues with outdated IC2 integration (Macerator recipes) causing certain recipes to become non-functional. 2016-11-02 23:32:20 +01:00
Sebastian Hartte af54883fd3 Fixes #2558: Make Sky Stone Chest TESR more robust against odd world state, as Vanilla also does. 2016-11-02 20:44:50 +01:00
thatsIch 223a210d49 Replaced reference to FMLCommonHandler EventBus through MinecraftForge.EVENT_BUS due to deprecation notice 2016-11-02 14:22:00 +01:00
thatsIch c133e4f0ef Removed tickhandler registration from FMLCommonHandler EventBus since they same to MinecraftForge.EVENT_BUS 2016-11-02 14:14:51 +01:00
thatsIch 424d27b71c Removed github tag badge because this only works with SemVer in release format v1.0.0 for example and without any trailing information like "-alpha" 2016-11-02 13:42:24 +01:00
Sebastian Hartte 2fe5a3cef8 Fixes #2557: Made facades much more robust when rendering. Facades now use string ids for the base item in NBT again to avoid issues when loading worlds with a different Item ID registry mapping. In addition, we don't store the Block metadata instead of the Item Damage anymore, since when reading a facade back in, we were using that block metadata as the item damage, which is technically incorrect. 2016-11-02 01:43:01 +01:00
yueh a3c33d5323 Fixed typo in prioritylist. 2016-11-01 16:15:05 +01:00
yueh e927c27b85 Fixes #2554: Extract identical item not any equal one. 2016-11-01 15:51:38 +01:00
182 changed files with 2695 additions and 3668 deletions
-1
View File
@@ -1,5 +1,4 @@
[![Travis](https://img.shields.io/travis/AppliedEnergistics/Applied-Energistics-2.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/AppliedEnergistics/Applied-Energistics-2)
[![Latest Tag](https://img.shields.io/github/tag/AppliedEnergistics/Applied-Energistics-2.svg?label=Latest Tag&style=flat-square)](https://github.com/AppliedEnergistics/Applied-Energistics-2/tags)
[![Latest Release](https://img.shields.io/github/release/AppliedEnergistics/Applied-Energistics-2.svg?label=Latest Release&style=flat-square)](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases)
# Applied Energistics 2
-1
View File
@@ -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
-29
View File
@@ -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();
@@ -300,7 +300,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
for( final ItemStack ol : itemDropCandidates )
{
if( Platform.isSameItemType( ol, op ) )
if( Platform.itemComparisons().isEqualItemType( ol, op ) )
{
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
if( tag != null )
@@ -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;
}
@@ -217,7 +217,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 );
@@ -317,7 +317,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 +325,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 +369,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 +409,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 +445,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 +455,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;
@@ -848,6 +848,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();
}
}
+3 -4
View File
@@ -37,11 +37,11 @@ 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;
import appeng.util.prioitylist.IPartitionList;
import appeng.util.prioritylist.IPartitionList;
public class ItemRepo
@@ -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;
@@ -22,6 +22,7 @@ package appeng.client.render.cablebus;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -35,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;
@@ -59,13 +59,14 @@ 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;
private final BlockRendererDispatcher blockRendererDispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
private static final Set<ResourceLocation> warnedFor = new HashSet<>();
FacadeBuilder( VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
this.format = format;
@@ -83,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 );
@@ -100,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
@@ -116,27 +117,52 @@ 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 );
}
}
}
}
catch( Exception e )
{
if( warnedFor.add( state.getBlock().getRegistryName() ) )
{
AELog.warn( "Unable to get facade sprite for blockstate %s. Supressing further warnings for this block.", state );
AELog.debug( e );
}
}
finally
{
ForgeHooksClient.setRenderLayer( orgLayer );
}
// Fall back to the particle texture, if we havent found anything else so far.
if( firstFound == null )
{
try
{
return new TextureAtlasAndTint( blockModel.getParticleTexture(), -1 );
}
catch( Exception e )
{
if( warnedFor.add( state.getBlock().getRegistryName() ) )
{
AELog.warn( "Unable to get facade sprite particle texture fallback for blockstate %s. Supressing further warnings for this block.", state );
AELog.debug( e );
}
}
}
return firstFound;
}
@@ -186,36 +212,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 );
}
}
@@ -431,4 +463,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 );
}
}
@@ -19,6 +19,7 @@
package appeng.client.render.tesr;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@@ -70,14 +71,8 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
}
else
{
if( te != null )
{
this.bindTexture( ( (BlockSkyChest) te.getBlockType() ).type == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
}
else
{
this.bindTexture( TEXTURE_BLOCK );
}
SkyChestType chestType = getChestType( te );
this.bindTexture( chestType == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
}
GlStateManager.pushMatrix();
@@ -128,4 +123,20 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
}
}
// Defensively determine the sky chest type
private static SkyChestType getChestType( TileSkyChest te )
{
if( te == null )
{
return SkyChestType.BLOCK;
}
Block blockType = te.getBlockType();
if( blockType instanceof BlockSkyChest )
{
return ( (BlockSkyChest) blockType ).type;
}
return SkyChestType.BLOCK;
}
}
@@ -227,7 +227,7 @@ public abstract class AEBaseContainer extends Container
final ItemStack a = stack == null ? null : stack.getItemStack();
final ItemStack b = this.clientRequestedTargetItem == null ? null : this.clientRequestedTargetItem.getItemStack();
if( Platform.isSameItemPrecise( a, b ) )
if( Platform.itemComparisons().isSameItem( a, b ) )
{
return;
}
@@ -438,13 +438,11 @@ public abstract class AEBaseContainer extends Container
if( Platform.isServer() )
{
for( final Object crafter : this.listeners )
for( final IContainerListener listener : this.listeners )
{
final IContainerListener IContainerListener = (IContainerListener) crafter;
for( final SyncData sd : this.syncData.values() )
{
sd.tick( IContainerListener );
sd.tick( listener );
}
}
}
@@ -545,7 +543,7 @@ public abstract class AEBaseContainer extends Container
if( !( cs.isPlayerSide() ) && cs instanceof SlotFake )
{
if( Platform.isSameItemPrecise( destination, tis ) )
if( Platform.itemComparisons().isSameItem( destination, tis ) )
{
break;
}
@@ -577,7 +575,7 @@ public abstract class AEBaseContainer extends Container
{
final ItemStack t = d.getStack();
if( Platform.isSameItemPrecise( tis, t ) ) // t.isItemEqual(tis))
if( Platform.itemComparisons().isSameItem( tis, t ) ) // t.isItemEqual(tis))
{
int maxSize = t.getMaxStackSize();
if( maxSize > d.getSlotStackLimit() )
@@ -629,7 +627,7 @@ public abstract class AEBaseContainer extends Container
{
final ItemStack t = d.getStack();
if( Platform.isSameItemPrecise( t, tis ) )
if( Platform.itemComparisons().isSameItem( t, tis ) )
{
int maxSize = t.getMaxStackSize();
if( d.getSlotStackLimit() < maxSize )
@@ -795,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 ) )
{
@@ -929,7 +927,7 @@ public abstract class AEBaseContainer extends Container
{
liftQty = 0;
}
if( !Platform.isSameItemPrecise( slotItem.getItemStack(), item ) )
if( !Platform.itemComparisons().isSameItem( slotItem.getItemStack(), item ) )
{
liftQty = 0;
}
@@ -26,6 +26,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
@@ -151,22 +152,24 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
this.setValidContainer( false );
}
for( final Object crafter : this.listeners )
for( final IContainerListener listener : this.listeners )
{
final IContainerListener IContainerListener = (IContainerListener) crafter;
if( this.prevStack != is )
{
// if the bars changed an item was probably made, so just send shit!
for( final Object s : this.inventorySlots )
for( final Slot s : this.inventorySlots )
{
if( s instanceof OptionalSlotRestrictedInput )
{
final OptionalSlotRestrictedInput sri = (OptionalSlotRestrictedInput) s;
IContainerListener.sendSlotContents( this, sri.slotNumber, sri.getStack() );
listener.sendSlotContents( this, sri.slotNumber, sri.getStack() );
}
}
( (EntityPlayerMP) IContainerListener ).isChangingQuantityOnly = false;
if( listener instanceof EntityPlayerMP )
{
( (EntityPlayerMP) listener ).isChangingQuantityOnly = false;
}
}
}
@@ -115,7 +115,7 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
{
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
{
if( Platform.isSameItemPrecise( optional, is ) )
if( Platform.itemComparisons().isSameItem( optional, is ) )
{
return false;
}
@@ -126,18 +126,18 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
final boolean matchA = ( top == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( top, recipe.getTopOptional().orElse( null ) ) ) && // and...
( bot == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( bot, recipe.getBottomOptional().orElse( null ) ) );
final boolean matchA = ( top == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( null ) ) ) && // and...
( bot == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( bot, recipe.getBottomOptional().orElse( null ) ) );
final boolean matchB = ( bot == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( bot, recipe.getTopOptional().orElse( null ) ) ) && // and...
( top == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( top, recipe.getBottomOptional().orElse( null ) ) );
final boolean matchB = ( bot == null && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot, recipe.getTopOptional().orElse( null ) ) ) && // and...
( top == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.itemComparisons().isSameItem( top, recipe.getBottomOptional().orElse( null ) ) );
if( matchA || matchB )
{
matches = true;
for( final ItemStack option : recipe.getInputs() )
{
if( Platform.isSameItemPrecise( is, option ) )
if( Platform.itemComparisons().isSameItem( is, option ) )
{
found = true;
}
@@ -174,13 +174,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
boolean isValid = false;
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
if( Platform.isSameItemPrecise( recipe.getTopOptional().orElse( null ), otherSlot ) )
if( Platform.itemComparisons().isSameItem( recipe.getTopOptional().orElse( null ), otherSlot ) )
{
isValid = Platform.isSameItemPrecise( is, recipe.getBottomOptional().orElse( null ) );
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( null ) );
}
else if( Platform.isSameItemPrecise( recipe.getBottomOptional().orElse( null ), otherSlot ) )
else if( Platform.itemComparisons().isSameItem( recipe.getBottomOptional().orElse( null ), otherSlot ) )
{
isValid = Platform.isSameItemPrecise( is, recipe.getTopOptional().orElse( null ) );
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( null ) );
}
if( isValid )
@@ -67,7 +67,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
{
if( currentItem != null )
{
if( Platform.isSameItem( this.civ.getItemStack(), currentItem ) )
if( Platform.itemComparisons().isEqualItem( this.civ.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.civ.getItemStack() );
}
@@ -72,7 +72,7 @@ public class ContainerNetworkTool extends AEBaseContainer
{
if( currentItem != null )
{
if( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
}
@@ -200,7 +200,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
if( output != null && !this.isPattern( output ) )
{
return;
}// if nothing is there we should snag a new pattern.
} // if nothing is there we should snag a new pattern.
else if( output == null )
{
output = this.patternSlotIN.getStack();
@@ -414,7 +414,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
final IRecipe rr = Platform.findMatchingRecipe( real, p.worldObj );
if( rr == r && Platform.isSameItemPrecise( rr.getCraftingResult( real ), is ) )
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
{
final SlotCrafting sc = new SlotCrafting( p, real, this.cOut, 0, 0, 0 );
sc.onPickupFromSlot( p, is );
@@ -483,19 +483,19 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( s == this.patternSlotOUT && Platform.isServer() )
{
for( final Object crafter : this.listeners )
for( final IContainerListener listener : this.listeners )
{
final IContainerListener IContainerListener = (IContainerListener) crafter;
for( final Object g : this.inventorySlots )
for( final Slot slot : this.inventorySlots )
{
if( g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix )
if( slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix )
{
final Slot sri = (Slot) g;
IContainerListener.sendSlotContents( this, sri.slotNumber, sri.getStack() );
listener.sendSlotContents( this, slot.slotNumber, slot.getStack() );
}
}
( (EntityPlayerMP) IContainerListener ).isChangingQuantityOnly = false;
if( listener instanceof EntityPlayerMP )
{
( (EntityPlayerMP) listener ).isChangingQuantityOnly = false;
}
}
this.detectAndSendChanges();
}
@@ -79,7 +79,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
{
if( currentItem != null )
{
if( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
}
@@ -168,11 +168,10 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
this.wirelessOut.putStack( term );
// update the two slots in question...
for( final Object crafter : this.listeners )
for( final IContainerListener listener : this.listeners )
{
final IContainerListener IContainerListener = (IContainerListener) crafter;
IContainerListener.sendSlotContents( this, this.wirelessIn.slotNumber, this.wirelessIn.getStack() );
IContainerListener.sendSlotContents( this, this.wirelessOut.slotNumber, this.wirelessOut.getStack() );
listener.sendSlotContents( this, this.wirelessIn.slotNumber, this.wirelessIn.getStack() );
listener.sendSlotContents( this, this.wirelessOut.slotNumber, this.wirelessOut.getStack() );
}
}
}
@@ -235,7 +235,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{
if( currentItem != null )
{
if( Platform.isSameItem( this.tbInventory.getItemStack(), currentItem ) )
if( Platform.itemComparisons().isEqualItem( this.tbInventory.getItemStack(), currentItem ) )
{
this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
}
@@ -158,7 +158,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
// update crafting matrix...
ItemStack is = this.getStack();
if( is != null && Platform.isSameItem( request, is ) )
if( is != null && Platform.itemComparisons().isEqualItem( request, is ) )
{
final ItemStack[] set = new ItemStack[this.getPattern().getSizeInventory()];
@@ -170,7 +170,7 @@ public class SlotRestrictedInput extends AppEngSlot
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
{
if( Platform.isSameItemPrecise( optional, i ) )
if( Platform.itemComparisons().isSameItem( optional, i ) )
{
return true;
}
@@ -258,7 +258,7 @@ public class SlotRestrictedInput extends AppEngSlot
public static boolean isMetalIngot( final ItemStack i )
{
if( Platform.isSameItemPrecise( i, new ItemStack( Items.IRON_INGOT ) ) )
if( Platform.itemComparisons().isSameItem( i, new ItemStack( Items.IRON_INGOT ) ) )
{
return true;
}
@@ -267,7 +267,7 @@ public class SlotRestrictedInput extends AppEngSlot
{
for( final ItemStack ingot : OreDictionary.getOres( "ingot" + name ) )
{
if( Platform.isSameItemPrecise( i, ingot ) )
if( Platform.itemComparisons().isSameItem( i, ingot ) )
{
return true;
}
+5 -2
View File
@@ -25,10 +25,10 @@ import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -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;
@@ -113,7 +114,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
super( configFile );
this.configFile = configFile;
FMLCommonHandler.instance().bus().register( this );
MinecraftForge.EVENT_BUS.register( this );
final double DEFAULT_IC2_EXCHANGE = 2.0;
PowerUnits.EU.conversionRatio = this.get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE );
@@ -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 );
+7 -15
View File
@@ -22,7 +22,6 @@ package appeng.core;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
@@ -30,7 +29,6 @@ import com.google.common.base.Preconditions;
import net.minecraft.world.DimensionType;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@@ -65,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;
@@ -86,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;
@@ -216,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 );
@@ -248,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 ) )
// {
@@ -267,7 +262,6 @@ public final class Registration
// "li.cil.oc.api.network.SidedEnvironment" );
// }
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
@@ -300,7 +294,7 @@ public final class Registration
this.recipeHandler.injectRecipes();
final PlayerStatsRegistration registration = new PlayerStatsRegistration( FMLCommonHandler.instance().bus(), AEConfig.instance );
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance );
registration.registerAchievementHandlers();
registration.registerAchievements();
@@ -337,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
+139 -75
View File
@@ -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;
@@ -73,7 +73,7 @@ public class ItemDefinition implements IItemDefinition
@Override
public final boolean isSameAs( final ItemStack comparableStack )
{
return isEnabled() && Platform.isSameItemType( comparableStack, this.maybeStack( 1 ).get() );
return isEnabled() && Platform.itemComparisons().isEqualItemType( comparableStack, this.maybeStack( 1 ).get() );
}
}
@@ -125,7 +125,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
{
for( final IGrinderEntry gr : this.recipes )
{
if( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
if( Platform.itemComparisons().isSameItem( gr.getInput(), appEngGrinderRecipe.getInput() ) )
{
return;
}
@@ -151,7 +151,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
{
for( final IGrinderEntry r : this.recipes )
{
if( Platform.isSameItem( input, r.getInput() ) )
if( Platform.itemComparisons().isEqualItem( input, r.getInput() ) )
{
this.log( "Recipe for " + input.getUnlocalizedName() + " found " + Platform.getItemDisplayName( r.getOutput() ) );
return r;
@@ -52,7 +52,7 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
{
for( final ItemStack o : this.DamageModifiers.keySet() )
{
if( Platform.isSameItem( o, is ) )
if( Platform.itemComparisons().isEqualItem( o, is ) )
{
return this.DamageModifiers.get( o ).floatValue();
}
@@ -146,7 +146,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
return this.tunnels.get( is );
}
if( Platform.isSameItem( is, trigger ) )
if( Platform.itemComparisons().isEqualItem( is, trigger ) )
{
return this.tunnels.get( is );
}
@@ -37,6 +37,8 @@ public enum TickRates
Inscriber( 1, 1 ),
Charger( 10, 120 ),
IOPort( 1, 5 ),
VibrationChamber( 10, 40 ),
@@ -54,7 +54,7 @@ public class AchievementCraftingHandler
switch( achievement.getType() )
{
case Craft:
if( Platform.isSameItemPrecise( achievement.getStack(), event.crafting ) )
if( Platform.itemComparisons().isSameItem( achievement.getStack(), event.crafting ) )
{
achievement.addToPlayer( event.player );
return;
@@ -54,7 +54,7 @@ public class AchievementPickupHandler
for( final Achievements achievement : Achievements.values() )
{
if( achievement.getType() == AchievementType.Pickup && Platform.isSameItemPrecise( achievement.getStack(), is ) )
if( achievement.getType() == AchievementType.Pickup && Platform.itemComparisons().isSameItem( achievement.getStack(), is ) )
{
achievement.addToPlayer( event.player );
return;
@@ -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 ),
@@ -59,7 +59,7 @@ import appeng.items.storage.ItemViewCell;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.IPartitionList;
import appeng.util.prioritylist.IPartitionList;
public class PacketJEIRecipe extends AppEngPacket
@@ -167,7 +167,7 @@ public class PacketJEIRecipe extends AppEngPacket
final ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
testInv.setInventorySlotContents( x, patternItem );
if( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
if( newItemStack == null || !Platform.itemComparisons().isSameItem( newItemStack, is ) )
{
final IAEItemStack in = AEItemStack.create( currentItem );
if( in != null )
@@ -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() )
{
@@ -119,12 +119,12 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
final ItemStack other = ( (EntityItem) e ).getEntityItem();
if( other != null && other.stackSize > 0 )
{
if( Platform.isSameItem( other, new ItemStack( Items.REDSTONE ) ) )
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.REDSTONE ) ) )
{
redstone = (EntityItem) e;
}
if( Platform.isSameItem( other, new ItemStack( Items.QUARTZ ) ) )
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.QUARTZ ) ) )
{
netherQuartz = (EntityItem) e;
}
@@ -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 ) ) );
}
}
}
}
}
}
@@ -245,7 +245,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
{
final ItemStack testOutput = this.standardRecipe.getCraftingResult( this.testFrame );
if( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
if( Platform.itemComparisons().isSameItem( this.correctOutput, testOutput ) )
{
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
@@ -256,7 +256,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
{
final ItemStack testOutput = CraftingManager.getInstance().findMatchingRecipe( this.testFrame, w );
if( Platform.isSameItemPrecise( this.correctOutput, testOutput ) )
if( Platform.itemComparisons().isSameItem( this.correctOutput, testOutput ) )
{
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
@@ -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 );
}
@@ -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 );
}
@@ -22,15 +22,27 @@ 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 addToEnergyNet( TileEntity appEngTile );
default void maceratorRecipe( ItemStack in, ItemStack out )
{
}
void removeFromEnergyNet( TileEntity appEngTile );
/**
* Create an IC2 power sink for the given external sink.
*/
default IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) {
return IC2PowerSinkStub.INSTANCE;
}
ItemStack getItem( String string );
class Stub extends IIntegrationModule.Stub implements IIC2
{
void maceratorRecipe( ItemStack in, ItemStack out );
}
}
@@ -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,60 +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.modules;
import java.util.function.BiFunction;
import net.minecraft.tileentity.TileEntity;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
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
{
@Reflected
public static IC2 instance;
private static BiFunction<TileEntity, IExternalPowerSink, IC2PowerSink> powerSinkFactory = ( ( te, sink ) -> IC2PowerSinkStub.INSTANCE );
@Override
public void init() throws Throwable
{
powerSinkFactory = IC2PowerSinkAdapter::new;
}
@Override
public void postInit()
{
}
/**
* Create an IC2 power sink for the given external sink.
*/
public static IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
{
return powerSinkFactory.apply( tileEntity, externalSink );
}
}
@@ -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;
}
}
@@ -0,0 +1,81 @@
/*
* 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.ic2;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import ic2.api.recipe.RecipeInputItemStack;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IC2PowerSink;
import appeng.integration.abstraction.IIC2;
import appeng.tile.powersink.IExternalPowerSink;
public class IC2Module implements IIC2
{
public IC2Module()
{
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
}
@Override
public void postInit()
{
final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
reg.addNewAttunement( this.getItem( "copperCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedCopperCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "goldCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedGoldCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "ironCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedIronCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedTinCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "glassFiberCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "tinCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "detectorCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER );
}
private ItemStack getItem( final String name )
{
return ic2.api.item.IC2Items.getItem( name );
}
/**
* Create an IC2 power sink for the given external sink.
*/
@Override
public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
{
return new IC2PowerSinkAdapter( tileEntity, externalSink );
}
@Override
public void maceratorRecipe( ItemStack in, ItemStack out )
{
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;
@@ -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;
@@ -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;
@@ -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;
@@ -38,6 +38,7 @@ import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
@@ -57,6 +58,9 @@ import appeng.items.AEBaseItem;
public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassItem
{
private static final String TAG_ITEM_ID = "item";
private static final String TAG_DAMAGE = "damage";
private List<ItemStack> subTypes = null;
public ItemFacade()
@@ -107,6 +111,10 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
try
{
final Item item = Item.getItemFromBlock( b );
if( item == null )
{
continue;
}
final List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
@@ -184,10 +192,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
final ItemStack is = new ItemStack( this );
final NBTTagCompound data = new NBTTagCompound();
final int[] ds = new int[2];
ds[0] = Item.getIdFromItem( l.getItem() );
ds[1] = metadata;
data.setIntArray( "x", ds );
data.setString( TAG_ITEM_ID, l.getItem().getRegistryName().toString() );
data.setInteger( TAG_DAMAGE, l.getItemDamage() );
is.setTagCompound( data );
return is;
}
@@ -216,22 +222,39 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return null;
}
// First item is numeric item id, second is damage
int[] ids = nbt.getIntArray( "x" );
ResourceLocation itemId;
int itemDamage;
if( ids.length != 2 )
// Handle legacy facades
if( nbt.hasKey( "x" ) )
{
return null;
int[] data = nbt.getIntArray( "x" );
if( data.length != 2 )
{
return null;
}
Item item = Item.REGISTRY.getObjectById( data[0] );
if ( item == null ) {
return null;
}
itemId = item.getRegistryName();
itemDamage = data[1];
} else {
// First item is numeric item id, second is damage
itemId = new ResourceLocation( nbt.getString( TAG_ITEM_ID ) );
itemDamage = nbt.getInteger( TAG_DAMAGE );
}
Item baseItem = Item.REGISTRY.getObjectById( ids[0] );
Item baseItem = Item.REGISTRY.getObject( itemId );
if( baseItem == null )
{
return null;
}
return new ItemStack( baseItem, 1, ids[1] );
return new ItemStack( baseItem, 1, itemDamage );
}
@@ -253,13 +276,15 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return Blocks.GLASS.getDefaultState();
}
int metadata = baseItemStack.getItem().getMetadata( baseItemStack );
try
{
return block.getStateFromMeta( baseItemStack.getItemDamage() );
return block.getStateFromMeta( metadata );
}
catch( Exception e )
{
AELog.warn( "Block {} has broken getStateFromMeta method for meta {}", block.getRegistryName(), baseItemStack.getItemDamage() );
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getItemDamage() );
return Blocks.GLASS.getDefaultState();
}
@@ -286,8 +311,15 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
ItemStack facadeStack = AEApi.instance().definitions().items().facade().maybeStack( 1 )
.orElseThrow( () -> new MissingDefinition( "Tried to create a facade, while facades are being deactivated." ) );
// Convert back to a registry name...
Item item = Item.REGISTRY.getObjectById( ids[0] );
if ( item == null ) {
return null;
}
final NBTTagCompound facadeTag = new NBTTagCompound();
facadeTag.setIntArray( "x", ids.clone() );
facadeTag.setString( TAG_ITEM_ID, item.getRegistryName().toString() );
facadeTag.setInteger( TAG_DAMAGE, ids[1] );
facadeStack.setTagCompound( facadeTag );
return facadeStack;
+1 -15
View File
@@ -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 );

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