Skip to content

Commit

Permalink
fix space suit!1!11!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Mar 30, 2024
1 parent 502e98f commit 146950b
Show file tree
Hide file tree
Showing 13 changed files with 289 additions and 13 deletions.
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ dependencyResolutionManagement {
def vineFlowerVersion = "1.+"
def macheteVersion = "1.+"
def configurationVersion = "2.2.0"
def gtCeuVersion = "1.1.3"
def ldLibVersion = "1.0.23.a"
def gtCeuVersion = "1.1.4.a"
def ldLibVersion = "1.0.24.b"
def mixinExtrasVersion = "0.2.0"
def mixinVersion = "0.8.6-SNAPSHOT"

Expand Down
8 changes: 8 additions & 0 deletions src/generated/resources/assets/gcyr/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,30 @@
"block.gcyr.dyson_system_controller": "ɹǝןןoɹʇuoƆ ɯǝʇsʎS uosʎᗡ",
"block.gcyr.elite_fuel_tank": "ʞuɐ⟘ ןǝnℲ ǝʇıןƎ",
"block.gcyr.elite_rocket_motor": "ɹoʇoW ʇǝʞɔoᴚ ǝʇıןƎ",
"block.gcyr.ev_fluid_loader": "ɹǝpɐoꞀ pınןℲ ΛƎϛ§",
"block.gcyr.hv_fluid_loader": "ɹǝpɐoꞀ pınןℲ ΛH9§",
"block.gcyr.iv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛI6§",
"block.gcyr.launch_pad": "pɐԀ ɥɔunɐꞀ",
"block.gcyr.luv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛnꞀp§",
"block.gcyr.lv_fluid_loader": "ɹǝpɐoꞀ pınןℲ ΛꞀㄥ§",
"block.gcyr.mars_regolith": "ɥʇıןobǝᴚ sɹɐW",
"block.gcyr.martian_rock": "ʞɔoᴚ uɐıʇɹɐW",
"block.gcyr.mercury_rock": "ʞɔoᴚ ʎɹnɔɹǝW",
"block.gcyr.moon_sand": "puɐS uooW",
"block.gcyr.moon_stone": "ǝuoʇS uooW",
"block.gcyr.mv_fluid_loader": "ɹǝpɐoꞀ pınןℲ ΛWq§",
"block.gcyr.opv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛdOן§6§",
"block.gcyr.prb_underground_mushroom": "ɯooɹɥsnW punoɹbɹǝpu∩ qɹԀ",
"block.gcyr.rocket_scanner": "ɹǝuuɐɔS ʇǝʞɔoᴚ",
"block.gcyr.seat": "ʇɐǝS",
"block.gcyr.space_elevator": "ɹoʇɐʌǝןƎ ǝɔɐdS",
"block.gcyr.space_elevator_support": "ʇɹoddnS ɹoʇɐʌǝןƎ ǝɔɐdS",
"block.gcyr.space_station_packager": "ɹǝbɐʞɔɐԀ uoıʇɐʇS ǝɔɐdS",
"block.gcyr.uev_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛƎ∩ɐ§",
"block.gcyr.uhv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛH∩ㄣ§",
"block.gcyr.uiv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛI∩ᄅ§",
"block.gcyr.uv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO Λ∩Ɛ§",
"block.gcyr.uxv_oxygen_spreader": "ɹǝpɐǝɹdS uǝbʎxO ΛX∩ǝ§",
"block.gcyr.venus_rock": "ʞɔoᴚ snuǝΛ",
"block.gcyr.venus_sand": "puɐS snuǝΛ",
"block.gcyr.venusian_regolith": "ɥʇıןobǝᴚ uɐısnuǝΛ",
Expand Down
8 changes: 8 additions & 0 deletions src/generated/resources/assets/gcyr/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,30 @@
"block.gcyr.dyson_system_controller": "Dyson System Controller",
"block.gcyr.elite_fuel_tank": "Elite Fuel Tank",
"block.gcyr.elite_rocket_motor": "Elite Rocket Motor",
"block.gcyr.ev_fluid_loader": "§5EV Fluid Loader",
"block.gcyr.hv_fluid_loader": "§6HV Fluid Loader",
"block.gcyr.iv_oxygen_spreader": "§9IV Oxygen Spreader",
"block.gcyr.launch_pad": "Launch Pad",
"block.gcyr.luv_oxygen_spreader": "§dLuV Oxygen Spreader",
"block.gcyr.lv_fluid_loader": "§7LV Fluid Loader",
"block.gcyr.mars_regolith": "Mars Regolith",
"block.gcyr.martian_rock": "Martian Rock",
"block.gcyr.mercury_rock": "Mercury Rock",
"block.gcyr.moon_sand": "Moon Sand",
"block.gcyr.moon_stone": "Moon Stone",
"block.gcyr.mv_fluid_loader": "§bMV Fluid Loader",
"block.gcyr.opv_oxygen_spreader": "§9§lOpV Oxygen Spreader",
"block.gcyr.prb_underground_mushroom": "Prb Underground Mushroom",
"block.gcyr.rocket_scanner": "Rocket Scanner",
"block.gcyr.seat": "Seat",
"block.gcyr.space_elevator": "Space Elevator",
"block.gcyr.space_elevator_support": "Space Elevator Support",
"block.gcyr.space_station_packager": "Space Station Packager",
"block.gcyr.uev_oxygen_spreader": "§aUEV Oxygen Spreader",
"block.gcyr.uhv_oxygen_spreader": "§4UHV Oxygen Spreader",
"block.gcyr.uiv_oxygen_spreader": "§2UIV Oxygen Spreader",
"block.gcyr.uv_oxygen_spreader": "§3UV Oxygen Spreader",
"block.gcyr.uxv_oxygen_spreader": "§eUXV Oxygen Spreader",
"block.gcyr.venus_rock": "Venus Rock",
"block.gcyr.venus_sand": "Venus Sand",
"block.gcyr.venusian_regolith": "Venusian Regolith",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"gcyr:luv_oxygen_spreader",
"gcyr:zpm_oxygen_spreader",
"gcyr:uv_oxygen_spreader",
"gcyr:uhv_oxygen_spreader"
"gcyr:uhv_oxygen_spreader",
"gcyr:uev_oxygen_spreader",
"gcyr:uiv_oxygen_spreader",
"gcyr:uxv_oxygen_spreader",
"gcyr:opv_oxygen_spreader"
]
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"values": [
{
"id": "gcyr:venus_wastelands",
"id": "gcyr:venus_eroded_plains",
"required": false
},
{
"id": "gcyr:infernal_venus_barrens",
"id": "gcyr:venus_eroded_plains",
"required": false
}
]
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/argent_matter/gcyr/GCyR.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argent_matter.gcyr.api.gui.factory.EntityUIFactory;
import argent_matter.gcyr.api.registries.GCyRRegistries;
import argent_matter.gcyr.common.data.*;
import argent_matter.gcyr.common.gui.EntityOxygenHUD;
import argent_matter.gcyr.config.GCyRConfig;
import argent_matter.gcyr.data.GCyRDatagen;
import argent_matter.gcyr.data.loader.PlanetResources;
Expand All @@ -19,6 +20,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
import net.minecraftforge.client.event.RegisterGuiOverlaysEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -72,6 +74,12 @@ public static ResourceLocation id(String path) {
return new ResourceLocation(MOD_ID, path);
}

