Skip to content

Commit

Permalink
Add Reservoir Hatch & Adjust model (#1576)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwer523 authored Jul 13, 2024
1 parent 258383a commit 9ae30e7
Show file tree
Hide file tree
Showing 44 changed files with 194 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"page": "gtceu:parts/buffer_part",
"position": [
-100,
-50,
100
],
"section": "gtceu:parts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
],
"page": "gtceu:parts/diode",
"position": [
-50,
100
-250,
150
],
"section": "gtceu:parts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"page": "gtceu:parts/parallel_hatch",
"position": [
-200,
-150,
150
],
"section": "gtceu:parts"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"button_texture": {
"type": "item",
"res": "gtceu:reservoir_hatch"
},
"items": [
"gtceu:reservoir_hatch"
],
"page": "gtceu:parts/reservoir_hatch",
"position": [
-100,
100
],
"section": "gtceu:parts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"page": "gtceu:parts/rotor_holder",
"position": [
-250,
-200,
150
],
"section": "gtceu:parts"
Expand Down
2 changes: 2 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@
"block.gtceu.red_lamp": "dɯɐꞀ pǝᴚ",
"block.gtceu.reinforced_stone": "ǝuoʇS pǝɔɹoɟuıǝᴚ",
"block.gtceu.research_station": "uoıʇɐʇS ɥɔɹɐǝsǝᴚ",
"block.gtceu.reservoir_hatch": "ɥɔʇɐH ɹıoʌɹǝsǝᴚ",
"block.gtceu.robust_machine_casing": "buısɐƆ ǝuıɥɔɐW ןǝǝʇsuǝʇsbun⟘ ʇsnqoᴚ",
"block.gtceu.rtm_alloy_coil_block": "ʞɔoןᗺ ןıoƆ ʎoןןⱯ W⟘ᴚ",
"block.gtceu.rubber_button": "uoʇʇnᗺ ɹǝqqnᴚ",
Expand Down Expand Up @@ -1997,6 +1998,7 @@
"compass.node.gtceu.parts/muffler_hatch": "ɥɔʇɐH ɹǝןɟɟnW",
"compass.node.gtceu.parts/parallel_hatch": "ɥɔʇɐH ןǝןןɐɹɐԀ",
"compass.node.gtceu.parts/pump_hatch": "ɥɔʇɐH dɯnԀ",
"compass.node.gtceu.parts/reservoir_hatch": "ɥɔʇɐH ɹıoʌɹǝsǝᴚ",
"compass.node.gtceu.parts/rotor_holder": "ɹǝpןoH ɹoʇoᴚ",
"compass.node.gtceu.parts/steam_hatch": "ɥɔʇɐH ɯɐǝʇS",
"compass.node.gtceu.steam/coke_oven": "uǝʌO ǝʞoƆ",
Expand Down
2 changes: 2 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@
"block.gtceu.red_lamp": "Red Lamp",
"block.gtceu.reinforced_stone": "Reinforced Stone",
"block.gtceu.research_station": "Research Station",
"block.gtceu.reservoir_hatch": "Reservoir Hatch",
"block.gtceu.robust_machine_casing": "Robust Tungstensteel Machine Casing",
"block.gtceu.rtm_alloy_coil_block": "RTM Alloy Coil Block",
"block.gtceu.rubber_button": "Rubber Button",
Expand Down Expand Up @@ -1997,6 +1998,7 @@
"compass.node.gtceu.parts/muffler_hatch": "Muffler Hatch",
"compass.node.gtceu.parts/parallel_hatch": "Parallel Hatch",
"compass.node.gtceu.parts/pump_hatch": "Pump Hatch",
"compass.node.gtceu.parts/reservoir_hatch": "Reservoir Hatch",
"compass.node.gtceu.parts/rotor_holder": "Rotor Holder",
"compass.node.gtceu.parts/steam_hatch": "Steam Hatch",
"compass.node.gtceu.steam/coke_oven": "Coke Oven",
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,20 @@ public static BiConsumer<ItemStack, List<Component>> createTankTooltips(String n
.register(),
ELECTRIC_TIERS);

public static final MachineDefinition RESERVOIR_HATCH = REGISTRATE
.machine("reservoir_hatch", ReservoirHatchPartMachine::new)
.langValue("Reservoir Hatch")
.tier(EV)
.rotationState(RotationState.ALL)
.abilities(PartAbility.IMPORT_FLUIDS)
.tooltips(
Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity",
ReservoirHatchPartMachine.FLUID_AMOUNT),
Component.translatable("gtceu.universal.enabled"))
.overlayTieredHullRenderer("reservoir_hatch")
.compassNodeSelf()
.register();

