2020-10-19 22:07:05 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
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;
|
|
|
|
import com.tterrag.registrate.util.entry.RegistryEntry;
|
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
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.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
|
|
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
|
|
|
|
2020-10-19 22:07:05 +02:00
|
|
|
public class AllFluids {
|
|
|
|
|
|
|
|
private static final CreateRegistrate REGISTRATE = Create.registrate();
|
|
|
|
|
|
|
|
public static RegistryEntry<PotionFluid> POTION =
|
|
|
|
REGISTRATE.virtualFluid("potion", PotionFluidAttributes::new, PotionFluid::new)
|
2020-12-03 20:41:55 +01:00
|
|
|
.lang(f -> "fluid.create.potion", "Potion")
|
|
|
|
.register();
|
|
|
|
|
|
|
|
public static RegistryEntry<VirtualFluid> TEA = REGISTRATE.virtualFluid("tea")
|
|
|
|
.lang(f -> "fluid.create.tea", "Builder's Tea")
|
|
|
|
.register();
|
|
|
|
|
|
|
|
public static RegistryEntry<VirtualFluid> MILK = REGISTRATE.virtualFluid("milk")
|
|
|
|
.lang(f -> "fluid.create.milk", "Milk")
|
|
|
|
.tag(AllTags.forgeFluidTag("milk"))
|
|
|
|
.register();
|
|
|
|
|
|
|
|
public static RegistryEntry<ForgeFlowingFluid.Flowing> HONEY =
|
|
|
|
REGISTRATE.fluid("honey", new ResourceLocation("block/honey_block_top"), Create.asResource("fluid/honey_flow"))
|
|
|
|
.lang(f -> "fluid.create.honey", "Honey")
|
|
|
|
.attributes(b -> b.viscosity(500)
|
|
|
|
.density(1400))
|
|
|
|
.properties(p -> p.levelDecreasePerBlock(2)
|
|
|
|
.tickRate(25)
|
|
|
|
.slopeFindDistance(3)
|
|
|
|
.explosionResistance(100f))
|
|
|
|
.tag(AllTags.forgeFluidTag("honey"))
|
2020-10-19 22:07:05 +02:00
|
|
|
.register();
|
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
public static RegistryEntry<ForgeFlowingFluid.Flowing> 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();
|
|
|
|
|
2020-10-19 22:07:05 +02:00
|
|
|
// Load this class
|
|
|
|
|
|
|
|
public static void register() {}
|
|
|
|
|
2020-12-03 20:41:55 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public static void assignRenderLayers() {
|
|
|
|
makeTranslucent(HONEY);
|
|
|
|
}
|
|
|
|
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
private static void makeTranslucent(RegistryEntry<? extends ForgeFlowingFluid> entry) {
|
|
|
|
ForgeFlowingFluid fluid = entry.get();
|
|
|
|
RenderTypeLookup.setRenderLayer(fluid, RenderType.getTranslucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(fluid.getStillFluid(), RenderType.getTranslucent());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public static BlockState getLavaInteraction(IFluidState fluidState) {
|
|
|
|
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-10-19 22:07:05 +02:00
|
|
|
}
|