Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e15b23506 | |||
| 2ed7a5598a | |||
| 1c05dd5834 | |||
| 632d124359 | |||
| 829c18e2bb | |||
| d3a5be7ed6 | |||
| 217cbf0982 | |||
| 4dd0a4cd96 | |||
| 54c0ce43ea | |||
| bd8f43acbf | |||
| 970630a90d | |||
| 771a944058 | |||
| db1cd8c312 | |||
| 375e1efb15 | |||
| 955fcac92a | |||
| 216e2cb1e3 | |||
| 53f5724657 | |||
| a3269826f9 | |||
| 1a918be658 | |||
| 90130e72aa | |||
| c8f10d92bb |
+7
-7
@@ -7,22 +7,22 @@ aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
minecraft_version=1.12
|
||||
mcp_mappings=snapshot_20170704
|
||||
forge_version=14.21.1.2412
|
||||
minecraft_version=1.12.1
|
||||
mcp_mappings=snapshot_20170811
|
||||
forge_version=14.22.1.2478
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
#########################################################
|
||||
hwyla_version=1.8.19-B33_1.12
|
||||
hwyla_version=1.8.20-B35_1.12
|
||||
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_version=4.7.1.69
|
||||
jei_version=4.7.8.95
|
||||
tesla_version=1.0.61
|
||||
ic2_version=2.8.9-ex112
|
||||
top_version=1.12-1.4.8-2
|
||||
ic2_version=2.8.19-ex112
|
||||
top_version=1.12-1.4.18-10
|
||||
|
||||
#########################################################
|
||||
# Deployment #
|
||||
|
||||
@@ -69,17 +69,14 @@ dependencies {
|
||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||
// mods "com.github.mcjty:compatlayer:${compatlayer_version}"
|
||||
|
||||
// compile against provided APIs
|
||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||
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 "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
|
||||
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
|
||||
// at runtime, use the full JEI jar
|
||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
/**
|
||||
* Extensible way to create a grinder recipe.
|
||||
*
|
||||
* @return builder for grinder recipes
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder builder();
|
||||
|
||||
/**
|
||||
* An immutable list of the currently registered recipes.
|
||||
*
|
||||
@@ -47,48 +55,13 @@ public interface IGrinderRegistry
|
||||
Collection<IGrinderRecipe> getRecipes();
|
||||
|
||||
/**
|
||||
* Add a new recipe with a single input and output and how many turns it requires.
|
||||
*
|
||||
* 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.
|
||||
* Add a new recipe to the registry.
|
||||
*/
|
||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, int turns );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
boolean addRecipe( IGrinderRecipe recipe );
|
||||
|
||||
/**
|
||||
* Remove the specific from the recipe list.
|
||||
*
|
||||
*
|
||||
* @param recipe The recipe to be 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.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @param oredictName The name of the ore;
|
||||
* @param ratio The amount, must be > 0;
|
||||
*/
|
||||
@@ -118,9 +91,9 @@ public interface IGrinderRegistry
|
||||
|
||||
/**
|
||||
* Remove a custom ratio for a specific ore name.
|
||||
*
|
||||
*
|
||||
* Will use the default of 2 value afterwards.
|
||||
*
|
||||
*
|
||||
* @param oredictName The name of the ore;
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3
|
||||
* @version rv5
|
||||
* @since rv2
|
||||
*/
|
||||
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.
|
||||
*
|
||||
@@ -65,29 +73,25 @@ public interface IInscriberRegistry
|
||||
@Nonnull
|
||||
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.
|
||||
* Added recipes will be automatically added to the optionals and inputs.
|
||||
*
|
||||
* @param recipe new recipe
|
||||
*
|
||||
* @return true, when successfully added
|
||||
*
|
||||
* @throws IllegalArgumentException if null is added
|
||||
*/
|
||||
void addRecipe( IInscriberRecipe recipe );
|
||||
boolean addRecipe( IInscriberRecipe recipe );
|
||||
|
||||
/**
|
||||
* Removes all equal recipes from the registry.
|
||||
*
|
||||
*
|
||||
* @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 );
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
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.storage.data.IAEItemStack;
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
||||
/**
|
||||
* @return the action source for the CPU.
|
||||
*/
|
||||
BaseActionSource getActionSource();
|
||||
IActionSource getActionSource();
|
||||
|
||||
/**
|
||||
* @return the available storage in bytes
|
||||
|
||||
@@ -33,7 +33,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
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
|
||||
* 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.
|
||||
@@ -82,7 +82,7 @@ public interface ICraftingGrid extends IGridCache
|
||||
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
||||
* 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
|
||||
|
||||
@@ -25,7 +25,9 @@ package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
@@ -36,32 +38,91 @@ import appeng.api.config.Actionable;
|
||||
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
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IEnergyGridProvider> providers();
|
||||
|
||||
/**
|
||||
* 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 extractProviderPower( double amt, Actionable mode, Set<IEnergyGridProvider> 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
|
||||
*
|
||||
* 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 injectProviderPower( double amt, Actionable mode, Set<IEnergyGridProvider> seen );
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*/
|
||||
double getProviderEnergyDemand( double d, Set<IEnergyGridProvider> 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;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
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;
|
||||
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -50,5 +50,5 @@ public interface IStackWatcherHost
|
||||
* @param src action source
|
||||
* @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.IGridHost;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.ICellContainer;
|
||||
import appeng.api.storage.ICellProvider;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
@@ -50,7 +50,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
||||
*
|
||||
* @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
|
||||
|
||||
@@ -25,7 +25,7 @@ package appeng.api.storage;
|
||||
|
||||
|
||||
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.IItemList;
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface IMEInventory<StackType extends IAEStack>
|
||||
*
|
||||
* @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
|
||||
@@ -62,7 +62,7 @@ public interface IMEInventory<StackType extends IAEStack>
|
||||
*
|
||||
* @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.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
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.storage.data.IAEStack;
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface IMEMonitorHandlerReceiver<StackType extends IAEStack>
|
||||
*
|
||||
* @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.
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
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.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -109,7 +109,7 @@ public interface IStorageHelper
|
||||
*
|
||||
* @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
|
||||
@@ -121,5 +121,5 @@ public interface IStorageHelper
|
||||
*
|
||||
* @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 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).
|
||||
*/
|
||||
@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.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
@@ -95,7 +95,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
||||
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();
|
||||
|
||||
@@ -116,12 +116,12 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
||||
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 );
|
||||
}
|
||||
|
||||
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.
|
||||
final Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
|
||||
@@ -146,7 +146,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
||||
*
|
||||
* @return new ItemStack
|
||||
*/
|
||||
ItemStack getItemStack();
|
||||
ItemStack createItemStack();
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
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 net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
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();
|
||||
|
||||
/**
|
||||
* obtain the NBT Data for the item.
|
||||
*
|
||||
* @return nbt data
|
||||
*/
|
||||
IAETagCompound getTagCompound();
|
||||
|
||||
/**
|
||||
* @return true if the stack is a {@link IAEItemStack}
|
||||
*/
|
||||
@@ -205,13 +199,9 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
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();
|
||||
|
||||
/**
|
||||
* Used internally to show that it should show a Crafting label instead of a "1"
|
||||
*/
|
||||
void setShowCraftingLabel( boolean showCraftingLabel );
|
||||
|
||||
ItemStack asItemStackRepresentation();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.capabilities;
|
||||
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
|
||||
@@ -28,7 +28,7 @@ class NullMENetworkAccessor implements IStorageMonitorableAccessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getInventory( BaseActionSource src )
|
||||
public IStorageMonitorable getInventory( IActionSource src )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ import appeng.helpers.InventoryAction;
|
||||
|
||||
public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
private static boolean switchingGuis;
|
||||
private final List<InternalSlotME> meSlots = new LinkedList<>();
|
||||
// drag y
|
||||
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 ItemStack dbl_whichItem = ItemStack.EMPTY;
|
||||
private Slot bl_clicked;
|
||||
private boolean subGui;
|
||||
|
||||
public AEBaseGui( final Container container )
|
||||
{
|
||||
super( container );
|
||||
this.subGui = switchingGuis;
|
||||
switchingGuis = false;
|
||||
}
|
||||
|
||||
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
|
||||
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;
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel() && player.inventory.getItemStack().isEmpty() )
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack()
|
||||
.isEmpty() )
|
||||
{
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
@@ -587,7 +579,6 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
public void 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 )
|
||||
@@ -715,7 +706,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
// Annoying but easier than trying to splice into render item
|
||||
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 )
|
||||
@@ -870,14 +861,4 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
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 posY = y * offY + yo;
|
||||
|
||||
final ItemStack is = refStack.copy().getItemStack();
|
||||
final ItemStack is = refStack.asItemStackRepresentation();
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
dspToolTip = Platform.getItemDisplayName( refStack );
|
||||
|
||||
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 posY = y * offY + ITEMSTACK_TOP_OFFSET;
|
||||
|
||||
final ItemStack is = refStack.copy().getItemStack();
|
||||
final ItemStack is = refStack.asItemStackRepresentation();
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
dspToolTip = Platform.getItemDisplayName( refStack );
|
||||
|
||||
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.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.parts.reporting.AbstractPartTerminal;
|
||||
import appeng.tile.misc.TileSecurityStation;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
@@ -304,6 +305,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.searchField.setEnableBackgroundDrawing( false );
|
||||
this.searchField.setMaxStringLength( 25 );
|
||||
this.searchField.setTextColor( 0xFFFFFF );
|
||||
this.searchField.setSelectionColor( 0xFF99FF99 );
|
||||
this.searchField.setVisible( true );
|
||||
|
||||
if( this.viewCell || this instanceof GuiWirelessTerm )
|
||||
@@ -313,13 +315,19 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.craftingStatusBtn.setHideEdge( 13 );
|
||||
}
|
||||
|
||||
// Enum setting = AEConfig.instance().getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
||||
final Enum setting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
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.selectAll();
|
||||
this.repo.setSearchString( memoryText );
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
@@ -363,12 +371,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
@Override
|
||||
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
|
||||
{
|
||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
|
||||
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.JEI_AUTOSEARCH )
|
||||
{
|
||||
this.searchField.mouseClicked( xCoord, yCoord, btn );
|
||||
}
|
||||
this.searchField.mouseClicked( xCoord, yCoord, btn );
|
||||
|
||||
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
|
||||
{
|
||||
|
||||
@@ -180,7 +180,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
toolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
|
||||
toolTip = Platform.getItemDisplayName( refStack );
|
||||
|
||||
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
|
||||
if( refStack.getCountRequestable() > 0 )
|
||||
@@ -192,7 +192,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
||||
toolPosY = y * 18 + yo;
|
||||
}
|
||||
|
||||
this.drawItem( posX, posY, this.repo.getItem( z ) );
|
||||
this.drawItem( posX, posY, refStack.asItemStackRepresentation() );
|
||||
|
||||
x++;
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ package appeng.client.gui.widgets;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
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 _width;
|
||||
private final int _height;
|
||||
private int selectionColor = 0xFF00FF00;
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
final boolean requiresFocus = this.isMouseIn( xPos, yPos );
|
||||
if( !this.isFocused() )
|
||||
{
|
||||
this.setFocused( requiresFocus );
|
||||
}
|
||||
|
||||
this.setFocused( requiresFocus );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -86,4 +94,69 @@ public class MEGuiTextField extends GuiTextField
|
||||
|
||||
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()
|
||||
{
|
||||
return this.repo.getItem( this.offset );
|
||||
return this.getAEStack() == null ? ItemStack.EMPTY : this.getAEStack().asItemStackRepresentation();
|
||||
}
|
||||
|
||||
IAEItemStack getAEStack()
|
||||
|
||||
@@ -50,7 +50,6 @@ public class ItemRepo
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||
private final ArrayList<ItemStack> dsp = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
|
||||
@@ -78,17 +77,6 @@ public class ItemRepo
|
||||
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 )
|
||||
{
|
||||
this.searchString = search == null ? "" : search;
|
||||
@@ -118,10 +106,8 @@ public class ItemRepo
|
||||
public void updateView()
|
||||
{
|
||||
this.view.clear();
|
||||
this.dsp.clear();
|
||||
|
||||
this.view.ensureCapacity( this.list.size() );
|
||||
this.dsp.ensureCapacity( this.list.size() );
|
||||
|
||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
@@ -177,12 +163,10 @@ public class ItemRepo
|
||||
if( viewMode == ViewItems.CRAFTABLE )
|
||||
{
|
||||
is = is.copy();
|
||||
// is.setStackSize( 0 ) triggers isEmpty() and thus only shows empty stacks!
|
||||
is.setStackSize( 1 );
|
||||
is.setShowCraftingLabel( true );
|
||||
is.setStackSize( 0 );
|
||||
}
|
||||
|
||||
if( viewMode == ViewItems.STORED && is.getShowCraftingLabel() )
|
||||
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -196,7 +180,7 @@ public class ItemRepo
|
||||
notDone = false;
|
||||
}
|
||||
|
||||
if( terminalSearchToolTips && notDone )
|
||||
if( terminalSearchToolTips && notDone && !searchMod )
|
||||
{
|
||||
for( final Object lp : Platform.getTooltip( is ) )
|
||||
{
|
||||
@@ -237,11 +221,6 @@ public class ItemRepo
|
||||
{
|
||||
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 )
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.client.render;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -42,9 +41,9 @@ public class StackSizeRenderer
|
||||
private static final ISlimReadableNumberConverter SLIM_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 inverseScaleFactor = 1.0f / scaleFactor;
|
||||
@@ -53,7 +52,7 @@ public class StackSizeRenderer
|
||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||
fontRenderer.setUnicodeFlag( false );
|
||||
|
||||
if( aeStack.getShowCraftingLabel() )
|
||||
if( aeStack.getStackSize() == 0 && aeStack.isCraftable() )
|
||||
{
|
||||
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
|
||||
.getLocal();
|
||||
@@ -71,10 +70,9 @@ public class StackSizeRenderer
|
||||
GlStateManager.enableBlend();
|
||||
}
|
||||
|
||||
final long amount = aeStack != null ? aeStack.getStackSize() : is.getCount();
|
||||
if( amount != 0 && !aeStack.getShowCraftingLabel() )
|
||||
if( aeStack.getStackSize() > 0 )
|
||||
{
|
||||
final String stackSize = this.getToBeRenderedStackSize( amount );
|
||||
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
@@ -126,8 +126,9 @@ public class TesrRenderHelper
|
||||
*/
|
||||
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 String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
||||
|
||||
@@ -22,6 +22,7 @@ package appeng.client.render.effects;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -45,7 +46,8 @@ public class AssemblerFX extends Particle implements ICanDie
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
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 );
|
||||
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() );
|
||||
}
|
||||
|
||||
try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft()
|
||||
.getResourceManager()
|
||||
.getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) )
|
||||
.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;
|
||||
}
|
||||
|
||||
@@ -387,7 +389,7 @@ public enum UVLModelLoader implements ICustomModelLoader
|
||||
|
||||
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.energy.IEnergyGrid;
|
||||
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.security.ISecurityGrid;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -77,6 +76,7 @@ import appeng.core.sync.packets.PacketPartialItem;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
@@ -87,7 +87,7 @@ import appeng.util.item.AEItemStack;
|
||||
public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
private final InventoryPlayer invPlayer;
|
||||
private final BaseActionSource mySrc;
|
||||
private final IActionSource mySrc;
|
||||
private final HashSet<Integer> locked = new HashSet<>();
|
||||
private final TileEntity tileEntity;
|
||||
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.
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
final ItemStack a = stack == null ? ItemStack.EMPTY : stack.getItemStack();
|
||||
final ItemStack b = this.clientRequestedTargetItem == null ? ItemStack.EMPTY : this.clientRequestedTargetItem.getItemStack();
|
||||
|
||||
if( Platform.itemComparisons().isSameItem( a, b ) )
|
||||
if( stack == null && this.clientRequestedTargetItem == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( stack != null && stack.isSameType( this.clientRequestedTargetItem ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -279,7 +280,7 @@ public abstract class AEBaseContainer extends Container
|
||||
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
||||
}
|
||||
|
||||
public BaseActionSource getActionSource()
|
||||
public IActionSource getActionSource()
|
||||
{
|
||||
return this.mySrc;
|
||||
}
|
||||
@@ -861,7 +862,7 @@ public abstract class AEBaseContainer extends Container
|
||||
if( slotItem != null )
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
ItemStack myItem = ais.getItemStack();
|
||||
ItemStack myItem = ais.createItemStack();
|
||||
|
||||
ais.setStackSize( myItem.getMaxStackSize() );
|
||||
|
||||
@@ -877,7 +878,7 @@ public abstract class AEBaseContainer extends Container
|
||||
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais != null )
|
||||
{
|
||||
adp.addItems( ais.getItemStack() );
|
||||
adp.addItems( ais.createItemStack() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -901,7 +902,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
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() )
|
||||
{
|
||||
this.getCellInventory().extractItems( extracted, Actionable.MODULATE, this.getActionSource() );
|
||||
@@ -930,7 +931,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
liftQty = 0;
|
||||
}
|
||||
if( !Platform.itemComparisons().isSameItem( slotItem.getItemStack(), item ) )
|
||||
if( !Platform.itemComparisons().isSameItem( slotItem.getDefinition(), item ) )
|
||||
{
|
||||
liftQty = 0;
|
||||
}
|
||||
@@ -945,7 +946,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
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() )
|
||||
{
|
||||
this.getCellInventory().injectItems( ais, Actionable.MODULATE, this.getActionSource() );
|
||||
@@ -967,11 +968,11 @@ public abstract class AEBaseContainer extends Container
|
||||
if( slotItem != null )
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
|
||||
ais.setStackSize( ais.getDefinition().getMaxStackSize() );
|
||||
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais != null )
|
||||
{
|
||||
player.inventory.setItemStack( ais.getItemStack() );
|
||||
player.inventory.setItemStack( ais.createItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -986,7 +987,7 @@ public abstract class AEBaseContainer extends Container
|
||||
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais != null )
|
||||
{
|
||||
player.inventory.setItemStack( ais.getItemStack() );
|
||||
player.inventory.setItemStack( ais.createItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1007,7 +1008,7 @@ public abstract class AEBaseContainer extends Container
|
||||
if( slotItem != null )
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
final long maxSize = ais.getItemStack().getMaxStackSize();
|
||||
final long maxSize = ais.getDefinition().getMaxStackSize();
|
||||
ais.setStackSize( maxSize );
|
||||
ais = this.getCellInventory().extractItems( ais, Actionable.SIMULATE, this.getActionSource() );
|
||||
|
||||
@@ -1020,7 +1021,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( ais != null )
|
||||
{
|
||||
player.inventory.setItemStack( ais.getItemStack() );
|
||||
player.inventory.setItemStack( ais.createItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1050,7 +1051,7 @@ public abstract class AEBaseContainer extends Container
|
||||
case CREATIVE_DUPLICATE:
|
||||
if( player.capabilities.isCreativeMode && slotItem != null )
|
||||
{
|
||||
final ItemStack is = slotItem.getItemStack();
|
||||
final ItemStack is = slotItem.createItemStack();
|
||||
is.setCount( is.getMaxStackSize() );
|
||||
player.inventory.setItemStack( is );
|
||||
this.updateHeld( player );
|
||||
@@ -1069,7 +1070,7 @@ public abstract class AEBaseContainer extends Container
|
||||
for( int slotNum = 0; slotNum < playerInv; slotNum++ )
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
ItemStack myItem = ais.getItemStack();
|
||||
ItemStack myItem = ais.createItemStack();
|
||||
|
||||
ais.setStackSize( myItem.getMaxStackSize() );
|
||||
|
||||
@@ -1085,7 +1086,7 @@ public abstract class AEBaseContainer extends Container
|
||||
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais != null )
|
||||
{
|
||||
adp.addItems( ais.getItemStack() );
|
||||
adp.addItems( ais.createItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1128,7 +1129,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return ais.getItemStack();
|
||||
return ais.createItemStack();
|
||||
}
|
||||
|
||||
private void updateSlot( final Slot clickSlot )
|
||||
|
||||
@@ -240,8 +240,8 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
if( i.hasNext() )
|
||||
{
|
||||
final ItemStack g = i.next().getItemStack();
|
||||
g.setCount( 1 );
|
||||
// TODO: check if ok
|
||||
final ItemStack g = i.next().asItemStackRepresentation();
|
||||
ItemHandlerUtil.setStackInSlot( inv, x, g );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -27,13 +27,13 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
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.data.IAEItemStack;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotInaccessible;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ContainerCraftAmount extends AEBaseContainer
|
||||
return this.getPlayerInv().player.world;
|
||||
}
|
||||
|
||||
public BaseActionSource getActionSrc()
|
||||
public IActionSource getActionSrc()
|
||||
{
|
||||
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.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
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.storage.IMEInventory;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
@@ -58,8 +57,8 @@ import appeng.core.AELog;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
@@ -353,15 +352,13 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
this.setAutoStart( false );
|
||||
if( g != null && originalGui != null && this.getOpenContext() != null )
|
||||
{
|
||||
NetworkHandler.instance().sendTo( new PacketSwitchGuis( originalGui ), (EntityPlayerMP) this.getInventoryPlayer().player );
|
||||
|
||||
final TileEntity te = this.getOpenContext().getTile();
|
||||
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() );
|
||||
}
|
||||
|
||||
@@ -28,16 +28,14 @@ import net.minecraft.inventory.IContainerListener;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
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.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.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
@@ -65,15 +63,11 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
public ContainerCraftingCPU( final InventoryPlayer ip, final Object 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 );
|
||||
for( final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
this.findNode( host, d );
|
||||
}
|
||||
this.setNetwork( host.getActionableNode().getGrid() );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
if( c == this.getMonitor() )
|
||||
@@ -238,7 +220,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
||||
@@ -47,7 +47,8 @@ import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
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.parts.IPart;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
@@ -122,9 +123,22 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
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 )
|
||||
{
|
||||
this.networkNode = node;
|
||||
@@ -374,7 +388,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
@@ -67,7 +66,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
{
|
||||
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() );
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
{
|
||||
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() );
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -59,6 +58,7 @@ import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
@@ -364,7 +364,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
inv = playerInv;
|
||||
}
|
||||
|
||||
if( !inv.simulateAdd( out.getItemStack() ).isEmpty() )
|
||||
if( !inv.simulateAdd( out.createItemStack() ).isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
if( extracted != null )
|
||||
{
|
||||
inv.addItems( extracted.getItemStack() );
|
||||
inv.addItems( extracted.createItemStack() );
|
||||
if( p instanceof EntityPlayerMP )
|
||||
{
|
||||
this.updateHeld( (EntityPlayerMP) p );
|
||||
@@ -388,7 +388,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
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 = CraftingManager.findMatchingRecipe( ic, p.world );
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
||||
{
|
||||
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() );
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
{
|
||||
if( i.hasNext() && this.isSlotEnabled( ( x / 9 ) - 2 ) )
|
||||
{
|
||||
final ItemStack g = i.next().getItemStack();
|
||||
g.setCount( 1 );
|
||||
// TODO: check if ok
|
||||
final ItemStack g = i.next().asItemStackRepresentation();
|
||||
ItemHandlerUtil.setStackInSlot( inv, x, g );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -245,7 +245,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
{
|
||||
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() );
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public void clearStack()
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.slotNumber, ItemStack.EMPTY );
|
||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
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.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -61,12 +61,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
private final IItemHandler craftInv;
|
||||
private final IItemHandler pattern;
|
||||
|
||||
private final BaseActionSource mySrc;
|
||||
private final IActionSource mySrc;
|
||||
private final IEnergySource energySrc;
|
||||
private final IStorageMonitorable storage;
|
||||
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 );
|
||||
this.energySrc = energySrc;
|
||||
@@ -134,7 +134,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemStack rs = Platform.cloneItemStack( this.getStack() );
|
||||
final ItemStack rs = this.getStack().copy();
|
||||
if( rs.isEmpty() )
|
||||
{
|
||||
return;
|
||||
@@ -202,7 +202,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
// update crafting matrix...
|
||||
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()];
|
||||
// Safeguard for empty slots in the inventory for now
|
||||
@@ -309,7 +309,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
final IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
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.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
@@ -40,7 +40,7 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
||||
private final int groupNum;
|
||||
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 );
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
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.IStorageHelper;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -90,13 +90,13 @@ public class ApiStorage implements IStorageHelper
|
||||
}
|
||||
|
||||
@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 );
|
||||
}
|
||||
|
||||
@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 );
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
@@ -96,12 +99,26 @@ public class IMCGrinder implements IIMCProcessor
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.item.ItemStack;
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import appeng.recipes.ores.IOreListener;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
|
||||
@@ -52,7 +51,7 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
|
||||
{
|
||||
for( final ItemStack o : this.DamageModifiers.keySet() )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( o, is ) )
|
||||
if( ItemStack.areItemsEqual( o, is ) )
|
||||
{
|
||||
return this.DamageModifiers.get( o ).floatValue();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
@@ -216,7 +215,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
return this.tunnels.get( is );
|
||||
}
|
||||
|
||||
if( Platform.itemComparisons().isEqualItem( is, trigger ) )
|
||||
if( ItemStack.areItemsEqual( is, trigger ) )
|
||||
{
|
||||
return this.tunnels.get( is );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
@@ -33,7 +35,10 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.IInscriberRecipeBuilder;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.recipes.ores.IOreListener;
|
||||
@@ -83,58 +88,26 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
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
|
||||
public Collection<IGrinderRecipe> getRecipes()
|
||||
{
|
||||
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
|
||||
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 ) )
|
||||
{
|
||||
this.log( "Tried to add duplicate recipe for '%1$s'", Platform.getItemDisplayName( appEngGrinderRecipe.getInput() ) );
|
||||
return;
|
||||
this.log( "Tried to add duplicate recipe for '%1$s'", Platform.getItemDisplayName( grinderRecipe.getInput() ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
this.recipes.put( cacheKey, appEngGrinderRecipe );
|
||||
}
|
||||
this.recipes.put( cacheKey, grinderRecipe );
|
||||
|
||||
private ItemStack copy( final ItemStack is )
|
||||
{
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
return is.copy();
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getDustToOreRatio( final String name )
|
||||
@@ -259,11 +225,25 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
final ItemStack extra = is.copy();
|
||||
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
|
||||
{
|
||||
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 ) )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if( this.dusts.containsKey( name ) )
|
||||
{
|
||||
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();
|
||||
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
|
||||
{
|
||||
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() ) )
|
||||
{
|
||||
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;
|
||||
}
|
||||
if( obj == null || this.getClass() != obj.getClass() )
|
||||
if( obj == null || getClass() != obj.getClass() )
|
||||
{
|
||||
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 com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
@@ -84,32 +86,43 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
}
|
||||
|
||||
@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." );
|
||||
this.recipes.add( recipe );
|
||||
|
||||
recipe.getTopOptional().ifPresent( this.optionals::add );
|
||||
recipe.getBottomOptional().ifPresent( this.optionals::add );
|
||||
|
||||
this.inputs.addAll( recipe.getInputs() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
this.recipes.add( recipe );
|
||||
|
||||
recipe.getTopOptional().ifPresent( this.optionals::add );
|
||||
recipe.getBottomOptional().ifPresent( this.optionals::add );
|
||||
|
||||
this.inputs.addAll( recipe.getInputs() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@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(); )
|
||||
{
|
||||
final IInscriberRecipe recipe = iterator.next();
|
||||
if( recipe.equals( toBeRemovedRecipe ) )
|
||||
{
|
||||
changed = true;
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,6 +141,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withInputs( @Nonnull final Collection<ItemStack> inputs )
|
||||
{
|
||||
Preconditions.checkNotNull( inputs );
|
||||
Preconditions.checkArgument( !inputs.isEmpty() );
|
||||
|
||||
this.inputs = new ArrayList<>( inputs.size() );
|
||||
this.inputs.addAll( inputs );
|
||||
|
||||
@@ -138,6 +154,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withOutput( @Nonnull final ItemStack output )
|
||||
{
|
||||
Preconditions.checkNotNull( output );
|
||||
Preconditions.checkArgument( !output.isEmpty() );
|
||||
|
||||
this.output = output;
|
||||
|
||||
return this;
|
||||
@@ -147,6 +166,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withTopOptional( @Nonnull final ItemStack topOptional )
|
||||
{
|
||||
Preconditions.checkNotNull( topOptional );
|
||||
Preconditions.checkArgument( !topOptional.isEmpty() );
|
||||
|
||||
this.topOptional = topOptional;
|
||||
|
||||
return this;
|
||||
@@ -156,6 +178,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withBottomOptional( @Nonnull final ItemStack bottomOptional )
|
||||
{
|
||||
Preconditions.checkNotNull( bottomOptional );
|
||||
Preconditions.checkArgument( !bottomOptional.isEmpty() );
|
||||
|
||||
this.bottomOptional = bottomOptional;
|
||||
|
||||
return this;
|
||||
@@ -165,6 +190,8 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withProcessType( @Nonnull final InscriberProcessType type )
|
||||
{
|
||||
Preconditions.checkNotNull( type );
|
||||
|
||||
this.type = type;
|
||||
|
||||
return this;
|
||||
@@ -174,26 +201,11 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public IInscriberRecipe build()
|
||||
{
|
||||
if( this.inputs == null )
|
||||
{
|
||||
throw new IllegalStateException( "Input must be defined." );
|
||||
}
|
||||
if( this.inputs.isEmpty() )
|
||||
{
|
||||
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." );
|
||||
}
|
||||
Preconditions.checkState( this.inputs != null, "Input must be defined." );
|
||||
Preconditions.checkState( !this.inputs.isEmpty(), "Input must have a size." );
|
||||
Preconditions.checkState( !this.output.isEmpty(), "Output cannot be empty." );
|
||||
Preconditions.checkState( !this.topOptional.isEmpty() || !this.bottomOptional.isEmpty(), "One optional must be defined." );
|
||||
Preconditions.checkState( this.type != null, "Process type must be defined." );
|
||||
|
||||
return new InscriberRecipe( this.inputs, this.output, this.topOptional, this.bottomOptional, this.type );
|
||||
}
|
||||
|
||||
@@ -28,11 +28,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
@@ -77,10 +76,10 @@ public class PacketCraftRequest extends AppEngPacket
|
||||
{
|
||||
final ContainerCraftAmount cca = (ContainerCraftAmount) player.openContainer;
|
||||
final Object target = cca.getTarget();
|
||||
if( target instanceof IGridHost )
|
||||
if( target instanceof IActionHost )
|
||||
{
|
||||
final IGridHost gh = (IGridHost) target;
|
||||
final IGridNode gn = gh.getGridNode( AEPartLocation.INTERNAL );
|
||||
final IActionHost ah = (IActionHost) target;
|
||||
final IGridNode gn = ah.getActionableNode();
|
||||
if( gn == null )
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -141,10 +141,7 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
|
||||
if( baseContainer.getTargetStack() != null )
|
||||
{
|
||||
// Force to stack size 1 to fix a client-side display problem...
|
||||
ItemStack displayIs = baseContainer.getTargetStack().getItemStack().copy();
|
||||
displayIs.setCount( 1 );
|
||||
cca.getCraftingItem().putStack( displayIs );
|
||||
cca.getCraftingItem().putStack( baseContainer.getTargetStack().asItemStackRepresentation() );
|
||||
// This is the *actual* item that matters, not the display item above
|
||||
cca.setItemToCraft( baseContainer.getTargetStack() );
|
||||
}
|
||||
@@ -171,7 +168,7 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
AppEng.proxy.getPlayers().get( 0 ).inventory.setItemStack( this.slotItem.getItemStack() );
|
||||
AppEng.proxy.getPlayers().get( 0 ).inventory.setItemStack( this.slotItem.createItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
final IAEItemStack out = cct.useRealItems() ? Platform.poweredInsert( energy, storage, in, cct.getActionSource() ) : null;
|
||||
if( out != null )
|
||||
{
|
||||
currentItem = out.getItemStack();
|
||||
currentItem = out.createItemStack();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -188,7 +188,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
|
||||
if( out != null )
|
||||
{
|
||||
currentItem = out.getItemStack();
|
||||
currentItem = out.createItemStack();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -51,11 +50,6 @@ public class PacketSwitchGuis extends AppEngPacket
|
||||
{
|
||||
this.newGui = newGui;
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
AEBaseGui.setSwitchingGuis( true );
|
||||
}
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( this.getPacketID() );
|
||||
@@ -79,10 +73,4 @@ public class PacketSwitchGuis extends AppEngPacket
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
|
||||
{
|
||||
AEBaseGui.setSwitchingGuis( true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,8 @@ import appeng.api.networking.crafting.ICraftingCallback;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -66,7 +64,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
private boolean simulate = false;
|
||||
private MECraftingInventory availableCheck;
|
||||
private long bytes = 0;
|
||||
private final BaseActionSource actionSrc;
|
||||
private final IActionSource actionSrc;
|
||||
private final ICraftingCallback callback;
|
||||
private boolean running = false;
|
||||
private boolean done = false;
|
||||
@@ -78,7 +76,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
return w;
|
||||
}
|
||||
|
||||
public CraftingJob( final World w, final IGrid grid, final BaseActionSource actionSrc, final IAEItemStack what, final ICraftingCallback callback )
|
||||
public CraftingJob( final World w, final IGrid grid, final IActionSource actionSrc, final IAEItemStack what, final ICraftingCallback callback )
|
||||
{
|
||||
this.world = this.wrapWorld( w );
|
||||
this.output = what.copy();
|
||||
@@ -375,22 +373,21 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
final long elapsedTime = timer.elapsed( TimeUnit.MILLISECONDS );
|
||||
final String actionSource;
|
||||
|
||||
if( this.actionSrc instanceof MachineSource )
|
||||
if( this.actionSrc.player().isPresent() )
|
||||
{
|
||||
final IActionHost machineSource = ( (MachineSource) this.actionSrc ).via;
|
||||
final EntityPlayer player = this.actionSrc.player().get();
|
||||
|
||||
actionSource = player.toString();
|
||||
}
|
||||
else if( this.actionSrc.machine().isPresent() )
|
||||
{
|
||||
final IActionHost machineSource = this.actionSrc.machine().get();
|
||||
final IGridNode actionableNode = machineSource.getActionableNode();
|
||||
final IGridHost machine = actionableNode.getMachine();
|
||||
final DimensionalCoord location = actionableNode.getGridBlock().getLocation();
|
||||
|
||||
actionSource = String.format( LOG_MACHINE_SOURCE_DETAILS, machine, location );
|
||||
}
|
||||
else if( this.actionSrc instanceof PlayerSource )
|
||||
{
|
||||
final PlayerSource source = (PlayerSource) this.actionSrc;
|
||||
final EntityPlayer player = source.player;
|
||||
|
||||
actionSource = player.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
actionSource = "[unknown source]";
|
||||
|
||||
@@ -33,7 +33,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
@@ -117,7 +117,7 @@ public class CraftingTreeNode
|
||||
return this.parent.notRecursive( details );
|
||||
}
|
||||
|
||||
IAEItemStack request( final MECraftingInventory inv, long l, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
IAEItemStack request( final MECraftingInventory inv, long l, final IActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
{
|
||||
this.job.handlePausing();
|
||||
|
||||
@@ -147,7 +147,7 @@ public class CraftingTreeNode
|
||||
|
||||
for( IAEItemStack fuzz : itemList )
|
||||
{
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.getItemStack(), this.world ) )
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.createItemStack(), this.world ) )
|
||||
{
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( l );
|
||||
@@ -346,7 +346,7 @@ public class CraftingTreeNode
|
||||
}
|
||||
}
|
||||
|
||||
public void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure
|
||||
public void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final IActionSource src ) throws CraftBranchFailure
|
||||
{
|
||||
for( final IAEItemStack i : this.used )
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -73,7 +73,7 @@ public class CraftingTreeProcess
|
||||
final IAEItemStack[] is = details.getInputs();
|
||||
for( int x = 0; x < ic.getSizeInventory(); x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, is[x] == null ? ItemStack.EMPTY : is[x].getItemStack() );
|
||||
ic.setInventorySlotContents( x, is[x] == null ? ItemStack.EMPTY : is[x].createItemStack() );
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) world ), details.getOutput( ic, world ), ic );
|
||||
@@ -89,7 +89,7 @@ public class CraftingTreeProcess
|
||||
|
||||
for( final IAEItemStack part : details.getCondensedInputs() )
|
||||
{
|
||||
final ItemStack g = part.getItemStack();
|
||||
final ItemStack g = part.createItemStack();
|
||||
|
||||
boolean isAnInput = false;
|
||||
for( final IAEItemStack a : details.getCondensedOutputs() )
|
||||
@@ -146,7 +146,7 @@ public class CraftingTreeProcess
|
||||
{
|
||||
for( final IAEItemStack part : details.getCondensedInputs() )
|
||||
{
|
||||
final ItemStack g = part.getItemStack();
|
||||
final ItemStack g = part.createItemStack();
|
||||
|
||||
boolean isAnInput = false;
|
||||
for( final IAEItemStack a : details.getCondensedOutputs() )
|
||||
@@ -184,7 +184,7 @@ public class CraftingTreeProcess
|
||||
return ( remaining / stackSize ) + ( remaining % stackSize != 0 ? 1 : 0 );
|
||||
}
|
||||
|
||||
void request( final MECraftingInventory inv, final long i, final BaseActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
void request( final MECraftingInventory inv, final long i, final IActionSource src ) throws CraftBranchFailure, InterruptedException
|
||||
{
|
||||
this.job.handlePausing();
|
||||
|
||||
@@ -197,7 +197,7 @@ public class CraftingTreeProcess
|
||||
final IAEItemStack item = entry.getKey().getStack( entry.getValue() );
|
||||
final IAEItemStack stack = entry.getKey().request( inv, item.getStackSize(), src );
|
||||
|
||||
ic.setInventorySlotContents( entry.getKey().getSlot(), stack.getItemStack() );
|
||||
ic.setInventorySlotContents( entry.getKey().getSlot(), stack.createItemStack() );
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.world ), this.details.getOutput( ic, this.world ), ic );
|
||||
@@ -225,7 +225,7 @@ public class CraftingTreeProcess
|
||||
|
||||
if( this.containerItems )
|
||||
{
|
||||
final ItemStack is = Platform.getContainerItem( stack.getItemStack() );
|
||||
final ItemStack is = Platform.getContainerItem( stack.createItemStack() );
|
||||
final IAEItemStack o = AEApi.instance().storage().createItemStack( is );
|
||||
if( o != null )
|
||||
{
|
||||
@@ -297,7 +297,7 @@ public class CraftingTreeProcess
|
||||
}
|
||||
}
|
||||
|
||||
void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final BaseActionSource src ) throws CraftBranchFailure
|
||||
void setJob( final MECraftingInventory storage, final CraftingCPUCluster craftingCPUCluster, final IActionSource src ) throws CraftBranchFailure
|
||||
{
|
||||
craftingCPUCluster.addCrafting( this.details, this.crafts );
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.crafting;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
@@ -99,7 +99,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
this.par = parent;
|
||||
}
|
||||
|
||||
public MECraftingInventory( final IMEMonitor<IAEItemStack> target, final BaseActionSource src, final boolean logExtracted, final boolean logInjections, final boolean logMissing )
|
||||
public MECraftingInventory( final IMEMonitor<IAEItemStack> target, final IActionSource src, final boolean logExtracted, final boolean logInjections, final boolean logMissing )
|
||||
{
|
||||
this.target = target;
|
||||
this.logExtracted = logExtracted;
|
||||
@@ -181,7 +181,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( input == null )
|
||||
{
|
||||
@@ -201,7 +201,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( request == null )
|
||||
{
|
||||
@@ -265,7 +265,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
return this.localCache;
|
||||
}
|
||||
|
||||
public boolean commit( final BaseActionSource src )
|
||||
public boolean commit( final IActionSource src )
|
||||
{
|
||||
final IItemList<IAEItemStack> added = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().createItemList();
|
||||
|
||||
@@ -121,12 +121,12 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
final ItemStack other = ( (EntityItem) e ).getItem();
|
||||
if( !other.isEmpty() )
|
||||
{
|
||||
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
if( ItemStack.areItemsEqual( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
{
|
||||
redstone = (EntityItem) e;
|
||||
}
|
||||
|
||||
if( Platform.itemComparisons().isEqualItem( other, new ItemStack( Items.QUARTZ ) ) )
|
||||
if( ItemStack.areItemsEqual( other, new ItemStack( Items.QUARTZ ) ) )
|
||||
{
|
||||
netherQuartz = (EntityItem) e;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -66,9 +67,8 @@ import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
@@ -88,6 +88,7 @@ import appeng.capabilities.Capabilities;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
import appeng.me.storage.MEMonitorIInventory;
|
||||
import appeng.me.storage.MEMonitorPassThrough;
|
||||
import appeng.me.storage.NullInventory;
|
||||
@@ -118,8 +119,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private final MultiCraftingTracker craftingTracker;
|
||||
private final AENetworkProxy gridProxy;
|
||||
private final IInterfaceHost iHost;
|
||||
private final BaseActionSource mySource;
|
||||
private final BaseActionSource interfaceRequestSource;
|
||||
private final IActionSource mySource;
|
||||
private final IActionSource interfaceRequestSource;
|
||||
private final ConfigManager cm = new ConfigManager( this );
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS );
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
|
||||
@@ -132,7 +133,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private List<ICraftingPatternDetails> craftingList = null;
|
||||
private List<ItemStack> waitingToSend = null;
|
||||
private IMEInventory<IAEItemStack> destination;
|
||||
private boolean isWorking = false;
|
||||
private int isWorking = -1;
|
||||
private final Accessor accessor = new Accessor();
|
||||
|
||||
public DualityInterface( final AENetworkProxy networkProxy, final IInterfaceHost ih )
|
||||
@@ -164,7 +165,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
|
||||
{
|
||||
if( this.isWorking )
|
||||
if( this.isWorking == slot )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -407,34 +408,34 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
req = null;
|
||||
}
|
||||
|
||||
final ItemStack Stored = this.storage.getStackInSlot( slot );
|
||||
final ItemStack stored = this.storage.getStackInSlot( slot );
|
||||
|
||||
if( req == null && !Stored.isEmpty() )
|
||||
if( req == null && !stored.isEmpty() )
|
||||
{
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
else if( req != null )
|
||||
{
|
||||
if( Stored.isEmpty() ) // need to add stuff!
|
||||
if( stored.isEmpty() ) // need to add stuff!
|
||||
{
|
||||
this.requireWork[slot] = req.copy();
|
||||
return;
|
||||
}
|
||||
else if( req.isSameType( Stored ) ) // same type ( qty different? )!
|
||||
else if( req.isSameType( stored ) ) // same type ( qty different? )!
|
||||
{
|
||||
if( req.getStackSize() != Stored.getCount() )
|
||||
if( req.getStackSize() != stored.getCount() )
|
||||
{
|
||||
this.requireWork[slot] = req.copy();
|
||||
this.requireWork[slot].setStackSize( req.getStackSize() - Stored.getCount() );
|
||||
this.requireWork[slot].setStackSize( req.getStackSize() - stored.getCount() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
// Stored != null; dispose!
|
||||
{
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -657,7 +658,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private boolean usePlan( final int x, final IAEItemStack itemStack )
|
||||
{
|
||||
final InventoryAdaptor adaptor = this.getAdaptor( x );
|
||||
this.isWorking = true;
|
||||
this.isWorking = x;
|
||||
|
||||
boolean changed = false;
|
||||
try
|
||||
@@ -672,7 +673,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
else if( itemStack.getStackSize() > 0 )
|
||||
{
|
||||
// make sure strange things didn't happen...
|
||||
if( !adaptor.simulateAdd( itemStack.getItemStack() ).isEmpty() )
|
||||
if( !adaptor.simulateAdd( itemStack.createItemStack() ).isEmpty() )
|
||||
{
|
||||
changed = true;
|
||||
throw new GridAccessException();
|
||||
@@ -682,7 +683,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
if( acquired != null )
|
||||
{
|
||||
changed = true;
|
||||
final ItemStack issue = adaptor.addItems( acquired.getItemStack() );
|
||||
final ItemStack issue = adaptor.addItems( acquired.createItemStack() );
|
||||
if( !issue.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
||||
@@ -701,7 +702,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
long diff = toStore.getStackSize();
|
||||
|
||||
// make sure strange things didn't happen...
|
||||
final ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getItemStack(), null );
|
||||
// TODO: check if OK
|
||||
final ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getDefinition(), null );
|
||||
if( canExtract.isEmpty() || canExtract.getCount() != diff )
|
||||
{
|
||||
changed = true;
|
||||
@@ -742,7 +744,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.updatePlan( x );
|
||||
}
|
||||
|
||||
this.isWorking = false;
|
||||
this.isWorking = -1;
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -865,7 +867,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.craftingTracker.cancel();
|
||||
}
|
||||
|
||||
public IStorageMonitorable getMonitorable( final BaseActionSource src, final IStorageMonitorable myInterface )
|
||||
public IStorageMonitorable getMonitorable( final IActionSource src, final IStorageMonitorable myInterface )
|
||||
{
|
||||
if( Platform.canAccess( this.gridProxy, src ) )
|
||||
{
|
||||
@@ -990,7 +992,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
|
||||
if( ad != null )
|
||||
{
|
||||
if( !ad.simulateRemove( 1, ItemStack.EMPTY, null ).isEmpty() )
|
||||
if( ad.simulateRemove( 1, ItemStack.EMPTY, null ).isEmpty() )
|
||||
{
|
||||
allAreBusy = false;
|
||||
break;
|
||||
@@ -1117,11 +1119,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
return AEItemStack.create( adaptor.simulateAdd( acquired.getItemStack() ) );
|
||||
return AEItemStack.create( adaptor.simulateAdd( acquired.createItemStack() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.getItemStack() ) );
|
||||
final IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.createItemStack() ) );
|
||||
this.updatePlan( slot );
|
||||
return is;
|
||||
}
|
||||
@@ -1275,10 +1277,34 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private class InterfaceRequestSource extends MachineSource
|
||||
{
|
||||
private final InterfaceRequestContext context;
|
||||
|
||||
public InterfaceRequestSource( final IActionHost v )
|
||||
public InterfaceRequestSource( IActionHost v )
|
||||
{
|
||||
super( v );
|
||||
this.context = new InterfaceRequestContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> context( Class<T> key )
|
||||
{
|
||||
if( key == InterfaceRequestContext.class )
|
||||
{
|
||||
return (Optional<T>) Optional.of( this.context );
|
||||
}
|
||||
|
||||
return super.context( key );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class InterfaceRequestContext implements Comparable<Integer>
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compareTo( Integer o )
|
||||
{
|
||||
return Integer.compare( DualityInterface.this.priority, o );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1292,9 +1318,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
if( src instanceof InterfaceRequestSource )
|
||||
final Optional<InterfaceRequestContext> context = src.context( InterfaceRequestContext.class );
|
||||
final boolean isInterface = context.isPresent();
|
||||
|
||||
if( isInterface )
|
||||
{
|
||||
return input;
|
||||
}
|
||||
@@ -1303,9 +1332,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable type, final BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable type, final IActionSource src )
|
||||
{
|
||||
if( src instanceof InterfaceRequestSource )
|
||||
final Optional<InterfaceRequestContext> context = src.context( InterfaceRequestContext.class );
|
||||
final boolean hasLowerOrEqualPriority = context.map( c -> c.compareTo( DualityInterface.this.priority ) <= 0 ).orElse( false );
|
||||
|
||||
if( hasLowerOrEqualPriority )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1319,7 +1351,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IStorageMonitorable getInventory( BaseActionSource src )
|
||||
public IStorageMonitorable getInventory( IActionSource src )
|
||||
{
|
||||
return DualityInterface.this.getMonitorable( src, DualityInterface.this );
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
|
||||
|
||||
public interface IContainerCraftingPacket
|
||||
@@ -44,7 +44,7 @@ public interface IContainerCraftingPacket
|
||||
/**
|
||||
* @return who are we?
|
||||
*/
|
||||
BaseActionSource getActionSource();
|
||||
IActionSource getActionSource();
|
||||
|
||||
/**
|
||||
* @return consume items?
|
||||
|
||||
@@ -33,7 +33,7 @@ import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
|
||||
@@ -81,9 +81,9 @@ public class MultiCraftingTracker
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleCrafting( final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final BaseActionSource mySrc )
|
||||
public boolean handleCrafting( final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final IActionSource mySrc )
|
||||
{
|
||||
if( ais != null && d.simulateAdd( ais.getItemStack() ).isEmpty() )
|
||||
if( ais != null && d.simulateAdd( ais.createItemStack() ).isEmpty() )
|
||||
{
|
||||
final Future<ICraftingJob> craftingJob = this.getJob( x );
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ package appeng.helpers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import scala.NotImplementedError;
|
||||
|
||||
|
||||
public class NonNullArrayIterator<E> implements Iterator<E>
|
||||
{
|
||||
@@ -58,6 +56,6 @@ public class NonNullArrayIterator<E> implements Iterator<E>
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new NotImplementedError();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
if( this.outputs != null && this.outputs.length > 0 )
|
||||
{
|
||||
return this.outputs[0].getItemStack();
|
||||
return this.outputs[0].createItemStack();
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
@@ -32,11 +32,10 @@ import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IMachineSet;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
@@ -44,8 +43,6 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
@@ -87,9 +84,9 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
// :P
|
||||
}
|
||||
|
||||
if( obj instanceof IGridHost )
|
||||
if( obj instanceof IActionHost )
|
||||
{
|
||||
final IGridNode n = ( (IGridHost) obj ).getGridNode( AEPartLocation.INTERNAL );
|
||||
final IGridNode n = ( (IActionHost) obj ).getActionableNode();
|
||||
if( n != null )
|
||||
{
|
||||
this.targetGrid = n.getGrid();
|
||||
@@ -225,7 +222,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -235,7 +232,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -280,24 +277,6 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
return this.wth.getConfigManager( this.effectiveItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( final AEPartLocation dir )
|
||||
{
|
||||
return this.getActionableNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( final AEPartLocation dir )
|
||||
{
|
||||
return AECableType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void securityBreak()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getActionableNode()
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.integration.modules.jei;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -35,6 +34,7 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.CondenserOutput;
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,6 +33,7 @@ import net.minecraftforge.fml.client.config.HoverChecker;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@@ -88,12 +88,14 @@ class GrinderRecipeCategory implements IRecipeCategory<GrinderRecipeWrapper>, IR
|
||||
itemStacks.set( ingredients );
|
||||
}
|
||||
|
||||
@Override public void addRecipeCategories( IRecipeCategory... recipeCategories )
|
||||
@Override
|
||||
public void addRecipeCategories( IRecipeCategory... recipeCategories )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override public IJeiHelpers getJeiHelpers()
|
||||
@Override
|
||||
public IJeiHelpers getJeiHelpers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
|
||||
class GrinderRecipeHandler implements IRecipeWrapperFactory<IGrinderRecipe>
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -32,6 +30,7 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import mezz.jei.api.recipe.IRecipeWrapperFactory;
|
||||
|
||||
|
||||
class InscriberRecipeHandler implements IRecipeWrapperFactory<IInscriberRecipe>
|
||||
|
||||
@@ -23,10 +23,10 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -43,6 +40,7 @@ import appeng.api.config.CondenserOutput;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
@@ -51,6 +49,8 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
|
||||
|
||||
@mezz.jei.api.JEIPlugin
|
||||
@@ -175,7 +175,8 @@ public class JEIPlugin implements IModPlugin
|
||||
if( !matterBall.isEmpty() || !singularity.isEmpty() )
|
||||
{
|
||||
registry.addRecipeCatalyst( condenser, CondenserCategory.UID );
|
||||
registry.handleRecipes( CondenserOutput.class, new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity) , CondenserCategory.UID );
|
||||
registry.handleRecipes( CondenserOutput.class, new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity ),
|
||||
CondenserCategory.UID );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,7 +28,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
|
||||
@@ -24,10 +24,10 @@ import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
|
||||
+2
-1
@@ -48,10 +48,11 @@ public class StorageMonitorInfoProvider implements IPartProbInfoProvider
|
||||
final IAEStack<?> displayed = monitor.getDisplayed();
|
||||
final boolean isLocked = monitor.isLocked();
|
||||
|
||||
// TODO: generalize
|
||||
if( displayed instanceof IAEItemStack )
|
||||
{
|
||||
final IAEItemStack ais = (IAEItemStack) displayed;
|
||||
probeInfo.text( TheOneProbeText.SHOWING.getLocal() + ": " + ais.getItemStack().getDisplayName() );
|
||||
probeInfo.text( TheOneProbeText.SHOWING.getLocal() + ": " + ais.asItemStackRepresentation().getDisplayName() );
|
||||
}
|
||||
else if( displayed instanceof IAEFluidStack )
|
||||
{
|
||||
|
||||
+2
-1
@@ -48,7 +48,8 @@ public class CraftingMonitorInfoProvider implements ITileProbInfoProvider
|
||||
|
||||
if( displayStack != null )
|
||||
{
|
||||
final ItemStack itemStack = displayStack.getItemStack();
|
||||
// TODO: check if OK
|
||||
final ItemStack itemStack = displayStack.asItemStackRepresentation();
|
||||
final String itemName = itemStack.getDisplayName();
|
||||
final String formattedCrafting = String.format( TheOneProbeText.CRAFTING.getLocal(), itemName );
|
||||
|
||||
|
||||
+2
-1
@@ -62,10 +62,11 @@ public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProv
|
||||
final IAEStack<?> displayed = monitor.getDisplayed();
|
||||
final boolean isLocked = monitor.isLocked();
|
||||
|
||||
// TODO: generalize
|
||||
if( displayed instanceof IAEItemStack )
|
||||
{
|
||||
final IAEItemStack ais = (IAEItemStack) displayed;
|
||||
currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() );
|
||||
currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.asItemStackRepresentation().getDisplayName() );
|
||||
}
|
||||
else if( displayed instanceof IAEFluidStack )
|
||||
{
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvide
|
||||
|
||||
if( displayStack != null )
|
||||
{
|
||||
final String currentCrafting = displayStack.getItemStack().getDisplayName();
|
||||
final String currentCrafting = displayStack.asItemStackRepresentation().getDisplayName();
|
||||
|
||||
currentToolTip.add( WailaText.Crafting.getLocal() + ": " + currentCrafting );
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].getItemStack() );
|
||||
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].createItemStack() );
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
@@ -77,6 +76,7 @@ import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.me.helpers.BaseActionSource;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.ItemSorters;
|
||||
@@ -126,7 +126,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
if( option != null )
|
||||
{
|
||||
paintBall = option.getItemStack();
|
||||
paintBall = option.createItemStack();
|
||||
paintBall.setCount( 1 );
|
||||
}
|
||||
else
|
||||
@@ -274,7 +274,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
final IAEItemStack firstItem = itemList.getFirstItem();
|
||||
if( firstItem != null )
|
||||
{
|
||||
newColor = firstItem.getItemStack();
|
||||
newColor = firstItem.createItemStack();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -321,7 +321,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
list.addFirst( list.removeLast() );
|
||||
}
|
||||
|
||||
return list.get( 0 ).getItemStack();
|
||||
return list.get( 0 ).createItemStack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
if( requestedAddition != null )
|
||||
{
|
||||
final int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
|
||||
final int[] id = OreDictionary.getOreIDs( requestedAddition.getDefinition() );
|
||||
|
||||
for( final int x : id )
|
||||
{
|
||||
|
||||
@@ -52,7 +52,6 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
@@ -76,6 +75,7 @@ import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.LookDirection;
|
||||
@@ -140,13 +140,12 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
aeAmmo.setStackSize( 1 );
|
||||
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).createItemStack();
|
||||
if( ammo == null )
|
||||
{
|
||||
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
ammo.setCount( 1 );
|
||||
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
|
||||
if( aeAmmo == null )
|
||||
{
|
||||
@@ -167,7 +166,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
|
||||
if( penetration <= 0 )
|
||||
{
|
||||
final ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
final ItemStack type = aeAmmo.asItemStackRepresentation();
|
||||
if( type.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
|
||||
@@ -497,7 +496,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
@Override
|
||||
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
|
||||
{
|
||||
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
|
||||
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.createItemStack() );
|
||||
if( pen > 0 )
|
||||
{
|
||||
return false;
|
||||
|
||||
+8
-6
@@ -67,7 +67,7 @@ import appeng.api.networking.events.MENetworkCraftingCpuChange;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPostCacheConstruction;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ICellProvider;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
@@ -80,6 +80,7 @@ import appeng.crafting.CraftingLink;
|
||||
import appeng.crafting.CraftingLinkNexus;
|
||||
import appeng.crafting.CraftingWatcher;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.me.helpers.BaseActionSource;
|
||||
import appeng.me.helpers.GenericInterestManager;
|
||||
import appeng.tile.crafting.TileCraftingStorageTile;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
@@ -431,7 +432,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack injectItems( IAEStack input, final Actionable type, final BaseActionSource src )
|
||||
public IAEStack injectItems( IAEStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
|
||||
{
|
||||
@@ -442,7 +443,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack extractItems( final IAEStack request, final Actionable mode, final BaseActionSource src )
|
||||
public IAEStack extractItems( final IAEStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -483,7 +484,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
{
|
||||
if( ais.getItem() == whatToCraft.getItem() && ( !ais.getItem().getHasSubtypes() || ais.getItemDamage() == whatToCraft.getItemDamage() ) )
|
||||
{
|
||||
if( details.isValidItemForSlot( slotIndex, ais.getItemStack(), world ) )
|
||||
// TODO: check if OK
|
||||
if( details.isValidItemForSlot( slotIndex, ais.createItemStack(), world ) )
|
||||
{
|
||||
return this.craftableItems.get( ais );
|
||||
}
|
||||
@@ -498,7 +500,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<ICraftingJob> beginCraftingJob( final World world, final IGrid grid, final BaseActionSource actionSrc, final IAEItemStack slotItem, final ICraftingCallback cb )
|
||||
public Future<ICraftingJob> beginCraftingJob( final World world, final IGrid grid, final IActionSource actionSrc, final IAEItemStack slotItem, final ICraftingCallback cb )
|
||||
{
|
||||
if( world == null || grid == null || actionSrc == null || slotItem == null )
|
||||
{
|
||||
@@ -511,7 +513,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingLink submitJob( final ICraftingJob job, final ICraftingRequester requestingMachine, final ICraftingCPU target, final boolean prioritizePower, final BaseActionSource src )
|
||||
public ICraftingLink submitJob( final ICraftingJob job, final ICraftingRequester requestingMachine, final ICraftingCPU target, final boolean prioritizePower, final IActionSource src )
|
||||
{
|
||||
if( job.isSimulation() )
|
||||
{
|
||||
|
||||
+53
-130
@@ -106,8 +106,6 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
private boolean hasPower = true;
|
||||
private long ticksSinceHasPowerChange = 900;
|
||||
|
||||
private IAEPowerStorage lastProvider;
|
||||
private IAEPowerStorage lastRequester;
|
||||
private PathGridCache pgc;
|
||||
private double lastStoredPower = -1;
|
||||
|
||||
@@ -127,7 +125,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void EnergyNodeChanges( final MENetworkPowerIdleChange ev )
|
||||
public void nodeIdlePowerChangeHandler( final MENetworkPowerIdleChange ev )
|
||||
{
|
||||
// update power usage based on event.
|
||||
final GridNode node = (GridNode) ev.node;
|
||||
@@ -141,7 +139,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void EnergyNodeChanges( final MENetworkPowerStorage ev )
|
||||
public void storagePowerChangeHandler( final MENetworkPowerStorage ev )
|
||||
{
|
||||
if( ev.storage.isAEPublicPowerStorage() )
|
||||
{
|
||||
@@ -247,7 +245,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
final IEnergyGridProvider next = toVisit.poll();
|
||||
visited.add( next );
|
||||
|
||||
extracted += next.extractProviderPower( toExtract - extracted, mode, visited );
|
||||
extracted += next.extractProviderPower( toExtract - extracted, mode );
|
||||
|
||||
for( IEnergyGridProvider iEnergyGridProvider : next.providers() )
|
||||
{
|
||||
@@ -299,25 +297,30 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractProviderPower( final double amt, final Actionable mode, final Set<IEnergyGridProvider> seen )
|
||||
public double extractProviderPower( final double amt, final Actionable mode )
|
||||
{
|
||||
double extractedPower = 0;
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
extractedPower += this.simulateExtract( extractedPower, amt );
|
||||
final Iterator<IAEPowerStorage> it = this.providers.iterator();
|
||||
|
||||
return extractedPower;
|
||||
}
|
||||
else
|
||||
while( extractedPower < amt && it.hasNext() )
|
||||
{
|
||||
extractedPower = this.doExtract( extractedPower, amt );
|
||||
final IAEPowerStorage node = it.next();
|
||||
|
||||
final double req = amt - extractedPower;
|
||||
final double newPower = node.extractAEPower( req, mode, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
|
||||
if( newPower < req )
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// got more then we wanted?
|
||||
if( extractedPower > amt )
|
||||
{
|
||||
this.localStorage.addAECurrentPower( extractedPower - amt );
|
||||
this.localStorage.addCurrentAEPower( extractedPower - amt );
|
||||
this.globalAvailablePower -= amt;
|
||||
|
||||
this.tickDrainPerTick += amt;
|
||||
@@ -331,32 +334,23 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectProviderPower( double amt, final Actionable mode, final Set<IEnergyGridProvider> seen )
|
||||
public double injectProviderPower( double amt, final Actionable mode )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
||||
while( amt > 0 && it.hasNext() )
|
||||
{
|
||||
final IAEPowerStorage node = it.next();
|
||||
amt = node.injectAEPower( amt, Actionable.SIMULATE );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.tickInjectionPerTick += amt;
|
||||
}
|
||||
|
||||
while( amt > 0 && !this.requesters.isEmpty() )
|
||||
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
||||
|
||||
while( amt > 0 && it.hasNext() )
|
||||
{
|
||||
final IAEPowerStorage node = it.next();
|
||||
amt = node.injectAEPower( amt, mode );
|
||||
|
||||
if( amt > 0 )
|
||||
{
|
||||
final IAEPowerStorage node = this.getFirstRequester();
|
||||
|
||||
amt = node.injectAEPower( amt, Actionable.MODULATE );
|
||||
if( amt > 0 )
|
||||
{
|
||||
this.requesters.remove( node );
|
||||
this.lastRequester = null;
|
||||
}
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +358,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getProviderEnergyDemand( final double maxRequired, final Set<IEnergyGridProvider> seen )
|
||||
public double getProviderEnergyDemand( final double maxRequired )
|
||||
{
|
||||
double required = 0;
|
||||
|
||||
@@ -381,53 +375,6 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
return required;
|
||||
}
|
||||
|
||||
private double simulateExtract( double extractedPower, final double amt )
|
||||
{
|
||||
final Iterator<IAEPowerStorage> it = this.providers.iterator();
|
||||
|
||||
while( extractedPower < amt && it.hasNext() )
|
||||
{
|
||||
final IAEPowerStorage node = it.next();
|
||||
|
||||
final double req = amt - extractedPower;
|
||||
final double newPower = node.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
}
|
||||
|
||||
return extractedPower;
|
||||
}
|
||||
|
||||
private double doExtract( double extractedPower, final double amt )
|
||||
{
|
||||
while( extractedPower < amt && !this.providers.isEmpty() )
|
||||
{
|
||||
final IAEPowerStorage node = this.getFirstProvider();
|
||||
|
||||
final double req = amt - extractedPower;
|
||||
final double newPower = node.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.ONE );
|
||||
extractedPower += newPower;
|
||||
|
||||
if( newPower < req )
|
||||
{
|
||||
this.providers.remove( node );
|
||||
this.lastProvider = null;
|
||||
}
|
||||
}
|
||||
|
||||
return extractedPower;
|
||||
}
|
||||
|
||||
private IAEPowerStorage getFirstProvider()
|
||||
{
|
||||
if( this.lastProvider == null )
|
||||
{
|
||||
final Iterator<IAEPowerStorage> i = this.providers.iterator();
|
||||
this.lastProvider = i.hasNext() ? i.next() : null;
|
||||
}
|
||||
|
||||
return this.lastProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAvgPowerUsage()
|
||||
{
|
||||
@@ -460,10 +407,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
final IEnergyGridProvider next = toVisit.poll();
|
||||
visited.add( next );
|
||||
|
||||
final double cannotHold = next.injectProviderPower( amt, Actionable.SIMULATE, visited );
|
||||
next.injectProviderPower( leftover - cannotHold, mode, visited );
|
||||
|
||||
leftover = cannotHold;
|
||||
leftover = next.injectProviderPower( leftover, mode );
|
||||
|
||||
for( IEnergyGridProvider iEnergyGridProvider : next.providers() )
|
||||
{
|
||||
@@ -477,17 +421,6 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
return leftover;
|
||||
}
|
||||
|
||||
private IAEPowerStorage getFirstRequester()
|
||||
{
|
||||
if( this.lastRequester == null )
|
||||
{
|
||||
final Iterator<IAEPowerStorage> i = this.requesters.iterator();
|
||||
this.lastRequester = i.hasNext() ? i.next() : null;
|
||||
}
|
||||
|
||||
return this.lastRequester;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStoredPower()
|
||||
{
|
||||
@@ -519,7 +452,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
final IEnergyGridProvider next = toVisit.poll();
|
||||
visited.add( next );
|
||||
|
||||
required += next.getProviderEnergyDemand( maxRequired - required, visited );
|
||||
required += next.getProviderEnergyDemand( maxRequired - required );
|
||||
|
||||
for( IEnergyGridProvider iEnergyGridProvider : next.providers() )
|
||||
{
|
||||
@@ -569,16 +502,6 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
this.globalAvailablePower -= ps.getAECurrentPower();
|
||||
}
|
||||
|
||||
if( this.lastProvider == machine )
|
||||
{
|
||||
this.lastProvider = null;
|
||||
}
|
||||
|
||||
if( this.lastRequester == machine )
|
||||
{
|
||||
this.lastRequester = null;
|
||||
}
|
||||
|
||||
this.providers.remove( ps );
|
||||
this.requesters.remove( ps );
|
||||
}
|
||||
@@ -653,14 +576,14 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
public void onSplit( final IGridStorage storageB )
|
||||
{
|
||||
final double newBuffer = this.localStorage.getAECurrentPower() / 2;
|
||||
this.localStorage.setAECurrentPower( newBuffer );
|
||||
this.localStorage.removeCurrentAEPower( newBuffer );
|
||||
storageB.dataObject().setDouble( "buffer", newBuffer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin( final IGridStorage storageB )
|
||||
{
|
||||
this.localStorage.addAECurrentPower( storageB.dataObject().getDouble( "buffer" ) );
|
||||
this.localStorage.addCurrentAEPower( storageB.dataObject().getDouble( "buffer" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -681,7 +604,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
|
||||
private class GridPowerStorage implements IAEPowerStorage
|
||||
{
|
||||
double stored = 0;
|
||||
private double stored = 0;
|
||||
|
||||
@Override
|
||||
public double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier )
|
||||
@@ -690,12 +613,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.stored -= extracted;
|
||||
|
||||
if( this.stored < MAX_BUFFER_STORAGE - 0.001 )
|
||||
{
|
||||
EnergyGridCache.this.myGrid.postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
|
||||
}
|
||||
this.removeCurrentAEPower( extracted );
|
||||
}
|
||||
|
||||
return extracted;
|
||||
@@ -714,12 +632,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.stored += toStore;
|
||||
|
||||
if( this.stored > 0.01 )
|
||||
{
|
||||
EnergyGridCache.this.myGrid.postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
|
||||
}
|
||||
this.addCurrentAEPower( toStore );
|
||||
}
|
||||
|
||||
return amt - toStore;
|
||||
@@ -743,14 +656,24 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
return this.stored;
|
||||
}
|
||||
|
||||
public void setAECurrentPower( double amount )
|
||||
{
|
||||
this.stored = amount;
|
||||
}
|
||||
|
||||
public void addAECurrentPower( double amount )
|
||||
private void addCurrentAEPower( double amount )
|
||||
{
|
||||
this.stored += amount;
|
||||
|
||||
if( this.stored > 0.01 )
|
||||
{
|
||||
EnergyGridCache.this.myGrid.postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void removeCurrentAEPower( double amount )
|
||||
{
|
||||
this.stored -= amount;
|
||||
|
||||
if( this.stored < MAX_BUFFER_STORAGE - 0.001 )
|
||||
{
|
||||
EnergyGridCache.this.myGrid.postEvent( new MENetworkPowerStorage( this, PowerEventType.REQUEST_POWER ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-9
@@ -34,10 +34,9 @@ import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.storage.IStackWatcher;
|
||||
import appeng.api.networking.storage.IStackWatcherHost;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
@@ -50,7 +49,9 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.helpers.BaseActionSource;
|
||||
import appeng.me.helpers.GenericInterestManager;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
import appeng.me.storage.ItemWatcher;
|
||||
import appeng.me.storage.NetworkInventoryHandler;
|
||||
|
||||
@@ -161,7 +162,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.inactiveCellProviders.remove( cc );
|
||||
this.activeCellProviders.add( cc );
|
||||
|
||||
BaseActionSource actionSrc = new BaseActionSource();
|
||||
IActionSource actionSrc = new BaseActionSource();
|
||||
if( cc instanceof IActionHost )
|
||||
{
|
||||
actionSrc = new MachineSource( (IActionHost) cc );
|
||||
@@ -188,7 +189,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
this.activeCellProviders.remove( cc );
|
||||
this.inactiveCellProviders.add( cc );
|
||||
|
||||
BaseActionSource actionSrc = new BaseActionSource();
|
||||
IActionSource actionSrc = new BaseActionSource();
|
||||
|
||||
if( cc instanceof IActionHost )
|
||||
{
|
||||
@@ -254,7 +255,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
tracker.applyChanges();
|
||||
}
|
||||
|
||||
private void postChangesToNetwork( final StorageChannel chan, final int upOrDown, final IItemList availableItems, final BaseActionSource src )
|
||||
private void postChangesToNetwork( final StorageChannel chan, final int upOrDown, final IItemList availableItems, final IActionSource src )
|
||||
{
|
||||
switch( chan )
|
||||
{
|
||||
@@ -317,7 +318,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postAlterationOfStoredItems( final StorageChannel chan, final Iterable<? extends IAEStack> input, final BaseActionSource src )
|
||||
public void postAlterationOfStoredItems( final StorageChannel chan, final Iterable<? extends IAEStack> input, final IActionSource src )
|
||||
{
|
||||
if( chan == StorageChannel.ITEMS )
|
||||
{
|
||||
@@ -371,9 +372,9 @@ public class GridStorageCache implements IStorageGrid
|
||||
final StorageChannel channel;
|
||||
final int up_or_down;
|
||||
final IItemList list;
|
||||
final BaseActionSource src;
|
||||
final IActionSource src;
|
||||
|
||||
public CellChangeTrackerRecord( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc )
|
||||
public CellChangeTrackerRecord( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final IActionSource actionSrc )
|
||||
{
|
||||
this.channel = channel;
|
||||
this.up_or_down = i;
|
||||
@@ -404,7 +405,7 @@ public class GridStorageCache implements IStorageGrid
|
||||
|
||||
final List<CellChangeTrackerRecord> data = new LinkedList<>();
|
||||
|
||||
public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc )
|
||||
public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final IActionSource actionSrc )
|
||||
{
|
||||
this.data.add( new CellChangeTrackerRecord( channel, i, h, actionSrc ) );
|
||||
}
|
||||
|
||||
+7
-7
@@ -36,7 +36,7 @@ import com.google.common.collect.Lists;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.events.MENetworkStorageEvent;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
@@ -86,7 +86,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public T extractItems( final T request, final Actionable mode, final BaseActionSource src )
|
||||
public T extractItems( final T request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
@@ -150,7 +150,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public T injectItems( final T input, final Actionable mode, final BaseActionSource src )
|
||||
public T injectItems( final T input, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
@@ -207,7 +207,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
return this.listeners.entrySet().iterator();
|
||||
}
|
||||
|
||||
private T monitorDifference( final IAEStack original, final T leftOvers, final boolean extraction, final BaseActionSource src )
|
||||
private T monitorDifference( final IAEStack original, final T leftOvers, final boolean extraction, final IActionSource src )
|
||||
{
|
||||
final T diff = (T) original.copy();
|
||||
|
||||
@@ -228,7 +228,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
return leftOvers;
|
||||
}
|
||||
|
||||
private void notifyListenersOfChange( final Iterable<T> diff, final BaseActionSource src )
|
||||
private void notifyListenersOfChange( final Iterable<T> diff, final IActionSource src )
|
||||
{
|
||||
this.hasChanged = true;
|
||||
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.getListeners();
|
||||
@@ -248,12 +248,12 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
|
||||
}
|
||||
}
|
||||
|
||||
private void postChangesToListeners( final Iterable<T> changes, final BaseActionSource src )
|
||||
private void postChangesToListeners( final Iterable<T> changes, final IActionSource src )
|
||||
{
|
||||
this.postChange( true, changes, src );
|
||||
}
|
||||
|
||||
protected void postChange( final boolean add, final Iterable<T> changes, final BaseActionSource src )
|
||||
protected void postChange( final boolean add, final Iterable<T> changes, final IActionSource src )
|
||||
{
|
||||
if( this.localDepthSemaphore > 0 || GLOBAL_DEPTH.contains( this ) )
|
||||
{
|
||||
|
||||
@@ -55,8 +55,7 @@ import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkCraftingCpuChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
@@ -73,6 +72,7 @@ import appeng.crafting.CraftingWatcher;
|
||||
import appeng.crafting.MECraftingInventory;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cluster.IAECluster;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.util.Platform;
|
||||
@@ -236,7 +236,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return false;
|
||||
}
|
||||
|
||||
public IAEStack injectItems( final IAEStack input, final Actionable type, final BaseActionSource src )
|
||||
public IAEStack injectItems( final IAEStack input, final Actionable type, final IActionSource src )
|
||||
{
|
||||
if( !( input instanceof IAEItemStack ) )
|
||||
{
|
||||
@@ -365,7 +365,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
return input;
|
||||
}
|
||||
|
||||
private void postChange( final IAEItemStack diff, final BaseActionSource src )
|
||||
private void postChange( final IAEItemStack diff, final IActionSource src )
|
||||
{
|
||||
final Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.getListeners();
|
||||
|
||||
@@ -469,7 +469,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (TileCraftingTile) this.machineSrc.via;
|
||||
return (TileCraftingTile) this.machineSrc.machine().get();
|
||||
}
|
||||
|
||||
private IGrid getGrid()
|
||||
@@ -504,7 +504,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( g.getStackSize() );
|
||||
final IAEItemStack ais = this.inventory.extractItems( fuzz, Actionable.SIMULATE, this.machineSrc );
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.getItemStack();
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
||||
|
||||
if( !is.isEmpty() && is.getCount() == g.getStackSize() )
|
||||
{
|
||||
@@ -526,7 +526,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
else
|
||||
{
|
||||
final IAEItemStack ais = this.inventory.extractItems( g.copy(), Actionable.SIMULATE, this.machineSrc );
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.getItemStack();
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
||||
|
||||
if( is.isEmpty() || is.getCount() < g.getStackSize() )
|
||||
{
|
||||
@@ -690,10 +690,10 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( input[x].getStackSize() );
|
||||
|
||||
if( details.isValidItemForSlot( x, fuzz.getItemStack(), this.getWorld() ) )
|
||||
if( details.isValidItemForSlot( x, fuzz.createItemStack(), this.getWorld() ) )
|
||||
{
|
||||
final IAEItemStack ais = this.inventory.extractItems( fuzz, Actionable.MODULATE, this.machineSrc );
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.getItemStack();
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
||||
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
@@ -708,7 +708,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
else
|
||||
{
|
||||
final IAEItemStack ais = this.inventory.extractItems( input[x].copy(), Actionable.MODULATE, this.machineSrc );
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.getItemStack();
|
||||
final ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
|
||||
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
@@ -844,7 +844,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public ICraftingLink submitJob( final IGrid g, final ICraftingJob job, final BaseActionSource src, final ICraftingRequester requestingMachine )
|
||||
public ICraftingLink submitJob( final IGrid g, final ICraftingJob job, final IActionSource src, final ICraftingRequester requestingMachine )
|
||||
{
|
||||
if( !this.tasks.isEmpty() || !this.waitingFor.isEmpty() )
|
||||
{
|
||||
@@ -935,7 +935,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseActionSource getActionSource()
|
||||
public IActionSource getActionSource()
|
||||
{
|
||||
return this.machineSrc;
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
if( pattern != null && pattern.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
final ICraftingPatternItem cpi = (ICraftingPatternItem) pattern.getItem();
|
||||
final ICraftingPatternDetails details = cpi.getPatternForItem( pattern.getItemStack(), this.getWorld() );
|
||||
final ICraftingPatternDetails details = cpi.getPatternForItem( pattern.createItemStack(), this.getWorld() );
|
||||
if( details != null )
|
||||
{
|
||||
final TaskProgress tp = new TaskProgress();
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.me.helpers;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
|
||||
|
||||
public class BaseActionSource implements IActionSource
|
||||
{
|
||||
|
||||
@Override
|
||||
public Optional<EntityPlayer> player()
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<IActionHost> machine()
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> context( Class<T> key )
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.me.helpers;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
|
||||
|
||||
public class MachineSource implements IActionSource
|
||||
{
|
||||
|
||||
private final IActionHost via;
|
||||
|
||||
public MachineSource( final IActionHost v )
|
||||
{
|
||||
this.via = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<EntityPlayer> player()
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<IActionHost> machine()
|
||||
{
|
||||
return Optional.of( this.via );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> context( Class<T> key )
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.me.helpers;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
|
||||
|
||||
public class PlayerSource implements IActionSource
|
||||
{
|
||||
|
||||
private final EntityPlayer player;
|
||||
private final IActionHost via;
|
||||
|
||||
public PlayerSource( final EntityPlayer p, final IActionHost v )
|
||||
{
|
||||
Preconditions.checkNotNull( p );
|
||||
this.player = p;
|
||||
this.via = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<EntityPlayer> player()
|
||||
{
|
||||
return Optional.of( this.player );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<IActionHost> machine()
|
||||
{
|
||||
return Optional.ofNullable( this.via );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> context( Class<T> key )
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import java.util.HashSet;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -33,7 +32,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
@@ -202,7 +201,7 @@ public class CellInventory implements ICellInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( input == null )
|
||||
{
|
||||
@@ -218,7 +217,7 @@ public class CellInventory implements ICellInventory
|
||||
return input;
|
||||
}
|
||||
|
||||
final ItemStack sharedItemStack = input.getItemStack();
|
||||
final ItemStack sharedItemStack = input.createItemStack();
|
||||
|
||||
if( CellInventory.isStorageCell( sharedItemStack ) )
|
||||
{
|
||||
@@ -269,11 +268,11 @@ public class CellInventory implements ICellInventory
|
||||
{
|
||||
if( input.getStackSize() > remainingItemCount )
|
||||
{
|
||||
final ItemStack toReturn = Platform.cloneItemStack( sharedItemStack );
|
||||
final ItemStack toReturn = sharedItemStack.copy();
|
||||
toReturn.setCount( sharedItemStack.getCount() - remainingItemCount );
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
final ItemStack toWrite = Platform.cloneItemStack( sharedItemStack );
|
||||
final ItemStack toWrite = sharedItemStack.copy();
|
||||
toWrite.setCount( remainingItemCount );
|
||||
|
||||
this.cellItems.add( AEItemStack.create( toWrite ) );
|
||||
@@ -299,7 +298,7 @@ public class CellInventory implements ICellInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
if( request == null )
|
||||
{
|
||||
@@ -368,22 +367,10 @@ public class CellInventory implements ICellInventory
|
||||
{
|
||||
itemCount += v.getStackSize();
|
||||
|
||||
final NBTBase c = this.tagCompound.getTag( itemSlots[x] );
|
||||
if( c instanceof NBTTagCompound )
|
||||
{
|
||||
v.writeToNBT( (NBTTagCompound) c );
|
||||
}
|
||||
else
|
||||
{
|
||||
final NBTTagCompound g = new NBTTagCompound();
|
||||
v.writeToNBT( g );
|
||||
this.tagCompound.setTag( itemSlots[x], g );
|
||||
}
|
||||
final NBTTagCompound g = new NBTTagCompound();
|
||||
v.writeToNBT( g );
|
||||
this.tagCompound.setTag( itemSlots[x], g );
|
||||
|
||||
/*
|
||||
* NBTBase tagSlotCount = tagCompound.getTag( itemSlotCount[x] ); if ( tagSlotCount instanceof
|
||||
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
|
||||
*/
|
||||
this.tagCompound.setInteger( itemSlotCount[x], (int) v.getStackSize() );
|
||||
|
||||
x++;
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -58,7 +58,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
final IAEItemStack local = this.itemListCache.findPrecise( input );
|
||||
if( local == null )
|
||||
@@ -70,7 +70,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
|
||||
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final IActionSource src )
|
||||
{
|
||||
final IAEItemStack local = this.itemListCache.findPrecise( request );
|
||||
if( local == null )
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user