Skip to content

Commit

Permalink
Mixer JAde
Browse files Browse the repository at this point in the history
  • Loading branch information
Leclowndu93150 committed Sep 28, 2024
1 parent a79e839 commit 21d6ea2
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public IPowerStorage getPowerStorage() {
return powerStorage;
}


protected ItemStackHandler getItemStackHandler() {
return itemHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.portingdeadmods.nautec.content.blocks.AquaticCatalystBlock;
import com.portingdeadmods.nautec.content.blocks.LaserJunctionBlock;
import com.portingdeadmods.nautec.content.blocks.MixerBlock;
import snownee.jade.api.IWailaClientRegistration;
import snownee.jade.api.IWailaCommonRegistration;
import snownee.jade.api.IWailaPlugin;
Expand All @@ -19,6 +20,6 @@ public void register(IWailaCommonRegistration registration) {
public void registerClient(IWailaClientRegistration registration) {
registration.registerBlockComponent(AquaticCatalystComponentProvider.INSTANCE, AquaticCatalystBlock.class);
registration.registerBlockComponent(LaserJunctionComponentProvider.INSTANCE, LaserJunctionBlock.class);

registration.registerBlockComponent(MixerComponentProvider.INSTANCE, MixerBlock.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.portingdeadmods.nautec.compat.jade;

import com.portingdeadmods.nautec.Nautec;
import com.portingdeadmods.nautec.content.blockentities.AquaticCatalystBlockEntity;
import com.portingdeadmods.nautec.content.blockentities.MixerBlockEntity;
import com.portingdeadmods.nautec.content.blocks.MixerBlock;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.fluids.FluidStack;
import snownee.jade.api.BlockAccessor;
import snownee.jade.api.IBlockComponentProvider;
import snownee.jade.api.ITooltip;
import snownee.jade.api.config.IPluginConfig;

public enum MixerComponentProvider implements IBlockComponentProvider {
INSTANCE;


@Override
public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPluginConfig iPluginConfig) {
if (blockAccessor.getBlockEntity() instanceof MixerBlockEntity blockEntity) {
// Display the input fluid and its amount
FluidStack inputFluid = blockEntity.getInputFluid();
iTooltip.add(Component.literal("Fluid Input: ")
.append(Component.translatable(inputFluid.getFluid().getFluidType().getDescriptionId()))
.append(" - " + blockEntity.getInputFluidAmount() + " mB"));

// Display the output fluid and its amount
FluidStack outputFluid = blockEntity.getOutputFluid();
iTooltip.add(Component.literal("Fluid Output: ")
.append(Component.translatable(outputFluid.getFluid().getFluidType().getDescriptionId()))
.append(" - " + blockEntity.getOutputFluidAmount() + " mB"));


// Display the current duration and max duration of the mixing process
int duration = blockEntity.getDuration();
int maxDuration = blockEntity.getMaxDuration();
iTooltip.add(Component.literal("Mixing Progress: " + duration + " / " + maxDuration + " ticks"));

iTooltip.add(Component.literal("Energy: " + blockEntity.getPower() + " AP"));

}
}

@Override
public ResourceLocation getUid() {
return ResourceLocation.fromNamespaceAndPath(Nautec.MODID, "mixer");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,33 @@ protected void saveData(CompoundTag tag, HolderLookup.Provider provider) {
tag.putInt("duration", this.duration);
}

public FluidStack getInputFluid() {
return getFluidTank().getFluid();
}

public int getInputFluidAmount() {
return getFluidTank().getFluidAmount();
}

public FluidStack getOutputFluid() {
return getSecondaryFluidTank().getFluid();
}

public int getOutputFluidAmount() {
return getSecondaryFluidTank().getFluidAmount();
}

public int getDuration() {
return this.duration;
}

public boolean isActive() {
return this.active;
}

public int getMaxDuration() {
return getRecipe().map(MixingRecipe::duration).orElse(0);
}


}

0 comments on commit 21d6ea2

Please sign in to comment.