diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 31b3cc2ba..b1eb1e729 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -410,21 +410,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 " @@ -639,6 +636,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()) { @@ -656,11 +658,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 (StringParseUtil.isInList(FACADE_IGNORELIST.get(), itemId)) { + if (StringParseUtil.isInList(getFacadeIgnoreList(), itemId)) { return false; } return true; diff --git a/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java b/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java index 1dbbcf5a5..bf310191b 100644 --- a/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java +++ b/src/main/java/com/lothrazar/cyclic/util/FluidHelpers.java @@ -20,6 +20,7 @@ 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; @@ -48,6 +49,12 @@ public static class FluidAttributes { public static final int BUCKET_VOLUME = net.minecraftforge.fluids.FluidType.BUCKET_VOLUME; } + /** + * 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 @@ -65,10 +72,7 @@ else if (fstack.getFluid() == FluidSlimeHolder.STILL.get()) { } else if (fstack.getFluid() == FluidXpJuiceHolder.STILL.get()) { return FluidXpJuiceHolder.COLOR; - } //now check if the fluid has a color - // else if (fstack.getFluid().getAttributes().getColor() > 0) { - // return fstack.getFluid().getAttributes().getColor(); - // } + } else if (fstack.getFluid() == ForgeMod.MILK.get()) { return COLOUR_MILK; } @@ -80,6 +84,11 @@ else if (fstack.getFluid() == Fluids.LAVA) { } /** + * 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 @@ -96,7 +105,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; @@ -116,6 +125,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; @@ -132,7 +152,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())) {