From ad1a91b2c971114d4f35a8a7ad772113769f6c48 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 13:47:06 -0800 Subject: [PATCH 1/2] fix new facade config list and update defaults --- examples/config/cyclic.toml | 6 +++--- .../cyclic/config/ConfigRegistry.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index a2e59889a..cda02f7bb 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -12,7 +12,7 @@ traveler = true #Radius per level. size around player to perform growth logic #Range: 1 ~ 16 - growthRadius = 2 + growthRadius = 6 #Set false to disable enchantment reach = true #Set false to disable enchantment @@ -154,8 +154,8 @@ [cyclic.blocks.facades] # - # These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others) - itemsNotAllowed = ["minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily", "minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars", "minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine", "minecraft:rail", "minecraft:*_rail", "minecraft:brewing_stand", "minecraft:*_dripleaf", "minecraft:*_pane", "minecraft:*_sapling", "minecraft:*_sign", "minecraft:*_door", "minecraft:*_banner", "minecraft:*_shulker_box", "cyclic:*_pipe", "cyclic:*_bars", "storagenetwork:*"] + # These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others). If you want to ignore one entire mod use an entry like this : storagenetwork:* + itemsNotAllowed = ["minecraft:double_plant", "minecraft:waterlily", "minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars", "minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine", "minecraft:brewing_stand", "minecraft:*_dripleaf", "minecraft:*_pane", "minecraft:*_sapling", "minecraft:*_sign", "minecraft:*_door", "minecraft:*_banner", "minecraft:*_shulker_box", "storagenetwork:*"] [cyclic.blocks.facades.cables] # diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 79c72dad4..0d2e4de65 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -414,21 +414,18 @@ private static void initConfig() { CABLE_FACADES = CFG.comment("\r\n Allow cables to have blocks placed in them as facades (sneak-left-click to set; use empty hand to remove). Set to false to disable facades") .define("cables.enabled", true); //a few default - List list = Arrays.asList("minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily", + List list = Arrays.asList("minecraft:double_plant", "minecraft:waterlily", "minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars", "minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine", - "minecraft:rail", - "minecraft:*_rail", "minecraft:brewing_stand", "minecraft:*_dripleaf", "minecraft:*_pane", "minecraft:*_sapling", "minecraft:*_sign", "minecraft:*_door", "minecraft:*_banner", "minecraft:*_shulker_box", - "cyclic:*_pipe", "cyclic:*_bars", "storagenetwork:*"); - FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others)") - .define("itemsNotAllowed", list); + FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others). If you want to ignore one entire mod use an entry like this : storagenetwork:* ") + .defineList("itemsNotAllowed", list, it -> it instanceof String); CFG.pop(); // TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions " @@ -569,6 +566,11 @@ public static List getGloomIgnoreList() { return (List) GLOOM_IGNORE_LIST.get(); } + @SuppressWarnings("unchecked") + public static List getFacadeIgnoreList() { + return (List) FACADE_IGNORELIST.get(); + } + public static Map getMappedBeheading() { Map mappedBeheading = new HashMap(); for (String s : BEHEADING_SKINS.get()) { @@ -586,11 +588,11 @@ public static Map getMappedBeheading() { } public static BooleanValue CABLE_FACADES; - private static ConfigValue> FACADE_IGNORELIST; + private static ConfigValue> FACADE_IGNORELIST; public static boolean isFacadeAllowed(ItemStack item) { ResourceLocation itemId = ForgeRegistries.ITEMS.getKey(item.getItem()); - if (UtilString.isInList(FACADE_IGNORELIST.get(), itemId)) { + if (UtilString.isInList(getFacadeIgnoreList(), itemId)) { return false; } return true; From 0ee2bf2945626e1255592e0c771e809597f56ba3 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 9 Nov 2024 17:50:10 -0800 Subject: [PATCH 2/2] update fluid hopper lava cauldrons --- .../lothrazar/cyclic/util/FluidHelpers.java | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java b/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java index edafe4bbb..605421479 100644 --- a/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java +++ b/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java @@ -20,13 +20,13 @@ import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LayeredCauldronBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; @@ -43,6 +43,12 @@ public class FluidHelpers { public static final FluidRenderMap> CACHED_FLUIDS = new FluidRenderMap<>(); public static final int STAGES = 1400; + /** + * maps fluid to colour hex code as int value. Used by itemstack durability bar on filled held tanks + * + * @param fstack + * @return + */ public static int getColorFromFluid(FluidStack fstack) { if (fstack != null && fstack.getFluid() != null) { //first check mine @@ -64,17 +70,20 @@ else if (fstack.getFluid() == FluidXpJuiceHolder.STILL.get()) { else if (fstack.getFluid().getAttributes().getColor() > 0) { return fstack.getFluid().getAttributes().getColor(); } - else if (fstack.getFluid() == ForgeMod.MILK.get()) { - return COLOUR_MILK; - } - else if (fstack.getFluid() == Fluids.LAVA) { - return COLOUR_LAVA; - } + return COLOUR_MILK; + } + else if (fstack.getFluid() == Fluids.LAVA) { + return COLOUR_LAVA; } return COLOUR_DEFAULT; } /** + * Internally knows that water cauldrons fil to level 3, but lava cauldrons are a different block without the level property. + * + * Ignores partially filled water cauldrons. + * + * a full cauldron is 1000mb * * @param level * @param posTarget @@ -91,7 +100,7 @@ public static boolean insertSourceCauldron(Level level, BlockPos posTarget, IFlu FluidStack simulate = tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE); if (simulate.getAmount() == FluidAttributes.BUCKET_VOLUME) { //we are able to fill the tank - if (level.setBlock(posTarget, Blocks.WATER_CAULDRON.defaultBlockState(), 3)) { + if (level.setBlock(posTarget, Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), 3)) { //we filled the cauldron, so now drain with execute tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.EXECUTE); return true; @@ -111,6 +120,17 @@ public static boolean insertSourceCauldron(Level level, BlockPos posTarget, IFlu return false; } + /** + * Internally knows that water cauldrons fil to level 3, but lava cauldrons are a different block without the level property. + * + * Ignores partially filled water cauldrons. + * + * a full cauldron is 1000mb + * + * @param level + * @param posTarget + * @param tank + */ public static void extractSourceWaterloggedCauldron(Level level, BlockPos posTarget, IFluidHandler tank) { if (tank == null) { return; @@ -127,7 +147,7 @@ public static void extractSourceWaterloggedCauldron(Level level, BlockPos posTar tank.fill(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAction.EXECUTE); } } - else if (targetState.getBlock() == Blocks.WATER_CAULDRON) { + else if (targetState.getBlock() == Blocks.WATER_CAULDRON && targetState.getValue(LayeredCauldronBlock.LEVEL) >= 3) { int simFill = tank.fill(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE); if (simFill == FluidAttributes.BUCKET_VOLUME && level.setBlockAndUpdate(posTarget, Blocks.CAULDRON.defaultBlockState())) {