diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 56c325a36..add2b3215 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -753,7 +753,7 @@ a68cd40ffb769b195437107f4a2c2188b222b74a assets/create/models/block/gray_sail.js 17b651233c62b928f0228562a7f6e7a2b7b2d6b7 assets/create/models/block/green_sail.json 1438b8ce54ac5557b8f10dcef94f3525eae19461 assets/create/models/block/green_seat.json cc7ce9b6bc687ad5027a67c3bf22bdf5bcd71674 assets/create/models/block/green_valve_handle.json -5bbe7e5322020d205d2c60bc14e4b45b317a193c assets/create/models/block/honey.json +5163171ed77af879fa06f290bf24b1bb99735c94 assets/create/models/block/honey.json 9730fcb02f679087e81e24c836751e625be6a298 assets/create/models/block/horizontal_framed_glass.json d13df8a5920c5778d98081fb0e97f045e2fd46a2 assets/create/models/block/horizontal_framed_glass_pane_noside.json 3e975bec02e2670ce2b1868cebcbd780a5ebf3f8 assets/create/models/block/horizontal_framed_glass_pane_noside_alt.json diff --git a/src/generated/resources/assets/create/models/block/honey.json b/src/generated/resources/assets/create/models/block/honey.json index 262271bb6..079948a71 100644 --- a/src/generated/resources/assets/create/models/block/honey.json +++ b/src/generated/resources/assets/create/models/block/honey.json @@ -1,5 +1,5 @@ { "textures": { - "particle": "block/honey_block_top" + "particle": "create:fluid/honey_still" } } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllFluids.java b/src/main/java/com/simibubi/create/AllFluids.java index 0666e5c72..5f2277b51 100644 --- a/src/main/java/com/simibubi/create/AllFluids.java +++ b/src/main/java/com/simibubi/create/AllFluids.java @@ -10,14 +10,15 @@ import com.simibubi.create.foundation.data.CreateRegistrate; import com.tterrag.registrate.util.entry.RegistryEntry; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.IFluidState; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ILightReader; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.ForgeFlowingFluid; public class AllFluids { @@ -39,7 +40,7 @@ public class AllFluids { .register(); public static RegistryEntry HONEY = - REGISTRATE.fluid("honey", new ResourceLocation("block/honey_block_top"), Create.asResource("fluid/honey_flow")) + REGISTRATE.standardFluid("honey", NoColorFluidAttributes::new) .lang(f -> "fluid.create.honey", "Honey") .attributes(b -> b.viscosity(500) .density(1400)) @@ -50,24 +51,23 @@ public class AllFluids { .tag(AllTags.forgeFluidTag("honey")) .register(); - public static RegistryEntry CHOCOLATE = REGISTRATE.standardFluid("chocolate") - .lang(f -> "fluid.create.chocolate", "Chocolate") - .attributes(b -> b.viscosity(500) - .density(1400)) - .properties(p -> p.levelDecreasePerBlock(2) - .tickRate(25) - .slopeFindDistance(3) - .explosionResistance(100f)) - .register(); + public static RegistryEntry CHOCOLATE = + REGISTRATE.standardFluid("chocolate", NoColorFluidAttributes::new) + .lang(f -> "fluid.create.chocolate", "Chocolate") + .attributes(b -> b.viscosity(500) + .density(1400)) + .properties(p -> p.levelDecreasePerBlock(2) + .tickRate(25) + .slopeFindDistance(3) + .explosionResistance(100f)) + .register(); // Load this class public static void register() {} @OnlyIn(Dist.CLIENT) - public static void assignRenderLayers() { - makeTranslucent(HONEY); - } + public static void assignRenderLayers() {} @OnlyIn(Dist.CLIENT) private static void makeTranslucent(RegistryEntry entry) { @@ -90,4 +90,21 @@ public class AllFluids { return null; } + /** + * Removing alpha from tint prevents optifine from forcibly applying biome + * colors to modded fluids (Makes translucent fluids disappear) + */ + private static class NoColorFluidAttributes extends FluidAttributes { + + protected NoColorFluidAttributes(Builder builder, Fluid fluid) { + super(builder, fluid); + } + + @Override + public int getColor(ILightReader world, BlockPos pos) { + return 0x00ffffff; + } + + } + } diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index f619a4dc2..f278611be 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -25,6 +25,7 @@ import com.tterrag.registrate.builders.FluidBuilder; import com.tterrag.registrate.builders.ItemBuilder; import com.tterrag.registrate.util.NonNullLazyValue; import com.tterrag.registrate.util.entry.RegistryEntry; +import com.tterrag.registrate.util.nullness.NonNullBiFunction; import com.tterrag.registrate.util.nullness.NonNullConsumer; import com.tterrag.registrate.util.nullness.NonNullFunction; import com.tterrag.registrate.util.nullness.NonNullSupplier; @@ -143,6 +144,12 @@ public class CreateRegistrate extends AbstractRegistrate { return fluid(name, Create.asResource("fluid/" + name + "_still"), Create.asResource("fluid/" + name + "_flow")); } + public FluidBuilder standardFluid(String name, + NonNullBiFunction attributesFactory) { + return fluid(name, Create.asResource("fluid/" + name + "_still"), Create.asResource("fluid/" + name + "_flow"), + attributesFactory); + } + /* Util */ public static NonNullConsumer connectedTextures(ConnectedTextureBehaviour behavior) { diff --git a/src/main/resources/assets/create/textures/fluid/honey_flow.png b/src/main/resources/assets/create/textures/fluid/honey_flow.png index 2fa7090ef..496733dfb 100644 Binary files a/src/main/resources/assets/create/textures/fluid/honey_flow.png and b/src/main/resources/assets/create/textures/fluid/honey_flow.png differ diff --git a/src/main/resources/assets/create/textures/fluid/honey_still.png b/src/main/resources/assets/create/textures/fluid/honey_still.png new file mode 100644 index 000000000..bdc474d57 Binary files /dev/null and b/src/main/resources/assets/create/textures/fluid/honey_still.png differ