aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/misc/spaceprojects/interfaces
diff options
context:
space:
mode:
authorBlueWeabo <ilia.iliev2005@gmail.com>2023-02-26 13:16:07 +0200
committerGitHub <noreply@github.com>2023-02-26 12:16:07 +0100
commitb8d1ecf8b9b6348304392d09e4490d473dbb120d (patch)
tree1cdc59a1b660510fe2abd40686b2abed8b0ab40f /src/main/java/gregtech/common/misc/spaceprojects/interfaces
parentebd7df3a1ddba9105df008d44ab046d159279628 (diff)
downloadGT5-Unofficial-b8d1ecf8b9b6348304392d09e4490d473dbb120d.tar.gz
GT5-Unofficial-b8d1ecf8b9b6348304392d09e4490d473dbb120d.tar.bz2
GT5-Unofficial-b8d1ecf8b9b6348304392d09e4490d473dbb120d.zip
Add a completely new system for late/endgame content (#1754)
* basic work * typo fixes * make an enum folder * location enums * space project manager * implement the space project teams * commands * move things around and new things * upgrade work * requirement work * if possible use an upgrades values * cleanup * more helpers in command * fix AOOBE * fix world saved data * builder for requirements * add command autocomplete * fix command npe * mark world saved data dirty * switch to saving to json string. this is fine * fix npe * fix files not saving correctly. serialization * spotless * part 1 of fixing json saving * working json file saving * rename fields * full implementation of SP_Upgrade * fixes * cleanup * texture prep * documentation part 1 * documentation part 2 and rework of json saving * fix the missed conversions * set texture when copying * more interface usage and fixes * rework saving. * Added rudimentary NEI handler for projects * Revert "Added rudimentary NEI handler for projects" This reverts commit 6d8210e25b27fee7dc1865d1afa91708a8d9b875. * address NPEs * some textures * higher quality textures, put in the moon as a temp texture * add a check to create a team if one smt weird happens * command work * add ability to localize the space bodies * Added disabled button and toggle button * Added possibility to not render the original stacksize of item stacks in NEI * Added NEI handler * Fixes item count on tooltip always rendering as 1 * Fix refactor * 5 new body textures * fix misspelled texture name --------- Co-authored-by: minecraft7771 <maxim235@gmx.de>
Diffstat (limited to 'src/main/java/gregtech/common/misc/spaceprojects/interfaces')
-rw-r--r--src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceBody.java37
-rw-r--r--src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceProject.java430
2 files changed, 467 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceBody.java b/src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceBody.java
new file mode 100644
index 0000000000..79eba4c968
--- /dev/null
+++ b/src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceBody.java
@@ -0,0 +1,37 @@
+package gregtech.common.misc.spaceprojects.interfaces;
+
+import com.gtnewhorizons.modularui.api.drawable.UITexture;
+
+import gregtech.common.misc.spaceprojects.enums.SpaceBodyType;
+import gregtech.common.misc.spaceprojects.enums.StarType;
+
+/**
+ * @author BlueWeabo
+ */
+public interface ISpaceBody {
+
+ /**
+ * @return The star type of the space body, if its a star
+ */
+ StarType getStarType();
+
+ /**
+ * @return The type of space body it is
+ */
+ SpaceBodyType getType();
+
+ /**
+ * @return The internal name of the space body
+ */
+ String getName();
+
+ /**
+ * @return The texture of the space body used for UI
+ */
+ UITexture getTexture();
+
+ /**
+ * @return The Unlocalized name for this body
+ */
+ String getUnlocalizedName();
+}
diff --git a/src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceProject.java b/src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceProject.java
new file mode 100644
index 0000000000..3de3ef2b94
--- /dev/null
+++ b/src/main/java/gregtech/common/misc/spaceprojects/interfaces/ISpaceProject.java
@@ -0,0 +1,430 @@
+package gregtech.common.misc.spaceprojects.interfaces;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import com.gtnewhorizons.modularui.api.drawable.UITexture;
+
+import gregtech.common.misc.spaceprojects.enums.SpaceBodyType;
+import gregtech.common.misc.spaceprojects.enums.StarType;
+import gregtech.common.misc.spaceprojects.enums.UpgradeStatus;
+
+/**
+ * @author BlueWeabo
+ */
+public interface ISpaceProject {
+
+ /**
+ * @return the internal name of the project.
+ */
+ String getProjectName();
+
+ /**
+ * @return Unlocalized name of the project.
+ */
+ String getUnlocalizedName();
+
+ /**
+ * @return Localized name of the project using StatCollect#translateToLocal.
+ */
+ String getLocalizedName();
+
+ /**
+ * @return The voltage the project requires to be built at. Used by the project manager.
+ */
+ long getProjectVoltage();
+
+ /**
+ * @return The duration it takes to build out one(1) stage of the project. The time returned is in ticks
+ */
+ int getProjectBuildTime();
+
+ /**
+ * @return The Current Progress of the project in percentage form. 1 being 100% and 0 being 0%.
+ */
+ float getProjectCurrentProgress();
+
+ /**
+ * @return Currently unused, but this is the project's tier. Will be used to determine the min-tier motors needed on
+ * the Space Elevator
+ */
+ int getProjectTier();
+
+ /**
+ * @return The Current stage of the project
+ */
+ int getCurrentStage();
+
+ /**
+ * @return The Total amount of stages the project has
+ */
+ int getTotalStages();
+
+ /**
+ * @return a Collection of all upgrades the project has
+ */
+ Collection<ISP_Upgrade> getAllUpgrades();
+
+ /**
+ * @return a Map of all upgrades that have been built.
+ */
+ Map<String, ISP_Upgrade> getUpgradesBuiltMap();
+
+ /**
+ * @return
+ */
+ Collection<ISP_Upgrade> getAllBuiltUpgrades();
+
+ /**
+ * @param upgradeName The name of the upgrade wanted
+ * @return The upgrade with the appropriate name found in the available upgrades for the project
+ */
+ ISP_Upgrade getUpgrade(String upgradeName);
+
+ /**
+ * @return The Items cost required per stage in an array form. Used for making the recipe.
+ */
+ ItemStack[] getItemsCostPerStage();
+
+ /**
+ * @param index Index at which the itemstack is found at
+ * @return an item's cost at the appropriate index. Null otherwise if it goes above the index or there are no item
+ * costs
+ */
+ ItemStack getItemCostPerStage(int index);
+
+ /**
+ * @return The Items current progress in an array form.
+ */
+ ItemStack[] getCurrentItemsProgress();
+
+ /**
+ * @param index Index at which the itemstack is found at
+ * @return an item's current progress at the appropriate index. Null otherwise if it goes above the index or there
+ * are no item costs
+ */
+ ItemStack getCurrentItemProgress(int index);
+
+ /**
+ * @return The items total cost required in an array form.
+ */
+ ItemStack[] getTotalItemsCost();
+
+ /**
+ * @param index Index at which the itemstack is found at
+ * @return an item's total cost at the appropriate index. Null otherwise if it goes above the index or there are no
+ * item costs
+ */
+ ItemStack getTotalItemCost(int index);
+
+ /**
+ * @return The fluids cost required per stage in an array form. Used for making the recipe.
+ */
+ FluidStack[] getFluidsCostPerStage();
+
+ /**
+ * @param index Index at which the fluidstack is found at
+ * @return a fluid's cost at the appropriate index. Null otherwise if it goes above the index or there are no fluid
+ * costs
+ */
+ FluidStack getFluidCostPerStage(int index);
+
+ /**
+ * @return The fluids current progress in an array form. Null if there are no fluid costs
+ */
+ FluidStack[] getCurrentFluidsProgress();
+
+ /**
+ * @param index Index at which the fluidstack is found at
+ * @return a fluid's current progress at the appropriate index. Null otherwise if it goes above the index or there
+ * are no fluid costs
+ */
+ FluidStack getCurrentFluidProgress(int index);
+
+ /**
+ * @return The fluids total cost required in an array form. Null if there are no fluid costs
+ */
+ FluidStack[] getTotalFluidsCost();
+
+ /**
+ * @param index Index at which the fluidstack is found at
+ * @return a fluid's total cost at the appropriate index. Null otherwise if it goes above the index or there are no
+ * fluid costs
+ */
+ FluidStack getTotalFluidCost(int index);
+
+ /**
+ * @return The current upgrade for this project, which is being built
+ */
+ ISP_Upgrade getUpgradeBeingBuilt();
+
+ /**
+ * @return The location of the project
+ */
+ ISpaceBody getProjectLocation();
+
+ /**
+ * @return The texture used in GUIs for the project
+ */
+ UITexture getTexture();
+
+ /**
+ * Sets the current stage of the project
+ */
+ void setProjectCurrentStage(int stage);
+
+ /**
+ * Sets the current upgrade, which needs to be built
+ */
+ void setCurrentUpgradeBeingBuilt(ISP_Upgrade upgrade);
+
+ /**
+ * Sets the project's location when it starts being built
+ */
+ void setProjectLocation(ISpaceBody newLocation);
+
+ /**
+ * Sets the project's upgrades, which have been built
+ */
+ void setBuiltUpgrade(ISP_Upgrade... upgrades);
+
+ /**
+ * Goes to the next stage of the project
+ */
+ void goToNextStage();
+
+ /**
+ * Creates a copy of the space project
+ */
+ ISpaceProject copy();
+
+ /**
+ * Checks if the project meets all requirements with its current location
+ *
+ * @param team Team wanting said project and checking their projects
+ * @return true if all requirements met, false otherwise
+ */
+ boolean meetsRequirements(UUID team);
+
+ /**
+ * Checks if the project meets requirements if it requires other projects, unless {@code checkLocation} is true,
+ * then it also checks for the location
+ *
+ * @param team Team wanting said project and checking their projects
+ * @param checkLocation If the location position should be checked
+ * @return true if all requirements met, false otherwise
+ */
+ boolean meetsRequirements(UUID team, boolean checkLocation);
+
+ /**
+ * Checks if the projects is finished
+ */
+ boolean isFinished();
+
+ /**
+ * Checks if the project has a certain upgrade installed or not
+ *
+ * @param upgradeName Upgrade being searched for
+ * @return True if that upgrade has been installed, false otherwise
+ */
+ boolean hasUpgrade(String upgradeName);
+
+ /**
+ * @author BlueWeabo
+ */
+ public interface ISP_Upgrade {
+
+ /**
+ * @return internal name of the upgrade
+ */
+ String getUpgradeName();
+
+ /**
+ * @return unlocalized name of the upgrade
+ */
+ String getUnlocalizedName();
+
+ /**
+ * @return localized name of the upgrade
+ */
+ String getLocalizedName();
+
+ /**
+ * @return The Items cost required per stage in an array form. Used for making the recipe.
+ */
+ ItemStack[] getItemsCostPerStage();
+
+ /**
+ * @param index Index at which the itemstack is found at
+ * @return an item's cost at the appropriate index. Null otherwise if it goes above the index or there are no
+ * item costs
+ */
+ ItemStack getItemCostPerStage(int index);
+
+ /**
+ * @return The Items current progress in an array form.
+ */
+ ItemStack[] getCurrentItemsProgress();
+
+ /**
+ * @param index Index at which the itemstack is found at
+ * @return an item's current progress at the appropriate index. Null otherwise if it goes above the index or
+ * there are no item costs
+ */
+ ItemStack getCurrentItemProgress(int index);
+
+ /**
+ * @return The items total cost required in an array form.
+ */
+ ItemStack[] getTotalItemsCost();
+
+ /**
+ * @param index Index at which the itemstack is found at
+ * @return an item's total cost at the appropriate index. Null otherwise if it goes above the index or there are
+ * no item costs
+ */
+ ItemStack getTotalItemCost(int index);
+
+ /**
+ * @return The fluids cost required per stage in an array form. Used for making the recipe.
+ */
+ FluidStack[] getFluidsCostPerStage();
+
+ /**
+ * @param index Index at which the fluidstack is found at
+ * @return a fluid's cost at the appropriate index. Null otherwise if it goes above the index or there are no
+ * fluid costs
+ */
+ FluidStack getFluidCostPerStage(int index);
+
+ /**
+ * @return The fluids current progress in an array form. Null if there are no fluid costs
+ */
+ FluidStack[] getCurrentFluidsProgress();
+
+ /**
+ * @param index Index at which the fluidstack is found at
+ * @return a fluid's current progress at the appropriate index. Null otherwise if it goes above the index or
+ * there are no fluid costs
+ */
+ FluidStack getCurrentFluidProgress(int index);
+
+ /**
+ * @return The fluids total cost required in an array form. Null if there are no fluid costs
+ */
+ FluidStack[] getTotalFluidsCost();
+
+ /**
+ * @param index Index at which the fluidstack is found at
+ * @return a fluid's total cost at the appropriate index. Null otherwise if it goes above the index or there are
+ * no fluid costs
+ */
+ FluidStack getTotalFluidCost(int index);
+
+ /**
+ * @return the total stages an upgrade has
+ */
+ int getTotalStages();
+
+ /**
+ * @return the build time for the upgrade to go to its next stage
+ */
+ int getUpgradeBuildTime();
+
+ /**
+ * @return current stage of the upgrade
+ */
+ int getCurrentStage();
+
+ /**
+ * @return The Current Progress of the upgrade in percentage form. 1 being 100% and 0 being 0%.
+ */
+ float getCurrentProgress();
+
+ /**
+ * @return The voltage at which the upgrade requires to be build at.
+ */
+ long getVoltage();
+
+ /**
+ * Unused, unsure if it will get a sure
+ */
+ UpgradeStatus getStatus();
+
+ /**
+ * @return the requirements the upgrade has
+ */
+ ISP_Requirements getUpgradeRequirements();
+
+ /**
+ * @return the parent project, which the upgrade belongs to
+ */
+ ISpaceProject getParentProject();
+
+ /**
+ * @param project The project the upgrade belongs to
+ */
+ void setUpgradeProject(ISpaceProject project);
+
+ /**
+ * Sets the current stage of the upgrade
+ *
+ * @param stage
+ */
+ void setUpgradeCurrentStage(int stage);
+
+ /**
+ * Checks if the team has met all requirements to be able to build said upgrade
+ *
+ * @param team The one starting the upgrade
+ * @return true if all requirements are met, false otherwise
+ */
+ boolean meetsRequirements(UUID team);
+
+ /**
+ * Creates a copy of the upgrade
+ */
+ ISP_Upgrade copy();
+
+ /**
+ * Goes to the next stage of the upgrade
+ */
+ void goToNextStage();
+
+ /**
+ * @return true if the upgrade has finished all of its stages, false otherwise
+ */
+ boolean isFinished();
+ }
+
+ /**
+ * @author BlueWeabo
+ */
+ public interface ISP_Requirements {
+
+ /**
+ * @return Space Body Type required by the project/upgrade
+ */
+ SpaceBodyType getBodyType();
+
+ /**
+ * @return Star Type required by the project/upgrade
+ */
+ StarType getStarType();
+
+ /**
+ * @return a list of all project required for the team to have to unlock it
+ */
+ List<ISpaceProject> getProjects();
+
+ /**
+ * @return a list of all upgrades an upgrade can have as required.
+ */
+ List<ISP_Upgrade> getUpgrades();
+ }
+}