2020-10-19 22:07:05 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2021-06-26 09:30:01 +02:00
|
|
|
import com.simibubi.create.AllTags.AllFluidTags;
|
2020-12-03 20:41:55 +01:00
|
|
|
import com.simibubi.create.content.contraptions.fluids.VirtualFluid;
|
2020-10-19 22:07:05 +02:00
|
|
|
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid;
|
|
|
|
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid.PotionFluidAttributes;
|
2020-12-03 20:41:55 +01:00
|
|
|
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
2020-10-19 22:07:05 +02:00
|
|
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
2021-05-23 03:00:10 +02:00
|
|
|
import com.tterrag.registrate.util.entry.FluidEntry;
|
2020-10-19 22:07:05 +02:00
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
import net.minecraft.block.BlockState;
|
|
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
|
|
|
import net.minecraft.fluid.Fluid;
|
2020-12-05 11:42:14 +01:00
|
|
|
import net.minecraft.fluid.FluidState;
|
2020-12-04 23:31:12 +01:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2020-12-05 11:42:14 +01:00
|
|
|
import net.minecraft.world.IBlockDisplayReader;
|
2020-12-03 20:41:55 +01:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2021-06-26 09:30:01 +02:00
|
|
|
import net.minecraftforge.common.Tags;
|
2020-12-04 23:31:12 +01:00
|
|
|
import net.minecraftforge.fluids.FluidAttributes;
|
2020-12-03 20:41:55 +01:00
|
|
|
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
|
|
|
|
2020-10-19 22:07:05 +02:00
|
|
|
public class AllFluids {
|
|
|
|
|
|
|
|
private static final CreateRegistrate REGISTRATE = Create.registrate();
|
|
|
|
|
2021-06-26 09:30:01 +02:00
|
|
|
public static final FluidEntry<PotionFluid> POTION =
|
2021-05-25 21:23:55 +02:00
|
|
|
REGISTRATE.virtualFluid("potion", PotionFluidAttributes::new, PotionFluid::new)
|
|
|
|
.lang(f -> "fluid.create.potion", "Potion")
|
|
|
|
.register();
|
2020-12-03 20:41:55 +01:00
|
|
|
|
2021-06-26 09:30:01 +02:00
|
|
|
public static final FluidEntry<VirtualFluid> TEA = REGISTRATE.virtualFluid("tea")
|
2021-05-25 21:23:55 +02:00
|
|
|
.lang(f -> "fluid.create.tea", "Builder's Tea")
|
|
|
|
.tag(AllTags.forgeFluidTag("tea"))
|
|
|
|
.register();
|
2020-12-03 20:41:55 +01:00
|
|
|
|
2021-06-26 09:30:01 +02:00
|
|
|
public static final FluidEntry<VirtualFluid> MILK = REGISTRATE.virtualFluid("milk")
|
2021-05-25 21:23:55 +02:00
|
|
|
.lang(f -> "fluid.create.milk", "Milk")
|
2021-06-26 09:30:01 +02:00
|
|
|
.tag(Tags.Fluids.MILK)
|
2020-10-19 22:07:05 +02:00
|
|
|
.register();
|
|
|
|
|
2021-06-26 09:30:01 +02:00
|
|
|
public static final FluidEntry<ForgeFlowingFluid.Flowing> HONEY =
|
2021-05-25 21:23:55 +02:00
|
|
|
REGISTRATE.standardFluid("honey", NoColorFluidAttributes::new)
|
|
|
|
.lang(f -> "fluid.create.honey", "Honey")
|
|
|
|
.attributes(b -> b.viscosity(500)
|
|
|
|
.density(1400))
|
|
|
|
.properties(p -> p.levelDecreasePerBlock(2)
|
|
|
|
.tickRate(25)
|
|
|
|
.slopeFindDistance(3)
|
|
|
|
.explosionResistance(100f))
|
2021-06-26 09:30:01 +02:00
|
|
|
.tag(AllFluidTags.HONEY.tag)
|
2021-05-25 21:23:55 +02:00
|
|
|
.bucket()
|
|
|
|
.properties(p -> p.maxStackSize(1))
|
|
|
|
.build()
|
|
|
|
.register();
|
2020-10-19 22:07:05 +02:00
|
|
|
|
2021-06-26 09:30:01 +02:00
|
|
|
public static final FluidEntry<ForgeFlowingFluid.Flowing> CHOCOLATE =
|
2021-05-25 21:23:55 +02:00
|
|
|
REGISTRATE.standardFluid("chocolate", NoColorFluidAttributes::new)
|
|
|
|
.lang(f -> "fluid.create.chocolate", "Chocolate")
|
|
|
|
.tag(AllTags.forgeFluidTag("chocolate"))
|
|
|
|
.attributes(b -> b.viscosity(500)
|
|
|
|
.density(1400))
|
|
|
|
.properties(p -> p.levelDecreasePerBlock(2)
|
|
|
|
.tickRate(25)
|
|
|
|
.slopeFindDistance(3)
|
|
|
|
.explosionResistance(100f))
|
|
|
|
.bucket()
|
2020-12-27 23:09:19 +01:00
|
|
|
.properties(p -> p.maxStackSize(1))
|
|
|
|
.build()
|
2020-10-19 22:07:05 +02:00
|
|
|
.register();
|
|
|
|
|
|
|
|
// Load this class
|
|
|
|
|
|
|
|
public static void register() {}
|
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2020-12-04 23:31:12 +01:00
|
|
|
public static void assignRenderLayers() {}
|
2020-12-03 20:41:55 +01:00
|
|
|
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
2021-05-23 03:00:10 +02:00
|
|
|
private static void makeTranslucent(FluidEntry<?> entry) {
|
2020-12-03 20:41:55 +01:00
|
|
|
ForgeFlowingFluid fluid = entry.get();
|
|
|
|
RenderTypeLookup.setRenderLayer(fluid, RenderType.getTranslucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(fluid.getStillFluid(), RenderType.getTranslucent());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
2020-12-05 11:42:14 +01:00
|
|
|
public static BlockState getLavaInteraction(FluidState fluidState) {
|
2020-12-03 20:41:55 +01:00
|
|
|
Fluid fluid = fluidState.getFluid();
|
|
|
|
if (fluid.isEquivalentTo(HONEY.get()))
|
|
|
|
return fluidState.isSource() ? AllPaletteBlocks.LIMESTONE.getDefaultState()
|
|
|
|
: AllPaletteBlocks.LIMESTONE_VARIANTS.registeredBlocks.get(0)
|
|
|
|
.getDefaultState();
|
|
|
|
if (fluid.isEquivalentTo(CHOCOLATE.get()))
|
|
|
|
return fluidState.isSource() ? AllPaletteBlocks.SCORIA.getDefaultState()
|
|
|
|
: AllPaletteBlocks.SCORIA_VARIANTS.registeredBlocks.get(0)
|
|
|
|
.getDefaultState();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-12-04 23:31:12 +01:00
|
|
|
/**
|
|
|
|
* 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
|
2020-12-05 11:42:14 +01:00
|
|
|
public int getColor(IBlockDisplayReader world, BlockPos pos) {
|
2020-12-04 23:31:12 +01:00
|
|
|
return 0x00ffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-19 22:07:05 +02:00
|
|
|
}
|