Compare commits

..

12 Commits

Author SHA1 Message Date
Uristqwerty c1c3655db6 Cleaned up CraftGuide Integration
A NPE caused to open CraftGuide very slowly (several seconds)

Added Grinder recipes
Added Inscriber recipes

Conflicts:
	src/main/java/appeng/integration/modules/CraftGuide.java
2015-06-09 23:42:03 +02:00
yueh b05796e62b No longer invalidate the cache of MEMonitorIInventory on simulate.
Should fix #1036
2015-06-05 23:06:57 +02:00
thatsIch 200e56a509 Fixes #1536: Checking for all required BC classes 2015-06-01 20:47:04 +02:00
thatsIch 9540bbce49 Merge pull request #1499 from TheJulianJES/patch-5
Changed version from PartStack provider to rv2 (rv3)
2015-05-23 13:52:58 +02:00
TheJulianJES c6d932da04 Changed version from PartStack provider to rv2 (rv3)
because @thatsIch merged it also to rv2
2015-05-23 13:49:52 +02:00
yueh 6e7100361c Fixes #1465 faulty item comparison 2015-05-19 21:16:30 +02:00
TheJulianJES ca50ee0762 Removes default RF tooltip
Removed tab

Did something
2015-05-19 21:16:10 +02:00
TheJulianJES f00d5c297f Parts display correctly in WAILA
Register an method that can be overidden

Register the same method in the interface

New class that picks the item and displays it to WAILA

Register the new class and call the other class method

Import in PartWailaDataProvider

Fixed errors

Renamed all Display -> Stack

Stuff
2015-05-19 21:15:50 +02:00
yueh b13f5ced01 Fixes #1389 Enabled repeatable keyboard events 2015-05-19 21:14:49 +02:00
thatsIch 1c0f1ea243 Merge branch 'rv2' of https://github.com/AppliedEnergistics/Applied-Energistics-2 into rv2 2015-05-19 21:11:26 +02:00
Jeremiah Winsley b612ff47a3 Test with V6e of RotaryCraft
Conflicts:
	gradle.properties