public static final MachineDefinition[] INPUT_BUFFER = registerTieredMachines(
"input_buffer",
(holder, tier) -> new BufferPartMachine(holder, tier, IO.IN),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package com.gregtechceu.gtceu.common.machine.multiblock.part;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank;

import com.lowdragmc.lowdraglib.misc.FluidStorage;
import com.lowdragmc.lowdraglib.side.fluid.FluidStack;

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.material.Fluids;

import java.util.Collections;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class ReservoirHatchPartMachine extends FluidHatchPartMachine {

protected InfiniteWaterTank waterTank;

public static final long FLUID_AMOUNT = 2_000_000_000L;

public ReservoirHatchPartMachine(IMachineBlockEntity holder, Object... args) {
super(holder, GTValues.EV, IO.IN, FLUID_AMOUNT, 1, args);
}

//////////////////////////////////
// ****** Initialization ****** //
//////////////////////////////////

@Override
protected NotifiableFluidTank createTank(long initialCapacity, int slots, Object... args) {
this.waterTank = new InfiniteWaterTank(initialCapacity);
// allow both importing and exporting from the tank
return new NotifiableFluidTank(this, Collections.singletonList(waterTank), io, IO.BOTH);
}

//////////////////////////////////
// ******** Fill Water ******** //
//////////////////////////////////

@Override
protected void updateTankSubscription() {
if (isWorkingEnabled() && !waterTank.isFull()) {
autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO);
} else if (autoIOSubs != null) {
autoIOSubs.unsubscribe();
autoIOSubs = null;
}
}

@Override
protected void autoIO() {
// replace with refilling water tank
if (getOffsetTimer() % 20 == 0) {
waterTank.refillWater();
updateTankSubscription();
}
}

protected static class InfiniteWaterTank extends FluidStorage {

private static final CompoundTag EMPTY = new CompoundTag();
private static final FluidStack WATER = FluidStack.create(Fluids.WATER, Long.MAX_VALUE);

public InfiniteWaterTank(long capacity) {
super(capacity);
// start with the full amount
setFluid(FluidStack.create(Fluids.WATER, capacity));
}

public void refillWater() {
// call super since our overrides don't allow any kind of filling
super.fill(0, WATER, false, true);
}

public boolean isFull() {
return getFluidAmount() >= capacity;
}

@Override
public boolean supportsFill(int tank) {
// don't allow external callers to fill this tank
return false;
}

@Override
public long fill(int tank, FluidStack resource, boolean simulate, boolean notifyChange) {
// don't allow external filling
return 0;
}

@Override
public CompoundTag serializeNBT() {
// serialization is unnecessary here, we can always recreate it completely full since it would refill anyway
return EMPTY;
}

@Override
public void deserializeNBT(CompoundTag nbt) {}

@Override
public FluidStorage copy() {
var storage = new InfiniteWaterTank(capacity);
storage.setFluid(fluid.copy());
return storage;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
public class MetaTileEntityMachineRecipeLoader {

public static void init(Consumer<FinishedRecipe> provider) {
// Reservoir Hatch
ASSEMBLER_RECIPES.recipeBuilder("reservoir_hatch")
.inputItems(COVER_INFINITE_WATER)
.inputItems(FLUID_IMPORT_HATCH[EV])
.inputItems(ELECTRIC_PUMP_EV)
.outputItems(RESERVOIR_HATCH)
.duration(300).EUt(VA[EV]).save(provider);

registerLaserRecipes(provider);

// Energy Output Hatches
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_data_hatch_optical",
"overlay_emissive": "gtceu:block/overlay/machine/overlay_data_hatch_optical_emissive"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_data_hatch",
"overlay_emissive": "gtceu:block/overlay/machine/overlay_data_hatch_emissive"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_data_hatch_creative",
"overlay_emissive": "gtceu:block/overlay/machine/overlay_data_hatch_creative_emissive"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_out_multi"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_out_ultra"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_out_hi"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_in_multi"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_in_ultra"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_in_hi"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_out",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_out_4x",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_out_9x",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_in",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_in_4x",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_in_9x",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_energy_out"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_out",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_hatch",
"overlay": "gtceu:block/overlay/machine/overlay_pipe_in",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_laser_source"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_2",
"parent": "gtceu:block/overlay/tinted/front_2",
"textures": {
"overlay": "gtceu:block/overlay/machine/overlay_laser_target"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_maintenance_cleaning",
"overlay": "gtceu:block/overlay/machine/overlay_maintenance_cleaning",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front",
"parent": "gtceu:block/overlay/front",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_maintenance_configurable",
"overlay": "gtceu:block/overlay/machine/overlay_maintenance_configurable"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "gtceu:block/machine/part/overlay_front_emissive",
"parent": "gtceu:block/overlay/front_emissive",
"textures": {
"particle": "gtceu:block/overlay/machine/overlay_maintenance_full_auto",
"overlay": "gtceu:block/overlay/machine/overlay_maintenance_full_auto",
Expand Down
Loading

0 comments on commit 9ae30e7

Please sign in to comment.