fixing false flag crash report from other mods source crashes

added new method of adding port types from other mods
This commit is contained in:
ticticboooom
2021-07-17 00:15:14 +01:00
parent 4c9dc49969
commit 2adef9be79
7 changed files with 14 additions and 45 deletions

View File

@@ -21,7 +21,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.spongepowered.mixin'
version = '1.16.5-0.1.50-B' + getVersionNumber() version = '1.16.5-0.1.52-B' + getVersionNumber()
group = 'com.ticticboooom.mods.mm' // http://maven.apache.org/guides/mini/guide-naming-conventions.html group = 'com.ticticboooom.mods.mm' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'MasterfulMachinery' archivesBaseName = 'MasterfulMachinery'
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8. java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.

View File

@@ -11,8 +11,6 @@ import com.ticticboooom.mods.mm.client.screen.ControllerBlockContainerScreen;
import com.ticticboooom.mods.mm.client.screen.PortBlockContainerScreen; import com.ticticboooom.mods.mm.client.screen.PortBlockContainerScreen;
import com.ticticboooom.mods.mm.client.screen.StructureGenBlockContainerScreen; import com.ticticboooom.mods.mm.client.screen.StructureGenBlockContainerScreen;
import com.ticticboooom.mods.mm.client.ter.StructureGenTileEntityRenderer; import com.ticticboooom.mods.mm.client.ter.StructureGenTileEntityRenderer;
import com.ticticboooom.mods.mm.event.MMPortEventHandler;
import com.ticticboooom.mods.mm.event.MMPortRegistrationEvent;
import com.ticticboooom.mods.mm.datagen.MMPackFinder; import com.ticticboooom.mods.mm.datagen.MMPackFinder;
import com.ticticboooom.mods.mm.datagen.DataGeneratorFactory; import com.ticticboooom.mods.mm.datagen.DataGeneratorFactory;
import com.ticticboooom.mods.mm.datagen.PackType; import com.ticticboooom.mods.mm.datagen.PackType;
@@ -25,6 +23,7 @@ import com.ticticboooom.mods.mm.registration.MMLoader;
import com.ticticboooom.mods.mm.registration.MMPorts; import com.ticticboooom.mods.mm.registration.MMPorts;
import com.ticticboooom.mods.mm.registration.MMSetup; import com.ticticboooom.mods.mm.registration.MMSetup;
import com.ticticboooom.mods.mm.registration.RecipeTypes; import com.ticticboooom.mods.mm.registration.RecipeTypes;
import lombok.SneakyThrows;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager; import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
@@ -37,6 +36,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoader;
import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
@@ -59,8 +59,10 @@ public class MM {
private static boolean hasGenerated = false; private static boolean hasGenerated = false;
private static MM instance; private static MM instance;
@SneakyThrows
public MM() { public MM() {
instance = this; instance = this;
MMPorts.init();
DataGeneratorFactory.init(); DataGeneratorFactory.init();
PacketHandler.init(); PacketHandler.init();
registerDataGen(); registerDataGen();
@@ -99,6 +101,9 @@ public class MM {
public static void generate() { public static void generate() {
if (!hasGenerated) { if (!hasGenerated) {
try { try {
if (!ModLoader.isLoadingStateValid()){
return;
}
instance.generator.run(); instance.generator.run();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@@ -35,6 +35,9 @@ public class MMLangProvider extends LanguageProvider {
} }
} }
if (!MMSetup.BLUEPRINT.isPresent()){
return;
}
this.add(MMSetup.BLUEPRINT.get(), "Blueprint"); this.add(MMSetup.BLUEPRINT.get(), "Blueprint");
this.add(MMSetup.STRUCTURE_DEVICE.get(), "Structure Scanner"); this.add(MMSetup.STRUCTURE_DEVICE.get(), "Structure Scanner");
this.add(MMSetup.PROJECTOR_BLOCK.get(), "Structure Projector"); this.add(MMSetup.PROJECTOR_BLOCK.get(), "Structure Projector");

View File

@@ -1,19 +1,14 @@
package com.ticticboooom.mods.mm.event; package com.ticticboooom.mods.mm.event;
import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.registration.MMLoader; import com.ticticboooom.mods.mm.registration.MMLoader;
import com.ticticboooom.mods.mm.registration.MMPorts;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent; import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod.EventBusSubscriber(modid = MM.ID, bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class ConstructEventHandler { public class ConstructEventHandler {
@SubscribeEvent @SubscribeEvent
public static void onConstruct(FMLConstructModEvent event) { public static void onConstruct(FMLConstructModEvent event) {
FMLJavaModLoadingContext.get().getModEventBus().post(new MMPortRegistrationEvent(MMPorts.PORTS));
MMLoader.load(); MMLoader.load();
} }
} }

View File

@@ -1,15 +0,0 @@
package com.ticticboooom.mods.mm.event;
import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.registration.MMPorts;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(modid = MM.ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class MMPortEventHandler {
@SubscribeEvent
public static void onMMPorts(MMPortRegistrationEvent event) {
MMPorts.init();
}
}

View File

@@ -1,19 +0,0 @@
package com.ticticboooom.mods.mm.event;
import com.ticticboooom.mods.mm.ports.MasterfulPortType;
import lombok.Getter;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.lifecycle.IModBusEvent;
import java.util.Map;
public class MMPortRegistrationEvent extends Event implements IModBusEvent {
@Getter
private Map<ResourceLocation, MasterfulPortType> portsMap;
public MMPortRegistrationEvent(Map<ResourceLocation, MasterfulPortType> portsMap) {
this.portsMap = portsMap;
}
}

View File

@@ -1,2 +1,2 @@
#Tue Jul 13 16:42:54 BST 2021 #Sat Jul 17 00:12:57 BST 2021
VERSION_CODE=639 VERSION_CODE=658