diff --git a/dependencies.gradle b/dependencies.gradle index 1926590..af43c71 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,6 +1,7 @@ dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.68:dev') - api('com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.96-GTNH:dev') - api('com.github.GTNewHorizons:GTNHLib:0.5.20:dev') - compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.78:dev") {transitive = false} + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.93:dev') + api('com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.97-GTNH:dev') + api('com.github.GTNewHorizons:GTNHLib:0.5.21:dev') + compileOnly('com.github.GTNewHorizons:BlockRenderer6343:1.2.15:dev') {transitive = false} + compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.82:dev") {transitive = false} } diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/GTNHIntergalactic.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/GTNHIntergalactic.java index b8e94eb..554ddde 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/GTNHIntergalactic.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/GTNHIntergalactic.java @@ -7,7 +7,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.gtnewhorizon.gtnhlib.config.ConfigException; +import com.gtnewhorizon.gtnhlib.config.ConfigurationManager; import com.gtnewhorizons.gtnhintergalactic.block.IGBlocks; +import com.gtnewhorizons.gtnhintergalactic.config.IGConfig; import com.gtnewhorizons.gtnhintergalactic.item.IGItems; import com.gtnewhorizons.gtnhintergalactic.proxy.CommonProxy; @@ -26,7 +29,7 @@ acceptedMinecraftVersions = "[1.7.10]", dependencies = "required-after:GalacticraftCore@[3.0.36,);" + "required-after:GalacticraftMars;" + "required-after:gregtech;" - + "required-after:gtnhlib@[0.3.3,);" + + "required-after:gtnhlib@[0.5.21,);" + "required-after:tectech;" + "required-after:structurelib;" + "required-after:GalaxySpace;" @@ -38,6 +41,14 @@ + "after:IronChest;") public class GTNHIntergalactic { + static { + try { + ConfigurationManager.registerConfig(IGConfig.class); + } catch (ConfigException e) { + throw new RuntimeException(e); + } + } + /** Logger used by this mod */ public static final Logger LOG = LogManager.getLogger(Tags.MODID); /** Prefix for assets */ diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/TooltipUtil.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/TooltipUtil.java index 30338b7..5a944ac 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/TooltipUtil.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/TooltipUtil.java @@ -4,10 +4,7 @@ import java.util.function.Supplier; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.SimpleReloadableResourceManager; - -import com.gtnewhorizons.gtnhintergalactic.client.lore.LoreHandler; +import com.gtnewhorizon.gtnhlib.client.tooltip.LoreHandler; import com.gtnewhorizons.gtnhintergalactic.item.IGItems; import com.gtnewhorizons.gtnhintergalactic.tile.multi.TileEntityPlanetaryGasSiphon; import com.gtnewhorizons.gtnhintergalactic.tile.multi.elevator.TileEntitySpaceElevator; @@ -23,8 +20,6 @@ public class TooltipUtil { * Initialize the tooltip utilities */ public static void postInit() { - ((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) - .registerReloadListener(new LoreHandler()); LoreHandler.registerLoreHolder(TileEntityPlanetaryGasSiphon.class); LoreHandler.registerLoreHolder(TileEntitySpaceElevator.class); diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/lore/LoreHandler.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/lore/LoreHandler.java deleted file mode 100644 index 4f3adbe..0000000 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/lore/LoreHandler.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.gtnewhorizons.gtnhintergalactic.client.lore; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.util.StatCollector; -import net.minecraft.util.WeightedRandom; - -import org.apache.commons.lang3.StringUtils; - -import com.gtnewhorizons.gtnhintergalactic.GTNHIntergalactic; - -import gregtech.api.objects.XSTR; - -/** - * Helper class for providing random, localized Strings to fields annotated with {@link LoreHolder}. - * - * @since 1.0.0 - * @author glowredman - */ -public class LoreHandler implements IResourceManagerReloadListener { - - /** - * key: field to be updated; value: translation key to use - */ - private static final Map LORE_HOLDERS = new HashMap<>(); - - @Override - public void onResourceManagerReload(IResourceManager p_110549_1_) { - updateLoreHolders(); - } - - /** - * Register a class containing one or more static fields of type {@link String} annotated with {@link LoreHolder}. - * When the resources are reloaded, the field(s) are updated with a random translation. The possible lines are - * defined via lang files, using the translation key defined by {@link LoreHolder#value()}, appended by an index - * (starting with 0). Blank translations are ignored. The translations may be weighted by using {@code :} as - * prefix, {@code } being a non-negative integer. If no weight is specified, a default value of 1 is used. - * To prevent ':' being used as delimiter, escape it using '\'. - * - * @param clazz The class containing the field(s) to be updated when the resources are reloaded - * @since 1.0.0 - * @since 1.0.9 Lines can be weighted - * @author glowredman - */ - public static void registerLoreHolder(Class clazz) { - try { - for (Field field : clazz.getDeclaredFields()) { - if (!field.getType().isAssignableFrom(String.class) || !Modifier.isStatic(field.getModifiers())) - continue; - - LoreHolder loreHolder = field.getDeclaredAnnotation(LoreHolder.class); - if (loreHolder == null) continue; - - field.setAccessible(true); - LORE_HOLDERS.put(field, loreHolder.value()); - } - } catch (Exception e) { - GTNHIntergalactic.LOG - .error("An exception occured while looking for @LoreHolder annotations in " + clazz.toString(), e); - } - } - - private static void updateLoreHolders() { - LORE_HOLDERS.forEach((field, keyPrefix) -> { - try { - field.set(null, getRandomLine(keyPrefix)); - } catch (Exception e) { - GTNHIntergalactic.LOG.warn( - "Unable to update LoreHolder in " + field.getDeclaringClass().toString() - + " (Field: " - + field.getName() - + ")", - e); - } - }); - } - - private static String getRandomLine(String keyPrefix) { - List lines = getAllLines(keyPrefix); - - if (lines.size() == 0) { - return null; - } - - try { - return ((WeightedText) WeightedRandom.getRandomItem(XSTR.XSTR_INSTANCE, lines)).text; - } catch (IllegalArgumentException e) { - GTNHIntergalactic.LOG - .warn("The total weight of all lines for \"" + keyPrefix + "\" exceeds " + Integer.MAX_VALUE, e); - } catch (Exception e) { - GTNHIntergalactic.LOG - .error("An unexpected Exception occured while choosing a random lore for \"" + keyPrefix + '"', e); - } - - return null; - } - - private static List getAllLines(String keyPrefix) { - List allLines = new ArrayList<>(); - - for (int i = 0; true; i++) { - String unlocalizedLine = keyPrefix + i; - String localizedLine = StatCollector.translateToLocal(unlocalizedLine); - if (unlocalizedLine.equals(localizedLine)) { - break; - } else { - if (!StringUtils.isBlank(localizedLine)) { - allLines.add(new WeightedText(localizedLine)); - } - } - } - - return allLines; - } - - private static class WeightedText extends WeightedRandom.Item { - - private String text; - - private WeightedText(String weightedText) { - super(0); - this.extractWeightAndText(weightedText); - } - - private void extractWeightAndText(String weightedText) { - int endOfWeight = weightedText.indexOf(':'); - - // no ':' was found or the ':' was escaped using '\' - // -> lore line has no weight specified - if (endOfWeight < 1) { - this.itemWeight = 1; - this.text = weightedText; - return; - } - - if (weightedText.charAt(endOfWeight - 1) == '\\') { - this.itemWeight = 1; - this.text = weightedText.substring(0, endOfWeight - 1) + weightedText.substring(endOfWeight); - return; - } - - // if a ':' was found, attempt to parse everything before it as int - String weightString = weightedText.substring(0, endOfWeight); - try { - int weight = Integer.parseInt(weightString); - - if (weight < 0) { - GTNHIntergalactic.LOG.warn( - "\"{}\" has a negative weight ({}). This is not allowed, a weight of 1 will be used instead.", - weightedText, - weight); - this.itemWeight = 1; - } else { - this.itemWeight = weight; - } - - this.text = weightedText.substring(endOfWeight + 1); - return; - } catch (NumberFormatException e) { - GTNHIntergalactic.LOG.warn( - "Could not parse \"" + weightString - + "\" as Integer. If it is not supposed to be a weight, escape the ':' delimiter using '\\'.", - e); - } catch (Exception e) { - GTNHIntergalactic.LOG.error( - "An unexpected Exception occured while extracting weight and text from lore \"" + weightedText - + '"', - e); - } - - // fallback - this.itemWeight = 1; - this.text = weightedText; - } - - } - -} diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/lore/LoreHolder.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/lore/LoreHolder.java deleted file mode 100644 index 20720d6..0000000 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/client/lore/LoreHolder.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.gtnewhorizons.gtnhintergalactic.client.lore; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation used to identify fields which should be updated on a resource refresh. Annotated fields must be static and - * of type {@link String}. To use this, register the declaring class via {@link LoreHandler#registerLoreHolder(Class)}. - * - * @author glowredman - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface LoreHolder { - - /** - * The localization key - * - * @author glowredman - */ - String value(); - -} diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/config/Config.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/config/Config.java deleted file mode 100644 index 869fefa..0000000 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/config/Config.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.gtnewhorizons.gtnhintergalactic.config; - -import java.io.File; - -import net.minecraftforge.common.config.Configuration; - -/** - * Config file of this mod - * - * @author minecraft7771 - */ -public class Config { - - /** Category for Space Elevator settigns */ - public static String CATEGORY_SPACE_ELEVATOR = "spaceElevator"; - - // Space Elevator - /** Whether to render the cable was block or with renderer */ - public static boolean isCableRenderingEnabled = true; - - /** - * Read the configuration file - * - * @param configFile File to be read - */ - public static void synchronizeConfiguration(File configFile) { - Configuration configuration = new Configuration(configFile); - - isCableRenderingEnabled = configuration.getBoolean( - "isCableRenderingEnabled", - CATEGORY_SPACE_ELEVATOR, - isCableRenderingEnabled, - "If the Space Elevator should use it's fancy renderer, or simple block renderer"); - - if (configuration.hasChanged()) { - configuration.save(); - } - } -} diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/config/IGConfig.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/config/IGConfig.java new file mode 100644 index 0000000..9a06881 --- /dev/null +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/config/IGConfig.java @@ -0,0 +1,19 @@ +package com.gtnewhorizons.gtnhintergalactic.config; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.G_T_N_H_INTERGALACTIC, filename = "gtnhintergalactic") +public class IGConfig { + + public static SpaceElevator spaceElevator = new SpaceElevator(); + + @Config.Comment("Space Elevator section") + public static class SpaceElevator { + + @Config.Comment("If true, the Space Elevator will use it's fancy renderer, otherwise a simple block renderer") + @Config.DefaultBoolean(true) + public boolean isCableRenderingEnabled; + } +} diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/proxy/CommonProxy.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/proxy/CommonProxy.java index 573c48b..018b03f 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/proxy/CommonProxy.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/proxy/CommonProxy.java @@ -3,7 +3,6 @@ import net.minecraft.util.IIcon; import com.gtnewhorizons.gtnhintergalactic.block.IGBlocks; -import com.gtnewhorizons.gtnhintergalactic.config.Config; import com.gtnewhorizons.gtnhintergalactic.item.IGItems; import com.gtnewhorizons.gtnhintergalactic.loader.MachineLoader; import com.gtnewhorizons.gtnhintergalactic.loader.RecipeLoader; @@ -30,9 +29,7 @@ public class CommonProxy { // preInit "Run before anything else. Read your config, create blocks, items, etc, and register them with the // GameRegistry." (Remove if not needed) - public void preInit(FMLPreInitializationEvent event) { - Config.synchronizeConfiguration(event.getSuggestedConfigurationFile()); - } + public void preInit(FMLPreInitializationEvent event) {} // load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed) public void init(FMLInitializationEvent event) { diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/render/RenderSpaceElevatorCable.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/render/RenderSpaceElevatorCable.java index 90a970d..9ff2d8f 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/render/RenderSpaceElevatorCable.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/render/RenderSpaceElevatorCable.java @@ -27,7 +27,7 @@ import com.gtnewhorizon.gtnhlib.client.renderer.shader.ShaderProgram; import com.gtnewhorizons.gtnhintergalactic.GTNHIntergalactic; import com.gtnewhorizons.gtnhintergalactic.block.BlockSpaceElevatorCable; -import com.gtnewhorizons.gtnhintergalactic.config.Config; +import com.gtnewhorizons.gtnhintergalactic.config.IGConfig; import com.gtnewhorizons.gtnhintergalactic.tile.TileEntitySpaceElevatorCable; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; @@ -108,7 +108,7 @@ public RenderSpaceElevatorCable() { */ @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { - if (!Config.isCableRenderingEnabled) return; + if (!IGConfig.spaceElevator.isCableRenderingEnabled) return; if (!(tile instanceof TileEntitySpaceElevatorCable)) return; final TileEntitySpaceElevatorCable cableTile = (TileEntitySpaceElevatorCable) tile; diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/TileEntitySpaceElevatorCable.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/TileEntitySpaceElevatorCable.java index 36f4c21..29a0bd6 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/TileEntitySpaceElevatorCable.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/TileEntitySpaceElevatorCable.java @@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; -import com.gtnewhorizons.gtnhintergalactic.config.Config; +import com.gtnewhorizons.gtnhintergalactic.config.IGConfig; import cpw.mods.fml.relauncher.Side; import io.netty.buffer.ByteBuf; @@ -159,7 +159,7 @@ public boolean shouldRender() { */ @Override public void updateEntity() { - if (!Config.isCableRenderingEnabled) return; + if (!IGConfig.spaceElevator.isCableRenderingEnabled) return; super.updateEntity(); // If the render state changed we need to issue a block renderer update to switch to the block renderer if (worldObj != null && worldObj.isRemote) { diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/TileEntityPlanetaryGasSiphon.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/TileEntityPlanetaryGasSiphon.java index 8dcb0fd..6bf5dbc 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/TileEntityPlanetaryGasSiphon.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/TileEntityPlanetaryGasSiphon.java @@ -28,13 +28,13 @@ import org.jetbrains.annotations.NotNull; +import com.gtnewhorizon.gtnhlib.client.tooltip.LoreHolder; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureUtility; import com.gtnewhorizons.gtnhintergalactic.client.IGTextures; -import com.gtnewhorizons.gtnhintergalactic.client.lore.LoreHolder; import com.gtnewhorizons.gtnhintergalactic.recipe.GasSiphonRecipes; import bartworks.client.textures.PrefixTextureLinker; diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevator/TileEntitySpaceElevator.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevator/TileEntitySpaceElevator.java index 34cf94d..80e7545 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevator/TileEntitySpaceElevator.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevator/TileEntitySpaceElevator.java @@ -1,5 +1,6 @@ package com.gtnewhorizons.gtnhintergalactic.tile.multi.elevator; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.withChannel; import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static net.minecraft.util.EnumChatFormatting.GREEN; import static net.minecraft.util.EnumChatFormatting.ITALIC; @@ -23,16 +24,16 @@ import org.jetbrains.annotations.NotNull; +import com.gtnewhorizon.gtnhlib.client.tooltip.LoreHolder; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; -import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureUtility; import com.gtnewhorizons.gtnhintergalactic.block.IGBlocks; -import com.gtnewhorizons.gtnhintergalactic.client.lore.LoreHolder; -import com.gtnewhorizons.gtnhintergalactic.config.Config; +import com.gtnewhorizons.gtnhintergalactic.config.IGConfig; import com.gtnewhorizons.gtnhintergalactic.gui.IG_UITextures; import com.gtnewhorizons.gtnhintergalactic.tile.TileEntitySpaceElevatorCable; import com.gtnewhorizons.gtnhintergalactic.tile.multi.GT_MetaTileEntity_EnhancedMultiBlockBase_EM; @@ -51,9 +52,11 @@ import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; +import blockrenderer6343.client.world.ClientFakePlayer; import galaxyspace.core.register.GSBlocks; import gregtech.api.enums.GTValues; import gregtech.api.enums.Materials; +import gregtech.api.enums.Mods; import gregtech.api.enums.SoundResource; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -233,12 +236,14 @@ public class TileEntitySpaceElevator extends GT_MetaTileEntity_EnhancedMultiBloc .addElement('F', StructureUtility.ofBlock(IGBlocks.SpaceElevatorCasing, 2)) // Internal Structure .addElement( 'C', - StructureUtility.ofBlocksTiered( - ElevatorUtil.motorTierConverter(), - ElevatorUtil.getMotorTiers(), - 0, - TileEntitySpaceElevator::setMotorTier, - TileEntitySpaceElevator::getMotorTier)) // Motors + withChannel( + "motor", + StructureUtility.ofBlocksTiered( + ElevatorUtil.motorTierConverter(), + ElevatorUtil.getMotorTiers(), + 0, + TileEntitySpaceElevator::setMotorTier, + TileEntitySpaceElevator::getMotorTier))) // Motors .addElement('A', StructureUtility.ofBlock(GSBlocks.DysonSwarmBlocks, 9)) // Concrete .addElement('D', StructureUtility.ofBlock(IGBlocks.SpaceElevatorCasing, 0)) // Base Casing .addElement( @@ -397,46 +402,60 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { } } - /** - * Construct the structure of the Space Elevator in survival - * - * @param stackSize Hologram projector item stack - * @param elementBudget Max at once placeable blocks - * @param source Source of the building material - * @param actor Player that is constructing - * @return Number of placed blocks - */ @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { - if (mMachine) { - return -1; - } else { - int consumedBudget = survivialBuildPiece( + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (Mods.BlockRenderer6343.isModLoaded() && env.getActor() instanceof ClientFakePlayer) { + int built = survivialBuildPiece( STRUCTURE_PIECE_MAIN, stackSize, STRUCTURE_PIECE_MAIN_HOR_OFFSET, STRUCTURE_PIECE_MAIN_VERT_OFFSET, STRUCTURE_PIECE_MAIN_DEPTH_OFFSET, elementBudget, - source, - actor, + env, false, true); - if (isExtensionEnabled) { - consumedBudget += survivialBuildPiece( + if (built >= 0) return built; + if (stackSize.stackSize > 1) { + built = survivialBuildPiece( STRUCTURE_PIECE_EXTENDED, stackSize, STRUCTURE_PIECE_EXTENDED_HOR_OFFSET, STRUCTURE_PIECE_EXTENDED_VERT_OFFSET, STRUCTURE_PIECE_EXTENDED_DEPTH_OFFSET, elementBudget, - source, - actor, + env, false, true); } - return consumedBudget; + return built; + } + + if (mMachine) return -1; + + int consumedBudget = survivialBuildPiece( + STRUCTURE_PIECE_MAIN, + stackSize, + STRUCTURE_PIECE_MAIN_HOR_OFFSET, + STRUCTURE_PIECE_MAIN_VERT_OFFSET, + STRUCTURE_PIECE_MAIN_DEPTH_OFFSET, + elementBudget, + env, + false, + true); + if (isExtensionEnabled) { + consumedBudget += survivialBuildPiece( + STRUCTURE_PIECE_EXTENDED, + stackSize, + STRUCTURE_PIECE_EXTENDED_HOR_OFFSET, + STRUCTURE_PIECE_EXTENDED_VERT_OFFSET, + STRUCTURE_PIECE_EXTENDED_DEPTH_OFFSET, + elementBudget, + env, + false, + true); } + return consumedBudget; } /** @@ -600,7 +619,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { } this.isLoadedChunk = true; } else { - if (elevatorCable != null && Config.isCableRenderingEnabled + if (elevatorCable != null && IGConfig.spaceElevator.isCableRenderingEnabled && elevatorCable.getAnimation() == TileEntitySpaceElevatorCable.ClimberAnimation.NO_ANIMATION && aTick % 2000 == 0) { elevatorCable.startAnimation(TileEntitySpaceElevatorCable.ClimberAnimation.DELIVER_ANIMATION); diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleAssembler.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleAssembler.java index ae2f173..96609c8 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleAssembler.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleAssembler.java @@ -273,7 +273,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .toolTipFinisher(); return tt; } @@ -352,7 +351,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .toolTipFinisher(); return tt; } @@ -431,7 +429,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .toolTipFinisher(); return tt; } diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleMiner.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleMiner.java index deb933c..d7005b6 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleMiner.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleMiner.java @@ -838,6 +838,7 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.desc2")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc3")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc4")) + .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc5")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.t1.desc5")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT1")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc6")) @@ -846,7 +847,10 @@ protected MultiblockTooltipBuilder createTooltip() { .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) + .addOtherStructurePart( + GCCoreUtil.translate("ig.elevator.structure.OpticalConnector"), + GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), + 1) .toolTipFinisher(); return tt; } @@ -931,6 +935,7 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.desc2")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc3")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc4")) + .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc5")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.t2.desc5")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT2")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc6")) @@ -939,7 +944,10 @@ protected MultiblockTooltipBuilder createTooltip() { .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) + .addOtherStructurePart( + GCCoreUtil.translate("ig.elevator.structure.OpticalConnector"), + GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), + 1) .toolTipFinisher(); return tt; } @@ -1024,6 +1032,7 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.desc2")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc3")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc4")) + .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc5")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.t3.desc5")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT3")) .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.miner.desc6")) @@ -1032,7 +1041,10 @@ protected MultiblockTooltipBuilder createTooltip() { .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) + .addOtherStructurePart( + GCCoreUtil.translate("ig.elevator.structure.OpticalConnector"), + GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), + 1) .toolTipFinisher(); return tt; } diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModulePump.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModulePump.java index 0d22ca6..26f97c3 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModulePump.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModulePump.java @@ -1,7 +1,6 @@ package com.gtnewhorizons.gtnhintergalactic.tile.multi.elevatormodules; import java.util.ArrayList; -import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; @@ -31,6 +30,7 @@ import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.ParallelHelper; import gregtech.common.tileentities.machines.MTEHatchOutputME; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import tectech.thing.metaTileEntity.multi.base.INameFunction; @@ -127,7 +127,7 @@ public TileEntityModulePump(String aName, int tTier, int tModuleTier, int tMinMo .insufficientPower(ENERGY_CONSUMPTION * getParallelRecipes() * getParallels()); } - List outputs = new ArrayList<>(); + ArrayList outputs = new ArrayList<>(); int usedEUt = 0; // We store the highest batch size as time multiplier int maxBatchSize = (int) Math.min(Math.max(batchSetting.get(), 1.0D), 128.0D); @@ -160,9 +160,9 @@ public TileEntityModulePump(String aName, int tTier, int tModuleTier, int tMinMo } if (parallels > 0 && batchSize > 0) { fluid = fluid.copy(); - fluid.amount = fluid.amount * parallels * batchSize; - usedEUt += ENERGY_CONSUMPTION * parallels; - outputs.add(fluid); + long fluidLong = (long) fluid.amount * parallels * batchSize; + usedEUt += (int) (ENERGY_CONSUMPTION * parallels); + ParallelHelper.addFluidsLong(outputs, fluid, fluidLong); } } } @@ -173,7 +173,7 @@ public TileEntityModulePump(String aName, int tTier, int tModuleTier, int tMinMo mEfficiencyIncrease = 10000; mMaxProgresstime = 20 * maxBatchSize; - return outputs.size() > 0 ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.NO_RECIPE; + return !outputs.isEmpty() ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.NO_RECIPE; } /** @@ -412,9 +412,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT2")) .beginStructureBlock(1, 5, 2, false) .addCasingInfoRange(GCCoreUtil.translate("gt.blockcasings.ig.0.name"), 0, 9, false) - .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .toolTipFinisher(); return tt; @@ -505,9 +502,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT3")) .beginStructureBlock(1, 5, 2, false) .addCasingInfoRange(GCCoreUtil.translate("gt.blockcasings.ig.0.name"), 0, 9, false) - .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .toolTipFinisher(); return tt; @@ -598,9 +592,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT4")) .beginStructureBlock(1, 5, 2, false) .addCasingInfoRange(GCCoreUtil.translate("gt.blockcasings.ig.0.name"), 0, 9, false) - .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) - .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .toolTipFinisher(); return tt; diff --git a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleResearch.java b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleResearch.java index 4c83490..6b46893 100644 --- a/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleResearch.java +++ b/src/main/java/com/gtnewhorizons/gtnhintergalactic/tile/multi/elevatormodules/TileEntityModuleResearch.java @@ -71,7 +71,7 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(GCCoreUtil.translate("gt.blockmachines.multimachine.project.ig.motorT2")) .beginStructureBlock(1, 5, 2, false) .addCasingInfoRange(GCCoreUtil.translate("gt.blockcasings.ig.0.name"), 0, 9, false) - .addInputBus(GCCoreUtil.translate("i.gelevator.structure.AnyBaseCasingWith1Dot"), 1) + .addInputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputBus(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addInputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) .addOutputHatch(GCCoreUtil.translate("ig.elevator.structure.AnyBaseCasingWith1Dot"), 1) diff --git a/src/main/resources/assets/gtnhintergalactic/lang/en_US.lang b/src/main/resources/assets/gtnhintergalactic/lang/en_US.lang index b798690..26596c1 100644 --- a/src/main/resources/assets/gtnhintergalactic/lang/en_US.lang +++ b/src/main/resources/assets/gtnhintergalactic/lang/en_US.lang @@ -215,6 +215,7 @@ gt.blockmachines.multimachine.project.ig.miner.t2.desc1=Does this violate drone gt.blockmachines.multimachine.project.ig.miner.t3.desc1=This definitely violates drone rights. gt.blockmachines.multimachine.project.ig.miner.desc3=Requires a plasma to operate (1000L Helium / 500L Bismuth / 300L Radon). gt.blockmachines.multimachine.project.ig.miner.desc4=Higher tier plasmas give bonuses. +gt.blockmachines.multimachine.project.ig.miner.desc5=Needs to be fed with computation to work. gt.blockmachines.multimachine.project.ig.miner.t1.desc5=Runs at UV with up to 2 parallels gt.blockmachines.multimachine.project.ig.miner.t2.desc5=Runs at UHV with up to 4 parallels gt.blockmachines.multimachine.project.ig.miner.t3.desc5=Runs at UEV with up to 8 parallels