Add data generation. (#4399)

Recipe and other Data Generators
This commit is contained in:
Eutro
2020-06-02 22:13:49 +01:00
committed by GitHub
parent 1056629545
commit 58afa6539f
139 changed files with 2702 additions and 962 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ package appeng.core;
import appeng.api.config.*;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.core.features.AEFeature;
import appeng.api.features.AEFeature;
import appeng.core.settings.TickRates;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
+1 -1
View File
@@ -29,7 +29,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage;
import net.minecraft.util.math.BlockPos;
import appeng.core.features.AEFeature;
import appeng.api.features.AEFeature;
public final class AELog
+3 -8
View File
@@ -21,26 +21,21 @@ package appeng.core;
import java.io.File;
import appeng.bootstrap.components.IBlockRegistrationComponent;
import appeng.bootstrap.components.IClientSetupComponent;
import appeng.client.ClientHelper;
import appeng.client.render.model.GlassModelLoader;
import appeng.core.features.AEFeature;
import appeng.server.ServerHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.particles.ParticleType;
import net.minecraft.stats.StatType;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.CrashReportExtender;
import net.minecraftforge.fml.DistExecutor;
@@ -54,8 +49,7 @@ import appeng.services.export.ExportConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.registries.IForgeRegistry;
@Mod(AppEng.MOD_ID)
public final class AppEng
@@ -109,6 +103,7 @@ public final class AppEng
modEventBus.addGenericListener(ParticleType.class, registration::registerParticleTypes);
modEventBus.addGenericListener(TileEntityType.class, registration::registerTileEntities);
modEventBus.addGenericListener(ContainerType.class, registration::registerContainerTypes);
modEventBus.addGenericListener(IRecipeSerializer.class, registration::registerRecipeSerializers);
modEventBus.addListener(registration::registerParticleFactories);
modEventBus.addListener(registration::registerTextures);
+24 -29
View File
@@ -31,6 +31,9 @@ import appeng.client.render.tesr.SkyChestTESR;
import appeng.container.implementations.ContainerGrinder;
import appeng.container.implementations.ContainerSkyChest;
import appeng.core.stats.AeStats;
import appeng.recipes.conditions.FeaturesEnabled;
import appeng.recipes.game.DisassembleRecipe;
import appeng.recipes.ingredients.PartIngredientSerializer;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager;
@@ -39,6 +42,7 @@ import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.entity.EntityType;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.particles.ParticleType;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
@@ -48,9 +52,11 @@ import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.GenericEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.registries.ForgeRegistryEntry;
@@ -252,35 +258,24 @@ final class Registration
});
}
// @SubscribeEvent
// public void registerRecipes( RegistryEvent.Register<IRecipe> event )
// {
// final IForgeRegistry<IRecipe> registry = event.getRegistry();
//
// final Api api = Api.INSTANCE;
// final ApiDefinitions definitions = api.definitions();
// final Dist dist = FMLCommonHandler.instance().getEffectiveSide();
//
// if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
// {
// DisassembleRecipe r = new DisassembleRecipe();
// registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
// }
//
// if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_FACADE_CRAFTING ) )
// {
// definitions.items().facade().maybeItem().ifPresent( facadeItem ->
// {
// FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
// registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
// } );
// }
//
// definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
//
// final AERecipeLoader ldr = new AERecipeLoader();
// ldr.loadProcessingRecipes();
// }
public void registerRecipeSerializers( RegistryEvent.Register<IRecipeSerializer<?>> event )
{
IForgeRegistry<IRecipeSerializer<?>> r = event.getRegistry();
final ApiDefinitions definitions = Api.INSTANCE.definitions();
r.registerAll(
DisassembleRecipe.SERIALIZER
// FacadeRecipe.getSerializer( (ItemFacade) definitions.items().facade().item() ) FIXME reimplement facades
// this.factories.put( new ResourceLocation( AppEng.MOD_ID, "inscriber" ), new InscriberHandler() ); FIXME re-implement machine recipes
// this.factories.put( new ResourceLocation( AppEng.MOD_ID, "smelt" ), new SmeltingHandler() );
// this.factories.put( new ResourceLocation( AppEng.MOD_ID, "grinder" ), new GrinderHandler() );
);
CraftingHelper.register( FeaturesEnabled.Serializer.INSTANCE );
CraftingHelper.register( new ResourceLocation( AppEng.MOD_ID, "part" ), PartIngredientSerializer.INSTANCE );
}
public void registerEntities( RegistryEvent.Register<EntityType<?>> event )
@@ -31,14 +31,17 @@ import appeng.bootstrap.*;
import appeng.bootstrap.definitions.TileEntityDefinition;
import appeng.client.render.tesr.CrankTESR;
import appeng.client.render.tesr.SkyChestTESR;
import appeng.core.features.AEFeature;
import appeng.api.features.AEFeature;
import appeng.core.features.registries.PartModels;
import appeng.decorative.AEDecorativeBlock;
import appeng.decorative.solid.*;
import appeng.tile.grindstone.TileCrank;
import appeng.tile.grindstone.TileGrinder;
import appeng.tile.storage.TileSkyChest;
import net.minecraft.block.*;
import net.minecraft.block.Block;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.api.distmarker.Dist;
@@ -23,7 +23,7 @@ import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IItems;
import appeng.api.util.AEColoredItemDefinition;
import appeng.bootstrap.FeatureFactory;
import appeng.core.features.AEFeature;
import appeng.api.features.AEFeature;
import appeng.items.tools.quartz.*;
@@ -1,275 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features;
public enum AEFeature
{
// stuff that has no reason for ever being turned off, or that
// is just flat out required by tons of
// important stuff.
CORE( "Core", null )
{
@Override
public boolean isVisible()
{
return false;
}
},
CERTUS_QUARTZ_WORLD_GEN( "CertusQuartzWorldGen", Constants.CATEGORY_WORLD ),
METEORITE_WORLD_GEN( "MeteoriteWorldGen", Constants.CATEGORY_WORLD ),
DECORATIVE_LIGHTS( "DecorativeLights", Constants.CATEGORY_WORLD ),
DECORATIVE_BLOCKS( "DecorativeBlocks", Constants.CATEGORY_WORLD, "Blocks that are not used in any essential recipes, also slabs and stairs." ),
SKY_STONE_CHESTS( "SkyStoneChests", Constants.CATEGORY_WORLD ),
SPAWN_PRESSES_IN_METEORITES( "SpawnPressesInMeteorites", Constants.CATEGORY_WORLD ),
FLOUR( "Flour", Constants.CATEGORY_WORLD ),
CHEST_LOOT( "ChestLoot", Constants.CATEGORY_WORLD ),
VILLAGER_TRADING( "VillagerTrading", Constants.CATEGORY_WORLD ),
TINY_TNT( "TinyTNT", Constants.CATEGORY_WORLD ),
CERTUS_ORE( "CertusOre", Constants.CATEGORY_WORLD ),
CHARGED_CERTUS_ORE( "ChargedCertusOre", Constants.CATEGORY_WORLD ),
GRIND_STONE( "GrindStone", Constants.CATEGORY_MACHINES ),
INSCRIBER( "Inscriber", Constants.CATEGORY_MACHINES ),
CHARGER( "Charger", Constants.CATEGORY_MACHINES ),
CRYSTAL_GROWTH_ACCELERATOR( "CrystalGrowthAccelerator", Constants.CATEGORY_MACHINES ),
POWER_GEN( "VibrationChamber", Constants.CATEGORY_MACHINES ),
POWERED_TOOLS( "PoweredTools", Constants.CATEGORY_TOOLS_CLASSIFICATIONS ),
CERTUS_QUARTZ_TOOLS( "CertusQuartzTools", Constants.CATEGORY_TOOLS_CLASSIFICATIONS ),
NETHER_QUARTZ_TOOLS( "NetherQuartzTools", Constants.CATEGORY_TOOLS_CLASSIFICATIONS ),
QUARTZ_HOE( "QuartzHoe", Constants.CATEGORY_TOOLS ),
QUARTZ_SPADE( "QuartzSpade", Constants.CATEGORY_TOOLS ),
QUARTZ_SWORD( "QuartzSword", Constants.CATEGORY_TOOLS ),
QUARTZ_PICKAXE( "QuartzPickaxe", Constants.CATEGORY_TOOLS ),
QUARTZ_AXE( "QuartzAxe", Constants.CATEGORY_TOOLS ),
QUARTZ_KNIFE( "QuartzKnife", Constants.CATEGORY_TOOLS ),
QUARTZ_WRENCH( "QuartzWrench", Constants.CATEGORY_TOOLS ),
CHARGED_STAFF( "ChargedStaff", Constants.CATEGORY_TOOLS ),
ENTROPY_MANIPULATOR( "EntropyManipulator", Constants.CATEGORY_TOOLS ),
MATTER_CANNON( "MatterCannon", Constants.CATEGORY_TOOLS ),
WIRELESS_ACCESS_TERMINAL( "WirelessAccessTerminal", Constants.CATEGORY_TOOLS ),
COLOR_APPLICATOR( "ColorApplicator", Constants.CATEGORY_TOOLS ),
METEORITE_COMPASS( "MeteoriteCompass", Constants.CATEGORY_TOOLS ),
SECURITY( "Security", Constants.CATEGORY_NETWORK_FEATURES ),
SPATIAL_IO( "SpatialIO", Constants.CATEGORY_NETWORK_FEATURES ),
QUANTUM_NETWORK_BRIDGE( "QuantumNetworkBridge", Constants.CATEGORY_NETWORK_FEATURES ),
CHANNELS( "Channels", Constants.CATEGORY_NETWORK_FEATURES ),
INTERFACE( "Interface", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_INTERFACE( "FluidInterface", Constants.CATEGORY_NETWORK_BUSES ),
LEVEL_EMITTER( "LevelEmitter", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_LEVEL_EMITTER( "FluidLevelEmitter", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_TERMINAL( "FluidTerminal", Constants.CATEGORY_NETWORK_BUSES ),
CRAFTING_TERMINAL( "CraftingTerminal", Constants.CATEGORY_NETWORK_BUSES ),
TERMINAL( "Terminal", Constants.CATEGORY_NETWORK_BUSES ),
STORAGE_MONITOR( "StorageMonitor", Constants.CATEGORY_NETWORK_BUSES ),
P2P_TUNNEL( "P2PTunnel", Constants.CATEGORY_NETWORK_BUSES ),
FORMATION_PLANE( "FormationPlane", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_FORMATION_PLANE( "FluidFormationPlane", Constants.CATEGORY_NETWORK_BUSES ),
ANNIHILATION_PLANE( "AnnihilationPlane", Constants.CATEGORY_NETWORK_BUSES ),
IDENTITY_ANNIHILATION_PLANE( "IdentityAnnihilationPlane", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_ANNIHILATION_PLANE( "FluidAnnihilationPlane", Constants.CATEGORY_NETWORK_BUSES ),
IMPORT_BUS( "ImportBus", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_IMPORT_BUS( "FluidImportBus", Constants.CATEGORY_NETWORK_BUSES ),
EXPORT_BUS( "ExportBus", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_EXPORT_BUS( "FluidExportBus", Constants.CATEGORY_NETWORK_BUSES ),
STORAGE_BUS( "StorageBus", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_STORAGE_BUS( "FluidStorageBus", Constants.CATEGORY_NETWORK_BUSES ),
PART_CONVERSION_MONITOR( "PartConversionMonitor", Constants.CATEGORY_NETWORK_BUSES ),
TOGGLE_BUS( "ToggleBus", Constants.CATEGORY_NETWORK_BUSES ),
PANELS( "Panels", Constants.CATEGORY_NETWORK_BUSES ),
QUARTZ_FIBER( "QuartzFiber", Constants.CATEGORY_NETWORK_BUSES ),
CABLE_ANCHOR( "CableAnchor", Constants.CATEGORY_NETWORK_BUSES ),
PORTABLE_CELL( "PortableCell", Constants.CATEGORY_PORTABLE_CELL ),
STORAGE_CELLS( "StorageCells", Constants.CATEGORY_STORAGE ),
ME_CHEST( "MEChest", Constants.CATEGORY_STORAGE ),
ME_DRIVE( "MEDrive", Constants.CATEGORY_STORAGE ),
IO_PORT( "IOPort", Constants.CATEGORY_STORAGE ),
CONDENSER( "Condenser", Constants.CATEGORY_STORAGE ),
NETWORK_TOOL( "NetworkTool", Constants.CATEGORY_NETWORK_TOOL ),
MEMORY_CARD( "MemoryCard", Constants.CATEGORY_NETWORK_TOOL ),
GLASS_CABLES( "GlassCables", Constants.CATEGORY_CABLES ),
COVERED_CABLES( "CoveredCables", Constants.CATEGORY_CABLES ),
SMART_CABLES( "SmartCables", Constants.CATEGORY_CABLES ),
DENSE_CABLES( "DenseCables", Constants.CATEGORY_CABLES ),
ENERGY_CELLS( "EnergyCells", Constants.CATEGORY_ENERGY ),
ENERGY_ACCEPTOR( "EnergyAcceptor", Constants.CATEGORY_ENERGY ),
DENSE_ENERGY_CELLS( "DenseEnergyCells", Constants.CATEGORY_ENERGY ),
P2P_TUNNEL_ME( "P2PTunnelME", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_EU( "P2PTunnelEU", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_FE( "P2PTunnelFE", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_FLUIDS( "P2PTunnelFluids", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_LIGHT( "P2PTunnelLight", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_OPEN_COMPUTERS( "P2PTunnelOpenComputers", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_PRESSURE( "P2PTunnelPressure", Constants.CATEGORY_P2P_TUNNELS ),
MASS_CANNON_BLOCK_DAMAGE( "MassCannonBlockDamage", Constants.CATEGORY_BLOCK_FEATURES ),
TINY_TNT_BLOCK_DAMAGE( "TinyTNTBlockDamage", Constants.CATEGORY_BLOCK_FEATURES ),
FACADES( "Facades", Constants.CATEGORY_FACADES ),
UNSUPPORTED_DEVELOPER_TOOLS( "UnsupportedDeveloperTools", Constants.CATEGORY_MISC, false ),
CREATIVE( "Creative", Constants.CATEGORY_MISC ),
GRINDER_LOGGING( "GrinderLogging", Constants.CATEGORY_MISC, false ),
LOGGING( "Logging", Constants.CATEGORY_MISC ),
INTEGRATION_LOGGING( "IntegrationLogging", Constants.CATEGORY_MISC, false ),
WEBSITE_RECIPES( "WebsiteRecipes", Constants.CATEGORY_MISC, false ),
LOG_SECURITY_AUDITS( "LogSecurityAudits", Constants.CATEGORY_MISC, false ),
ACHIEVEMENTS( "Achievements", Constants.CATEGORY_MISC ),
UPDATE_LOGGING( "UpdateLogging", Constants.CATEGORY_MISC, false ),
PACKET_LOGGING( "PacketLogging", Constants.CATEGORY_MISC, false ),
CRAFTING_LOG( "CraftingLog", Constants.CATEGORY_MISC, false ),
LIGHT_DETECTOR( "LightDetector", Constants.CATEGORY_MISC ),
DEBUG_LOGGING( "DebugLogging", Constants.CATEGORY_MISC, false ),
ENABLE_FACADE_CRAFTING( "EnableFacadeCrafting", Constants.CATEGORY_CRAFTING ),
IN_WORLD_SINGULARITY( "InWorldSingularity", Constants.CATEGORY_CRAFTING ),
IN_WORLD_FLUIX( "InWorldFluix", Constants.CATEGORY_CRAFTING ),
IN_WORLD_PURIFICATION( "InWorldPurification", Constants.CATEGORY_CRAFTING ),
INTERFACE_TERMINAL( "InterfaceTerminal", Constants.CATEGORY_CRAFTING ),
ENABLE_DISASSEMBLY_CRAFTING( "EnableDisassemblyCrafting", Constants.CATEGORY_CRAFTING ),
ALPHA_PASS( "AlphaPass", Constants.CATEGORY_RENDERING ),
PAINT_BALLS( "PaintBalls", Constants.CATEGORY_TOOLS ),
MOLECULAR_ASSEMBLER( "MolecularAssembler", Constants.CATEGORY_CRAFTING_FEATURES ),
PATTERNS( "Patterns", Constants.CATEGORY_CRAFTING_FEATURES ),
CRAFTING_CPU( "CraftingCPU", Constants.CATEGORY_CRAFTING_FEATURES ),
CRAFTING_MANAGER_FALLBACK( "CraftingManagerFallback", Constants.CATEGORY_CRAFTING_FEATURES, "Use CraftingManager to find an alternative recipe, after a pattern rejected an ingredient. Should be enabled to avoid issues, but can have a minor performance impact." ),
BASIC_CARDS( "BasicCards", Constants.CATEGORY_UPGRADES ),
ADVANCED_CARDS( "AdvancedCards", Constants.CATEGORY_UPGRADES ),
VIEW_CELL( "ViewCell", Constants.CATEGORY_UPGRADES ),
CRYSTAL_SEEDS( "CrystalSeeds", Constants.CATEGORY_MATERIALS ),
PURE_CRYSTALS( "PureCrystals", Constants.CATEGORY_MATERIALS ),
CERTUS( "Certus", Constants.CATEGORY_MATERIALS ),
FLUIX( "Fluix", Constants.CATEGORY_MATERIALS ),
SILICON( "Silicon", Constants.CATEGORY_MATERIALS ),
DUSTS( "Dusts", Constants.CATEGORY_MATERIALS ),
NUGGETS( "Nuggets", Constants.CATEGORY_MATERIALS ),
QUARTZ_GLASS( "QuartzGlass", Constants.CATEGORY_MATERIALS ),
SKY_STONE( "SkyStone", Constants.CATEGORY_MATERIALS ),
PROCESSORS( "Processors", Constants.CATEGORY_COMPONENTS ),
PRINTED_CIRCUITS( "PrintedCircuits", Constants.CATEGORY_COMPONENTS ),
PRESSES( "Presses", Constants.CATEGORY_COMPONENTS ),
MATTER_BALL( "MatterBall", Constants.CATEGORY_COMPONENTS ),
CORES( "Cores", Constants.CATEGORY_COMPONENTS ),
CHUNK_LOGGER_TRACE( "ChunkLoggerTrace", Constants.CATEGORY_COMMANDS, false );
private final String key;
private final String category;
private final boolean enabled;
private final String comment;
AEFeature( final String key, final String cat )
{
this( key, cat, true );
}
AEFeature( final String key, final String cat, final String comment )
{
this( key, cat, true, comment );
}
AEFeature( final String key, final String cat, final boolean enabled )
{
this( key, cat, enabled, null );
}
AEFeature( final String key, final String cat, final boolean enabled, final String comment )
{
this.key = key;
this.category = cat;
this.enabled = enabled;
this.comment = comment;
}
/**
* override to set visibility
*
* @return default true
*/
public boolean isVisible()
{
return true;
}
public String key()
{
return this.key;
}
public String category()
{
return this.category;
}
public boolean isEnabled()
{
return this.enabled;
}
public String comment()
{
return this.comment;
}
private enum Constants
{
;
private static final String CATEGORY_MISC = "Misc";
private static final String CATEGORY_CRAFTING = "Crafting";
private static final String CATEGORY_WORLD = "World";
private static final String CATEGORY_MACHINES = "Machines";
private static final String CATEGORY_TOOLS = "Tools";
private static final String CATEGORY_TOOLS_CLASSIFICATIONS = "ToolsClassifications";
private static final String CATEGORY_NETWORK_BUSES = "NetworkBuses";
private static final String CATEGORY_P2P_TUNNELS = "P2PTunnels";
private static final String CATEGORY_BLOCK_FEATURES = "BlockFeatures";
private static final String CATEGORY_CRAFTING_FEATURES = "CraftingFeatures";
private static final String CATEGORY_STORAGE = "Storage";
private static final String CATEGORY_CABLES = "Cables";
private static final String CATEGORY_NETWORK_FEATURES = "NetworkFeatures";
private static final String CATEGORY_COMMANDS = "Commands";
private static final String CATEGORY_RENDERING = "Rendering";
private static final String CATEGORY_FACADES = "Facades";
private static final String CATEGORY_NETWORK_TOOL = "NetworkTool";
private static final String CATEGORY_PORTABLE_CELL = "PortableCell";
private static final String CATEGORY_ENERGY = "Energy";
private static final String CATEGORY_UPGRADES = "Upgrades";
private static final String CATEGORY_MATERIALS = "Materials";
private static final String CATEGORY_COMPONENTS = "CraftingComponents";
}
}
@@ -19,8 +19,9 @@
package appeng.core.features;
import java.util.Optional;
import java.util.Set;
import appeng.api.features.AEFeature;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
@@ -30,7 +31,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import appeng.api.definitions.IBlockDefinition;
import net.minecraftforge.fml.RegistryObject;
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
@@ -39,9 +39,9 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition
private final BlockItem blockItem;
public BlockDefinition( String registryName, Block block, BlockItem item )
public BlockDefinition( String registryName, Block block, BlockItem item, Set<AEFeature> features )
{
super( registryName, item );
super( registryName, item, features );
this.block = block;
this.blockItem = item;
}
@@ -19,10 +19,13 @@
package appeng.core.features;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import appeng.api.features.AEFeature;
import com.google.common.base.Preconditions;
import net.minecraft.item.Item;
@@ -71,9 +74,9 @@ public final class DamagedItemDefinition implements IItemDefinition
}
@Override
public boolean isEnabled()
public Set<AEFeature> features()
{
return this.source.isPresent();
return Collections.emptySet();
}
@Override
@@ -84,7 +87,7 @@ public final class DamagedItemDefinition implements IItemDefinition
return false;
}
return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem();
return comparableStack.getItem() == this.source.get().getItem();
}
}
@@ -19,13 +19,15 @@
package appeng.core.features;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import appeng.api.features.AEFeature;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -37,12 +39,14 @@ public class ItemDefinition implements IItemDefinition
{
private final String identifier;
private final Item item;
private final Set<AEFeature> features;
public ItemDefinition( String registryName, Item item )
public ItemDefinition( String registryName, Item item, Set<AEFeature> features )
{
Preconditions.checkArgument( !Strings.isNullOrEmpty( registryName ), "registryName" );
this.identifier = registryName;
this.item = item;
this.features = ImmutableSet.copyOf(features);
}
@Nonnull
@@ -65,10 +69,9 @@ public class ItemDefinition implements IItemDefinition
}
@Override
public boolean isEnabled()
public Set<AEFeature> features()
{
// FIXME sadly we can only set this after registration
return true;
return features;
}
@Override
@@ -20,9 +20,11 @@ package appeng.core.features;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import appeng.api.features.AEFeature;
import net.minecraft.item.BlockItem;
import net.minecraft.tileentity.TileEntity;
@@ -35,9 +37,9 @@ public final class TileDefinition extends BlockDefinition implements ITileDefini
private final Optional<AEBaseTileBlock> block;
public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, BlockItem item )
public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, BlockItem item, Set<AEFeature> features )
{
super( registryName, block, item );
super( registryName, block, item, features );
this.block = Optional.ofNullable( block );
}
@@ -26,7 +26,6 @@ import net.minecraft.item.Items;
import appeng.api.features.IMatterCannonAmmoRegistry;
import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler;
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
@@ -32,7 +32,6 @@ import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IRecipeHandler;
import appeng.api.recipes.ISubItemResolver;
import appeng.core.AELog;
import appeng.recipes.RecipeHandler;
/**
@@ -43,51 +42,14 @@ import appeng.recipes.RecipeHandler;
*/
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
{
private final Map<String, Class<? extends ICraftHandler>> handlers = new HashMap<>( 20 );
private final Collection<ISubItemResolver> resolvers = new ArrayList<>();
@Override
public void addNewCraftHandler( final String name, final Class<? extends ICraftHandler> handler )
{
this.handlers.put( name.toLowerCase( Locale.ENGLISH ), handler );
}
@Override
public void addNewSubItemResolver( final ISubItemResolver sir )
{
this.resolvers.add( sir );
}
@Nullable
@Override
public ICraftHandler getCraftHandlerFor( final String name )
{
final Class<? extends ICraftHandler> clz = this.handlers.get( name );
if( clz == null )
{
return null;
}
try
{
return clz.newInstance();
}
catch( final Throwable e )
{
AELog.error( "Error Caused when trying to construct " + clz.getName() );
AELog.debug( e );
this.handlers.put( name, null ); // clear it..
return null;
}
}
@Override
public IRecipeHandler createNewRecipehandler()
{
return new RecipeHandler();
}
@Nullable
@Override
public Object resolveItem( final String nameSpace, final String itemName )
@@ -42,7 +42,6 @@ import appeng.api.features.IInscriberRecipeBuilder;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler;
import appeng.util.Platform;
@@ -19,8 +19,6 @@
package appeng.core.sync;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.IPacket;
import net.minecraft.network.PacketBuffer;
@@ -28,7 +26,7 @@ import net.minecraftforge.fml.network.NetworkDirection;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.api.features.AEFeature;
import appeng.core.sync.network.INetworkInfo;