@SubscribeEvent
public void registerGuiOverlays(RegisterGuiOverlaysEvent event) {
event.registerBelowAll("oxygen_tank", new EntityOxygenHUD());
}


@SubscribeEvent
public void registerClientReloadListeners(RegisterClientReloadListenersEvent event) {
event.registerReloadListener(PlanetResources.INSTANCE);
Expand Down
21 changes: 16 additions & 5 deletions src/main/java/argent_matter/gcyr/common/data/GCyRMachines.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package argent_matter.gcyr.common.data;

import argent_matter.gcyr.GCyR;
import argent_matter.gcyr.common.machine.electric.FluidLoaderMachine;
import argent_matter.gcyr.common.machine.electric.OxygenSpreaderMachine;
import argent_matter.gcyr.common.machine.multiblock.RocketScannerMachine;
import argent_matter.gcyr.common.machine.multiblock.SpaceStationPackagerMachine;
import argent_matter.gcyr.common.machine.multiblock.electric.DroneHangarMachine;
import argent_matter.gcyr.common.machine.multiblock.electric.DysonSystemControllerMachine;
import argent_matter.gcyr.data.recipe.GCyRTags;
import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTCEuAPI;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability;
import com.gregtechceu.gtceu.api.data.RotationState;
Expand Down Expand Up @@ -35,29 +37,38 @@

import static argent_matter.gcyr.api.registries.GCyRRegistries.REGISTRATE;
import static argent_matter.gcyr.common.data.GCyRBlocks.*;
import static com.gregtechceu.gtceu.api.GTValues.VNF;
import static com.gregtechceu.gtceu.api.GTValues.*;
import static com.gregtechceu.gtceu.api.pattern.Predicates.*;
import static com.gregtechceu.gtceu.common.data.GCyMBlocks.CASING_ATOMIC;
import static com.gregtechceu.gtceu.common.data.GTBlocks.*;
import static com.gregtechceu.gtceu.common.data.GTMachines.POWER_TRANSFORMER;

@SuppressWarnings({"Convert2MethodRef", "FunctionalExpressionCanBeFolded", "unused"})
public class GCyRMachines {

public final static int[] HIGH_TIERS = new int[] {GTValues.IV, GTValues.LuV, GTValues.ZPM, GTValues.UV, GTValues.UHV};
public final static int[] ELECTRIC_TIERS = GTValues.tiersBetween(LV, GTCEuAPI.isHighTier() ? OpV : UV);
public final static int[] LOW_TIERS = GTValues.tiersBetween(LV, EV);
public final static int[] HIGH_TIERS = GTValues.tiersBetween(IV, GTCEuAPI.isHighTier() ? OpV : UHV);

public final static MachineDefinition[] OXYGEN_SPREADER = registerTieredMachines("oxygen_spreader", OxygenSpreaderMachine::new,
(tier, builder) -> builder
.langValue("%s Oxygen Spreader".formatted(VNF[tier]))
.rotationState(RotationState.NON_Y_AXIS)
.hasTESR(true)
.renderer(() -> new TieredHullMachineRenderer(tier, GCyR.id("block/machine/oxygen_spreader_machine")))
.renderer(() -> new TieredHullMachineRenderer(tier, GCyR.id("block/machine/oxygen_spreader")))
.recipeType(GCyRRecipeTypes.OXYGEN_SPREADER_RECIPES)
.tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, GCyRRecipeTypes.OXYGEN_SPREADER_RECIPES, OxygenSpreaderMachine.tankScalingFunction(tier), true))
.blockBuilder(block -> block.tag(GCyRTags.PASSES_FLOOD_FILL))
.register(),
HIGH_TIERS);

