Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e8d554d69d | |||
| 1e15b23506 | |||
| 2ed7a5598a | |||
| 1c05dd5834 | |||
| 632d124359 | |||
| 829c18e2bb | |||
| d3a5be7ed6 | |||
| 217cbf0982 | |||
| 4dd0a4cd96 | |||
| 54c0ce43ea | |||
| bd8f43acbf | |||
| 970630a90d | |||
| 771a944058 | |||
| db1cd8c312 | |||
| 375e1efb15 | |||
| 955fcac92a | |||
| 216e2cb1e3 | |||
| 53f5724657 | |||
| a3269826f9 | |||
| 1a918be658 | |||
| 90130e72aa | |||
| c8f10d92bb | |||
| 548af3c6cc | |||
| 98b9380494 | |||
| bbf4d4a9ce | |||
| 1513ba3f6a | |||
| f03f8ec432 | |||
| e1dcd588b7 | |||
| 8338a7d13e | |||
| b8e685b1b6 | |||
| d84500c5b7 | |||
| a1679c944b | |||
| a3a39201d1 | |||
| d788da687e | |||
| 030e0c6a14 | |||
| 8e4265aa33 | |||
| 80eaa032b9 | |||
| bee9c70497 | |||
| c4fa21c193 | |||
| 8a7450168b | |||
| 7cb641cdc8 | |||
| b5b8050c4c | |||
| e65083b045 | |||
| b61219ef88 | |||
| 4f9fd1b369 | |||
| 630fae3f73 | |||
| 488ef1b544 | |||
| 098ee2f000 | |||
| 04d2b06c0d | |||
| ac48ab02fc | |||
| 9022150e38 | |||
| 65c6d2249a | |||
| 8e7f79a9ea | |||
| 95b48b9438 | |||
| cdd76b7b22 | |||
| 3e2bc0e038 | |||
| eec3e59eea | |||
| e39855b48f | |||
| cdcab7d91c | |||
| 27ad2c2b96 | |||
| 542a2e5d5a | |||
| 3b58f5e8da | |||
| 092afad4a5 | |||
| 6aa810d62a | |||
| 41d98f9944 | |||
| 1b198979fd |
+6
-3
@@ -45,6 +45,12 @@ apply from: 'gradle/scripts/optional.gradle'
|
|||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
// ensure everything uses UTF-8 and not some random codepage chosen by gradle
|
||||||
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
version = aeversion + "-" + aechannel + "-" + aebuild
|
version = aeversion + "-" + aechannel + "-" + aebuild
|
||||||
group = aegroup
|
group = aegroup
|
||||||
archivesBaseName = aebasename
|
archivesBaseName = aebasename
|
||||||
@@ -52,7 +58,6 @@ archivesBaseName = aebasename
|
|||||||
// Add Coremod Manifest
|
// Add Coremod Manifest
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
|
||||||
attributes 'FMLAT': 'appeng_at.cfg'
|
attributes 'FMLAT': 'appeng_at.cfg'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +73,6 @@ jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
coreMod = "appeng.coremod.AppEngCore"
|
|
||||||
|
|
||||||
version = minecraft_version + "-" + forge_version
|
version = minecraft_version + "-" + forge_version
|
||||||
|
|
||||||
replaceIn "AEConfig.java"
|
replaceIn "AEConfig.java"
|
||||||
|
|||||||
+13
-8
@@ -7,20 +7,25 @@ aebasename=appliedenergistics2
|
|||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
minecraft_version=1.12
|
minecraft_version=1.12.1
|
||||||
mcp_mappings=snapshot_20170704
|
mcp_mappings=snapshot_20170811
|
||||||
forge_version=14.21.1.2412
|
forge_version=14.22.1.2478
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Installable #
|
# Installable #
|
||||||
#########################################################
|
#########################################################
|
||||||
hwyla_version=1.8.19-B33_1.12
|
hwyla_version=1.8.20-B35_1.12
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Provided APIs #
|
# Provided APIs #
|
||||||
#########################################################
|
#########################################################
|
||||||
jei_version=4.7.1.69
|
jei_version=4.7.8.95
|
||||||
tesla_version=1.0.61
|
tesla_version=1.0.61
|
||||||
ic2_version=2.8.7-ex112
|
ic2_version=2.8.19-ex112
|
||||||
rf_version=2.0.0.1
|
top_version=1.12-1.4.18-10
|
||||||
top_version=1.12-1.4.8-2
|
|
||||||
|
#########################################################
|
||||||
|
# Deployment #
|
||||||
|
#########################################################
|
||||||
|
website_version=1.12.x
|
||||||
|
curse_versions=1.12,1.12.1
|
||||||
|
|||||||
@@ -69,18 +69,14 @@ dependencies {
|
|||||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||||
// mods "com.github.mcjty:compatlayer:${compatlayer_version}"
|
|
||||||
|
|
||||||
// compile against provided APIs
|
// compile against provided APIs
|
||||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
compileOnly "net.darkhax.tesla:Tesla-${minecraft_version}:${tesla_version}"
|
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
|
||||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||||
|
|
||||||
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
|
||||||
deobfCompile "cofh:RedstoneFlux:${minecraft_version}-${rf_version}:universal"
|
|
||||||
|
|
||||||
// at runtime, use the full JEI jar
|
// at runtime, use the full JEI jar
|
||||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public enum TunnelType
|
|||||||
{
|
{
|
||||||
ME, // Network Tunnel
|
ME, // Network Tunnel
|
||||||
IC2_POWER, // EU Tunnel
|
IC2_POWER, // EU Tunnel
|
||||||
RF_POWER, // RF Tunnel
|
|
||||||
FE_POWER, // Forge Energy tunnel
|
FE_POWER, // Forge Energy tunnel
|
||||||
REDSTONE, // Redstone Tunnel
|
REDSTONE, // Redstone Tunnel
|
||||||
FLUID, // Fluid Tunnel
|
FLUID, // Fluid Tunnel
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ public interface IParts
|
|||||||
|
|
||||||
AEColoredItemDefinition cableGlass();
|
AEColoredItemDefinition cableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDense();
|
AEColoredItemDefinition cableDenseCovered();
|
||||||
|
|
||||||
|
AEColoredItemDefinition cableDenseSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableSmart();
|
AEColoredItemDefinition lumenCableSmart();
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public interface IParts
|
|||||||
|
|
||||||
AEColoredItemDefinition lumenCableGlass();
|
AEColoredItemDefinition lumenCableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableDense();
|
AEColoredItemDefinition lumenDenseCableSmart();
|
||||||
|
|
||||||
IItemDefinition quartzFiber();
|
IItemDefinition quartzFiber();
|
||||||
|
|
||||||
@@ -80,8 +82,6 @@ public interface IParts
|
|||||||
|
|
||||||
IItemDefinition p2PTunnelEU();
|
IItemDefinition p2PTunnelEU();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelRF();
|
|
||||||
|
|
||||||
IItemDefinition p2PTunnelFE();
|
IItemDefinition p2PTunnelFE();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelLight();
|
IItemDefinition p2PTunnelLight();
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 AlgorithmX2
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder for a grinder recipe.
|
||||||
|
*
|
||||||
|
* The only default value provided are turns at a value of 8.
|
||||||
|
*
|
||||||
|
* @author yueh
|
||||||
|
* @version rv5
|
||||||
|
* @since rv5
|
||||||
|
*/
|
||||||
|
public interface IGrinderRecipeBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an grinder recipe with inputs.
|
||||||
|
* Needs to be invoked.
|
||||||
|
*
|
||||||
|
* @param input new input for the recipe
|
||||||
|
*
|
||||||
|
* @return currently used builder
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipeBuilder withInput( @Nonnull ItemStack input );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an grinder recipe with output.
|
||||||
|
* Needs to be invoked.
|
||||||
|
*
|
||||||
|
* @param output new output for the recipe
|
||||||
|
*
|
||||||
|
* @return currently used builder
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipeBuilder withOutput( @Nonnull ItemStack output );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an grinder recipe with the first optional output and its chance.
|
||||||
|
*
|
||||||
|
* @param optional new first optional for the recipe
|
||||||
|
* @param chance chance for the first optional output, must be within 0.0 - 1.0
|
||||||
|
*
|
||||||
|
* @return currently used builder
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipeBuilder withFirstOptional( @Nonnull ItemStack optional, float chance );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an grinder recipe with the second optional output and its chance.
|
||||||
|
*
|
||||||
|
* @param optional new second optional for the recipe
|
||||||
|
* @param chance chance for the second optional output, must be within 0.0 - 1.0
|
||||||
|
*
|
||||||
|
* @return currently used builder
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipeBuilder withSecondOptional( @Nonnull ItemStack optional, float chance );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an grinder recipe with the amount of turns as cost.
|
||||||
|
*
|
||||||
|
* Defaults to 8 when not called.
|
||||||
|
*
|
||||||
|
* @param turns new turns for the recipe, must be > 0
|
||||||
|
*
|
||||||
|
* @return currently used builder
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipeBuilder withTurns( @Nonnegative int turns );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalizes the process of making the recipe.
|
||||||
|
* Needs to be invoked to fetch grinder recipe.
|
||||||
|
*
|
||||||
|
* @return valid grinder recipe
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException when input is not defined
|
||||||
|
* @throws IllegalStateException when input has no size
|
||||||
|
* @throws IllegalStateException when output is not defined
|
||||||
|
* @throws IllegalStateException when both optionals are not defined
|
||||||
|
* @throws IllegalStateException when process type is not defined
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipe build();
|
||||||
|
}
|
||||||
@@ -38,6 +38,14 @@ import net.minecraft.item.ItemStack;
|
|||||||
public interface IGrinderRegistry
|
public interface IGrinderRegistry
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extensible way to create a grinder recipe.
|
||||||
|
*
|
||||||
|
* @return builder for grinder recipes
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IGrinderRecipeBuilder builder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable list of the currently registered recipes.
|
* An immutable list of the currently registered recipes.
|
||||||
*
|
*
|
||||||
@@ -47,48 +55,13 @@ public interface IGrinderRegistry
|
|||||||
Collection<IGrinderRecipe> getRecipes();
|
Collection<IGrinderRecipe> getRecipes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new recipe with a single input and output and how many turns it requires.
|
* Add a new recipe to the registry.
|
||||||
*
|
|
||||||
* Will ignore duplicate recipes with the same input item.
|
|
||||||
*
|
|
||||||
* @param in The {@link ItemStack} to grind.
|
|
||||||
* @param out The {@link ItemStack} to output.
|
|
||||||
* @param turns Amount of turns to turn the input into the output, with turns > 0.
|
|
||||||
*/
|
*/
|
||||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, int turns );
|
boolean addRecipe( IGrinderRecipe recipe );
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new recipe with an input, output and a single optional output.
|
|
||||||
*
|
|
||||||
* Will ignore duplicate recipes with the same input item.
|
|
||||||
*
|
|
||||||
* @param in The {@link ItemStack} to grind.
|
|
||||||
* @param out The {@link ItemStack} to output.
|
|
||||||
* @param optional The optional {@link ItemStack} to output of a certain chance.
|
|
||||||
* @param chance Chance to get the optional output within 0.0 - 1.0
|
|
||||||
* @param turns Amount of turns to turn the input into the output, with turns > 0.
|
|
||||||
*/
|
|
||||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, int turns );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add a new recipe with optional outputs, duplicates will not be added.
|
|
||||||
*
|
|
||||||
* Will ignore duplicate recipes with the same input item.
|
|
||||||
*
|
|
||||||
* @param in The {@link ItemStack} to grind.
|
|
||||||
* @param out The {@link ItemStack} to output.
|
|
||||||
* @param optional The first optional {@link ItemStack} to output of a certain chance.
|
|
||||||
* @param chance Chance to get the first optional output within 0.0 - 1.0
|
|
||||||
* @param optional2 The second optional {@link ItemStack} to output of a certain chance.
|
|
||||||
* @param chance2 chance to get the second optional output within 0.0 - 1.0
|
|
||||||
* @param turns Amount of turns to turn the input into the output, with turns > 0.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, @Nonnull ItemStack optional2, float chance2, int turns );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specific from the recipe list.
|
* Remove the specific from the recipe list.
|
||||||
*
|
*
|
||||||
* @param recipe The recipe to be removed.
|
* @param recipe The recipe to be removed.
|
||||||
* @return true, if it was removed
|
* @return true, if it was removed
|
||||||
*/
|
*/
|
||||||
@@ -106,11 +79,11 @@ public interface IGrinderRegistry
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows do add a custom ratio from an ore to dust when being grinded.
|
* Allows do add a custom ratio from an ore to dust when being grinded.
|
||||||
*
|
*
|
||||||
* The default ratio is 1 ore to 2 dusts.
|
* The default ratio is 1 ore to 2 dusts.
|
||||||
*
|
*
|
||||||
* These have to be added before any recipe is registered. Otherwise it will use the default value.
|
* These have to be added before any recipe is registered. Otherwise it will use the default value.
|
||||||
*
|
*
|
||||||
* @param oredictName The name of the ore;
|
* @param oredictName The name of the ore;
|
||||||
* @param ratio The amount, must be > 0;
|
* @param ratio The amount, must be > 0;
|
||||||
*/
|
*/
|
||||||
@@ -118,9 +91,9 @@ public interface IGrinderRegistry
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a custom ratio for a specific ore name.
|
* Remove a custom ratio for a specific ore name.
|
||||||
*
|
*
|
||||||
* Will use the default of 2 value afterwards.
|
* Will use the default of 2 value afterwards.
|
||||||
*
|
*
|
||||||
* @param oredictName The name of the ore;
|
* @param oredictName The name of the ore;
|
||||||
*/
|
*/
|
||||||
boolean removeDustRatio( @Nonnull String oredictName );
|
boolean removeDustRatio( @Nonnull String oredictName );
|
||||||
|
|||||||
@@ -31,11 +31,19 @@ import net.minecraft.item.ItemStack;
|
|||||||
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
||||||
*
|
*
|
||||||
* @author thatsIch
|
* @author thatsIch
|
||||||
* @version rv3
|
* @version rv5
|
||||||
* @since rv2
|
* @since rv2
|
||||||
*/
|
*/
|
||||||
public interface IInscriberRegistry
|
public interface IInscriberRegistry
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Extensible way to create an inscriber recipe.
|
||||||
|
*
|
||||||
|
* @return builder for inscriber recipes
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
IInscriberRecipeBuilder builder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable copy of currently registered recipes.
|
* An immutable copy of currently registered recipes.
|
||||||
*
|
*
|
||||||
@@ -65,29 +73,25 @@ public interface IInscriberRegistry
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
Set<ItemStack> getInputs();
|
Set<ItemStack> getInputs();
|
||||||
|
|
||||||
/**
|
|
||||||
* Extensible way to create an inscriber recipe.
|
|
||||||
*
|
|
||||||
* @return builder for inscriber recipes
|
|
||||||
*/
|
|
||||||
@Nonnull
|
|
||||||
IInscriberRecipeBuilder builder();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add a new recipe the easy way, duplicates will not be added.
|
* add a new recipe the easy way, duplicates will not be added.
|
||||||
* Added recipes will be automatically added to the optionals and inputs.
|
* Added recipes will be automatically added to the optionals and inputs.
|
||||||
*
|
*
|
||||||
* @param recipe new recipe
|
* @param recipe new recipe
|
||||||
|
*
|
||||||
|
* @return true, when successfully added
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if null is added
|
* @throws IllegalArgumentException if null is added
|
||||||
*/
|
*/
|
||||||
void addRecipe( IInscriberRecipe recipe );
|
boolean addRecipe( IInscriberRecipe recipe );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all equal recipes from the registry.
|
* Removes all equal recipes from the registry.
|
||||||
*
|
*
|
||||||
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense.
|
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense.
|
||||||
|
*
|
||||||
|
* @return true, when successfully removed
|
||||||
*/
|
*/
|
||||||
void removeRecipe( IInscriberRecipe toBeRemovedRecipe );
|
boolean removeRecipe( IInscriberRecipe toBeRemovedRecipe );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package appeng.api.implementations.items;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.energy.IAEPowerStorage;
|
import appeng.api.networking.energy.IAEPowerStorage;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,27 +43,27 @@ public interface IAEItemPowerStorage
|
|||||||
*
|
*
|
||||||
* @return amount unable to be stored
|
* @return amount unable to be stored
|
||||||
*/
|
*/
|
||||||
double injectAEPower( ItemStack is, double amt );
|
double injectAEPower( ItemStack stack, double amount, Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to extract power from the device, it will extract what it can and
|
* Attempt to extract power from the device, it will extract what it can and
|
||||||
* return it.
|
* return it.
|
||||||
*
|
*
|
||||||
* @param amt to be extracted power from device
|
* @param amount to be extracted power from device
|
||||||
*
|
*
|
||||||
* @return what it could extract
|
* @return what it could extract
|
||||||
*/
|
*/
|
||||||
double extractAEPower( ItemStack is, double amt );
|
double extractAEPower( ItemStack stack, double amount, Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current maximum power ( this can change :P )
|
* @return the current maximum power ( this can change :P )
|
||||||
*/
|
*/
|
||||||
double getAEMaxPower( ItemStack is );
|
double getAEMaxPower( ItemStack stack );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current AE Power Level, this may exceed getMEMaxPower()
|
* @return the current AE Power Level, this may exceed getMEMaxPower()
|
||||||
*/
|
*/
|
||||||
double getAECurrentPower( ItemStack is );
|
double getAECurrentPower( ItemStack stack );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control the power flow by telling what the network can do, either add? or
|
* Control the power flow by telling what the network can do, either add? or
|
||||||
@@ -70,5 +71,5 @@ public interface IAEItemPowerStorage
|
|||||||
*
|
*
|
||||||
* @return access restriction of network
|
* @return access restriction of network
|
||||||
*/
|
*/
|
||||||
AccessRestriction getPowerFlow( ItemStack is );
|
AccessRestriction getPowerFlow( ItemStack stack );
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.implementations.TransitionResult;
|
import appeng.api.implementations.TransitionResult;
|
||||||
|
import appeng.api.storage.ISpatialDimension;
|
||||||
import appeng.api.util.WorldCoord;
|
import appeng.api.util.WorldCoord;
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ public interface ISpatialStorageCell
|
|||||||
*
|
*
|
||||||
* @return the world for this cell
|
* @return the world for this cell
|
||||||
*/
|
*/
|
||||||
World getWorld( ItemStack is );
|
ISpatialDimension getSpatialDimension();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the currently stored size.
|
* get the currently stored size.
|
||||||
@@ -69,22 +70,13 @@ public interface ISpatialStorageCell
|
|||||||
WorldCoord getStoredSize( ItemStack is );
|
WorldCoord getStoredSize( ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum coordinates in its world for the storage cell.
|
* get the currently stored Dimension id.
|
||||||
*
|
*
|
||||||
* @param is spatial storage cell
|
* @param is spatial storage cell
|
||||||
*
|
*
|
||||||
* @return minimum coordinate of dimension
|
* @return dimension id or -1
|
||||||
*/
|
*/
|
||||||
WorldCoord getMin( ItemStack is );
|
int getStoredDimensionID( ItemStack is );
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum coordinates in its world for the storage cell.
|
|
||||||
*
|
|
||||||
* @param is spatial storage cell
|
|
||||||
*
|
|
||||||
* @return maximum coordinate of dimension
|
|
||||||
*/
|
|
||||||
WorldCoord getMax( ItemStack is );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a spatial swap with the contents of the cell, and the world.
|
* Perform a spatial swap with the contents of the cell, and the world.
|
||||||
@@ -93,9 +85,9 @@ public interface ISpatialStorageCell
|
|||||||
* @param w world of spatial
|
* @param w world of spatial
|
||||||
* @param min min coord
|
* @param min min coord
|
||||||
* @param max max coord
|
* @param max max coord
|
||||||
* @param doTransition transition
|
* @param playerId owner of current grid or -1
|
||||||
*
|
*
|
||||||
* @return result of transition
|
* @return result of transition
|
||||||
*/
|
*/
|
||||||
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition );
|
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, int playerId );
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
package appeng.api.networking.crafting;
|
package appeng.api.networking.crafting;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.storage.IBaseMonitor;
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
|||||||
/**
|
/**
|
||||||
* @return the action source for the CPU.
|
* @return the action source for the CPU.
|
||||||
*/
|
*/
|
||||||
BaseActionSource getActionSource();
|
IActionSource getActionSource();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the available storage in bytes
|
* @return the available storage in bytes
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public interface ICraftingGrid extends IGridCache
|
|||||||
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
|
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
|
||||||
* on this, your be waiting forever.
|
* on this, your be waiting forever.
|
||||||
*/
|
*/
|
||||||
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, IActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit the job to the Crafting system for processing.
|
* Submit the job to the Crafting system for processing.
|
||||||
@@ -82,7 +82,7 @@ public interface ICraftingGrid extends IGridCache
|
|||||||
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
||||||
* return state.
|
* return state.
|
||||||
*/
|
*/
|
||||||
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, BaseActionSource src );
|
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, IActionSource src );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return list of all the crafting cpus on the grid
|
* @return list of all the crafting cpus on the grid
|
||||||
|
|||||||
@@ -24,7 +24,10 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
|
|
||||||
@@ -35,17 +38,91 @@ import appeng.api.config.Actionable;
|
|||||||
public interface IEnergyGridProvider
|
public interface IEnergyGridProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* internal use only
|
||||||
|
*
|
||||||
|
* Can return a list of providers behind the current.
|
||||||
|
*
|
||||||
|
* An example would be something acting as proxy between different {@link IEnergyGrid}s.
|
||||||
|
*
|
||||||
|
* This can contain duplicate entries, AE will ensure that each provider is only visited once.
|
||||||
|
*
|
||||||
* internal use only
|
* internal use only
|
||||||
*/
|
*/
|
||||||
double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
@Nonnull
|
||||||
|
Collection<IEnergyGridProvider> providers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal use only
|
* internal use only
|
||||||
|
*
|
||||||
|
* Extracts the requested amount from the provider.
|
||||||
|
*
|
||||||
|
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
|
||||||
|
* {@link IEnergyGridProvider#providers()}
|
||||||
|
*
|
||||||
|
* @return the used amount
|
||||||
*/
|
*/
|
||||||
double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
@Nonnegative
|
||||||
|
double extractProviderPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injects the offered amount into the provider.
|
||||||
|
*
|
||||||
|
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
|
||||||
|
* {@link IEnergyGridProvider#providers()}
|
||||||
|
*
|
||||||
|
* internal use only
|
||||||
|
*
|
||||||
|
* @return the leftover amount
|
||||||
|
*/
|
||||||
|
@Nonnegative
|
||||||
|
double injectProviderPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal use only
|
* internal use only
|
||||||
|
*
|
||||||
|
* Returns the current demand of an provider.
|
||||||
|
*
|
||||||
|
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
|
||||||
|
* {@link IEnergyGridProvider#providers()}
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param d the max amount offered, the demand should never exceed it.
|
||||||
|
* @return the total amount demanded
|
||||||
*/
|
*/
|
||||||
double getEnergyDemand( double d, Set<IEnergyGrid> seen );
|
@Nonnegative
|
||||||
|
double getProviderEnergyDemand( @Nonnegative double d );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* internal use only
|
||||||
|
*
|
||||||
|
* AE currently uses this to enqueue the next visited provider.
|
||||||
|
*
|
||||||
|
* There is no guarantee that this works on in a perfect way.
|
||||||
|
* It can be limited to the returns of the past {@link IEnergyGridProvider#providers()}, but not any future one
|
||||||
|
* discovered by visiting further providers.
|
||||||
|
*
|
||||||
|
* E.g. inject into the the lowest one first or extract from the highest one.
|
||||||
|
*
|
||||||
|
* @return the current stored amount.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Nonnegative
|
||||||
|
double getProviderStoredEnergy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* internal use only
|
||||||
|
*
|
||||||
|
* AE currently uses this to enqueue the next visited provider.
|
||||||
|
*
|
||||||
|
* There is no guarantee that this works on in a perfect way.
|
||||||
|
* It can be limited to the returns of the past {@link IEnergyGridProvider#providers()}, but not any future one
|
||||||
|
* discovered by visiting further providers.
|
||||||
|
*
|
||||||
|
* E.g. inject into the the lowest one first or extract from the highest one.
|
||||||
|
*
|
||||||
|
* @return the maximum amount stored.
|
||||||
|
*/
|
||||||
|
@Nonnegative
|
||||||
|
double getProviderMaxEnergy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013 AlgorithmX2
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.api.networking.security;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Consider refactoring.
|
|
||||||
*/
|
|
||||||
public class BaseActionSource
|
|
||||||
{
|
|
||||||
|
|
||||||
public boolean isPlayer()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMachine()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,11 +24,10 @@
|
|||||||
package appeng.api.networking.security;
|
package appeng.api.networking.security;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.IGridHost;
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
|
|
||||||
public interface IActionHost extends IGridHost
|
public interface IActionHost
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 AlgorithmX2
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.api.networking.security;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The source of any action.
|
||||||
|
*
|
||||||
|
* This can either be a {@link EntityPlayer} or an {@link IActionHost}.
|
||||||
|
*
|
||||||
|
* In most cases this is used for security checks, but can be used to validate the source itself.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IActionSource
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If present, AE will consider the player being the source for the action.
|
||||||
|
*
|
||||||
|
* This will take precedence over {@link IActionSource#machine()} in any case.
|
||||||
|
*
|
||||||
|
* @return An optional player issuing the action.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
Optional<EntityPlayer> player();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If present, it indicates the {@link IActionHost} of the source.
|
||||||
|
*
|
||||||
|
* Should {@link IActionSource#player()} be absent, it will consider a machine as source.
|
||||||
|
*
|
||||||
|
* It is recommended to include the machine even when a player is present.
|
||||||
|
*
|
||||||
|
* @return An optional machine issuing the action or acting as proxy for a player.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
Optional<IActionHost> machine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An {@link IActionSource} can have multiple optional contexts.
|
||||||
|
*
|
||||||
|
* It is strongly recommended to limit the uses for absolutely necessary cases.
|
||||||
|
*
|
||||||
|
* Currently there are no public contexts made available by AE.
|
||||||
|
* An example would be the context interfaces use internally to avoid looping items between each other.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
<T> Optional<T> context( @Nonnull Class<T> key );
|
||||||
|
}
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013 AlgorithmX2
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.api.networking.security;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Consider refactoring.
|
|
||||||
*/
|
|
||||||
public class MachineSource extends BaseActionSource
|
|
||||||
{
|
|
||||||
|
|
||||||
public final IActionHost via;
|
|
||||||
|
|
||||||
public MachineSource( final IActionHost v )
|
|
||||||
{
|
|
||||||
this.via = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMachine()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
package appeng.api.networking.storage;
|
package appeng.api.networking.storage;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
@@ -50,5 +50,5 @@ public interface IStackWatcherHost
|
|||||||
* @param src action source
|
* @param src action source
|
||||||
* @param chan storage channel
|
* @param chan storage channel
|
||||||
*/
|
*/
|
||||||
void onStackChange( IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan );
|
void onStackChange( IItemList o, IAEStack fullStack, IAEStack diffStack, IActionSource src, StorageChannel chan );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ package appeng.api.networking.storage;
|
|||||||
|
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.IGridHost;
|
import appeng.api.networking.IGridHost;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.ICellContainer;
|
import appeng.api.storage.ICellContainer;
|
||||||
import appeng.api.storage.ICellProvider;
|
import appeng.api.storage.ICellProvider;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
@@ -50,7 +50,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
|||||||
*
|
*
|
||||||
* @param input injected items
|
* @param input injected items
|
||||||
*/
|
*/
|
||||||
void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src );
|
void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, IActionSource src );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to add a cell provider to the storage system
|
* Used to add a cell provider to the storage system
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package appeng.api.storage;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public interface IMEInventory<StackType extends IAEStack>
|
|||||||
*
|
*
|
||||||
* @return returns the number of items not added.
|
* @return returns the number of items not added.
|
||||||
*/
|
*/
|
||||||
StackType injectItems( StackType input, Actionable type, BaseActionSource src );
|
StackType injectItems( StackType input, Actionable type, IActionSource src );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the specified item from the ME Inventory
|
* Extract the specified item from the ME Inventory
|
||||||
@@ -62,7 +62,7 @@ public interface IMEInventory<StackType extends IAEStack>
|
|||||||
*
|
*
|
||||||
* @return returns the number of items extracted, null
|
* @return returns the number of items extracted, null
|
||||||
*/
|
*/
|
||||||
StackType extractItems( StackType request, Actionable mode, BaseActionSource src );
|
StackType extractItems( StackType request, Actionable mode, IActionSource src );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* request a full report of all available items, storage.
|
* request a full report of all available items, storage.
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
package appeng.api.storage;
|
package appeng.api.storage;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.storage.IBaseMonitor;
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public interface IMEMonitorHandlerReceiver<StackType extends IAEStack>
|
|||||||
*
|
*
|
||||||
* @param change done change
|
* @param change done change
|
||||||
*/
|
*/
|
||||||
void postChange( IBaseMonitor<StackType> monitor, Iterable<StackType> change, BaseActionSource actionSource );
|
void postChange( IBaseMonitor<StackType> monitor, Iterable<StackType> change, IActionSource actionSource );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called when the list updates its contents, this is mostly for handling power events.
|
* called when the list updates its contents, this is mostly for handling power events.
|
||||||
|
|||||||
+16
-14
@@ -16,24 +16,26 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.integration.modules.rf;
|
package appeng.api.storage;
|
||||||
|
|
||||||
|
|
||||||
import appeng.integration.IIntegrationModule;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import appeng.integration.IntegrationHelper;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
|
||||||
/**
|
public interface ISpatialDimension
|
||||||
* @author GuntherDW
|
|
||||||
*/
|
|
||||||
public class RFModule implements IIntegrationModule
|
|
||||||
{
|
{
|
||||||
public RFModule()
|
World getWorld();
|
||||||
{
|
|
||||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class );
|
|
||||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyProvider.class );
|
|
||||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyConnection.class );
|
|
||||||
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int createNewCellDimension( BlockPos contentSize, int playerId );
|
||||||
|
|
||||||
|
void deleteCellDimension( int cellDimId );
|
||||||
|
|
||||||
|
boolean isCellDimension( int cellDimID );
|
||||||
|
|
||||||
|
int getCellDimensionOwner( int cellDimId );
|
||||||
|
|
||||||
|
BlockPos getCellDimensionOrigin( int cellDimId );
|
||||||
|
|
||||||
|
BlockPos getCellContentSize( int cellDimId );
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
import appeng.api.networking.crafting.ICraftingRequester;
|
import appeng.api.networking.crafting.ICraftingRequester;
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
@@ -109,7 +109,7 @@ public interface IStorageHelper
|
|||||||
*
|
*
|
||||||
* @return items that successfully extracted.
|
* @return items that successfully extracted.
|
||||||
*/
|
*/
|
||||||
IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src );
|
IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, IActionSource src );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use energy from energy, to inject input items into cell, at the request of src
|
* use energy from energy, to inject input items into cell, at the request of src
|
||||||
@@ -121,5 +121,5 @@ public interface IStorageHelper
|
|||||||
*
|
*
|
||||||
* @return items that failed to insert.
|
* @return items that failed to insert.
|
||||||
*/
|
*/
|
||||||
IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src );
|
IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, IActionSource src );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package appeng.api.storage;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,5 +22,5 @@ public interface IStorageMonitorableAccessor
|
|||||||
* @return Null if the network cannot be accessed by the given action source (i.e. security doesn't permit it).
|
* @return Null if the network cannot be accessed by the given action source (i.e. security doesn't permit it).
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
IStorageMonitorable getInventory( BaseActionSource src );
|
IStorageMonitorable getInventory( IActionSource src );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableList;
|
|||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StackType injectItems( final StackType input, final Actionable mode, final BaseActionSource src )
|
public StackType injectItems( final StackType input, final Actionable mode, final IActionSource src )
|
||||||
{
|
{
|
||||||
if( mode == Actionable.SIMULATE )
|
if( mode == Actionable.SIMULATE )
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||||||
return this.internalHandler;
|
return this.internalHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private StackType monitorDifference( final IAEStack original, final StackType leftOvers, final boolean extraction, final BaseActionSource src )
|
private StackType monitorDifference( final IAEStack original, final StackType leftOvers, final boolean extraction, final IActionSource src )
|
||||||
{
|
{
|
||||||
final StackType diff = (StackType) original.copy();
|
final StackType diff = (StackType) original.copy();
|
||||||
|
|
||||||
@@ -116,12 +116,12 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||||||
return leftOvers;
|
return leftOvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void postChangesToListeners( final Iterable<StackType> changes, final BaseActionSource src )
|
protected void postChangesToListeners( final Iterable<StackType> changes, final IActionSource src )
|
||||||
{
|
{
|
||||||
this.notifyListenersOfChange( changes, src );
|
this.notifyListenersOfChange( changes, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void notifyListenersOfChange( final Iterable<StackType> diff, final BaseActionSource src )
|
protected void notifyListenersOfChange( final Iterable<StackType> diff, final IActionSource src )
|
||||||
{
|
{
|
||||||
this.hasChanged = true;// need to update the cache.
|
this.hasChanged = true;// need to update the cache.
|
||||||
final Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
|
final Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
|
||||||
@@ -146,7 +146,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StackType extractItems( final StackType request, final Actionable mode, final BaseActionSource src )
|
public StackType extractItems( final StackType request, final Actionable mode, final IActionSource src )
|
||||||
{
|
{
|
||||||
if( mode == Actionable.SIMULATE )
|
if( mode == Actionable.SIMULATE )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||||||
*
|
*
|
||||||
* @return new ItemStack
|
* @return new ItemStack
|
||||||
*/
|
*/
|
||||||
ItemStack getItemStack();
|
ItemStack createItemStack();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is there NBT Data for this item?
|
* is there NBT Data for this item?
|
||||||
@@ -105,4 +105,11 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||||||
* @return true if it is the same type (same item, damage, nbt)
|
* @return true if it is the same type (same item, damage, nbt)
|
||||||
*/
|
*/
|
||||||
boolean isSameType( ItemStack stored );
|
boolean isSameType( ItemStack stored );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DO NOT MODIFY THIS STACK! NEVER. If you think about it .. DON'T
|
||||||
|
*
|
||||||
|
* @return definition stack
|
||||||
|
*/
|
||||||
|
ItemStack getDefinition();
|
||||||
}
|
}
|
||||||
@@ -28,13 +28,14 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
|
|
||||||
|
|
||||||
public interface IAEStack<StackType extends IAEStack>
|
public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,13 +183,6 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
*/
|
*/
|
||||||
StackType empty();
|
StackType empty();
|
||||||
|
|
||||||
/**
|
|
||||||
* obtain the NBT Data for the item.
|
|
||||||
*
|
|
||||||
* @return nbt data
|
|
||||||
*/
|
|
||||||
IAETagCompound getTagCompound();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the stack is a {@link IAEItemStack}
|
* @return true if the stack is a {@link IAEItemStack}
|
||||||
*/
|
*/
|
||||||
@@ -205,13 +199,9 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
StorageChannel getChannel();
|
StorageChannel getChannel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if it should show the crafting label.
|
* Returns itemstack for display and similar purposes. Always has a count of 1.
|
||||||
|
*
|
||||||
|
* @return itemstack
|
||||||
*/
|
*/
|
||||||
boolean getShowCraftingLabel();
|
ItemStack asItemStackRepresentation();
|
||||||
|
|
||||||
/**
|
|
||||||
* Used internally to show that it should show a Crafting label instead of a "1"
|
|
||||||
*/
|
|
||||||
void setShowCraftingLabel( boolean showCraftingLabel );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013 AlgorithmX2
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package appeng.api.storage.data;
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
import appeng.api.features.IItemComparison;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Don't cast this... either compare with it, or copy it.
|
|
||||||
*
|
|
||||||
* Don't Implement.
|
|
||||||
*/
|
|
||||||
public interface IAETagCompound
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a copy ( the copy will not be a IAETagCompound, it will be a NBTTagCompound )
|
|
||||||
*/
|
|
||||||
NBTTagCompound getNBTTagCompoundCopy();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* compare to other NBTTagCompounds or IAETagCompounds
|
|
||||||
*
|
|
||||||
* @param a compared object
|
|
||||||
*
|
|
||||||
* @return true, if they are the same.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
boolean equals( Object a );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the special comparison for this tag
|
|
||||||
*/
|
|
||||||
IItemComparison getSpecialComparison();
|
|
||||||
}
|
|
||||||
@@ -46,6 +46,11 @@ public enum AECableType
|
|||||||
*/
|
*/
|
||||||
SMART,
|
SMART,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
|
*/
|
||||||
|
DENSE_COVERED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +60,7 @@ public enum AECableType
|
|||||||
GLASS,
|
GLASS,
|
||||||
COVERED,
|
COVERED,
|
||||||
SMART,
|
SMART,
|
||||||
|
DENSE_COVERED,
|
||||||
DENSE_SMART
|
DENSE_SMART
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
import appeng.api.definitions.IBlockDefinition;
|
import appeng.api.definitions.IBlockDefinition;
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
@@ -66,67 +67,39 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
|||||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getMaxEnergyCapacity()
|
@Override
|
||||||
|
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
|
||||||
{
|
{
|
||||||
final Block blockID = Block.getBlockFromItem( this );
|
final double internalCurrentPower = this.getInternal( is );
|
||||||
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
final double internalMaxPower = this.getAEMaxPower( is );
|
||||||
return energyCell.maybeBlock().map( block ->
|
final double required = internalMaxPower - internalCurrentPower;
|
||||||
|
final double overflow = Math.max( 0, amount - required );
|
||||||
|
|
||||||
|
if( mode == Actionable.MODULATE )
|
||||||
{
|
{
|
||||||
if( blockID == block )
|
final double toAdd = Math.min( required, amount );
|
||||||
{
|
final double newPowerStored = internalCurrentPower + toAdd;
|
||||||
return 200000;
|
|
||||||
}
|
this.setInternal( is, newPowerStored );
|
||||||
else
|
}
|
||||||
{
|
|
||||||
return 8 * 200000;
|
return overflow;
|
||||||
}
|
|
||||||
} ).orElse( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double injectAEPower( final ItemStack is, double amt )
|
public double extractAEPower( final ItemStack is, double amount, Actionable mode )
|
||||||
{
|
{
|
||||||
double internalCurrentPower = this.getInternal( is );
|
final double internalCurrentPower = this.getInternal( is );
|
||||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
final double fulfillable = Math.min( amount, internalCurrentPower );
|
||||||
internalCurrentPower += amt;
|
|
||||||
if( internalCurrentPower > internalMaxPower )
|
if( mode == Actionable.MODULATE )
|
||||||
{
|
{
|
||||||
amt = internalCurrentPower - internalMaxPower;
|
final double newPowerStored = internalCurrentPower - fulfillable;
|
||||||
internalCurrentPower = internalMaxPower;
|
|
||||||
this.setInternal( is, internalCurrentPower );
|
this.setInternal( is, newPowerStored );
|
||||||
return amt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setInternal( is, internalCurrentPower );
|
return fulfillable;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getInternal( final ItemStack is )
|
|
||||||
{
|
|
||||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
|
||||||
return nbt.getDouble( "internalCurrentPower" );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setInternal( final ItemStack is, final double amt )
|
|
||||||
{
|
|
||||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
|
||||||
nbt.setDouble( "internalCurrentPower", amt );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double extractAEPower( final ItemStack is, double amt )
|
|
||||||
{
|
|
||||||
double internalCurrentPower = this.getInternal( is );
|
|
||||||
if( internalCurrentPower > amt )
|
|
||||||
{
|
|
||||||
internalCurrentPower -= amt;
|
|
||||||
this.setInternal( is, internalCurrentPower );
|
|
||||||
return amt;
|
|
||||||
}
|
|
||||||
|
|
||||||
amt = internalCurrentPower;
|
|
||||||
this.setInternal( is, 0 );
|
|
||||||
return amt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -146,4 +119,34 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
|||||||
{
|
{
|
||||||
return AccessRestriction.WRITE;
|
return AccessRestriction.WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double getMaxEnergyCapacity()
|
||||||
|
{
|
||||||
|
final Block blockID = Block.getBlockFromItem( this );
|
||||||
|
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
||||||
|
|
||||||
|
return energyCell.maybeBlock().map( block ->
|
||||||
|
{
|
||||||
|
if( blockID == block )
|
||||||
|
{
|
||||||
|
return 200000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 8 * 200000;
|
||||||
|
}
|
||||||
|
} ).orElse( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getInternal( final ItemStack is )
|
||||||
|
{
|
||||||
|
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||||
|
return nbt.getDouble( "internalCurrentPower" );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setInternal( final ItemStack is, final double amt )
|
||||||
|
{
|
||||||
|
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||||
|
nbt.setDouble( "internalCurrentPower", amt );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class BlockCableBus extends AEBaseTileBlock
|
|||||||
// this will actually be overwritten later through setupTile and the
|
// this will actually be overwritten later through setupTile and the
|
||||||
// combined layers
|
// combined layers
|
||||||
this.setTileEntity( TileCableBus.class );
|
this.setTileEntity( TileCableBus.class );
|
||||||
|
this.useNeighborBrightness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@@ -42,11 +42,13 @@ import appeng.api.definitions.IBlockDefinition;
|
|||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.block.AEBaseItemBlock;
|
import appeng.block.AEBaseItemBlock;
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
|
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IPreInitComponent;
|
||||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.CreativeTab;
|
import appeng.core.CreativeTab;
|
||||||
import appeng.core.Registration;
|
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.ActivityState;
|
import appeng.core.features.ActivityState;
|
||||||
import appeng.core.features.BlockDefinition;
|
import appeng.core.features.BlockDefinition;
|
||||||
@@ -65,13 +67,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
|
|
||||||
private final Supplier<? extends Block> blockSupplier;
|
private final Supplier<? extends Block> blockSupplier;
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> preInitCallbacks = new ArrayList<>();
|
private final List<BiFunction<Block, Item, IBootstrapComponent>> bootstrapComponents = new ArrayList<>();
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> initCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> modelRegCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<BiConsumer<Block, Item>> postInitCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||||
|
|
||||||
@@ -103,30 +99,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockDefinitionBuilder preInit( BiConsumer<Block, Item> callback )
|
public BlockDefinitionBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> callback )
|
||||||
{
|
{
|
||||||
this.preInitCallbacks.add( callback );
|
this.bootstrapComponents.add( callback );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockDefinitionBuilder init( BiConsumer<Block, Item> callback )
|
|
||||||
{
|
|
||||||
this.initCallbacks.add( callback );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockDefinitionBuilder modelRegInit( BiConsumer<Block, Item> callback )
|
|
||||||
{
|
|
||||||
this.modelRegCallbacks.add( callback );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockDefinitionBuilder postInit( BiConsumer<Block, Item> callback )
|
|
||||||
{
|
|
||||||
this.postInitCallbacks.add( callback );
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,22 +196,16 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Register the item and block with the game
|
// Register the item and block with the game
|
||||||
this.factory.addPreInit( side ->
|
this.factory.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( block ) );
|
||||||
|
if( item != null )
|
||||||
{
|
{
|
||||||
Registration.addBlockToRegister( block );
|
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) );
|
||||||
if( item != null )
|
}
|
||||||
{
|
|
||||||
Registration.addItemToRegister( item );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
block.setCreativeTab( this.creativeTab );
|
block.setCreativeTab( this.creativeTab );
|
||||||
|
|
||||||
// Register all extra handlers
|
// Register all extra handlers
|
||||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( block, item ) ) );
|
this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) );
|
||||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( block, item ) ) );
|
|
||||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( block, item ) ) );
|
|
||||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( block, item ) ) );
|
|
||||||
|
|
||||||
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
||||||
{
|
{
|
||||||
@@ -268,7 +237,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
|
|
||||||
if( block instanceof AEBaseTileBlock )
|
if( block instanceof AEBaseTileBlock )
|
||||||
{
|
{
|
||||||
this.factory.addPreInit( side ->
|
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
|
||||||
{
|
{
|
||||||
AEBaseTile.registerTileItem(
|
AEBaseTile.registerTileItem(
|
||||||
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ class BlockRendering implements IBlockRendering
|
|||||||
|
|
||||||
if( this.modelCustomizer != null )
|
if( this.modelCustomizer != null )
|
||||||
{
|
{
|
||||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||||
}
|
}
|
||||||
else if( block instanceof AEBaseTileBlock )
|
else if( block instanceof AEBaseTileBlock )
|
||||||
{
|
{
|
||||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||||
// extended props
|
// extended props
|
||||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : 1.12
|
// TODO : 1.12
|
||||||
|
|||||||
@@ -20,10 +20,18 @@ package appeng.bootstrap;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraftforge.client.model.IModel;
|
import net.minecraftforge.client.model.IModel;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
@@ -33,10 +41,6 @@ import appeng.api.definitions.IItemDefinition;
|
|||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEColoredItemDefinition;
|
import appeng.api.util.AEColoredItemDefinition;
|
||||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
import appeng.bootstrap.components.BuiltInModelComponent;
|
||||||
import appeng.bootstrap.components.IInitComponent;
|
|
||||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
|
||||||
import appeng.bootstrap.components.IPostInitComponent;
|
|
||||||
import appeng.bootstrap.components.IPreInitComponent;
|
|
||||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||||
import appeng.bootstrap.components.TileEntityComponent;
|
import appeng.bootstrap.components.TileEntityComponent;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
@@ -51,10 +55,10 @@ public class FeatureFactory
|
|||||||
|
|
||||||
private final AEFeature[] defaultFeatures;
|
private final AEFeature[] defaultFeatures;
|
||||||
|
|
||||||
private final List<IBootstrapComponent> bootstrapComponents;
|
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
ModelOverrideComponent modelOverrideComponent;
|
private ModelOverrideComponent modelOverrideComponent;
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
private BuiltInModelComponent builtInModelComponent;
|
private BuiltInModelComponent builtInModelComponent;
|
||||||
@@ -64,18 +68,18 @@ public class FeatureFactory
|
|||||||
public FeatureFactory()
|
public FeatureFactory()
|
||||||
{
|
{
|
||||||
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
||||||
this.bootstrapComponents = new ArrayList<>();
|
this.bootstrapComponents = new HashMap<>();
|
||||||
|
|
||||||
this.tileEntityComponent = new TileEntityComponent();
|
this.tileEntityComponent = new TileEntityComponent();
|
||||||
this.bootstrapComponents.add( this.tileEntityComponent );
|
this.addBootstrapComponent( this.tileEntityComponent );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
this.modelOverrideComponent = new ModelOverrideComponent();
|
||||||
this.bootstrapComponents.add( this.modelOverrideComponent );
|
this.addBootstrapComponent( this.modelOverrideComponent );
|
||||||
|
|
||||||
this.builtInModelComponent = new BuiltInModelComponent();
|
this.builtInModelComponent = new BuiltInModelComponent();
|
||||||
this.bootstrapComponents.add( this.builtInModelComponent );
|
this.addBootstrapComponent( this.builtInModelComponent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,29 +127,16 @@ public class FeatureFactory
|
|||||||
return new FeatureFactory( this, features );
|
return new FeatureFactory( this, features );
|
||||||
}
|
}
|
||||||
|
|
||||||
void addBootstrapComponent( IBootstrapComponent component )
|
public void addBootstrapComponent( IBootstrapComponent component )
|
||||||
{
|
{
|
||||||
this.bootstrapComponents.add( component );
|
Arrays.stream( component.getClass().getInterfaces() )
|
||||||
|
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )
|
||||||
|
.forEach( i -> this.addBootstrapComponent( (Class<? extends IBootstrapComponent>) i, component ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPreInit( IPreInitComponent component )
|
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
|
||||||
{
|
{
|
||||||
this.bootstrapComponents.add( component );
|
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||||
}
|
|
||||||
|
|
||||||
void addInit( IInitComponent component )
|
|
||||||
{
|
|
||||||
this.bootstrapComponents.add( component );
|
|
||||||
}
|
|
||||||
|
|
||||||
void addModelReg( IModelRegistrationComponent component )
|
|
||||||
{
|
|
||||||
this.bootstrapComponents.add( component );
|
|
||||||
}
|
|
||||||
|
|
||||||
void addPostInit( IPostInitComponent component )
|
|
||||||
{
|
|
||||||
this.bootstrapComponents.add( component );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
@@ -154,8 +145,14 @@ public class FeatureFactory
|
|||||||
this.builtInModelComponent.addModel( path, model );
|
this.builtInModelComponent.addModel( path, model );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IBootstrapComponent> getBootstrapComponents()
|
@SideOnly( Side.CLIENT )
|
||||||
|
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||||
{
|
{
|
||||||
return this.bootstrapComponents;
|
this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||||
|
{
|
||||||
|
return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -33,14 +33,7 @@ import appeng.core.features.AEFeature;
|
|||||||
|
|
||||||
public interface IBlockBuilder
|
public interface IBlockBuilder
|
||||||
{
|
{
|
||||||
|
IBlockBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> component );
|
||||||
IBlockBuilder preInit( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder init( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder modelRegInit( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder postInit( BiConsumer<Block, Item> callback );
|
|
||||||
|
|
||||||
IBlockBuilder features( AEFeature... features );
|
IBlockBuilder features( AEFeature... features );
|
||||||
|
|
||||||
|
|||||||
@@ -19,28 +19,10 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
||||||
|
* See the individual subclasses for a specific forge initalization event.
|
||||||
*/
|
*/
|
||||||
public interface IBootstrapComponent
|
public interface IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
default void preInitialize( Side side )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
default void modelRegistration( Side side, IModelRegistry registry )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
default void initialize( Side side )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
default void postInitialize( Side side )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
@@ -36,12 +36,7 @@ import appeng.core.features.ItemDefinition;
|
|||||||
*/
|
*/
|
||||||
public interface IItemBuilder
|
public interface IItemBuilder
|
||||||
{
|
{
|
||||||
|
IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component );
|
||||||
IItemBuilder preInit( Consumer<Item> callback );
|
|
||||||
|
|
||||||
IItemBuilder init( Consumer<Item> callback );
|
|
||||||
|
|
||||||
IItemBuilder postInit( Consumer<Item> callback );
|
|
||||||
|
|
||||||
IItemBuilder features( AEFeature... features );
|
IItemBuilder features( AEFeature... features );
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.block.BlockDispenser;
|
import net.minecraft.block.BlockDispenser;
|
||||||
@@ -33,10 +33,11 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IPostInitComponent;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.CreativeTab;
|
import appeng.core.CreativeTab;
|
||||||
import appeng.core.Registration;
|
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.ItemDefinition;
|
import appeng.core.features.ItemDefinition;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
@@ -53,13 +54,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
|
|
||||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||||
|
|
||||||
private final List<Consumer<Item>> preInitCallbacks = new ArrayList<>();
|
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
|
||||||
|
|
||||||
private final List<Consumer<Item>> initCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<Consumer<Item>> modelRegCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private final List<Consumer<Item>> postInitCallbacks = new ArrayList<>();
|
|
||||||
|
|
||||||
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
||||||
|
|
||||||
@@ -80,23 +75,9 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemDefinitionBuilder preInit( Consumer<Item> callback )
|
public IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component )
|
||||||
{
|
{
|
||||||
this.preInitCallbacks.add( callback );
|
this.boostrapComponents.add( component );
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemDefinitionBuilder init( Consumer<Item> callback )
|
|
||||||
{
|
|
||||||
this.initCallbacks.add( callback );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemDefinitionBuilder postInit( Consumer<Item> callback )
|
|
||||||
{
|
|
||||||
this.postInitCallbacks.add( callback );
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,22 +144,19 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
item.setCreativeTab( this.creativeTab );
|
item.setCreativeTab( this.creativeTab );
|
||||||
|
|
||||||
// Register all extra handlers
|
// Register all extra handlers
|
||||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( item ) ) );
|
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
||||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( item ) ) );
|
|
||||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( item ) ) );
|
|
||||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( item ) ) );
|
|
||||||
|
|
||||||
// Register custom dispenser behavior if requested
|
// Register custom dispenser behavior if requested
|
||||||
if( this.dispenserBehaviorSupplier != null )
|
if( this.dispenserBehaviorSupplier != null )
|
||||||
{
|
{
|
||||||
this.factory.addPostInit( side ->
|
this.factory.addBootstrapComponent( (IPostInitComponent) side ->
|
||||||
{
|
{
|
||||||
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
||||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.factory.addPreInit( side -> Registration.addItemToRegister( item ) );
|
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, reg ) -> reg.register( item ) );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
@@ -187,4 +165,5 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
|
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
|
|||||||
Block block = ( (ItemBlock) item ).getBlock();
|
Block block = ( (ItemBlock) item ).getBlock();
|
||||||
|
|
||||||
// We can only do this once the blocks are actually registered...
|
// We can only do this once the blocks are actually registered...
|
||||||
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
|
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
||||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
model = helper.getModelResourceLocation( block.getDefaultState() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||||
resources.add( model );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
|
|||||||
{
|
{
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||||
}
|
}
|
||||||
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
|
else if( this.itemMeshDefinition != null )
|
||||||
{
|
{
|
||||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||||
// case
|
// case
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||||
}
|
}
|
||||||
else if( item instanceof ItemBlock )
|
|
||||||
{
|
|
||||||
// The default for block items is to register the block model
|
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this.itemColor != null )
|
if( this.itemColor != null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IBlockRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void blockRegistration( Side side, IForgeRegistry<Block> blockRegistry );
|
||||||
|
}
|
||||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IInitComponent extends IBootstrapComponent
|
public interface IInitComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void initialize( Side side );
|
void initialize( Side side );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IItemRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void itemRegistration( Side side, IForgeRegistry<Item> itemRegistry );
|
||||||
|
}
|
||||||
@@ -32,8 +32,5 @@ import appeng.bootstrap.IModelRegistry;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IModelRegistrationComponent extends IBootstrapComponent
|
public interface IModelRegistrationComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void modelRegistration( Side side, IModelRegistry registry );
|
void modelRegistration( Side side, IModelRegistry registry );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-8
@@ -16,18 +16,16 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.tile;
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
|
|
||||||
import appeng.tile.events.TileEventType;
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
@Retention( RetentionPolicy.RUNTIME )
|
@FunctionalInterface
|
||||||
public @interface TileEvent
|
public interface IOreDictComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
void oreRegistration( Side side );
|
||||||
TileEventType value();
|
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IPostInitComponent extends IBootstrapComponent
|
public interface IPostInitComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void postInitialize( Side side );
|
void postInitialize( Side side );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IPreInitComponent extends IBootstrapComponent
|
public interface IPreInitComponent extends IBootstrapComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
|
||||||
void preInitialize( Side side );
|
void preInitialize( Side side );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void recipeRegistration( Side side, IForgeRegistry<IRecipe> recipeRegistry );
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
|
|||||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
import appeng.api.storage.ISpatialDimension;
|
||||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||||
import appeng.integration.IntegrationRegistry;
|
import appeng.integration.IntegrationRegistry;
|
||||||
import appeng.integration.IntegrationType;
|
import appeng.integration.IntegrationType;
|
||||||
@@ -45,6 +46,8 @@ public final class Capabilities
|
|||||||
|
|
||||||
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
|
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
|
||||||
|
|
||||||
|
public static Capability<ISpatialDimension> SPATIAL_DIMENSION;
|
||||||
|
|
||||||
public static Capability<ITeslaConsumer> TESLA_CONSUMER;
|
public static Capability<ITeslaConsumer> TESLA_CONSUMER;
|
||||||
|
|
||||||
public static Capability<ITeslaHolder> TESLA_HOLDER;
|
public static Capability<ITeslaHolder> TESLA_HOLDER;
|
||||||
@@ -57,6 +60,7 @@ public final class Capabilities
|
|||||||
public static void register()
|
public static void register()
|
||||||
{
|
{
|
||||||
CapabilityManager.INSTANCE.register( IStorageMonitorableAccessor.class, createNullStorage(), NullMENetworkAccessor::new );
|
CapabilityManager.INSTANCE.register( IStorageMonitorableAccessor.class, createNullStorage(), NullMENetworkAccessor::new );
|
||||||
|
CapabilityManager.INSTANCE.register( ISpatialDimension.class, createNullStorage(), NullSpatialDimension::new );
|
||||||
}
|
}
|
||||||
|
|
||||||
@CapabilityInject( IStorageMonitorableAccessor.class )
|
@CapabilityInject( IStorageMonitorableAccessor.class )
|
||||||
@@ -65,6 +69,12 @@ public final class Capabilities
|
|||||||
STORAGE_MONITORABLE_ACCESSOR = cap;
|
STORAGE_MONITORABLE_ACCESSOR = cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CapabilityInject( ISpatialDimension.class )
|
||||||
|
private static void capISpatialDimensionRegistered( Capability<ISpatialDimension> cap )
|
||||||
|
{
|
||||||
|
SPATIAL_DIMENSION = cap;
|
||||||
|
}
|
||||||
|
|
||||||
@CapabilityInject( ITeslaConsumer.class )
|
@CapabilityInject( ITeslaConsumer.class )
|
||||||
private static void capITeslaConsumerRegistered( Capability<ITeslaConsumer> cap )
|
private static void capITeslaConsumerRegistered( Capability<ITeslaConsumer> cap )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
package appeng.capabilities;
|
package appeng.capabilities;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class NullMENetworkAccessor implements IStorageMonitorableAccessor
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IStorageMonitorable getInventory( BaseActionSource src )
|
public IStorageMonitorable getInventory( IActionSource src )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2017, 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.capabilities;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import appeng.api.storage.ISpatialDimension;
|
||||||
|
|
||||||
|
|
||||||
|
class NullSpatialDimension implements ISpatialDimension
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public int createNewCellDimension( BlockPos size, int owner )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteCellDimension( int cellStorageId )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCellDimensionOwner( int cellStorageId )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockPos getCellDimensionOrigin( int cellStorageId )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World getWorld()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCellDimension( int cellDimID )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockPos getCellContentSize( int cellDimId )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,6 @@ import appeng.core.AppEng;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.coremod.MissingCoreMod;
|
|
||||||
import appeng.entity.EntityFloatingItem;
|
import appeng.entity.EntityFloatingItem;
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
import appeng.entity.EntityTinyTNTPrimed;
|
||||||
import appeng.entity.RenderFloatingItem;
|
import appeng.entity.RenderFloatingItem;
|
||||||
@@ -241,12 +240,6 @@ public class ClientHelper extends ServerHelper
|
|||||||
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void missingCoreMod()
|
|
||||||
{
|
|
||||||
throw new MissingCoreMod();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void postPlayerRender( final RenderLivingEvent.Pre p )
|
public void postPlayerRender( final RenderLivingEvent.Pre p )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ import appeng.helpers.InventoryAction;
|
|||||||
|
|
||||||
public abstract class AEBaseGui extends GuiContainer
|
public abstract class AEBaseGui extends GuiContainer
|
||||||
{
|
{
|
||||||
private static boolean switchingGuis;
|
|
||||||
private final List<InternalSlotME> meSlots = new LinkedList<>();
|
private final List<InternalSlotME> meSlots = new LinkedList<>();
|
||||||
// drag y
|
// drag y
|
||||||
private final Set<Slot> drag_click = new HashSet<>();
|
private final Set<Slot> drag_click = new HashSet<>();
|
||||||
@@ -94,13 +93,10 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
||||||
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
||||||
private Slot bl_clicked;
|
private Slot bl_clicked;
|
||||||
private boolean subGui;
|
|
||||||
|
|
||||||
public AEBaseGui( final Container container )
|
public AEBaseGui( final Container container )
|
||||||
{
|
{
|
||||||
super( container );
|
super( container );
|
||||||
this.subGui = switchingGuis;
|
|
||||||
switchingGuis = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String join( final Collection<String> toolTip, final String delimiter )
|
protected static String join( final Collection<String> toolTip, final String delimiter )
|
||||||
@@ -123,11 +119,6 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSubGui()
|
|
||||||
{
|
|
||||||
return this.subGui;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui()
|
||||||
{
|
{
|
||||||
@@ -455,7 +446,8 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
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();
|
stack = ( (SlotME) slot ).getAEStack();
|
||||||
|
|
||||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel() )
|
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack()
|
||||||
|
.isEmpty() )
|
||||||
{
|
{
|
||||||
action = InventoryAction.AUTO_CRAFT;
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
}
|
}
|
||||||
@@ -587,7 +579,6 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
public void onGuiClosed()
|
public void onGuiClosed()
|
||||||
{
|
{
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
this.subGui = true; // in case the gui is reopened later ( i'm looking at you NEI )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Slot getSlot( final int mouseX, final int mouseY )
|
protected Slot getSlot( final int mouseX, final int mouseY )
|
||||||
@@ -715,7 +706,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
// Annoying but easier than trying to splice into render item
|
// Annoying but easier than trying to splice into render item
|
||||||
super.drawSlot( new Size1Slot( (SlotME) s ) );
|
super.drawSlot( new Size1Slot( (SlotME) s ) );
|
||||||
|
|
||||||
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.getStack(), s.xPos, s.yPos );
|
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.xPos, s.yPos );
|
||||||
|
|
||||||
}
|
}
|
||||||
catch( final Exception err )
|
catch( final Exception err )
|
||||||
@@ -870,14 +861,4 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
{
|
{
|
||||||
return this.meSlots;
|
return this.meSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final synchronized boolean isSwitchingGuis()
|
|
||||||
{
|
|
||||||
return switchingGuis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final synchronized void setSwitchingGuis( final boolean switchingGuis )
|
|
||||||
{
|
|
||||||
AEBaseGui.switchingGuis = switchingGuis;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,11 +352,11 @@ public class GuiCraftConfirm extends AEBaseGui
|
|||||||
final int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
|
final int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
|
||||||
final int posY = y * offY + yo;
|
final int posY = y * offY + yo;
|
||||||
|
|
||||||
final ItemStack is = refStack.copy().getItemStack();
|
final ItemStack is = refStack.asItemStackRepresentation();
|
||||||
|
|
||||||
if( this.tooltip == z - viewStart )
|
if( this.tooltip == z - viewStart )
|
||||||
{
|
{
|
||||||
dspToolTip = Platform.getItemDisplayName( is );
|
dspToolTip = Platform.getItemDisplayName( refStack );
|
||||||
|
|
||||||
if( lineList.size() > 0 )
|
if( lineList.size() > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -309,11 +309,11 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
|||||||
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
|
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
|
||||||
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
|
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
|
||||||
|
|
||||||
final ItemStack is = refStack.copy().getItemStack();
|
final ItemStack is = refStack.asItemStackRepresentation();
|
||||||
|
|
||||||
if( this.tooltip == z - viewStart )
|
if( this.tooltip == z - viewStart )
|
||||||
{
|
{
|
||||||
dspToolTip = Platform.getItemDisplayName( is );
|
dspToolTip = Platform.getItemDisplayName( refStack );
|
||||||
|
|
||||||
if( lineList.size() > 0 )
|
if( lineList.size() > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ import appeng.core.sync.network.NetworkHandler;
|
|||||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.WirelessTerminalGuiObject;
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import appeng.integration.Integrations;
|
||||||
import appeng.parts.reporting.AbstractPartTerminal;
|
import appeng.parts.reporting.AbstractPartTerminal;
|
||||||
import appeng.tile.misc.TileSecurityStation;
|
import appeng.tile.misc.TileSecurityStation;
|
||||||
import appeng.util.IConfigManagerHost;
|
import appeng.util.IConfigManagerHost;
|
||||||
@@ -304,6 +305,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.searchField.setEnableBackgroundDrawing( false );
|
this.searchField.setEnableBackgroundDrawing( false );
|
||||||
this.searchField.setMaxStringLength( 25 );
|
this.searchField.setMaxStringLength( 25 );
|
||||||
this.searchField.setTextColor( 0xFFFFFF );
|
this.searchField.setTextColor( 0xFFFFFF );
|
||||||
|
this.searchField.setSelectionColor( 0xFF99FF99 );
|
||||||
this.searchField.setVisible( true );
|
this.searchField.setVisible( true );
|
||||||
|
|
||||||
if( this.viewCell || this instanceof GuiWirelessTerm )
|
if( this.viewCell || this instanceof GuiWirelessTerm )
|
||||||
@@ -313,13 +315,19 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.craftingStatusBtn.setHideEdge( 13 );
|
this.craftingStatusBtn.setHideEdge( 13 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enum setting = AEConfig.instance().getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
|
||||||
final Enum setting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
final Enum setting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||||
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.JEI_AUTOSEARCH == setting );
|
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.JEI_AUTOSEARCH == setting );
|
||||||
|
this.searchField.setCanLoseFocus( SearchBoxMode.MANUAL_SEARCH == setting || SearchBoxMode.JEI_MANUAL_SEARCH == setting );
|
||||||
|
|
||||||
if( this.isSubGui() )
|
if( setting == SearchBoxMode.JEI_AUTOSEARCH || setting == SearchBoxMode.JEI_MANUAL_SEARCH )
|
||||||
|
{
|
||||||
|
memoryText = Integrations.jei().getSearchText();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( memoryText != null && !memoryText.isEmpty() )
|
||||||
{
|
{
|
||||||
this.searchField.setText( memoryText );
|
this.searchField.setText( memoryText );
|
||||||
|
this.searchField.selectAll();
|
||||||
this.repo.setSearchString( memoryText );
|
this.repo.setSearchString( memoryText );
|
||||||
this.repo.updateView();
|
this.repo.updateView();
|
||||||
this.setScrollBar();
|
this.setScrollBar();
|
||||||
@@ -363,12 +371,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
@Override
|
@Override
|
||||||
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
|
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
|
||||||
{
|
{
|
||||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
this.searchField.mouseClicked( xCoord, yCoord, btn );
|
||||||
|
|
||||||
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.JEI_AUTOSEARCH )
|
|
||||||
{
|
|
||||||
this.searchField.mouseClicked( xCoord, yCoord, btn );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
|
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
|
|
||||||
if( this.tooltip == z - viewStart )
|
if( this.tooltip == z - viewStart )
|
||||||
{
|
{
|
||||||
toolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
|
toolTip = Platform.getItemDisplayName( refStack );
|
||||||
|
|
||||||
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
|
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
|
||||||
if( refStack.getCountRequestable() > 0 )
|
if( refStack.getCountRequestable() > 0 )
|
||||||
@@ -192,7 +192,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
toolPosY = y * 18 + yo;
|
toolPosY = y * 18 + yo;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawItem( posX, posY, this.repo.getItem( z ) );
|
this.drawItem( posX, posY, refStack.asItemStackRepresentation() );
|
||||||
|
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
|
|||||||
@@ -78,12 +78,23 @@ public class GuiSpatialIOPort extends AEBaseGui
|
|||||||
this.fontRenderer.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21,
|
this.fontRenderer.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21,
|
||||||
4210752 );
|
4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 );
|
this.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 78,
|
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 73,
|
||||||
4210752 );
|
4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 88, 4210752 );
|
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 83, 4210752 );
|
||||||
|
|
||||||
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
|
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
|
||||||
|
|
||||||
|
if( this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0 )
|
||||||
|
{
|
||||||
|
final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize + "x" + this.container.zSize;
|
||||||
|
this.fontRenderer.drawString( text, 13, 93, 4210752 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSSInvalid.getLocal(), 13, 93, 4210752 );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ package appeng.client.gui.widgets;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +43,7 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
private final int _yPos;
|
private final int _yPos;
|
||||||
private final int _width;
|
private final int _width;
|
||||||
private final int _height;
|
private final int _height;
|
||||||
|
private int selectionColor = 0xFF00FF00;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the values to instantiate a padded version of a text field.
|
* Uses the values to instantiate a padded version of a text field.
|
||||||
@@ -66,8 +71,11 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
super.mouseClicked( xPos, yPos, button );
|
super.mouseClicked( xPos, yPos, button );
|
||||||
|
|
||||||
final boolean requiresFocus = this.isMouseIn( xPos, yPos );
|
final boolean requiresFocus = this.isMouseIn( xPos, yPos );
|
||||||
|
if( !this.isFocused() )
|
||||||
|
{
|
||||||
|
this.setFocused( requiresFocus );
|
||||||
|
}
|
||||||
|
|
||||||
this.setFocused( requiresFocus );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,4 +94,69 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
|
|
||||||
return withinXRange && withinYRange;
|
return withinXRange && withinYRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void selectAll()
|
||||||
|
{
|
||||||
|
this.setCursorPosition( 0 );
|
||||||
|
this.setSelectionPos( this.getMaxStringLength() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectionColor( int color )
|
||||||
|
{
|
||||||
|
this.selectionColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawSelectionBox( int startX, int startY, int endX, int endY )
|
||||||
|
{
|
||||||
|
if( startX < endX )
|
||||||
|
{
|
||||||
|
int i = startX;
|
||||||
|
startX = endX;
|
||||||
|
endX = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
startX += 1;
|
||||||
|
endX -= 1;
|
||||||
|
|
||||||
|
if( startY < endY )
|
||||||
|
{
|
||||||
|
int j = startY;
|
||||||
|
startY = endY;
|
||||||
|
endY = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
startY -= PADDING;
|
||||||
|
|
||||||
|
if( endX > this.x + this.width )
|
||||||
|
{
|
||||||
|
endX = this.x + this.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( startX > this.x + this.width )
|
||||||
|
{
|
||||||
|
startX = this.x + this.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||||
|
|
||||||
|
float red = (float) ( this.selectionColor >> 16 & 255 ) / 255.0F;
|
||||||
|
float blue = (float) ( this.selectionColor >> 8 & 255 ) / 255.0F;
|
||||||
|
float green = (float) ( this.selectionColor & 255 ) / 255.0F;
|
||||||
|
float alpha = (float) ( this.selectionColor >> 24 & 255 ) / 255.0F;
|
||||||
|
|
||||||
|
GlStateManager.color( red, green, blue, alpha );
|
||||||
|
GlStateManager.disableTexture2D();
|
||||||
|
GlStateManager.enableColorLogic();
|
||||||
|
GlStateManager.colorLogicOp( GlStateManager.LogicOp.OR_REVERSE );
|
||||||
|
bufferbuilder.begin( 7, DefaultVertexFormats.POSITION );
|
||||||
|
bufferbuilder.pos( (double) startX, (double) endY, 0.0D ).endVertex();
|
||||||
|
bufferbuilder.pos( (double) endX, (double) endY, 0.0D ).endVertex();
|
||||||
|
bufferbuilder.pos( (double) endX, (double) startY, 0.0D ).endVertex();
|
||||||
|
bufferbuilder.pos( (double) startX, (double) startY, 0.0D ).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
GlStateManager.disableColorLogic();
|
||||||
|
GlStateManager.enableTexture2D();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class InternalSlotME
|
|||||||
|
|
||||||
ItemStack getStack()
|
ItemStack getStack()
|
||||||
{
|
{
|
||||||
return this.repo.getItem( this.offset );
|
return this.getAEStack() == null ? ItemStack.EMPTY : this.getAEStack().asItemStackRepresentation();
|
||||||
}
|
}
|
||||||
|
|
||||||
IAEItemStack getAEStack()
|
IAEItemStack getAEStack()
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public class ItemRepo
|
|||||||
|
|
||||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||||
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||||
private final ArrayList<ItemStack> dsp = new ArrayList<>();
|
|
||||||
private final IScrollSource src;
|
private final IScrollSource src;
|
||||||
private final ISortSource sortSrc;
|
private final ISortSource sortSrc;
|
||||||
|
|
||||||
@@ -78,17 +77,6 @@ public class ItemRepo
|
|||||||
return this.view.get( idx );
|
return this.view.get( idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem( int idx )
|
|
||||||
{
|
|
||||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
|
||||||
|
|
||||||
if( idx >= this.dsp.size() )
|
|
||||||
{
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
return this.dsp.get( idx );
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSearch( final String search )
|
void setSearch( final String search )
|
||||||
{
|
{
|
||||||
this.searchString = search == null ? "" : search;
|
this.searchString = search == null ? "" : search;
|
||||||
@@ -118,10 +106,8 @@ public class ItemRepo
|
|||||||
public void updateView()
|
public void updateView()
|
||||||
{
|
{
|
||||||
this.view.clear();
|
this.view.clear();
|
||||||
this.dsp.clear();
|
|
||||||
|
|
||||||
this.view.ensureCapacity( this.list.size() );
|
this.view.ensureCapacity( this.list.size() );
|
||||||
this.dsp.ensureCapacity( this.list.size() );
|
|
||||||
|
|
||||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||||
@@ -177,12 +163,10 @@ public class ItemRepo
|
|||||||
if( viewMode == ViewItems.CRAFTABLE )
|
if( viewMode == ViewItems.CRAFTABLE )
|
||||||
{
|
{
|
||||||
is = is.copy();
|
is = is.copy();
|
||||||
// is.setStackSize( 0 ) triggers isEmpty() and thus only shows empty stacks!
|
is.setStackSize( 0 );
|
||||||
is.setStackSize( 1 );
|
|
||||||
is.setShowCraftingLabel( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( viewMode == ViewItems.STORED && is.getShowCraftingLabel() )
|
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -196,7 +180,7 @@ public class ItemRepo
|
|||||||
notDone = false;
|
notDone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( terminalSearchToolTips && notDone )
|
if( terminalSearchToolTips && notDone && !searchMod )
|
||||||
{
|
{
|
||||||
for( final Object lp : Platform.getTooltip( is ) )
|
for( final Object lp : Platform.getTooltip( is ) )
|
||||||
{
|
{
|
||||||
@@ -237,11 +221,6 @@ public class ItemRepo
|
|||||||
{
|
{
|
||||||
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME );
|
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( final IAEItemStack is : this.view )
|
|
||||||
{
|
|
||||||
this.dsp.add( is.getItemStack() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateJEI( String filter )
|
private void updateJEI( String filter )
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package appeng.client.render;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
@@ -42,9 +41,9 @@ public class StackSizeRenderer
|
|||||||
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
|
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||||
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
|
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||||
|
|
||||||
public void renderStackSize( FontRenderer fontRenderer, IAEItemStack aeStack, ItemStack is, int xPos, int yPos )
|
public void renderStackSize( FontRenderer fontRenderer, IAEItemStack aeStack, int xPos, int yPos )
|
||||||
{
|
{
|
||||||
if( !is.isEmpty() )
|
if( aeStack != null )
|
||||||
{
|
{
|
||||||
final float scaleFactor = AEConfig.instance().useTerminalUseLargeFont() ? 0.85f : 0.5f;
|
final float scaleFactor = AEConfig.instance().useTerminalUseLargeFont() ? 0.85f : 0.5f;
|
||||||
final float inverseScaleFactor = 1.0f / scaleFactor;
|
final float inverseScaleFactor = 1.0f / scaleFactor;
|
||||||
@@ -53,7 +52,7 @@ public class StackSizeRenderer
|
|||||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||||
fontRenderer.setUnicodeFlag( false );
|
fontRenderer.setUnicodeFlag( false );
|
||||||
|
|
||||||
if( aeStack.getShowCraftingLabel() )
|
if( aeStack.getStackSize() == 0 && aeStack.isCraftable() )
|
||||||
{
|
{
|
||||||
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
|
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
|
||||||
.getLocal();
|
.getLocal();
|
||||||
@@ -71,10 +70,9 @@ public class StackSizeRenderer
|
|||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
final long amount = aeStack != null ? aeStack.getStackSize() : is.getCount();
|
if( aeStack.getStackSize() > 0 )
|
||||||
if( amount != 0 && !aeStack.getShowCraftingLabel() )
|
|
||||||
{
|
{
|
||||||
final String stackSize = this.getToBeRenderedStackSize( amount );
|
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
|
||||||
|
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
|
|||||||
@@ -126,8 +126,9 @@ public class TesrRenderHelper
|
|||||||
*/
|
*/
|
||||||
public static void renderItem2dWithAmount( IAEItemStack itemStack, float itemScale, float spacing )
|
public static void renderItem2dWithAmount( IAEItemStack itemStack, float itemScale, float spacing )
|
||||||
{
|
{
|
||||||
|
final ItemStack renderStack = itemStack.asItemStackRepresentation();
|
||||||
|
|
||||||
TesrRenderHelper.renderItem2d( itemStack.getItemStack(), itemScale );
|
TesrRenderHelper.renderItem2d( renderStack, itemScale );
|
||||||
|
|
||||||
final long stackSize = itemStack.getStackSize();
|
final long stackSize = itemStack.getStackSize();
|
||||||
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ class CableBuilder
|
|||||||
case SMART:
|
case SMART:
|
||||||
textureFolder = "parts/cable/smart/";
|
textureFolder = "parts/cable/smart/";
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
textureFolder = "parts/cable/dense_covered/";
|
||||||
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
textureFolder = "parts/cable/dense_smart/";
|
textureFolder = "parts/cable/dense_smart/";
|
||||||
break;
|
break;
|
||||||
@@ -127,6 +130,7 @@ class CableBuilder
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.addCableCore( CableCoreType.COVERED, color, quadsOut );
|
this.addCableCore( CableCoreType.COVERED, color, quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
||||||
break;
|
break;
|
||||||
@@ -448,7 +452,31 @@ class CableBuilder
|
|||||||
addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder );
|
addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDenseConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
public void addDenseCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
|
||||||
|
{
|
||||||
|
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
|
||||||
|
if( connectionType == AECableType.COVERED || connectionType == AECableType.SMART || connectionType == AECableType.GLASS )
|
||||||
|
{
|
||||||
|
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
// We render all faces except the one on the connection side
|
||||||
|
cubeBuilder.setDrawFaces( EnumSet.complementOf( EnumSet.of( facing ) ) );
|
||||||
|
|
||||||
|
TextureAtlasSprite texture = this.connectionTextures.get( AECableType.DENSE_COVERED ).get( cableColor );
|
||||||
|
cubeBuilder.setTexture( texture );
|
||||||
|
|
||||||
|
addDenseCableSizedCube( facing, cubeBuilder );
|
||||||
|
|
||||||
|
// Reset back to normal rendering for the rest
|
||||||
|
cubeBuilder.setRenderFullBright( false );
|
||||||
|
cubeBuilder.setTexture( texture );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDenseSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
||||||
{
|
{
|
||||||
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
|
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
|
||||||
if( connectionType == AECableType.SMART )
|
if( connectionType == AECableType.SMART )
|
||||||
@@ -456,7 +484,7 @@ class CableBuilder
|
|||||||
this.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
this.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( connectionType != AECableType.DENSE_SMART )
|
else if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
|
||||||
{
|
{
|
||||||
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
return;
|
return;
|
||||||
@@ -495,7 +523,19 @@ class CableBuilder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStraightDenseConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
|
public void addStraightDenseCoveredConnection( EnumFacing facing, AEColor cableColor, List<BakedQuad> quadsOut )
|
||||||
|
{
|
||||||
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
TextureAtlasSprite texture = this.connectionTextures.get( AECableType.DENSE_COVERED ).get( cableColor );
|
||||||
|
cubeBuilder.setTexture( texture );
|
||||||
|
|
||||||
|
setStraightCableUVs( cubeBuilder, facing, 5, 11 );
|
||||||
|
|
||||||
|
addStraightDenseCableSizedCube( facing, cubeBuilder );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addStraightDenseSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
|
||||||
{
|
{
|
||||||
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
{
|
{
|
||||||
case GLASS:
|
case GLASS:
|
||||||
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
return firstType == AECableType.DENSE_COVERED && secondType == AECableType.DENSE_COVERED;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
||||||
}
|
}
|
||||||
@@ -200,8 +202,11 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
this.cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
this.cableBuilder.addStraightDenseCoveredConnection( facing, cableColor, quadsOut );
|
||||||
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.cableBuilder.addStraightDenseConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
this.cableBuilder.addStraightDenseSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +233,7 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.cableBuilder.addConstrainedSmartConnection( facing, cableColor, distance, channels, quadsOut );
|
this.cableBuilder.addConstrainedSmartConnection( facing, cableColor, distance, channels, quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
// Dense cables do not render connections to parts since none can be attached
|
// Dense cables do not render connections to parts since none can be attached
|
||||||
break;
|
break;
|
||||||
@@ -253,8 +259,11 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
case SMART:
|
case SMART:
|
||||||
this.cableBuilder.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
this.cableBuilder.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||||
break;
|
break;
|
||||||
|
case DENSE_COVERED:
|
||||||
|
this.cableBuilder.addDenseCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.cableBuilder.addDenseConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
this.cableBuilder.addDenseSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public enum CableCoreType
|
|||||||
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
||||||
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
||||||
result.put( AECableType.SMART, CableCoreType.COVERED );
|
result.put( AECableType.SMART, CableCoreType.COVERED );
|
||||||
|
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE_SMART );
|
||||||
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
||||||
|
|
||||||
return ImmutableMap.copyOf( result );
|
return ImmutableMap.copyOf( result );
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.client.render.effects;
|
|||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
@@ -45,7 +46,8 @@ public class AssemblerFX extends Particle implements ICanDie
|
|||||||
this.motionY = 0;
|
this.motionY = 0;
|
||||||
this.motionZ = 0;
|
this.motionZ = 0;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
|
final ItemStack displayItem = is.asItemStackRepresentation();
|
||||||
|
this.fi = new EntityFloatingItem( this, w, x, y, z, displayItem );
|
||||||
w.spawnEntity( this.fi );
|
w.spawnEntity( this.fi );
|
||||||
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
|
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,17 +191,19 @@ public enum UVLModelLoader implements ICustomModelLoader
|
|||||||
{
|
{
|
||||||
modelPath = modelPath.substring( "models/".length() );
|
modelPath = modelPath.substring( "models/".length() );
|
||||||
}
|
}
|
||||||
|
|
||||||
try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft()
|
try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft()
|
||||||
.getResourceManager()
|
.getResourceManager()
|
||||||
.getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) )
|
.getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) )
|
||||||
.getInputStream() ) )
|
.getInputStream() ) )
|
||||||
{
|
{
|
||||||
return gson.fromJson( io, UVLMarker.class ).uvlMarker;
|
return gson.fromJson( io, UVLMarker.class ).ae2_uvl_marker;
|
||||||
}
|
}
|
||||||
catch( IOException e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
|
// Catch-all in case of any JSON parser issues.
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +389,7 @@ public enum UVLModelLoader implements ICustomModelLoader
|
|||||||
|
|
||||||
class UVLMarker
|
class UVLMarker
|
||||||
{
|
{
|
||||||
boolean uvlMarker = false;
|
boolean ae2_uvl_marker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -51,10 +51,9 @@ import appeng.api.networking.IGrid;
|
|||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.energy.IEnergyGrid;
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
|
||||||
import appeng.api.networking.security.IActionHost;
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.security.ISecurityGrid;
|
import appeng.api.networking.security.ISecurityGrid;
|
||||||
import appeng.api.networking.security.PlayerSource;
|
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.api.storage.IMEInventoryHandler;
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
@@ -77,6 +76,7 @@ import appeng.core.sync.packets.PacketPartialItem;
|
|||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.ICustomNameObject;
|
import appeng.helpers.ICustomNameObject;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.me.helpers.PlayerSource;
|
||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.inv.AdaptorItemHandler;
|
import appeng.util.inv.AdaptorItemHandler;
|
||||||
@@ -87,7 +87,7 @@ import appeng.util.item.AEItemStack;
|
|||||||
public abstract class AEBaseContainer extends Container
|
public abstract class AEBaseContainer extends Container
|
||||||
{
|
{
|
||||||
private final InventoryPlayer invPlayer;
|
private final InventoryPlayer invPlayer;
|
||||||
private final BaseActionSource mySrc;
|
private final IActionSource mySrc;
|
||||||
private final HashSet<Integer> locked = new HashSet<>();
|
private final HashSet<Integer> locked = new HashSet<>();
|
||||||
private final TileEntity tileEntity;
|
private final TileEntity tileEntity;
|
||||||
private final IPart part;
|
private final IPart part;
|
||||||
@@ -225,10 +225,11 @@ public abstract class AEBaseContainer extends Container
|
|||||||
// client doesn't need to re-send, makes for lower overhead rapid packets.
|
// client doesn't need to re-send, makes for lower overhead rapid packets.
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
final ItemStack a = stack == null ? ItemStack.EMPTY : stack.getItemStack();
|
if( stack == null && this.clientRequestedTargetItem == null )
|
||||||
final ItemStack b = this.clientRequestedTargetItem == null ? ItemStack.EMPTY : this.clientRequestedTargetItem.getItemStack();
|
{
|
||||||
|
return;
|
||||||
if( Platform.itemComparisons().isSameItem( a, b ) )
|
}
|
||||||
|
if( stack != null && stack.isSameType( this.clientRequestedTargetItem ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -279,7 +280,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseActionSource getActionSource()
|
public IActionSource getActionSource()
|
||||||
{
|
{
|
||||||
return this.mySrc;
|
return this.mySrc;
|
||||||
}
|
}
|
||||||
@@ -828,11 +829,11 @@ public abstract class AEBaseContainer extends Container
|
|||||||
|
|
||||||
if( action == InventoryAction.MOVE_REGION )
|
if( action == InventoryAction.MOVE_REGION )
|
||||||
{
|
{
|
||||||
final List<Slot> from = new LinkedList<>();
|
final List<Slot> from = new ArrayList<>();
|
||||||
|
|
||||||
for( final Object j : this.inventorySlots )
|
for( final Object j : this.inventorySlots )
|
||||||
{
|
{
|
||||||
if( j instanceof Slot && j.getClass() == s.getClass() )
|
if( j instanceof Slot && j.getClass() == s.getClass() && !( j instanceof SlotCraftingTerm ) )
|
||||||
{
|
{
|
||||||
from.add( (Slot) j );
|
from.add( (Slot) j );
|
||||||
}
|
}
|
||||||
@@ -861,7 +862,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
if( slotItem != null )
|
if( slotItem != null )
|
||||||
{
|
{
|
||||||
IAEItemStack ais = slotItem.copy();
|
IAEItemStack ais = slotItem.copy();
|
||||||
ItemStack myItem = ais.getItemStack();
|
ItemStack myItem = ais.createItemStack();
|
||||||
|
|
||||||
ais.setStackSize( myItem.getMaxStackSize() );
|
ais.setStackSize( myItem.getMaxStackSize() );
|
||||||
|
|
||||||
@@ -877,7 +878,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||||
if( ais != null )
|
if( ais != null )
|
||||||
{
|
{
|
||||||
adp.addItems( ais.getItemStack() );
|
adp.addItems( ais.createItemStack() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -901,7 +902,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
final InventoryAdaptor ia = new AdaptorItemHandler( new WrapperCursorItemHandler( player.inventory ) );
|
final InventoryAdaptor ia = new AdaptorItemHandler( new WrapperCursorItemHandler( player.inventory ) );
|
||||||
|
|
||||||
final ItemStack fail = ia.removeItems( 1, extracted.getItemStack(), null );
|
final ItemStack fail = ia.removeItems( 1, extracted.getDefinition(), null );
|
||||||
if( fail.isEmpty() )
|
if( fail.isEmpty() )
|
||||||
{
|
{
|
||||||
this.getCellInventory().extractItems( extracted, Actionable.MODULATE, this.getActionSource() );
|
this.getCellInventory().extractItems( extracted, Actionable.MODULATE, this.getActionSource() );
|
||||||
@@ -930,7 +931,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
liftQty = 0;
|
liftQty = 0;
|
||||||
}
|
}
|
||||||
if( !Platform.itemComparisons().isSameItem( slotItem.getItemStack(), item ) )
|
if( !Platform.itemComparisons().isSameItem( slotItem.getDefinition(), item ) )
|
||||||
{
|
{
|
||||||
liftQty = 0;
|
liftQty = 0;
|
||||||
}
|
}
|
||||||
@@ -945,7 +946,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
final InventoryAdaptor ia = new AdaptorItemHandler( new WrapperCursorItemHandler( player.inventory ) );
|
final InventoryAdaptor ia = new AdaptorItemHandler( new WrapperCursorItemHandler( player.inventory ) );
|
||||||
|
|
||||||
final ItemStack fail = ia.addItems( ais.getItemStack() );
|
final ItemStack fail = ia.addItems( ais.createItemStack() );
|
||||||
if( !fail.isEmpty() )
|
if( !fail.isEmpty() )
|
||||||
{
|
{
|
||||||
this.getCellInventory().injectItems( ais, Actionable.MODULATE, this.getActionSource() );
|
this.getCellInventory().injectItems( ais, Actionable.MODULATE, this.getActionSource() );
|
||||||
@@ -967,11 +968,11 @@ public abstract class AEBaseContainer extends Container
|
|||||||
if( slotItem != null )
|
if( slotItem != null )
|
||||||
{
|
{
|
||||||
IAEItemStack ais = slotItem.copy();
|
IAEItemStack ais = slotItem.copy();
|
||||||
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
|
ais.setStackSize( ais.getDefinition().getMaxStackSize() );
|
||||||
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||||
if( ais != null )
|
if( ais != null )
|
||||||
{
|
{
|
||||||
player.inventory.setItemStack( ais.getItemStack() );
|
player.inventory.setItemStack( ais.createItemStack() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -986,7 +987,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||||
if( ais != null )
|
if( ais != null )
|
||||||
{
|
{
|
||||||
player.inventory.setItemStack( ais.getItemStack() );
|
player.inventory.setItemStack( ais.createItemStack() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1007,7 +1008,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
if( slotItem != null )
|
if( slotItem != null )
|
||||||
{
|
{
|
||||||
IAEItemStack ais = slotItem.copy();
|
IAEItemStack ais = slotItem.copy();
|
||||||
final long maxSize = ais.getItemStack().getMaxStackSize();
|
final long maxSize = ais.getDefinition().getMaxStackSize();
|
||||||
ais.setStackSize( maxSize );
|
ais.setStackSize( maxSize );
|
||||||
ais = this.getCellInventory().extractItems( ais, Actionable.SIMULATE, this.getActionSource() );
|
ais = this.getCellInventory().extractItems( ais, Actionable.SIMULATE, this.getActionSource() );
|
||||||
|
|
||||||
@@ -1020,7 +1021,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
|
|
||||||
if( ais != null )
|
if( ais != null )
|
||||||
{
|
{
|
||||||
player.inventory.setItemStack( ais.getItemStack() );
|
player.inventory.setItemStack( ais.createItemStack() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1050,7 +1051,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
case CREATIVE_DUPLICATE:
|
case CREATIVE_DUPLICATE:
|
||||||
if( player.capabilities.isCreativeMode && slotItem != null )
|
if( player.capabilities.isCreativeMode && slotItem != null )
|
||||||
{
|
{
|
||||||
final ItemStack is = slotItem.getItemStack();
|
final ItemStack is = slotItem.createItemStack();
|
||||||
is.setCount( is.getMaxStackSize() );
|
is.setCount( is.getMaxStackSize() );
|
||||||
player.inventory.setItemStack( is );
|
player.inventory.setItemStack( is );
|
||||||
this.updateHeld( player );
|
this.updateHeld( player );
|
||||||
@@ -1069,7 +1070,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
for( int slotNum = 0; slotNum < playerInv; slotNum++ )
|
for( int slotNum = 0; slotNum < playerInv; slotNum++ )
|
||||||
{
|
{
|
||||||
IAEItemStack ais = slotItem.copy();
|
IAEItemStack ais = slotItem.copy();
|
||||||
ItemStack myItem = ais.getItemStack();
|
ItemStack myItem = ais.createItemStack();
|
||||||
|
|
||||||
ais.setStackSize( myItem.getMaxStackSize() );
|
ais.setStackSize( myItem.getMaxStackSize() );
|
||||||
|
|
||||||
@@ -1085,7 +1086,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||||
if( ais != null )
|
if( ais != null )
|
||||||
{
|
{
|
||||||
adp.addItems( ais.getItemStack() );
|
adp.addItems( ais.createItemStack() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1128,7 +1129,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
return ais.getItemStack();
|
return ais.createItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSlot( final Slot clickSlot )
|
private void updateSlot( final Slot clickSlot )
|
||||||
|
|||||||
@@ -240,8 +240,8 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
{
|
{
|
||||||
if( i.hasNext() )
|
if( i.hasNext() )
|
||||||
{
|
{
|
||||||
final ItemStack g = i.next().getItemStack();
|
// TODO: check if ok
|
||||||
g.setCount( 1 );
|
final ItemStack g = i.next().asItemStackRepresentation();
|
||||||
ItemHandlerUtil.setStackInSlot( inv, x, g );
|
ItemHandlerUtil.setStackInSlot( inv, x, g );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
|
||||||
import appeng.api.networking.security.IActionHost;
|
import appeng.api.networking.security.IActionHost;
|
||||||
import appeng.api.networking.security.PlayerSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.slot.SlotInaccessible;
|
import appeng.container.slot.SlotInaccessible;
|
||||||
|
import appeng.me.helpers.PlayerSource;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class ContainerCraftAmount extends AEBaseContainer
|
|||||||
return this.getPlayerInv().player.world;
|
return this.getPlayerInv().player.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseActionSource getActionSrc()
|
public IActionSource getActionSrc()
|
||||||
{
|
{
|
||||||
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,8 @@ import appeng.api.networking.crafting.ICraftingCPU;
|
|||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingJob;
|
import appeng.api.networking.crafting.ICraftingJob;
|
||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
|
||||||
import appeng.api.networking.security.IActionHost;
|
import appeng.api.networking.security.IActionHost;
|
||||||
import appeng.api.networking.security.PlayerSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.storage.IStorageGrid;
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventory;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
@@ -58,8 +57,8 @@ import appeng.core.AELog;
|
|||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
|
||||||
import appeng.helpers.WirelessTerminalGuiObject;
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import appeng.me.helpers.PlayerSource;
|
||||||
import appeng.parts.reporting.PartCraftingTerminal;
|
import appeng.parts.reporting.PartCraftingTerminal;
|
||||||
import appeng.parts.reporting.PartPatternTerminal;
|
import appeng.parts.reporting.PartPatternTerminal;
|
||||||
import appeng.parts.reporting.PartTerminal;
|
import appeng.parts.reporting.PartTerminal;
|
||||||
@@ -353,15 +352,13 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
|||||||
this.setAutoStart( false );
|
this.setAutoStart( false );
|
||||||
if( g != null && originalGui != null && this.getOpenContext() != null )
|
if( g != null && originalGui != null && this.getOpenContext() != null )
|
||||||
{
|
{
|
||||||
NetworkHandler.instance().sendTo( new PacketSwitchGuis( originalGui ), (EntityPlayerMP) this.getInventoryPlayer().player );
|
|
||||||
|
|
||||||
final TileEntity te = this.getOpenContext().getTile();
|
final TileEntity te = this.getOpenContext().getTile();
|
||||||
Platform.openGUI( this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui );
|
Platform.openGUI( this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseActionSource getActionSrc()
|
private IActionSource getActionSrc()
|
||||||
{
|
{
|
||||||
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,16 +28,14 @@ import net.minecraft.inventory.IContainerListener;
|
|||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
import appeng.api.networking.IGridHost;
|
|
||||||
import appeng.api.networking.IGridNode;
|
|
||||||
import appeng.api.networking.crafting.CraftingItemList;
|
import appeng.api.networking.crafting.CraftingItemList;
|
||||||
import appeng.api.networking.crafting.ICraftingCPU;
|
import appeng.api.networking.crafting.ICraftingCPU;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.storage.IBaseMonitor;
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AEPartLocation;
|
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -65,15 +63,11 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
public ContainerCraftingCPU( final InventoryPlayer ip, final Object te )
|
public ContainerCraftingCPU( final InventoryPlayer ip, final Object te )
|
||||||
{
|
{
|
||||||
super( ip, te );
|
super( ip, te );
|
||||||
final IGridHost host = (IGridHost) ( te instanceof IGridHost ? te : null );
|
final IActionHost host = (IActionHost) ( te instanceof IActionHost ? te : null );
|
||||||
|
|
||||||
if( host != null )
|
if( host != null && host.getActionableNode() != null )
|
||||||
{
|
{
|
||||||
this.findNode( host, AEPartLocation.INTERNAL );
|
this.setNetwork( host.getActionableNode().getGrid() );
|
||||||
for( final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
|
|
||||||
{
|
|
||||||
this.findNode( host, d );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( te instanceof TileCraftingTile )
|
if( te instanceof TileCraftingTile )
|
||||||
@@ -87,18 +81,6 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findNode( final IGridHost host, final AEPartLocation d )
|
|
||||||
{
|
|
||||||
if( this.getNetwork() == null )
|
|
||||||
{
|
|
||||||
final IGridNode node = host.getGridNode( d );
|
|
||||||
if( node != null )
|
|
||||||
{
|
|
||||||
this.setNetwork( node.getGrid() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setCPU( final ICraftingCPU c )
|
protected void setCPU( final ICraftingCPU c )
|
||||||
{
|
{
|
||||||
if( c == this.getMonitor() )
|
if( c == this.getMonitor() )
|
||||||
@@ -238,7 +220,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final BaseActionSource actionSource )
|
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource actionSource )
|
||||||
{
|
{
|
||||||
for( IAEItemStack is : change )
|
for( IAEItemStack is : change )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
|||||||
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
|
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
|
||||||
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
|
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
|
||||||
private final SlotCraftingTerm outputSlot;
|
private final SlotCraftingTerm outputSlot;
|
||||||
|
private IRecipe currentRecipe;
|
||||||
|
|
||||||
public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
|
public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||||
{
|
{
|
||||||
@@ -85,7 +87,21 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
|||||||
ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() );
|
ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.outputSlot.putStack( CraftingManager.findMatchingResult( ic, this.getPlayerInv().player.world ) );
|
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, this.getPlayerInv().player.world ) )
|
||||||
|
{
|
||||||
|
this.currentRecipe = CraftingManager.findMatchingRecipe( ic, this.getPlayerInv().player.world );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this.currentRecipe == null )
|
||||||
|
{
|
||||||
|
this.outputSlot.putStack( ItemStack.EMPTY );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final ItemStack craftingResult = this.currentRecipe.getCraftingResult( ic );
|
||||||
|
|
||||||
|
this.outputSlot.putStack( craftingResult );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -115,4 +131,9 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IRecipe getCurrentRecipe()
|
||||||
|
{
|
||||||
|
return this.currentRecipe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
|||||||
{
|
{
|
||||||
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||||
( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
( ( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||||
|
|
||||||
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||||
( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
( ( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||||
|
|
||||||
if( matchA || matchB )
|
if( matchA || matchB )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ import appeng.api.networking.IGridHost;
|
|||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.energy.IEnergyGrid;
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.storage.IBaseMonitor;
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
@@ -122,9 +123,22 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||||||
{
|
{
|
||||||
this.setPowerSource( (IEnergySource) monitorable );
|
this.setPowerSource( (IEnergySource) monitorable );
|
||||||
}
|
}
|
||||||
else if( monitorable instanceof IGridHost )
|
else if( monitorable instanceof IGridHost || monitorable instanceof IActionHost )
|
||||||
{
|
{
|
||||||
final IGridNode node = ( (IGridHost) monitorable ).getGridNode( AEPartLocation.INTERNAL );
|
final IGridNode node;
|
||||||
|
if( monitorable instanceof IGridHost )
|
||||||
|
{
|
||||||
|
node = ( (IGridHost) monitorable ).getGridNode( AEPartLocation.INTERNAL );
|
||||||
|
}
|
||||||
|
else if( monitorable instanceof IActionHost )
|
||||||
|
{
|
||||||
|
node = ( (IActionHost) monitorable ).getActionableNode();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
|
||||||
if( node != null )
|
if( node != null )
|
||||||
{
|
{
|
||||||
this.networkNode = node;
|
this.networkNode = node;
|
||||||
@@ -374,7 +388,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final BaseActionSource source )
|
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource source )
|
||||||
{
|
{
|
||||||
for( final IAEItemStack is : change )
|
for( final IAEItemStack is : change )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import appeng.api.config.Actionable;
|
|||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.container.interfaces.IInventorySlotAware;
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
|
|
||||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||||
@@ -67,7 +66,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
|||||||
{
|
{
|
||||||
if( !currentItem.isEmpty() )
|
if( !currentItem.isEmpty() )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isEqualItem( this.civ.getItemStack(), currentItem ) )
|
if( ItemStack.areItemsEqual( this.civ.getItemStack(), currentItem ) )
|
||||||
{
|
{
|
||||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.civ.getItemStack() );
|
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.civ.getItemStack() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class ContainerNetworkTool extends AEBaseContainer
|
|||||||
{
|
{
|
||||||
if( !currentItem.isEmpty() )
|
if( !currentItem.isEmpty() )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
|
if( ItemStack.areItemsEqual( this.toolInv.getItemStack(), currentItem ) )
|
||||||
{
|
{
|
||||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.definitions.IDefinitions;
|
import appeng.api.definitions.IDefinitions;
|
||||||
import appeng.api.networking.security.MachineSource;
|
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
@@ -59,6 +58,7 @@ import appeng.container.slot.SlotRestrictedInput;
|
|||||||
import appeng.core.sync.packets.PacketPatternSlot;
|
import appeng.core.sync.packets.PacketPatternSlot;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
import appeng.items.storage.ItemViewCell;
|
import appeng.items.storage.ItemViewCell;
|
||||||
|
import appeng.me.helpers.MachineSource;
|
||||||
import appeng.parts.reporting.PartPatternTerminal;
|
import appeng.parts.reporting.PartPatternTerminal;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
@@ -364,7 +364,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
inv = playerInv;
|
inv = playerInv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !inv.simulateAdd( out.getItemStack() ).isEmpty() )
|
if( !inv.simulateAdd( out.createItemStack() ).isEmpty() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -374,7 +374,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
|
|
||||||
if( extracted != null )
|
if( extracted != null )
|
||||||
{
|
{
|
||||||
inv.addItems( extracted.getItemStack() );
|
inv.addItems( extracted.createItemStack() );
|
||||||
if( p instanceof EntityPlayerMP )
|
if( p instanceof EntityPlayerMP )
|
||||||
{
|
{
|
||||||
this.updateHeld( (EntityPlayerMP) p );
|
this.updateHeld( (EntityPlayerMP) p );
|
||||||
@@ -388,10 +388,10 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
|
|
||||||
for( int x = 0; x < 9; x++ )
|
for( int x = 0; x < 9; x++ )
|
||||||
{
|
{
|
||||||
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].getItemStack() );
|
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].createItemStack() );
|
||||||
}
|
}
|
||||||
|
|
||||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
|
final IRecipe r = CraftingManager.findMatchingRecipe( ic, p.world );
|
||||||
|
|
||||||
if( r == null )
|
if( r == null )
|
||||||
{
|
{
|
||||||
@@ -413,7 +413,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final IRecipe rr = Platform.findMatchingRecipe( real, p.world );
|
final IRecipe rr = CraftingManager.findMatchingRecipe( real, p.world );
|
||||||
|
|
||||||
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
|
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
{
|
{
|
||||||
if( !currentItem.isEmpty() )
|
if( !currentItem.isEmpty() )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isEqualItem( this.toolInv.getItemStack(), currentItem ) )
|
if( ItemStack.areItemsEqual( this.toolInv.getItemStack(), currentItem ) )
|
||||||
{
|
{
|
||||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getStack()
|
public ItemStack getStack()
|
||||||
{
|
{
|
||||||
final IItemHandler baseInv = getItemHandler();
|
final IItemHandler baseInv = this.getItemHandler();
|
||||||
final ItemStack input = baseInv.getStackInSlot( 0 );
|
final ItemStack input = baseInv.getStackInSlot( 0 );
|
||||||
if( input == ItemStack.EMPTY )
|
if( input == ItemStack.EMPTY )
|
||||||
{
|
{
|
||||||
@@ -137,10 +137,10 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack decrStackSize( int amount )
|
public ItemStack decrStackSize( int amount )
|
||||||
{
|
{
|
||||||
ItemStack ret = getStack();
|
ItemStack ret = this.getStack();
|
||||||
if( !ret.isEmpty() )
|
if( !ret.isEmpty() )
|
||||||
{
|
{
|
||||||
makePlate();
|
this.makePlate();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -150,21 +150,21 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
|||||||
{
|
{
|
||||||
if( stack.isEmpty() )
|
if( stack.isEmpty() )
|
||||||
{
|
{
|
||||||
makePlate();
|
this.makePlate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makePlate()
|
private void makePlate()
|
||||||
{
|
{
|
||||||
if( !getItemHandler().extractItem( 0, 1, false ).isEmpty() )
|
if( !this.getItemHandler().extractItem( 0, 1, false ).isEmpty() )
|
||||||
{
|
{
|
||||||
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
|
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
|
||||||
item.damageItem( 1, getPlayerInv().player );
|
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
|
||||||
|
|
||||||
if( item.getCount() == 0 )
|
if( item.getCount() == 0 )
|
||||||
{
|
{
|
||||||
getPlayerInv().mainInventory.add( getPlayerInv().currentItem, ItemStack.EMPTY );
|
ContainerQuartzKnife.this.getPlayerInv().mainInventory.add( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
|
||||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( getPlayerInv().player, item, null ) );
|
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, item, null ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import appeng.api.networking.IGrid;
|
|||||||
import appeng.api.networking.energy.IEnergyGrid;
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
import appeng.api.networking.spatial.ISpatialCache;
|
import appeng.api.networking.spatial.ISpatialCache;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.api.util.DimensionalCoord;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.slot.SlotOutput;
|
import appeng.container.slot.SlotOutput;
|
||||||
@@ -48,6 +49,13 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
|||||||
private IGrid network;
|
private IGrid network;
|
||||||
private int delay = 40;
|
private int delay = 40;
|
||||||
|
|
||||||
|
@GuiSync( 31 )
|
||||||
|
public int xSize;
|
||||||
|
@GuiSync( 32 )
|
||||||
|
public int ySize;
|
||||||
|
@GuiSync( 33 )
|
||||||
|
public int zSize;
|
||||||
|
|
||||||
public ContainerSpatialIOPort( final InventoryPlayer ip, final TileSpatialIOPort spatialIOPort )
|
public ContainerSpatialIOPort( final InventoryPlayer ip, final TileSpatialIOPort spatialIOPort )
|
||||||
{
|
{
|
||||||
super( ip, spatialIOPort, null );
|
super( ip, spatialIOPort, null );
|
||||||
@@ -85,6 +93,22 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
|||||||
this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
|
this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
|
||||||
this.setRequiredPower( (long) ( 100.0 * sc.requiredPower() ) );
|
this.setRequiredPower( (long) ( 100.0 * sc.requiredPower() ) );
|
||||||
this.setEfficency( (long) ( 100.0f * sc.currentEfficiency() ) );
|
this.setEfficency( (long) ( 100.0f * sc.currentEfficiency() ) );
|
||||||
|
|
||||||
|
final DimensionalCoord min = sc.getMin();
|
||||||
|
final DimensionalCoord max = sc.getMax();
|
||||||
|
|
||||||
|
if( min != null && max != null && sc.isValidRegion() )
|
||||||
|
{
|
||||||
|
this.xSize = sc.getMax().x - sc.getMin().x - 1;
|
||||||
|
this.ySize = sc.getMax().y - sc.getMin().y - 1;
|
||||||
|
this.zSize = sc.getMax().z - sc.getMin().z - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.xSize = 0;
|
||||||
|
this.ySize = 0;
|
||||||
|
this.zSize = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,8 +165,8 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
|||||||
{
|
{
|
||||||
if( i.hasNext() && this.isSlotEnabled( ( x / 9 ) - 2 ) )
|
if( i.hasNext() && this.isSlotEnabled( ( x / 9 ) - 2 ) )
|
||||||
{
|
{
|
||||||
final ItemStack g = i.next().getItemStack();
|
// TODO: check if ok
|
||||||
g.setCount( 1 );
|
final ItemStack g = i.next().asItemStackRepresentation();
|
||||||
ItemHandlerUtil.setStackInSlot( inv, x, g );
|
ItemHandlerUtil.setStackInSlot( inv, x, g );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
|||||||
{
|
{
|
||||||
if( !currentItem.isEmpty() )
|
if( !currentItem.isEmpty() )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isEqualItem( this.tbInventory.getItemStack(), currentItem ) )
|
if( ItemStack.areItemsEqual( this.tbInventory.getItemStack(), currentItem ) )
|
||||||
{
|
{
|
||||||
this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
|
this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.util.helpers.ItemHandlerUtil;
|
import appeng.util.helpers.ItemHandlerUtil;
|
||||||
@@ -149,7 +150,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
|||||||
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
|
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
final NonNullList<ItemStack> aitemstack = CraftingManager.getRemainingItems( ic, playerIn.world );
|
final NonNullList<ItemStack> aitemstack = this.getRemainingItems( ic, playerIn.world );
|
||||||
|
|
||||||
ItemHandlerUtil.copy( ic, this.craftMatrix, false );
|
ItemHandlerUtil.copy( ic, this.craftMatrix, false );
|
||||||
|
|
||||||
@@ -195,4 +196,10 @@ public class AppEngCraftingSlot extends AppEngSlot
|
|||||||
|
|
||||||
return super.decrStackSize( par1 );
|
return super.decrStackSize( par1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
|
protected NonNullList<ItemStack> getRemainingItems( InventoryCrafting ic, World world )
|
||||||
|
{
|
||||||
|
return CraftingManager.getRemainingItems( ic, world );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class AppEngSlot extends Slot
|
|||||||
|
|
||||||
public void clearStack()
|
public void clearStack()
|
||||||
{
|
{
|
||||||
super.putStack( ItemStack.EMPTY );
|
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, ItemStack.EMPTY );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -112,7 +112,7 @@ public class AppEngSlot extends Slot
|
|||||||
return this.getDisplayStack();
|
return this.getDisplayStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.itemHandler.getStackInSlot( index );
|
return this.itemHandler.getStackInSlot( this.index );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,7 +120,7 @@ public class AppEngSlot extends Slot
|
|||||||
{
|
{
|
||||||
if( this.isSlotEnabled() )
|
if( this.isSlotEnabled() )
|
||||||
{
|
{
|
||||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, index, stack );
|
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, stack );
|
||||||
this.onSlotChanged();
|
this.onSlotChanged();
|
||||||
|
|
||||||
if( this.getContainer() != null )
|
if( this.getContainer() != null )
|
||||||
@@ -151,7 +151,7 @@ public class AppEngSlot extends Slot
|
|||||||
@Override
|
@Override
|
||||||
public int getItemStackLimit( @Nonnull ItemStack stack )
|
public int getItemStackLimit( @Nonnull ItemStack stack )
|
||||||
{
|
{
|
||||||
return Math.min( getSlotStackLimit(), stack.getMaxStackSize() );
|
return Math.min( this.getSlotStackLimit(), stack.getMaxStackSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -159,7 +159,7 @@ public class AppEngSlot extends Slot
|
|||||||
{
|
{
|
||||||
if( this.isSlotEnabled() )
|
if( this.isSlotEnabled() )
|
||||||
{
|
{
|
||||||
return !this.itemHandler.extractItem( index, 1, true ).isEmpty();
|
return !this.itemHandler.extractItem( this.index, 1, true ).isEmpty();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ public class AppEngSlot extends Slot
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack decrStackSize( int amount )
|
public ItemStack decrStackSize( int amount )
|
||||||
{
|
{
|
||||||
return this.itemHandler.extractItem( index, amount, false );
|
return this.itemHandler.extractItem( this.index, amount, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,7 +191,7 @@ public class AppEngSlot extends Slot
|
|||||||
|
|
||||||
public ItemStack getDisplayStack()
|
public ItemStack getDisplayStack()
|
||||||
{
|
{
|
||||||
return this.itemHandler.getStackInSlot( index );
|
return this.itemHandler.getStackInSlot( this.index );
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getOpacityOfIcon()
|
public float getOpacityOfIcon()
|
||||||
|
|||||||
@@ -27,18 +27,22 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
import appeng.items.storage.ItemViewCell;
|
import appeng.items.storage.ItemViewCell;
|
||||||
@@ -57,12 +61,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
|||||||
private final IItemHandler craftInv;
|
private final IItemHandler craftInv;
|
||||||
private final IItemHandler pattern;
|
private final IItemHandler pattern;
|
||||||
|
|
||||||
private final BaseActionSource mySrc;
|
private final IActionSource mySrc;
|
||||||
private final IEnergySource energySrc;
|
private final IEnergySource energySrc;
|
||||||
private final IStorageMonitorable storage;
|
private final IStorageMonitorable storage;
|
||||||
private final IContainerCraftingPacket container;
|
private final IContainerCraftingPacket container;
|
||||||
|
|
||||||
public SlotCraftingTerm( final EntityPlayer player, final BaseActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IContainerCraftingPacket ccp )
|
public SlotCraftingTerm( final EntityPlayer player, final IActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IContainerCraftingPacket ccp )
|
||||||
{
|
{
|
||||||
super( player, cMatrix, output, 0, x, y );
|
super( player, cMatrix, output, 0, x, y );
|
||||||
this.energySrc = energySrc;
|
this.energySrc = energySrc;
|
||||||
@@ -130,7 +134,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ItemStack rs = Platform.cloneItemStack( this.getStack() );
|
final ItemStack rs = this.getStack().copy();
|
||||||
if( rs.isEmpty() )
|
if( rs.isEmpty() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -153,6 +157,41 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
|
protected IRecipe findRecipe( InventoryCrafting ic, World world )
|
||||||
|
{
|
||||||
|
if( this.container instanceof ContainerCraftingTerm )
|
||||||
|
{
|
||||||
|
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||||
|
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||||
|
|
||||||
|
if( recipe != null && recipe.matches( ic, world ) )
|
||||||
|
{
|
||||||
|
return containerTerminal.getCurrentRecipe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CraftingManager.findMatchingRecipe( ic, world );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
|
@Override
|
||||||
|
protected NonNullList<ItemStack> getRemainingItems( InventoryCrafting ic, World world )
|
||||||
|
{
|
||||||
|
if( this.container instanceof ContainerCraftingTerm )
|
||||||
|
{
|
||||||
|
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||||
|
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||||
|
|
||||||
|
if( recipe != null && recipe.matches( ic, world ) )
|
||||||
|
{
|
||||||
|
return containerTerminal.getCurrentRecipe().getRemainingItems( ic );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CraftingManager.getRemainingItems( ic, world );
|
||||||
|
}
|
||||||
|
|
||||||
private int capCraftingAttempts( final int maxTimesToCraft )
|
private int capCraftingAttempts( final int maxTimesToCraft )
|
||||||
{
|
{
|
||||||
return maxTimesToCraft;
|
return maxTimesToCraft;
|
||||||
@@ -163,7 +202,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
|||||||
// update crafting matrix...
|
// update crafting matrix...
|
||||||
ItemStack is = this.getStack();
|
ItemStack is = this.getStack();
|
||||||
|
|
||||||
if( !is.isEmpty() && Platform.itemComparisons().isEqualItem( request, is ) )
|
if( !is.isEmpty() && ItemStack.areItemsEqual( request, is ) )
|
||||||
{
|
{
|
||||||
final ItemStack[] set = new ItemStack[this.getPattern().getSlots()];
|
final ItemStack[] set = new ItemStack[this.getPattern().getSlots()];
|
||||||
// Safeguard for empty slots in the inventory for now
|
// Safeguard for empty slots in the inventory for now
|
||||||
@@ -178,7 +217,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
|||||||
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
|
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
|
final IRecipe r = this.findRecipe( ic, p.world );
|
||||||
|
|
||||||
if( r == null )
|
if( r == null )
|
||||||
{
|
{
|
||||||
@@ -270,7 +309,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
|||||||
final IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
final IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||||
if( fail != null )
|
if( fail != null )
|
||||||
{
|
{
|
||||||
drops.add( fail.getItemStack() );
|
drops.add( fail.createItemStack() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
import appeng.core.sync.AppEngPacket;
|
import appeng.core.sync.AppEngPacket;
|
||||||
import appeng.core.sync.packets.PacketPatternSlot;
|
import appeng.core.sync.packets.PacketPatternSlot;
|
||||||
@@ -40,7 +40,7 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
|||||||
private final int groupNum;
|
private final int groupNum;
|
||||||
private final IOptionalSlotHost host;
|
private final IOptionalSlotHost host;
|
||||||
|
|
||||||
public SlotPatternTerm( final EntityPlayer player, final BaseActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c )
|
public SlotPatternTerm( final EntityPlayer player, final IActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c )
|
||||||
{
|
{
|
||||||
super( player, mySrc, energySrc, storage, cMatrix, secondMatrix, output, x, y, c );
|
super( player, mySrc, energySrc, storage, cMatrix, secondMatrix, output, x, y, c );
|
||||||
|
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
private final int[] levelByStacks = { 1, 10, 100, 1000 };
|
private final int[] levelByStacks = { 1, 10, 100, 1000 };
|
||||||
|
|
||||||
// Spatial IO/Dimension
|
// Spatial IO/Dimension
|
||||||
private int storageBiomeID = -1;
|
|
||||||
private int storageProviderID = -1;
|
private int storageProviderID = -1;
|
||||||
|
private int storageDimensionID = -1;
|
||||||
private double spatialPowerExponent = 1.35;
|
private double spatialPowerExponent = 1.35;
|
||||||
private double spatialPowerMultiplier = 1250.0;
|
private double spatialPowerMultiplier = 1250.0;
|
||||||
|
|
||||||
@@ -251,8 +251,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
|
|
||||||
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||||
{
|
{
|
||||||
this.storageBiomeID = this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).getInt( this.storageBiomeID );
|
|
||||||
this.storageProviderID = this.get( "spatialio", "storageProviderID", this.storageProviderID ).getInt( this.storageProviderID );
|
this.storageProviderID = this.get( "spatialio", "storageProviderID", this.storageProviderID ).getInt( this.storageProviderID );
|
||||||
|
this.storageDimensionID = this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).getInt( this.storageDimensionID );
|
||||||
this.spatialPowerMultiplier = this.get( "spatialio", "spatialPowerMultiplier", this.spatialPowerMultiplier ).getDouble(
|
this.spatialPowerMultiplier = this.get( "spatialio", "spatialPowerMultiplier", this.spatialPowerMultiplier ).getDouble(
|
||||||
this.spatialPowerMultiplier );
|
this.spatialPowerMultiplier );
|
||||||
this.spatialPowerExponent = this.get( "spatialio", "spatialPowerExponent", this.spatialPowerExponent ).getDouble( this.spatialPowerExponent );
|
this.spatialPowerExponent = this.get( "spatialio", "spatialPowerExponent", this.spatialPowerExponent ).getDouble( this.spatialPowerExponent );
|
||||||
@@ -397,8 +397,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
{
|
{
|
||||||
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||||
{
|
{
|
||||||
this.get( "spatialio", "storageBiomeID", this.storageBiomeID ).set( this.storageBiomeID );
|
|
||||||
this.get( "spatialio", "storageProviderID", this.storageProviderID ).set( this.storageProviderID );
|
this.get( "spatialio", "storageProviderID", this.storageProviderID ).set( this.storageProviderID );
|
||||||
|
this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).set( this.storageDimensionID );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).set( this.selectedPowerUnit.name() );
|
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).set( this.selectedPowerUnit.name() );
|
||||||
@@ -619,16 +619,16 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
return this.levelByStacks;
|
return this.levelByStacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStorageBiomeID()
|
|
||||||
{
|
|
||||||
return this.storageBiomeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStorageProviderID()
|
public int getStorageProviderID()
|
||||||
{
|
{
|
||||||
return this.storageProviderID;
|
return this.storageProviderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getStorageDimensionID()
|
||||||
|
{
|
||||||
|
return this.storageDimensionID;
|
||||||
|
}
|
||||||
|
|
||||||
public double getSpatialPowerExponent()
|
public double getSpatialPowerExponent()
|
||||||
{
|
{
|
||||||
return this.spatialPowerExponent;
|
return this.spatialPowerExponent;
|
||||||
@@ -766,13 +766,13 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
|
|
||||||
// Setters keep visibility as low as possible.
|
// Setters keep visibility as low as possible.
|
||||||
|
|
||||||
void setStorageBiomeID( int id )
|
|
||||||
{
|
|
||||||
this.storageBiomeID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setStorageProviderID( int id )
|
void setStorageProviderID( int id )
|
||||||
{
|
{
|
||||||
this.storageProviderID = id;
|
this.storageProviderID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setStorageDimensionID( int id )
|
||||||
|
{
|
||||||
|
this.storageDimensionID = id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ import javax.annotation.Nonnull;
|
|||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
@@ -55,6 +56,7 @@ import appeng.core.sync.network.NetworkHandler;
|
|||||||
import appeng.core.worlddata.WorldData;
|
import appeng.core.worlddata.WorldData;
|
||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.integration.IntegrationRegistry;
|
import appeng.integration.IntegrationRegistry;
|
||||||
|
import appeng.integration.IntegrationType;
|
||||||
import appeng.recipes.CustomRecipeConfig;
|
import appeng.recipes.CustomRecipeConfig;
|
||||||
import appeng.recipes.CustomRecipeForgeConfiguration;
|
import appeng.recipes.CustomRecipeForgeConfiguration;
|
||||||
import appeng.server.AECommand;
|
import appeng.server.AECommand;
|
||||||
@@ -66,7 +68,7 @@ import appeng.services.version.VersionCheckerConfig;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12,1.12.1]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
||||||
public final class AppEng
|
public final class AppEng
|
||||||
{
|
{
|
||||||
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
|
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
|
||||||
@@ -114,6 +116,7 @@ public final class AppEng
|
|||||||
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
|
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
|
||||||
|
|
||||||
this.registration = new Registration();
|
this.registration = new Registration();
|
||||||
|
MinecraftForge.EVENT_BUS.register( this.registration );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@@ -123,21 +126,24 @@ public final class AppEng
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
public Biome getStorageBiome()
|
||||||
public final Registration getRegistration()
|
|
||||||
{
|
{
|
||||||
return this.registration;
|
return this.registration.storageBiome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DimensionType getStorageDimensionType()
|
||||||
|
{
|
||||||
|
return this.registration.storageDimensionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStorageDimensionID()
|
||||||
|
{
|
||||||
|
return this.registration.storageDimensionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void preInit( final FMLPreInitializationEvent event )
|
private void preInit( final FMLPreInitializationEvent event )
|
||||||
{
|
{
|
||||||
if( !Loader.isModLoaded( "appliedenergistics2-core" ) )
|
|
||||||
{
|
|
||||||
AppEng.proxy.missingCoreMod();
|
|
||||||
}
|
|
||||||
MinecraftForge.EVENT_BUS.register( this.registration );
|
|
||||||
|
|
||||||
final Stopwatch watch = Stopwatch.createStarted();
|
final Stopwatch watch = Stopwatch.createStarted();
|
||||||
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
|
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
|
||||||
this.recipeDirectory = new File( this.configDirectory, "aerecipes" );
|
this.recipeDirectory = new File( this.configDirectory, "aerecipes" );
|
||||||
@@ -165,6 +171,11 @@ public final class AppEng
|
|||||||
CreativeTabFacade.init();
|
CreativeTabFacade.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( final IntegrationType type : IntegrationType.values() )
|
||||||
|
{
|
||||||
|
IntegrationRegistry.INSTANCE.add( type );
|
||||||
|
}
|
||||||
|
|
||||||
this.registration.preInitialize( event );
|
this.registration.preInitialize( event );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
|
|||||||
@@ -62,6 +62,4 @@ public abstract class CommonHelper
|
|||||||
|
|
||||||
public abstract void updateRenderMode( EntityPlayer player );
|
public abstract void updateRenderMode( EntityPlayer player );
|
||||||
|
|
||||||
public abstract void missingCoreMod();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ package appeng.core;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@@ -37,10 +35,13 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.DimensionType;
|
import net.minecraft.world.DimensionType;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
@@ -48,8 +49,8 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.RecipeSorter;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
@@ -70,7 +71,16 @@ import appeng.api.networking.spatial.ISpatialCache;
|
|||||||
import appeng.api.networking.storage.IStorageGrid;
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
import appeng.api.networking.ticking.ITickManager;
|
import appeng.api.networking.ticking.ITickManager;
|
||||||
import appeng.api.parts.IPartHelper;
|
import appeng.api.parts.IPartHelper;
|
||||||
|
import appeng.api.recipes.IRecipeHandler;
|
||||||
import appeng.bootstrap.IModelRegistry;
|
import appeng.bootstrap.IModelRegistry;
|
||||||
|
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IInitComponent;
|
||||||
|
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||||
|
import appeng.bootstrap.components.IOreDictComponent;
|
||||||
|
import appeng.bootstrap.components.IPostInitComponent;
|
||||||
|
import appeng.bootstrap.components.IPreInitComponent;
|
||||||
|
import appeng.bootstrap.components.IRecipeRegistrationComponent;
|
||||||
import appeng.capabilities.Capabilities;
|
import appeng.capabilities.Capabilities;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||||
@@ -79,10 +89,8 @@ import appeng.core.features.registries.cell.CreativeCellHandler;
|
|||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.core.localization.PlayerMessages;
|
import appeng.core.localization.PlayerMessages;
|
||||||
import appeng.core.stats.PlayerStatsRegistration;
|
import appeng.core.stats.PlayerStatsRegistration;
|
||||||
|
import appeng.core.worlddata.SpatialDimensionManager;
|
||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.integration.IntegrationRegistry;
|
|
||||||
import appeng.integration.IntegrationType;
|
|
||||||
import appeng.integration.Integrations;
|
|
||||||
import appeng.items.materials.ItemMaterial;
|
import appeng.items.materials.ItemMaterial;
|
||||||
import appeng.items.parts.ItemFacade;
|
import appeng.items.parts.ItemFacade;
|
||||||
import appeng.loot.ChestLoot;
|
import appeng.loot.ChestLoot;
|
||||||
@@ -100,8 +108,6 @@ import appeng.recipes.CustomRecipeConfig;
|
|||||||
import appeng.recipes.RecipeHandler;
|
import appeng.recipes.RecipeHandler;
|
||||||
import appeng.recipes.game.DisassembleRecipe;
|
import appeng.recipes.game.DisassembleRecipe;
|
||||||
import appeng.recipes.game.FacadeRecipe;
|
import appeng.recipes.game.FacadeRecipe;
|
||||||
import appeng.recipes.game.ShapedRecipe;
|
|
||||||
import appeng.recipes.game.ShapelessRecipe;
|
|
||||||
import appeng.recipes.handlers.Crusher;
|
import appeng.recipes.handlers.Crusher;
|
||||||
import appeng.recipes.handlers.Grind;
|
import appeng.recipes.handlers.Grind;
|
||||||
import appeng.recipes.handlers.HCCrusher;
|
import appeng.recipes.handlers.HCCrusher;
|
||||||
@@ -111,8 +117,6 @@ import appeng.recipes.handlers.MekCrusher;
|
|||||||
import appeng.recipes.handlers.MekEnrichment;
|
import appeng.recipes.handlers.MekEnrichment;
|
||||||
import appeng.recipes.handlers.Press;
|
import appeng.recipes.handlers.Press;
|
||||||
import appeng.recipes.handlers.Pulverizer;
|
import appeng.recipes.handlers.Pulverizer;
|
||||||
import appeng.recipes.handlers.Shaped;
|
|
||||||
import appeng.recipes.handlers.Shapeless;
|
|
||||||
import appeng.recipes.handlers.Smelt;
|
import appeng.recipes.handlers.Smelt;
|
||||||
import appeng.recipes.ores.OreDictionaryHandler;
|
import appeng.recipes.ores.OreDictionaryHandler;
|
||||||
import appeng.spatial.BiomeGenStorage;
|
import appeng.spatial.BiomeGenStorage;
|
||||||
@@ -122,16 +126,12 @@ import appeng.worldgen.MeteoriteWorldGen;
|
|||||||
import appeng.worldgen.QuartzWorldGen;
|
import appeng.worldgen.QuartzWorldGen;
|
||||||
|
|
||||||
|
|
||||||
public final class Registration
|
final class Registration
|
||||||
{
|
{
|
||||||
private final RecipeHandler recipeHandler;
|
DimensionType storageDimensionType;
|
||||||
private DimensionType storageDimensionType;
|
int storageDimensionID;
|
||||||
private Biome storageBiome;
|
Biome storageBiome;
|
||||||
|
|
||||||
// TODO : 1.12 Improve
|
|
||||||
private static List<Block> blocksToRegister = new ArrayList<>();
|
|
||||||
private static List<Item> itemsToRegister = new ArrayList<>();
|
|
||||||
private static List<IRecipe> recipesToRegister = new ArrayList<>();
|
|
||||||
private File recipeDirectory;
|
private File recipeDirectory;
|
||||||
private CustomRecipeConfig customRecipeConfig;
|
private CustomRecipeConfig customRecipeConfig;
|
||||||
|
|
||||||
@@ -141,115 +141,49 @@ public final class Registration
|
|||||||
this.customRecipeConfig = f2;
|
this.customRecipeConfig = f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Registration()
|
|
||||||
{
|
|
||||||
this.recipeHandler = new RecipeHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Biome getStorageBiome()
|
|
||||||
{
|
|
||||||
return this.storageBiome;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addBlockToRegister( Block b )
|
|
||||||
{
|
|
||||||
if( blocksToRegister == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Past the registration phase already!" );
|
|
||||||
}
|
|
||||||
blocksToRegister.add( b );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addRecipeToRegister( IRecipe r )
|
|
||||||
{
|
|
||||||
if( recipesToRegister == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Past the registration phase already!" );
|
|
||||||
}
|
|
||||||
recipesToRegister.add( r );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addItemToRegister( Item i )
|
|
||||||
{
|
|
||||||
if( itemsToRegister == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Past the registration phase already!" );
|
|
||||||
}
|
|
||||||
itemsToRegister.add( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DimensionType getStorageDimensionType()
|
|
||||||
{
|
|
||||||
return this.storageDimensionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void preInitialize( final FMLPreInitializationEvent event )
|
void preInitialize( final FMLPreInitializationEvent event )
|
||||||
{
|
{
|
||||||
// this.registerSpatial( false );
|
|
||||||
|
|
||||||
Capabilities.register();
|
Capabilities.register();
|
||||||
|
|
||||||
final Api api = Api.INSTANCE;
|
final Api api = Api.INSTANCE;
|
||||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||||
this.registerCraftHandlers( recipeRegistry );
|
this.registerCraftHandlers( recipeRegistry );
|
||||||
|
|
||||||
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
// RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||||
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
// RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||||
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
// RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||||
|
|
||||||
ApiDefinitions definitions = api.definitions();
|
ApiDefinitions definitions = api.definitions();
|
||||||
|
|
||||||
// Register all detected handlers and features (items, blocks) in pre-init
|
// Register
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.preInitialize( event.getSide() ) );
|
definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerSpatial( final boolean force, IForgeRegistry<Biome> registry )
|
private void registerSpatialBiome( IForgeRegistry<Biome> registry )
|
||||||
{
|
{
|
||||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final AEConfig config = AEConfig.instance();
|
|
||||||
|
|
||||||
if( this.storageBiome == null )
|
if( this.storageBiome == null )
|
||||||
{
|
{
|
||||||
// if( force && config.getStorageBiomeID() == -1 )
|
|
||||||
// {
|
|
||||||
// config.setStorageBiomeID( Platform.findEmpty( Biome.REGISTRY, 0, 256 ) );
|
|
||||||
// if( config.getStorageBiomeID() == -1 )
|
|
||||||
// {
|
|
||||||
// throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable
|
|
||||||
// spatial." );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this.storageBiome = new BiomeGenStorage();
|
|
||||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
|
||||||
// );
|
|
||||||
// config.save();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if( !force && config.getStorageBiomeID() != -1 )
|
|
||||||
// {
|
|
||||||
// this.storageBiome = new BiomeGenStorage();
|
|
||||||
// Biome.registerBiome( config.getStorageBiomeID(), "appliedenergistics2:storage_biome", this.storageBiome
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// TODO: 1.12, are modders allowed to even touch the ID's any more?
|
|
||||||
this.storageBiome = new BiomeGenStorage();
|
this.storageBiome = new BiomeGenStorage();
|
||||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( config.getStorageProviderID() != -1 )
|
private void registerSpatialDimension()
|
||||||
|
{
|
||||||
|
final AEConfig config = AEConfig.instance();
|
||||||
|
if( !config.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||||
{
|
{
|
||||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( config.getStorageProviderID() == -1 && force )
|
if( config.getStorageProviderID() == -1 )
|
||||||
{
|
{
|
||||||
final Set<Integer> ids = new HashSet<>();
|
final Set<Integer> ids = new HashSet<>();
|
||||||
for( DimensionType type : DimensionType.values() )
|
for( DimensionType type : DimensionType.values() )
|
||||||
@@ -257,17 +191,25 @@ public final class Registration
|
|||||||
ids.add( type.getId() );
|
ids.add( type.getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
config.setStorageProviderID( -11 );
|
int newId = -11;
|
||||||
|
while( ids.contains( newId ) )
|
||||||
while( ids.contains( config.getStorageProviderID() ) )
|
|
||||||
{
|
{
|
||||||
config.setStorageProviderID( config.getStorageProviderID() - 1 );
|
--newId;
|
||||||
}
|
}
|
||||||
|
config.setStorageProviderID( newId );
|
||||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, false );
|
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, true );
|
||||||
|
|
||||||
|
if( config.getStorageDimensionID() == -1 )
|
||||||
|
{
|
||||||
|
config.setStorageDimensionID( DimensionManager.getNextFreeDimId() );
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
this.storageDimensionID = config.getStorageDimensionID();
|
||||||
|
|
||||||
|
DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
||||||
@@ -285,9 +227,6 @@ public final class Registration
|
|||||||
registry.addNewCraftHandler( "smelt", Smelt.class );
|
registry.addNewCraftHandler( "smelt", Smelt.class );
|
||||||
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
||||||
registry.addNewCraftHandler( "press", Press.class );
|
registry.addNewCraftHandler( "press", Press.class );
|
||||||
|
|
||||||
registry.addNewCraftHandler( "shaped", Shaped.class );
|
|
||||||
registry.addNewCraftHandler( "shapeless", Shapeless.class );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
||||||
@@ -302,7 +241,9 @@ public final class Registration
|
|||||||
final IRegistryContainer registries = api.registries();
|
final IRegistryContainer registries = api.registries();
|
||||||
|
|
||||||
ApiDefinitions definitions = api.definitions();
|
ApiDefinitions definitions = api.definitions();
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.initialize( event.getSide() ) );
|
definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( event.getSide() ) );
|
||||||
|
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||||
|
|
||||||
//
|
//
|
||||||
// // Perform ore camouflage!
|
// // Perform ore camouflage!
|
||||||
// ItemMaterial.instance.makeUnique();
|
// ItemMaterial.instance.makeUnique();
|
||||||
@@ -310,22 +251,6 @@ public final class Registration
|
|||||||
// final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
// final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
||||||
// recipeLoader.run();
|
// recipeLoader.run();
|
||||||
|
|
||||||
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 ) )
|
|
||||||
{
|
|
||||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.redstoneflux.api.IEnergyReceiver" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.RF)) {
|
|
||||||
// partHelper.registerNewLayer("appeng.parts.layers.LayerIEnergyStorager",
|
|
||||||
// "net.minecraftforge.common.capabilities.ICapabilityProvider");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
||||||
// {
|
// {
|
||||||
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
|
||||||
@@ -361,9 +286,6 @@ public final class Registration
|
|||||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// TODO : 1.12 This is way too late for recipes
|
|
||||||
// this.recipeHandler.injectRecipes();
|
|
||||||
|
|
||||||
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance() );
|
final PlayerStatsRegistration registration = new PlayerStatsRegistration( MinecraftForge.EVENT_BUS, AEConfig.instance() );
|
||||||
registration.registerAchievementHandlers();
|
registration.registerAchievementHandlers();
|
||||||
registration.registerAchievements();
|
registration.registerAchievements();
|
||||||
@@ -372,41 +294,36 @@ public final class Registration
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||||
{
|
{
|
||||||
IForgeRegistry<Biome> registry = event.getRegistry();
|
final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||||
this.registerSpatial( false, registry );
|
this.registerSpatialBiome( registry );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||||
{
|
{
|
||||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
final IModelRegistry registry = new ModelLoaderWrapper();
|
final IModelRegistry registry = new ModelLoaderWrapper();
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.modelRegistration( FMLCommonHandler.instance().getEffectiveSide(), registry ) );
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
|
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( side, registry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||||
{
|
{
|
||||||
IForgeRegistry<Block> registry = event.getRegistry();
|
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||||
// TODO : 1.12 Improve
|
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
for( Block b : blocksToRegister )
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
{
|
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( side, registry ) );
|
||||||
registry.register( b );
|
|
||||||
}
|
|
||||||
blocksToRegister = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void registerItems( RegistryEvent.Register<Item> event )
|
public void registerItems( RegistryEvent.Register<Item> event )
|
||||||
{
|
{
|
||||||
|
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||||
IForgeRegistry<Item> registry = event.getRegistry();
|
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
// TODO : 1.12 Improve
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
for( Item i : itemsToRegister )
|
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( side, registry ) );
|
||||||
{
|
|
||||||
registry.register( i );
|
|
||||||
}
|
|
||||||
itemsToRegister = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -416,20 +333,15 @@ public final class Registration
|
|||||||
|
|
||||||
final Api api = Api.INSTANCE;
|
final Api api = Api.INSTANCE;
|
||||||
final ApiDefinitions definitions = api.definitions();
|
final ApiDefinitions definitions = api.definitions();
|
||||||
|
final Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||||
|
|
||||||
// Perform ore camouflage!
|
// Perform ore camouflage!
|
||||||
ItemMaterial.instance.makeUnique();
|
ItemMaterial.instance.makeUnique();
|
||||||
|
|
||||||
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, this.recipeHandler );
|
|
||||||
recipeLoader.run();
|
|
||||||
|
|
||||||
this.recipeHandler.injectRecipes();
|
|
||||||
|
|
||||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||||
{
|
{
|
||||||
DisassembleRecipe r = new DisassembleRecipe();
|
DisassembleRecipe r = new DisassembleRecipe();
|
||||||
// TODO : 1.12 Improve
|
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||||
addRecipeToRegister( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
|
||||||
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
|
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
|
||||||
// "after:minecraft:shapeless" );
|
// "after:minecraft:shapeless" );
|
||||||
}
|
}
|
||||||
@@ -438,41 +350,42 @@ public final class Registration
|
|||||||
{
|
{
|
||||||
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
||||||
{
|
{
|
||||||
// TODO : 1.12 Improve
|
|
||||||
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
||||||
addRecipeToRegister( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||||
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
|
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
|
||||||
// "after:minecraft:shaped" );
|
// "after:minecraft:shaped" );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = 0;
|
definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
|
||||||
// TODO : 1.12 Improve
|
|
||||||
for( IRecipe r : recipesToRegister )
|
|
||||||
{
|
|
||||||
// TODO : 1.12 *really* improve.
|
|
||||||
// Move to json where possible?
|
|
||||||
if( r.getRegistryName() == null )
|
|
||||||
{
|
|
||||||
r.setRegistryName( new ResourceLocation( AppEng.MOD_ID.toLowerCase(), "recipe_" + x ) );
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
registry.register( r );
|
|
||||||
}
|
|
||||||
recipesToRegister = null;
|
|
||||||
|
|
||||||
|
// load machine recipes
|
||||||
|
final IRecipeHandler recipeHandler = new RecipeHandler();
|
||||||
|
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, recipeHandler );
|
||||||
|
recipeLoader.run();
|
||||||
|
recipeHandler.injectRecipes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
||||||
|
{
|
||||||
|
if( AEConfig.instance()
|
||||||
|
.isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
||||||
|
{
|
||||||
|
event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void postInit( final FMLPostInitializationEvent event )
|
void postInit( final FMLPostInitializationEvent event )
|
||||||
{
|
{
|
||||||
// TODO : 1.12 Improve
|
|
||||||
|
|
||||||
final IRegistryContainer registries = Api.INSTANCE.registries();
|
final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
final IParts parts = definitions.parts();
|
final IParts parts = definitions.parts();
|
||||||
final IBlocks blocks = definitions.blocks();
|
final IBlocks blocks = definitions.blocks();
|
||||||
final IItems items = definitions.items();
|
final IItems items = definitions.items();
|
||||||
|
|
||||||
|
registerSpatialDimension();
|
||||||
|
|
||||||
// default settings..
|
// default settings..
|
||||||
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
||||||
|
|
||||||
@@ -480,7 +393,7 @@ public final class Registration
|
|||||||
PlayerMessages.values();
|
PlayerMessages.values();
|
||||||
GuiText.values();
|
GuiText.values();
|
||||||
|
|
||||||
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
|
definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||||
@@ -556,7 +469,7 @@ public final class Registration
|
|||||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||||
{
|
{
|
||||||
// TODO: VILLAGER TRADING
|
// TODO: VILLAGER TRADING
|
||||||
// VillagerRegistry.instance().getRegisteredVillagers()..registerVillageTradeHandler( 3, new AETrading() );
|
// VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
||||||
@@ -579,6 +492,7 @@ public final class Registration
|
|||||||
/*
|
/*
|
||||||
* White List Vanilla...
|
* White List Vanilla...
|
||||||
*/
|
*/
|
||||||
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBanner.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBeacon.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBeacon.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBrewingStand.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBrewingStand.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityChest.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityChest.class );
|
||||||
@@ -590,15 +504,15 @@ public final class Registration
|
|||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnchantmentTable.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnchantmentTable.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnderChest.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnderChest.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEndPortal.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEndPortal.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class );
|
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class );
|
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class );
|
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class );
|
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class );
|
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFlowerPot.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFlowerPot.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityHopper.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityHopper.class );
|
||||||
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class );
|
||||||
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class );
|
||||||
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class );
|
||||||
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityShulkerBox.class );
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityShulkerBox.class );
|
||||||
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class );
|
||||||
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Whitelist AE2
|
* Whitelist AE2
|
||||||
@@ -657,7 +571,6 @@ public final class Registration
|
|||||||
{
|
{
|
||||||
ModelLoader.setCustomStateMapper( block, mapper );
|
ModelLoader.setCustomStateMapper( block, mapper );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
import appeng.api.networking.crafting.ICraftingRequester;
|
import appeng.api.networking.crafting.ICraftingRequester;
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventory;
|
||||||
import appeng.api.storage.IStorageHelper;
|
import appeng.api.storage.IStorageHelper;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
@@ -90,13 +90,13 @@ public class ApiStorage implements IStorageHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAEItemStack poweredExtraction( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack request, final BaseActionSource src )
|
public IAEItemStack poweredExtraction( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack request, final IActionSource src )
|
||||||
{
|
{
|
||||||
return Platform.poweredExtraction( energy, cell, request, src );
|
return Platform.poweredExtraction( energy, cell, request, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAEItemStack poweredInsert( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack input, final BaseActionSource src )
|
public IAEItemStack poweredInsert( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack input, final IActionSource src )
|
||||||
{
|
{
|
||||||
return Platform.poweredInsert( energy, cell, input, src );
|
return Platform.poweredInsert( energy, cell, input, src );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ import appeng.bootstrap.BlockRenderingCustomizer;
|
|||||||
import appeng.bootstrap.FeatureFactory;
|
import appeng.bootstrap.FeatureFactory;
|
||||||
import appeng.bootstrap.IBlockRendering;
|
import appeng.bootstrap.IBlockRendering;
|
||||||
import appeng.bootstrap.IItemRendering;
|
import appeng.bootstrap.IItemRendering;
|
||||||
|
import appeng.bootstrap.components.IOreDictComponent;
|
||||||
|
import appeng.bootstrap.components.IPostInitComponent;
|
||||||
|
import appeng.bootstrap.components.IPreInitComponent;
|
||||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||||
import appeng.client.render.crafting.CraftingCubeRendering;
|
import appeng.client.render.crafting.CraftingCubeRendering;
|
||||||
import appeng.client.render.model.GlassModel;
|
import appeng.client.render.model.GlassModel;
|
||||||
@@ -239,17 +242,12 @@ public final class ApiBlocks implements IBlocks
|
|||||||
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
|
||||||
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new )
|
||||||
.features( AEFeature.CERTUS_ORE )
|
.features( AEFeature.CERTUS_ORE )
|
||||||
.postInit( ( block, item ) ->
|
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||||
{
|
|
||||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
|
||||||
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
|
||||||
.postInit( ( block, item ) ->
|
.useCustomItemModel()
|
||||||
{
|
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
|
||||||
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
|
||||||
|
|
||||||
@@ -308,6 +306,7 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.features( AEFeature.GRIND_STONE )
|
.features( AEFeature.GRIND_STONE )
|
||||||
.tileEntity( new TileEntityDefinition( TileCrank.class ) )
|
.tileEntity( new TileEntityDefinition( TileCrank.class ) )
|
||||||
.rendering( new CrankRendering() )
|
.rendering( new CrankRendering() )
|
||||||
|
.useCustomItemModel()
|
||||||
.build();
|
.build();
|
||||||
this.inscriber = registry.block( "inscriber", BlockInscriber::new )
|
this.inscriber = registry.block( "inscriber", BlockInscriber::new )
|
||||||
.features( AEFeature.INSCRIBER )
|
.features( AEFeature.INSCRIBER )
|
||||||
@@ -334,10 +333,8 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.build();
|
.build();
|
||||||
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||||
.features( AEFeature.TINY_TNT )
|
.features( AEFeature.TINY_TNT )
|
||||||
.postInit( ( block, item ) ->
|
.bootstrap( ( block, item ) -> (IPreInitComponent) side -> BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item,
|
||||||
{
|
new DispenserBehaviorTinyTNT() ) )
|
||||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, new DispenserBehaviorTinyTNT() );
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||||
.features( AEFeature.SECURITY )
|
.features( AEFeature.SECURITY )
|
||||||
@@ -424,7 +421,6 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.build();
|
.build();
|
||||||
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
||||||
.features( AEFeature.CREATIVE )
|
.features( AEFeature.CREATIVE )
|
||||||
.item( AEBaseItemBlockChargeable::new )
|
|
||||||
.tileEntity( new TileEntityDefinition( TileCreativeEnergyCell.class ) )
|
.tileEntity( new TileEntityDefinition( TileCreativeEnergyCell.class ) )
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -497,10 +493,8 @@ public final class ApiBlocks implements IBlocks
|
|||||||
.rendering( new CableBusRendering( partModels ) )
|
.rendering( new CableBusRendering( partModels ) )
|
||||||
// (handled in BlockCableBus.java and its setupTile())
|
// (handled in BlockCableBus.java and its setupTile())
|
||||||
// .tileEntity( TileCableBus.class )
|
// .tileEntity( TileCableBus.class )
|
||||||
.postInit( ( block, item ) ->
|
// TODO: why the custom registration?
|
||||||
{
|
.bootstrap( ( block, item ) -> (IPostInitComponent) side -> ( (BlockCableBus) block ).setupTile() )
|
||||||
( (BlockCableBus) block ).setupTile();
|
|
||||||
} )
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
this.skyStoneSlab = makeSlab( "sky_stone_slab", "sky_stone_double_slab", registry, this.skyStoneBlock() );
|
this.skyStoneSlab = makeSlab( "sky_stone_slab", "sky_stone_double_slab", registry, this.skyStoneBlock() );
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public final class ApiParts implements IParts
|
|||||||
private final AEColoredItemDefinition cableSmart;
|
private final AEColoredItemDefinition cableSmart;
|
||||||
private final AEColoredItemDefinition cableCovered;
|
private final AEColoredItemDefinition cableCovered;
|
||||||
private final AEColoredItemDefinition cableGlass;
|
private final AEColoredItemDefinition cableGlass;
|
||||||
private final AEColoredItemDefinition cableDense;
|
private final AEColoredItemDefinition cableDenseCovered;
|
||||||
|
private final AEColoredItemDefinition cableDenseSmart;
|
||||||
// private final AEColoredItemDefinition lumenCableSmart;
|
// private final AEColoredItemDefinition lumenCableSmart;
|
||||||
// private final AEColoredItemDefinition lumenCableCovered;
|
// private final AEColoredItemDefinition lumenCableCovered;
|
||||||
// private final AEColoredItemDefinition lumenCableGlass;
|
// private final AEColoredItemDefinition lumenCableGlass;
|
||||||
@@ -63,7 +64,6 @@ public final class ApiParts implements IParts
|
|||||||
private final IItemDefinition p2PTunnelItems;
|
private final IItemDefinition p2PTunnelItems;
|
||||||
private final IItemDefinition p2PTunnelFluids;
|
private final IItemDefinition p2PTunnelFluids;
|
||||||
private final IItemDefinition p2PTunnelEU;
|
private final IItemDefinition p2PTunnelEU;
|
||||||
private final IItemDefinition p2PTunnelRF;
|
|
||||||
private final IItemDefinition p2PTunnelFE;
|
private final IItemDefinition p2PTunnelFE;
|
||||||
private final IItemDefinition p2PTunnelLight;
|
private final IItemDefinition p2PTunnelLight;
|
||||||
// private final IItemDefinition p2PTunnelOpenComputers;
|
// private final IItemDefinition p2PTunnelOpenComputers;
|
||||||
@@ -94,7 +94,8 @@ public final class ApiParts implements IParts
|
|||||||
this.cableSmart = constructColoredDefinition( itemPart, PartType.CABLE_SMART );
|
this.cableSmart = constructColoredDefinition( itemPart, PartType.CABLE_SMART );
|
||||||
this.cableCovered = constructColoredDefinition( itemPart, PartType.CABLE_COVERED );
|
this.cableCovered = constructColoredDefinition( itemPart, PartType.CABLE_COVERED );
|
||||||
this.cableGlass = constructColoredDefinition( itemPart, PartType.CABLE_GLASS );
|
this.cableGlass = constructColoredDefinition( itemPart, PartType.CABLE_GLASS );
|
||||||
this.cableDense = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_SMART );
|
this.cableDenseCovered = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_COVERED );
|
||||||
|
this.cableDenseSmart = constructColoredDefinition( itemPart, PartType.CABLE_DENSE_SMART );
|
||||||
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||||
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||||
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||||
@@ -116,7 +117,6 @@ public final class ApiParts implements IParts
|
|||||||
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
|
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
|
||||||
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) );
|
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2P_TUNNEL_FLUIDS ) );
|
||||||
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) );
|
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2P_TUNNEL_IC2 ) );
|
||||||
this.p2PTunnelRF = new DamagedItemDefinition( "part.tunnel.rf", itemPart.createPart( PartType.P2P_TUNNEL_RF ) );
|
|
||||||
this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2P_TUNNEL_FE ) );
|
this.p2PTunnelFE = new DamagedItemDefinition( "part.tunnel.fe", itemPart.createPart( PartType.P2P_TUNNEL_FE ) );
|
||||||
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) );
|
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2P_TUNNEL_LIGHT ) );
|
||||||
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
// this.p2PTunnelOpenComputers = new DamagedItemDefinition( itemMultiPart.createPart(
|
||||||
@@ -166,9 +166,15 @@ public final class ApiParts implements IParts
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AEColoredItemDefinition cableDense()
|
public AEColoredItemDefinition cableDenseCovered()
|
||||||
{
|
{
|
||||||
return this.cableDense;
|
return this.cableDenseCovered;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AEColoredItemDefinition cableDenseSmart()
|
||||||
|
{
|
||||||
|
return this.cableDenseSmart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -193,7 +199,7 @@ public final class ApiParts implements IParts
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AEColoredItemDefinition lumenCableDense()
|
public AEColoredItemDefinition lumenDenseCableSmart()
|
||||||
{
|
{
|
||||||
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
||||||
// return this.lumenCableDense;
|
// return this.lumenCableDense;
|
||||||
@@ -295,12 +301,6 @@ public final class ApiParts implements IParts
|
|||||||
return this.p2PTunnelEU;
|
return this.p2PTunnelEU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IItemDefinition p2PTunnelRF()
|
|
||||||
{
|
|
||||||
return this.p2PTunnelRF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemDefinition p2PTunnelFE()
|
public IItemDefinition p2PTunnelFE()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.features.IGrinderRecipe;
|
||||||
|
import appeng.api.features.IGrinderRecipeBuilder;
|
||||||
|
import appeng.api.features.IGrinderRegistry;
|
||||||
import appeng.core.api.IIMCProcessor;
|
import appeng.core.api.IIMCProcessor;
|
||||||
|
|
||||||
|
|
||||||
@@ -96,12 +99,26 @@ public class IMCGrinder implements IIMCProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
final float chance = msg.getFloat( "chance" );
|
final float chance = msg.getFloat( "chance" );
|
||||||
|
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||||
|
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||||
|
final IGrinderRecipe grinderRecipe = builder.withInput( in )
|
||||||
|
.withOutput( out )
|
||||||
|
.withFirstOptional( optional, chance )
|
||||||
|
.withTurns( turns )
|
||||||
|
.build();
|
||||||
|
|
||||||
AEApi.instance().registries().grinder().addRecipe( in, out, optional, chance, turns );
|
grinderRegistry.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AEApi.instance().registries().grinder().addRecipe( in, out, turns );
|
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||||
|
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||||
|
final IGrinderRecipe grinderRecipe = builder.withInput( in )
|
||||||
|
.withOutput( out )
|
||||||
|
.withTurns( turns )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
grinderRegistry.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ public enum AEFeature
|
|||||||
DENSE_ENERGY_CELLS( "DenseEnergyCells", Constants.CATEGORY_HIGHER_CAPACITY ),
|
DENSE_ENERGY_CELLS( "DenseEnergyCells", Constants.CATEGORY_HIGHER_CAPACITY ),
|
||||||
DENSE_CABLES( "DenseCables", Constants.CATEGORY_HIGHER_CAPACITY ),
|
DENSE_CABLES( "DenseCables", Constants.CATEGORY_HIGHER_CAPACITY ),
|
||||||
|
|
||||||
P2P_TUNNEL_RF( "P2PTunnelRF", Constants.CATEGORY_P2P_TUNNELS ),
|
|
||||||
P2P_TUNNEL_ME( "P2PTunnelME", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_ME( "P2PTunnelME", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
|
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import net.minecraft.item.ItemStack;
|
|||||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||||
import appeng.recipes.ores.IOreListener;
|
import appeng.recipes.ores.IOreListener;
|
||||||
import appeng.recipes.ores.OreDictionaryHandler;
|
import appeng.recipes.ores.OreDictionaryHandler;
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
|
|
||||||
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
|
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
|
||||||
@@ -52,7 +51,7 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
|
|||||||
{
|
{
|
||||||
for( final ItemStack o : this.DamageModifiers.keySet() )
|
for( final ItemStack o : this.DamageModifiers.keySet() )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isEqualItem( o, is ) )
|
if( ItemStack.areItemsEqual( o, is ) )
|
||||||
{
|
{
|
||||||
return this.DamageModifiers.get( o ).floatValue();
|
return this.DamageModifiers.get( o ).floatValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import appeng.api.definitions.IParts;
|
|||||||
import appeng.api.features.IP2PTunnelRegistry;
|
import appeng.api.features.IP2PTunnelRegistry;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.capabilities.Capabilities;
|
import appeng.capabilities.Capabilities;
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
|
|
||||||
public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||||
@@ -73,22 +72,12 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( blocks.energyCell(), TunnelType.FE_POWER );
|
this.addNewAttunement( blocks.energyCell(), TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( blocks.energyCellCreative(), TunnelType.FE_POWER );
|
this.addNewAttunement( blocks.energyCellCreative(), TunnelType.FE_POWER );
|
||||||
|
|
||||||
/**
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER );
|
||||||
* RF tunnel items
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.FE_POWER );
|
||||||
*/
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.FE_POWER );
|
||||||
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.RF_POWER ); // leadstone
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.FE_POWER );
|
||||||
// fluxduct
|
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.RF_POWER ); // hardened
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.RF_POWER ); // redstone
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.RF_POWER ); // signalum
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.RF_POWER ); // resonant
|
|
||||||
// fluxduct
|
|
||||||
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.RF_POWER ); // cryo-stabilized
|
|
||||||
// fluxduct
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EU tunnel items
|
* EU tunnel items
|
||||||
@@ -167,22 +156,22 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
|
||||||
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
|
||||||
this.addNewAttunement( parts.cableSmart().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableSmart().stack( c, 1 ), TunnelType.ME );
|
||||||
this.addNewAttunement( parts.cableDense().stack( c, 1 ), TunnelType.ME );
|
this.addNewAttunement( parts.cableDenseSmart().stack( c, 1 ), TunnelType.ME );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* attune based on the ItemStack's modId
|
* attune based on the ItemStack's modId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.addNewAttunement( "thermaldynamics", TunnelType.RF_POWER );
|
this.addNewAttunement( "thermaldynamics", TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( "thermalexpansion", TunnelType.RF_POWER );
|
this.addNewAttunement( "thermalexpansion", TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( "thermalfoundation", TunnelType.RF_POWER );
|
this.addNewAttunement( "thermalfoundation", TunnelType.FE_POWER );
|
||||||
// TODO: Remove when confirmed that the official 1.12 version of EnderIO will support FE.
|
// TODO: Remove when confirmed that the official 1.12 version of EnderIO will support FE.
|
||||||
this.addNewAttunement( "enderio", TunnelType.RF_POWER );
|
this.addNewAttunement( "enderio", TunnelType.FE_POWER );
|
||||||
// TODO: Remove when confirmed that the official 1.12 version of Mekanism will support FE.
|
// TODO: Remove when confirmed that the official 1.12 version of Mekanism will support FE.
|
||||||
this.addNewAttunement( "mekanism", TunnelType.RF_POWER );
|
this.addNewAttunement( "mekanism", TunnelType.FE_POWER );
|
||||||
// TODO: Remove when support for RFTools' Powercells support is added
|
// TODO: Remove when support for RFTools' Powercells support is added
|
||||||
this.addNewAttunement( "rftools", TunnelType.RF_POWER );
|
this.addNewAttunement( "rftools", TunnelType.FE_POWER );
|
||||||
this.addNewAttunement( "ic2", TunnelType.IC2_POWER );
|
this.addNewAttunement( "ic2", TunnelType.IC2_POWER );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -226,7 +215,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|||||||
return this.tunnels.get( is );
|
return this.tunnels.get( is );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Platform.itemComparisons().isEqualItem( is, trigger ) )
|
if( ItemStack.areItemsEqual( is, trigger ) )
|
||||||
{
|
{
|
||||||
return this.tunnels.get( is );
|
return this.tunnels.get( is );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
@@ -33,7 +35,10 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.features.IGrinderRecipe;
|
import appeng.api.features.IGrinderRecipe;
|
||||||
|
import appeng.api.features.IGrinderRecipeBuilder;
|
||||||
import appeng.api.features.IGrinderRegistry;
|
import appeng.api.features.IGrinderRegistry;
|
||||||
|
import appeng.api.features.IInscriberRecipe;
|
||||||
|
import appeng.api.features.IInscriberRecipeBuilder;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.recipes.ores.IOreListener;
|
import appeng.recipes.ores.IOreListener;
|
||||||
@@ -83,58 +88,26 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
OreDictionaryHandler.INSTANCE.observe( this );
|
OreDictionaryHandler.INSTANCE.observe( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipeBuilder builder()
|
||||||
|
{
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addRecipe( IGrinderRecipe recipe )
|
||||||
|
{
|
||||||
|
Preconditions.checkNotNull( recipe, "Cannot add null as recipe." );
|
||||||
|
|
||||||
|
return this.injectRecipe( recipe );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<IGrinderRecipe> getRecipes()
|
public Collection<IGrinderRecipe> getRecipes()
|
||||||
{
|
{
|
||||||
return Collections.unmodifiableCollection( this.recipes.values() );
|
return Collections.unmodifiableCollection( this.recipes.values() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addRecipe( final ItemStack in, final ItemStack out, final int cost )
|
|
||||||
{
|
|
||||||
Preconditions.checkNotNull( in, "Null is not accepted as input itemstack." );
|
|
||||||
Preconditions.checkNotNull( out, "Null is not accepted as output itemstack." );
|
|
||||||
Preconditions.checkArgument( cost > 0, "Turns must be > 0" );
|
|
||||||
|
|
||||||
this.log( "Allow Grinding of '%1$s' to '%2$s' for %3$d turn", Platform.getItemDisplayName( in ), Platform.getItemDisplayName( out ), cost );
|
|
||||||
|
|
||||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), cost ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addRecipe( final ItemStack in, final ItemStack out, final ItemStack optional, final float chance, final int cost )
|
|
||||||
{
|
|
||||||
Preconditions.checkNotNull( in, "Null is not accepted as input itemstack." );
|
|
||||||
Preconditions.checkNotNull( out, "Null is not accepted as output itemstack." );
|
|
||||||
Preconditions.checkNotNull( optional, "Null is not accepted as optional itemstack." );
|
|
||||||
Preconditions.checkArgument( chance >= 0.0 && chance <= 1.0, "chance must be within 0.0 - 1.0." );
|
|
||||||
Preconditions.checkArgument( cost > 0, "Turns must be > 0" );
|
|
||||||
|
|
||||||
this.log( "Allow Grinding of '%1$s' to '%2$s' with optional '%3$s' @ %4$.2f for %5$d", Platform.getItemDisplayName( in ),
|
|
||||||
Platform.getItemDisplayName( out ), Platform.getItemDisplayName( optional ), chance, cost );
|
|
||||||
|
|
||||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addRecipe( final ItemStack in, final ItemStack out, final ItemStack optional1, final float chance1, final ItemStack optional2, final float chance2, final int cost )
|
|
||||||
{
|
|
||||||
Preconditions.checkNotNull( in, "Null is not accepted as input itemstack." );
|
|
||||||
Preconditions.checkNotNull( out, "Null is not accepted as output itemstack." );
|
|
||||||
Preconditions.checkNotNull( optional1, "Null is not accepted as optional itemstack." );
|
|
||||||
Preconditions.checkArgument( chance1 >= 0.0 && chance1 <= 1.0, "chance must be within 0.0 - 1.0." );
|
|
||||||
Preconditions.checkNotNull( optional2, "Null is not accepted as optional2 itemstack." );
|
|
||||||
Preconditions.checkArgument( chance2 >= 0.0 && chance2 <= 1.0, "chance2 must be within 0.0 - 1.0." );
|
|
||||||
Preconditions.checkArgument( cost > 0, "Turns must be > 0" );
|
|
||||||
|
|
||||||
this.log( "Allow Grinding of '%1$s' to '%2$s' with optional '%3$s' @ %4$.2f and optional2 '%5$s' @ %6$.2f for %7$d", Platform.getItemDisplayName( in ),
|
|
||||||
Platform.getItemDisplayName( out ), Platform.getItemDisplayName( optional1 ), chance1, Platform.getItemDisplayName( optional2 ), chance2,
|
|
||||||
cost );
|
|
||||||
|
|
||||||
this.injectRecipe(
|
|
||||||
new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional1 ), this.copy( optional2 ), chance1, chance2, cost ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeRecipe( IGrinderRecipe recipe )
|
public boolean removeRecipe( IGrinderRecipe recipe )
|
||||||
{
|
{
|
||||||
@@ -214,26 +187,19 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void injectRecipe( final AppEngGrinderRecipe appEngGrinderRecipe )
|
private boolean injectRecipe( final IGrinderRecipe grinderRecipe )
|
||||||
{
|
{
|
||||||
final CacheKey cacheKey = new CacheKey( appEngGrinderRecipe.getInput() );
|
final CacheKey cacheKey = new CacheKey( grinderRecipe.getInput() );
|
||||||
|
|
||||||
if( this.recipes.containsKey( cacheKey ) )
|
if( this.recipes.containsKey( cacheKey ) )
|
||||||
{
|
{
|
||||||
this.log( "Tried to add duplicate recipe for '%1$s'", Platform.getItemDisplayName( appEngGrinderRecipe.getInput() ) );
|
this.log( "Tried to add duplicate recipe for '%1$s'", Platform.getItemDisplayName( grinderRecipe.getInput() ) );
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recipes.put( cacheKey, appEngGrinderRecipe );
|
this.recipes.put( cacheKey, grinderRecipe );
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack copy( final ItemStack is )
|
return true;
|
||||||
{
|
|
||||||
if( !is.isEmpty() )
|
|
||||||
{
|
|
||||||
return is.copy();
|
|
||||||
}
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDustToOreRatio( final String name )
|
private int getDustToOreRatio( final String name )
|
||||||
@@ -259,11 +225,25 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
{
|
{
|
||||||
final ItemStack extra = is.copy();
|
final ItemStack extra = is.copy();
|
||||||
extra.setCount( ratio - 1 );
|
extra.setCount( ratio - 1 );
|
||||||
this.addRecipe( item, is, extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ), 8 );
|
|
||||||
|
final IGrinderRecipeBuilder builder = this.builder();
|
||||||
|
IGrinderRecipe grinderRecipe = builder.withInput( item )
|
||||||
|
.withOutput( is )
|
||||||
|
.withFirstOptional( extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ) )
|
||||||
|
.withTurns( 8 )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.addRecipe( item, is, 8 );
|
final IGrinderRecipeBuilder builder = this.builder();
|
||||||
|
IGrinderRecipe grinderRecipe = builder.withInput( item )
|
||||||
|
.withOutput( is )
|
||||||
|
.withTurns( 8 )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,7 +260,13 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
|
|
||||||
if( this.dusts.containsKey( name ) )
|
if( this.dusts.containsKey( name ) )
|
||||||
{
|
{
|
||||||
this.addRecipe( item, this.dusts.get( name ), 4 );
|
final IGrinderRecipeBuilder builder = this.builder();
|
||||||
|
IGrinderRecipe grinderRecipe = builder.withInput( item )
|
||||||
|
.withOutput( this.dusts.get( name ) )
|
||||||
|
.withTurns( 4 )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,6 +276,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( this.dusts.containsKey( name ) )
|
if( this.dusts.containsKey( name ) )
|
||||||
{
|
{
|
||||||
this.log( "Rejecting Dust: '%1$s'", Platform.getItemDisplayName( item ) );
|
this.log( "Rejecting Dust: '%1$s'", Platform.getItemDisplayName( item ) );
|
||||||
@@ -311,11 +298,25 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
{
|
{
|
||||||
final ItemStack extra = is.copy();
|
final ItemStack extra = is.copy();
|
||||||
extra.setCount( ratio - 1 );
|
extra.setCount( ratio - 1 );
|
||||||
this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ), 8 );
|
|
||||||
|
final IGrinderRecipeBuilder builder = this.builder();
|
||||||
|
final IGrinderRecipe grinderRecipe = builder.withInput( d.getKey() )
|
||||||
|
.withOutput( is )
|
||||||
|
.withFirstOptional( extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ) )
|
||||||
|
.withTurns( 8 )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.addRecipe( d.getKey(), is, 8 );
|
final IGrinderRecipeBuilder builder = this.builder();
|
||||||
|
final IGrinderRecipe grinderRecipe = builder.withInput( d.getKey() )
|
||||||
|
.withOutput( is )
|
||||||
|
.withTurns( 8 )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +325,13 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
{
|
{
|
||||||
if( name.equals( d.getValue() ) )
|
if( name.equals( d.getValue() ) )
|
||||||
{
|
{
|
||||||
this.addRecipe( d.getKey(), item, 4 );
|
final IGrinderRecipeBuilder builder = this.builder();
|
||||||
|
final IGrinderRecipe grinderRecipe = builder.withInput( d.getKey() )
|
||||||
|
.withOutput( item )
|
||||||
|
.withTurns( 4 )
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.addRecipe( grinderRecipe );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,7 +372,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if( obj == null || this.getClass() != obj.getClass() )
|
if( obj == null || getClass() != obj.getClass() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -393,4 +400,100 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal {@link IInscriberRecipeBuilder} implementation.
|
||||||
|
* Needs to be adapted to represent a correct {@link IInscriberRecipe}
|
||||||
|
*/
|
||||||
|
private static final class Builder implements IGrinderRecipeBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
private ItemStack in;
|
||||||
|
private ItemStack out;
|
||||||
|
|
||||||
|
private float optionalChance;
|
||||||
|
private ItemStack optionalOutput;
|
||||||
|
|
||||||
|
private float optionalChance2;
|
||||||
|
private ItemStack optionalOutput2;
|
||||||
|
|
||||||
|
private int turns = 8;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipeBuilder withInput( ItemStack input )
|
||||||
|
{
|
||||||
|
Preconditions.checkNotNull( input );
|
||||||
|
Preconditions.checkArgument( !input.isEmpty(), "Input cannot be empty." );
|
||||||
|
|
||||||
|
this.in = this.copy( input );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipeBuilder withOutput( ItemStack output )
|
||||||
|
{
|
||||||
|
Preconditions.checkNotNull( output );
|
||||||
|
Preconditions.checkArgument( !output.isEmpty(), "Output cannot be empty." );
|
||||||
|
|
||||||
|
this.out = this.copy( output );
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipeBuilder withFirstOptional( ItemStack optional, float chance )
|
||||||
|
{
|
||||||
|
Preconditions.checkNotNull( optional );
|
||||||
|
Preconditions.checkArgument( !optional.isEmpty(), "Optional cannot be empty." );
|
||||||
|
Preconditions.checkArgument( chance >= 0 && chance <= 1.0 );
|
||||||
|
|
||||||
|
this.optionalOutput = this.copy( optional );
|
||||||
|
this.optionalChance = chance;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipeBuilder withSecondOptional( ItemStack optional, float chance )
|
||||||
|
{
|
||||||
|
Preconditions.checkNotNull( optional );
|
||||||
|
Preconditions.checkArgument( !optional.isEmpty(), "Optional cannot be empty." );
|
||||||
|
Preconditions.checkArgument( chance >= 0 && chance <= 1.0 );
|
||||||
|
|
||||||
|
this.optionalOutput2 = this.copy( optional );
|
||||||
|
this.optionalChance2 = chance;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipeBuilder withTurns( int turns )
|
||||||
|
{
|
||||||
|
Preconditions.checkArgument( turns > 0 );
|
||||||
|
|
||||||
|
this.turns = turns;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public IGrinderRecipe build()
|
||||||
|
{
|
||||||
|
Preconditions.checkState( this.in != null, "Input itemstack must be defined." );
|
||||||
|
Preconditions.checkState( this.out != null, "Output itemstack must be defined." );
|
||||||
|
|
||||||
|
return new AppEngGrinderRecipe( this.in, this.out, this.optionalOutput, this.optionalOutput2, this.optionalChance, this.optionalChance2, this.turns );
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack copy( final ItemStack is )
|
||||||
|
{
|
||||||
|
if( is != null )
|
||||||
|
{
|
||||||
|
return is.copy();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import java.util.Set;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.features.IInscriberRecipe;
|
import appeng.api.features.IInscriberRecipe;
|
||||||
@@ -84,32 +86,41 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRecipe( final IInscriberRecipe recipe )
|
public boolean addRecipe( final IInscriberRecipe recipe )
|
||||||
{
|
{
|
||||||
if( recipe == null )
|
Preconditions.checkNotNull( recipe, "Tried to add (null) as inscriber recipe to the registry." );
|
||||||
|
|
||||||
|
if( this.recipes.add( recipe ) )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException( "Tried to add an invalid (null) inscriber recipe to the registry." );
|
recipe.getTopOptional().ifPresent( this.optionals::add );
|
||||||
|
recipe.getBottomOptional().ifPresent( this.optionals::add );
|
||||||
|
|
||||||
|
this.inputs.addAll( recipe.getInputs() );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recipes.add( recipe );
|
return false;
|
||||||
|
|
||||||
recipe.getTopOptional().ifPresent( this.optionals::add );
|
|
||||||
recipe.getBottomOptional().ifPresent( this.optionals::add );
|
|
||||||
|
|
||||||
this.inputs.addAll( recipe.getInputs() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeRecipe( final IInscriberRecipe toBeRemovedRecipe )
|
public boolean removeRecipe( final IInscriberRecipe toBeRemovedRecipe )
|
||||||
{
|
{
|
||||||
|
Preconditions.checkNotNull( toBeRemovedRecipe, "Tried to remove (null) from the registry." );
|
||||||
|
|
||||||
|
boolean changed = false;
|
||||||
|
|
||||||
for( final Iterator<IInscriberRecipe> iterator = this.recipes.iterator(); iterator.hasNext(); )
|
for( final Iterator<IInscriberRecipe> iterator = this.recipes.iterator(); iterator.hasNext(); )
|
||||||
{
|
{
|
||||||
final IInscriberRecipe recipe = iterator.next();
|
final IInscriberRecipe recipe = iterator.next();
|
||||||
if( recipe.equals( toBeRemovedRecipe ) )
|
if( recipe.equals( toBeRemovedRecipe ) )
|
||||||
{
|
{
|
||||||
|
changed = true;
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,6 +139,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
@Override
|
@Override
|
||||||
public Builder withInputs( @Nonnull final Collection<ItemStack> inputs )
|
public Builder withInputs( @Nonnull final Collection<ItemStack> inputs )
|
||||||
{
|
{
|
||||||
|
Preconditions.checkNotNull( inputs );
|
||||||
|
Preconditions.checkArgument( !inputs.isEmpty() );
|
||||||
|
|
||||||
this.inputs = new ArrayList<>( inputs.size() );
|
this.inputs = new ArrayList<>( inputs.size() );
|
||||||
this.inputs.addAll( inputs );
|
this.inputs.addAll( inputs );
|
||||||
|
|
||||||
@@ -138,6 +152,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
@Override
|
@Override
|
||||||
public Builder withOutput( @Nonnull final ItemStack output )
|
public Builder withOutput( @Nonnull final ItemStack output )
|
||||||
{
|
{
|
||||||
|
Preconditions.checkNotNull( output );
|
||||||
|
Preconditions.checkArgument( !output.isEmpty() );
|
||||||
|
|
||||||
this.output = output;
|
this.output = output;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -147,6 +164,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
@Override
|
@Override
|
||||||
public Builder withTopOptional( @Nonnull final ItemStack topOptional )
|
public Builder withTopOptional( @Nonnull final ItemStack topOptional )
|
||||||
{
|
{
|
||||||
|
Preconditions.checkNotNull( topOptional );
|
||||||
|
Preconditions.checkArgument( !topOptional.isEmpty() );
|
||||||
|
|
||||||
this.topOptional = topOptional;
|
this.topOptional = topOptional;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -156,6 +176,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
@Override
|
@Override
|
||||||
public Builder withBottomOptional( @Nonnull final ItemStack bottomOptional )
|
public Builder withBottomOptional( @Nonnull final ItemStack bottomOptional )
|
||||||
{
|
{
|
||||||
|
Preconditions.checkNotNull( bottomOptional );
|
||||||
|
Preconditions.checkArgument( !bottomOptional.isEmpty() );
|
||||||
|
|
||||||
this.bottomOptional = bottomOptional;
|
this.bottomOptional = bottomOptional;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -165,6 +188,8 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
@Override
|
@Override
|
||||||
public Builder withProcessType( @Nonnull final InscriberProcessType type )
|
public Builder withProcessType( @Nonnull final InscriberProcessType type )
|
||||||
{
|
{
|
||||||
|
Preconditions.checkNotNull( type );
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -174,26 +199,11 @@ public final class InscriberRegistry implements IInscriberRegistry
|
|||||||
@Override
|
@Override
|
||||||
public IInscriberRecipe build()
|
public IInscriberRecipe build()
|
||||||
{
|
{
|
||||||
if( this.inputs == null )
|
Preconditions.checkState( this.inputs != null, "Input must be defined." );
|
||||||
{
|
Preconditions.checkState( !this.inputs.isEmpty(), "Input must have a size." );
|
||||||
throw new IllegalStateException( "Input must be defined." );
|
Preconditions.checkState( !this.output.isEmpty(), "Output cannot be empty." );
|
||||||
}
|
Preconditions.checkState( !this.topOptional.isEmpty() || !this.bottomOptional.isEmpty(), "One optional must be defined." );
|
||||||
if( this.inputs.isEmpty() )
|
Preconditions.checkState( this.type != null, "Process type must be defined." );
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Input must have a size." );
|
|
||||||
}
|
|
||||||
if( this.output.isEmpty() )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Output must be defined." );
|
|
||||||
}
|
|
||||||
if( this.topOptional.isEmpty() && this.bottomOptional.isEmpty() )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "One optional must be defined." );
|
|
||||||
}
|
|
||||||
if( this.type == null )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( "Process type must be defined." );
|
|
||||||
}
|
|
||||||
|
|
||||||
return new InscriberRecipe( this.inputs, this.output, this.topOptional, this.bottomOptional, this.type );
|
return new InscriberRecipe( this.inputs, this.output, this.topOptional, this.bottomOptional, this.type );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,11 +89,13 @@ public enum GuiText
|
|||||||
FluidTunnel,
|
FluidTunnel,
|
||||||
OCTunnel,
|
OCTunnel,
|
||||||
LightTunnel,
|
LightTunnel,
|
||||||
RFTunnel,
|
|
||||||
FETunnel,
|
FETunnel,
|
||||||
PressureTunnel,
|
PressureTunnel,
|
||||||
|
|
||||||
|
// spatial
|
||||||
StoredSize,
|
StoredSize,
|
||||||
|
CellId,
|
||||||
|
|
||||||
CopyMode,
|
CopyMode,
|
||||||
CopyModeDesc,
|
CopyModeDesc,
|
||||||
PatternTerminal,
|
PatternTerminal,
|
||||||
@@ -115,6 +117,8 @@ public enum GuiText
|
|||||||
MaxPower,
|
MaxPower,
|
||||||
RequiredPower,
|
RequiredPower,
|
||||||
Efficiency,
|
Efficiency,
|
||||||
|
SCSSize,
|
||||||
|
SCSSInvalid,
|
||||||
InWorldCrafting,
|
InWorldCrafting,
|
||||||
|
|
||||||
inWorldFluix,
|
inWorldFluix,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user