2015-05-19 21:10:08 +02:00
Jeremiah Winsley e8a68cc531 Fixes #1384 - implement AdvancedShaftPowerReceiver for RotaryCraft powersink 2015-05-19 21:08:37 +02:00
16 changed files with 351 additions and 158 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
aeversion=rv2
aechannel=beta
aechannel=stable
aebuild=0
aegroup=appeng
aebasename=appliedenergistics2
@@ -39,7 +39,7 @@ bc_version=6.4.6
# Self Compiled APIs #
#########################################################
mekansim_version=8.0.1.198
rotarycraft_version=V5c
rotarycraft_version=V6e
#########################################################
@@ -22,6 +22,7 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.List;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -218,6 +219,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
@Override
public void initGui()
{
Keyboard.enableRepeatEvents( true );
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
@@ -383,6 +386,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
public void onGuiClosed()
{
super.onGuiClosed();
Keyboard.enableRepeatEvents( false );
memoryText = this.searchField.getText();
}
@@ -85,7 +85,10 @@ public final class WrappedDamageItemDefinition implements ITileDefinition
return false;
}
return this.definition.isSameAs( comparableStack ) && comparableStack.getItemDamage() == this.damage;
final boolean sameItem = this.definition.isSameAs( new ItemStack( comparableStack.getItem() ) );
final boolean sameDamage = comparableStack.getItemDamage() == this.damage;
return sameItem && sameDamage;
}
@Override
@@ -1,6 +1,6 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
* 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
@@ -34,7 +34,10 @@ import cpw.mods.fml.common.event.FMLInterModComms;
import buildcraft.BuildCraftEnergy;
import buildcraft.BuildCraftTransport;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.ISchematicRegistry;
import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicTile;
import buildcraft.api.facades.IFacadeItem;
import buildcraft.api.tools.IToolWrench;
import buildcraft.api.transport.IInjectable;
@@ -68,9 +71,21 @@ public final class BC extends BaseModule implements IBC
public BC()
{
this.testClassExistence( IPipeConnection.class );
this.testClassExistence( ItemFacade.class );
this.testClassExistence( BuildCraftEnergy.class );
this.testClassExistence( BuildCraftTransport.class );
this.testClassExistence( BuilderAPI.class );
this.testClassExistence( IBuilderContext.class );
this.testClassExistence( ISchematicRegistry.class );
this.testClassExistence( IFacadeItem.class );
this.testClassExistence( IToolWrench.class );
this.testClassExistence( IInjectable.class );
this.testClassExistence( IPipeConnection.class );
this.testClassExistence( IPipeTile.class );
this.testClassExistence( ItemFacade.class );
this.testClassExistence( PipeIconProvider.class );
this.testClassExistence( SchematicTile.class );
this.testClassExistence( SchematicBlock.class );
this.testClassExistence( IPipeTile.PipeType.class );
}
@Override
@@ -1,6 +1,6 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
* 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
@@ -21,8 +21,10 @@ package appeng.integration.modules;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
@@ -32,95 +34,173 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
import uristqwerty.CraftGuide.CraftGuideLog;
import uristqwerty.CraftGuide.DefaultRecipeTemplate;
import uristqwerty.CraftGuide.RecipeGeneratorImplementation;
import uristqwerty.CraftGuide.api.ChanceSlot;
import uristqwerty.CraftGuide.api.CraftGuideAPIObject;
import uristqwerty.CraftGuide.api.CraftGuideRecipe;
import uristqwerty.CraftGuide.api.ItemSlot;
import uristqwerty.CraftGuide.api.RecipeGenerator;
import uristqwerty.CraftGuide.api.RecipeProvider;
import uristqwerty.CraftGuide.api.RecipeTemplate;
import uristqwerty.CraftGuide.api.Slot;
import uristqwerty.CraftGuide.api.SlotType;
import uristqwerty.CraftGuide.api.StackInfo;
import uristqwerty.CraftGuide.api.StackInfoSource;
import uristqwerty.gui_craftguide.texture.DynamicTexture;
import uristqwerty.gui_craftguide.texture.TextureClip;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.definitions.IBlocks;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.features.IGrinderEntry;
import appeng.api.features.IInscriberRecipe;
import appeng.api.recipes.IIngredient;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.recipes.game.ShapedRecipe;
import appeng.recipes.game.ShapelessRecipe;
public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider, StackInfoSource, RecipeGenerator
public final class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider
{
private static final int SLOT_SIZE = 16;
private static final int TEXTURE_WIDTH = 79;
private static final int TEXTURE_HEIGHT = 58;
private static final int GRINDER_RATIO = 10000;
private static final Slot[] GRINDER_SLOTS = new ItemSlot[] {
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 41, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ChanceSlot( 59, 12, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ChanceSlot( 59, 30, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ItemSlot( 22, 12, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT ),
new ItemSlot( 22, 30, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT )
};
private static final Slot[] INSCRIBER_SLOTS = new ItemSlot[] {
new ItemSlot( 12, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 50, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ItemSlot( 31, 21, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT )
};
private static final Slot[] SHAPELESS_CRAFTING_SLOTS = new ItemSlot[] {
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
};
private static final Slot[] CRAFTING_SLOTS_OWN_BG = new ItemSlot[] {
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(),
};
private static final Slot[] SMALL_CRAFTING_SLOTS_OWN_BG = new ItemSlot[] {
new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(),
};
private static final Slot[] CRTAFTING_SLOTS = new ItemSlot[] {
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
};
private static final Slot[] SMALL_CRAFTING_SLOTS = new ItemSlot[] {
new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
};
@Reflected
public static CraftGuide instance;
private final Slot[] shapelessCraftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ), new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ), new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
private final Slot[] craftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 3, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 3, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 21, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 39, 39, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
private final Slot[] smallCraftingSlotsOwnBackground = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 30, 12, 16, 16 ).drawOwnBackground(), new ItemSlot( 12, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 30, 30, 16, 16 ).drawOwnBackground(), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(), };
private final Slot[] craftingSlots = new ItemSlot[] { new ItemSlot( 3, 3, 16, 16 ), new ItemSlot( 21, 3, 16, 16 ), new ItemSlot( 39, 3, 16, 16 ), new ItemSlot( 3, 21, 16, 16 ), new ItemSlot( 21, 21, 16, 16 ), new ItemSlot( 39, 21, 16, 16 ), new ItemSlot( 3, 39, 16, 16 ), new ItemSlot( 21, 39, 16, 16 ), new ItemSlot( 39, 39, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
private final Slot[] smallCraftingSlots = new ItemSlot[] { new ItemSlot( 12, 12, 16, 16 ), new ItemSlot( 30, 12, 16, 16 ), new ItemSlot( 12, 30, 16, 16 ), new ItemSlot( 30, 30, 16, 16 ), new ItemSlot( 59, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
private final Slot[] furnaceSlots = new ItemSlot[] { new ItemSlot( 13, 21, 16, 16 ), new ItemSlot( 50, 21, 16, 16, true ).setSlotType( SlotType.OUTPUT_SLOT ), };
RecipeGenerator parent;
@Override
public String getInfo( ItemStack itemStack )
{
// :P
return null;
}
@Override
public void generateRecipes( RecipeGenerator generator )
{
this.parent = generator;
RecipeTemplate craftingTemplate;
RecipeTemplate smallCraftingTemplate;
final RecipeTemplate craftingTemplate;
final RecipeTemplate smallTemplate;
if( uristqwerty.CraftGuide.CraftGuide.newerBackgroundStyle )
{
craftingTemplate = generator.createRecipeTemplate( this.craftingSlotsOwnBackground, null );
smallCraftingTemplate = generator.createRecipeTemplate( this.smallCraftingSlotsOwnBackground, null );
craftingTemplate = generator.createRecipeTemplate( CRAFTING_SLOTS_OWN_BG, null );
smallTemplate = generator.createRecipeTemplate( SMALL_CRAFTING_SLOTS_OWN_BG, null );
}
else
{
craftingTemplate = new DefaultRecipeTemplate( this.craftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, 79, 58 ) );
final TextureClip craftingBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final TextureClip craftingSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT );
craftingTemplate = new DefaultRecipeTemplate( CRTAFTING_SLOTS, RecipeGeneratorImplementation.workbench, craftingBG, craftingSelected );
smallCraftingTemplate = new DefaultRecipeTemplate( this.smallCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, 79, 58 ) );
final TextureClip smallBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final TextureClip smallSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT );
smallTemplate = new DefaultRecipeTemplate( SMALL_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, smallBG, smallSelected );
}
RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( this.shapelessCraftingSlots, RecipeGeneratorImplementation.workbench, new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, 79, 58 ) );
final TextureClip shapelessBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final TextureClip shapelessSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( SHAPELESS_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, shapelessBG, shapelessSelected );
RecipeTemplate furnaceTemplate = new DefaultRecipeTemplate( this.furnaceSlots, new ItemStack( Blocks.furnace ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 181, 79, 58 ), new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 181, 79, 58 ) );
this.addCraftingRecipes( craftingTemplate, smallTemplate, shapelessTemplate, generator );
this.addCraftingRecipes( craftingTemplate, smallCraftingTemplate, shapelessTemplate, this );
this.addGrinderRecipes( furnaceTemplate, this );
this.addInscriberRecipes( furnaceTemplate, this );
final IAppEngApi api = AEApi.instance();
final IBlocks aeBlocks = api.definitions().blocks();
final Optional<ItemStack> grindstone = aeBlocks.grindStone().maybeStack( 1 );
final Optional<ItemStack> inscriber = aeBlocks.inscriber().maybeStack( 1 );
if( grindstone.isPresent() )
{
this.addGrinderRecipes( api, grindstone.get(), generator );
}
if( inscriber.isPresent() )
{
this.addInscriberRecipes( api, inscriber.get(), generator );
}
}
@SuppressWarnings( "unchecked" )
private List<IRecipe> getUncheckedRecipes()
{
return (List<IRecipe>) CraftingManager.getInstance().getRecipeList();
}
private void addCraftingRecipes( RecipeTemplate template, RecipeTemplate templateSmall, RecipeTemplate templateShapeless, RecipeGenerator generator )
{
List recipes = CraftingManager.getInstance().getRecipeList();
final List<IRecipe> recipes = this.getUncheckedRecipes();
int errCount = 0;
for( Object o : recipes )
for( IRecipe recipe : recipes )
{
try
{
IRecipe recipe = (IRecipe) o;
Object[] items = generator.getCraftingRecipe( recipe, true );
final Object[] items = this.getCraftingRecipe( recipe, true );
if( items == null )
{
continue;
}
if( items.length == 5 )
{
generator.addRecipe( templateSmall, items );
@@ -138,8 +218,7 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
{
if( errCount >= 5 )
{
CraftGuideLog.log( "CraftGuide DefaultRecipeProvider: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log", true );
errCount = -1;
CraftGuideLog.log( "AppEng CraftGuide integration: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log", true );
}
else
{
@@ -152,61 +231,49 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
}
}
private void addGrinderRecipes( RecipeTemplate template, RecipeGenerator generator )
private void addGrinderRecipes( IAppEngApi api, ItemStack grindstone, RecipeGenerator generator )
{
final ItemStack handle = api.definitions().blocks().crankHandle().maybeStack( 1 ).orNull();
final RecipeTemplate grinderTemplate = generator.createRecipeTemplate( GRINDER_SLOTS, grindstone );
for( IGrinderEntry recipe : api.registries().grinder().getRecipes() )
{
generator.addRecipe( grinderTemplate, new Object[] {
recipe.getInput(),
recipe.getOutput(),
new Object[] {
recipe.getOptionalOutput(),
(int) ( recipe.getOptionalChance() * GRINDER_RATIO )
},
new Object[] {
recipe.getSecondOptionalOutput(),
(int) ( recipe.getOptionalChance() * GRINDER_RATIO )
},
handle,
grindstone
} );
}
}
private void addInscriberRecipes( RecipeTemplate template, RecipeGenerator generator )
private void addInscriberRecipes( IAppEngApi api, ItemStack inscriber, RecipeGenerator generator )
{
final RecipeTemplate inscriberTemplate = generator.createRecipeTemplate( INSCRIBER_SLOTS, inscriber );
for( IInscriberRecipe recipe : api.registries().inscriber().getRecipes() )
{
generator.addRecipe( inscriberTemplate, new Object[] {
recipe.getInputs(),
recipe.getTopOptional().orNull(),
recipe.getBottomOptional().orNull(),
recipe.getOutput(),
inscriber
} );
}
}
@Override
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType )
private Object[] getCraftingShapelessRecipe( List<?> items, ItemStack recipeOutput )
{
return this.parent.createRecipeTemplate( slots, craftingType );
}
@Override
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY, int backgroundSelectedX, int backgroundSelectedY )
{
return this.parent.createRecipeTemplate( slots, craftingType, backgroundTexture, backgroundX, backgroundY, backgroundSelectedX, backgroundSelectedY );
}
@Override
public RecipeTemplate createRecipeTemplate( Slot[] slots, ItemStack craftingType, String backgroundTexture, int backgroundX, int backgroundY, String backgroundSelectedTexture, int backgroundSelectedX, int backgroundSelectedY )
{
return this.parent.createRecipeTemplate( slots, craftingType, backgroundTexture, backgroundX, backgroundY, backgroundSelectedTexture, backgroundSelectedX, backgroundSelectedY );
}
@Override
public void addRecipe( RecipeTemplate template, Object[] crafting )
{
this.parent.addRecipe( template, crafting );
}
@Override
public void addRecipe( CraftGuideRecipe recipe, ItemStack craftingType )
{
this.parent.addRecipe( recipe, craftingType );
}
@Override
public void setDefaultTypeVisibility( ItemStack type, boolean visible )
{
this.parent.setDefaultTypeVisibility( type, visible );
}
@Override
public Object[] getCraftingRecipe( IRecipe recipe )
{
return this.getCraftingRecipe( recipe, true );
}
Object[] getCraftingShapelessRecipe( List items, ItemStack recipeOutput )
{
Object[] output = new Object[10];
final Object[] output = new Object[10];
for( int i = 0; i < items.size(); i++ )
{
@@ -235,18 +302,19 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
}
output[9] = recipeOutput;
return output;
}
Object[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
private Object[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
{
Object[] output = new Object[5];
final Object[] output = new Object[5];
for( int y = 0; y < height; y++ )
{
for( int x = 0; x < width; x++ )
{
int i = y * 2 + x;
final int i = y * 2 + x;
output[i] = items[y * width + x];
if( output[i] instanceof ItemStack[] )
@@ -273,18 +341,19 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
}
output[4] = recipeOutput;
return output;
}
Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
private Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
{
Object[] output = new Object[10];
final Object[] output = new Object[10];
for( int y = 0; y < height; y++ )
{
for( int x = 0; x < width; x++ )
{
int i = y * 3 + x;
final int i = y * 3 + x;
output[i] = items[y * width + x];
if( output[i] instanceof ItemStack[] )
@@ -311,12 +380,13 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
}
output[9] = recipeOutput;
return output;
}
private Object toCG( ItemStack[] itemStackSet )
{
List<ItemStack> list = Arrays.asList( itemStackSet );
final List<ItemStack> list = Arrays.asList( itemStackSet );
for( int x = 0; x < list.size(); x++ )
{
@@ -330,19 +400,20 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
return list;
}
@Override
public Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid )
@Nullable
private Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid )
{
if( recipe instanceof ShapelessRecipe )
{
List items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" );
final List<Object> items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" );
return this.getCraftingShapelessRecipe( items, recipe.getRecipeOutput() );
}
else if( recipe instanceof ShapedRecipe )
{
int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" );
int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" );
Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" );
final int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" );
final int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" );
final Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" );
if( allowSmallGrid && width < 3 && height < 3 )
{
@@ -360,7 +431,6 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
@Override
public void init() throws Throwable
{
StackInfo.addSource( this );
}
@Override
@@ -28,7 +28,8 @@ public class RotaryCraft extends BaseModule
public RotaryCraft()
{
this.testClassExistence( Reika.RotaryCraft.API.Power.ShaftPowerReceiver.class );
this.testClassExistence( Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver.class );
this.testClassExistence( Reika.RotaryCraft.API.Interfaces.Transducerable.class );
}
@Override
@@ -38,6 +38,7 @@ public class Waila extends BaseModule
{
final IWailaDataProvider partHost = new PartWailaDataProvider();
registrar.registerStackProvider( partHost, AEBaseTile.class );
registrar.registerBodyProvider( partHost, AEBaseTile.class );
registrar.registerNBTProvider( partHost, AEBaseTile.class );
@@ -38,6 +38,7 @@ import appeng.api.parts.IPart;
import appeng.integration.modules.waila.part.ChannelWailaDataProvider;
import appeng.integration.modules.waila.part.IPartWailaDataProvider;
import appeng.integration.modules.waila.part.PartAccessor;
import appeng.integration.modules.waila.part.PartStackWailaDataProvider;
import appeng.integration.modules.waila.part.PowerStateWailaDataProvider;
import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider;
import appeng.integration.modules.waila.part.Tracer;
@@ -75,13 +76,32 @@ public final class PartWailaDataProvider implements IWailaDataProvider
final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
this.providers = Lists.newArrayList( channel, storageMonitor, powerState );
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack );
}
@Override
public ItemStack getWailaStack( IWailaDataAccessor accessor, IWailaConfigHandler config )
{
final TileEntity te = accessor.getTileEntity();
final MovingObjectPosition mop = accessor.getPosition();
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
ItemStack wailaStack = null;
for( IPartWailaDataProvider provider : this.providers )
{
wailaStack = provider.getWailaStack( part, config, wailaStack );
}
return wailaStack;
}
return null;
}
@@ -22,6 +22,7 @@ package appeng.integration.modules.waila.part;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -41,6 +42,12 @@ import appeng.api.parts.IPart;
*/
public abstract class BasePartWailaDataProvider implements IPartWailaDataProvider
{
@Override
public ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack )
{
return null;
}
@Override
public List<String> getWailaHead( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
@@ -22,6 +22,7 @@ package appeng.integration.modules.waila.part;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -41,6 +42,8 @@ import appeng.api.parts.IPart;
*/
public interface IPartWailaDataProvider
{
ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack );
List<String> getWailaHead( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
List<String> getWailaBody( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
@@ -0,0 +1,42 @@
/*
* 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.modules.waila.part;
import appeng.api.parts.IPart;
import appeng.api.parts.PartItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import net.minecraft.item.ItemStack;
/**
* Part ItemStack provider for WAILA
*
* @author TheJulianJES
* @version rv2
* @since rv2
*/
public class PartStackWailaDataProvider extends BasePartWailaDataProvider {
@Override
public ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack )
{
partStack = part.getItemStack( PartItemStack.Pick );
return partStack;
}
}
@@ -29,6 +29,7 @@ import net.minecraft.world.World;
import gnu.trove.map.TObjectLongMap;
import gnu.trove.map.hash.TObjectLongHashMap;
import mcp.mobius.waila.api.ITaggedList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -76,6 +77,9 @@ public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
@Override
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
//Removes RF tooltip on WAILA 1.5.9+
((ITaggedList<String, String>) currentToolTip).removeEntries("RFEnergyStorage");
final TileEntity te = accessor.getTileEntity();
if( te instanceof IAEPowerStorage )
{
@@ -86,7 +86,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
out = this.adaptor.addItems( input.getItemStack() );
}
this.onTick();
if( type == Actionable.MODULATE )
{
this.onTick();
}
if( out == null )
{
@@ -122,7 +125,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
IAEItemStack o = request.copy();
o.setStackSize( out.stackSize );
this.onTick();
if( type == Actionable.MODULATE )
{
this.onTick();
}
return o;
}
@@ -92,7 +92,7 @@ public final class DisassembleRecipe implements IRecipe
{
// needs a single input in the recipe
itemCount++;
if ( itemCount > 1 )
if( itemCount > 1 )
{
return MISMATCHED_STACK;
}
@@ -19,20 +19,25 @@
package appeng.tile.powersink;
import appeng.transformer.annotations.Integration;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import Reika.RotaryCraft.API.Power.ShaftPowerReceiver;
import Reika.RotaryCraft.API.Interfaces.Transducerable;
import Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver;
import appeng.api.config.PowerUnits;
import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
import java.util.ArrayList;
@Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Power.ShaftPowerReceiver" )
public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
@InterfaceList( value = { @Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver" ), @Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Interfaces.Transducerable") } )
public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerReceiver, Transducerable
{
private int omega = 0;
@@ -40,16 +45,32 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
private long power = 0;
private int alpha = 0;
private long currentPower = 0;
@TileEvent( TileEventType.TICK )
@Method( iname = "RotaryCraft" )
public void Tick_RotaryCraft()
{
if( this.worldObj != null && !this.worldObj.isRemote && this.power > 0 )
if( this.worldObj != null && !this.worldObj.isRemote && this.currentPower > 0 )
{
this.injectExternalPower( PowerUnits.WA, this.power );
this.injectExternalPower( PowerUnits.WA, this.currentPower );
this.currentPower = 0;
}
}
@Override
public final boolean addPower( int torque, int omega, long power, ForgeDirection side )
{
this.omega = omega;
this.torque = torque;
this.power = power;
this.currentPower += power;
return true;
}
@Override
public final int getOmega()
{
@@ -86,37 +107,6 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
this.alpha = io;
}
@Override
public final void setPower( long p )
{
if( Platform.isClient() )
{
return;
}
this.power = p;
}
@Override
public final void noInputMachine()
{
this.power = 0;
this.torque = 0;
this.omega = 0;
}
@Override
public final void setTorque( int t )
{
this.torque = t;
}
@Override
public final void setOmega( int o )
{
this.omega = o;
}
public final boolean canReadFromBlock( int x, int y, int z )
{
ForgeDirection side = ForgeDirection.UNKNOWN;
@@ -164,6 +154,33 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
@Override
public final int getMinTorque( int available )
{
return 0;
return 1;
}
@Override
public final ArrayList<String> getMessages( World world, int x, int y, int z, int side )
{
String out;
if( power >= 1000000000 )
{
out = String.format( "Receiving %.3f GW @ %d rad/s.", power / 1000000000.0D, omega );
}
else if( power >= 1000000 )
{
out = String.format( "Receiving %.3f MW @ %d rad/s.", power / 1000000.0D, omega );
}
else if( power >= 1000 )
{
out = String.format( "Receiving %.3f kW @ %d rad/s.", power / 1000.0D, omega );
}
else
{
out = String.format( "Receiving %d W @ %d rad/s.", power, omega );
}
ArrayList<String> messages = new ArrayList<String>( 1 );
messages.add( out );
return messages;
}
}
+4 -4
View File
@@ -1863,15 +1863,15 @@ public class Platform
return null;
}
public static boolean isSameItemType( ItemStack ol, ItemStack op )
public static boolean isSameItemType( ItemStack that, ItemStack other )
{
if( ol != null && op != null && ol.getItem() == op.getItem() )
if( that != null && other != null && that.getItem() == other.getItem() )
{
if( ol.isItemStackDamageable() )
if( that.isItemStackDamageable() )
{
return true;
}
return ol.getItemDamage() == ol.getItemDamage();
return that.getItemDamage() == other.getItemDamage();
}
return false;
}