Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
import com.yision.fluidlogistics.config.FeatureToggle;
import com.yision.fluidlogistics.registry.AllBlocks;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.entity.BlockEntity;
Expand All @@ -22,6 +19,10 @@
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class FluidTransporterBlockEntity extends SmartBlockEntity {

private static final int INTERNAL_BUFFER_CAPACITY = 1000;
Expand Down Expand Up @@ -186,8 +187,10 @@ private boolean canActivate() {

BlockPos targetPos = worldPosition.relative(facing);
BlockState targetState = level.getBlockState(targetPos);
if (FluidTransporterBlock.isInfiniteWaterSource(targetState)) {
return WATERLOGGED_LEAVES_HANDLER;
if (FeatureToggle.isEnabled(FeatureToggle.FLUID_TRANSPORTER_GET_WATER)){
if (FluidTransporterBlock.isInfiniteWaterSource(targetState)) {
return WATERLOGGED_LEAVES_HANDLER;
}
}

return grabCapability(facing);
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/yision/fluidlogistics/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Config {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();

private static final boolean FLUID_TRANSPORTER_ENABLED_DEFAULT = true;
private static final boolean FLUID_TRANSPORTER_GET_WATER_FROM_LEAVES_DEFAULT = true;
private static final boolean SMART_FAUCET_ENABLED_DEFAULT = true;
private static final boolean FAUCET_ENABLED_DEFAULT = true;
private static final boolean MULTI_FLUID_TANK_ENABLED_DEFAULT = true;
Expand Down Expand Up @@ -42,6 +43,11 @@ public class Config {
.translation("fluidlogistics.configuration.fluidTransporterEnabled")
.define("fluidTransporterEnabled", FLUID_TRANSPORTER_ENABLED_DEFAULT);

public static final ForgeConfigSpec.BooleanValue FLUID_TRANSPORTER_GET_WATER_FROM_LEAVES = BUILDER
.comment("Can extract water from waterlogged leaves")
.translation("fluidlogistics.configuration.fluidTransporterGetWaterFromLeaves")
.define("fluidTransporterGetWaterFromLeaves", FLUID_TRANSPORTER_GET_WATER_FROM_LEAVES_DEFAULT);

public static final ForgeConfigSpec.BooleanValue SMART_FAUCET_ENABLED = BUILDER
.comment("Enables smart faucet")
.translation("fluidlogistics.configuration.smartFaucetEnabled")
Expand Down Expand Up @@ -140,6 +146,7 @@ public class Config {
public static final ForgeConfigSpec SPEC = BUILDER.build();

private static boolean fluidTransporterEnabled = FLUID_TRANSPORTER_ENABLED_DEFAULT;
private static boolean fluidTransporterGetWaterFromLeaves = FLUID_TRANSPORTER_GET_WATER_FROM_LEAVES_DEFAULT;
private static boolean smartFaucetEnabled = SMART_FAUCET_ENABLED_DEFAULT;
private static boolean faucetEnabled = FAUCET_ENABLED_DEFAULT;
private static boolean multiFluidTankEnabled = MULTI_FLUID_TANK_ENABLED_DEFAULT;
Expand All @@ -161,6 +168,7 @@ public class Config {
@SubscribeEvent
static void onLoad(final ModConfigEvent event) {
fluidTransporterEnabled = FLUID_TRANSPORTER_ENABLED.get();
fluidTransporterGetWaterFromLeaves = FLUID_TRANSPORTER_GET_WATER_FROM_LEAVES.get();
smartFaucetEnabled = SMART_FAUCET_ENABLED.get();
faucetEnabled = FAUCET_ENABLED.get();
multiFluidTankEnabled = MULTI_FLUID_TANK_ENABLED.get();
Expand All @@ -181,6 +189,7 @@ static void onLoad(final ModConfigEvent event) {
}

public static boolean isFluidTransporterEnabled() { return fluidTransporterEnabled; }
public static boolean isFluidTransporterGetWaterFromLeaves() { return fluidTransporterGetWaterFromLeaves; }
public static boolean isSmartFaucetEnabled() { return smartFaucetEnabled; }
public static boolean isFaucetEnabled() { return faucetEnabled; }
public static boolean isMultiFluidTankEnabled() { return multiFluidTankEnabled; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public final class FeatureToggle {

// --- Feature constants ---
public static final ResourceLocation FLUID_TRANSPORTER = FluidLogistics.asResource("fluid_transporter");
public static final ResourceLocation FLUID_TRANSPORTER_GET_WATER = FluidLogistics.asResource("fluid_transporter_get_water_from_leaves");
public static final ResourceLocation SMART_FAUCET = FluidLogistics.asResource("smart_faucet");
public static final ResourceLocation FAUCET = FluidLogistics.asResource("faucet");
public static final ResourceLocation MULTI_FLUID_TANK = FluidLogistics.asResource("multi_fluid_tank");
Expand All @@ -38,6 +39,7 @@ public final class FeatureToggle {
static {
Map<ResourceLocation, BooleanSupplier> map = new LinkedHashMap<>();
map.put(FLUID_TRANSPORTER, Config::isFluidTransporterEnabled);
map.put(FLUID_TRANSPORTER_GET_WATER,Config::isFluidTransporterGetWaterFromLeaves);
map.put(SMART_FAUCET, Config::isSmartFaucetEnabled);
map.put(FAUCET, Config::isFaucetEnabled);
map.put(MULTI_FLUID_TANK, Config::isMultiFluidTankEnabled);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/fluidlogistics/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
"fluidlogistics.configuration.fluidPumpRange.tooltip": "Maximum distance a Fluid Pump can push or pull fluids on either side",
"fluidlogistics.configuration.fluidTransporterEnabled": "Fluid Transporter",
"fluidlogistics.configuration.fluidTransporterEnabled.tooltip": "Whether the Fluid Transporter is enabled",
"fluidlogistics.configuration.fluidTransporterGetWaterFromLeaves": "Fluid Transporter Get Water From Leaves",
"fluidlogistics.configuration.fluidTransporterGetWaterFromLeaves.tooltip": "Whether to allow Fluid Transporter Get Water From Leaves",
"fluidlogistics.configuration.handPointerEnabled": "Hand Pointer",
"fluidlogistics.configuration.handPointerEnabled.tooltip": "Whether the Hand Pointer is enabled",
"fluidlogistics.configuration.horizontalMultiFluidTankEnabled": "Horizontal Multi-Fluid Tank",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/fluidlogistics/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
"fluidlogistics.configuration.fluidPumpRange.tooltip": "流体泵在任一侧可推动或抽取流体的最大距离",
"fluidlogistics.configuration.fluidTransporterEnabled": "流体传输器",
"fluidlogistics.configuration.fluidTransporterEnabled.tooltip": "是否启用流体传输器",
"fluidlogistics.configuration.fluidTransporterGetWaterFromLeaves": "流体传输器从树叶中抽水",
"fluidlogistics.configuration.fluidTransporterGetWaterFromLeaves.tooltip": "是否允许流体传输器从树叶中抽水",
"fluidlogistics.configuration.handPointerEnabled": "指读棒",
"fluidlogistics.configuration.handPointerEnabled.tooltip": "是否启用指读棒",
"fluidlogistics.configuration.horizontalMultiFluidTankEnabled": "横向多流体储罐",
Expand Down
Loading