Campfire WTHIT and TOP integration
This commit is contained in:
@@ -23,8 +23,8 @@ minecraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
||||||
compileOnly("me.hypherionmc.craterlib:CraterLib-common-1.19.1:${craterlib_version}")
|
compileOnly("me.hypherionmc.craterlib:CraterLib-common-1.19.1:${craterlib_version}")
|
||||||
compileOnly("com.lowdragmc.shimmer:Shimmer-common-1.19.1:${shimmer_version}")
|
compileOnly("com.lowdragmc.shimmer:Shimmer-common-1.19.1:${shimmer_version}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,4 +12,6 @@ public class Constants {
|
|||||||
public static ResourceLocation rl(String name) {
|
public static ResourceLocation rl(String name) {
|
||||||
return new ResourceLocation(MOD_ID, name);
|
return new ResourceLocation(MOD_ID, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String THE_ONE_PROBE = "theoneprobe";
|
||||||
}
|
}
|
||||||
|
@@ -31,13 +31,10 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
public class AdvancedCampfireBlockEntity extends BlockEntity implements Clearable, ISidedTickable {
|
public class AdvancedCampfireBlockEntity extends BlockEntity implements Clearable, ISidedTickable {
|
||||||
|
|
||||||
private static final int BURN_COOL_SPEED = 2;
|
|
||||||
private static final int NUM_SLOTS = 4;
|
|
||||||
|
|
||||||
private final NonNullList<ItemStack> items = NonNullList.withSize(4, ItemStack.EMPTY);
|
private final NonNullList<ItemStack> items = NonNullList.withSize(4, ItemStack.EMPTY);
|
||||||
|
|
||||||
private final int[] cookingProgress = new int[4];
|
public final int[] cookingProgress = new int[4];
|
||||||
private final int[] cookingTime = new int[4];
|
public final int[] cookingTime = new int[4];
|
||||||
|
|
||||||
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
|
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
|
||||||
|
|
||||||
@@ -135,7 +132,7 @@ public class AdvancedCampfireBlockEntity extends BlockEntity implements Clearabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void saveAdditional(CompoundTag compoundTag) {
|
public void saveAdditional(CompoundTag compoundTag) {
|
||||||
super.saveAdditional(compoundTag);
|
super.saveAdditional(compoundTag);
|
||||||
ContainerHelper.saveAllItems(compoundTag, this.items, true);
|
ContainerHelper.saveAllItems(compoundTag, this.items, true);
|
||||||
compoundTag.putIntArray("CookingTimes", this.cookingProgress);
|
compoundTag.putIntArray("CookingTimes", this.cookingProgress);
|
||||||
|
@@ -6,6 +6,10 @@ plugins {
|
|||||||
|
|
||||||
archivesBaseName = "${mod_name}-fabric-${minecraft_version}"
|
archivesBaseName = "${mod_name}-fabric-${minecraft_version}"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" }
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||||
mappings loom.officialMojangMappings()
|
mappings loom.officialMojangMappings()
|
||||||
@@ -32,6 +36,17 @@ dependencies {
|
|||||||
modImplementation ("com.lowdragmc.shimmer:Shimmer-fabric-1.19.1:${shimmer_version}") {
|
modImplementation ("com.lowdragmc.shimmer:Shimmer-fabric-1.19.1:${shimmer_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The One Probe Fabric
|
||||||
|
modCompileOnly("mcjty.theoneprobe:theoneprobe-fabric:${top_fabric}")
|
||||||
|
|
||||||
|
// WTHIT
|
||||||
|
// compile against the API
|
||||||
|
modCompileOnly "mcp.mobius.waila:wthit-api:fabric-${wthitVersion}"
|
||||||
|
|
||||||
|
// run against the full jar
|
||||||
|
modRuntimeOnly "mcp.mobius.waila:wthit:fabric-${wthitVersion}"
|
||||||
|
modRuntimeOnly "lol.bai:badpackets:fabric-0.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.top;
|
||||||
|
|
||||||
|
import mcjty.theoneprobe.api.IProbeConfig;
|
||||||
|
import mcjty.theoneprobe.api.ITheOneProbe;
|
||||||
|
import mcjty.theoneprobe.api.ITheOneProbePlugin;
|
||||||
|
import me.hypherionmc.hyperlighting.common.integration.top.overrides.TOPCampfireInfoProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class TOPIntegration implements ITheOneProbePlugin {
|
||||||
|
|
||||||
|
private static ITheOneProbe theOneProbe;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad(ITheOneProbe apiInstance) {
|
||||||
|
TOPIntegration.theOneProbe = apiInstance;
|
||||||
|
|
||||||
|
theOneProbe.registerBlockDisplayOverride(new TOPCampfireInfoProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IProbeConfig getProbeConfig() {
|
||||||
|
return theOneProbe.createProbeConfig();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,60 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.top.overrides;
|
||||||
|
|
||||||
|
import mcjty.theoneprobe.api.*;
|
||||||
|
import me.hypherionmc.hyperlighting.Constants;
|
||||||
|
import me.hypherionmc.hyperlighting.common.blockentities.AdvancedCampfireBlockEntity;
|
||||||
|
import me.hypherionmc.hyperlighting.common.integration.top.TOPIntegration;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
import static mcjty.theoneprobe.api.IProbeConfig.ConfigMode.EXTENDED;
|
||||||
|
import static mcjty.theoneprobe.api.IProbeConfig.ConfigMode.NORMAL;
|
||||||
|
import static mcjty.theoneprobe.api.TextStyleClass.MODNAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class TOPCampfireInfoProvider implements IBlockDisplayOverride {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean overrideStandardInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player playerEntity, Level world, BlockState blockState, IProbeHitData iProbeHitData) {
|
||||||
|
IProbeConfig config = TOPIntegration.getProbeConfig();
|
||||||
|
|
||||||
|
if (probeMode != ProbeMode.DEBUG) {
|
||||||
|
if (world.getBlockEntity(iProbeHitData.getPos()) instanceof AdvancedCampfireBlockEntity tileCampFire) {
|
||||||
|
String modName = FabricLoader.getInstance().getModContainer(Constants.MOD_ID).get().getMetadata().getName();
|
||||||
|
iProbeInfo
|
||||||
|
.horizontal()
|
||||||
|
.item(iProbeHitData.getPickBlock())
|
||||||
|
.vertical()
|
||||||
|
.text(CompoundText.create().name(blockState.getBlock().getName()))
|
||||||
|
.vertical()
|
||||||
|
.text(CompoundText.create().info(MODNAME + modName));
|
||||||
|
|
||||||
|
for (int i = 0; i < tileCampFire.getItems().size(); i++) {
|
||||||
|
ItemStack stack = tileCampFire.getItems().get(i);
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
iProbeInfo
|
||||||
|
.horizontal()
|
||||||
|
.item(stack)
|
||||||
|
.horizontal()
|
||||||
|
.progress(
|
||||||
|
(int) ((float) tileCampFire.cookingTime[i] / tileCampFire.cookingProgress[i] * 100),
|
||||||
|
100,
|
||||||
|
iProbeInfo.defaultProgressStyle().suffix(" %").alignment(ElementAlignment.ALIGN_TOPLEFT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean show(ProbeMode mode, IProbeConfig.ConfigMode cfg) {
|
||||||
|
return cfg == NORMAL || (cfg == EXTENDED && mode == ProbeMode.EXTENDED);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.wthit;
|
||||||
|
|
||||||
|
import mcp.mobius.waila.api.IPluginConfig;
|
||||||
|
import mcp.mobius.waila.api.IServerAccessor;
|
||||||
|
import mcp.mobius.waila.api.IServerDataProvider;
|
||||||
|
import me.hypherionmc.hyperlighting.common.blockentities.AdvancedCampfireBlockEntity;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class CampfireDataProvider implements IServerDataProvider<AdvancedCampfireBlockEntity> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void appendServerData(CompoundTag data, IServerAccessor<AdvancedCampfireBlockEntity> accessor, IPluginConfig config) {
|
||||||
|
CompoundTag tag = new CompoundTag();
|
||||||
|
accessor.getTarget().saveAdditional(tag);
|
||||||
|
data.put("hl_campfire", tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.wthit;
|
||||||
|
|
||||||
|
import mcp.mobius.waila.api.IBlockAccessor;
|
||||||
|
import mcp.mobius.waila.api.IBlockComponentProvider;
|
||||||
|
import mcp.mobius.waila.api.IPluginConfig;
|
||||||
|
import mcp.mobius.waila.api.ITooltip;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.world.ContainerHelper;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class CampfireProvider implements IBlockComponentProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void appendBody(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) {
|
||||||
|
CompoundTag compound = accessor.getServerData().getCompound("hl_campfire");
|
||||||
|
int[] cookingTimes = new int[4];
|
||||||
|
int[] cookingTotalTimes = new int[4];
|
||||||
|
NonNullList<ItemStack> inventory = NonNullList.withSize(4, ItemStack.EMPTY);
|
||||||
|
|
||||||
|
inventory.clear();
|
||||||
|
ContainerHelper.loadAllItems(compound, inventory);
|
||||||
|
if (compound.contains("CookingTimes", 11)) {
|
||||||
|
int[] aint = compound.getIntArray("CookingTimes");
|
||||||
|
System.arraycopy(aint, 0, cookingTimes, 0, Math.min(cookingTotalTimes.length, aint.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (compound.contains("CookingTotalTimes", 11)) {
|
||||||
|
int[] aint1 = compound.getIntArray("CookingTotalTimes");
|
||||||
|
System.arraycopy(aint1, 0, cookingTotalTimes, 0, Math.min(cookingTotalTimes.length, aint1.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inventory.isEmpty()) {
|
||||||
|
tooltip.addLine(Component.literal(ChatFormatting.RED + "Empty"));
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < inventory.size(); i++) {
|
||||||
|
if (!inventory.get(i).isEmpty()) {
|
||||||
|
int progress = (int) ((float) cookingTimes[i] / cookingTotalTimes[i] * 100);
|
||||||
|
tooltip.addLine(Component.literal(inventory.get(i).getDisplayName().getString() + " : " + ChatFormatting.YELLOW + progress + "%"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,24 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.wthit;
|
||||||
|
|
||||||
|
import mcp.mobius.waila.api.IRegistrar;
|
||||||
|
import mcp.mobius.waila.api.IWailaPlugin;
|
||||||
|
import mcp.mobius.waila.api.TooltipPosition;
|
||||||
|
import me.hypherionmc.hyperlighting.Constants;
|
||||||
|
import me.hypherionmc.hyperlighting.common.blockentities.AdvancedCampfireBlockEntity;
|
||||||
|
import me.hypherionmc.hyperlighting.common.blocks.AdvancedCampfire;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class HLWTHITPlugin implements IWailaPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(IRegistrar registrar) {
|
||||||
|
Constants.LOG.info("Registering WTHIT Plugins");
|
||||||
|
//registrar.addComponent(new FogMachineProvider(), TooltipPosition.BODY, FogMachineBlock.class);
|
||||||
|
|
||||||
|
registrar.addBlockData(new CampfireDataProvider(), AdvancedCampfireBlockEntity.class);
|
||||||
|
registrar.addComponent(new CampfireProvider(), TooltipPosition.BODY, AdvancedCampfire.class);
|
||||||
|
}
|
||||||
|
}
|
@@ -23,6 +23,9 @@
|
|||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"me.hypherionmc.hyperlighting.client.HyperLightingFabricClient"
|
"me.hypherionmc.hyperlighting.client.HyperLightingFabricClient"
|
||||||
|
],
|
||||||
|
"top_plugin": [
|
||||||
|
"me.hypherionmc.hyperlighting.common.integration.top.TOPIntegration"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
@@ -37,5 +40,11 @@
|
|||||||
"java": ">=17",
|
"java": ">=17",
|
||||||
"craterlib": "*"
|
"craterlib": "*"
|
||||||
},
|
},
|
||||||
|
"custom": {
|
||||||
|
"waila:plugins": {
|
||||||
|
"id": "hyperlighting:waila_compat",
|
||||||
|
"initializer": "me.hypherionmc.hyperlighting.common.integration.wthit.HLWTHITPlugin"
|
||||||
|
}
|
||||||
|
},
|
||||||
"accessWidener": "hyperlighting.aw"
|
"accessWidener": "hyperlighting.aw"
|
||||||
}
|
}
|
||||||
|
@@ -90,6 +90,10 @@ dependencies {
|
|||||||
|
|
||||||
// Shimmer
|
// Shimmer
|
||||||
implementation fg.deobf("com.lowdragmc.shimmer:Shimmer-forge-1.19.1:${shimmer_version}")
|
implementation fg.deobf("com.lowdragmc.shimmer:Shimmer-forge-1.19.1:${shimmer_version}")
|
||||||
|
|
||||||
|
// The One Probe
|
||||||
|
implementation "mcjty.theoneprobe:theoneprobe:${top_version}:api"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
@@ -8,12 +8,14 @@ import me.hypherionmc.hyperlighting.common.entities.NeonFlyEntity;
|
|||||||
import me.hypherionmc.hyperlighting.common.init.CommonRegistration;
|
import me.hypherionmc.hyperlighting.common.init.CommonRegistration;
|
||||||
import me.hypherionmc.hyperlighting.common.init.HLBlockEntities;
|
import me.hypherionmc.hyperlighting.common.init.HLBlockEntities;
|
||||||
import me.hypherionmc.hyperlighting.common.init.HLEntities;
|
import me.hypherionmc.hyperlighting.common.init.HLEntities;
|
||||||
|
import me.hypherionmc.hyperlighting.common.integration.top.TOPIntegration;
|
||||||
import me.hypherionmc.hyperlighting.common.worldgen.ForgeWorldGen;
|
import me.hypherionmc.hyperlighting.common.worldgen.ForgeWorldGen;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||||
import net.minecraft.world.entity.SpawnPlacements;
|
import net.minecraft.world.entity.SpawnPlacements;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraftforge.client.ConfigScreenHandler;
|
import net.minecraftforge.client.ConfigScreenHandler;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
@@ -30,6 +32,10 @@ public class HyperLightingForge {
|
|||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonInit);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonInit);
|
||||||
CommonRegistration.registerAll();
|
CommonRegistration.registerAll();
|
||||||
|
|
||||||
|
if (ModList.get().isLoaded(Constants.THE_ONE_PROBE)) {
|
||||||
|
new TOPIntegration().setup();
|
||||||
|
}
|
||||||
|
|
||||||
ForgeWorldGen.registerAll(FMLJavaModLoadingContext.get().getModEventBus());
|
ForgeWorldGen.registerAll(FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
registration.registerEvents();
|
registration.registerEvents();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,42 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.top;
|
||||||
|
|
||||||
|
import mcjty.theoneprobe.api.IProbeConfig;
|
||||||
|
import mcjty.theoneprobe.api.ITheOneProbe;
|
||||||
|
import me.hypherionmc.hyperlighting.Constants;
|
||||||
|
import me.hypherionmc.hyperlighting.common.integration.top.overrides.TOPCampfireInfoProvider;
|
||||||
|
import net.minecraftforge.fml.InterModComms;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class TOPIntegration implements Function<ITheOneProbe, Void> {
|
||||||
|
|
||||||
|
private static ITheOneProbe theOneProbe;
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::sendIMC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendIMC(InterModEnqueueEvent event) {
|
||||||
|
Constants.LOG.info("Registering TOP integration");
|
||||||
|
InterModComms.sendTo(Constants.THE_ONE_PROBE, "getTheOneProbe", TOPIntegration::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Void apply(ITheOneProbe theOneProbe) {
|
||||||
|
TOPIntegration.theOneProbe = theOneProbe;
|
||||||
|
|
||||||
|
TOPCampfireInfoProvider topCampfireInfoProvider = new TOPCampfireInfoProvider();
|
||||||
|
theOneProbe.registerBlockDisplayOverride(topCampfireInfoProvider);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IProbeConfig getProbeConfig() {
|
||||||
|
return theOneProbe.createProbeConfig();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,60 @@
|
|||||||
|
package me.hypherionmc.hyperlighting.common.integration.top.overrides;
|
||||||
|
|
||||||
|
import mcjty.theoneprobe.api.*;
|
||||||
|
import me.hypherionmc.hyperlighting.Constants;
|
||||||
|
import me.hypherionmc.hyperlighting.common.blockentities.AdvancedCampfireBlockEntity;
|
||||||
|
import me.hypherionmc.hyperlighting.common.integration.top.TOPIntegration;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
|
|
||||||
|
import static mcjty.theoneprobe.api.IProbeConfig.ConfigMode.EXTENDED;
|
||||||
|
import static mcjty.theoneprobe.api.IProbeConfig.ConfigMode.NORMAL;
|
||||||
|
import static mcjty.theoneprobe.api.TextStyleClass.MODNAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HypherionSA
|
||||||
|
* @date 27/08/2022
|
||||||
|
*/
|
||||||
|
public class TOPCampfireInfoProvider implements IBlockDisplayOverride {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean overrideStandardInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player playerEntity, Level world, BlockState blockState, IProbeHitData iProbeHitData) {
|
||||||
|
IProbeConfig config = TOPIntegration.getProbeConfig();
|
||||||
|
|
||||||
|
if (probeMode != ProbeMode.DEBUG) {
|
||||||
|
if (world.getBlockEntity(iProbeHitData.getPos()) instanceof AdvancedCampfireBlockEntity tileCampFire) {
|
||||||
|
String modName = ModList.get().getModContainerById(Constants.MOD_ID).get().getModInfo().getDisplayName();
|
||||||
|
iProbeInfo
|
||||||
|
.horizontal()
|
||||||
|
.item(iProbeHitData.getPickBlock())
|
||||||
|
.vertical()
|
||||||
|
.text(CompoundText.create().name(blockState.getBlock().getName()))
|
||||||
|
.vertical()
|
||||||
|
.text(CompoundText.create().info(MODNAME + modName));
|
||||||
|
|
||||||
|
for (int i = 0; i < tileCampFire.getItems().size(); i++) {
|
||||||
|
ItemStack stack = tileCampFire.getItems().get(i);
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
iProbeInfo
|
||||||
|
.horizontal()
|
||||||
|
.item(stack)
|
||||||
|
.horizontal()
|
||||||
|
.progress(
|
||||||
|
(int) ((float) tileCampFire.cookingTime[i] / tileCampFire.cookingProgress[i] * 100),
|
||||||
|
100,
|
||||||
|
iProbeInfo.defaultProgressStyle().suffix(" %").alignment(ElementAlignment.ALIGN_TOPLEFT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean show(ProbeMode mode, IProbeConfig.ConfigMode cfg) {
|
||||||
|
return cfg == NORMAL || (cfg == EXTENDED && mode == ProbeMode.EXTENDED);
|
||||||
|
}
|
||||||
|
}
|
@@ -57,6 +57,10 @@ subprojects {
|
|||||||
name = "Curseforge Maven"
|
name = "Curseforge Maven"
|
||||||
url 'https://cfa2.cursemaven.com'
|
url 'https://cfa2.cursemaven.com'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maven { url = "https://maven.k-4u.nl" }
|
||||||
|
maven { url = "https://maven.wispforest.io/" }
|
||||||
|
maven { url "https://maven.bai.lol" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -33,3 +33,6 @@ mod_menu_version=4.0.5
|
|||||||
shimmer_version=0.1.11d
|
shimmer_version=0.1.11d
|
||||||
sodium_version=3820973
|
sodium_version=3820973
|
||||||
ribidium_version=3864138
|
ribidium_version=3864138
|
||||||
|
top_version=1.19-6.2.0-6
|
||||||
|
top_fabric=1.19-6.0.0
|
||||||
|
wthitVersion=5.11.3
|
||||||
|
Reference in New Issue
Block a user