public final static MachineDefinition[] FLUID_LOADER = registerTieredMachines("fluid_loader", FluidLoaderMachine::new,
(tier, builder) -> builder
.langValue("%s Fluid Loader".formatted(VNF[tier]))
.rotationState(RotationState.ALL)
.renderer(() -> new TieredHullMachineRenderer(tier, GCyR.id("block/machine/fluid_loader")))
.recipeType(GTRecipeTypes.DUMMY_RECIPES)
.register(),
LOW_TIERS);

public static final MachineDefinition ROCKET_SCANNER = REGISTRATE.multiblock("rocket_scanner", RocketScannerMachine::new)
.langValue("Rocket Scanner")
.rotationState(RotationState.NON_Y_AXIS)
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/argent_matter/gcyr/common/gui/EntityOxygenHUD.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package argent_matter.gcyr.common.gui;

import argent_matter.gcyr.GCyR;
import argent_matter.gcyr.common.item.armor.SpaceSuitArmorItem;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.gui.overlay.ForgeGui;
import net.minecraftforge.client.gui.overlay.IGuiOverlay;

public class EntityOxygenHUD implements IGuiOverlay {
public static final ResourceLocation GUI_TEXTURE = GCyR.id("textures/gui/oxygen_bar.png");

@Override
public void render(ForgeGui gui, GuiGraphics graphics, float partialTick, int screenWidth, int screenHeight) {
if (!gui.getMinecraft().options.hideGui) {
if (SpaceSuitArmorItem.hasFullSet(gui.getMinecraft().player)) {
gui.setupOverlayRenderState(true, false);
int minX = 32;
int minY = screenHeight - 32;
int maxY = minY + 16;
graphics.blit(GUI_TEXTURE, minX, minY, 0, 0, 32, 64, 64, 64);

long oxygenAmount = SpaceSuitArmorItem.oxygenAmount(gui.getMinecraft().player);
long maxOxygen = SpaceSuitArmorItem.oxygenMax(gui.getMinecraft().player);
if (maxOxygen == 0) {
return;
}
graphics.blit(GUI_TEXTURE, minX, minY, 0, 0, (int) (minX + (oxygenAmount * 32.0 / maxOxygen)), 64, 64, 64);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.lowdragmc.lowdraglib.misc.ItemStackTransfer;
import com.lowdragmc.lowdraglib.side.fluid.FluidHelper;
import com.lowdragmc.lowdraglib.side.fluid.FluidStack;
import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.entity.EquipmentSlot;
Expand Down Expand Up @@ -30,6 +31,16 @@ public <T> LazyOptional<T> getCapability(@Nonnull final ItemStack itemStack, @No
return LazyOptional.empty();
}

@Override
public int getBarWidth(ItemStack stack) {
return Math.round(13.0F - (float)oxygenAmount(stack) * 13.0F / (float)oxygenMax(stack));
}

@Override
public int getBarColor(ItemStack stack) {
return 0xff84ebf5;
}

public static boolean hasFullSet(LivingEntity entity) {
int slotCount = 0;
int armorCount = 0;
Expand Down Expand Up @@ -59,12 +70,43 @@ public static boolean hasOxygenatedSpaceSuit(LivingEntity entity) {
return false;
}

public static long oxygenAmount(LivingEntity entity) {
ItemStack chest = entity.getItemBySlot(EquipmentSlot.CHEST);
return oxygenAmount(chest);
}

public static long oxygenAmount(ItemStack stack) {
if (stack.getItem() instanceof SpaceSuitArmorItem) {
var storage = new ItemStackTransfer(stack);
var fluid = FluidTransferHelper.getFluidTransfer(storage, 0);
if (fluid != null) {
return fluid.getFluidInTank(0).getAmount();
}
}
return 0;
}

public static long oxygenMax(LivingEntity entity) {
ItemStack chest = entity.getItemBySlot(EquipmentSlot.CHEST);
return oxygenMax(chest);
}

public static long oxygenMax(ItemStack stack) {
if (stack.getItem() instanceof SpaceSuitArmorItem) {
var fluid = FluidTransferHelper.getFluidTransfer(new ItemStackTransfer(stack), 0);
if (fluid != null) {
return fluid.getTankCapacity(0);
}
}
return 0;
}

public static void consumeSpaceSuitOxygen(LivingEntity entity, int amount) {
ItemStack chest = entity.getItemBySlot(EquipmentSlot.CHEST);
var storage = new ItemStackTransfer(chest);
var fluid = FluidTransferHelper.getFluidTransfer(storage, 0);
if (chest.getItem() instanceof SpaceSuitArmorItem) {
fluid.drain(amount, false);
var storage = new ItemStackTransfer(chest);
var fluid = FluidTransferHelper.getFluidTransfer(storage, 0);
fluid.drain(FluidStack.create(fluid.getFluidInTank(0), amount), false, true);
}

}
Expand Down
Loading

0 comments on commit 146950b

Please sign in to comment.