Fixed formation planes.

This commit is contained in:
Sebastian Hartte
2020-06-10 00:25:44 +02:00
parent 3e206ee544
commit bd16641638
52 changed files with 557 additions and 413 deletions
+8 -36
View File
@@ -34,6 +34,7 @@ import appeng.client.ClientHelper;
import appeng.client.render.DummyFluidItemModel;
import appeng.client.render.SimpleModelLoader;
import appeng.client.render.cablebus.CableBusModel;
import appeng.client.render.cablebus.P2PTunnelFrequencyModel;
import appeng.client.render.crafting.CraftingCubeModelLoader;
import appeng.client.render.model.*;
import appeng.client.render.spatial.SpatialPylonModel;
@@ -43,6 +44,8 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.parts.PartPlacement;
import appeng.parts.automation.PlaneModel;
import appeng.parts.automation.PlaneModelLoader;
import appeng.server.AECommand;
import appeng.server.ServerHelper;
import com.google.common.base.Stopwatch;
@@ -98,12 +101,11 @@ public final class AppEng
private static AppEng INSTANCE;
//FIXME private final Registration registration;
private final Registration registration;
/**
* determined in pre-init but used in init
*/
// FIXME private ExportConfig exportConfig;
public AppEng()
{
@@ -125,7 +127,7 @@ public final class AppEng
CreativeTabFacade.init();
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
Registration registration = new Registration();
registration = new Registration();
modEventBus.addGenericListener(Block.class, registration::registerBlocks);
modEventBus.addGenericListener(Item.class, registration::registerItems);
modEventBus.addGenericListener(EntityType.class, registration::registerEntities);
@@ -195,11 +197,12 @@ public final class AppEng
addBuiltInModel("spatial_pylon", SpatialPylonModel::new);
addBuiltInModel("paint_splotches", PaintSplotchesModel::new);
addBuiltInModel("quantum_bridge_formed", QnbFormedModel::new);
addBuiltInModel("p2p_tunnel_frequency", P2PTunnelFrequencyModel::new);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "part_plane"), PlaneModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "crafting_cube"), CraftingCubeModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "uvlightmap"), UVLModelLoader.INSTANCE);
addBuiltInModel("cable_bus", () -> new CableBusModel((PartModels) Api.INSTANCE.registries().partModels()));
}
private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) {
@@ -232,7 +235,7 @@ public final class AppEng
public AdvancementTriggers getAdvancementTriggers()
{
return null; // FIXME this.registration.advancementTriggers;
return this.registration.advancementTriggers;
}
// @EventHandler
@@ -250,8 +253,6 @@ public final class AppEng
// AEConfig.init( configFile );
// FacadeConfig.init( facadeFile );
//
// this.exportConfig = new ForgeExportConfig( recipeConfiguration );
//
// AELog.info( "Pre Initialization ( started )" );
//
//
@@ -286,35 +287,6 @@ public final class AppEng
thread.start();
}
// @EventHandler
// private void init( final FMLCommonSetupEvent event )
// {
// final Stopwatch start = Stopwatch.createStarted();
// AELog.info( "Initialization ( started )" );
//
// AppEng.proxy.init();
//
// if( this.exportConfig.isExportingItemNamesEnabled() )
// {
// if( FMLCommonHandler.instance().getSide().isClient() )
// {
// final ExportProcess process = new ExportProcess( this.configDirectory, this.exportConfig );
// final Thread exportProcessThread = new Thread( process );
//
// this.startService( "AE2 CSV Export", exportProcessThread );
// }
// else
// {
// AELog.info( "Disabling item.csv export for custom recipes, since creative tab information is only available on the client." );
// }
// }
//
// this.registration.initialize( event, this.configDirectory );
// IntegrationRegistry.INSTANCE.init();
//
// AELog.info( "Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
// }
private void registerNetworkHandler()
{
final Stopwatch start = Stopwatch.createStarted();
+10 -28
View File
@@ -36,6 +36,7 @@ import appeng.api.networking.security.ISecurityGrid;
import appeng.api.networking.spatial.ISpatialCache;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.ITickManager;
import appeng.bootstrap.ICriterionTriggerRegistry;
import appeng.bootstrap.IModelRegistry;
import appeng.bootstrap.components.*;
import appeng.client.gui.implementations.GuiCellWorkbench;
@@ -86,6 +87,7 @@ import appeng.core.features.registries.PartModels;
import appeng.core.features.registries.cell.BasicCellHandler;
import appeng.core.features.registries.cell.BasicItemCellGuiHandler;
import appeng.core.features.registries.cell.CreativeCellHandler;
import appeng.core.stats.AdvancementTriggers;
import appeng.core.stats.AeStats;
import appeng.core.stats.PartItemPredicate;
import appeng.fluids.client.gui.*;
@@ -97,6 +99,9 @@ import appeng.recipes.game.DisassembleRecipe;
import appeng.recipes.ingredients.PartIngredientSerializer;
import appeng.server.AECommand;
import appeng.tile.AEBaseTile;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.advancements.ICriterionInstance;
import net.minecraft.advancements.ICriterionTrigger;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager;
@@ -121,20 +126,24 @@ import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.fml.network.IContainerFactory;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import java.lang.reflect.Method;
final class Registration
{
public Registration() {
AeStats.register();
advancementTriggers = new AdvancementTriggers( CriteriaTriggers::register );
}
// DimensionType storageDimensionType;
// int storageDimensionID;
// Biome storageBiome;
// AdvancementTriggers advancementTriggers;
AdvancementTriggers advancementTriggers;
//
// void preInitialize( final FMLPreInitializationEvent event )
// {
@@ -237,8 +246,6 @@ final class Registration
} );
PartItemPredicate.register();
// FIXME Stats.register();
// FIXME this.advancementTriggers = new AdvancementTriggers( new CriterionTrigggerRegistry() );
}
// @SubscribeEvent
@@ -871,31 +878,6 @@ final class Registration
// {
// ModelLoader.setCustomStateMapper( block, mapper );
// }
// }
//
// private static class CriterionTrigggerRegistry implements ICriterionTriggerRegistry
// {
// private Method method;
//
// CriterionTrigggerRegistry()
// {
// this.method = ReflectionHelper.findMethod( CriteriaTriggers.class, "register", "func_192118_a", ICriterionTrigger.class );
// this.method.setAccessible( true );
// }
//
// @Override
// public void register( ICriterionTrigger<? extends ICriterionInstance> trigger )
// {
// try
// {
// this.method.invoke( null, trigger );
// }
// catch( IllegalAccessException | IllegalArgumentException | InvocationTargetException e )
// {
// AELog.debug( e );
// }
// }
//
// }
public void registerTextures(TextureStitchEvent.Pre event) {
@@ -27,10 +27,7 @@ import appeng.api.features.AEFeature;
import appeng.client.render.crafting.EncodedPatternRenderer;
import appeng.client.render.crafting.ItemEncodedPatternRendering;
import appeng.core.CreativeTabFacade;
import appeng.debug.ToolDebugCard;
import appeng.debug.ToolEraser;
import appeng.debug.ToolMeteoritePlacer;
import appeng.debug.ToolReplicatorCard;
import appeng.debug.*;
import appeng.entity.EntityGrowingCrystal;
import appeng.fluids.items.BasicFluidStorageCell;
import appeng.fluids.items.FluidDummyItem;
@@ -310,6 +307,7 @@ public final class ApiItems implements IItems
this.toolMeteoritePlacer = debugTools.item( "debug_meteorite_placer", ToolMeteoritePlacer::new ).build();
this.toolDebugCard = debugTools.item( "debug_card", ToolDebugCard::new ).build();
this.toolReplicatorCard = debugTools.item( "debug_replicator_card", ToolReplicatorCard::new ).build();
debugTools.item( "debug_part_placer", ToolDebugPartPlacer::new ).build();
this.dummyFluidItem = registry.item( "dummy_fluid_item", FluidDummyItem::new ).rendering( new FluidDummyItemRendering() ).build();
}
@@ -25,6 +25,7 @@ import appeng.api.parts.IPart;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
import appeng.bootstrap.FeatureFactory;
import appeng.client.render.cablebus.P2PTunnelFrequencyModel;
import appeng.core.AppEng;
import appeng.core.CreativeTab;
import appeng.core.features.*;
@@ -145,71 +146,8 @@ public final class ApiParts implements IParts
private void registerPartModels(PartModels partModels) {
// Register the built-in models for annihilation planes
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/annihilation_plane" );
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );
ResourceLocation fluidAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_annihilation_plane" );
ResourceLocation fluidAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_annihilation_plane_on" );
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/identity_annihilation_plane" );
ResourceLocation identityAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/identity_annihilation_plane_on" );
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/formation_plane" );
ResourceLocation formationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/formation_plane_on" );
ResourceLocation fluidFormationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_formation_plane" );
ResourceLocation fluidFormationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_formation_plane_on" );
ResourceLocation sidesTexture = new ResourceLocation( AppEng.MOD_ID, "parts/plane_sides" );
ResourceLocation backTexture = new ResourceLocation( AppEng.MOD_ID, "parts/transition_plane_back" );
List<String> modelNames = new ArrayList<>();
// FIXME for( PlaneConnections connection : PlaneConnections.PERMUTATIONS )
// FIXME {
// FIXME PlaneModel model = new PlaneModel( annihilationPlaneTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/annihilation_plane_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/annihilation_plane_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( annihilationPlaneOnTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/annihilation_plane_on_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/annihilation_plane_on_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( fluidAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/fluid_annihilation_plane_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/fluid_annihilation_plane_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( fluidAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( identityAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/identity_annihilation_plane_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/identity_annihilation_plane_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( identityAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/identity_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/identity_annihilation_plane_on_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( formationPlaneTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/formation_plane_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/formation_plane_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( formationPlaneOnTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/formation_plane_on_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/formation_plane_on_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( fluidFormationPlaneTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/fluid_formation_plane_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/fluid_formation_plane_" + connection.getFilenameSuffix() );
// FIXME
// FIXME model = new PlaneModel( fluidFormationPlaneOnTexture, sidesTexture, backTexture, connection );
// FIXME rendering.builtInModel( "models/part/fluid_formation_plane_on_" + connection.getFilenameSuffix(), model );
// FIXME modelNames.add( "part/fluid_formation_plane_on_" + connection.getFilenameSuffix() );
// FIXME }
// FIXME
// FIXME // base p2p model with frequency
// FIXME rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
List<ResourceLocation> partResourceLocs = modelNames.stream()
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
.collect( Collectors.toList() );
partModels.registerModels( partResourceLocs );
// Register all part models
for( PartType partType : PartType.values() )
@@ -91,17 +91,6 @@ public enum GuiText
Inscriber,
QuartzCuttingKnife,
// tunnel names
METunnel,
ItemTunnel,
RedstoneTunnel,
EUTunnel,
FluidTunnel,
OCTunnel,
LightTunnel,
FETunnel,
PressureTunnel,
// spatial
StoredSize,
CellId,