From 8bb053d5db221a57cd840ce7aedc2f05c88b4a3e Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Fri, 19 Apr 2019 19:52:46 +0200 Subject: fixes +this time really fixed (#27) +added small rocket gui stuff +fixed a bug where the moon of ross128b would cause issues with the dim handler +added Electric Implosion Compressor recipe and tooltip +fixed Electric Implosion Compressor recipe "Map" Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: aeee7f250bedb4ea9b5fb2e4656ea01be48211e3 --- .../com/github/bartimaeusnek/ASM/BWCorePlugin.java | 2 + .../bartimaeusnek/ASM/BWCoreTransformer.java | 4 +- .../github/bartimaeusnek/bartworks/MainMod.java | 86 +++++++++------ .../bartworks/common/loaders/ItemRegistry.java | 5 +- .../bartworks/common/loaders/RecipeLoader.java | 21 +++- .../GT_TileEntity_ElectricImplosionCompressor.java | 12 ++- .../tileentities/multis/GT_TileEntity_THTR.java | 2 +- .../system/material/BW_MetaGenerated_Items.java | 2 - .../bartworks/system/oregen/BW_OreLayer.java | 3 - .../system/oregen/BW_WorldGenRoss128b.java | 1 - .../bartimaeusnek/crossmod/BartWorksCrossmod.java | 12 ++- .../crossmod/galacticraft/GalacticraftProxy.java | 21 ++++ .../planets/AbstractWorldProviderSpace.java | 5 + .../planets/ross128b/SkyProviderRoss128b.java | 4 +- .../planets/ross128ba/WorldProviderRoss128Ba.java | 117 +++++++++++++++++++++ .../planets/ross128ba/WorldProviderRoss128ba.java | 117 --------------------- .../solarsystems/Ross128SolarSystem.java | 11 +- .../resources/assets/bartworks/lang/en_US.lang | 3 + 18 files changed, 261 insertions(+), 167 deletions(-) create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128Ba.java delete mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java index 2093b6a092..64206d5e56 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java @@ -47,6 +47,8 @@ public class BWCorePlugin implements IFMLLoadingPlugin { minecraftDir = (File) FMLInjectionData.data()[6]; //do all the configuration already now... new ConfigHandler(new Configuration(new File(new File(minecraftDir, "config"), "bartworks.cfg"))); + //config Override if mods are missing. + new BWCoreTransformer().checkForMods(); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index c40faa0c98..b9b823bb89 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -47,7 +47,7 @@ public class BWCoreTransformer implements IClassTransformer { public static boolean[] shouldTransform = new boolean[CLASSESBEEINGTRANSFORMED.length]; - static { + public void checkForMods() { //hacky way to detect if the mods are loaded try{ Class.forName("com.rwtema.extrautils.worldgen.endoftime.WorldProviderEndOfTime"); @@ -58,7 +58,7 @@ public class BWCoreTransformer implements IClassTransformer { shouldTransform[1] = false; } try{ - Class.forName("micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld"); + Class.forName("micdoodle8.mods.galacticraft.core.Constants"); shouldTransform[2] = true; }catch (ClassNotFoundException e){ shouldTransform[2] = false; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 99ac6fda7e..522943fba4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -35,34 +35,46 @@ import com.github.bartimaeusnek.bartworks.common.loaders.BioLabLoader; import com.github.bartimaeusnek.bartworks.common.loaders.GTNHBlocks; import com.github.bartimaeusnek.bartworks.common.loaders.LoaderRegistry; import com.github.bartimaeusnek.bartworks.common.net.BW_Network; -import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_THTR; import com.github.bartimaeusnek.bartworks.system.log.DebugLog; import com.github.bartimaeusnek.bartworks.system.material.ThreadedLoader; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; +import com.github.bartimaeusnek.bartworks.util.BW_Util; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartedEvent; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.IOException; +import java.util.HashSet; + +import static com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor.eicMap; @Mod( modid = MainMod.MOD_ID, name = MainMod.NAME, version = MainMod.VERSION, dependencies = "required-after:IC2; " + "required-after:gregtech; " - + "after:berriespp;" -) + + "after:berriespp; " + + "after:GalacticraftMars; " + + "after:GalacticraftCore; " + ) public final class MainMod { public static final String NAME = "BartWorks"; public static final String VERSION = "@version@"; @@ -80,12 +92,14 @@ public final class MainMod { @Mod.EventHandler public void preInit(FMLPreInitializationEvent preinit) { - //fixing BorosilicateGlass... -_-' - Materials.BorosilicateGlass.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_RECYCLING, SubTag.SMELTING_TO_FLUID); + if (!(API_REFERENCE.VERSION.equals(APIVERSION))) { LOGGER.error("Something has loaded an old API. Please contact the Mod authors to update!"); } + //fixing BorosilicateGlass... -_-' + Materials.BorosilicateGlass.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_RECYCLING, SubTag.SMELTING_TO_FLUID); + if (Loader.isModLoaded("dreamcraft")) { ConfigHandler.GTNH = true; } @@ -138,31 +152,43 @@ public final class MainMod { else WerkstoffLoader.INSTANCE.run(); } - ConfigHandler.setUpComments(); } -// @Mod.EventHandler -// public void onServerStarted(FMLServerStartedEvent event) { -// eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet(GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList.size()), "gt.recipe.electricimplosioncompressor", "Electric Implosion Compressor", (String) null, "gregtech:textures/gui/basicmachines/Default", 1, 2, 1, 0, 1, "", 1, "", true, true); -// for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList) { -// if (recipe == null || recipe.mInputs == null) -// continue; -// ItemStack input = recipe.mInputs[0]; -// int i = 0; -// while (checkForExplosives(input)) { -// try { -// i++; -// input = recipe.mInputs[i]; -// } catch (ArrayIndexOutOfBoundsException e) { -// LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE."); -// e.printStackTrace(); -// } -// } -// eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, recipe.mDuration, BW_Util.getMachineVoltageFromTier(10), 0); -// } -// } -// -// private boolean checkForExplosives(ItemStack input) { -// return (GT_Utility.areStacksEqual(input, new ItemStack(Blocks.tnt)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("dynamite", 1L)) || GT_Utility.areStacksEqual(input, ItemList.Block_Powderbarrel.get(1L))); -// } + @Mod.EventHandler + public void onServerStarted(FMLServerStartedEvent event) { + eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet(GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList.size()), "gt.recipe.electricimplosioncompressor", "Electric Implosion Compressor", (String) null, "gregtech:textures/gui/basicmachines/Default", 1, 2, 1, 0, 1, "", 1, "", true, true); + recipeLoop: + for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList) { + if (recipe == null || recipe.mInputs == null) + continue; + try { + ItemStack input = recipe.mInputs[0]; + int i = 0; + float durMod = 0; + if (checkForExplosives(recipe.mInputs[1])) { + if (GT_Utility.areStacksEqual(recipe.mInputs[1], GT_ModHandler.getIC2Item("industrialTnt", 1L))) + durMod += ((float) input.stackSize * 2f); + else + continue recipeLoop; + } + while (checkForExplosives(input)) { + if (GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L))) + durMod += ((float) input.stackSize * 2f); + else + continue recipeLoop; + i++; + input = recipe.mInputs[i]; + } + + eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, (int)Math.floor(Math.max((float)recipe.mDuration*durMod,20f)), BW_Util.getMachineVoltageFromTier(10), 0); + } catch (ArrayIndexOutOfBoundsException e) { + LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE!"); + e.printStackTrace(); + } + } + } + + private boolean checkForExplosives(ItemStack input) { + return (GT_Utility.areStacksEqual(input, new ItemStack(Blocks.tnt)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("dynamite", 1L)) || GT_Utility.areStacksEqual(input, ItemList.Block_Powderbarrel.get(1L))); + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index ca12a39636..e5db33bc5c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -122,7 +122,7 @@ public class ItemRegistry { }, BWT), }; - public static ItemStack dehp; + public static ItemStack[] diode2A = new ItemStack[GT_Values.VN.length]; public static ItemStack[] diode4A = new ItemStack[GT_Values.VN.length]; public static ItemStack[] diode8A = new ItemStack[GT_Values.VN.length]; @@ -131,11 +131,14 @@ public class ItemRegistry { public static ItemStack[] energyDistributor = new ItemStack[GT_Values.VN.length]; public static ItemStack[] acidGens = new ItemStack[3]; public static ItemStack[] megaMachines = new ItemStack[2]; + public static ItemStack dehp; public static ItemStack thtr; + public static ItemStack eic; public static void run() { if (newStuff) { + eic=new GT_TileEntity_ElectricImplosionCompressor(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 6,"ElectricImplosionCompressor","Electric Implosion Compressor").getStackForm(1L); thtr=new GT_TileEntity_THTR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 5,"THTR","Thorium High Temperature Reactor").getStackForm(1L); GT_TileEntity_THTR.THTRMaterials.registeraTHR_Materials(); GameRegistry.registerBlock(ItemRegistry.bw_glasses[0], BW_ItemBlocks.class, "BW_GlasBlocks"); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java index 9c958e25fa..ffcddc4706 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -739,8 +739,27 @@ public class RecipeLoader implements Runnable { 'R',GT_ModHandler.getModItem("IC2","blockGenerator",1,5), 'Z',"circuitUltimate" } - ); + ); + GT_Values.RA.addAssemblylineRecipe( + ItemList.Machine_Multi_ImplosionCompressor.get(1L),24000, + new ItemStack[]{ + ItemList.Machine_Multi_ImplosionCompressor.get(1L), + Materials.Neutronium.getBlocks(5), + GT_OreDictUnificator.get(OrePrefixes.stickLong,Materials.Osmium,64), + GT_OreDictUnificator.get(OrePrefixes.ring,Materials.Osmium,64), + GT_OreDictUnificator.get(OrePrefixes.wireGt01,Materials.Superconductor,64), + ItemList.Electric_Piston_UV.get(64), + }, + new FluidStack[]{ + Materials.SolderingAlloy.getMolten(1440), + Materials.Osmium.getMolten(1440), + Materials.Neutronium.getMolten(1440) + }, + ItemRegistry.eic.copy(), + 240000, + BW_Util.getMachineVoltageFromTier(8) + ); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java index 74efa145e5..cd45301d4f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java @@ -22,6 +22,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; +import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -32,6 +33,7 @@ import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ImplosionCo import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -186,7 +188,7 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity IGregTechTileEntity te = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, z + zDir); if (y == -2 || y == 6) { if (!(x == 0 && z == 0)) { - if (!this.addMaintenanceToMachineList(te, 16) && !this.addMufflerToMachineList(te, 16) && !this.addInputToMachineList(te, 16) && !this.addOutputToMachineList(te, 16)) { + if (!this.addMaintenanceToMachineList(te, 16) && !this.addInputToMachineList(te, 16) && !this.addOutputToMachineList(te, 16)) { Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z); byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z); if ((tBlock != GregTech_API.sBlockCasings2 || tMeta != 0) && (tBlock != GregTech_API.sBlockCasings3 || tMeta != 4)) { @@ -248,6 +250,12 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity @Override public String[] getDescription() { - return new String[0]; + String[] dsc = StatCollector.translateToLocal("tooltip.tile.eic.0.name").split(";"); + String[] mDescription = new String[dsc.length + 1]; + for (int i = 0; i < dsc.length; i++) { + mDescription[i] = dsc[i]; + mDescription[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + } + return mDescription; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java index b21e97aead..501069b25d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java @@ -176,7 +176,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { // 0.01f, // ExplosionIC2.Type.Nuclear // ).doExplosion(); - return false; + toProduce=accessibleCoolant; } accessibleCoolant=toProduce; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java index d50081c9e9..f77c8ea745 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java @@ -23,7 +23,6 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -42,7 +41,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.OreDictionary; import java.util.List; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java index 92f42ad9e0..d5d13aea13 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java @@ -23,15 +23,12 @@ package com.github.bartimaeusnek.bartworks.system.oregen; import com.github.bartimaeusnek.bartworks.MainMod; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.world.GT_Worldgen; -import gregtech.common.blocks.GT_Block_Ores; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; import net.minecraft.init.Blocks; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java index a1535ff8f5..95a69f00b0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java @@ -63,7 +63,6 @@ public class BW_WorldGenRoss128b extends BW_OreLayer { uo_dimensionList.SetConfigValues(ross128b, ross128b, "veryheavyoil", "liquid_extra_heavy_oil", 0, 625, 40, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "lava", FluidRegistry.getFluidName(FluidRegistry.LAVA), 0, 32767, 5, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); - } @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index da78891b8c..65fbb0f6a7 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -28,6 +28,7 @@ import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import org.apache.logging.log4j.LogManager; @@ -38,7 +39,9 @@ import org.apache.logging.log4j.Logger; dependencies = "required-after:IC2; " + "required-after:gregtech; " + "required-after:bartworks;" - + "after:GalacticraftCore;" + + "after:GalacticraftMars; " + + "after:GalacticraftCore; " + + "after:Micdoodlecore; " ) public class BartWorksCrossmod { public static final String NAME = "BartWorks Mod Additions"; @@ -63,6 +66,13 @@ public class BartWorksCrossmod { GalacticraftProxy.init(init); } + @Mod.EventHandler + public void postInit(FMLPostInitializationEvent init) { + if (Loader.isModLoaded("GalacticraftCore")) + GalacticraftProxy.postInit(init); + } + + @Mod.EventHandler public void onFMLServerStart(FMLServerStartingEvent event) { event.registerServerCommand(new SummonRuin()); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java index a8c9a218b1..2c126759b8 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java @@ -26,6 +26,7 @@ import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gregtech.api.objects.GT_UO_DimensionList; import net.minecraftforge.common.config.Configuration; @@ -41,6 +42,15 @@ public class GalacticraftProxy { private GalacticraftProxy() { } + public static void postInit(FMLPostInitializationEvent e){ + if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()) { + GalacticraftProxy.serverPostInit(e); + } else { + GalacticraftProxy.clientPostInit(e); + } + GalacticraftProxy.commonPostInit(e); + } + public static void preInit(FMLPreInitializationEvent e) { if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()) { GalacticraftProxy.serverpreInit(e); @@ -87,4 +97,15 @@ public class GalacticraftProxy { if (ConfigHandler.Ross128Enabled) Ross128SolarSystem.init(); } + private static void serverPostInit(FMLPostInitializationEvent e) { + + } + + private static void clientPostInit(FMLPostInitializationEvent e) { + + } + + private static void commonPostInit(FMLPostInitializationEvent e) { + + } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java index c3b87bf15c..988920cae6 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java @@ -32,6 +32,11 @@ public abstract class AbstractWorldProviderSpace extends WorldProviderSpace impl return false; } + @Override + public String getDimensionName() { + return this.getCelestialBody().getLocalizedName(); + } + @Override public boolean hasSunset() { return true; diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java index 24c8e8573e..d575bd7dd8 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java @@ -23,11 +23,9 @@ package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; -import micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld; import net.minecraft.util.ResourceLocation; -public class SkyProviderRoss128b extends SkyProviderOverworld { - +public class SkyProviderRoss128b { //ASM enables this texture public static final ResourceLocation sunTex = new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/World/SunRoss128.png"); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128Ba.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128Ba.java new file mode 100644 index 0000000000..eeb306018c --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128Ba.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba; + +import com.github.bartimaeusnek.crossmod.galacticraft.planets.AbstractWorldProviderSpace; +import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; +import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; +import micdoodle8.mods.galacticraft.api.vector.Vector3; +import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerMoon; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.IChunkProvider; + +public class WorldProviderRoss128Ba extends AbstractWorldProviderSpace { + @Override + public Vector3 getFogColor() { + return new Vector3(0,0,0); + } + + @Override + public Vector3 getSkyColor() { + return new Vector3(0,0,0); + } + + @Override + public long getDayLength() { + return (long) Math.floor(24000f*9.9f/100f); + } + @Override + public boolean hasSunset() { + return false; + } + + @Override + public Class getChunkProviderClass() { + return ChunkProviderRoss128ba.class; + } + + @Override + public Class getWorldChunkManagerClass() { + return WorldChunkManagerMoon.class; + } + + @Override + public double getYCoordinateToTeleport() { + return 500; + } + + @Override + public float getGravity() { + return 0.060f; + } + + @Override + public double getMeteorFrequency() { + return 9D; + } + + @Override + public double getFuelUsageMultiplier() { + return 0.7D; + } + + @Override + public boolean canSpaceshipTierPass(int i) { + return i >= Ross128SolarSystem.Ross128ba.getTierRequirement(); + } + + @Override + public float getFallDamageModifier() { + return 0.2f; + } + + @Override + public float getSoundVolReductionAmount() { + return 20f; + } + + @Override + public float getThermalLevelModifier() { + return 0; + } + + @Override + public float getWindLevel() { + return 0; + } + + @Override + public CelestialBody getCelestialBody() { + return Ross128SolarSystem.Ross128ba; + } + + @Override + public double getSolarEnergyMultiplier() { + return 1.9D; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java deleted file mode 100644 index c28374d2ca..0000000000 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2019 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba; - -import com.github.bartimaeusnek.crossmod.galacticraft.planets.AbstractWorldProviderSpace; -import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; -import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; -import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerMoon; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; - -public class WorldProviderRoss128ba extends AbstractWorldProviderSpace { - @Override - public Vector3 getFogColor() { - return new Vector3(0,0,0); - } - - @Override - public Vector3 getSkyColor() { - return new Vector3(0,0,0); - } - - @Override - public long getDayLength() { - return (long) Math.floor(24000f*9.9f/100f); - } - @Override - public boolean hasSunset() { - return false; - } - - @Override - public Class getChunkProviderClass() { - return ChunkProviderRoss128ba.class; - } - - @Override - public Class getWorldChunkManagerClass() { - return WorldChunkManagerMoon.class; - } - - @Override - public double getYCoordinateToTeleport() { - return 500; - } - - @Override - public float getGravity() { - return 0.060f; - } - - @Override - public double getMeteorFrequency() { - return 9D; - } - - @Override - public double getFuelUsageMultiplier() { - return 0.7D; - } - - @Override - public boolean canSpaceshipTierPass(int i) { - return i >= Ross128SolarSystem.Ross128ba.getTierRequirement(); - } - - @Override - public float getFallDamageModifier() { - return 0.2f; - } - - @Override - public float getSoundVolReductionAmount() { - return 20f; - } - - @Override - public float getThermalLevelModifier() { - return 0; - } - - @Override - public float getWindLevel() { - return 0; - } - - @Override - public CelestialBody getCelestialBody() { - return Ross128SolarSystem.Ross128ba; - } - - @Override - public double getSolarEnergyMultiplier() { - return 1.9D; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java index 5035090c2e..c69ec74549 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java @@ -26,13 +26,16 @@ import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.github.bartimaeusnek.crossmod.galacticraft.UniversalTeleportType; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b.WorldProviderRoss128b; -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba.WorldProviderRoss128ba; +import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba.WorldProviderRoss128Ba; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.galaxies.*; import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas; +import micdoodle8.mods.galacticraft.core.GalacticraftCore; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.DimensionManager; import java.util.Arrays; @@ -67,7 +70,7 @@ public class Ross128SolarSystem { Ross128SolarSystem.Ross128ba = new Moon("Ross128ba").setParentPlanet(Ross128SolarSystem.Ross128b); Ross128SolarSystem.Ross128ba.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(10f, 15f)).setRelativeOrbitTime(1 / 0.01F); Ross128SolarSystem.Ross128ba.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128ba.png")); - Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128ba.class); +// Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128Ba.class); Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? 5 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); Ross128SolarSystem.Ross128ba.setUnreachable(); @@ -75,8 +78,10 @@ public class Ross128SolarSystem { GalaxyRegistry.registerPlanet(Ross128SolarSystem.Ross128b); GalaxyRegistry.registerMoon(Ross128SolarSystem.Ross128ba); GalaxyRegistry.registerSolarSystem(Ross128SolarSystem.Ross128System); + GalacticraftRegistry.registerRocketGui(WorldProviderRoss128b.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/overworldRocketGui.png")); +// GalacticraftRegistry.registerRocketGui(WorldProviderRoss128Ba.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/moonRocketGui.png")); GalacticraftRegistry.registerTeleportType(WorldProviderRoss128b.class, new UniversalTeleportType()); - GalacticraftRegistry.registerTeleportType(WorldProviderRoss128ba.class, new UniversalTeleportType()); +// GalacticraftRegistry.registerTeleportType(WorldProviderRoss128Ba.class, new UniversalTeleportType()); } } diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index d035c87472..73a58a4c64 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -153,6 +153,9 @@ item.TRISOPelletCompound.name=TRISO pebble compund item.BISOPelletCompound.name=BISO pebble compund itemGroup.bartworksMetaMaterials=BartWorks' Meta Materials +tooltip.tile.eic.0.name=Controller Block for the Electric Implosion Compressor;Size(WxHxD): 3x9x3;Uses Electricity instead of Explosives;Controller: Layer 3, front, center;Layer 1 and Layer 9: Solid Steel Machine Casings, each: 1 Energy Hatch in the middle;Layer 2,3,7,8: Middle: Nickel-Zinc-Ferrit Blocks, Outer: Transformer-Winding Blocks;Layer 4,5,6: Neutronium Blocks;1+ Input Bus, 1+ Output Bus, 1 Maintenance Hatch at any Solid Steel Machine Casing;Do NOT Obstruct or mine the Moving parts while in Operation, will explode if you do so! + + planet.Ross128b=Ross128b moon.Ross128ba=Ross128ba star.Ross128=Ross128 -- cgit From 59990f3d91daca43b94522dc6a230147c1b82fc6 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Fri, 19 Apr 2019 20:08:04 +0200 Subject: moved Ross128 to t3 even with galaxyspace loaded Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: 88669e848a7482e79eb6874023bc0eba3214ef4f --- .../crossmod/galacticraft/solarsystems/Ross128SolarSystem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java index c69ec74549..7f9befe058 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java @@ -65,13 +65,13 @@ public class Ross128SolarSystem { Ross128SolarSystem.Ross128b.setRelativeOrbitTime(0.65F); Ross128SolarSystem.Ross128b.atmosphere.addAll(Arrays.asList(IAtmosphericGas.OXYGEN, IAtmosphericGas.NITROGEN, IAtmosphericGas.ARGON)); Ross128SolarSystem.Ross128b.setDimensionInfo(ConfigHandler.ross128BID, WorldProviderRoss128b.class); - Ross128SolarSystem.Ross128b.setTierRequired(Loader.isModLoaded("galaxyspace") ? 4 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); + Ross128SolarSystem.Ross128b.setTierRequired(3); Ross128SolarSystem.Ross128ba = new Moon("Ross128ba").setParentPlanet(Ross128SolarSystem.Ross128b); Ross128SolarSystem.Ross128ba.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(10f, 15f)).setRelativeOrbitTime(1 / 0.01F); Ross128SolarSystem.Ross128ba.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128ba.png")); // Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128Ba.class); - Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? 5 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); + Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? 4 : 3); Ross128SolarSystem.Ross128ba.setUnreachable(); -- cgit From 0d29c70baf147ca9ea3281b095ffe98558a674f3 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Fri, 19 Apr 2019 21:46:22 +0200 Subject: fixes +fixes crash when ExU is installed +version increase Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: 09bd3c16b90946f3e737329aafc5d85726a15725 --- src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index b9b823bb89..41c1164db4 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -50,7 +50,7 @@ public class BWCoreTransformer implements IClassTransformer { public void checkForMods() { //hacky way to detect if the mods are loaded try{ - Class.forName("com.rwtema.extrautils.worldgen.endoftime.WorldProviderEndOfTime"); + Class.forName("com.rwtema.extrautils.core.Tuple"); shouldTransform[0] = true; shouldTransform[1] = true; }catch (ClassNotFoundException e){ -- cgit From a80b6ce33747bbf63fb26ccc4ee6252f2ac099c4 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Sun, 21 Apr 2019 23:11:49 +0200 Subject: fixes +Optimised BlockChecker +made THTR structure check NOT ignore walls +corrected tooltip on THTR +added Empty mode on THTR +fixed coords hash +started work on OC integration +rewrote blockchecker just to see if a loop would be faster than a recursive check +version increase Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: 9cad6f0b7ab2d3fafa413b515baa405c8961cce5 --- .../tileentities/multis/GT_TileEntity_LESU.java | 3 +- .../tileentities/multis/GT_TileEntity_THTR.java | 56 +++++--- .../bartworks/util/ConnectedBlocksChecker.java | 49 +++---- .../util/ConnectedBlocksCheckerIteration.java | 143 +++++++++++++++++++++ .../bartimaeusnek/bartworks/util/Coords.java | 28 ++-- .../crossmod/openComputers/GT_NBT_DataBase.java | 88 +++++++++++++ .../openComputers/TileEntity_GTDataServer.java | 122 ++++++++++++++++++ .../resources/assets/bartworks/lang/en_US.lang | 2 +- 8 files changed, 437 insertions(+), 54 deletions(-) create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/openComputers/GT_NBT_DataBase.java create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/openComputers/TileEntity_GTDataServer.java (limited to 'src') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java index 42eeada394..471373e3dd 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java @@ -397,8 +397,9 @@ public class GT_TileEntity_LESU extends GT_MetaTileEntity_MultiBlockBase { this.getBaseMetaTileEntity().setActive(true); long finishedTime = System.nanoTime(); + //System.out.println("LESU LookUp: "+((finishedTime - startingTime) / 1000000)+"ms"); if (finishedTime - startingTime > 5000000) - MainMod.LOGGER.warn("LESU LookUp took longer than 5ms!(" + (finishedTime - startingTime) + "ns / " + ((finishedTime - startingTime) / 1000000) + "ms) Check at x:" + this.getBaseMetaTileEntity().getXCoord() + " y:" + this.getBaseMetaTileEntity().getYCoord() + " z:" + this.getBaseMetaTileEntity().getZCoord() + " DIM-ID: " + this.getBaseMetaTileEntity().getWorld().provider.dimensionId); + MainMod.LOGGER.warn("LESU LookUp took longer than 5ms!(" + (finishedTime - startingTime) + "ns / " + ((finishedTime - startingTime) / 1000000) + "ms) Owner:"+this.getBaseMetaTileEntity().getOwnerName()+" Check at x:" + this.getBaseMetaTileEntity().getXCoord() + " y:" + this.getBaseMetaTileEntity().getYCoord() + " z:" + this.getBaseMetaTileEntity().getZCoord() + " DIM-ID: " + this.getBaseMetaTileEntity().getWorld().provider.dimensionId); return true; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java index 501069b25d..193a1ffacb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java @@ -41,6 +41,7 @@ import gregtech.api.objects.XSTR; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; @@ -57,6 +58,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { private int HeliumSupply; private int BISOPeletSupply; private int TRISOPeletSupply; + private boolean empty; public GT_TileEntity_THTR(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -77,6 +79,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { HeliumSupply=aNBT.getInteger("HeliumSupply"); BISOPeletSupply=aNBT.getInteger("BISOPeletSupply"); TRISOPeletSupply=aNBT.getInteger("TRISOPeletSupply"); + empty=aNBT.getBoolean("EmptyMode"); } @Override @@ -85,6 +88,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { aNBT.setInteger("HeliumSupply",HeliumSupply); aNBT.setInteger("BISOPeletSupply",BISOPeletSupply); aNBT.setInteger("TRISOPeletSupply",TRISOPeletSupply); + aNBT.setBoolean("EmptyMode",empty); } @Override @@ -155,6 +159,17 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { @Override public boolean onRunningTick(ItemStack aStack) { + + if (empty){ + this.addOutput(Materials.Helium.getGas(HeliumSupply)); + this.addOutput(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials, TRISOPeletSupply, 3)); + this.addOutput(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials, BISOPeletSupply, 1)); + this.HeliumSupply = 0; + this.TRISOPeletSupply = 0; + this.BISOPeletSupply = 0; + return true; + } + long accessibleCoolant = 0; long toProduce=0; for (FluidStack fluidStack : this.getStoredFluids()) { @@ -198,16 +213,17 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4; - for (int x = -4; x <= 4; x++) { - for (int z = -4; z <= 4; z++) { + final byte xz = 5; + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * xz; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * xz; + for (int x = -xz; x <= xz; x++) { + for (int z = -xz; z <= xz; z++) { for (int y = 0; y < 12; y++) { if (y == 0 || y == 11) { if ( - !((Math.abs(z) == 3 && Math.abs(x) == 4)) && - !((Math.abs(z) == 4 && Math.abs(x) == 3)) && - !((Math.abs(x) == Math.abs(z) && Math.abs(x) == 4)) + !((Math.abs(z) == xz-1 && Math.abs(x) == xz)) && + !((Math.abs(z) == xz && Math.abs(x) == xz-1)) && + !((Math.abs(x) == Math.abs(z) && Math.abs(x) == xz)) ) { if (x + xDir == 0 && y == 0 && z + zDir == 0) continue; @@ -223,10 +239,18 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { } } } - else if (!((Math.abs(x) == 4 && Math.abs(z) == 4) || (Math.abs(x) == 3 && Math.abs(z) == 3)) && !(Math.abs(x) < 3 || Math.abs(z) < 3) && !((Math.abs(x) == Math.abs(z) && Math.abs(x) == 3) || Math.abs(x) == 4 || Math.abs(z) == 4)) { - if (!(aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) == 12)) { + + +// else if (!((Math.abs(x) == 4 && Math.abs(z) == 4) || (Math.abs(x) == 3 && Math.abs(z) == 3)) && !(Math.abs(x) < 3 || Math.abs(z) < 3) && !((Math.abs(x) == Math.abs(z) && Math.abs(x) == 3) || Math.abs(x) == 4 || Math.abs(z) == 4)) { + else if (!((Math.abs(z) == xz-1 && Math.abs(x) == xz))) + if (!((Math.abs(z) == xz && Math.abs(x) == xz-1))) + if (!((Math.abs(x) == Math.abs(z) && Math.abs(x) == xz))) + if (!(Math.abs(x) < xz && Math.abs(z) != xz)) + + { + if (!(aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) == 12)) { if ( - !this.addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), BASECASINGINDEX)) + !this.addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), BASECASINGINDEX)) { return false; } @@ -237,10 +261,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { } - if (this.mMaintenanceHatches.size() != 1) - return false; - - return true; + return this.mMaintenanceHatches.size() == 1; } @Override @@ -276,7 +297,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { "BISO-Pebbles:", this.BISOPeletSupply + "pcs.", "TRISO-Pebbles:", this.TRISOPeletSupply + "pcs.", "Helium-Level:", this.HeliumSupply+"L / "+HELIUM_NEEDED+"L", - "Coolant/sec:", this.BISOPeletSupply+this.TRISOPeletSupply >= 100000 ? (long) ((0.03471*(float)this.TRISOPeletSupply + 0.0267*(float)this.BISOPeletSupply))+"L/t" : "0L/t", + "Coolant/t:", this.BISOPeletSupply+this.TRISOPeletSupply >= 100000 ? (long) ((0.03471*(float)this.TRISOPeletSupply + 0.0267*(float)this.BISOPeletSupply))+"L/t" : "0L/t", "Problems:", String.valueOf(this.getIdealStatus() - this.getRepairStatus()) }; } @@ -297,6 +318,11 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { return aSide == aFacing ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[BASECASINGINDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)} : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[BASECASINGINDEX]}; } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + empty = !empty; + GT_Utility.sendChatToPlayer(aPlayer,empty ? "THTR will now empty itself." : "THTR is back in normal Operation"); + } public static class THTRMaterials{ static final SimpleSubItemClass aTHTR_Materials = new SimpleSubItemClass("BISOPelletCompound","BISOPellet","TRISOPelletCompound","TRISOPellet","BISOPelletBall","TRISOPelletBall"); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java index e1502041ed..1a0f189fd7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java @@ -29,22 +29,17 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import java.util.HashSet; +import java.util.LinkedHashSet; public class ConnectedBlocksChecker { - public final HashSet hashset = new HashSet(); + public final HashSet hashset = new HashSet(2048); public static byte check_sourroundings(Coords C, Block b) { byte ret = 0; World w = DimensionManager.getWorld(C.wID); int x = C.x, y = C.y, z = C.z; - if (w.getBlock(x, y + 1, z).equals(b)) - ret = (byte) (ret | 0b000001); - - if (w.getBlock(x, y - 1, z).equals(b)) - ret = (byte) (ret | 0b000010); - if (w.getBlock(x + 1, y, z).equals(b)) ret = (byte) (ret | 0b000100); @@ -57,6 +52,13 @@ public class ConnectedBlocksChecker { if (w.getBlock(x, y, z - 1).equals(b)) ret = (byte) (ret | 0b100000); + if (w.getBlock(x, y + 1, z).equals(b)) + ret = (byte) (ret | 0b000001); + + if (w.getBlock(x, y - 1, z).equals(b)) + ret = (byte) (ret | 0b000010); + + return ret; } @@ -67,16 +69,6 @@ public class ConnectedBlocksChecker { byte sides = check_sourroundings(w, x, y, z, b); - if (((sides | 0b111110) == 0b111111) && !hashset.contains(new Coords(x, y + 1, z, wID))) { - ret++; - ret += get_connected(w, x, y + 1, z, b); - } - - if (((sides | 0b111101) == 0b111111) && !hashset.contains(new Coords(x, y - 1, z, wID))) { - ret++; - ret += get_connected(w, x, y - 1, z, b); - } - if (((sides | 0b111011) == 0b111111) && !hashset.contains(new Coords(x + 1, y, z, wID))) { ret++; ret += get_connected(w, x + 1, y, z, b); @@ -97,6 +89,17 @@ public class ConnectedBlocksChecker { ret += get_connected(w, x, y, z - 1, b); } + + if (((sides | 0b111110) == 0b111111) && !hashset.contains(new Coords(x, y + 1, z, wID))) { + ret++; + ret += get_connected(w, x, y + 1, z, b); + } + + if (((sides | 0b111101) == 0b111111) && !hashset.contains(new Coords(x, y - 1, z, wID))) { + ret++; + ret += get_connected(w, x, y - 1, z, b); + } + return ret; } @@ -110,12 +113,6 @@ public class ConnectedBlocksChecker { hashset.add(new Coords(x, y, z, wID)); - if (w.getBlock(x, y + 1, z).equals(b)) - ret = (byte) (ret | 0b000001); - - if (w.getBlock(x, y - 1, z).equals(b)) - ret = (byte) (ret | 0b000010); - if (w.getBlock(x + 1, y, z).equals(b)) ret = (byte) (ret | 0b000100); @@ -128,6 +125,12 @@ public class ConnectedBlocksChecker { if (w.getBlock(x, y, z - 1).equals(b)) ret = (byte) (ret | 0b100000); + if (w.getBlock(x, y + 1, z).equals(b)) + ret = (byte) (ret | 0b000001); + + if (w.getBlock(x, y - 1, z).equals(b)) + ret = (byte) (ret | 0b000010); + return ret; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java new file mode 100644 index 0000000000..707b374888 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.util; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Queue; + + +/** + * This implementation is for some reason slower than the Recursive Check.... + * For ~3400 blocks this takes 8ms, the Recursive Check 5ms. + */ +public class ConnectedBlocksCheckerIteration { + + public final HashSet hashset = new HashSet(2048); + public final HashSet checked = new HashSet(4096); + private final Queue kwoe = new LinkedList(); + + public long get_connected(World w, int x, int y, int z, Block b){ + kwoe.add(new Coords(x,y,z,w.provider.dimensionId)); + hashset.add(new Coords(x,y,z,w.provider.dimensionId)); + while (!kwoe.isEmpty()){ + Coords tocheck = kwoe.poll(); + int wID = w.provider.dimensionId; + checked.add(tocheck); + Coords c; + if (!checked.contains(c = new Coords(tocheck.x + 1, tocheck.y, tocheck.z, wID)) && w.getBlock(tocheck.x + 1, tocheck.y, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x - 1, tocheck.y, tocheck.z, wID)) && w.getBlock(tocheck.x - 1, tocheck.y, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y, tocheck.z + 1, wID)) && w.getBlock(tocheck.x, tocheck.y, tocheck.z + 1).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y, tocheck.z - 1, wID)) && w.getBlock(tocheck.x, tocheck.y, tocheck.z - 1).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y + 1, tocheck.z, wID)) && w.getBlock(tocheck.x, tocheck.y + 1, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y - 1, tocheck.z, wID)) && w.getBlock(tocheck.x, tocheck.y - 1, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + } + return hashset.size(); + } + + public boolean get_meta_of_sideblocks(World w, int n, int[] xyz, boolean GT) { + + int wID = w.provider.dimensionId; + Coords Controller = new Coords(xyz[0], xyz[1], xyz[2], wID); + + for (Coords C : hashset) { + if (GT) { + TileEntity t; + t = w.getTileEntity(C.x, C.y + 1, C.z); + if (t != null && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x, C.y - 1, C.z); + if (t != null && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x + 1, C.y, C.z); + if (t != null && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x - 1, C.y, C.z); + if (t != null && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x, C.y, C.z + 1); + if (t != null && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x, C.y, C.z - 1); + if (t != null && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + } else { + if (n == w.getBlockMetadata(C.x, C.y + 1, C.z) && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x, C.y - 1, C.z) && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x + 1, C.y, C.z) && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x - 1, C.y, C.z) && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockM