Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 483049f555 | |||
| a7a65ae39d | |||
| 45878df17d | |||
| 98142d8ade | |||
| 7956872d1d | |||
| e243c8e9a2 | |||
| 641d0d40cc | |||
| 50fad685b6 | |||
| 1ad49edd76 | |||
| 7ceaa4cc3e | |||
| b70c86542b | |||
| c1197c0084 | |||
| f0d807f0a2 | |||
| 5fa2c0ab27 | |||
| 3063bd887c | |||
| fac4a8f9dc | |||
| 9d8226da19 | |||
| 33754d289d | |||
| 959672dae3 | |||
| 90c17c09a8 |
@@ -14,6 +14,7 @@
|
||||
* [Building](#building)
|
||||
* [Contribution](#contribution)
|
||||
* [API](#applied-energistics-2-api)
|
||||
* [CraftTweaker](#applied-energistics-2-crafttweaker)
|
||||
* [Localization](#applied-energistics-2-localization)
|
||||
* [Credits](#credits)
|
||||
|
||||
@@ -154,6 +155,57 @@ Where the __ are filled in with the correct version criteria; AE2 is available f
|
||||
|
||||
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
|
||||
|
||||
## Applied Energistics 2 CraftTweaker
|
||||
|
||||
### Inscriber
|
||||
Add a recipe. When `inscribe` is true the bottom and top inputs are not consumed.
|
||||
|
||||
mods.appliedenergistics2.Inscriber.addRecipe(ItemStack output, ItemStack input, boolean inscribe,
|
||||
@Optional ItemStack topInput, @Optional ItemStack bottomInput );
|
||||
|
||||
Remove all recipes for this output stack.
|
||||
|
||||
mods.appliedenergistics2.Inscriber.removeRecipe(ItemStack output);
|
||||
|
||||
### Grindstone
|
||||
Add a recipe.
|
||||
|
||||
mods.appliedenergistics2.Grinder.addRecipe( ItemStack output, ItemStack input, int turns,
|
||||
@Optional ItemStack secondary1Output, @Optional float secondary1Chance,
|
||||
@Optional ItemStack secondary2Output, @Optional float secondary2Chance);
|
||||
|
||||
Remove recipes for this input.
|
||||
|
||||
mods.appliedenergistics2.Grinder.removeRecipe(ItemStack input);
|
||||
|
||||
### Spatial
|
||||
Whitelist a TileEntity class for Spatial IO.
|
||||
|
||||
mods.appliedenergistics2.Spatial.whitelistEntity( String fullEntityClassName );
|
||||
|
||||
### Attunement
|
||||
Attune a ItemStack or ModID to a specific P2P-Tunnel type. ModID's are used as fallback when no ItemStack was found.
|
||||
|
||||
mods.appliedenergistics2.Attunement.attuneME( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneME( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneItem( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneItem( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneFluid( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneFluid( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneRedstone( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneRedstone( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneRF( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneRF( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneIC2( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneIC2( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneLight( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneLight( String modID );
|
||||
|
||||
### Cannon
|
||||
Add ammo types for the matter cannon.
|
||||
|
||||
mods.appliedenergistics2.Cannon.registerAmmo( ItemStack itemStack, double weight );
|
||||
|
||||
## Applied Energistics 2 Localization
|
||||
|
||||
### English Text
|
||||
|
||||
+2
-1
@@ -9,7 +9,7 @@ aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
minecraft_version=1.12.2
|
||||
mcp_mappings=snapshot_20171003
|
||||
forge_version=14.23.0.2491
|
||||
forge_version=14.23.1.2554
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
@@ -24,6 +24,7 @@ tesla_version=1.0.61
|
||||
ic2_version=2.8.19-ex112
|
||||
top_version=1.12-1.4.18-10
|
||||
cofhcore_version=1.12-4.+
|
||||
crafttweaker_version=4.0.10.310
|
||||
|
||||
#########################################################
|
||||
# Deployment #
|
||||
|
||||
@@ -58,6 +58,11 @@ repositories {
|
||||
name 'tehnut'
|
||||
url "http://tehnut.info/maven"
|
||||
}
|
||||
|
||||
maven { // CraftTweaker
|
||||
name 'jared maven'
|
||||
url "http://maven.blamejared.com/"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -77,6 +82,7 @@ dependencies {
|
||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||
|
||||
// at runtime, use the full JEI jar
|
||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
|
||||
@@ -28,6 +28,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
import appeng.api.config.TunnelType;
|
||||
|
||||
@@ -47,6 +48,7 @@ public interface IP2PTunnelRegistry
|
||||
*/
|
||||
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
||||
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
|
||||
void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type );
|
||||
|
||||
/**
|
||||
* returns null if no attunement can be found.
|
||||
|
||||
@@ -48,6 +48,7 @@ public interface IRecipeHandlerRegistry
|
||||
* @param name name of crafthandler
|
||||
* @param handler class of crafthandler
|
||||
*/
|
||||
@Deprecated
|
||||
void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler );
|
||||
|
||||
/**
|
||||
@@ -65,11 +66,13 @@ public interface IRecipeHandlerRegistry
|
||||
* @return A recipe handler by name, returns null on failure.
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
ICraftHandler getCraftHandlerFor( String name );
|
||||
|
||||
/**
|
||||
* @return a new recipe handler, which can be used to parse, and read recipe files.
|
||||
*/
|
||||
@Deprecated
|
||||
IRecipeHandler createNewRecipehandler();
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RecipeException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface ICraftHandler
|
||||
{
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface IIngredient
|
||||
{
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ package appeng.api.recipes;
|
||||
/**
|
||||
* Represents the AE2 Recipe Loading/Reading Class
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IRecipeHandler
|
||||
{
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.BufferedReader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface IRecipeLoader
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,19 @@ import appeng.api.storage.data.IItemList;
|
||||
public interface IStorageChannel<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
* Can be used as factor for transferring stacks of a channel.
|
||||
*
|
||||
* E.g. used by IO Ports to transfer 1000 mB, not 1 mB to match the
|
||||
* item channel transferring a full bucket per operation.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default int transferFactor()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link IItemList} of the specific type.
|
||||
*
|
||||
|
||||
@@ -92,7 +92,7 @@ public class GuiSpatialIOPort extends AEBaseGui
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSSInvalid.getLocal(), 13, 93, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,28 +120,23 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
|
||||
if( s == this.middle )
|
||||
{
|
||||
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
IItemDefinition press = AEApi.instance().definitions().materials().namePress();
|
||||
if( press.isSameAs( top ) || press.isSameAs( bot ) )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( optional, is ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return !press.isSameAs( is );
|
||||
}
|
||||
|
||||
boolean matches = false;
|
||||
boolean found = false;
|
||||
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( ( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||
|
||||
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
||||
( ( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
||||
final boolean matchA = !top
|
||||
.isEmpty() && ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) || Platform
|
||||
.itemComparisons()
|
||||
.isSameItem( top, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
final boolean matchB = !bot
|
||||
.isEmpty() && ( Platform.itemComparisons().isSameItem( bot, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) || Platform
|
||||
.itemComparisons()
|
||||
.isSameItem( bot, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||
|
||||
if( matchA || matchB )
|
||||
{
|
||||
@@ -150,21 +145,19 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( is, option ) )
|
||||
{
|
||||
found = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( matches && !found )
|
||||
if( matches )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( ( s == this.top && !bot.isEmpty() ) || ( s == this.bottom && !top.isEmpty() ) )
|
||||
else if( ( s == this.top && !bot.isEmpty() ) || ( s == this.bottom && !top.isEmpty() ) )
|
||||
{
|
||||
ItemStack otherSlot = ItemStack.EMPTY;
|
||||
ItemStack otherSlot;
|
||||
if( s == this.top )
|
||||
{
|
||||
otherSlot = this.bottom.getStack();
|
||||
@@ -182,28 +175,24 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
}
|
||||
|
||||
// everything else
|
||||
boolean isValid = false;
|
||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( recipe.getTopOptional().orElse( ItemStack.EMPTY ), otherSlot ) )
|
||||
boolean isValid = false;
|
||||
if( Platform.itemComparisons().isSameItem( otherSlot, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) )
|
||||
{
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) );
|
||||
}
|
||||
else if( Platform.itemComparisons().isSameItem( recipe.getBottomOptional().orElse( ItemStack.EMPTY ), otherSlot ) )
|
||||
else if( Platform.itemComparisons().isSameItem( otherSlot, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) )
|
||||
{
|
||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( ItemStack.EMPTY ) );
|
||||
}
|
||||
|
||||
if( isValid )
|
||||
{
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !isValid )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -172,7 +172,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
|
||||
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( optional, i ) )
|
||||
if( Platform.itemComparisons().isSameItem( i, optional ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,6 +189,8 @@ public final class AppEng
|
||||
AppEng.proxy.preinit();
|
||||
}
|
||||
|
||||
IntegrationRegistry.INSTANCE.preInit();
|
||||
|
||||
if( versionCheckerConfig.isVersionCheckingEnabled() )
|
||||
{
|
||||
final VersionChecker versionChecker = new VersionChecker( versionCheckerConfig );
|
||||
|
||||
@@ -160,6 +160,12 @@ public class ApiStorage implements IStorageHelper
|
||||
private static final class FluidStorageChannel implements IFluidStorageChannel
|
||||
{
|
||||
|
||||
@Override
|
||||
public int transferFactor()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> createList()
|
||||
{
|
||||
@@ -195,7 +201,7 @@ public class ApiStorage implements IStorageHelper
|
||||
Preconditions.checkNotNull( request );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return null;
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,7 +212,7 @@ public class ApiStorage implements IStorageHelper
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return input;
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,10 +106,12 @@ import appeng.core.features.BlockDefinition;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockCubeGenerator;
|
||||
import appeng.debug.BlockEnergyGenerator;
|
||||
import appeng.debug.BlockItemGen;
|
||||
import appeng.debug.BlockPhantomNode;
|
||||
import appeng.debug.TileChunkLoader;
|
||||
import appeng.debug.TileCubeGenerator;
|
||||
import appeng.debug.TileEnergyGenerator;
|
||||
import appeng.debug.TileItemGen;
|
||||
import appeng.debug.TilePhantomNode;
|
||||
import appeng.decorative.slab.BlockSlabCommon;
|
||||
@@ -236,6 +238,7 @@ public final class ApiBlocks implements IBlocks
|
||||
private final IBlockDefinition chunkLoader;
|
||||
private final IBlockDefinition phantomNode;
|
||||
private final IBlockDefinition cubeGenerator;
|
||||
private final IBlockDefinition energyGenerator;
|
||||
|
||||
public ApiBlocks( FeatureFactory registry, PartModels partModels )
|
||||
{
|
||||
@@ -526,6 +529,11 @@ public final class ApiBlocks implements IBlocks
|
||||
.tileEntity( new TileEntityDefinition( TileCubeGenerator.class ) )
|
||||
.useCustomItemModel()
|
||||
.build();
|
||||
this.energyGenerator = registry.block( "debug_energy_gen", BlockEnergyGenerator::new )
|
||||
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
.tileEntity( new TileEntityDefinition( TileEnergyGenerator.class ) )
|
||||
.useCustomItemModel()
|
||||
.build();
|
||||
}
|
||||
|
||||
private static IBlockDefinition makeSlab( String slabId, String doubleSlabId, FeatureFactory registry, IBlockDefinition blockDef )
|
||||
@@ -1014,4 +1022,9 @@ public final class ApiBlocks implements IBlocks
|
||||
{
|
||||
return this.cubeGenerator;
|
||||
}
|
||||
|
||||
public IBlockDefinition energyGenerator()
|
||||
{
|
||||
return energyGenerator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.core.features.registries;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -30,6 +31,8 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -49,6 +52,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
|
||||
private final Map<ItemStack, TunnelType> tunnels = new HashMap<>( INITIAL_CAPACITY );
|
||||
private final Map<String, TunnelType> modIdTunnels = new HashMap<>( INITIAL_CAPACITY );
|
||||
private final Map<Capability<?>, TunnelType> capTunnels = new HashMap<>( INITIAL_CAPACITY );
|
||||
|
||||
public void configure()
|
||||
{
|
||||
@@ -159,6 +163,12 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
this.addNewAttunement( parts.cableDenseSmart().stack( c, 1 ), TunnelType.ME );
|
||||
}
|
||||
|
||||
/**
|
||||
* attune based caps
|
||||
*/
|
||||
this.addNewAttunement( Capabilities.FORGE_ENERGY, TunnelType.FE_POWER );
|
||||
this.addNewAttunement( CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, TunnelType.FLUID );
|
||||
|
||||
/**
|
||||
* attune based on the ItemStack's modId
|
||||
*/
|
||||
@@ -186,6 +196,16 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
this.modIdTunnels.put( modId, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewAttunement( @Nonnull final Capability<?> cap, @Nullable final TunnelType type )
|
||||
{
|
||||
if( type == null || cap == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.capTunnels.put( cap, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewAttunement( @Nonnull final ItemStack trigger, @Nullable final TunnelType type )
|
||||
{
|
||||
@@ -203,39 +223,40 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
{
|
||||
if( !trigger.isEmpty() )
|
||||
{
|
||||
// if( FluidRegistry.isContainer( trigger ) )
|
||||
// {
|
||||
// return TunnelType.FLUID;
|
||||
// }
|
||||
|
||||
for( final ItemStack is : this.tunnels.keySet() )
|
||||
// First match exact items
|
||||
for( final Entry<ItemStack, TunnelType> entry : this.tunnels.entrySet() )
|
||||
{
|
||||
final ItemStack is = entry.getKey();
|
||||
|
||||
if( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
|
||||
{
|
||||
return this.tunnels.get( is );
|
||||
return entry.getValue();
|
||||
}
|
||||
|
||||
if( ItemStack.areItemsEqual( is, trigger ) )
|
||||
{
|
||||
return this.tunnels.get( is );
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
// Try by ModId next
|
||||
for( final String modId : this.modIdTunnels.keySet() )
|
||||
{
|
||||
if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals( modId ) )
|
||||
{
|
||||
return this.modIdTunnels.get( modId );
|
||||
}
|
||||
}
|
||||
|
||||
// Next, check if the Item you're holding supports Forge Energy
|
||||
// Next, check if the Item you're holding supports any registered capability
|
||||
for( EnumFacing face : EnumFacing.VALUES )
|
||||
{
|
||||
if( trigger.hasCapability( Capabilities.FORGE_ENERGY, face ) )
|
||||
for( Entry<Capability<?>, TunnelType> entry : this.capTunnels.entrySet() )
|
||||
{
|
||||
return TunnelType.FE_POWER;
|
||||
if( trigger.hasCapability( entry.getKey(), face ) )
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Use the mod id as last option.
|
||||
for( final Entry<String, TunnelType> entry : this.modIdTunnels.entrySet() )
|
||||
{
|
||||
if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals( entry.getKey() ) )
|
||||
{
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public enum GuiText
|
||||
RequiredPower,
|
||||
Efficiency,
|
||||
SCSSize,
|
||||
SCSSInvalid,
|
||||
SCSInvalid,
|
||||
InWorldCrafting,
|
||||
|
||||
inWorldFluix,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
|
||||
public class BlockEnergyGenerator extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
public BlockEnergyGenerator()
|
||||
{
|
||||
super( Material.IRON );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.math.IntMath;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class TileEnergyGenerator extends AEBaseTile implements ITickable, IEnergyStorage
|
||||
{
|
||||
/**
|
||||
* The base energy injected each tick.
|
||||
* Adjacent TileEnergyGenerators will increase it to pow(base, #generators).
|
||||
*/
|
||||
private static final int BASE_ENERGY = 8;
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
int tier = 1;
|
||||
final EnumSet<EnumFacing> validEnergyReceivers = EnumSet.noneOf( EnumFacing.class );
|
||||
|
||||
for( EnumFacing facing : EnumFacing.values() )
|
||||
{
|
||||
final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) );
|
||||
|
||||
if( te instanceof TileEnergyGenerator )
|
||||
{
|
||||
tier++;
|
||||
}
|
||||
|
||||
if( te != null && te.hasCapability( CapabilityEnergy.ENERGY, facing.getOpposite() ) )
|
||||
{
|
||||
validEnergyReceivers.add( facing );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final int energyToInsert = IntMath.pow( BASE_ENERGY, tier );
|
||||
|
||||
for( EnumFacing facing : validEnergyReceivers )
|
||||
{
|
||||
final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) );
|
||||
final IEnergyStorage cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() );
|
||||
|
||||
if( cap.canReceive() )
|
||||
{
|
||||
|
||||
cap.receiveEnergy( energyToInsert, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
|
||||
{
|
||||
if( capability == CapabilityEnergy.ENERGY )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability( capability, facing );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getCapability( Capability<T> capability, @Nullable EnumFacing facing )
|
||||
{
|
||||
if( capability == CapabilityEnergy.ENERGY )
|
||||
{
|
||||
return (T) this;
|
||||
}
|
||||
return super.getCapability( capability, facing );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy( int maxReceive, boolean simulate )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy( int maxExtract, boolean simulate )
|
||||
{
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtract()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -136,19 +138,20 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
return;
|
||||
}
|
||||
|
||||
for( final Object e : this.world.getEntitiesWithinAABBExcludingEntity( this,
|
||||
new AxisAlignedBB( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 ) ) )
|
||||
final Explosion ex = new Explosion( this.world, this, this.posX, this.posY, this.posZ, 0.2f, false, false );
|
||||
final AxisAlignedBB area = new AxisAlignedBB( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 );
|
||||
final List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity( this, area );
|
||||
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate( this.world, ex, list, 0.2f * 2d );
|
||||
|
||||
for( final Entity e : list )
|
||||
{
|
||||
if( e instanceof Entity )
|
||||
{
|
||||
( (Entity) e ).attackEntityFrom( DamageSource.causeExplosionDamage( (Explosion) null ), 6 );
|
||||
}
|
||||
e.attackEntityFrom( DamageSource.causeExplosionDamage( ex ), 6 );
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.TINY_TNT_BLOCK_DAMAGE ) )
|
||||
{
|
||||
this.posY -= 0.25;
|
||||
final Explosion ex = new Explosion( this.world, this, this.posX, this.posY, this.posZ, 0.2f, false, false );
|
||||
|
||||
for( int x = (int) ( this.posX - 2 ); x <= this.posX + 2; x++ )
|
||||
{
|
||||
@@ -159,6 +162,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
final BlockPos point = new BlockPos( x, y, z );
|
||||
final IBlockState state = this.world.getBlockState( point );
|
||||
final Block block = state.getBlock();
|
||||
|
||||
if( block != null && !block.isAir( state, this.world, point ) )
|
||||
{
|
||||
float strength = (float) ( 2.3f - ( ( ( x + 0.5f ) - this.posX ) * ( ( x + 0.5f ) - this.posX ) + ( ( y + 0.5f ) - this.posY ) * ( ( y + 0.5f ) - this.posY ) + ( ( z + 0.5f ) - this.posZ ) * ( ( z + 0.5f ) - this.posZ ) ) );
|
||||
|
||||
@@ -47,13 +47,16 @@ public enum IntegrationRegistry
|
||||
this.modules.add( new IntegrationNode( type.dspName, type.modID, type ) );
|
||||
}
|
||||
|
||||
public void init()
|
||||
public void preInit()
|
||||
{
|
||||
for( final IntegrationNode node : this.modules )
|
||||
{
|
||||
node.call( IntegrationStage.PRE_INIT );
|
||||
}
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( final IntegrationNode node : this.modules )
|
||||
{
|
||||
node.call( IntegrationStage.INIT );
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.integration;
|
||||
|
||||
|
||||
import appeng.integration.modules.crafttweaker.CTModule;
|
||||
import appeng.integration.modules.ic2.IC2Module;
|
||||
import appeng.integration.modules.jei.JEIModule;
|
||||
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
|
||||
@@ -73,7 +74,16 @@ public enum IntegrationType
|
||||
}
|
||||
},
|
||||
|
||||
TESLA( IntegrationSide.BOTH, "Tesla", "tesla" );
|
||||
TESLA( IntegrationSide.BOTH, "Tesla", "tesla" ),
|
||||
|
||||
CRAFTTWEAKER( IntegrationSide.BOTH, "CraftTweaker", "crafttweaker" )
|
||||
{
|
||||
@Override
|
||||
public IIntegrationModule createInstance()
|
||||
{
|
||||
return new CTModule();
|
||||
}
|
||||
};
|
||||
|
||||
public final IntegrationSide side;
|
||||
public final String dspName;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
|
||||
public interface ICraftTweaker extends IIntegrationModule
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.crafttweaker;
|
||||
|
||||
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
|
||||
|
||||
@ZenClass( "mods.appliedenergistics2.Attunement" )
|
||||
public class AttunementRegistry
|
||||
{
|
||||
private AttunementRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneME( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.ME );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneME( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.ME );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneItem( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.ITEM );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneItem( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.ITEM );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneFluid( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.FLUID );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneFluid( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.FLUID );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneRedstone( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.REDSTONE );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneRedstone( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.REDSTONE );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneRF( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.FE_POWER );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneRF( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.FE_POWER );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneIC2( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.IC2_POWER );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneIC2( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.IC2_POWER );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneLight( IIngredient itemStack )
|
||||
{
|
||||
attune( itemStack, TunnelType.LIGHT );
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void attuneLight( String modId )
|
||||
{
|
||||
attune( modId, TunnelType.LIGHT );
|
||||
}
|
||||
|
||||
private static void attune( IIngredient itemStack, TunnelType type )
|
||||
{
|
||||
IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
|
||||
CTModule.toStacks( itemStack ).ifPresent( c -> c.forEach( i -> registry.addNewAttunement( i, type ) ) );
|
||||
}
|
||||
|
||||
private static void attune( String modid, TunnelType type )
|
||||
{
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( modid, type );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.crafttweaker;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import crafttweaker.CraftTweakerAPI;
|
||||
import crafttweaker.IAction;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
|
||||
import appeng.integration.abstraction.ICraftTweaker;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class CTModule implements ICraftTweaker
|
||||
{
|
||||
static final List<IAction> MODIFICATIONS = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
CraftTweakerAPI.registerClass( GrinderRecipes.class );
|
||||
CraftTweakerAPI.registerClass( InscriberRecipes.class );
|
||||
CraftTweakerAPI.registerClass( SpatialRegistry.class );
|
||||
CraftTweakerAPI.registerClass( AttunementRegistry.class );
|
||||
CraftTweakerAPI.registerClass( CannonRegistry.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
MODIFICATIONS.forEach( CraftTweakerAPI::apply );
|
||||
}
|
||||
|
||||
public static ItemStack toStack( IItemStack iStack )
|
||||
{
|
||||
if( iStack == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (ItemStack) iStack.getInternal();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ItemStack> toStackExpand( IItemStack iStack )
|
||||
{
|
||||
if( iStack == null )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack is = (ItemStack) iStack.getInternal();
|
||||
if( !is.isItemStackDamageable() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
|
||||
{
|
||||
NonNullList<ItemStack> ret = NonNullList.create();
|
||||
is.getItem().getSubItems( CreativeTabs.SEARCH, ret );
|
||||
return ret.stream().map( i -> new ItemStack( i.getItem(), iStack.getAmount(), i.getItemDamage() ) ).collect( Collectors.toList() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Collections.singletonList( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Optional<Collection<ItemStack>> toStacks( IIngredient ingredient )
|
||||
{
|
||||
if( ingredient == null )
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
Set<ItemStack> ret = new TreeSet<>( CTModule::compareItemStacks );
|
||||
ingredient.getItems().stream().map( CTModule::toStackExpand ).forEach( ret::addAll );
|
||||
if( ret.isEmpty() )
|
||||
{
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of( ret );
|
||||
}
|
||||
|
||||
private static int compareItemStacks( ItemStack a, ItemStack b )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( a, b ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( a == null )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if( b == null )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return System.identityHashCode( a ) - System.identityHashCode( b );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.crafttweaker;
|
||||
|
||||
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
|
||||
|
||||
@ZenClass( "mods.appliedenergistics2.Cannon" )
|
||||
public class CannonRegistry
|
||||
{
|
||||
private CannonRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void registerAmmo( IIngredient itemStack, double weight )
|
||||
{
|
||||
IMatterCannonAmmoRegistry registry = AEApi.instance().registries().matterCannon();
|
||||
CTModule.toStacks( itemStack ).ifPresent( c -> c.forEach( i -> registry.registerAmmo( i, weight ) ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.crafttweaker;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import crafttweaker.IAction;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
|
||||
|
||||
@ZenClass( "mods.appliedenergistics2.Grinder" )
|
||||
public class GrinderRecipes
|
||||
{
|
||||
private GrinderRecipes()
|
||||
{
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe( IItemStack output, IIngredient input, int turns, @stanhebben.zenscript.annotations.Optional IItemStack secondary1Output, @stanhebben.zenscript.annotations.Optional Float secondary1Chance, @stanhebben.zenscript.annotations.Optional IItemStack secondary2Output, @stanhebben.zenscript.annotations.Optional Float secondary2Chance )
|
||||
{
|
||||
Collection<ItemStack> inStacks = CTModule.toStacks( input ).orElse( Collections.emptySet() );
|
||||
|
||||
for( ItemStack inStack : inStacks )
|
||||
{
|
||||
IGrinderRecipeBuilder builder = AEApi.instance().registries().grinder().builder();
|
||||
builder.withInput( inStack )
|
||||
.withOutput( CTModule.toStack( output ) )
|
||||
.withTurns( turns );
|
||||
|
||||
final ItemStack s1 = CTModule.toStack( secondary1Output );
|
||||
if( !s1.isEmpty() )
|
||||
{
|
||||
builder.withFirstOptional( s1, secondary1Chance == null ? 1.0f : secondary1Chance );
|
||||
}
|
||||
final ItemStack s2 = CTModule.toStack( secondary2Output );
|
||||
if( !s2.isEmpty() )
|
||||
{
|
||||
builder.withFirstOptional( s2, secondary2Chance == null ? 1.0f : secondary2Chance );
|
||||
}
|
||||
CTModule.MODIFICATIONS.add( new Add( builder.build() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe( IIngredient input )
|
||||
{
|
||||
for( ItemStack inStack : CTModule.toStacks( input ).orElse( Collections.emptySet() ) )
|
||||
{
|
||||
CTModule.MODIFICATIONS.add( new Remove( inStack ) );
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add implements IAction
|
||||
{
|
||||
private final IGrinderRecipe entry;
|
||||
|
||||
private Add( IGrinderRecipe entry )
|
||||
{
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
AEApi.instance().registries().grinder().addRecipe( entry );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding Grinder Entry for " + entry.getInput().getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove implements IAction
|
||||
{
|
||||
private final ItemStack stack;
|
||||
|
||||
private Remove( ItemStack stack )
|
||||
{
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
IGrinderRecipe recipe = AEApi.instance().registries().grinder().getRecipeForInput( stack );
|
||||
if( recipe != null )
|
||||
{
|
||||
AEApi.instance().registries().grinder().removeRecipe( recipe );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing Grinder Entry for " + stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.crafttweaker;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import crafttweaker.IAction;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.IInscriberRecipeBuilder;
|
||||
import appeng.api.features.IInscriberRegistry;
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
|
||||
|
||||
@ZenClass( "mods.appliedenergistics2.Inscriber" )
|
||||
public class InscriberRecipes
|
||||
{
|
||||
private InscriberRecipes()
|
||||
{
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe( IItemStack output, IIngredient input, boolean inscribe, @stanhebben.zenscript.annotations.Optional IIngredient top, @stanhebben.zenscript.annotations.Optional IIngredient bottom )
|
||||
{
|
||||
Optional<Collection<ItemStack>> inStacks = CTModule.toStacks( input );
|
||||
if( !inStacks.isPresent() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<ItemStack> topList = CTModule.toStacks( top ).orElse( Collections.singleton( ItemStack.EMPTY ) );
|
||||
Collection<ItemStack> bottomList = CTModule.toStacks( bottom ).orElse( Collections.singleton( ItemStack.EMPTY ) );
|
||||
|
||||
for( ItemStack topStack : topList )
|
||||
{
|
||||
for( ItemStack bottomStack : bottomList )
|
||||
{
|
||||
final IInscriberRecipeBuilder builder = AEApi.instance().registries().inscriber().builder();
|
||||
builder.withProcessType( inscribe ? InscriberProcessType.INSCRIBE : InscriberProcessType.PRESS )
|
||||
.withOutput( CTModule.toStack( output ) )
|
||||
.withInputs( inStacks.get() );
|
||||
|
||||
if( !topStack.isEmpty() )
|
||||
{
|
||||
builder.withTopOptional( topStack );
|
||||
}
|
||||
if( !bottomStack.isEmpty() )
|
||||
{
|
||||
builder.withBottomOptional( bottomStack );
|
||||
}
|
||||
CTModule.MODIFICATIONS.add( new Add( builder.build() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe( IItemStack output )
|
||||
{
|
||||
CTModule.MODIFICATIONS.add( new Remove( (ItemStack) output.getInternal() ) );
|
||||
}
|
||||
|
||||
private static class Add implements IAction
|
||||
{
|
||||
private final IInscriberRecipe entry;
|
||||
|
||||
private Add( IInscriberRecipe entry )
|
||||
{
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
AEApi.instance().registries().inscriber().addRecipe( entry );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding Inscriber Entry for " + entry.getOutput().getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove implements IAction
|
||||
{
|
||||
private final ItemStack stack;
|
||||
|
||||
private Remove( ItemStack stack )
|
||||
{
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
final IInscriberRegistry inscriber = AEApi.instance().registries().inscriber();
|
||||
inscriber.getRecipes()
|
||||
.stream()
|
||||
.filter( r -> r.getOutput().isItemEqual( this.stack ) )
|
||||
.collect( Collectors.toList() )
|
||||
.forEach( inscriber::removeRecipe );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing Inscriber Entry for " + stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.crafttweaker;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AELog;
|
||||
|
||||
|
||||
@ZenClass( "mods.appliedenergistics2.Spatial" )
|
||||
public class SpatialRegistry
|
||||
{
|
||||
private SpatialRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void whitelistEntity( String entityClassName )
|
||||
{
|
||||
Class<? extends TileEntity> entityClass = loadClass( entityClassName );
|
||||
if( entityClass != null )
|
||||
{
|
||||
AEApi.instance().registries().movable().whiteListTileEntity( entityClass );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private static Class<? extends TileEntity> loadClass( String className )
|
||||
{
|
||||
try
|
||||
{
|
||||
return (Class<? extends TileEntity>) Class.forName( className );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.warn( e, "Failed to load TileEntity class '" + className + "'" );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -211,6 +211,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
public ItemStack getOutput( final ItemStack item )
|
||||
{
|
||||
ItemStack out = SIMPLE_CACHE.get( item );
|
||||
|
||||
if( out != null )
|
||||
{
|
||||
return out;
|
||||
@@ -224,12 +225,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
final ICraftingPatternDetails details = this.getPatternForItem( item, w );
|
||||
|
||||
if( details == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
out = details != null ? details.getOutputs()[0].createItemStack() : ItemStack.EMPTY;
|
||||
|
||||
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].createItemStack() );
|
||||
SIMPLE_CACHE.put( item, out );
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,13 +219,11 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
// IToolHammer - end
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
final IAEItemStack firstItem = itemList.getFirstItem();
|
||||
if( firstItem != null )
|
||||
{
|
||||
newColor = firstItem.createItemStack();
|
||||
newColor = firstItem.asItemStackRepresentation();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -324,7 +324,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
list.addFirst( list.removeLast() );
|
||||
}
|
||||
|
||||
return list.get( 0 ).createItemStack();
|
||||
return list.get( 0 ).asItemStackRepresentation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,14 +103,13 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolHamm
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
|
||||
// IToolHammer - end
|
||||
|
||||
// TODO: BC Wrench Integration
|
||||
|
||||
+9
-5
@@ -336,10 +336,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
@Override
|
||||
public double injectProviderPower( double amt, final Actionable mode )
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.tickInjectionPerTick += amt;
|
||||
}
|
||||
final double originalAmount = amt;
|
||||
|
||||
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
||||
|
||||
@@ -354,7 +351,14 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
}
|
||||
}
|
||||
|
||||
return Math.max( 0.0, amt );
|
||||
final double overflow = Math.max( 0.0, amt );
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.tickInjectionPerTick += originalAmount - overflow;
|
||||
}
|
||||
|
||||
return overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -117,8 +117,11 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
|
||||
@Override
|
||||
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
|
||||
{
|
||||
this.opacity = -1;
|
||||
this.getHost().markForUpdate();
|
||||
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
|
||||
{
|
||||
this.opacity = -1;
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,9 +43,9 @@ import net.minecraftforge.common.crafting.JsonContext;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.recipes.ResolverResult;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
@@ -72,6 +72,48 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getResult( JsonObject json, JsonContext context )
|
||||
{
|
||||
JsonObject resultObject = JsonUtils.getJsonObject( json, "result" );
|
||||
|
||||
if( resultObject.has( "part" ) )
|
||||
{
|
||||
return getPart( resultObject );
|
||||
}
|
||||
else if( resultObject.has( "item" ) )
|
||||
{
|
||||
return CraftingHelper.getItemStack( resultObject, context );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonSyntaxException( "Result has no 'part' or 'item' property." );
|
||||
}
|
||||
}
|
||||
|
||||
private static ItemStack getPart( JsonObject resultObject )
|
||||
{
|
||||
String ingredient = JsonUtils.getString( resultObject, "part" );
|
||||
Object result = AEApi.instance().registries().recipes().resolveItem( AppEng.MOD_ID, ingredient );
|
||||
if( result instanceof ResolverResult )
|
||||
{
|
||||
ResolverResult resolverResult = (ResolverResult) result;
|
||||
|
||||
Item item = Item.getByNameOrId( AppEng.MOD_ID + ":" + resolverResult.itemName );
|
||||
|
||||
if( item == null )
|
||||
{
|
||||
AELog.warn( "item was null for " + resolverResult.itemName + " ( " + ingredient + " )!" );
|
||||
throw new JsonSyntaxException( "Got a null item for " + resolverResult.itemName + " ( " + ingredient + " ). This should never happen!" );
|
||||
}
|
||||
|
||||
return new ItemStack( item, JsonUtils.getInt( resultObject, "count", 1 ), resolverResult.damageValue, resolverResult.compound );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonSyntaxException( "Couldn't find the resulting item in AE. This means AE was provided a recipe that it shouldn't be handling.\n" + "Was looking for : '" + ingredient + "'." );
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from ShapedOreRecipe.java, modified a bit.
|
||||
private static ShapedOreRecipe shapedFactory( JsonContext context, JsonObject json )
|
||||
{
|
||||
@@ -141,28 +183,7 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
throw new JsonSyntaxException( "Key defines symbols that aren't used in pattern: " + keys );
|
||||
}
|
||||
|
||||
JsonObject resultObject = (JsonObject) json.get( "result" );
|
||||
int count = JsonUtils.getInt( resultObject, "count", 1 );
|
||||
|
||||
String ingredient = resultObject.get( "part" ).getAsString();
|
||||
Object result = (Object) Api.INSTANCE.registries().recipes().resolveItem( AppEng.MOD_ID, ingredient );
|
||||
if( result instanceof ResolverResult )
|
||||
{
|
||||
ResolverResult resolverResult = (ResolverResult) result;
|
||||
|
||||
Item item = Item.getByNameOrId( AppEng.MOD_ID + ":" + resolverResult.itemName );
|
||||
if( item == null )
|
||||
{
|
||||
AELog.warn( "item was null for " + resolverResult.itemName + " ( " + ingredient + " )!" );
|
||||
throw new JsonSyntaxException( "Got a null item for " + resolverResult.itemName + " ( " + ingredient + " ). This should never happen!" );
|
||||
}
|
||||
ItemStack itemStack = new ItemStack( item, count, resolverResult.damageValue, resolverResult.compound );
|
||||
|
||||
return new ShapedOreRecipe( group.isEmpty() ? null : new ResourceLocation( group ), itemStack, primer );
|
||||
}
|
||||
|
||||
// Should never reach this part unless mangled JSON or bug in AE.
|
||||
throw new JsonSyntaxException( "Couldn't find the resulting item in AE. This means AE was provided a recipe that it shouldn't be handling.\nWas looking for : '" + ingredient + "'." );
|
||||
return new ShapedOreRecipe( group.isEmpty() ? null : new ResourceLocation( group ), getResult( json, context ), primer );
|
||||
}
|
||||
|
||||
// Copied from ShapelessOreRecipe.java, modified a bit.
|
||||
@@ -181,28 +202,6 @@ public class PartRecipeFactory implements IRecipeFactory
|
||||
throw new JsonParseException( "No ingredients for shapeless recipe" );
|
||||
}
|
||||
|
||||
JsonObject resultObject = (JsonObject) json.get( "result" );
|
||||
int count = JsonUtils.getInt( resultObject, "count", 1 );
|
||||
|
||||
String ingredient = resultObject.get( "part" ).getAsString();
|
||||
Object result = (Object) Api.INSTANCE.registries().recipes().resolveItem( AppEng.MOD_ID, ingredient );
|
||||
if( result instanceof ResolverResult )
|
||||
{
|
||||
ResolverResult resolverResult = (ResolverResult) result;
|
||||
|
||||
Item item = Item.getByNameOrId( AppEng.MOD_ID + ":" + resolverResult.itemName );
|
||||
|
||||
if( item == null )
|
||||
{
|
||||
AELog.warn( "item was null for " + resolverResult.itemName + " ( " + ingredient + " )!" );
|
||||
throw new JsonSyntaxException( "Got a null item for " + resolverResult.itemName + " ( " + ingredient + " ). This should never happen!" );
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack( item, count, resolverResult.damageValue, resolverResult.compound );
|
||||
|
||||
return new ShapelessOreRecipe( group.isEmpty() ? null : new ResourceLocation( group ), ings, itemStack );
|
||||
}
|
||||
|
||||
throw new JsonSyntaxException( "Couldn't find the resulting item in AE. This means AE was provided a recipe that it shouldn't be handling.\n" + "Was looking for : '" + ingredient + "'." );
|
||||
return new ShapelessOreRecipe( group.isEmpty() ? null : new ResourceLocation( group ), ings, getResult( json, context ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
@@ -58,7 +57,6 @@ public class RecipeResourceCopier
|
||||
private static final String FILE_PROTOCOL = "file";
|
||||
private static final String CLASS_EXTENSION = ".class";
|
||||
private static final String JAR_PROTOCOL = "jar";
|
||||
private static final String UTF_8_ENCODING = "UTF-8";
|
||||
|
||||
/**
|
||||
* copy source in the jar
|
||||
@@ -225,9 +223,9 @@ public class RecipeResourceCopier
|
||||
{
|
||||
/* A JAR path */
|
||||
final String dirPath = dirURL.getPath();
|
||||
final String jarPath = dirPath.substring( 5, dirPath.indexOf( '!' ) ); // strip out only
|
||||
final String jarPath = dirPath.substring( 0, dirPath.indexOf( '!' ) ); // strip out only
|
||||
// the JAR file
|
||||
final JarFile jar = new JarFile( URLDecoder.decode( jarPath, UTF_8_ENCODING ) );
|
||||
final JarFile jar = new JarFile( new File( new URI( jarPath ) ) );
|
||||
try
|
||||
{
|
||||
final Enumeration<JarEntry> entries = jar.entries(); // gives ALL entries in jar
|
||||
|
||||
@@ -418,7 +418,7 @@ public class CachedPlane
|
||||
ExtendedBlockStorage extendedblockstorage = storage[by];
|
||||
if( extendedblockstorage == null )
|
||||
{
|
||||
extendedblockstorage = storage[by] = new ExtendedBlockStorage( by << 4, !this.c.getWorld().provider.hasSkyLight() );
|
||||
extendedblockstorage = storage[by] = new ExtendedBlockStorage( by << 4, this.c.getWorld().provider.hasSkyLight() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class TileCraftingStorageTile extends TileCraftingTile
|
||||
@Override
|
||||
public int getStorageBytes()
|
||||
{
|
||||
if( this.world == null || this.notLoaded() )
|
||||
if( this.world == null || this.notLoaded() || this.isInvalid() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
|
||||
public void updateMeta( final boolean updateFormed )
|
||||
{
|
||||
if( this.world == null || this.notLoaded() )
|
||||
if( this.world == null || this.notLoaded() || this.isInvalid() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,9 +281,13 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@Nullable
|
||||
public IInscriberRecipe getTask()
|
||||
{
|
||||
final ItemStack plateA = this.topItemHandler.getStackInSlot( 0 );
|
||||
final ItemStack plateB = this.bottomItemHandler.getStackInSlot( 0 );
|
||||
ItemStack renamedItem = this.sideItemHandler.getStackInSlot( 0 );
|
||||
return getTask( this.sideItemHandler.getStackInSlot( 0 ), this.topItemHandler.getStackInSlot( 0 ), this.bottomItemHandler.getStackInSlot( 0 ) );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IInscriberRecipe getTask( final ItemStack input, final ItemStack plateA, final ItemStack plateB )
|
||||
{
|
||||
ItemStack renamedItem = input;
|
||||
|
||||
if( !plateA.isEmpty() && plateA.getCount() > 1 )
|
||||
{
|
||||
@@ -379,7 +383,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
for( final ItemStack option : recipe.getInputs() )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( option, this.sideItemHandler.getStackInSlot( 0 ) ) )
|
||||
if( Platform.itemComparisons().isSameItem( input, option ) )
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
@@ -606,7 +610,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
for( final ItemStack optionals : AEApi.instance().registries().inscriber().getOptionals() )
|
||||
{
|
||||
if( Platform.itemComparisons().isSameItem( optionals, stack ) )
|
||||
if( Platform.itemComparisons().isSameItem( stack, optionals ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
||||
|
||||
private void changePowerLevel()
|
||||
{
|
||||
if( this.notLoaded() )
|
||||
if( this.notLoaded() || this.isInvalid() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
package appeng.tile.storage;
|
||||
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -48,10 +50,6 @@ import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
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.api.util.AECableType;
|
||||
@@ -68,7 +66,6 @@ import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.InvOperation;
|
||||
@@ -79,10 +76,13 @@ import appeng.util.inv.filter.AEItemFilters;
|
||||
|
||||
public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable
|
||||
{
|
||||
private static final int NUMBER_OF_CELL_SLOTS = 6;
|
||||
private static final int NUMBER_OF_UPGRADE_SLOTS = 3;
|
||||
|
||||
private final ConfigManager manager;
|
||||
|
||||
private final AppEngInternalInventory inputCells = new AppEngInternalInventory( this, 6 );
|
||||
private final AppEngInternalInventory outputCells = new AppEngInternalInventory( this, 6 );
|
||||
private final AppEngInternalInventory inputCells = new AppEngInternalInventory( this, NUMBER_OF_CELL_SLOTS );
|
||||
private final AppEngInternalInventory outputCells = new AppEngInternalInventory( this, NUMBER_OF_CELL_SLOTS );
|
||||
private final IItemHandler combinedInventory = new WrapperChainedItemHandler( this.inputCells, this.outputCells );
|
||||
|
||||
private final IItemHandler inputCellsExt = new WrapperFilteredItemHandler( this.inputCells, AEItemFilters.INSERT_ONLY );
|
||||
@@ -92,8 +92,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
private final IActionSource mySrc;
|
||||
private YesNo lastRedstoneState;
|
||||
private ItemStack currentCell;
|
||||
private IMEInventory<IAEFluidStack> cachedFluid;
|
||||
private IMEInventory<IAEItemStack> cachedItem;
|
||||
private Map<IStorageChannel<?>, IMEInventory<?>> cachedInventories;
|
||||
|
||||
public TileIOPort()
|
||||
{
|
||||
@@ -106,7 +105,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
this.lastRedstoneState = YesNo.UNDECIDED;
|
||||
|
||||
final Block ioPortBlock = AEApi.instance().definitions().blocks().iOPort().maybeBlock().get();
|
||||
this.upgrades = new BlockUpgradeInventory( ioPortBlock, this, 3 );
|
||||
this.upgrades = new BlockUpgradeInventory( ioPortBlock, this, NUMBER_OF_UPGRADE_SLOTS );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,87 +276,84 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
long ItemsToMove = 256;
|
||||
TickRateModulation ret = TickRateModulation.SLEEP;
|
||||
long itemsToMove = 256;
|
||||
|
||||
switch( this.getInstalledUpgrades( Upgrades.SPEED ) )
|
||||
{
|
||||
case 1:
|
||||
ItemsToMove *= 2;
|
||||
itemsToMove *= 2;
|
||||
break;
|
||||
case 2:
|
||||
ItemsToMove *= 4;
|
||||
itemsToMove *= 4;
|
||||
break;
|
||||
case 3:
|
||||
ItemsToMove *= 8;
|
||||
itemsToMove *= 8;
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final IMEInventory<IAEItemStack> itemNet = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IMEInventory<IAEFluidStack> fluidNet = this.getProxy().getStorage().getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
for( int x = 0; x < 6; x++ )
|
||||
for( int x = 0; x < NUMBER_OF_CELL_SLOTS; x++ )
|
||||
{
|
||||
final ItemStack is = this.inputCells.getStackInSlot( x );
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
if( ItemsToMove > 0 )
|
||||
boolean shouldMove = true;
|
||||
|
||||
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
|
||||
{
|
||||
final IMEInventory<IAEItemStack> itemInv = this.getInv( is, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IMEInventory<IAEFluidStack> fluidInv = this.getInv( is,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
|
||||
if( this.manager.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
|
||||
if( itemsToMove > 0 )
|
||||
{
|
||||
if( itemInv != null )
|
||||
final IMEMonitor<? extends IAEStack<?>> network = this.getProxy().getStorage().getInventory( c );
|
||||
final IMEInventory<?> inv = this.getInv( is, c );
|
||||
|
||||
if( inv == null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, itemInv, itemNet, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
continue;
|
||||
}
|
||||
if( fluidInv != null )
|
||||
|
||||
if( this.manager.getSetting( Settings.OPERATION_MODE ) == OperationMode.EMPTY )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, fluidInv, fluidNet, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( itemInv != null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, itemNet, itemInv, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
if( fluidInv != null )
|
||||
{
|
||||
ItemsToMove = this.transferContents( energy, fluidNet, fluidInv, ItemsToMove,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
itemsToMove = this.transferContents( energy, inv, network, itemsToMove, c );
|
||||
}
|
||||
else
|
||||
{
|
||||
itemsToMove = this.transferContents( energy, network, inv, itemsToMove, c );
|
||||
}
|
||||
|
||||
shouldMove &= this.shouldMove( inv );
|
||||
|
||||
if( itemsToMove > 0 )
|
||||
{
|
||||
ret = TickRateModulation.IDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = TickRateModulation.URGENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( ItemsToMove > 0 && this.shouldMove( itemInv, fluidInv ) && !this.moveSlot( x ) )
|
||||
{
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
return TickRateModulation.URGENT;
|
||||
if( itemsToMove > 0 && shouldMove && this.moveSlot( x ) )
|
||||
{
|
||||
ret = TickRateModulation.URGENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TickRateModulation.URGENT;
|
||||
ret = TickRateModulation.URGENT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
return TickRateModulation.IDLE;
|
||||
ret = TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
// nothing left to do...
|
||||
return TickRateModulation.SLEEP;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -366,23 +362,20 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
return this.upgrades.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
private IMEInventory getInv( final ItemStack is, final IStorageChannel chan )
|
||||
private IMEInventory<?> getInv( final ItemStack is, final IStorageChannel<?> chan )
|
||||
{
|
||||
if( this.currentCell != is )
|
||||
{
|
||||
this.currentCell = is;
|
||||
this.cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, null,
|
||||
AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
|
||||
this.cachedItem = AEApi.instance().registries().cell().getCellInventory( is, null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
this.cachedInventories = new IdentityHashMap<>();
|
||||
|
||||
for( IStorageChannel<? extends IAEStack<?>> c : AEApi.instance().storage().storageChannels() )
|
||||
{
|
||||
this.cachedInventories.put( c, AEApi.instance().registries().cell().getCellInventory( is, null, c ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) == chan )
|
||||
{
|
||||
return this.cachedItem;
|
||||
}
|
||||
|
||||
return this.cachedFluid;
|
||||
return this.cachedInventories.get( chan );
|
||||
}
|
||||
|
||||
private long transferContents( final IEnergySource energy, final IMEInventory src, final IMEInventory destination, long itemsToMove, final IStorageChannel chan )
|
||||
@@ -397,6 +390,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
myList = src.getAvailableItems( src.getChannel().createList() );
|
||||
}
|
||||
|
||||
itemsToMove *= chan.transferFactor();
|
||||
|
||||
boolean didStuff;
|
||||
|
||||
do
|
||||
@@ -429,7 +424,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
if( extracted != null )
|
||||
{
|
||||
possible = extracted.getStackSize();
|
||||
final IAEStack failed = Platform.poweredInsert( energy, destination, extracted, this.mySrc );
|
||||
final IAEStack failed = chan.poweredInsert( energy, destination, extracted, this.mySrc );
|
||||
|
||||
if( failed != null )
|
||||
{
|
||||
@@ -451,24 +446,16 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
}
|
||||
while( itemsToMove > 0 && didStuff );
|
||||
|
||||
return itemsToMove;
|
||||
return itemsToMove / chan.transferFactor();
|
||||
}
|
||||
|
||||
private boolean shouldMove( final IMEInventory<IAEItemStack> itemInv, final IMEInventory<IAEFluidStack> fluidInv )
|
||||
private boolean shouldMove( final IMEInventory<?> inv )
|
||||
{
|
||||
final FullnessMode fm = (FullnessMode) this.manager.getSetting( Settings.FULLNESS_MODE );
|
||||
|
||||
if( itemInv != null && fluidInv != null )
|
||||
if( inv != null )
|
||||
{
|
||||
return this.matches( fm, itemInv ) && this.matches( fm, fluidInv );
|
||||
}
|
||||
else if( itemInv != null )
|
||||
{
|
||||
return this.matches( fm, itemInv );
|
||||
}
|
||||
else if( fluidInv != null )
|
||||
{
|
||||
return this.matches( fm, fluidInv );
|
||||
return this.matches( fm, inv );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1174,13 +1174,13 @@ public class Platform
|
||||
stored -= possible.getStackSize();
|
||||
}
|
||||
|
||||
final double availablePower = energy.extractAEPower( stored, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
|
||||
final int energyFactor = Math.min( 1, input.getChannel().transferFactor() );
|
||||
final double availablePower = energy.extractAEPower( stored / energyFactor, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
final long itemToAdd = Math.min( (long) ( availablePower + 0.9 ), stored );
|
||||
|
||||
if( itemToAdd > 0 )
|
||||
{
|
||||
energy.extractAEPower( stored, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
energy.extractAEPower( stored / energyFactor, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
|
||||
if( itemToAdd < input.getStackSize() )
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ final class AESharedItemStack implements Comparable<AESharedItemStack>
|
||||
}
|
||||
else
|
||||
{
|
||||
newDef.setItemDamage( 0 );
|
||||
newDef.setItemDamage( 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<body>
|
||||
<div id="content">
|
||||
<div id="header">
|
||||
<h1>Custom Recipes</h1>
|
||||
<h1>Custom Recipes [DEPRECATED]</h1>
|
||||
</div>
|
||||
|
||||
<div id="body">
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
##########################################################
|
||||
# DEPRECATED #
|
||||
# Until vanilla/Forge JSON is capable of supporting most #
|
||||
# of our use cases use CraftTweaker for custom recipes #
|
||||
##########################################################
|
||||
|
||||
# Crash on Issues
|
||||
crash=false
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
##########################################################
|
||||
# DEPRECATED #
|
||||
# Until vanilla/Forge JSON is capable of supporting most #
|
||||
# of our use cases use CraftTweaker for custom recipes #
|
||||
##########################################################
|
||||
|
||||
# Forge Ore Dictionary
|
||||
# logWood, slabWood, stairWood, treeSapling, treeLeaves,
|
||||
# oreGold, oreIron, oreLapis, oreDiamond, oreRedstone, oreEmerald, oreQuartz, oreCoal,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"variants": {
|
||||
"normal": {
|
||||
"model": "appliedenergistics2:debug/energy_gen"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "appliedenergistics2:blocks/debug/energy_gen"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "appliedenergistics2:items/debug/energy_gen"
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,10 +1,9 @@
|
||||
{
|
||||
"type": "appliedenergistics2:part_shapeless",
|
||||
"result": {
|
||||
"type": "appliedenergistics2:part",
|
||||
"part": "part.cable_anchor",
|
||||
"count": 3
|
||||
},
|
||||
"type": "appliedenergistics2:part_shapeless",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "#appliedenergistics2:metalIngots"
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 791 B |
Binary file not shown.
|
After Width: | Height: | Size: 246 B |
Reference in New Issue
Block a user