Search in sources :

Example 1 with EncasedPipeBlock

use of com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock in project Create by Creators-of-Create.

the class BlockStateGen method encasedPipe.

public static <P extends EncasedPipeBlock> NonNullBiConsumer<DataGenContext<Block, P>, RegistrateBlockstateProvider> encasedPipe() {
    return (c, p) -> {
        ModelFile open = AssetLookup.partialBaseModel(c, p, "open");
        ModelFile flat = AssetLookup.partialBaseModel(c, p, "flat");
        MultiPartBlockStateBuilder builder = p.getMultipartBuilder(c.get());
        for (boolean flatPass : Iterate.trueAndFalse) for (Direction d : Iterate.directions) {
            int verticalAngle = d == Direction.UP ? 90 : d == Direction.DOWN ? -90 : 0;
            builder.part().modelFile(flatPass ? flat : open).rotationX(verticalAngle).rotationY((int) (d.toYRot() + (d.getAxis().isVertical() ? 90 : 0)) % 360).addModel().condition(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(d), !flatPass).end();
        }
    };
}
Also used : RadialChassisBlock(com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock) ResourceLocation(net.minecraft.resources.ResourceLocation) MultiPartBlockStateBuilder(net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder) Direction(net.minecraft.core.Direction) ModelFile(net.minecraftforge.client.model.generators.ModelFile) BiFunction(java.util.function.BiFunction) Pointing(com.simibubi.create.foundation.utility.Pointing) BlockState(net.minecraft.world.level.block.state.BlockState) HashMap(java.util.HashMap) EncasedPipeBlock(com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock) Function(java.util.function.Function) LinearChassisBlock(com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock) CartAssemblerBlock(com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock) Axis(net.minecraft.core.Direction.Axis) BooleanProperty(net.minecraft.world.level.block.state.properties.BooleanProperty) AxisDirection(net.minecraft.core.Direction.AxisDirection) Vector(java.util.Vector) Pair(org.apache.commons.lang3.tuple.Pair) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) FluidPipeBlock(com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock) DataGenContext(com.tterrag.registrate.providers.DataGenContext) BlockStateProperties(net.minecraft.world.level.block.state.properties.BlockStateProperties) IdentityHashMap(java.util.IdentityHashMap) Iterate(com.simibubi.create.foundation.utility.Iterate) ImmutableMap(com.google.common.collect.ImmutableMap) BlazeBurnerBlock(com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock) RegistrateBlockstateProvider(com.tterrag.registrate.providers.RegistrateBlockstateProvider) RailShape(net.minecraft.world.level.block.state.properties.RailShape) List(java.util.List) NonNullBiConsumer(com.tterrag.registrate.util.nullness.NonNullBiConsumer) ConfiguredModel(net.minecraftforge.client.model.generators.ConfiguredModel) DirectionalAxisKineticBlock(com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock) Block(net.minecraft.world.level.block.Block) CartAssembleRailType(com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType) MultiPartBlockStateBuilder(net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder) ModelFile(net.minecraftforge.client.model.generators.ModelFile) Direction(net.minecraft.core.Direction) AxisDirection(net.minecraft.core.Direction.AxisDirection)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 DirectionalAxisKineticBlock (com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock)1 LinearChassisBlock (com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock)1 RadialChassisBlock (com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock)1 CartAssembleRailType (com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType)1 CartAssemblerBlock (com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock)1 EncasedPipeBlock (com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock)1 FluidPipeBlock (com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock)1 BlazeBurnerBlock (com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock)1 Iterate (com.simibubi.create.foundation.utility.Iterate)1 Pointing (com.simibubi.create.foundation.utility.Pointing)1 DataGenContext (com.tterrag.registrate.providers.DataGenContext)1 RegistrateBlockstateProvider (com.tterrag.registrate.providers.RegistrateBlockstateProvider)1 NonNullBiConsumer (com.tterrag.registrate.util.nullness.NonNullBiConsumer)1 HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Vector (java.util.Vector)1