| 1 | package net.minecraft.client.data.models;
|
| 2 |
|
| 3 | import com.google.common.collect.ImmutableMap;
|
| 4 | import com.google.common.collect.ImmutableMap.Builder;
|
| 5 | import com.mojang.datafixers.util.Pair;
|
| 6 | import com.mojang.math.Quadrant;
|
| 7 | import com.mojang.math.Transformation;
|
| 8 | import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
| 9 | import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
| 10 | import java.util.Arrays;
|
| 11 | import java.util.HashMap;
|
| 12 | import java.util.HashSet;
|
| 13 | import java.util.List;
|
| 14 | import java.util.Locale;
|
| 15 | import java.util.Map;
|
| 16 | import java.util.Optional;
|
| 17 | import java.util.Set;
|
| 18 | import java.util.function.BiConsumer;
|
| 19 | import java.util.function.BiFunction;
|
| 20 | import java.util.function.Consumer;
|
| 21 | import java.util.function.Function;
|
| 22 | import java.util.stream.Collectors;
|
| 23 | import java.util.stream.IntStream;
|
| 24 | import java.util.stream.Stream;
|
| 25 | import net.fabricmc.api.EnvType;
|
| 26 | import net.fabricmc.api.Environment;
|
| 27 | import net.minecraft.client.color.item.GrassColorSource;
|
| 28 | import net.minecraft.client.color.item.ItemTintSource;
|
| 29 | import net.minecraft.client.data.models.blockstates.BlockModelDefinitionGenerator;
|
| 30 | import net.minecraft.client.data.models.blockstates.ConditionBuilder;
|
| 31 | import net.minecraft.client.data.models.blockstates.MultiPartGenerator;
|
| 32 | import net.minecraft.client.data.models.blockstates.MultiVariantGenerator;
|
| 33 | import net.minecraft.client.data.models.blockstates.PropertyDispatch;
|
| 34 | import net.minecraft.client.data.models.model.ItemModelUtils;
|
| 35 | import net.minecraft.client.data.models.model.ModelInstance;
|
| 36 | import net.minecraft.client.data.models.model.ModelLocationUtils;
|
| 37 | import net.minecraft.client.data.models.model.ModelTemplate;
|
| 38 | import net.minecraft.client.data.models.model.ModelTemplates;
|
| 39 | import net.minecraft.client.data.models.model.TextureMapping;
|
| 40 | import net.minecraft.client.data.models.model.TextureSlot;
|
| 41 | import net.minecraft.client.data.models.model.TexturedModel;
|
| 42 | import net.minecraft.client.renderer.MultiblockChestResources;
|
| 43 | import net.minecraft.client.renderer.block.dispatch.VariantMutator;
|
| 44 | import net.minecraft.client.renderer.block.dispatch.multipart.CombinedCondition;
|
| 45 | import net.minecraft.client.renderer.block.dispatch.multipart.Condition;
|
| 46 | import net.minecraft.client.renderer.blockentity.BannerRenderer;
|
| 47 | import net.minecraft.client.renderer.blockentity.ConduitRenderer;
|
| 48 | import net.minecraft.client.renderer.blockentity.ShulkerBoxRenderer;
|
| 49 | import net.minecraft.client.renderer.item.ItemModel;
|
| 50 | import net.minecraft.client.renderer.special.BannerSpecialRenderer;
|
| 51 | import net.minecraft.client.renderer.special.ChestSpecialRenderer;
|
| 52 | import net.minecraft.client.renderer.special.ConduitSpecialRenderer;
|
| 53 | import net.minecraft.client.renderer.special.CopperGolemStatueSpecialRenderer;
|
| 54 | import net.minecraft.client.renderer.special.DecoratedPotSpecialRenderer;
|
| 55 | import net.minecraft.client.renderer.special.PlayerHeadSpecialRenderer;
|
| 56 | import net.minecraft.client.renderer.special.ShulkerBoxSpecialRenderer;
|
| 57 | import net.minecraft.client.renderer.special.SkullSpecialRenderer;
|
| 58 | import net.minecraft.client.renderer.special.SpecialModelRenderer;
|
| 59 | import net.minecraft.client.resources.model.sprite.Material;
|
| 60 | import net.minecraft.core.Direction;
|
| 61 | import net.minecraft.core.FrontAndTop;
|
| 62 | import net.minecraft.core.Direction.Axis;
|
| 63 | import net.minecraft.data.BlockFamilies;
|
| 64 | import net.minecraft.data.BlockFamily;
|
| 65 | import net.minecraft.data.BlockFamily.Variant;
|
| 66 | import net.minecraft.resources.Identifier;
|
| 67 | import net.minecraft.util.StringRepresentable;
|
| 68 | import net.minecraft.util.random.Weighted;
|
| 69 | import net.minecraft.util.random.WeightedList;
|
| 70 | import net.minecraft.world.item.DyeColor;
|
| 71 | import net.minecraft.world.item.Item;
|
| 72 | import net.minecraft.world.item.Items;
|
| 73 | import net.minecraft.world.level.block.BeehiveBlock;
|
| 74 | import net.minecraft.world.level.block.Block;
|
| 75 | import net.minecraft.world.level.block.Blocks;
|
| 76 | import net.minecraft.world.level.block.ChiseledBookShelfBlock;
|
| 77 | import net.minecraft.world.level.block.ColorCollection;
|
| 78 | import net.minecraft.world.level.block.CopperGolemStatueBlock;
|
| 79 | import net.minecraft.world.level.block.CrafterBlock;
|
| 80 | import net.minecraft.world.level.block.CreakingHeartBlock;
|
| 81 | import net.minecraft.world.level.block.DriedGhastBlock;
|
| 82 | import net.minecraft.world.level.block.HangingMossBlock;
|
| 83 | import net.minecraft.world.level.block.LayeredCauldronBlock;
|
| 84 | import net.minecraft.world.level.block.LightBlock;
|
| 85 | import net.minecraft.world.level.block.MangrovePropaguleBlock;
|
| 86 | import net.minecraft.world.level.block.MossyCarpetBlock;
|
| 87 | import net.minecraft.world.level.block.MultifaceBlock;
|
| 88 | import net.minecraft.world.level.block.PitcherCropBlock;
|
| 89 | import net.minecraft.world.level.block.SnifferEggBlock;
|
| 90 | import net.minecraft.world.level.block.TestBlock;
|
| 91 | import net.minecraft.world.level.block.VaultBlock;
|
| 92 | import net.minecraft.world.level.block.BannerBlock.AttachmentType;
|
| 93 | import net.minecraft.world.level.block.CopperGolemStatueBlock.Pose;
|
| 94 | import net.minecraft.world.level.block.SkullBlock.Type;
|
| 95 | import net.minecraft.world.level.block.SkullBlock.Types;
|
| 96 | import net.minecraft.world.level.block.WeatheringCopper.WeatherState;
|
| 97 | import net.minecraft.world.level.block.state.StateHolder;
|
| 98 | import net.minecraft.world.level.block.state.properties.AttachFace;
|
| 99 | import net.minecraft.world.level.block.state.properties.BambooLeaves;
|
| 100 | import net.minecraft.world.level.block.state.properties.BedPart;
|
| 101 | import net.minecraft.world.level.block.state.properties.BellAttachType;
|
| 102 | import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
| 103 | import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
| 104 | import net.minecraft.world.level.block.state.properties.ComparatorMode;
|
| 105 | import net.minecraft.world.level.block.state.properties.CreakingHeartState;
|
| 106 | import net.minecraft.world.level.block.state.properties.DoorHingeSide;
|
| 107 | import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
|
| 108 | import net.minecraft.world.level.block.state.properties.EnumProperty;
|
| 109 | import net.minecraft.world.level.block.state.properties.Half;
|
| 110 | import net.minecraft.world.level.block.state.properties.PistonType;
|
| 111 | import net.minecraft.world.level.block.state.properties.Property;
|
| 112 | import net.minecraft.world.level.block.state.properties.RailShape;
|
| 113 | import net.minecraft.world.level.block.state.properties.RedstoneSide;
|
| 114 | import net.minecraft.world.level.block.state.properties.SculkSensorPhase;
|
| 115 | import net.minecraft.world.level.block.state.properties.SideChainPart;
|
| 116 | import net.minecraft.world.level.block.state.properties.SlabType;
|
| 117 | import net.minecraft.world.level.block.state.properties.SpeleothemThickness;
|
| 118 | import net.minecraft.world.level.block.state.properties.StairsShape;
|
| 119 | import net.minecraft.world.level.block.state.properties.TestBlockMode;
|
| 120 | import net.minecraft.world.level.block.state.properties.Tilt;
|
| 121 | import net.minecraft.world.level.block.state.properties.WallSide;
|
| 122 | import org.joml.Quaternionf;
|
| 123 | import org.joml.Vector3f;
|
| 124 | import org.jspecify.annotations.Nullable;
|
| 125 |
|
| 126 | /**
|
| 127 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 128 | */
|
| 129 | @Environment(EnvType.CLIENT)
|
| 130 | public class BlockModelGenerators {
|
| 131 | /**
|
| 132 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 133 | */
|
| 134 | public final Consumer<BlockModelDefinitionGenerator> blockStateOutput;
|
| 135 | /**
|
| 136 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 137 | */
|
| 138 | public final ItemModelOutput itemModelOutput;
|
| 139 | /**
|
| 140 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 141 | */
|
| 142 | public final BiConsumer<Identifier, ModelInstance> modelOutput;
|
| 143 | private static final List<Block> NON_ORIENTABLE_TRAPDOOR = List.of(Blocks.OAK_TRAPDOOR, Blocks.DARK_OAK_TRAPDOOR, Blocks.IRON_TRAPDOOR);
|
| 144 | public static final VariantMutator NOP = v -> v;
|
| 145 | public static final VariantMutator UV_LOCK = VariantMutator.UV_LOCK.withValue(true);
|
| 146 | public static final VariantMutator X_ROT_90 = VariantMutator.X_ROT.withValue(Quadrant.R90);
|
| 147 | public static final VariantMutator X_ROT_180 = VariantMutator.X_ROT.withValue(Quadrant.R180);
|
| 148 | public static final VariantMutator X_ROT_270 = VariantMutator.X_ROT.withValue(Quadrant.R270);
|
| 149 | public static final VariantMutator Y_ROT_90 = VariantMutator.Y_ROT.withValue(Quadrant.R90);
|
| 150 | public static final VariantMutator Y_ROT_180 = VariantMutator.Y_ROT.withValue(Quadrant.R180);
|
| 151 | public static final VariantMutator Y_ROT_270 = VariantMutator.Y_ROT.withValue(Quadrant.R270);
|
| 152 | private static final Function<ConditionBuilder, ConditionBuilder> FLOWER_BED_MODEL_1_SEGMENT_CONDITION = condition -> condition;
|
| 153 | private static final Function<ConditionBuilder, ConditionBuilder> FLOWER_BED_MODEL_2_SEGMENT_CONDITION = condition -> condition.term(
|
| 154 | BlockStateProperties.FLOWER_AMOUNT, 2, 3, 4
|
| 155 | );
|
| 156 | private static final Function<ConditionBuilder, ConditionBuilder> FLOWER_BED_MODEL_3_SEGMENT_CONDITION = condition -> condition.term(
|
| 157 | BlockStateProperties.FLOWER_AMOUNT, 3, 4
|
| 158 | );
|
| 159 | private static final Function<ConditionBuilder, ConditionBuilder> FLOWER_BED_MODEL_4_SEGMENT_CONDITION = condition -> condition.term(
|
| 160 | BlockStateProperties.FLOWER_AMOUNT, 4
|
| 161 | );
|
| 162 | private static final Function<ConditionBuilder, ConditionBuilder> LEAF_LITTER_MODEL_1_SEGMENT_CONDITION = condition -> condition.term(
|
| 163 | BlockStateProperties.SEGMENT_AMOUNT, 1
|
| 164 | );
|
| 165 | private static final Function<ConditionBuilder, ConditionBuilder> LEAF_LITTER_MODEL_2_SEGMENT_CONDITION = condition -> condition.term(
|
| 166 | BlockStateProperties.SEGMENT_AMOUNT, 2, 3
|
| 167 | );
|
| 168 | private static final Function<ConditionBuilder, ConditionBuilder> LEAF_LITTER_MODEL_3_SEGMENT_CONDITION = condition -> condition.term(
|
| 169 | BlockStateProperties.SEGMENT_AMOUNT, 3
|
| 170 | );
|
| 171 | private static final Function<ConditionBuilder, ConditionBuilder> LEAF_LITTER_MODEL_4_SEGMENT_CONDITION = condition -> condition.term(
|
| 172 | BlockStateProperties.SEGMENT_AMOUNT, 4
|
| 173 | );
|
| 174 | private static final Transformation SKULL_TRANSFORM = new Transformation(
|
| 175 | new Vector3f(0.5F, 0.0F, 0.5F), new Quaternionf().rotationX((float) Math.PI), null, null
|
| 176 | );
|
| 177 | private static final Map<Block, BlockModelGenerators.BlockStateGeneratorSupplier> FULL_BLOCK_MODEL_CUSTOM_GENERATORS = Map.of(
|
| 178 | Blocks.STONE,
|
| 179 | BlockModelGenerators::createMirroredCubeGenerator,
|
| 180 | Blocks.DEEPSLATE,
|
| 181 | BlockModelGenerators::createMirroredColumnGenerator,
|
| 182 | Blocks.MUD_BRICKS,
|
| 183 | BlockModelGenerators::createNorthWestMirroredCubeGenerator
|
| 184 | );
|
| 185 | /**
|
| 186 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 187 | */
|
| 188 | public static final PropertyDispatch<VariantMutator> ROTATION_FACING = PropertyDispatch.modify(BlockStateProperties.FACING)
|
| 189 | .select(Direction.DOWN, X_ROT_90)
|
| 190 | .select(Direction.UP, X_ROT_270)
|
| 191 | .select(Direction.NORTH, NOP)
|
| 192 | .select(Direction.SOUTH, Y_ROT_180)
|
| 193 | .select(Direction.WEST, Y_ROT_270)
|
| 194 | .select(Direction.EAST, Y_ROT_90);
|
| 195 | /**
|
| 196 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 197 | */
|
| 198 | public static final PropertyDispatch<VariantMutator> ROTATIONS_COLUMN_WITH_FACING = PropertyDispatch.modify(BlockStateProperties.FACING)
|
| 199 | .select(Direction.DOWN, X_ROT_180)
|
| 200 | .select(Direction.UP, NOP)
|
| 201 | .select(Direction.NORTH, X_ROT_90)
|
| 202 | .select(Direction.SOUTH, X_ROT_90.then(Y_ROT_180))
|
| 203 | .select(Direction.WEST, X_ROT_90.then(Y_ROT_270))
|
| 204 | .select(Direction.EAST, X_ROT_90.then(Y_ROT_90));
|
| 205 | /**
|
| 206 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 207 | */
|
| 208 | public static final PropertyDispatch<VariantMutator> ROTATION_TORCH = PropertyDispatch.modify(BlockStateProperties.HORIZONTAL_FACING)
|
| 209 | .select(Direction.EAST, NOP)
|
| 210 | .select(Direction.SOUTH, Y_ROT_90)
|
| 211 | .select(Direction.WEST, Y_ROT_180)
|
| 212 | .select(Direction.NORTH, Y_ROT_270);
|
| 213 | /**
|
| 214 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 215 | */
|
| 216 | public static final PropertyDispatch<VariantMutator> ROTATION_HORIZONTAL_FACING_ALT = PropertyDispatch.modify(BlockStateProperties.HORIZONTAL_FACING)
|
| 217 | .select(Direction.SOUTH, NOP)
|
| 218 | .select(Direction.WEST, Y_ROT_90)
|
| 219 | .select(Direction.NORTH, Y_ROT_180)
|
| 220 | .select(Direction.EAST, Y_ROT_270);
|
| 221 | /**
|
| 222 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 223 | */
|
| 224 | public static final PropertyDispatch<VariantMutator> ROTATION_HORIZONTAL_FACING = PropertyDispatch.modify(BlockStateProperties.HORIZONTAL_FACING)
|
| 225 | .select(Direction.EAST, Y_ROT_90)
|
| 226 | .select(Direction.SOUTH, Y_ROT_180)
|
| 227 | .select(Direction.WEST, Y_ROT_270)
|
| 228 | .select(Direction.NORTH, NOP);
|
| 229 | private static final Map<Block, TexturedModel> TEXTURED_MODELS = ImmutableMap.<Block, TexturedModel>builder()
|
| 230 | .put(Blocks.SANDSTONE, TexturedModel.TOP_BOTTOM_WITH_WALL.get(Blocks.SANDSTONE))
|
| 231 | .put(Blocks.RED_SANDSTONE, TexturedModel.TOP_BOTTOM_WITH_WALL.get(Blocks.RED_SANDSTONE))
|
| 232 | .put(Blocks.SMOOTH_SANDSTONE, TexturedModel.createAllSame(TextureMapping.getBlockTexture(Blocks.SANDSTONE, "_top")))
|
| 233 | .put(Blocks.SMOOTH_RED_SANDSTONE, TexturedModel.createAllSame(TextureMapping.getBlockTexture(Blocks.RED_SANDSTONE, "_top")))
|
| 234 | .put(
|
| 235 | Blocks.CUT_SANDSTONE,
|
| 236 | TexturedModel.COLUMN.get(Blocks.SANDSTONE).updateTextures(m -> m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.CUT_SANDSTONE)))
|
| 237 | )
|
| 238 | .put(
|
| 239 | Blocks.CUT_RED_SANDSTONE,
|
| 240 | TexturedModel.COLUMN.get(Blocks.RED_SANDSTONE).updateTextures(m -> m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.CUT_RED_SANDSTONE)))
|
| 241 | )
|
| 242 | .put(Blocks.QUARTZ_BLOCK, TexturedModel.COLUMN.get(Blocks.QUARTZ_BLOCK))
|
| 243 | .put(Blocks.SMOOTH_QUARTZ, TexturedModel.createAllSame(TextureMapping.getBlockTexture(Blocks.QUARTZ_BLOCK, "_bottom")))
|
| 244 | .put(Blocks.BLACKSTONE, TexturedModel.COLUMN_WITH_WALL.get(Blocks.BLACKSTONE))
|
| 245 | .put(Blocks.DEEPSLATE, TexturedModel.COLUMN_WITH_WALL.get(Blocks.DEEPSLATE))
|
| 246 | .put(
|
| 247 | Blocks.CHISELED_QUARTZ_BLOCK,
|
| 248 | TexturedModel.COLUMN
|
| 249 | .get(Blocks.CHISELED_QUARTZ_BLOCK)
|
| 250 | .updateTextures(m -> m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.CHISELED_QUARTZ_BLOCK)))
|
| 251 | )
|
| 252 | .put(Blocks.CHISELED_SANDSTONE, TexturedModel.COLUMN.get(Blocks.CHISELED_SANDSTONE).updateTextures(m -> {
|
| 253 | m.put(TextureSlot.END, TextureMapping.getBlockTexture(Blocks.SANDSTONE, "_top"));
|
| 254 | m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.CHISELED_SANDSTONE));
|
| 255 | }))
|
| 256 | .put(Blocks.CHISELED_RED_SANDSTONE, TexturedModel.COLUMN.get(Blocks.CHISELED_RED_SANDSTONE).updateTextures(m -> {
|
| 257 | m.put(TextureSlot.END, TextureMapping.getBlockTexture(Blocks.RED_SANDSTONE, "_top"));
|
| 258 | m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.CHISELED_RED_SANDSTONE));
|
| 259 | }))
|
| 260 | .put(Blocks.CHISELED_TUFF_BRICKS, TexturedModel.COLUMN_WITH_WALL.get(Blocks.CHISELED_TUFF_BRICKS))
|
| 261 | .put(Blocks.CHISELED_TUFF, TexturedModel.COLUMN_WITH_WALL.get(Blocks.CHISELED_TUFF))
|
| 262 | .build();
|
| 263 | private static final Map<Variant, BiConsumer<BlockModelGenerators.BlockFamilyProvider, Block>> SHAPE_CONSUMERS = ImmutableMap.<Variant, BiConsumer<BlockModelGenerators.BlockFamilyProvider, Block>>builder()
|
| 264 | .put(Variant.BUTTON, BlockModelGenerators.BlockFamilyProvider::button)
|
| 265 | .put(Variant.CARPET, BlockModelGenerators.BlockFamilyProvider::carpet)
|
| 266 | .put(Variant.DOOR, BlockModelGenerators.BlockFamilyProvider::door)
|
| 267 | .put(Variant.CHISELED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant)
|
| 268 | .put(Variant.CRACKED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant)
|
| 269 | .put(Variant.CUSTOM_FENCE, BlockModelGenerators.BlockFamilyProvider::customFence)
|
| 270 | .put(Variant.FENCE, BlockModelGenerators.BlockFamilyProvider::fence)
|
| 271 | .put(Variant.CUSTOM_FENCE_GATE, BlockModelGenerators.BlockFamilyProvider::customFenceGate)
|
| 272 | .put(Variant.FENCE_GATE, BlockModelGenerators.BlockFamilyProvider::fenceGate)
|
| 273 | .put(Variant.SIGN, BlockModelGenerators.BlockFamilyProvider::sign)
|
| 274 | .put(Variant.CUSTOM_HANGING_SIGN, BlockModelGenerators.BlockFamilyProvider::customHangingSign)
|
| 275 | .put(Variant.HANGING_SIGN, BlockModelGenerators.BlockFamilyProvider::hangingSign)
|
| 276 | .put(Variant.SLAB, BlockModelGenerators.BlockFamilyProvider::slab)
|
| 277 | .put(Variant.STAIRS, BlockModelGenerators.BlockFamilyProvider::stairs)
|
| 278 | .put(Variant.PRESSURE_PLATE, BlockModelGenerators.BlockFamilyProvider::pressurePlate)
|
| 279 | .put(Variant.TRAPDOOR, BlockModelGenerators.BlockFamilyProvider::trapdoor)
|
| 280 | .put(Variant.WALL, BlockModelGenerators.BlockFamilyProvider::wall)
|
| 281 | .put(Variant.BRICKS, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant)
|
| 282 | .put(Variant.TILES, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant)
|
| 283 | .put(Variant.COBBLED, BlockModelGenerators.BlockFamilyProvider::fullBlockVariant)
|
| 284 | .put(Variant.PILLAR, BlockModelGenerators.BlockFamilyProvider::pillar)
|
| 285 | .build();
|
| 286 | private static final Map<Direction, VariantMutator> MULTIFACE_GENERATOR = ImmutableMap.of(
|
| 287 | Direction.NORTH,
|
| 288 | NOP,
|
| 289 | Direction.EAST,
|
| 290 | Y_ROT_90.then(UV_LOCK),
|
| 291 | Direction.SOUTH,
|
| 292 | Y_ROT_180.then(UV_LOCK),
|
| 293 | Direction.WEST,
|
| 294 | Y_ROT_270.then(UV_LOCK),
|
| 295 | Direction.UP,
|
| 296 | X_ROT_270.then(UV_LOCK),
|
| 297 | Direction.DOWN,
|
| 298 | X_ROT_90.then(UV_LOCK)
|
| 299 | );
|
| 300 | private static final Map<BlockModelGenerators.BookSlotModelCacheKey, Identifier> CHISELED_BOOKSHELF_SLOT_MODEL_CACHE = new HashMap<>();
|
| 301 |
|
| 302 | /**
|
| 303 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 304 | */
|
| 305 | public static net.minecraft.client.renderer.block.dispatch.Variant plainModel(final Identifier model) {
|
| 306 | return new net.minecraft.client.renderer.block.dispatch.Variant(model);
|
| 307 | }
|
| 308 |
|
| 309 | /**
|
| 310 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 311 | */
|
| 312 | public static MultiVariant variant(final net.minecraft.client.renderer.block.dispatch.Variant variant) {
|
| 313 | return new MultiVariant(WeightedList.of(variant));
|
| 314 | }
|
| 315 |
|
| 316 | /**
|
| 317 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 318 | */
|
| 319 | public static MultiVariant variants(final net.minecraft.client.renderer.block.dispatch.Variant... variant) {
|
| 320 | return new MultiVariant(WeightedList.of(Arrays.stream(variant).map(v -> new Weighted<>(v, 1)).toList()));
|
| 321 | }
|
| 322 |
|
| 323 | /**
|
| 324 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 325 | */
|
| 326 | public static MultiVariant plainVariant(final Identifier model) {
|
| 327 | return variant(plainModel(model));
|
| 328 | }
|
| 329 |
|
| 330 | /**
|
| 331 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 332 | */
|
| 333 | public static ConditionBuilder condition() {
|
| 334 | return new ConditionBuilder();
|
| 335 | }
|
| 336 |
|
| 337 | /**
|
| 338 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 339 | */
|
| 340 | @SafeVarargs
|
| 341 | public static <T extends Enum<T> & StringRepresentable> ConditionBuilder condition(final EnumProperty<T> property, final T term, final T... additionalTerms) {
|
| 342 | return condition().term(property, term, additionalTerms);
|
| 343 | }
|
| 344 |
|
| 345 | /**
|
| 346 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 347 | */
|
| 348 | public static ConditionBuilder condition(final BooleanProperty property, final boolean term) {
|
| 349 | return condition().term(property, term);
|
| 350 | }
|
| 351 |
|
| 352 | /**
|
| 353 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 354 | */
|
| 355 | public static Condition or(final ConditionBuilder... terms) {
|
| 356 | return new CombinedCondition(CombinedCondition.Operation.OR, Stream.of(terms).map(ConditionBuilder::build).toList());
|
| 357 | }
|
| 358 |
|
| 359 | /**
|
| 360 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 361 | */
|
| 362 | public static Condition and(final ConditionBuilder... terms) {
|
| 363 | return new CombinedCondition(CombinedCondition.Operation.AND, Stream.of(terms).map(ConditionBuilder::build).toList());
|
| 364 | }
|
| 365 |
|
| 366 | /**
|
| 367 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 368 | */
|
| 369 | public static BlockModelDefinitionGenerator createMirroredCubeGenerator(
|
| 370 | final Block block,
|
| 371 | final net.minecraft.client.renderer.block.dispatch.Variant normal,
|
| 372 | final TextureMapping mapping,
|
| 373 | final BiConsumer<Identifier, ModelInstance> modelOutput
|
| 374 | ) {
|
| 375 | net.minecraft.client.renderer.block.dispatch.Variant mirrored = plainModel(ModelTemplates.CUBE_MIRRORED_ALL.create(block, mapping, modelOutput));
|
| 376 | return MultiVariantGenerator.dispatch(block, createRotatedVariants(normal, mirrored));
|
| 377 | }
|
| 378 |
|
| 379 | /**
|
| 380 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 381 | */
|
| 382 | public static BlockModelDefinitionGenerator createNorthWestMirroredCubeGenerator(
|
| 383 | final Block block,
|
| 384 | final net.minecraft.client.renderer.block.dispatch.Variant normal,
|
| 385 | final TextureMapping mapping,
|
| 386 | final BiConsumer<Identifier, ModelInstance> modelOutput
|
| 387 | ) {
|
| 388 | MultiVariant northWestMirrored = plainVariant(ModelTemplates.CUBE_NORTH_WEST_MIRRORED_ALL.create(block, mapping, modelOutput));
|
| 389 | return createSimpleBlock(block, northWestMirrored);
|
| 390 | }
|
| 391 |
|
| 392 | /**
|
| 393 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 394 | */
|
| 395 | public static BlockModelDefinitionGenerator createMirroredColumnGenerator(
|
| 396 | final Block block,
|
| 397 | final net.minecraft.client.renderer.block.dispatch.Variant normal,
|
| 398 | final TextureMapping mapping,
|
| 399 | final BiConsumer<Identifier, ModelInstance> modelOutput
|
| 400 | ) {
|
| 401 | net.minecraft.client.renderer.block.dispatch.Variant mirrored = plainModel(ModelTemplates.CUBE_COLUMN_MIRRORED.create(block, mapping, modelOutput));
|
| 402 | return MultiVariantGenerator.dispatch(block, createRotatedVariants(normal, mirrored)).with(createRotatedPillar());
|
| 403 | }
|
| 404 |
|
| 405 | public BlockModelGenerators(
|
| 406 | final Consumer<BlockModelDefinitionGenerator> blockStateOutput,
|
| 407 | final ItemModelOutput itemModelOutput,
|
| 408 | final BiConsumer<Identifier, ModelInstance> modelOutput
|
| 409 | ) {
|
| 410 | this.blockStateOutput = blockStateOutput;
|
| 411 | this.itemModelOutput = itemModelOutput;
|
| 412 | this.modelOutput = modelOutput;
|
| 413 | }
|
| 414 |
|
| 415 | /**
|
| 416 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 417 | */
|
| 418 | public final void registerSimpleItemModel(final Item item, final Identifier model) {
|
| 419 | this.itemModelOutput.accept(item, ItemModelUtils.plainModel(model));
|
| 420 | }
|
| 421 |
|
| 422 | /**
|
| 423 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 424 | */
|
| 425 | public final void registerSimpleItemModel(final Block block, final Identifier model) {
|
| 426 | this.itemModelOutput.accept(block.asItem(), ItemModelUtils.plainModel(model));
|
| 427 | }
|
| 428 |
|
| 429 | /**
|
| 430 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 431 | */
|
| 432 | public final void registerSimpleTintedItemModel(final Block block, final Identifier model, final ItemTintSource tint) {
|
| 433 | this.itemModelOutput.accept(block.asItem(), ItemModelUtils.tintedModel(model, tint));
|
| 434 | }
|
| 435 |
|
| 436 | /**
|
| 437 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 438 | */
|
| 439 | public final Identifier createFlatItemModel(final Item item) {
|
| 440 | return this.createFlatItemModel(item, TextureMapping.getItemTexture(item));
|
| 441 | }
|
| 442 |
|
| 443 | /**
|
| 444 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 445 | */
|
| 446 | public final Identifier createFlatItemModelWithBlockTexture(final Item item, final Block block) {
|
| 447 | return this.createFlatItemModel(item, TextureMapping.getBlockTexture(block));
|
| 448 | }
|
| 449 |
|
| 450 | /**
|
| 451 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 452 | */
|
| 453 | public final Identifier createFlatItemModelWithBlockTexture(final Item item, final Block block, final String suffix) {
|
| 454 | return this.createFlatItemModel(item, TextureMapping.getBlockTexture(block, suffix));
|
| 455 | }
|
| 456 |
|
| 457 | /**
|
| 458 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 459 | */
|
| 460 | public final Identifier createFlatItemModel(final Item item, final Material material) {
|
| 461 | return ModelTemplates.FLAT_ITEM.create(ModelLocationUtils.getModelLocation(item), TextureMapping.layer0(material), this.modelOutput);
|
| 462 | }
|
| 463 |
|
| 464 | /**
|
| 465 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 466 | */
|
| 467 | public final Identifier createTwoLayeredItemModel(final Item item, final Material base, final Material overlay) {
|
| 468 | return ModelTemplates.TWO_LAYERED_ITEM.create(ModelLocationUtils.getModelLocation(item), TextureMapping.layered(base, overlay), this.modelOutput);
|
| 469 | }
|
| 470 |
|
| 471 | /**
|
| 472 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 473 | */
|
| 474 | public final void registerSimpleFlatItemModel(final Item item) {
|
| 475 | this.registerSimpleItemModel(item, this.createFlatItemModel(item));
|
| 476 | }
|
| 477 |
|
| 478 | /**
|
| 479 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 480 | */
|
| 481 | public final void registerSimpleFlatItemModel(final Block block) {
|
| 482 | Item blockItem = block.asItem();
|
| 483 | if (blockItem != Items.AIR) {
|
| 484 | this.registerSimpleItemModel(blockItem, this.createFlatItemModelWithBlockTexture(blockItem, block));
|
| 485 | }
|
| 486 | }
|
| 487 |
|
| 488 | /**
|
| 489 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 490 | */
|
| 491 | public final void registerSimpleFlatItemModel(final Block block, final String suffix) {
|
| 492 | Item blockItem = block.asItem();
|
| 493 | if (blockItem != Items.AIR) {
|
| 494 | this.registerSimpleItemModel(blockItem, this.createFlatItemModelWithBlockTexture(blockItem, block, suffix));
|
| 495 | }
|
| 496 | }
|
| 497 |
|
| 498 | /**
|
| 499 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 500 | */
|
| 501 | public static MultiVariant createRotatedVariants(final net.minecraft.client.renderer.block.dispatch.Variant base) {
|
| 502 | return variants(base, base.with(Y_ROT_90), base.with(Y_ROT_180), base.with(Y_ROT_270));
|
| 503 | }
|
| 504 |
|
| 505 | /**
|
| 506 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 507 | */
|
| 508 | public static MultiVariant createRotatedVariants(
|
| 509 | final net.minecraft.client.renderer.block.dispatch.Variant normal, final net.minecraft.client.renderer.block.dispatch.Variant mirrored
|
| 510 | ) {
|
| 511 | return variants(normal, mirrored, normal.with(Y_ROT_180), mirrored.with(Y_ROT_180));
|
| 512 | }
|
| 513 |
|
| 514 | /**
|
| 515 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 516 | */
|
| 517 | public static PropertyDispatch<MultiVariant> createBooleanModelDispatch(final BooleanProperty property, final MultiVariant onTrue, final MultiVariant onFalse) {
|
| 518 | return PropertyDispatch.initial(property).select(true, onTrue).select(false, onFalse);
|
| 519 | }
|
| 520 |
|
| 521 | /**
|
| 522 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 523 | */
|
| 524 | public final void createRotatedMirroredVariantBlock(final Block block) {
|
| 525 | net.minecraft.client.renderer.block.dispatch.Variant normal = plainModel(TexturedModel.CUBE.create(block, this.modelOutput));
|
| 526 | net.minecraft.client.renderer.block.dispatch.Variant mirrored = plainModel(TexturedModel.CUBE_MIRRORED.create(block, this.modelOutput));
|
| 527 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block, createRotatedVariants(normal, mirrored)));
|
| 528 | }
|
| 529 |
|
| 530 | /**
|
| 531 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 532 | */
|
| 533 | public final void createRotatedVariantBlock(final Block block) {
|
| 534 | this.createRotatedVariantBlock(block, TexturedModel.CUBE);
|
| 535 | }
|
| 536 |
|
| 537 | /**
|
| 538 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 539 | */
|
| 540 | public final void createRotatedVariantBlock(final Block block, final TexturedModel.Provider modelProvider) {
|
| 541 | this.createRotatedVariantBlock(block, modelProvider.create(block, this.modelOutput));
|
| 542 | }
|
| 543 |
|
| 544 | /**
|
| 545 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 546 | */
|
| 547 | public final void createRotatedVariantBlock(final Block block, final Identifier model) {
|
| 548 | net.minecraft.client.renderer.block.dispatch.Variant normal = plainModel(model);
|
| 549 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block, createRotatedVariants(normal)));
|
| 550 | }
|
| 551 |
|
| 552 | /**
|
| 553 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 554 | */
|
| 555 | public final void createBrushableBlock(final Block block) {
|
| 556 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(PropertyDispatch.initial(BlockStateProperties.DUSTED).generate(dustProgress -> {
|
| 557 | String suffix = "_" + dustProgress;
|
| 558 | Material texture = TextureMapping.getBlockTexture(block, suffix);
|
| 559 | Identifier model = ModelTemplates.CUBE_ALL.createWithSuffix(block, suffix, new TextureMapping().put(TextureSlot.ALL, texture), this.modelOutput);
|
| 560 | return plainVariant(model);
|
| 561 | })));
|
| 562 | this.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block, "_0"));
|
| 563 | }
|
| 564 |
|
| 565 | /**
|
| 566 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 567 | */
|
| 568 | public static BlockModelDefinitionGenerator createButton(final Block block, final MultiVariant normal, final MultiVariant pressed) {
|
| 569 | return MultiVariantGenerator.dispatch(block)
|
| 570 | .with(PropertyDispatch.initial(BlockStateProperties.POWERED).select(false, normal).select(true, pressed))
|
| 571 | .with(
|
| 572 | PropertyDispatch.modify(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING)
|
| 573 | .select(AttachFace.FLOOR, Direction.EAST, Y_ROT_90)
|
| 574 | .select(AttachFace.FLOOR, Direction.WEST, Y_ROT_270)
|
| 575 | .select(AttachFace.FLOOR, Direction.SOUTH, Y_ROT_180)
|
| 576 | .select(AttachFace.FLOOR, Direction.NORTH, NOP)
|
| 577 | .select(AttachFace.WALL, Direction.EAST, Y_ROT_90.then(X_ROT_90).then(UV_LOCK))
|
| 578 | .select(AttachFace.WALL, Direction.WEST, Y_ROT_270.then(X_ROT_90).then(UV_LOCK))
|
| 579 | .select(AttachFace.WALL, Direction.SOUTH, Y_ROT_180.then(X_ROT_90).then(UV_LOCK))
|
| 580 | .select(AttachFace.WALL, Direction.NORTH, X_ROT_90.then(UV_LOCK))
|
| 581 | .select(AttachFace.CEILING, Direction.EAST, Y_ROT_270.then(X_ROT_180))
|
| 582 | .select(AttachFace.CEILING, Direction.WEST, Y_ROT_90.then(X_ROT_180))
|
| 583 | .select(AttachFace.CEILING, Direction.SOUTH, X_ROT_180)
|
| 584 | .select(AttachFace.CEILING, Direction.NORTH, Y_ROT_180.then(X_ROT_180))
|
| 585 | );
|
| 586 | }
|
| 587 |
|
| 588 | /**
|
| 589 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 590 | */
|
| 591 | public static BlockModelDefinitionGenerator createDoor(
|
| 592 | final Block block,
|
| 593 | final MultiVariant bottomLeft,
|
| 594 | final MultiVariant bottomLeftOpen,
|
| 595 | final MultiVariant bottomRight,
|
| 596 | final MultiVariant bottomRightOpen,
|
| 597 | final MultiVariant topLeft,
|
| 598 | final MultiVariant topLeftOpen,
|
| 599 | final MultiVariant topRight,
|
| 600 | final MultiVariant topRightOpen
|
| 601 | ) {
|
| 602 | return MultiVariantGenerator.dispatch(block)
|
| 603 | .with(
|
| 604 | PropertyDispatch.initial(
|
| 605 | BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.DOUBLE_BLOCK_HALF, BlockStateProperties.DOOR_HINGE, BlockStateProperties.OPEN
|
| 606 | )
|
| 607 | .select(Direction.EAST, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, false, bottomLeft)
|
| 608 | .select(Direction.SOUTH, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, false, bottomLeft.with(Y_ROT_90))
|
| 609 | .select(Direction.WEST, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, false, bottomLeft.with(Y_ROT_180))
|
| 610 | .select(Direction.NORTH, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, false, bottomLeft.with(Y_ROT_270))
|
| 611 | .select(Direction.EAST, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, false, bottomRight)
|
| 612 | .select(Direction.SOUTH, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, false, bottomRight.with(Y_ROT_90))
|
| 613 | .select(Direction.WEST, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, false, bottomRight.with(Y_ROT_180))
|
| 614 | .select(Direction.NORTH, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, false, bottomRight.with(Y_ROT_270))
|
| 615 | .select(Direction.EAST, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, true, bottomLeftOpen.with(Y_ROT_90))
|
| 616 | .select(Direction.SOUTH, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, true, bottomLeftOpen.with(Y_ROT_180))
|
| 617 | .select(Direction.WEST, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, true, bottomLeftOpen.with(Y_ROT_270))
|
| 618 | .select(Direction.NORTH, DoubleBlockHalf.LOWER, DoorHingeSide.LEFT, true, bottomLeftOpen)
|
| 619 | .select(Direction.EAST, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, true, bottomRightOpen.with(Y_ROT_270))
|
| 620 | .select(Direction.SOUTH, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, true, bottomRightOpen)
|
| 621 | .select(Direction.WEST, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, true, bottomRightOpen.with(Y_ROT_90))
|
| 622 | .select(Direction.NORTH, DoubleBlockHalf.LOWER, DoorHingeSide.RIGHT, true, bottomRightOpen.with(Y_ROT_180))
|
| 623 | .select(Direction.EAST, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, false, topLeft)
|
| 624 | .select(Direction.SOUTH, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, false, topLeft.with(Y_ROT_90))
|
| 625 | .select(Direction.WEST, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, false, topLeft.with(Y_ROT_180))
|
| 626 | .select(Direction.NORTH, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, false, topLeft.with(Y_ROT_270))
|
| 627 | .select(Direction.EAST, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, false, topRight)
|
| 628 | .select(Direction.SOUTH, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, false, topRight.with(Y_ROT_90))
|
| 629 | .select(Direction.WEST, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, false, topRight.with(Y_ROT_180))
|
| 630 | .select(Direction.NORTH, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, false, topRight.with(Y_ROT_270))
|
| 631 | .select(Direction.EAST, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, true, topLeftOpen.with(Y_ROT_90))
|
| 632 | .select(Direction.SOUTH, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, true, topLeftOpen.with(Y_ROT_180))
|
| 633 | .select(Direction.WEST, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, true, topLeftOpen.with(Y_ROT_270))
|
| 634 | .select(Direction.NORTH, DoubleBlockHalf.UPPER, DoorHingeSide.LEFT, true, topLeftOpen)
|
| 635 | .select(Direction.EAST, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, true, topRightOpen.with(Y_ROT_270))
|
| 636 | .select(Direction.SOUTH, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, true, topRightOpen)
|
| 637 | .select(Direction.WEST, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, true, topRightOpen.with(Y_ROT_90))
|
| 638 | .select(Direction.NORTH, DoubleBlockHalf.UPPER, DoorHingeSide.RIGHT, true, topRightOpen.with(Y_ROT_180))
|
| 639 | );
|
| 640 | }
|
| 641 |
|
| 642 | /**
|
| 643 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 644 | */
|
| 645 | public static BlockModelDefinitionGenerator createCustomFence(
|
| 646 | final Block block, final MultiVariant post, final MultiVariant north, final MultiVariant east, final MultiVariant south, final MultiVariant west
|
| 647 | ) {
|
| 648 | return MultiPartGenerator.multiPart(block)
|
| 649 | .with(post)
|
| 650 | .with(condition().term(BlockStateProperties.NORTH, true), north)
|
| 651 | .with(condition().term(BlockStateProperties.EAST, true), east)
|
| 652 | .with(condition().term(BlockStateProperties.SOUTH, true), south)
|
| 653 | .with(condition().term(BlockStateProperties.WEST, true), west);
|
| 654 | }
|
| 655 |
|
| 656 | /**
|
| 657 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 658 | */
|
| 659 | public static BlockModelDefinitionGenerator createFence(final Block block, final MultiVariant post, final MultiVariant side) {
|
| 660 | return MultiPartGenerator.multiPart(block)
|
| 661 | .with(post)
|
| 662 | .with(condition().term(BlockStateProperties.NORTH, true), side.with(UV_LOCK))
|
| 663 | .with(condition().term(BlockStateProperties.EAST, true), side.with(Y_ROT_90).with(UV_LOCK))
|
| 664 | .with(condition().term(BlockStateProperties.SOUTH, true), side.with(Y_ROT_180).with(UV_LOCK))
|
| 665 | .with(condition().term(BlockStateProperties.WEST, true), side.with(Y_ROT_270).with(UV_LOCK));
|
| 666 | }
|
| 667 |
|
| 668 | /**
|
| 669 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 670 | */
|
| 671 | public static BlockModelDefinitionGenerator createWall(final Block block, final MultiVariant post, final MultiVariant lowSide, final MultiVariant tallSide) {
|
| 672 | return MultiPartGenerator.multiPart(block)
|
| 673 | .with(condition().term(BlockStateProperties.UP, true), post)
|
| 674 | .with(condition().term(BlockStateProperties.NORTH_WALL, WallSide.LOW), lowSide.with(UV_LOCK))
|
| 675 | .with(condition().term(BlockStateProperties.EAST_WALL, WallSide.LOW), lowSide.with(Y_ROT_90).with(UV_LOCK))
|
| 676 | .with(condition().term(BlockStateProperties.SOUTH_WALL, WallSide.LOW), lowSide.with(Y_ROT_180).with(UV_LOCK))
|
| 677 | .with(condition().term(BlockStateProperties.WEST_WALL, WallSide.LOW), lowSide.with(Y_ROT_270).with(UV_LOCK))
|
| 678 | .with(condition().term(BlockStateProperties.NORTH_WALL, WallSide.TALL), tallSide.with(UV_LOCK))
|
| 679 | .with(condition().term(BlockStateProperties.EAST_WALL, WallSide.TALL), tallSide.with(Y_ROT_90).with(UV_LOCK))
|
| 680 | .with(condition().term(BlockStateProperties.SOUTH_WALL, WallSide.TALL), tallSide.with(Y_ROT_180).with(UV_LOCK))
|
| 681 | .with(condition().term(BlockStateProperties.WEST_WALL, WallSide.TALL), tallSide.with(Y_ROT_270).with(UV_LOCK));
|
| 682 | }
|
| 683 |
|
| 684 | /**
|
| 685 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 686 | */
|
| 687 | public static BlockModelDefinitionGenerator createFenceGate(
|
| 688 | final Block block, final MultiVariant open, final MultiVariant closed, final MultiVariant openWall, final MultiVariant closedWall, final boolean uvLock
|
| 689 | ) {
|
| 690 | return MultiVariantGenerator.dispatch(block)
|
| 691 | .with(
|
| 692 | PropertyDispatch.initial(BlockStateProperties.IN_WALL, BlockStateProperties.OPEN)
|
| 693 | .select(false, false, closed)
|
| 694 | .select(true, false, closedWall)
|
| 695 | .select(false, true, open)
|
| 696 | .select(true, true, openWall)
|
| 697 | )
|
| 698 | .with(uvLock ? UV_LOCK : NOP)
|
| 699 | .with(ROTATION_HORIZONTAL_FACING_ALT);
|
| 700 | }
|
| 701 |
|
| 702 | /**
|
| 703 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 704 | */
|
| 705 | public static BlockModelDefinitionGenerator createStairs(final Block block, final MultiVariant inner, final MultiVariant straight, final MultiVariant outer) {
|
| 706 | return MultiVariantGenerator.dispatch(block)
|
| 707 | .with(
|
| 708 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.HALF, BlockStateProperties.STAIRS_SHAPE)
|
| 709 | .select(Direction.EAST, Half.BOTTOM, StairsShape.STRAIGHT, straight)
|
| 710 | .select(Direction.WEST, Half.BOTTOM, StairsShape.STRAIGHT, straight.with(Y_ROT_180).with(UV_LOCK))
|
| 711 | .select(Direction.SOUTH, Half.BOTTOM, StairsShape.STRAIGHT, straight.with(Y_ROT_90).with(UV_LOCK))
|
| 712 | .select(Direction.NORTH, Half.BOTTOM, StairsShape.STRAIGHT, straight.with(Y_ROT_270).with(UV_LOCK))
|
| 713 | .select(Direction.EAST, Half.BOTTOM, StairsShape.OUTER_RIGHT, outer)
|
| 714 | .select(Direction.WEST, Half.BOTTOM, StairsShape.OUTER_RIGHT, outer.with(Y_ROT_180).with(UV_LOCK))
|
| 715 | .select(Direction.SOUTH, Half.BOTTOM, StairsShape.OUTER_RIGHT, outer.with(Y_ROT_90).with(UV_LOCK))
|
| 716 | .select(Direction.NORTH, Half.BOTTOM, StairsShape.OUTER_RIGHT, outer.with(Y_ROT_270).with(UV_LOCK))
|
| 717 | .select(Direction.EAST, Half.BOTTOM, StairsShape.OUTER_LEFT, outer.with(Y_ROT_270).with(UV_LOCK))
|
| 718 | .select(Direction.WEST, Half.BOTTOM, StairsShape.OUTER_LEFT, outer.with(Y_ROT_90).with(UV_LOCK))
|
| 719 | .select(Direction.SOUTH, Half.BOTTOM, StairsShape.OUTER_LEFT, outer)
|
| 720 | .select(Direction.NORTH, Half.BOTTOM, StairsShape.OUTER_LEFT, outer.with(Y_ROT_180).with(UV_LOCK))
|
| 721 | .select(Direction.EAST, Half.BOTTOM, StairsShape.INNER_RIGHT, inner)
|
| 722 | .select(Direction.WEST, Half.BOTTOM, StairsShape.INNER_RIGHT, inner.with(Y_ROT_180).with(UV_LOCK))
|
| 723 | .select(Direction.SOUTH, Half.BOTTOM, StairsShape.INNER_RIGHT, inner.with(Y_ROT_90).with(UV_LOCK))
|
| 724 | .select(Direction.NORTH, Half.BOTTOM, StairsShape.INNER_RIGHT, inner.with(Y_ROT_270).with(UV_LOCK))
|
| 725 | .select(Direction.EAST, Half.BOTTOM, StairsShape.INNER_LEFT, inner.with(Y_ROT_270).with(UV_LOCK))
|
| 726 | .select(Direction.WEST, Half.BOTTOM, StairsShape.INNER_LEFT, inner.with(Y_ROT_90).with(UV_LOCK))
|
| 727 | .select(Direction.SOUTH, Half.BOTTOM, StairsShape.INNER_LEFT, inner)
|
| 728 | .select(Direction.NORTH, Half.BOTTOM, StairsShape.INNER_LEFT, inner.with(Y_ROT_180).with(UV_LOCK))
|
| 729 | .select(Direction.EAST, Half.TOP, StairsShape.STRAIGHT, straight.with(X_ROT_180).with(UV_LOCK))
|
| 730 | .select(Direction.WEST, Half.TOP, StairsShape.STRAIGHT, straight.with(X_ROT_180).with(Y_ROT_180).with(UV_LOCK))
|
| 731 | .select(Direction.SOUTH, Half.TOP, StairsShape.STRAIGHT, straight.with(X_ROT_180).with(Y_ROT_90).with(UV_LOCK))
|
| 732 | .select(Direction.NORTH, Half.TOP, StairsShape.STRAIGHT, straight.with(X_ROT_180).with(Y_ROT_270).with(UV_LOCK))
|
| 733 | .select(Direction.EAST, Half.TOP, StairsShape.OUTER_RIGHT, outer.with(X_ROT_180).with(Y_ROT_90).with(UV_LOCK))
|
| 734 | .select(Direction.WEST, Half.TOP, StairsShape.OUTER_RIGHT, outer.with(X_ROT_180).with(Y_ROT_270).with(UV_LOCK))
|
| 735 | .select(Direction.SOUTH, Half.TOP, StairsShape.OUTER_RIGHT, outer.with(X_ROT_180).with(Y_ROT_180).with(UV_LOCK))
|
| 736 | .select(Direction.NORTH, Half.TOP, StairsShape.OUTER_RIGHT, outer.with(X_ROT_180).with(UV_LOCK))
|
| 737 | .select(Direction.EAST, Half.TOP, StairsShape.OUTER_LEFT, outer.with(X_ROT_180).with(UV_LOCK))
|
| 738 | .select(Direction.WEST, Half.TOP, StairsShape.OUTER_LEFT, outer.with(X_ROT_180).with(Y_ROT_180).with(UV_LOCK))
|
| 739 | .select(Direction.SOUTH, Half.TOP, StairsShape.OUTER_LEFT, outer.with(X_ROT_180).with(Y_ROT_90).with(UV_LOCK))
|
| 740 | .select(Direction.NORTH, Half.TOP, StairsShape.OUTER_LEFT, outer.with(X_ROT_180).with(Y_ROT_270).with(UV_LOCK))
|
| 741 | .select(Direction.EAST, Half.TOP, StairsShape.INNER_RIGHT, inner.with(X_ROT_180).with(Y_ROT_90).with(UV_LOCK))
|
| 742 | .select(Direction.WEST, Half.TOP, StairsShape.INNER_RIGHT, inner.with(X_ROT_180).with(Y_ROT_270).with(UV_LOCK))
|
| 743 | .select(Direction.SOUTH, Half.TOP, StairsShape.INNER_RIGHT, inner.with(X_ROT_180).with(Y_ROT_180).with(UV_LOCK))
|
| 744 | .select(Direction.NORTH, Half.TOP, StairsShape.INNER_RIGHT, inner.with(X_ROT_180).with(UV_LOCK))
|
| 745 | .select(Direction.EAST, Half.TOP, StairsShape.INNER_LEFT, inner.with(X_ROT_180).with(UV_LOCK))
|
| 746 | .select(Direction.WEST, Half.TOP, StairsShape.INNER_LEFT, inner.with(X_ROT_180).with(Y_ROT_180).with(UV_LOCK))
|
| 747 | .select(Direction.SOUTH, Half.TOP, StairsShape.INNER_LEFT, inner.with(X_ROT_180).with(Y_ROT_90).with(UV_LOCK))
|
| 748 | .select(Direction.NORTH, Half.TOP, StairsShape.INNER_LEFT, inner.with(X_ROT_180).with(Y_ROT_270).with(UV_LOCK))
|
| 749 | );
|
| 750 | }
|
| 751 |
|
| 752 | /**
|
| 753 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 754 | */
|
| 755 | public static BlockModelDefinitionGenerator createOrientableTrapdoor(
|
| 756 | final Block block, final MultiVariant top, final MultiVariant bottom, final MultiVariant open
|
| 757 | ) {
|
| 758 | return MultiVariantGenerator.dispatch(block)
|
| 759 | .with(
|
| 760 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.HALF, BlockStateProperties.OPEN)
|
| 761 | .select(Direction.NORTH, Half.BOTTOM, false, bottom)
|
| 762 | .select(Direction.SOUTH, Half.BOTTOM, false, bottom.with(Y_ROT_180))
|
| 763 | .select(Direction.EAST, Half.BOTTOM, false, bottom.with(Y_ROT_90))
|
| 764 | .select(Direction.WEST, Half.BOTTOM, false, bottom.with(Y_ROT_270))
|
| 765 | .select(Direction.NORTH, Half.TOP, false, top)
|
| 766 | .select(Direction.SOUTH, Half.TOP, false, top.with(Y_ROT_180))
|
| 767 | .select(Direction.EAST, Half.TOP, false, top.with(Y_ROT_90))
|
| 768 | .select(Direction.WEST, Half.TOP, false, top.with(Y_ROT_270))
|
| 769 | .select(Direction.NORTH, Half.BOTTOM, true, open)
|
| 770 | .select(Direction.SOUTH, Half.BOTTOM, true, open.with(Y_ROT_180))
|
| 771 | .select(Direction.EAST, Half.BOTTOM, true, open.with(Y_ROT_90))
|
| 772 | .select(Direction.WEST, Half.BOTTOM, true, open.with(Y_ROT_270))
|
| 773 | .select(Direction.NORTH, Half.TOP, true, open.with(X_ROT_180).with(Y_ROT_180))
|
| 774 | .select(Direction.SOUTH, Half.TOP, true, open.with(X_ROT_180))
|
| 775 | .select(Direction.EAST, Half.TOP, true, open.with(X_ROT_180).with(Y_ROT_270))
|
| 776 | .select(Direction.WEST, Half.TOP, true, open.with(X_ROT_180).with(Y_ROT_90))
|
| 777 | );
|
| 778 | }
|
| 779 |
|
| 780 | /**
|
| 781 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 782 | */
|
| 783 | public static BlockModelDefinitionGenerator createTrapdoor(final Block block, final MultiVariant top, final MultiVariant bottom, final MultiVariant open) {
|
| 784 | return MultiVariantGenerator.dispatch(block)
|
| 785 | .with(
|
| 786 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.HALF, BlockStateProperties.OPEN)
|
| 787 | .select(Direction.NORTH, Half.BOTTOM, false, bottom)
|
| 788 | .select(Direction.SOUTH, Half.BOTTOM, false, bottom)
|
| 789 | .select(Direction.EAST, Half.BOTTOM, false, bottom)
|
| 790 | .select(Direction.WEST, Half.BOTTOM, false, bottom)
|
| 791 | .select(Direction.NORTH, Half.TOP, false, top)
|
| 792 | .select(Direction.SOUTH, Half.TOP, false, top)
|
| 793 | .select(Direction.EAST, Half.TOP, false, top)
|
| 794 | .select(Direction.WEST, Half.TOP, false, top)
|
| 795 | .select(Direction.NORTH, Half.BOTTOM, true, open)
|
| 796 | .select(Direction.SOUTH, Half.BOTTOM, true, open.with(Y_ROT_180))
|
| 797 | .select(Direction.EAST, Half.BOTTOM, true, open.with(Y_ROT_90))
|
| 798 | .select(Direction.WEST, Half.BOTTOM, true, open.with(Y_ROT_270))
|
| 799 | .select(Direction.NORTH, Half.TOP, true, open)
|
| 800 | .select(Direction.SOUTH, Half.TOP, true, open.with(Y_ROT_180))
|
| 801 | .select(Direction.EAST, Half.TOP, true, open.with(Y_ROT_90))
|
| 802 | .select(Direction.WEST, Half.TOP, true, open.with(Y_ROT_270))
|
| 803 | );
|
| 804 | }
|
| 805 |
|
| 806 | /**
|
| 807 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 808 | */
|
| 809 | public static BlockModelDefinitionGenerator createBed(final Block block, final MultiVariant headModel, final MultiVariant footModel) {
|
| 810 | return MultiVariantGenerator.dispatch(block)
|
| 811 | .with(
|
| 812 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.BED_PART)
|
| 813 | .select(Direction.NORTH, BedPart.HEAD, headModel)
|
| 814 | .select(Direction.SOUTH, BedPart.HEAD, headModel.with(Y_ROT_180))
|
| 815 | .select(Direction.EAST, BedPart.HEAD, headModel.with(Y_ROT_90))
|
| 816 | .select(Direction.WEST, BedPart.HEAD, headModel.with(Y_ROT_270))
|
| 817 | .select(Direction.NORTH, BedPart.FOOT, footModel)
|
| 818 | .select(Direction.SOUTH, BedPart.FOOT, footModel.with(Y_ROT_180))
|
| 819 | .select(Direction.EAST, BedPart.FOOT, footModel.with(Y_ROT_90))
|
| 820 | .select(Direction.WEST, BedPart.FOOT, footModel.with(Y_ROT_270))
|
| 821 | );
|
| 822 | }
|
| 823 |
|
| 824 | /**
|
| 825 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 826 | */
|
| 827 | public static BlockModelDefinitionGenerator createStrawBed(final Block block, final MultiVariant headModel, final MultiVariant footModel) {
|
| 828 | return MultiVariantGenerator.dispatch(block)
|
| 829 | .with(
|
| 830 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.BED_PART)
|
| 831 | .select(Direction.NORTH, BedPart.HEAD, headModel.with(Y_ROT_180))
|
| 832 | .select(Direction.SOUTH, BedPart.HEAD, headModel)
|
| 833 | .select(Direction.EAST, BedPart.HEAD, headModel.with(Y_ROT_270))
|
| 834 | .select(Direction.WEST, BedPart.HEAD, headModel.with(Y_ROT_90))
|
| 835 | .select(Direction.NORTH, BedPart.FOOT, footModel.with(Y_ROT_180))
|
| 836 | .select(Direction.SOUTH, BedPart.FOOT, footModel)
|
| 837 | .select(Direction.EAST, BedPart.FOOT, footModel.with(Y_ROT_270))
|
| 838 | .select(Direction.WEST, BedPart.FOOT, footModel.with(Y_ROT_90))
|
| 839 | );
|
| 840 | }
|
| 841 |
|
| 842 | /**
|
| 843 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 844 | */
|
| 845 | public static BlockModelDefinitionGenerator createSign(
|
| 846 | final Block block, final MultiVariant rot0, final MultiVariant rot1, final MultiVariant rot2, final MultiVariant rot3
|
| 847 | ) {
|
| 848 | return MultiVariantGenerator.dispatch(block)
|
| 849 | .with(
|
| 850 | PropertyDispatch.initial(BlockStateProperties.ROTATION_16)
|
| 851 | .select(0, rot0)
|
| 852 | .select(1, rot1)
|
| 853 | .select(2, rot2)
|
| 854 | .select(3, rot3)
|
| 855 | .select(4, rot0.with(Y_ROT_90))
|
| 856 | .select(5, rot1.with(Y_ROT_90))
|
| 857 | .select(6, rot2.with(Y_ROT_90))
|
| 858 | .select(7, rot3.with(Y_ROT_90))
|
| 859 | .select(8, rot0.with(Y_ROT_180))
|
| 860 | .select(9, rot1.with(Y_ROT_180))
|
| 861 | .select(10, rot2.with(Y_ROT_180))
|
| 862 | .select(11, rot3.with(Y_ROT_180))
|
| 863 | .select(12, rot0.with(Y_ROT_270))
|
| 864 | .select(13, rot1.with(Y_ROT_270))
|
| 865 | .select(14, rot2.with(Y_ROT_270))
|
| 866 | .select(15, rot3.with(Y_ROT_270))
|
| 867 | );
|
| 868 | }
|
| 869 |
|
| 870 | /**
|
| 871 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 872 | */
|
| 873 | public static BlockModelDefinitionGenerator createHangingSign(
|
| 874 | final Block block,
|
| 875 | final MultiVariant rot0,
|
| 876 | final MultiVariant rot1,
|
| 877 | final MultiVariant rot2,
|
| 878 | final MultiVariant rot3,
|
| 879 | final MultiVariant attachedRot0,
|
| 880 | final MultiVariant attachedRot1,
|
| 881 | final MultiVariant attachedRot2,
|
| 882 | final MultiVariant attachedRot3
|
| 883 | ) {
|
| 884 | return MultiVariantGenerator.dispatch(block)
|
| 885 | .with(
|
| 886 | PropertyDispatch.initial(BlockStateProperties.ATTACHED, BlockStateProperties.ROTATION_16)
|
| 887 | .select(false, 0, rot0)
|
| 888 | .select(false, 1, rot1)
|
| 889 | .select(false, 2, rot2)
|
| 890 | .select(false, 3, rot3)
|
| 891 | .select(false, 4, rot0.with(Y_ROT_90))
|
| 892 | .select(false, 5, rot1.with(Y_ROT_90))
|
| 893 | .select(false, 6, rot2.with(Y_ROT_90))
|
| 894 | .select(false, 7, rot3.with(Y_ROT_90))
|
| 895 | .select(false, 8, rot0.with(Y_ROT_180))
|
| 896 | .select(false, 9, rot1.with(Y_ROT_180))
|
| 897 | .select(false, 10, rot2.with(Y_ROT_180))
|
| 898 | .select(false, 11, rot3.with(Y_ROT_180))
|
| 899 | .select(false, 12, rot0.with(Y_ROT_270))
|
| 900 | .select(false, 13, rot1.with(Y_ROT_270))
|
| 901 | .select(false, 14, rot2.with(Y_ROT_270))
|
| 902 | .select(false, 15, rot3.with(Y_ROT_270))
|
| 903 | .select(true, 0, attachedRot0)
|
| 904 | .select(true, 1, attachedRot1)
|
| 905 | .select(true, 2, attachedRot2)
|
| 906 | .select(true, 3, attachedRot3)
|
| 907 | .select(true, 4, attachedRot0.with(Y_ROT_90))
|
| 908 | .select(true, 5, attachedRot1.with(Y_ROT_90))
|
| 909 | .select(true, 6, attachedRot2.with(Y_ROT_90))
|
| 910 | .select(true, 7, attachedRot3.with(Y_ROT_90))
|
| 911 | .select(true, 8, attachedRot0.with(Y_ROT_180))
|
| 912 | .select(true, 9, attachedRot1.with(Y_ROT_180))
|
| 913 | .select(true, 10, attachedRot2.with(Y_ROT_180))
|
| 914 | .select(true, 11, attachedRot3.with(Y_ROT_180))
|
| 915 | .select(true, 12, attachedRot0.with(Y_ROT_270))
|
| 916 | .select(true, 13, attachedRot1.with(Y_ROT_270))
|
| 917 | .select(true, 14, attachedRot2.with(Y_ROT_270))
|
| 918 | .select(true, 15, attachedRot3.with(Y_ROT_270))
|
| 919 | );
|
| 920 | }
|
| 921 |
|
| 922 | /**
|
| 923 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 924 | */
|
| 925 | public static MultiVariantGenerator createSimpleBlock(final Block block, final MultiVariant variant) {
|
| 926 | return MultiVariantGenerator.dispatch(block, variant);
|
| 927 | }
|
| 928 |
|
| 929 | /**
|
| 930 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 931 | */
|
| 932 | public static PropertyDispatch<VariantMutator> createRotatedPillar() {
|
| 933 | return PropertyDispatch.modify(BlockStateProperties.AXIS).select(Axis.Y, NOP).select(Axis.Z, X_ROT_90).select(Axis.X, X_ROT_90.then(Y_ROT_90));
|
| 934 | }
|
| 935 |
|
| 936 | /**
|
| 937 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 938 | */
|
| 939 | public static BlockModelDefinitionGenerator createPillarBlockUVLocked(
|
| 940 | final Block block, final TextureMapping mapping, final BiConsumer<Identifier, ModelInstance> modelOutput
|
| 941 | ) {
|
| 942 | MultiVariant xAxisModel = plainVariant(ModelTemplates.CUBE_COLUMN_UV_LOCKED_X.create(block, mapping, modelOutput));
|
| 943 | MultiVariant yAxisModel = plainVariant(ModelTemplates.CUBE_COLUMN_UV_LOCKED_Y.create(block, mapping, modelOutput));
|
| 944 | MultiVariant zAxisModel = plainVariant(ModelTemplates.CUBE_COLUMN_UV_LOCKED_Z.create(block, mapping, modelOutput));
|
| 945 | return MultiVariantGenerator.dispatch(block)
|
| 946 | .with(PropertyDispatch.initial(BlockStateProperties.AXIS).select(Axis.X, xAxisModel).select(Axis.Y, yAxisModel).select(Axis.Z, zAxisModel));
|
| 947 | }
|
| 948 |
|
| 949 | /**
|
| 950 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 951 | */
|
| 952 | public static BlockModelDefinitionGenerator createAxisAlignedPillarBlock(final Block block, final MultiVariant model) {
|
| 953 | return MultiVariantGenerator.dispatch(block, model).with(createRotatedPillar());
|
| 954 | }
|
| 955 |
|
| 956 | /**
|
| 957 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 958 | */
|
| 959 | public final void createAxisAlignedPillarBlockCustomModel(final Block block, final MultiVariant model) {
|
| 960 | this.blockStateOutput.accept(createAxisAlignedPillarBlock(block, model));
|
| 961 | }
|
| 962 |
|
| 963 | /**
|
| 964 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 965 | */
|
| 966 | public final void createAxisAlignedPillarBlock(final Block block, final TexturedModel.Provider modelProvider) {
|
| 967 | MultiVariant model = plainVariant(modelProvider.create(block, this.modelOutput));
|
| 968 | this.blockStateOutput.accept(createAxisAlignedPillarBlock(block, model));
|
| 969 | }
|
| 970 |
|
| 971 | /**
|
| 972 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 973 | */
|
| 974 | public final void createHorizontallyRotatedBlock(final Block block, final TexturedModel.Provider modelProvider) {
|
| 975 | MultiVariant model = plainVariant(modelProvider.create(block, this.modelOutput));
|
| 976 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block, model).with(ROTATION_HORIZONTAL_FACING));
|
| 977 | }
|
| 978 |
|
| 979 | /**
|
| 980 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 981 | */
|
| 982 | public static BlockModelDefinitionGenerator createRotatedPillarWithHorizontalVariant(
|
| 983 | final Block block, final MultiVariant model, final MultiVariant horizontalModel
|
| 984 | ) {
|
| 985 | return MultiVariantGenerator.dispatch(block)
|
| 986 | .with(
|
| 987 | PropertyDispatch.initial(BlockStateProperties.AXIS)
|
| 988 | .select(Axis.Y, model)
|
| 989 | .select(Axis.Z, horizontalModel.with(X_ROT_90))
|
| 990 | .select(Axis.X, horizontalModel.with(X_ROT_90).with(Y_ROT_90))
|
| 991 | );
|
| 992 | }
|
| 993 |
|
| 994 | /**
|
| 995 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 996 | */
|
| 997 | public final void createRotatedPillarWithHorizontalVariant(
|
| 998 | final Block block, final TexturedModel.Provider verticalProvider, final TexturedModel.Provider horizontalProvider
|
| 999 | ) {
|
| 1000 | MultiVariant model = plainVariant(verticalProvider.create(block, this.modelOutput));
|
| 1001 | MultiVariant horizontalModel = plainVariant(horizontalProvider.create(block, this.modelOutput));
|
| 1002 | this.blockStateOutput.accept(createRotatedPillarWithHorizontalVariant(block, model, horizontalModel));
|
| 1003 | }
|
| 1004 |
|
| 1005 | /**
|
| 1006 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1007 | */
|
| 1008 | public final void createCreakingHeart(final Block block) {
|
| 1009 | MultiVariant model = plainVariant(TexturedModel.COLUMN_ALT.create(block, this.modelOutput));
|
| 1010 | MultiVariant horizontalModel = plainVariant(TexturedModel.COLUMN_HORIZONTAL_ALT.create(block, this.modelOutput));
|
| 1011 | MultiVariant activeModel = plainVariant(this.createCreakingHeartModel(TexturedModel.COLUMN_ALT, block, "_awake"));
|
| 1012 | MultiVariant activeHorizontalModel = plainVariant(this.createCreakingHeartModel(TexturedModel.COLUMN_HORIZONTAL_ALT, block, "_awake"));
|
| 1013 | MultiVariant dormantModel = plainVariant(this.createCreakingHeartModel(TexturedModel.COLUMN_ALT, block, "_dormant"));
|
| 1014 | MultiVariant dormantHorizontalModel = plainVariant(this.createCreakingHeartModel(TexturedModel.COLUMN_HORIZONTAL_ALT, block, "_dormant"));
|
| 1015 | this.blockStateOutput
|
| 1016 | .accept(
|
| 1017 | MultiVariantGenerator.dispatch(block)
|
| 1018 | .with(
|
| 1019 | PropertyDispatch.initial(BlockStateProperties.AXIS, CreakingHeartBlock.STATE)
|
| 1020 | .select(Axis.Y, CreakingHeartState.UPROOTED, model)
|
| 1021 | .select(Axis.Z, CreakingHeartState.UPROOTED, horizontalModel.with(X_ROT_90))
|
| 1022 | .select(Axis.X, CreakingHeartState.UPROOTED, horizontalModel.with(X_ROT_90).with(Y_ROT_90))
|
| 1023 | .select(Axis.Y, CreakingHeartState.DORMANT, dormantModel)
|
| 1024 | .select(Axis.Z, CreakingHeartState.DORMANT, dormantHorizontalModel.with(X_ROT_90))
|
| 1025 | .select(Axis.X, CreakingHeartState.DORMANT, dormantHorizontalModel.with(X_ROT_90).with(Y_ROT_90))
|
| 1026 | .select(Axis.Y, CreakingHeartState.AWAKE, activeModel)
|
| 1027 | .select(Axis.Z, CreakingHeartState.AWAKE, activeHorizontalModel.with(X_ROT_90))
|
| 1028 | .select(Axis.X, CreakingHeartState.AWAKE, activeHorizontalModel.with(X_ROT_90).with(Y_ROT_90))
|
| 1029 | )
|
| 1030 | );
|
| 1031 | }
|
| 1032 |
|
| 1033 | /**
|
| 1034 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1035 | */
|
| 1036 | public final Identifier createCreakingHeartModel(final TexturedModel.Provider provider, final Block block, final String suffix) {
|
| 1037 | return provider.updateTexture(
|
| 1038 | t -> t.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, suffix)).put(TextureSlot.END, TextureMapping.getBlockTexture(block, "_top" + suffix))
|
| 1039 | )
|
| 1040 | .createWithSuffix(block, suffix, this.modelOutput);
|
| 1041 | }
|
| 1042 |
|
| 1043 | /**
|
| 1044 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1045 | */
|
| 1046 | public final Identifier createSuffixedVariant(
|
| 1047 | final Block block, final String suffix, final ModelTemplate template, final Function<Material, TextureMapping> textureMapping
|
| 1048 | ) {
|
| 1049 | return template.createWithSuffix(block, suffix, textureMapping.apply(TextureMapping.getBlockTexture(block, suffix)), this.modelOutput);
|
| 1050 | }
|
| 1051 |
|
| 1052 | /**
|
| 1053 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1054 | */
|
| 1055 | public static BlockModelDefinitionGenerator createPressurePlate(final Block block, final MultiVariant off, final MultiVariant on) {
|
| 1056 | return MultiVariantGenerator.dispatch(block).with(createBooleanModelDispatch(BlockStateProperties.POWERED, on, off));
|
| 1057 | }
|
| 1058 |
|
| 1059 | /**
|
| 1060 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1061 | */
|
| 1062 | public static BlockModelDefinitionGenerator createSlab(final Block block, final MultiVariant bottom, final MultiVariant top, final MultiVariant full) {
|
| 1063 | return MultiVariantGenerator.dispatch(block)
|
| 1064 | .with(PropertyDispatch.initial(BlockStateProperties.SLAB_TYPE).select(SlabType.BOTTOM, bottom).select(SlabType.TOP, top).select(SlabType.DOUBLE, full));
|
| 1065 | }
|
| 1066 |
|
| 1067 | /**
|
| 1068 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1069 | */
|
| 1070 | public final void createTrivialCube(final Block block) {
|
| 1071 | this.createTrivialBlock(block, TexturedModel.CUBE);
|
| 1072 | }
|
| 1073 |
|
| 1074 | /**
|
| 1075 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1076 | */
|
| 1077 | public final void createTrivialBlock(final Block block, final TexturedModel.Provider modelProvider) {
|
| 1078 | this.blockStateOutput.accept(createSimpleBlock(block, plainVariant(modelProvider.create(block, this.modelOutput))));
|
| 1079 | }
|
| 1080 |
|
| 1081 | public void createTintedLeaves(final Block block, final TexturedModel.Provider modelProvider, final int tintColor) {
|
| 1082 | Identifier blockModel = modelProvider.create(block, this.modelOutput);
|
| 1083 | this.blockStateOutput.accept(createSimpleBlock(block, plainVariant(blockModel)));
|
| 1084 | this.registerSimpleTintedItemModel(block, blockModel, ItemModelUtils.constantTint(tintColor));
|
| 1085 | }
|
| 1086 |
|
| 1087 | private void createVine() {
|
| 1088 | this.createMultifaceBlockStates(Blocks.VINE);
|
| 1089 | Identifier itemModel = this.createFlatItemModelWithBlockTexture(Items.VINE, Blocks.VINE);
|
| 1090 | this.registerSimpleTintedItemModel(Blocks.VINE, itemModel, ItemModelUtils.constantTint(-12012264));
|
| 1091 | }
|
| 1092 |
|
| 1093 | /**
|
| 1094 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1095 | */
|
| 1096 | public final void createItemWithGrassTint(final Block block) {
|
| 1097 | Identifier itemModel = this.createFlatItemModelWithBlockTexture(block.asItem(), block);
|
| 1098 | this.registerSimpleTintedItemModel(block, itemModel, new GrassColorSource());
|
| 1099 | }
|
| 1100 |
|
| 1101 | /**
|
| 1102 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1103 | */
|
| 1104 | public final BlockModelGenerators.BlockFamilyProvider family(final Block block) {
|
| 1105 | TexturedModel model = TEXTURED_MODELS.getOrDefault(block, TexturedModel.CUBE.get(block));
|
| 1106 | return new BlockModelGenerators.BlockFamilyProvider(model.getMapping()).fullBlock(block, model.getTemplate());
|
| 1107 | }
|
| 1108 |
|
| 1109 | /**
|
| 1110 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1111 | */
|
| 1112 | public final void createDoor(final Block door) {
|
| 1113 | TextureMapping mapping = TextureMapping.door(door);
|
| 1114 | MultiVariant doorBottomLeft = plainVariant(ModelTemplates.DOOR_BOTTOM_LEFT.create(door, mapping, this.modelOutput));
|
| 1115 | MultiVariant doorBottomLeftOpen = plainVariant(ModelTemplates.DOOR_BOTTOM_LEFT_OPEN.create(door, mapping, this.modelOutput));
|
| 1116 | MultiVariant doorBottomRight = plainVariant(ModelTemplates.DOOR_BOTTOM_RIGHT.create(door, mapping, this.modelOutput));
|
| 1117 | MultiVariant doorBottomRightOpen = plainVariant(ModelTemplates.DOOR_BOTTOM_RIGHT_OPEN.create(door, mapping, this.modelOutput));
|
| 1118 | MultiVariant doorTopLeft = plainVariant(ModelTemplates.DOOR_TOP_LEFT.create(door, mapping, this.modelOutput));
|
| 1119 | MultiVariant doorTopLeftOpen = plainVariant(ModelTemplates.DOOR_TOP_LEFT_OPEN.create(door, mapping, this.modelOutput));
|
| 1120 | MultiVariant doorTopRight = plainVariant(ModelTemplates.DOOR_TOP_RIGHT.create(door, mapping, this.modelOutput));
|
| 1121 | MultiVariant doorTopRightOpen = plainVariant(ModelTemplates.DOOR_TOP_RIGHT_OPEN.create(door, mapping, this.modelOutput));
|
| 1122 | this.registerSimpleFlatItemModel(door.asItem());
|
| 1123 | this.blockStateOutput
|
| 1124 | .accept(
|
| 1125 | createDoor(door, doorBottomLeft, doorBottomLeftOpen, doorBottomRight, doorBottomRightOpen, doorTopLeft, doorTopLeftOpen, doorTopRight, doorTopRightOpen)
|
| 1126 | );
|
| 1127 | }
|
| 1128 |
|
| 1129 | /**
|
| 1130 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1131 | */
|
| 1132 | public final void copyDoorModel(final Block donor, final Block acceptor) {
|
| 1133 | MultiVariant doorBottomLeft = plainVariant(ModelTemplates.DOOR_BOTTOM_LEFT.getDefaultModelLocation(donor));
|
| 1134 | MultiVariant doorBottomLeftOpen = plainVariant(ModelTemplates.DOOR_BOTTOM_LEFT_OPEN.getDefaultModelLocation(donor));
|
| 1135 | MultiVariant doorBottomRight = plainVariant(ModelTemplates.DOOR_BOTTOM_RIGHT.getDefaultModelLocation(donor));
|
| 1136 | MultiVariant doorBottomRightOpen = plainVariant(ModelTemplates.DOOR_BOTTOM_RIGHT_OPEN.getDefaultModelLocation(donor));
|
| 1137 | MultiVariant doorTopLeft = plainVariant(ModelTemplates.DOOR_TOP_LEFT.getDefaultModelLocation(donor));
|
| 1138 | MultiVariant doorTopLeftOpen = plainVariant(ModelTemplates.DOOR_TOP_LEFT_OPEN.getDefaultModelLocation(donor));
|
| 1139 | MultiVariant doorTopRight = plainVariant(ModelTemplates.DOOR_TOP_RIGHT.getDefaultModelLocation(donor));
|
| 1140 | MultiVariant doorTopRightOpen = plainVariant(ModelTemplates.DOOR_TOP_RIGHT_OPEN.getDefaultModelLocation(donor));
|
| 1141 | this.itemModelOutput.copy(donor.asItem(), acceptor.asItem());
|
| 1142 | this.blockStateOutput
|
| 1143 | .accept(
|
| 1144 | createDoor(acceptor, doorBottomLeft, doorBottomLeftOpen, doorBottomRight, doorBottomRightOpen, doorTopLeft, doorTopLeftOpen, doorTopRight, doorTopRightOpen)
|
| 1145 | );
|
| 1146 | }
|
| 1147 |
|
| 1148 | /**
|
| 1149 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1150 | */
|
| 1151 | public final void createOrientableTrapdoor(final Block trapdoor) {
|
| 1152 | TextureMapping mapping = TextureMapping.defaultTexture(trapdoor);
|
| 1153 | MultiVariant top = plainVariant(ModelTemplates.ORIENTABLE_TRAPDOOR_TOP.create(trapdoor, mapping, this.modelOutput));
|
| 1154 | Identifier bottom = ModelTemplates.ORIENTABLE_TRAPDOOR_BOTTOM.create(trapdoor, mapping, this.modelOutput);
|
| 1155 | MultiVariant open = plainVariant(ModelTemplates.ORIENTABLE_TRAPDOOR_OPEN.create(trapdoor, mapping, this.modelOutput));
|
| 1156 | this.blockStateOutput.accept(createOrientableTrapdoor(trapdoor, top, plainVariant(bottom), open));
|
| 1157 | this.registerSimpleItemModel(trapdoor, bottom);
|
| 1158 | }
|
| 1159 |
|
| 1160 | /**
|
| 1161 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1162 | */
|
| 1163 | public final void createTrapdoor(final Block trapdoor) {
|
| 1164 | TextureMapping mapping = TextureMapping.defaultTexture(trapdoor);
|
| 1165 | MultiVariant top = plainVariant(ModelTemplates.TRAPDOOR_TOP.create(trapdoor, mapping, this.modelOutput));
|
| 1166 | Identifier bottom = ModelTemplates.TRAPDOOR_BOTTOM.create(trapdoor, mapping, this.modelOutput);
|
| 1167 | MultiVariant open = plainVariant(ModelTemplates.TRAPDOOR_OPEN.create(trapdoor, mapping, this.modelOutput));
|
| 1168 | this.blockStateOutput.accept(createTrapdoor(trapdoor, top, plainVariant(bottom), open));
|
| 1169 | this.registerSimpleItemModel(trapdoor, bottom);
|
| 1170 | }
|
| 1171 |
|
| 1172 | /**
|
| 1173 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1174 | */
|
| 1175 | public final void copyTrapdoorModel(final Block donor, final Block acceptor) {
|
| 1176 | MultiVariant top = plainVariant(ModelTemplates.TRAPDOOR_TOP.getDefaultModelLocation(donor));
|
| 1177 | MultiVariant bottom = plainVariant(ModelTemplates.TRAPDOOR_BOTTOM.getDefaultModelLocation(donor));
|
| 1178 | MultiVariant open = plainVariant(ModelTemplates.TRAPDOOR_OPEN.getDefaultModelLocation(donor));
|
| 1179 | this.itemModelOutput.copy(donor.asItem(), acceptor.asItem());
|
| 1180 | this.blockStateOutput.accept(createTrapdoor(acceptor, top, bottom, open));
|
| 1181 | }
|
| 1182 |
|
| 1183 | private void createBigDripLeafBlock() {
|
| 1184 | MultiVariant noTilt = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BIG_DRIPLEAF));
|
| 1185 | MultiVariant partialTilt = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BIG_DRIPLEAF, "_partial_tilt"));
|
| 1186 | MultiVariant fullTilt = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BIG_DRIPLEAF, "_full_tilt"));
|
| 1187 | this.blockStateOutput
|
| 1188 | .accept(
|
| 1189 | MultiVariantGenerator.dispatch(Blocks.BIG_DRIPLEAF)
|
| 1190 | .with(
|
| 1191 | PropertyDispatch.initial(BlockStateProperties.TILT)
|
| 1192 | .select(Tilt.NONE, noTilt)
|
| 1193 | .select(Tilt.UNSTABLE, noTilt)
|
| 1194 | .select(Tilt.PARTIAL, partialTilt)
|
| 1195 | .select(Tilt.FULL, fullTilt)
|
| 1196 | )
|
| 1197 | .with(ROTATION_HORIZONTAL_FACING)
|
| 1198 | );
|
| 1199 | }
|
| 1200 |
|
| 1201 | /**
|
| 1202 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1203 | */
|
| 1204 | public final BlockModelGenerators.WoodProvider woodProvider(final Block log) {
|
| 1205 | return new BlockModelGenerators.WoodProvider(TextureMapping.logColumn(log));
|
| 1206 | }
|
| 1207 |
|
| 1208 | /**
|
| 1209 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1210 | */
|
| 1211 | public final void createNonTemplateModelBlock(final Block block) {
|
| 1212 | this.createNonTemplateModelBlock(block, block);
|
| 1213 | }
|
| 1214 |
|
| 1215 | /**
|
| 1216 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1217 | */
|
| 1218 | public final void createNonTemplateModelBlock(final Block block, final Block donor) {
|
| 1219 | this.blockStateOutput.accept(createSimpleBlock(block, plainVariant(ModelLocationUtils.getModelLocation(donor))));
|
| 1220 | }
|
| 1221 |
|
| 1222 | /**
|
| 1223 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1224 | */
|
| 1225 | public final void createCrossBlockWithDefaultItem(final Block block, final BlockModelGenerators.PlantType plantType) {
|
| 1226 | this.registerSimpleItemModel(block.asItem(), plantType.createItemModelUsingBlockTexture(this, block));
|
| 1227 | this.createCrossBlock(block, plantType);
|
| 1228 | }
|
| 1229 |
|
| 1230 | /**
|
| 1231 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1232 | */
|
| 1233 | public final void createCrossBlockWithDefaultItem(final Block block, final BlockModelGenerators.PlantType plantType, final TextureMapping textures) {
|
| 1234 | this.registerSimpleFlatItemModel(block);
|
| 1235 | this.createCrossBlock(block, plantType, textures);
|
| 1236 | }
|
| 1237 |
|
| 1238 | /**
|
| 1239 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1240 | */
|
| 1241 | public final void createCrossBlock(final Block block, final BlockModelGenerators.PlantType plantType) {
|
| 1242 | TextureMapping textures = plantType.getTextureMapping(block);
|
| 1243 | this.createCrossBlock(block, plantType, textures);
|
| 1244 | }
|
| 1245 |
|
| 1246 | /**
|
| 1247 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1248 | */
|
| 1249 | public final void createCrossBlock(final Block block, final BlockModelGenerators.PlantType plantType, final TextureMapping textures) {
|
| 1250 | MultiVariant model = plainVariant(plantType.getCross().create(block, textures, this.modelOutput));
|
| 1251 | this.blockStateOutput.accept(createSimpleBlock(block, model));
|
| 1252 | }
|
| 1253 |
|
| 1254 | /**
|
| 1255 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1256 | */
|
| 1257 | public final void createCrossBlock(final Block block, final BlockModelGenerators.PlantType plantType, final Property<Integer> property, final int... stages) {
|
| 1258 | if (property.getPossibleValues().size() != stages.length) {
|
| 1259 | throw new IllegalArgumentException("missing values for property: " + property);
|
| 1260 | }
|
| 1261 |
|
| 1262 | this.registerSimpleFlatItemModel(block.asItem());
|
| 1263 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(PropertyDispatch.initial(property).generate(i -> {
|
| 1264 | String suffix = "_stage" + stages[i];
|
| 1265 | TextureMapping texture = TextureMapping.cross(TextureMapping.getBlockTexture(block, suffix));
|
| 1266 | return plainVariant(plantType.getCross().createWithSuffix(block, suffix, texture, this.modelOutput));
|
| 1267 | })));
|
| 1268 | }
|
| 1269 |
|
| 1270 | /**
|
| 1271 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1272 | */
|
| 1273 | public final void createPlantWithDefaultItem(final Block standAlone, final Block potted, final BlockModelGenerators.PlantType plantType) {
|
| 1274 | this.registerSimpleItemModel(standAlone.asItem(), plantType.createItemModelUsingBlockTexture(this, standAlone));
|
| 1275 | this.createPlant(standAlone, potted, plantType);
|
| 1276 | }
|
| 1277 |
|
| 1278 | /**
|
| 1279 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1280 | */
|
| 1281 | public final void createPlant(final Block standAlone, final Block potted, final BlockModelGenerators.PlantType plantType) {
|
| 1282 | this.createCrossBlock(standAlone, plantType);
|
| 1283 | TextureMapping textures = plantType.getPlantTextureMapping(standAlone);
|
| 1284 | MultiVariant model = plainVariant(plantType.getCrossPot().create(potted, textures, this.modelOutput));
|
| 1285 | this.blockStateOutput.accept(createSimpleBlock(potted, model));
|
| 1286 | }
|
| 1287 |
|
| 1288 | /**
|
| 1289 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1290 | */
|
| 1291 | public final void createCoralFans(final Block fan, final Block wallFan) {
|
| 1292 | TexturedModel fanTemplate = TexturedModel.CORAL_FAN.get(fan);
|
| 1293 | MultiVariant fanModel = plainVariant(fanTemplate.create(fan, this.modelOutput));
|
| 1294 | this.blockStateOutput.accept(createSimpleBlock(fan, fanModel));
|
| 1295 | MultiVariant wallFanModel = plainVariant(ModelTemplates.CORAL_WALL_FAN.create(wallFan, fanTemplate.getMapping(), this.modelOutput));
|
| 1296 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(wallFan, wallFanModel).with(ROTATION_HORIZONTAL_FACING));
|
| 1297 | this.registerSimpleFlatItemModel(fan);
|
| 1298 | }
|
| 1299 |
|
| 1300 | /**
|
| 1301 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1302 | */
|
| 1303 | public final void createStems(final Block growingStem, final Block attachedStem) {
|
| 1304 | this.registerSimpleFlatItemModel(growingStem.asItem());
|
| 1305 | TextureMapping growingMapping = TextureMapping.stem(growingStem);
|
| 1306 | TextureMapping attachedMapping = TextureMapping.attachedStem(growingStem, attachedStem);
|
| 1307 | MultiVariant attachedStemModel = plainVariant(ModelTemplates.ATTACHED_STEM.create(attachedStem, attachedMapping, this.modelOutput));
|
| 1308 | this.blockStateOutput
|
| 1309 | .accept(
|
| 1310 | MultiVariantGenerator.dispatch(attachedStem, attachedStemModel)
|
| 1311 | .with(
|
| 1312 | PropertyDispatch.modify(BlockStateProperties.HORIZONTAL_FACING)
|
| 1313 | .select(Direction.WEST, NOP)
|
| 1314 | .select(Direction.SOUTH, Y_ROT_270)
|
| 1315 | .select(Direction.NORTH, Y_ROT_90)
|
| 1316 | .select(Direction.EAST, Y_ROT_180)
|
| 1317 | )
|
| 1318 | );
|
| 1319 | this.blockStateOutput
|
| 1320 | .accept(
|
| 1321 | MultiVariantGenerator.dispatch(growingStem)
|
| 1322 | .with(
|
| 1323 | PropertyDispatch.initial(BlockStateProperties.AGE_7)
|
| 1324 | .generate(i -> plainVariant(ModelTemplates.STEMS[i].create(growingStem, growingMapping, this.modelOutput)))
|
| 1325 | )
|
| 1326 | );
|
| 1327 | }
|
| 1328 |
|
| 1329 | private void createPitcherPlant() {
|
| 1330 | Block block = Blocks.PITCHER_PLANT;
|
| 1331 | this.registerSimpleFlatItemModel(block.asItem());
|
| 1332 | MultiVariant topModel = plainVariant(ModelLocationUtils.getModelLocation(block, "_top"));
|
| 1333 | MultiVariant bottomModel = plainVariant(ModelLocationUtils.getModelLocation(block, "_bottom"));
|
| 1334 | this.createDoubleBlock(block, topModel, bottomModel);
|
| 1335 | }
|
| 1336 |
|
| 1337 | private void createPitcherCrop() {
|
| 1338 | Block block = Blocks.PITCHER_CROP;
|
| 1339 | this.registerSimpleFlatItemModel(block.asItem());
|
| 1340 | this.blockStateOutput
|
| 1341 | .accept(
|
| 1342 | MultiVariantGenerator.dispatch(block)
|
| 1343 | .with(PropertyDispatch.initial(PitcherCropBlock.AGE, BlockStateProperties.DOUBLE_BLOCK_HALF).generate((age, shape) -> {
|
| 1344 | return switch (shape) {
|
| 1345 | case UPPER -> plainVariant(ModelLocationUtils.getModelLocation(block, "_top_stage_" + age));
|
| 1346 | case LOWER -> plainVariant(ModelLocationUtils.getModelLocation(block, "_bottom_stage_" + age));
|
| 1347 | };
|
| 1348 | }))
|
| 1349 | );
|
| 1350 | }
|
| 1351 |
|
| 1352 | /**
|
| 1353 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1354 | */
|
| 1355 | public final void createCoral(
|
| 1356 | final Block plant,
|
| 1357 | final Block deadPlant,
|
| 1358 | final Block block,
|
| 1359 | final Block deadBlock,
|
| 1360 | final Block fan,
|
| 1361 | final Block deadFan,
|
| 1362 | final Block wallFan,
|
| 1363 | final Block deadWallFan
|
| 1364 | ) {
|
| 1365 | this.createCrossBlockWithDefaultItem(plant, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 1366 | this.createCrossBlockWithDefaultItem(deadPlant, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 1367 | this.createTrivialCube(block);
|
| 1368 | this.createTrivialCube(deadBlock);
|
| 1369 | this.createCoralFans(fan, wallFan);
|
| 1370 | this.createCoralFans(deadFan, deadWallFan);
|
| 1371 | }
|
| 1372 |
|
| 1373 | /**
|
| 1374 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1375 | */
|
| 1376 | public final void createDoublePlant(final Block block, final BlockModelGenerators.PlantType plantType) {
|
| 1377 | MultiVariant topModel = plainVariant(this.createSuffixedVariant(block, "_top", plantType.getCross(), TextureMapping::cross));
|
| 1378 | MultiVariant bottomModel = plainVariant(this.createSuffixedVariant(block, "_bottom", plantType.getCross(), TextureMapping::cross));
|
| 1379 | this.createDoubleBlock(block, topModel, bottomModel);
|
| 1380 | }
|
| 1381 |
|
| 1382 | /**
|
| 1383 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1384 | */
|
| 1385 | public final void createDoublePlantWithDefaultItem(final Block block, final BlockModelGenerators.PlantType plantType) {
|
| 1386 | this.registerSimpleFlatItemModel(block, "_top");
|
| 1387 | this.createDoublePlant(block, plantType);
|
| 1388 | }
|
| 1389 |
|
| 1390 | /**
|
| 1391 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1392 | */
|
| 1393 | public final void createTintedDoublePlant(final Block block) {
|
| 1394 | Identifier itemModel = this.createFlatItemModelWithBlockTexture(block.asItem(), block, "_top");
|
| 1395 | this.registerSimpleTintedItemModel(block, itemModel, new GrassColorSource());
|
| 1396 | this.createDoublePlant(block, BlockModelGenerators.PlantType.TINTED);
|
| 1397 | }
|
| 1398 |
|
| 1399 | private void createSunflower() {
|
| 1400 | this.registerSimpleFlatItemModel(Blocks.SUNFLOWER, "_front");
|
| 1401 | MultiVariant topModel = plainVariant(ModelLocationUtils.getModelLocation(Blocks.SUNFLOWER, "_top"));
|
| 1402 | MultiVariant bottomModel = plainVariant(
|
| 1403 | this.createSuffixedVariant(Blocks.SUNFLOWER, "_bottom", BlockModelGenerators.PlantType.NOT_TINTED.getCross(), TextureMapping::cross)
|
| 1404 | );
|
| 1405 | this.createDoubleBlock(Blocks.SUNFLOWER, topModel, bottomModel);
|
| 1406 | }
|
| 1407 |
|
| 1408 | private void createTallSeagrass() {
|
| 1409 | MultiVariant topModel = plainVariant(this.createSuffixedVariant(Blocks.TALL_SEAGRASS, "_top", ModelTemplates.SEAGRASS, TextureMapping::defaultTexture));
|
| 1410 | MultiVariant bottomModel = plainVariant(this.createSuffixedVariant(Blocks.TALL_SEAGRASS, "_bottom", ModelTemplates.SEAGRASS, TextureMapping::defaultTexture));
|
| 1411 | this.createDoubleBlock(Blocks.TALL_SEAGRASS, topModel, bottomModel);
|
| 1412 | }
|
| 1413 |
|
| 1414 | private void createSmallDripleaf() {
|
| 1415 | MultiVariant topModel = plainVariant(ModelLocationUtils.getModelLocation(Blocks.SMALL_DRIPLEAF, "_top"));
|
| 1416 | MultiVariant bottomModel = plainVariant(ModelLocationUtils.getModelLocation(Blocks.SMALL_DRIPLEAF, "_bottom"));
|
| 1417 | this.blockStateOutput
|
| 1418 | .accept(
|
| 1419 | MultiVariantGenerator.dispatch(Blocks.SMALL_DRIPLEAF)
|
| 1420 | .with(PropertyDispatch.initial(BlockStateProperties.DOUBLE_BLOCK_HALF).select(DoubleBlockHalf.LOWER, bottomModel).select(DoubleBlockHalf.UPPER, topModel))
|
| 1421 | .with(ROTATION_HORIZONTAL_FACING)
|
| 1422 | );
|
| 1423 | }
|
| 1424 |
|
| 1425 | /**
|
| 1426 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1427 | */
|
| 1428 | public final void createDoubleBlock(final Block block, final MultiVariant topModel, final MultiVariant bottomModel) {
|
| 1429 | this.blockStateOutput
|
| 1430 | .accept(
|
| 1431 | MultiVariantGenerator.dispatch(block)
|
| 1432 | .with(PropertyDispatch.initial(BlockStateProperties.DOUBLE_BLOCK_HALF).select(DoubleBlockHalf.LOWER, bottomModel).select(DoubleBlockHalf.UPPER, topModel))
|
| 1433 | );
|
| 1434 | }
|
| 1435 |
|
| 1436 | /**
|
| 1437 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1438 | */
|
| 1439 | public final void createPassiveRail(final Block block) {
|
| 1440 | TextureMapping texture = TextureMapping.rail(block);
|
| 1441 | TextureMapping cornerTexture = TextureMapping.rail(TextureMapping.getBlockTexture(block, "_corner"));
|
| 1442 | MultiVariant flat = plainVariant(ModelTemplates.RAIL_FLAT.create(block, texture, this.modelOutput));
|
| 1443 | MultiVariant curved = plainVariant(ModelTemplates.RAIL_CURVED.create(block, cornerTexture, this.modelOutput));
|
| 1444 | MultiVariant risingNE = plainVariant(ModelTemplates.RAIL_RAISED_NE.create(block, texture, this.modelOutput));
|
| 1445 | MultiVariant risingSW = plainVariant(ModelTemplates.RAIL_RAISED_SW.create(block, texture, this.modelOutput));
|
| 1446 | this.registerSimpleFlatItemModel(block);
|
| 1447 | this.blockStateOutput
|
| 1448 | .accept(
|
| 1449 | MultiVariantGenerator.dispatch(block)
|
| 1450 | .with(
|
| 1451 | PropertyDispatch.initial(BlockStateProperties.RAIL_SHAPE)
|
| 1452 | .select(RailShape.NORTH_SOUTH, flat)
|
| 1453 | .select(RailShape.EAST_WEST, flat.with(Y_ROT_90))
|
| 1454 | .select(RailShape.ASCENDING_EAST, risingNE.with(Y_ROT_90))
|
| 1455 | .select(RailShape.ASCENDING_WEST, risingSW.with(Y_ROT_90))
|
| 1456 | .select(RailShape.ASCENDING_NORTH, risingNE)
|
| 1457 | .select(RailShape.ASCENDING_SOUTH, risingSW)
|
| 1458 | .select(RailShape.SOUTH_EAST, curved)
|
| 1459 | .select(RailShape.SOUTH_WEST, curved.with(Y_ROT_90))
|
| 1460 | .select(RailShape.NORTH_WEST, curved.with(Y_ROT_180))
|
| 1461 | .select(RailShape.NORTH_EAST, curved.with(Y_ROT_270))
|
| 1462 | )
|
| 1463 | );
|
| 1464 | }
|
| 1465 |
|
| 1466 | /**
|
| 1467 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1468 | */
|
| 1469 | public final void createActiveRail(final Block block) {
|
| 1470 | MultiVariant flat = plainVariant(this.createSuffixedVariant(block, "", ModelTemplates.RAIL_FLAT, TextureMapping::rail));
|
| 1471 | MultiVariant risingNE = plainVariant(this.createSuffixedVariant(block, "", ModelTemplates.RAIL_RAISED_NE, TextureMapping::rail));
|
| 1472 | MultiVariant risingSW = plainVariant(this.createSuffixedVariant(block, "", ModelTemplates.RAIL_RAISED_SW, TextureMapping::rail));
|
| 1473 | MultiVariant flatOn = plainVariant(this.createSuffixedVariant(block, "_on", ModelTemplates.RAIL_FLAT, TextureMapping::rail));
|
| 1474 | MultiVariant risingNEOn = plainVariant(this.createSuffixedVariant(block, "_on", ModelTemplates.RAIL_RAISED_NE, TextureMapping::rail));
|
| 1475 | MultiVariant risingSWOn = plainVariant(this.createSuffixedVariant(block, "_on", ModelTemplates.RAIL_RAISED_SW, TextureMapping::rail));
|
| 1476 | this.registerSimpleFlatItemModel(block);
|
| 1477 | this.blockStateOutput
|
| 1478 | .accept(
|
| 1479 | MultiVariantGenerator.dispatch(block)
|
| 1480 | .with(PropertyDispatch.initial(BlockStateProperties.POWERED, BlockStateProperties.RAIL_SHAPE_STRAIGHT).generate((powered, railShape) -> {
|
| 1481 | return switch (railShape) {
|
| 1482 | case NORTH_SOUTH -> powered ? flatOn : flat;
|
| 1483 | case EAST_WEST -> (powered ? flatOn : flat).with(Y_ROT_90);
|
| 1484 | case ASCENDING_EAST -> (powered ? risingNEOn : risingNE).with(Y_ROT_90);
|
| 1485 | case ASCENDING_WEST -> (powered ? risingSWOn : risingSW).with(Y_ROT_90);
|
| 1486 | case ASCENDING_NORTH -> powered ? risingNEOn : risingNE;
|
| 1487 | case ASCENDING_SOUTH -> powered ? risingSWOn : risingSW;
|
| 1488 | default -> throw new UnsupportedOperationException("Fix you generator!");
|
| 1489 | };
|
| 1490 | }))
|
| 1491 | );
|
| 1492 | }
|
| 1493 |
|
| 1494 | /**
|
| 1495 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1496 | */
|
| 1497 | public final void createAirLikeBlock(final Block block, final Item particleItem) {
|
| 1498 | MultiVariant dummyModel = plainVariant(ModelTemplates.PARTICLE_ONLY.create(block, TextureMapping.particleFromItem(particleItem), this.modelOutput));
|
| 1499 | this.blockStateOutput.accept(createSimpleBlock(block, dummyModel));
|
| 1500 | }
|
| 1501 |
|
| 1502 | /**
|
| 1503 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1504 | */
|
| 1505 | public final void createAirLikeBlock(final Block block, final Material particle) {
|
| 1506 | MultiVariant dummyModel = plainVariant(ModelTemplates.PARTICLE_ONLY.create(block, TextureMapping.particle(particle), this.modelOutput));
|
| 1507 | this.blockStateOutput.accept(createSimpleBlock(block, dummyModel));
|
| 1508 | }
|
| 1509 |
|
| 1510 | /**
|
| 1511 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1512 | */
|
| 1513 | public final MultiVariant createParticleOnlyBlockModel(final Block block, final Block particleDonor) {
|
| 1514 | return plainVariant(ModelTemplates.PARTICLE_ONLY.create(block, TextureMapping.particle(particleDonor), this.modelOutput));
|
| 1515 | }
|
| 1516 |
|
| 1517 | public void createParticleOnlyBlock(final Block block, final Block particleDonor) {
|
| 1518 | this.blockStateOutput.accept(createSimpleBlock(block, this.createParticleOnlyBlockModel(block, particleDonor)));
|
| 1519 | }
|
| 1520 |
|
| 1521 | /**
|
| 1522 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1523 | */
|
| 1524 | public final void createParticleOnlyBlock(final Block block) {
|
| 1525 | this.createParticleOnlyBlock(block, block);
|
| 1526 | }
|
| 1527 |
|
| 1528 | /**
|
| 1529 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1530 | */
|
| 1531 | public final void createFullAndCarpetBlocks(final Block block, final Block carpet) {
|
| 1532 | this.createTrivialCube(block);
|
| 1533 | MultiVariant model = plainVariant(TexturedModel.CARPET.get(block).create(carpet, this.modelOutput));
|
| 1534 | this.blockStateOutput.accept(createSimpleBlock(carpet, model));
|
| 1535 | }
|
| 1536 |
|
| 1537 | /**
|
| 1538 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1539 | */
|
| 1540 | public final void createLeafLitter(final Block block) {
|
| 1541 | MultiVariant model1 = plainVariant(TexturedModel.LEAF_LITTER_1.create(block, this.modelOutput));
|
| 1542 | MultiVariant model2 = plainVariant(TexturedModel.LEAF_LITTER_2.create(block, this.modelOutput));
|
| 1543 | MultiVariant model3 = plainVariant(TexturedModel.LEAF_LITTER_3.create(block, this.modelOutput));
|
| 1544 | MultiVariant model4 = plainVariant(TexturedModel.LEAF_LITTER_4.create(block, this.modelOutput));
|
| 1545 | this.registerSimpleFlatItemModel(block.asItem());
|
| 1546 | this.createSegmentedBlock(
|
| 1547 | block,
|
| 1548 | model1,
|
| 1549 | LEAF_LITTER_MODEL_1_SEGMENT_CONDITION,
|
| 1550 | model2,
|
| 1551 | LEAF_LITTER_MODEL_2_SEGMENT_CONDITION,
|
| 1552 | model3,
|
| 1553 | LEAF_LITTER_MODEL_3_SEGMENT_CONDITION,
|
| 1554 | model4,
|
| 1555 | LEAF_LITTER_MODEL_4_SEGMENT_CONDITION
|
| 1556 | );
|
| 1557 | }
|
| 1558 |
|
| 1559 | /**
|
| 1560 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1561 | */
|
| 1562 | public final void createFlowerBed(final Block flowerbed) {
|
| 1563 | MultiVariant model1 = plainVariant(TexturedModel.FLOWERBED_1.create(flowerbed, this.modelOutput));
|
| 1564 | MultiVariant model2 = plainVariant(TexturedModel.FLOWERBED_2.create(flowerbed, this.modelOutput));
|
| 1565 | MultiVariant model3 = plainVariant(TexturedModel.FLOWERBED_3.create(flowerbed, this.modelOutput));
|
| 1566 | MultiVariant model4 = plainVariant(TexturedModel.FLOWERBED_4.create(flowerbed, this.modelOutput));
|
| 1567 | this.registerSimpleFlatItemModel(flowerbed.asItem());
|
| 1568 | this.createSegmentedBlock(
|
| 1569 | flowerbed,
|
| 1570 | model1,
|
| 1571 | FLOWER_BED_MODEL_1_SEGMENT_CONDITION,
|
| 1572 | model2,
|
| 1573 | FLOWER_BED_MODEL_2_SEGMENT_CONDITION,
|
| 1574 | model3,
|
| 1575 | FLOWER_BED_MODEL_3_SEGMENT_CONDITION,
|
| 1576 | model4,
|
| 1577 | FLOWER_BED_MODEL_4_SEGMENT_CONDITION
|
| 1578 | );
|
| 1579 | }
|
| 1580 |
|
| 1581 | /**
|
| 1582 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1583 | */
|
| 1584 | public final void createSegmentedBlock(
|
| 1585 | final Block segmentedProperty,
|
| 1586 | final MultiVariant model1,
|
| 1587 | final Function<ConditionBuilder, ConditionBuilder> model1SegmentCondition,
|
| 1588 | final MultiVariant model2,
|
| 1589 | final Function<ConditionBuilder, ConditionBuilder> model2SegmentCondition,
|
| 1590 | final MultiVariant model3,
|
| 1591 | final Function<ConditionBuilder, ConditionBuilder> model3SegmentCondition,
|
| 1592 | final MultiVariant model4,
|
| 1593 | final Function<ConditionBuilder, ConditionBuilder> model4SegmentCondition
|
| 1594 | ) {
|
| 1595 | this.blockStateOutput
|
| 1596 | .accept(
|
| 1597 | MultiPartGenerator.multiPart(segmentedProperty)
|
| 1598 | .with(model1SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH)), model1)
|
| 1599 | .with(model1SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST)), model1.with(Y_ROT_90))
|
| 1600 | .with(model1SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH)), model1.with(Y_ROT_180))
|
| 1601 | .with(model1SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST)), model1.with(Y_ROT_270))
|
| 1602 | .with(model2SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH)), model2)
|
| 1603 | .with(model2SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST)), model2.with(Y_ROT_90))
|
| 1604 | .with(model2SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH)), model2.with(Y_ROT_180))
|
| 1605 | .with(model2SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST)), model2.with(Y_ROT_270))
|
| 1606 | .with(model3SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH)), model3)
|
| 1607 | .with(model3SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST)), model3.with(Y_ROT_90))
|
| 1608 | .with(model3SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH)), model3.with(Y_ROT_180))
|
| 1609 | .with(model3SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST)), model3.with(Y_ROT_270))
|
| 1610 | .with(model4SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH)), model4)
|
| 1611 | .with(model4SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.EAST)), model4.with(Y_ROT_90))
|
| 1612 | .with(model4SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH)), model4.with(Y_ROT_180))
|
| 1613 | .with(model4SegmentCondition.apply(condition().term(BlockStateProperties.HORIZONTAL_FACING, Direction.WEST)), model4.with(Y_ROT_270))
|
| 1614 | );
|
| 1615 | }
|
| 1616 |
|
| 1617 | /**
|
| 1618 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1619 | */
|
| 1620 | public final void createColoredBlockWithRandomRotations(final TexturedModel.Provider modelProvider, final List<Block> blocks) {
|
| 1621 | for (Block block : blocks) {
|
| 1622 | this.createRotatedVariantBlock(block, modelProvider);
|
| 1623 | }
|
| 1624 | }
|
| 1625 |
|
| 1626 | /**
|
| 1627 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1628 | */
|
| 1629 | public final void createColoredBlockWithStateRotations(final TexturedModel.Provider modelProvider, final List<Block> blocks) {
|
| 1630 | for (Block block : blocks) {
|
| 1631 | MultiVariant model = plainVariant(modelProvider.create(block, this.modelOutput));
|
| 1632 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block, model).with(ROTATION_HORIZONTAL_FACING_ALT));
|
| 1633 | }
|
| 1634 | }
|
| 1635 |
|
| 1636 | /**
|
| 1637 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1638 | */
|
| 1639 | public final void createGlassBlocks(final Block block, final Block pane) {
|
| 1640 | this.createTrivialBlock(block, TexturedModel.CUBE.updateTexture(mapping -> mapping.forceAllTranslucent()));
|
| 1641 | TextureMapping paneMapping = TextureMapping.pane(block, pane).forceAllTranslucent();
|
| 1642 | MultiVariant post = plainVariant(ModelTemplates.STAINED_GLASS_PANE_POST.create(pane, paneMapping, this.modelOutput));
|
| 1643 | MultiVariant side = plainVariant(ModelTemplates.STAINED_GLASS_PANE_SIDE.create(pane, paneMapping, this.modelOutput));
|
| 1644 | MultiVariant sideAlt = plainVariant(ModelTemplates.STAINED_GLASS_PANE_SIDE_ALT.create(pane, paneMapping, this.modelOutput));
|
| 1645 | MultiVariant noSide = plainVariant(ModelTemplates.STAINED_GLASS_PANE_NOSIDE.create(pane, paneMapping, this.modelOutput));
|
| 1646 | MultiVariant noSideAlt = plainVariant(ModelTemplates.STAINED_GLASS_PANE_NOSIDE_ALT.create(pane, paneMapping, this.modelOutput));
|
| 1647 | Item paneItem = pane.asItem();
|
| 1648 | this.registerSimpleItemModel(paneItem, this.createFlatItemModelWithBlockTexture(paneItem, block));
|
| 1649 | this.blockStateOutput
|
| 1650 | .accept(
|
| 1651 | MultiPartGenerator.multiPart(pane)
|
| 1652 | .with(post)
|
| 1653 | .with(condition().term(BlockStateProperties.NORTH, true), side)
|
| 1654 | .with(condition().term(BlockStateProperties.EAST, true), side.with(Y_ROT_90))
|
| 1655 | .with(condition().term(BlockStateProperties.SOUTH, true), sideAlt)
|
| 1656 | .with(condition().term(BlockStateProperties.WEST, true), sideAlt.with(Y_ROT_90))
|
| 1657 | .with(condition().term(BlockStateProperties.NORTH, false), noSide)
|
| 1658 | .with(condition().term(BlockStateProperties.EAST, false), noSideAlt)
|
| 1659 | .with(condition().term(BlockStateProperties.SOUTH, false), noSideAlt.with(Y_ROT_90))
|
| 1660 | .with(condition().term(BlockStateProperties.WEST, false), noSide.with(Y_ROT_270))
|
| 1661 | );
|
| 1662 | }
|
| 1663 |
|
| 1664 | /**
|
| 1665 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1666 | */
|
| 1667 | public final void createCommandBlock(final Block block) {
|
| 1668 | TextureMapping normalTextures = TextureMapping.commandBlock(block);
|
| 1669 | MultiVariant normalModel = plainVariant(ModelTemplates.COMMAND_BLOCK.create(block, normalTextures, this.modelOutput));
|
| 1670 | MultiVariant conditionalModel = plainVariant(
|
| 1671 | this.createSuffixedVariant(block, "_conditional", ModelTemplates.COMMAND_BLOCK, id -> normalTextures.copyAndUpdate(TextureSlot.SIDE, id))
|
| 1672 | );
|
| 1673 | this.blockStateOutput
|
| 1674 | .accept(
|
| 1675 | MultiVariantGenerator.dispatch(block)
|
| 1676 | .with(createBooleanModelDispatch(BlockStateProperties.CONDITIONAL, conditionalModel, normalModel))
|
| 1677 | .with(ROTATION_FACING)
|
| 1678 | );
|
| 1679 | }
|
| 1680 |
|
| 1681 | /**
|
| 1682 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1683 | */
|
| 1684 | public final void createAnvil(final Block block) {
|
| 1685 | MultiVariant anvilModel = plainVariant(TexturedModel.ANVIL.create(block, this.modelOutput));
|
| 1686 | this.blockStateOutput.accept(createSimpleBlock(block, anvilModel).with(ROTATION_HORIZONTAL_FACING_ALT));
|
| 1687 | }
|
| 1688 |
|
| 1689 | /**
|
| 1690 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1691 | */
|
| 1692 | public static MultiVariant createBambooModels(final int age) {
|
| 1693 | String ageSuffix = "_age" + age;
|
| 1694 | return new MultiVariant(
|
| 1695 | WeightedList.of(
|
| 1696 | IntStream.range(1, 5)
|
| 1697 | .mapToObj(i -> new Weighted<>(plainModel(ModelLocationUtils.getModelLocation(Blocks.BAMBOO, i + ageSuffix)), 1))
|
| 1698 | .collect(Collectors.toList())
|
| 1699 | )
|
| 1700 | );
|
| 1701 | }
|
| 1702 |
|
| 1703 | private void createBamboo() {
|
| 1704 | this.blockStateOutput
|
| 1705 | .accept(
|
| 1706 | MultiPartGenerator.multiPart(Blocks.BAMBOO)
|
| 1707 | .with(condition().term(BlockStateProperties.AGE_1, 0), createBambooModels(0))
|
| 1708 | .with(condition().term(BlockStateProperties.AGE_1, 1), createBambooModels(1))
|
| 1709 | .with(
|
| 1710 | condition().term(BlockStateProperties.BAMBOO_LEAVES, BambooLeaves.SMALL),
|
| 1711 | plainVariant(ModelLocationUtils.getModelLocation(Blocks.BAMBOO, "_small_leaves"))
|
| 1712 | )
|
| 1713 | .with(
|
| 1714 | condition().term(BlockStateProperties.BAMBOO_LEAVES, BambooLeaves.LARGE),
|
| 1715 | plainVariant(ModelLocationUtils.getModelLocation(Blocks.BAMBOO, "_large_leaves"))
|
| 1716 | )
|
| 1717 | );
|
| 1718 | }
|
| 1719 |
|
| 1720 | private void createBarrel() {
|
| 1721 | Material openTop = TextureMapping.getBlockTexture(Blocks.BARREL, "_top_open");
|
| 1722 | MultiVariant closedModel = plainVariant(TexturedModel.CUBE_BOTTOM_TOP.create(Blocks.BARREL, this.modelOutput));
|
| 1723 | MultiVariant openModel = plainVariant(
|
| 1724 | TexturedModel.CUBE_BOTTOM_TOP
|
| 1725 | .get(Blocks.BARREL)
|
| 1726 | .updateTextures(t -> t.put(TextureSlot.TOP, openTop))
|
| 1727 | .createWithSuffix(Blocks.BARREL, "_open", this.modelOutput)
|
| 1728 | );
|
| 1729 | this.blockStateOutput
|
| 1730 | .accept(
|
| 1731 | MultiVariantGenerator.dispatch(Blocks.BARREL)
|
| 1732 | .with(PropertyDispatch.initial(BlockStateProperties.OPEN).select(false, closedModel).select(true, openModel))
|
| 1733 | .with(ROTATIONS_COLUMN_WITH_FACING)
|
| 1734 | );
|
| 1735 | }
|
| 1736 |
|
| 1737 | /**
|
| 1738 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1739 | */
|
| 1740 | public static <T extends Comparable<T>> PropertyDispatch<MultiVariant> createEmptyOrFullDispatch(
|
| 1741 | final Property<T> property, final T threshold, final MultiVariant fullModel, final MultiVariant emptyModel
|
| 1742 | ) {
|
| 1743 | return PropertyDispatch.initial(property).generate(value -> {
|
| 1744 | boolean isFull = value.compareTo(threshold) >= 0;
|
| 1745 | return isFull ? fullModel : emptyModel;
|
| 1746 | });
|
| 1747 | }
|
| 1748 |
|
| 1749 | /**
|
| 1750 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1751 | */
|
| 1752 | public final void createBeeNest(final Block block, final Function<Block, TextureMapping> mappingFunction) {
|
| 1753 | TextureMapping emptyMapping = mappingFunction.apply(block).copyForced(TextureSlot.SIDE, TextureSlot.PARTICLE);
|
| 1754 | TextureMapping fullMapping = emptyMapping.copyAndUpdate(TextureSlot.FRONT, TextureMapping.getBlockTexture(block, "_front_honey"));
|
| 1755 | Identifier emptyModel = ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.createWithSuffix(block, "_empty", emptyMapping, this.modelOutput);
|
| 1756 | Identifier fullModel = ModelTemplates.CUBE_ORIENTABLE_TOP_BOTTOM.createWithSuffix(block, "_honey", fullMapping, this.modelOutput);
|
| 1757 | this.itemModelOutput
|
| 1758 | .accept(
|
| 1759 | block.asItem(),
|
| 1760 | ItemModelUtils.selectBlockItemProperty(BeehiveBlock.HONEY_LEVEL, ItemModelUtils.plainModel(emptyModel), Map.of(5, ItemModelUtils.plainModel(fullModel)))
|
| 1761 | );
|
| 1762 | this.blockStateOutput
|
| 1763 | .accept(
|
| 1764 | MultiVariantGenerator.dispatch(block)
|
| 1765 | .with(createEmptyOrFullDispatch(BeehiveBlock.HONEY_LEVEL, 5, plainVariant(fullModel), plainVariant(emptyModel)))
|
| 1766 | .with(ROTATION_HORIZONTAL_FACING)
|
| 1767 | );
|
| 1768 | }
|
| 1769 |
|
| 1770 | /**
|
| 1771 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1772 | */
|
| 1773 | public final void createCropBlock(final Block block, final Property<Integer> property, final int... stages) {
|
| 1774 | this.registerSimpleFlatItemModel(block.asItem());
|
| 1775 | if (property.getPossibleValues().size() != stages.length) {
|
| 1776 | throw new IllegalArgumentException();
|
| 1777 | }
|
| 1778 |
|
| 1779 | Int2ObjectMap<Identifier> models = new Int2ObjectOpenHashMap<>();
|
| 1780 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(PropertyDispatch.initial(property).generate(i -> {
|
| 1781 | int stage = stages[i];
|
| 1782 | return plainVariant(models.computeIfAbsent(stage, s -> this.createSuffixedVariant(block, "_stage" + s, ModelTemplates.CROP, TextureMapping::crop)));
|
| 1783 | })));
|
| 1784 | }
|
| 1785 |
|
| 1786 | private void createBell() {
|
| 1787 | MultiVariant floor = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BELL, "_floor"));
|
| 1788 | MultiVariant ceiling = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BELL, "_ceiling"));
|
| 1789 | MultiVariant wall = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BELL, "_wall"));
|
| 1790 | MultiVariant betweenWalls = plainVariant(ModelLocationUtils.getModelLocation(Blocks.BELL, "_between_walls"));
|
| 1791 | this.registerSimpleFlatItemModel(Items.BELL);
|
| 1792 | this.blockStateOutput
|
| 1793 | .accept(
|
| 1794 | MultiVariantGenerator.dispatch(Blocks.BELL)
|
| 1795 | .with(
|
| 1796 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.BELL_ATTACHMENT)
|
| 1797 | .select(Direction.NORTH, BellAttachType.FLOOR, floor)
|
| 1798 | .select(Direction.SOUTH, BellAttachType.FLOOR, floor.with(Y_ROT_180))
|
| 1799 | .select(Direction.EAST, BellAttachType.FLOOR, floor.with(Y_ROT_90))
|
| 1800 | .select(Direction.WEST, BellAttachType.FLOOR, floor.with(Y_ROT_270))
|
| 1801 | .select(Direction.NORTH, BellAttachType.CEILING, ceiling)
|
| 1802 | .select(Direction.SOUTH, BellAttachType.CEILING, ceiling.with(Y_ROT_180))
|
| 1803 | .select(Direction.EAST, BellAttachType.CEILING, ceiling.with(Y_ROT_90))
|
| 1804 | .select(Direction.WEST, BellAttachType.CEILING, ceiling.with(Y_ROT_270))
|
| 1805 | .select(Direction.NORTH, BellAttachType.SINGLE_WALL, wall.with(Y_ROT_270))
|
| 1806 | .select(Direction.SOUTH, BellAttachType.SINGLE_WALL, wall.with(Y_ROT_90))
|
| 1807 | .select(Direction.EAST, BellAttachType.SINGLE_WALL, wall)
|
| 1808 | .select(Direction.WEST, BellAttachType.SINGLE_WALL, wall.with(Y_ROT_180))
|
| 1809 | .select(Direction.SOUTH, BellAttachType.DOUBLE_WALL, betweenWalls.with(Y_ROT_90))
|
| 1810 | .select(Direction.NORTH, BellAttachType.DOUBLE_WALL, betweenWalls.with(Y_ROT_270))
|
| 1811 | .select(Direction.EAST, BellAttachType.DOUBLE_WALL, betweenWalls)
|
| 1812 | .select(Direction.WEST, BellAttachType.DOUBLE_WALL, betweenWalls.with(Y_ROT_180))
|
| 1813 | )
|
| 1814 | );
|
| 1815 | }
|
| 1816 |
|
| 1817 | private void createGrindstone() {
|
| 1818 | this.blockStateOutput
|
| 1819 | .accept(
|
| 1820 | MultiVariantGenerator.dispatch(Blocks.GRINDSTONE, plainVariant(ModelLocationUtils.getModelLocation(Blocks.GRINDSTONE)))
|
| 1821 | .with(
|
| 1822 | PropertyDispatch.modify(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING)
|
| 1823 | .select(AttachFace.FLOOR, Direction.NORTH, NOP)
|
| 1824 | .select(AttachFace.FLOOR, Direction.EAST, Y_ROT_90)
|
| 1825 | .select(AttachFace.FLOOR, Direction.SOUTH, Y_ROT_180)
|
| 1826 | .select(AttachFace.FLOOR, Direction.WEST, Y_ROT_270)
|
| 1827 | .select(AttachFace.WALL, Direction.NORTH, X_ROT_90)
|
| 1828 | .select(AttachFace.WALL, Direction.EAST, X_ROT_90.then(Y_ROT_90))
|
| 1829 | .select(AttachFace.WALL, Direction.SOUTH, X_ROT_90.then(Y_ROT_180))
|
| 1830 | .select(AttachFace.WALL, Direction.WEST, X_ROT_90.then(Y_ROT_270))
|
| 1831 | .select(AttachFace.CEILING, Direction.SOUTH, X_ROT_180)
|
| 1832 | .select(AttachFace.CEILING, Direction.WEST, X_ROT_180.then(Y_ROT_90))
|
| 1833 | .select(AttachFace.CEILING, Direction.NORTH, X_ROT_180.then(Y_ROT_180))
|
| 1834 | .select(AttachFace.CEILING, Direction.EAST, X_ROT_180.then(Y_ROT_270))
|
| 1835 | )
|
| 1836 | );
|
| 1837 | }
|
| 1838 |
|
| 1839 | /**
|
| 1840 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1841 | */
|
| 1842 | public final void createFurnace(final Block furnace, final TexturedModel.Provider provider) {
|
| 1843 | MultiVariant normalModel = plainVariant(provider.create(furnace, this.modelOutput));
|
| 1844 | Material frontTexture = TextureMapping.getBlockTexture(furnace, "_front_on");
|
| 1845 | MultiVariant litModel = plainVariant(
|
| 1846 | provider.get(furnace).updateTextures(t -> t.put(TextureSlot.FRONT, frontTexture)).createWithSuffix(furnace, "_on", this.modelOutput)
|
| 1847 | );
|
| 1848 | this.blockStateOutput
|
| 1849 | .accept(
|
| 1850 | MultiVariantGenerator.dispatch(furnace).with(createBooleanModelDispatch(BlockStateProperties.LIT, litModel, normalModel)).with(ROTATION_HORIZONTAL_FACING)
|
| 1851 | );
|
| 1852 | }
|
| 1853 |
|
| 1854 | /**
|
| 1855 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1856 | */
|
| 1857 | public final void createCampfires(final Block... campFires) {
|
| 1858 | MultiVariant offModel = plainVariant(ModelLocationUtils.decorateBlockModelLocation("campfire_off"));
|
| 1859 |
|
| 1860 | for (Block campFire : campFires) {
|
| 1861 | MultiVariant litModel = plainVariant(ModelTemplates.CAMPFIRE.create(campFire, TextureMapping.campfire(campFire), this.modelOutput));
|
| 1862 | this.registerSimpleFlatItemModel(campFire.asItem());
|
| 1863 | this.blockStateOutput
|
| 1864 | .accept(
|
| 1865 | MultiVariantGenerator.dispatch(campFire)
|
| 1866 | .with(createBooleanModelDispatch(BlockStateProperties.LIT, litModel, offModel))
|
| 1867 | .with(ROTATION_HORIZONTAL_FACING_ALT)
|
| 1868 | );
|
| 1869 | }
|
| 1870 | }
|
| 1871 |
|
| 1872 | /**
|
| 1873 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1874 | */
|
| 1875 | public final void createAzalea(final Block block) {
|
| 1876 | MultiVariant model = plainVariant(ModelTemplates.AZALEA.create(block, TextureMapping.cubeTop(block), this.modelOutput));
|
| 1877 | this.blockStateOutput.accept(createSimpleBlock(block, model));
|
| 1878 | }
|
| 1879 |
|
| 1880 | /**
|
| 1881 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 1882 | */
|
| 1883 | public final void createPottedAzalea(final Block block) {
|
| 1884 | MultiVariant model;
|
| 1885 | if (block == Blocks.POTTED_FLOWERING_AZALEA) {
|
| 1886 | model = plainVariant(ModelTemplates.POTTED_FLOWERING_AZALEA.create(block, TextureMapping.pottedAzalea(block), this.modelOutput));
|
| 1887 | } else {
|
| 1888 | model = plainVariant(ModelTemplates.POTTED_AZALEA.create(block, TextureMapping.pottedAzalea(block), this.modelOutput));
|
| 1889 | }
|
| 1890 |
|
| 1891 | this.blockStateOutput.accept(createSimpleBlock(block, model));
|
| 1892 | }
|
| 1893 |
|
| 1894 | private void createBookshelf() {
|
| 1895 | TextureMapping textures = TextureMapping.column(TextureMapping.getBlockTexture(Blocks.BOOKSHELF), TextureMapping.getBlockTexture(Blocks.OAK_PLANKS));
|
| 1896 | MultiVariant model = plainVariant(ModelTemplates.CUBE_COLUMN.create(Blocks.BOOKSHELF, textures, this.modelOutput));
|
| 1897 | this.blockStateOutput.accept(createSimpleBlock(Blocks.BOOKSHELF, model));
|
| 1898 | }
|
| 1899 |
|
| 1900 | private void createRedstoneWire() {
|
| 1901 | this.registerSimpleFlatItemModel(Items.REDSTONE);
|
| 1902 | this.blockStateOutput
|
| 1903 | .accept(
|
| 1904 | MultiPartGenerator.multiPart(Blocks.REDSTONE_WIRE)
|
| 1905 | .with(
|
| 1906 | or(
|
| 1907 | condition()
|
| 1908 | .term(BlockStateProperties.NORTH_REDSTONE, RedstoneSide.NONE)
|
| 1909 | .term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.NONE)
|
| 1910 | .term(BlockStateProperties.SOUTH_REDSTONE, RedstoneSide.NONE)
|
| 1911 | .term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.NONE),
|
| 1912 | condition()
|
| 1913 | .term(BlockStateProperties.NORTH_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP)
|
| 1914 | .term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1915 | condition()
|
| 1916 | .term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP)
|
| 1917 | .term(BlockStateProperties.SOUTH_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1918 | condition()
|
| 1919 | .term(BlockStateProperties.SOUTH_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP)
|
| 1920 | .term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1921 | condition()
|
| 1922 | .term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP)
|
| 1923 | .term(BlockStateProperties.NORTH_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP)
|
| 1924 | ),
|
| 1925 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_dot"))
|
| 1926 | )
|
| 1927 | .with(
|
| 1928 | condition().term(BlockStateProperties.NORTH_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1929 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_side0"))
|
| 1930 | )
|
| 1931 | .with(
|
| 1932 | condition().term(BlockStateProperties.SOUTH_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1933 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_side_alt0"))
|
| 1934 | )
|
| 1935 | .with(
|
| 1936 | condition().term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1937 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_side_alt1")).with(Y_ROT_270)
|
| 1938 | )
|
| 1939 | .with(
|
| 1940 | condition().term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.SIDE, RedstoneSide.UP),
|
| 1941 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_side1")).with(Y_ROT_270)
|
| 1942 | )
|
| 1943 | .with(
|
| 1944 | condition().term(BlockStateProperties.NORTH_REDSTONE, RedstoneSide.UP), plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up"))
|
| 1945 | )
|
| 1946 | .with(
|
| 1947 | condition().term(BlockStateProperties.EAST_REDSTONE, RedstoneSide.UP),
|
| 1948 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up")).with(Y_ROT_90)
|
| 1949 | )
|
| 1950 | .with(
|
| 1951 | condition().term(BlockStateProperties.SOUTH_REDSTONE, RedstoneSide.UP),
|
| 1952 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up")).with(Y_ROT_180)
|
| 1953 | )
|
| 1954 | .with(
|
| 1955 | condition().term(BlockStateProperties.WEST_REDSTONE, RedstoneSide.UP),
|
| 1956 | plainVariant(ModelLocationUtils.decorateBlockModelLocation("redstone_dust_up")).with(Y_ROT_270)
|
| 1957 | )
|
| 1958 | );
|
| 1959 | }
|
| 1960 |
|
| 1961 | private void createComparator() {
|
| 1962 | this.registerSimpleFlatItemModel(Items.COMPARATOR);
|
| 1963 | this.blockStateOutput
|
| 1964 | .accept(
|
| 1965 | MultiVariantGenerator.dispatch(Blocks.COMPARATOR)
|
| 1966 | .with(
|
| 1967 | PropertyDispatch.initial(BlockStateProperties.MODE_COMPARATOR, BlockStateProperties.POWERED)
|
| 1968 | .select(ComparatorMode.COMPARE, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPARATOR)))
|
| 1969 | .select(ComparatorMode.COMPARE, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPARATOR, "_on")))
|
| 1970 | .select(ComparatorMode.SUBTRACT, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPARATOR, "_subtract")))
|
| 1971 | .select(ComparatorMode.SUBTRACT, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPARATOR, "_on_subtract")))
|
| 1972 | )
|
| 1973 | .with(ROTATION_HORIZONTAL_FACING_ALT)
|
| 1974 | );
|
| 1975 | }
|
| 1976 |
|
| 1977 | private void createSmoothStoneSlab() {
|
| 1978 | TextureMapping smoothStoneTextures = TextureMapping.cube(Blocks.SMOOTH_STONE);
|
| 1979 | TextureMapping smoothStoneSlabTextures = TextureMapping.column(
|
| 1980 | TextureMapping.getBlockTexture(Blocks.SMOOTH_STONE_SLAB, "_side"), smoothStoneTextures.get(TextureSlot.TOP)
|
| 1981 | );
|
| 1982 | MultiVariant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(Blocks.SMOOTH_STONE_SLAB, smoothStoneSlabTextures, this.modelOutput));
|
| 1983 | MultiVariant top = plainVariant(ModelTemplates.SLAB_TOP.create(Blocks.SMOOTH_STONE_SLAB, smoothStoneSlabTextures, this.modelOutput));
|
| 1984 | MultiVariant doubleSlab = plainVariant(
|
| 1985 | ModelTemplates.CUBE_COLUMN.createWithOverride(Blocks.SMOOTH_STONE_SLAB, "_double", smoothStoneSlabTextures, this.modelOutput)
|
| 1986 | );
|
| 1987 | this.blockStateOutput.accept(createSlab(Blocks.SMOOTH_STONE_SLAB, bottom, top, doubleSlab));
|
| 1988 | this.blockStateOutput
|
| 1989 | .accept(createSimpleBlock(Blocks.SMOOTH_STONE, plainVariant(ModelTemplates.CUBE_ALL.create(Blocks.SMOOTH_STONE, smoothStoneTextures, this.modelOutput))));
|
| 1990 | }
|
| 1991 |
|
| 1992 | private void createBrewingStand() {
|
| 1993 | this.registerSimpleFlatItemModel(Items.BREWING_STAND);
|
| 1994 | this.blockStateOutput
|
| 1995 | .accept(
|
| 1996 | MultiPartGenerator.multiPart(Blocks.BREWING_STAND)
|
| 1997 | .with(plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND)))
|
| 1998 | .with(condition().term(BlockStateProperties.HAS_BOTTLE_0, true), plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND, "_bottle0")))
|
| 1999 | .with(condition().term(BlockStateProperties.HAS_BOTTLE_1, true), plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND, "_bottle1")))
|
| 2000 | .with(condition().term(BlockStateProperties.HAS_BOTTLE_2, true), plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND, "_bottle2")))
|
| 2001 | .with(condition().term(BlockStateProperties.HAS_BOTTLE_0, false), plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND, "_empty0")))
|
| 2002 | .with(condition().term(BlockStateProperties.HAS_BOTTLE_1, false), plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND, "_empty1")))
|
| 2003 | .with(condition().term(BlockStateProperties.HAS_BOTTLE_2, false), plainVariant(ModelLocationUtils.getModelLocation(Blocks.BREWING_STAND, "_empty2")))
|
| 2004 | );
|
| 2005 | }
|
| 2006 |
|
| 2007 | /**
|
| 2008 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2009 | */
|
| 2010 | public final void createMushroomBlock(final Block block) {
|
| 2011 | MultiVariant skin = plainVariant(ModelTemplates.SINGLE_FACE.create(block, TextureMapping.defaultTexture(block), this.modelOutput));
|
| 2012 | MultiVariant skinless = plainVariant(ModelLocationUtils.decorateBlockModelLocation("mushroom_block_inside"));
|
| 2013 | this.blockStateOutput
|
| 2014 | .accept(
|
| 2015 | MultiPartGenerator.multiPart(block)
|
| 2016 | .with(condition().term(BlockStateProperties.NORTH, true), skin)
|
| 2017 | .with(condition().term(BlockStateProperties.EAST, true), skin.with(Y_ROT_90).with(UV_LOCK))
|
| 2018 | .with(condition().term(BlockStateProperties.SOUTH, true), skin.with(Y_ROT_180).with(UV_LOCK))
|
| 2019 | .with(condition().term(BlockStateProperties.WEST, true), skin.with(Y_ROT_270).with(UV_LOCK))
|
| 2020 | .with(condition().term(BlockStateProperties.UP, true), skin.with(X_ROT_270).with(UV_LOCK))
|
| 2021 | .with(condition().term(BlockStateProperties.DOWN, true), skin.with(X_ROT_90).with(UV_LOCK))
|
| 2022 | .with(condition().term(BlockStateProperties.NORTH, false), skinless)
|
| 2023 | .with(condition().term(BlockStateProperties.EAST, false), skinless.with(Y_ROT_90))
|
| 2024 | .with(condition().term(BlockStateProperties.SOUTH, false), skinless.with(Y_ROT_180))
|
| 2025 | .with(condition().term(BlockStateProperties.WEST, false), skinless.with(Y_ROT_270))
|
| 2026 | .with(condition().term(BlockStateProperties.UP, false), skinless.with(X_ROT_270))
|
| 2027 | .with(condition().term(BlockStateProperties.DOWN, false), skinless.with(X_ROT_90))
|
| 2028 | );
|
| 2029 | this.registerSimpleItemModel(block, TexturedModel.CUBE.createWithSuffix(block, "_inventory", this.modelOutput));
|
| 2030 | }
|
| 2031 |
|
| 2032 | private void createCakeBlock() {
|
| 2033 | this.registerSimpleFlatItemModel(Items.CAKE);
|
| 2034 | this.blockStateOutput
|
| 2035 | .accept(
|
| 2036 | MultiVariantGenerator.dispatch(Blocks.CAKE)
|
| 2037 | .with(
|
| 2038 | PropertyDispatch.initial(BlockStateProperties.BITES)
|
| 2039 | .select(0, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE)))
|
| 2040 | .select(1, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE, "_slice1")))
|
| 2041 | .select(2, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE, "_slice2")))
|
| 2042 | .select(3, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE, "_slice3")))
|
| 2043 | .select(4, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE, "_slice4")))
|
| 2044 | .select(5, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE, "_slice5")))
|
| 2045 | .select(6, plainVariant(ModelLocationUtils.getModelLocation(Blocks.CAKE, "_slice6")))
|
| 2046 | )
|
| 2047 | );
|
| 2048 | }
|
| 2049 |
|
| 2050 | private void createCartographyTable() {
|
| 2051 | TextureMapping mapping = new TextureMapping()
|
| 2052 | .put(TextureSlot.PARTICLE, TextureMapping.getBlockTexture(Blocks.CARTOGRAPHY_TABLE, "_side3"))
|
| 2053 | .put(TextureSlot.DOWN, TextureMapping.getBlockTexture(Blocks.DARK_OAK_PLANKS))
|
| 2054 | .put(TextureSlot.UP, TextureMapping.getBlockTexture(Blocks.CARTOGRAPHY_TABLE, "_top"))
|
| 2055 | .put(TextureSlot.NORTH, TextureMapping.getBlockTexture(Blocks.CARTOGRAPHY_TABLE, "_side3"))
|
| 2056 | .put(TextureSlot.EAST, TextureMapping.getBlockTexture(Blocks.CARTOGRAPHY_TABLE, "_side3"))
|
| 2057 | .put(TextureSlot.SOUTH, TextureMapping.getBlockTexture(Blocks.CARTOGRAPHY_TABLE, "_side1"))
|
| 2058 | .put(TextureSlot.WEST, TextureMapping.getBlockTexture(Blocks.CARTOGRAPHY_TABLE, "_side2"));
|
| 2059 | this.blockStateOutput
|
| 2060 | .accept(createSimpleBlock(Blocks.CARTOGRAPHY_TABLE, plainVariant(ModelTemplates.CUBE.create(Blocks.CARTOGRAPHY_TABLE, mapping, this.modelOutput))));
|
| 2061 | }
|
| 2062 |
|
| 2063 | private void createSmithingTable() {
|
| 2064 | TextureMapping mapping = new TextureMapping()
|
| 2065 | .put(TextureSlot.PARTICLE, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_front"))
|
| 2066 | .put(TextureSlot.DOWN, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_bottom"))
|
| 2067 | .put(TextureSlot.UP, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_top"))
|
| 2068 | .put(TextureSlot.NORTH, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_front"))
|
| 2069 | .put(TextureSlot.SOUTH, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_front"))
|
| 2070 | .put(TextureSlot.EAST, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_side"))
|
| 2071 | .put(TextureSlot.WEST, TextureMapping.getBlockTexture(Blocks.SMITHING_TABLE, "_side"));
|
| 2072 | this.blockStateOutput
|
| 2073 | .accept(createSimpleBlock(Blocks.SMITHING_TABLE, plainVariant(ModelTemplates.CUBE.create(Blocks.SMITHING_TABLE, mapping, this.modelOutput))));
|
| 2074 | }
|
| 2075 |
|
| 2076 | /**
|
| 2077 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2078 | */
|
| 2079 | public final void createCraftingTableLike(final Block block, final Block bottomBlock, final BiFunction<Block, Block, TextureMapping> mappingProvider) {
|
| 2080 | TextureMapping mapping = mappingProvider.apply(block, bottomBlock);
|
| 2081 | this.blockStateOutput.accept(createSimpleBlock(block, plainVariant(ModelTemplates.CUBE.create(block, mapping, this.modelOutput))));
|
| 2082 | }
|
| 2083 |
|
| 2084 | private void createPumpkins() {
|
| 2085 | TextureMapping pumpkinTextures = TextureMapping.column(Blocks.PUMPKIN);
|
| 2086 | this.blockStateOutput.accept(createSimpleBlock(Blocks.PUMPKIN, plainVariant(ModelLocationUtils.getModelLocation(Blocks.PUMPKIN))));
|
| 2087 | this.createPumpkinVariant(Blocks.CARVED_PUMPKIN, pumpkinTextures);
|
| 2088 | this.createPumpkinVariant(Blocks.JACK_O_LANTERN, pumpkinTextures);
|
| 2089 | }
|
| 2090 |
|
| 2091 | /**
|
| 2092 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2093 | */
|
| 2094 | public final void createPumpkinVariant(final Block block, final TextureMapping textures) {
|
| 2095 | MultiVariant model = plainVariant(
|
| 2096 | ModelTemplates.CUBE_ORIENTABLE.create(block, textures.copyAndUpdate(TextureSlot.FRONT, TextureMapping.getBlockTexture(block)), this.modelOutput)
|
| 2097 | );
|
| 2098 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block, model).with(ROTATION_HORIZONTAL_FACING));
|
| 2099 | }
|
| 2100 |
|
| 2101 | private void createCauldrons() {
|
| 2102 | this.registerSimpleFlatItemModel(Items.CAULDRON);
|
| 2103 | this.createNonTemplateModelBlock(Blocks.CAULDRON);
|
| 2104 | this.blockStateOutput
|
| 2105 | .accept(
|
| 2106 | createSimpleBlock(
|
| 2107 | Blocks.LAVA_CAULDRON,
|
| 2108 | plainVariant(
|
| 2109 | ModelTemplates.CAULDRON_FULL
|
| 2110 | .create(Blocks.LAVA_CAULDRON, TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.LAVA, "_still")), this.modelOutput)
|
| 2111 | )
|
| 2112 | )
|
| 2113 | );
|
| 2114 | this.blockStateOutput
|
| 2115 | .accept(
|
| 2116 | MultiVariantGenerator.dispatch(Blocks.WATER_CAULDRON)
|
| 2117 | .with(
|
| 2118 | PropertyDispatch.initial(LayeredCauldronBlock.LEVEL)
|
| 2119 | .select(
|
| 2120 | 1,
|
| 2121 | plainVariant(
|
| 2122 | ModelTemplates.CAULDRON_LEVEL1
|
| 2123 | .createWithSuffix(Blocks.WATER_CAULDRON, "_level1", TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.WATER, "_still")), this.modelOutput)
|
| 2124 | )
|
| 2125 | )
|
| 2126 | .select(
|
| 2127 | 2,
|
| 2128 | plainVariant(
|
| 2129 | ModelTemplates.CAULDRON_LEVEL2
|
| 2130 | .createWithSuffix(Blocks.WATER_CAULDRON, "_level2", TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.WATER, "_still")), this.modelOutput)
|
| 2131 | )
|
| 2132 | )
|
| 2133 | .select(
|
| 2134 | 3,
|
| 2135 | plainVariant(
|
| 2136 | ModelTemplates.CAULDRON_FULL
|
| 2137 | .createWithSuffix(Blocks.WATER_CAULDRON, "_full", TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.WATER, "_still")), this.modelOutput)
|
| 2138 | )
|
| 2139 | )
|
| 2140 | )
|
| 2141 | );
|
| 2142 | this.blockStateOutput
|
| 2143 | .accept(
|
| 2144 | MultiVariantGenerator.dispatch(Blocks.POWDER_SNOW_CAULDRON)
|
| 2145 | .with(
|
| 2146 | PropertyDispatch.initial(LayeredCauldronBlock.LEVEL)
|
| 2147 | .select(
|
| 2148 | 1,
|
| 2149 | plainVariant(
|
| 2150 | ModelTemplates.CAULDRON_LEVEL1
|
| 2151 | .createWithSuffix(
|
| 2152 | Blocks.POWDER_SNOW_CAULDRON, "_level1", TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.POWDER_SNOW)), this.modelOutput
|
| 2153 | )
|
| 2154 | )
|
| 2155 | )
|
| 2156 | .select(
|
| 2157 | 2,
|
| 2158 | plainVariant(
|
| 2159 | ModelTemplates.CAULDRON_LEVEL2
|
| 2160 | .createWithSuffix(
|
| 2161 | Blocks.POWDER_SNOW_CAULDRON, "_level2", TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.POWDER_SNOW)), this.modelOutput
|
| 2162 | )
|
| 2163 | )
|
| 2164 | )
|
| 2165 | .select(
|
| 2166 | 3,
|
| 2167 | plainVariant(
|
| 2168 | ModelTemplates.CAULDRON_FULL
|
| 2169 | .createWithSuffix(Blocks.POWDER_SNOW_CAULDRON, "_full", TextureMapping.cauldron(TextureMapping.getBlockTexture(Blocks.POWDER_SNOW)), this.modelOutput)
|
| 2170 | )
|
| 2171 | )
|
| 2172 | )
|
| 2173 | );
|
| 2174 | }
|
| 2175 |
|
| 2176 | private void createChorusFlower() {
|
| 2177 | TextureMapping aliveTextures = TextureMapping.defaultTexture(Blocks.CHORUS_FLOWER);
|
| 2178 | MultiVariant aliveModel = plainVariant(ModelTemplates.CHORUS_FLOWER.create(Blocks.CHORUS_FLOWER, aliveTextures, this.modelOutput));
|
| 2179 | MultiVariant deadModel = plainVariant(
|
| 2180 | this.createSuffixedVariant(Blocks.CHORUS_FLOWER, "_dead", ModelTemplates.CHORUS_FLOWER, id -> aliveTextures.copyAndUpdate(TextureSlot.TEXTURE, id))
|
| 2181 | );
|
| 2182 | this.blockStateOutput
|
| 2183 | .accept(MultiVariantGenerator.dispatch(Blocks.CHORUS_FLOWER).with(createEmptyOrFullDispatch(BlockStateProperties.AGE_5, 5, deadModel, aliveModel)));
|
| 2184 | }
|
| 2185 |
|
| 2186 | private void createCrafterBlock() {
|
| 2187 | MultiVariant off = plainVariant(ModelLocationUtils.getModelLocation(Blocks.CRAFTER));
|
| 2188 | MultiVariant triggeredLocation = plainVariant(ModelLocationUtils.getModelLocation(Blocks.CRAFTER, "_triggered"));
|
| 2189 | MultiVariant craftingLocation = plainVariant(ModelLocationUtils.getModelLocation(Blocks.CRAFTER, "_crafting"));
|
| 2190 | MultiVariant craftingTriggeredLocation = plainVariant(ModelLocationUtils.getModelLocation(Blocks.CRAFTER, "_crafting_triggered"));
|
| 2191 | this.blockStateOutput
|
| 2192 | .accept(
|
| 2193 | MultiVariantGenerator.dispatch(Blocks.CRAFTER)
|
| 2194 | .with(
|
| 2195 | PropertyDispatch.initial(BlockStateProperties.TRIGGERED, CrafterBlock.CRAFTING)
|
| 2196 | .select(false, false, off)
|
| 2197 | .select(true, true, craftingTriggeredLocation)
|
| 2198 | .select(true, false, triggeredLocation)
|
| 2199 | .select(false, true, craftingLocation)
|
| 2200 | )
|
| 2201 | .with(PropertyDispatch.modify(BlockStateProperties.ORIENTATION).generate(BlockModelGenerators::applyRotation))
|
| 2202 | );
|
| 2203 | }
|
| 2204 |
|
| 2205 | /**
|
| 2206 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2207 | */
|
| 2208 | public final void createDispenserBlock(final Block block) {
|
| 2209 | TextureMapping horizontalTextures = new TextureMapping()
|
| 2210 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(Blocks.FURNACE, "_top"))
|
| 2211 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.FURNACE, "_side"))
|
| 2212 | .put(TextureSlot.FRONT, TextureMapping.getBlockTexture(block, "_front"));
|
| 2213 | TextureMapping verticalTextures = new TextureMapping()
|
| 2214 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.FURNACE, "_top"))
|
| 2215 | .put(TextureSlot.FRONT, TextureMapping.getBlockTexture(block, "_front_vertical"));
|
| 2216 | MultiVariant horizontalModel = plainVariant(ModelTemplates.CUBE_ORIENTABLE.create(block, horizontalTextures, this.modelOutput));
|
| 2217 | MultiVariant verticalModel = plainVariant(ModelTemplates.CUBE_ORIENTABLE_VERTICAL.create(block, verticalTextures, this.modelOutput));
|
| 2218 | this.blockStateOutput
|
| 2219 | .accept(
|
| 2220 | MultiVariantGenerator.dispatch(block)
|
| 2221 | .with(
|
| 2222 | PropertyDispatch.initial(BlockStateProperties.FACING)
|
| 2223 | .select(Direction.DOWN, verticalModel.with(X_ROT_180))
|
| 2224 | .select(Direction.UP, verticalModel)
|
| 2225 | .select(Direction.NORTH, horizontalModel)
|
| 2226 | .select(Direction.EAST, horizontalModel.with(Y_ROT_90))
|
| 2227 | .select(Direction.SOUTH, horizontalModel.with(Y_ROT_180))
|
| 2228 | .select(Direction.WEST, horizontalModel.with(Y_ROT_270))
|
| 2229 | )
|
| 2230 | );
|
| 2231 | }
|
| 2232 |
|
| 2233 | private void createEndPortalFrame() {
|
| 2234 | MultiVariant empty = plainVariant(ModelLocationUtils.getModelLocation(Blocks.END_PORTAL_FRAME));
|
| 2235 | MultiVariant filled = plainVariant(ModelLocationUtils.getModelLocation(Blocks.END_PORTAL_FRAME, "_filled"));
|
| 2236 | this.blockStateOutput
|
| 2237 | .accept(
|
| 2238 | MultiVariantGenerator.dispatch(Blocks.END_PORTAL_FRAME)
|
| 2239 | .with(PropertyDispatch.initial(BlockStateProperties.EYE).select(false, empty).select(true, filled))
|
| 2240 | .with(ROTATION_HORIZONTAL_FACING_ALT)
|
| 2241 | );
|
| 2242 | }
|
| 2243 |
|
| 2244 | private void createChorusPlant() {
|
| 2245 | MultiVariant side = plainVariant(ModelLocationUtils.getModelLocation(Blocks.CHORUS_PLANT, "_side"));
|
| 2246 | net.minecraft.client.renderer.block.dispatch.Variant noside = plainModel(ModelLocationUtils.getModelLocation(Blocks.CHORUS_PLANT, "_noside"));
|
| 2247 | net.minecraft.client.renderer.block.dispatch.Variant noside1 = plainModel(ModelLocationUtils.getModelLocation(Blocks.CHORUS_PLANT, "_noside1"));
|
| 2248 | net.minecraft.client.renderer.block.dispatch.Variant noside2 = plainModel(ModelLocationUtils.getModelLocation(Blocks.CHORUS_PLANT, "_noside2"));
|
| 2249 | net.minecraft.client.renderer.block.dispatch.Variant noside3 = plainModel(ModelLocationUtils.getModelLocation(Blocks.CHORUS_PLANT, "_noside3"));
|
| 2250 | net.minecraft.client.renderer.block.dispatch.Variant nosideUvLock = noside.with(UV_LOCK);
|
| 2251 | net.minecraft.client.renderer.block.dispatch.Variant noside1uvLock = noside1.with(UV_LOCK);
|
| 2252 | net.minecraft.client.renderer.block.dispatch.Variant noside2uvLock = noside2.with(UV_LOCK);
|
| 2253 | net.minecraft.client.renderer.block.dispatch.Variant noside3uvLock = noside3.with(UV_LOCK);
|
| 2254 | this.blockStateOutput
|
| 2255 | .accept(
|
| 2256 | MultiPartGenerator.multiPart(Blocks.CHORUS_PLANT)
|
| 2257 | .with(condition().term(BlockStateProperties.NORTH, true), side)
|
| 2258 | .with(condition().term(BlockStateProperties.EAST, true), side.with(Y_ROT_90).with(UV_LOCK))
|
| 2259 | .with(condition().term(BlockStateProperties.SOUTH, true), side.with(Y_ROT_180).with(UV_LOCK))
|
| 2260 | .with(condition().term(BlockStateProperties.WEST, true), side.with(Y_ROT_270).with(UV_LOCK))
|
| 2261 | .with(condition().term(BlockStateProperties.UP, true), side.with(X_ROT_270).with(UV_LOCK))
|
| 2262 | .with(condition().term(BlockStateProperties.DOWN, true), side.with(X_ROT_90).with(UV_LOCK))
|
| 2263 | .with(
|
| 2264 | condition().term(BlockStateProperties.NORTH, false),
|
| 2265 | new MultiVariant(WeightedList.of(new Weighted<>(noside, 2), new Weighted<>(noside1, 1), new Weighted<>(noside2, 1), new Weighted<>(noside3, 1)))
|
| 2266 | )
|
| 2267 | .with(
|
| 2268 | condition().term(BlockStateProperties.EAST, false),
|
| 2269 | new MultiVariant(
|
| 2270 | WeightedList.of(
|
| 2271 | new Weighted<>(noside1uvLock.with(Y_ROT_90), 1),
|
| 2272 | new Weighted<>(noside2uvLock.with(Y_ROT_90), 1),
|
| 2273 | new Weighted<>(noside3uvLock.with(Y_ROT_90), 1),
|
| 2274 | new Weighted<>(nosideUvLock.with(Y_ROT_90), 2)
|
| 2275 | )
|
| 2276 | )
|
| 2277 | )
|
| 2278 | .with(
|
| 2279 | condition().term(BlockStateProperties.SOUTH, false),
|
| 2280 | new MultiVariant(
|
| 2281 | WeightedList.of(
|
| 2282 | new Weighted<>(noside2uvLock.with(Y_ROT_180), 1),
|
| 2283 | new Weighted<>(noside3uvLock.with(Y_ROT_180), 1),
|
| 2284 | new Weighted<>(nosideUvLock.with(Y_ROT_180), 2),
|
| 2285 | new Weighted<>(noside1uvLock.with(Y_ROT_180), 1)
|
| 2286 | )
|
| 2287 | )
|
| 2288 | )
|
| 2289 | .with(
|
| 2290 | condition().term(BlockStateProperties.WEST, false),
|
| 2291 | new MultiVariant(
|
| 2292 | WeightedList.of(
|
| 2293 | new Weighted<>(noside3uvLock.with(Y_ROT_270), 1),
|
| 2294 | new Weighted<>(nosideUvLock.with(Y_ROT_270), 2),
|
| 2295 | new Weighted<>(noside1uvLock.with(Y_ROT_270), 1),
|
| 2296 | new Weighted<>(noside2uvLock.with(Y_ROT_270), 1)
|
| 2297 | )
|
| 2298 | )
|
| 2299 | )
|
| 2300 | .with(
|
| 2301 | condition().term(BlockStateProperties.UP, false),
|
| 2302 | new MultiVariant(
|
| 2303 | WeightedList.of(
|
| 2304 | new Weighted<>(nosideUvLock.with(X_ROT_270), 2),
|
| 2305 | new Weighted<>(noside3uvLock.with(X_ROT_270), 1),
|
| 2306 | new Weighted<>(noside1uvLock.with(X_ROT_270), 1),
|
| 2307 | new Weighted<>(noside2uvLock.with(X_ROT_270), 1)
|
| 2308 | )
|
| 2309 | )
|
| 2310 | )
|
| 2311 | .with(
|
| 2312 | condition().term(BlockStateProperties.DOWN, false),
|
| 2313 | new MultiVariant(
|
| 2314 | WeightedList.of(
|
| 2315 | new Weighted<>(noside3uvLock.with(X_ROT_90), 1),
|
| 2316 | new Weighted<>(noside2uvLock.with(X_ROT_90), 1),
|
| 2317 | new Weighted<>(noside1uvLock.with(X_ROT_90), 1),
|
| 2318 | new Weighted<>(nosideUvLock.with(X_ROT_90), 2)
|
| 2319 | )
|
| 2320 | )
|
| 2321 | )
|
| 2322 | );
|
| 2323 | }
|
| 2324 |
|
| 2325 | private void createComposter() {
|
| 2326 | this.blockStateOutput
|
| 2327 | .accept(
|
| 2328 | MultiPartGenerator.multiPart(Blocks.COMPOSTER)
|
| 2329 | .with(plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER)))
|
| 2330 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 1), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents1")))
|
| 2331 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 2), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents2")))
|
| 2332 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 3), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents3")))
|
| 2333 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 4), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents4")))
|
| 2334 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 5), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents5")))
|
| 2335 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 6), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents6")))
|
| 2336 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 7), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents7")))
|
| 2337 | .with(condition().term(BlockStateProperties.LEVEL_COMPOSTER, 8), plainVariant(ModelLocationUtils.getModelLocation(Blocks.COMPOSTER, "_contents_ready")))
|
| 2338 | );
|
| 2339 | }
|
| 2340 |
|
| 2341 | /**
|
| 2342 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2343 | */
|
| 2344 | public final void createCopperBulb(final Block copperBulb) {
|
| 2345 | MultiVariant baseModel = plainVariant(ModelTemplates.CUBE_ALL.create(copperBulb, TextureMapping.cube(copperBulb), this.modelOutput));
|
| 2346 | MultiVariant baseModelPowered = plainVariant(this.createSuffixedVariant(copperBulb, "_powered", ModelTemplates.CUBE_ALL, TextureMapping::cube));
|
| 2347 | MultiVariant litModel = plainVariant(this.createSuffixedVariant(copperBulb, "_lit", ModelTemplates.CUBE_ALL, TextureMapping::cube));
|
| 2348 | MultiVariant litModelPowered = plainVariant(this.createSuffixedVariant(copperBulb, "_lit_powered", ModelTemplates.CUBE_ALL, TextureMapping::cube));
|
| 2349 | this.blockStateOutput.accept(createCopperBulb(copperBulb, baseModel, litModel, baseModelPowered, litModelPowered));
|
| 2350 | }
|
| 2351 |
|
| 2352 | /**
|
| 2353 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2354 | */
|
| 2355 | public static BlockModelDefinitionGenerator createCopperBulb(
|
| 2356 | final Block copperBulb, final MultiVariant baseModel, final MultiVariant litModel, final MultiVariant baseModelPowered, final MultiVariant litModelPowered
|
| 2357 | ) {
|
| 2358 | return MultiVariantGenerator.dispatch(copperBulb)
|
| 2359 | .with(PropertyDispatch.initial(BlockStateProperties.LIT, BlockStateProperties.POWERED).generate((emittingLight, powered) -> {
|
| 2360 | if (emittingLight) {
|
| 2361 | return powered ? litModelPowered : litModel;
|
| 2362 | } else {
|
| 2363 | return powered ? baseModelPowered : baseModel;
|
| 2364 | }
|
| 2365 | }));
|
| 2366 | }
|
| 2367 |
|
| 2368 | /**
|
| 2369 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2370 | */
|
| 2371 | public final void copyCopperBulbModel(final Block donor, final Block acceptor) {
|
| 2372 | MultiVariant baseModel = plainVariant(ModelLocationUtils.getModelLocation(donor));
|
| 2373 | MultiVariant baseModelPowered = plainVariant(ModelLocationUtils.getModelLocation(donor, "_powered"));
|
| 2374 | MultiVariant litModel = plainVariant(ModelLocationUtils.getModelLocation(donor, "_lit"));
|
| 2375 | MultiVariant litModelPowered = plainVariant(ModelLocationUtils.getModelLocation(donor, "_lit_powered"));
|
| 2376 | this.itemModelOutput.copy(donor.asItem(), acceptor.asItem());
|
| 2377 | this.blockStateOutput.accept(createCopperBulb(acceptor, baseModel, litModel, baseModelPowered, litModelPowered));
|
| 2378 | }
|
| 2379 |
|
| 2380 | /**
|
| 2381 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2382 | */
|
| 2383 | public final void createAmethystCluster(final Block clusterBlock) {
|
| 2384 | MultiVariant model = plainVariant(ModelTemplates.CROSS.create(clusterBlock, TextureMapping.cross(clusterBlock), this.modelOutput));
|
| 2385 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(clusterBlock, model).with(ROTATIONS_COLUMN_WITH_FACING));
|
| 2386 | }
|
| 2387 |
|
| 2388 | private void createAmethystClusters() {
|
| 2389 | this.createAmethystCluster(Blocks.SMALL_AMETHYST_BUD);
|
| 2390 | this.createAmethystCluster(Blocks.MEDIUM_AMETHYST_BUD);
|
| 2391 | this.createAmethystCluster(Blocks.LARGE_AMETHYST_BUD);
|
| 2392 | this.createAmethystCluster(Blocks.AMETHYST_CLUSTER);
|
| 2393 | }
|
| 2394 |
|
| 2395 | /**
|
| 2396 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2397 | */
|
| 2398 | public final void createSpeleothem(final Block block) {
|
| 2399 | PropertyDispatch.C2<MultiVariant, Direction, SpeleothemThickness> generator = PropertyDispatch.initial(
|
| 2400 | BlockStateProperties.VERTICAL_DIRECTION, BlockStateProperties.SPELEOTHEM_THICKNESS
|
| 2401 | );
|
| 2402 |
|
| 2403 | for (SpeleothemThickness speleothemThickness : SpeleothemThickness.values()) {
|
| 2404 | generator.select(Direction.UP, speleothemThickness, this.createSpeleothemVariant(Direction.UP, speleothemThickness, block));
|
| 2405 | }
|
| 2406 |
|
| 2407 | for (SpeleothemThickness speleothemThickness : SpeleothemThickness.values()) {
|
| 2408 | generator.select(Direction.DOWN, speleothemThickness, this.createSpeleothemVariant(Direction.DOWN, speleothemThickness, block));
|
| 2409 | }
|
| 2410 |
|
| 2411 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(generator));
|
| 2412 | }
|
| 2413 |
|
| 2414 | /**
|
| 2415 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2416 | */
|
| 2417 | public final MultiVariant createSpeleothemVariant(final Direction direction, final SpeleothemThickness speleothemThickness, final Block block) {
|
| 2418 | String suffix = "_" + direction.getSerializedName() + "_" + speleothemThickness.getSerializedName();
|
| 2419 | TextureMapping texture = TextureMapping.cross(TextureMapping.getBlockTexture(block, suffix));
|
| 2420 | return plainVariant(ModelTemplates.POINTED_DRIPSTONE.createWithSuffix(block, suffix, texture, this.modelOutput));
|
| 2421 | }
|
| 2422 |
|
| 2423 | /**
|
| 2424 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2425 | */
|
| 2426 | public final void createNyliumBlock(final Block block) {
|
| 2427 | TextureMapping mapping = new TextureMapping()
|
| 2428 | .put(TextureSlot.BOTTOM, TextureMapping.getBlockTexture(Blocks.NETHERRACK))
|
| 2429 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(block))
|
| 2430 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_side"));
|
| 2431 | this.blockStateOutput.accept(createSimpleBlock(block, plainVariant(ModelTemplates.CUBE_BOTTOM_TOP.create(block, mapping, this.modelOutput))));
|
| 2432 | }
|
| 2433 |
|
| 2434 | private void createDaylightDetector() {
|
| 2435 | Material sideTexture = TextureMapping.getBlockTexture(Blocks.DAYLIGHT_DETECTOR, "_side");
|
| 2436 | TextureMapping normalTextures = new TextureMapping()
|
| 2437 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(Blocks.DAYLIGHT_DETECTOR, "_top"))
|
| 2438 | .put(TextureSlot.SIDE, sideTexture);
|
| 2439 | TextureMapping invertedTextures = new TextureMapping()
|
| 2440 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(Blocks.DAYLIGHT_DETECTOR, "_inverted_top"))
|
| 2441 | .put(TextureSlot.SIDE, sideTexture);
|
| 2442 | this.blockStateOutput
|
| 2443 | .accept(
|
| 2444 | MultiVariantGenerator.dispatch(Blocks.DAYLIGHT_DETECTOR)
|
| 2445 | .with(
|
| 2446 | PropertyDispatch.initial(BlockStateProperties.INVERTED)
|
| 2447 | .select(false, plainVariant(ModelTemplates.DAYLIGHT_DETECTOR.create(Blocks.DAYLIGHT_DETECTOR, normalTextures, this.modelOutput)))
|
| 2448 | .select(
|
| 2449 | true,
|
| 2450 | plainVariant(
|
| 2451 | ModelTemplates.DAYLIGHT_DETECTOR
|
| 2452 | .create(ModelLocationUtils.getModelLocation(Blocks.DAYLIGHT_DETECTOR, "_inverted"), invertedTextures, this.modelOutput)
|
| 2453 | )
|
| 2454 | )
|
| 2455 | )
|
| 2456 | );
|
| 2457 | }
|
| 2458 |
|
| 2459 | /**
|
| 2460 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2461 | */
|
| 2462 | public final void createRotatableColumn(final Block block) {
|
| 2463 | this.blockStateOutput
|
| 2464 | .accept(MultiVariantGenerator.dispatch(block, plainVariant(ModelLocationUtils.getModelLocation(block))).with(ROTATIONS_COLUMN_WITH_FACING));
|
| 2465 | }
|
| 2466 |
|
| 2467 | /**
|
| 2468 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2469 | */
|
| 2470 | public final void createLightningRod(final Block block, final Block waxedBlock) {
|
| 2471 | MultiVariant on = plainVariant(ModelLocationUtils.getModelLocation(Blocks.LIGHTNING_ROD.weathering().unaffected(), "_on"));
|
| 2472 | MultiVariant off = plainVariant(ModelTemplates.LIGHTNING_ROD.create(block, TextureMapping.defaultTexture(block), this.modelOutput));
|
| 2473 | this.blockStateOutput
|
| 2474 | .accept(MultiVariantGenerator.dispatch(block).with(createBooleanModelDispatch(BlockStateProperties.POWERED, on, off)).with(ROTATIONS_COLUMN_WITH_FACING));
|
| 2475 | this.blockStateOutput
|
| 2476 | .accept(
|
| 2477 | MultiVariantGenerator.dispatch(waxedBlock).with(createBooleanModelDispatch(BlockStateProperties.POWERED, on, off)).with(ROTATIONS_COLUMN_WITH_FACING)
|
| 2478 | );
|
| 2479 | this.itemModelOutput.copy(block.asItem(), waxedBlock.asItem());
|
| 2480 | }
|
| 2481 |
|
| 2482 | /**
|
| 2483 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2484 | */
|
| 2485 | public final void createFarmland(final Block farmland, final Material baseTexture, final Material bottomTexture, final ModelTemplate template) {
|
| 2486 | TextureMapping dryTextures = new TextureMapping()
|
| 2487 | .put(TextureSlot.SIDE, baseTexture)
|
| 2488 | .put(TextureSlot.BOTTOM, bottomTexture)
|
| 2489 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(farmland));
|
| 2490 | TextureMapping moistTextures = new TextureMapping()
|
| 2491 | .put(TextureSlot.SIDE, baseTexture)
|
| 2492 | .put(TextureSlot.BOTTOM, bottomTexture)
|
| 2493 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(farmland, "_moist"));
|
| 2494 | MultiVariant dryModel = plainVariant(template.create(farmland, dryTextures, this.modelOutput));
|
| 2495 | MultiVariant moistModel = plainVariant(template.create(ModelLocationUtils.getModelLocation(farmland, "_moist"), moistTextures, this.modelOutput));
|
| 2496 | this.blockStateOutput
|
| 2497 | .accept(MultiVariantGenerator.dispatch(farmland).with(createEmptyOrFullDispatch(BlockStateProperties.MOISTURE, 7, moistModel, dryModel)));
|
| 2498 | }
|
| 2499 |
|
| 2500 | /**
|
| 2501 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2502 | */
|
| 2503 | public final MultiVariant createFloorFireModels(final Block block) {
|
| 2504 | return variants(
|
| 2505 | plainModel(ModelTemplates.FIRE_FLOOR.create(ModelLocationUtils.getModelLocation(block, "_floor0"), TextureMapping.fire0(block), this.modelOutput)),
|
| 2506 | plainModel(ModelTemplates.FIRE_FLOOR.create(ModelLocationUtils.getModelLocation(block, "_floor1"), TextureMapping.fire1(block), this.modelOutput))
|
| 2507 | );
|
| 2508 | }
|
| 2509 |
|
| 2510 | /**
|
| 2511 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2512 | */
|
| 2513 | public final MultiVariant createSideFireModels(final Block block) {
|
| 2514 | return variants(
|
| 2515 | plainModel(ModelTemplates.FIRE_SIDE.create(ModelLocationUtils.getModelLocation(block, "_side0"), TextureMapping.fire0(block), this.modelOutput)),
|
| 2516 | plainModel(ModelTemplates.FIRE_SIDE.create(ModelLocationUtils.getModelLocation(block, "_side1"), TextureMapping.fire1(block), this.modelOutput)),
|
| 2517 | plainModel(ModelTemplates.FIRE_SIDE_ALT.create(ModelLocationUtils.getModelLocation(block, "_side_alt0"), TextureMapping.fire0(block), this.modelOutput)),
|
| 2518 | plainModel(ModelTemplates.FIRE_SIDE_ALT.create(ModelLocationUtils.getModelLocation(block, "_side_alt1"), TextureMapping.fire1(block), this.modelOutput))
|
| 2519 | );
|
| 2520 | }
|
| 2521 |
|
| 2522 | /**
|
| 2523 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2524 | */
|
| 2525 | public final MultiVariant createTopFireModels(final Block block) {
|
| 2526 | return variants(
|
| 2527 | plainModel(ModelTemplates.FIRE_UP.create(ModelLocationUtils.getModelLocation(block, "_up0"), TextureMapping.fire0(block), this.modelOutput)),
|
| 2528 | plainModel(ModelTemplates.FIRE_UP.create(ModelLocationUtils.getModelLocation(block, "_up1"), TextureMapping.fire1(block), this.modelOutput)),
|
| 2529 | plainModel(ModelTemplates.FIRE_UP_ALT.create(ModelLocationUtils.getModelLocation(block, "_up_alt0"), TextureMapping.fire0(block), this.modelOutput)),
|
| 2530 | plainModel(ModelTemplates.FIRE_UP_ALT.create(ModelLocationUtils.getModelLocation(block, "_up_alt1"), TextureMapping.fire1(block), this.modelOutput))
|
| 2531 | );
|
| 2532 | }
|
| 2533 |
|
| 2534 | private void createFire() {
|
| 2535 | ConditionBuilder noSides = condition()
|
| 2536 | .term(BlockStateProperties.NORTH, false)
|
| 2537 | .term(BlockStateProperties.EAST, false)
|
| 2538 | .term(BlockStateProperties.SOUTH, false)
|
| 2539 | .term(BlockStateProperties.WEST, false)
|
| 2540 | .term(BlockStateProperties.UP, false);
|
| 2541 | MultiVariant floorFireModels = this.createFloorFireModels(Blocks.FIRE);
|
| 2542 | MultiVariant sideFireModels = this.createSideFireModels(Blocks.FIRE);
|
| 2543 | MultiVariant topFireModels = this.createTopFireModels(Blocks.FIRE);
|
| 2544 | this.blockStateOutput
|
| 2545 | .accept(
|
| 2546 | MultiPartGenerator.multiPart(Blocks.FIRE)
|
| 2547 | .with(noSides, floorFireModels)
|
| 2548 | .with(or(condition().term(BlockStateProperties.NORTH, true), noSides), sideFireModels)
|
| 2549 | .with(or(condition().term(BlockStateProperties.EAST, true), noSides), sideFireModels.with(Y_ROT_90))
|
| 2550 | .with(or(condition().term(BlockStateProperties.SOUTH, true), noSides), sideFireModels.with(Y_ROT_180))
|
| 2551 | .with(or(condition().term(BlockStateProperties.WEST, true), noSides), sideFireModels.with(Y_ROT_270))
|
| 2552 | .with(condition().term(BlockStateProperties.UP, true), topFireModels)
|
| 2553 | );
|
| 2554 | }
|
| 2555 |
|
| 2556 | private void createSoulFire() {
|
| 2557 | MultiVariant floorFireModels = this.createFloorFireModels(Blocks.SOUL_FIRE);
|
| 2558 | MultiVariant sideFireModels = this.createSideFireModels(Blocks.SOUL_FIRE);
|
| 2559 | this.blockStateOutput
|
| 2560 | .accept(
|
| 2561 | MultiPartGenerator.multiPart(Blocks.SOUL_FIRE)
|
| 2562 | .with(floorFireModels)
|
| 2563 | .with(sideFireModels)
|
| 2564 | .with(sideFireModels.with(Y_ROT_90))
|
| 2565 | .with(sideFireModels.with(Y_ROT_180))
|
| 2566 | .with(sideFireModels.with(Y_ROT_270))
|
| 2567 | );
|
| 2568 | }
|
| 2569 |
|
| 2570 | /**
|
| 2571 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2572 | */
|
| 2573 | public final void createLantern(final Block block) {
|
| 2574 | MultiVariant ground = plainVariant(TexturedModel.LANTERN.create(block, this.modelOutput));
|
| 2575 | MultiVariant hanging = plainVariant(TexturedModel.HANGING_LANTERN.create(block, this.modelOutput));
|
| 2576 | this.registerSimpleFlatItemModel(block.asItem());
|
| 2577 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(createBooleanModelDispatch(BlockStateProperties.HANGING, hanging, ground)));
|
| 2578 | }
|
| 2579 |
|
| 2580 | /**
|
| 2581 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2582 | */
|
| 2583 | public final void createCopperLantern(final Block unwaxed, final Block waxed) {
|
| 2584 | Identifier ground = TexturedModel.LANTERN.create(unwaxed, this.modelOutput);
|
| 2585 | Identifier hanging = TexturedModel.HANGING_LANTERN.create(unwaxed, this.modelOutput);
|
| 2586 | this.registerSimpleFlatItemModel(unwaxed.asItem());
|
| 2587 | this.itemModelOutput.copy(unwaxed.asItem(), waxed.asItem());
|
| 2588 | this.blockStateOutput
|
| 2589 | .accept(MultiVariantGenerator.dispatch(unwaxed).with(createBooleanModelDispatch(BlockStateProperties.HANGING, plainVariant(hanging), plainVariant(ground))));
|
| 2590 | this.blockStateOutput
|
| 2591 | .accept(MultiVariantGenerator.dispatch(waxed).with(createBooleanModelDispatch(BlockStateProperties.HANGING, plainVariant(hanging), plainVariant(ground))));
|
| 2592 | }
|
| 2593 |
|
| 2594 | /**
|
| 2595 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2596 | */
|
| 2597 | public final void createCopperChain(final Block unwaxed, final Block waxed) {
|
| 2598 | MultiVariant model = plainVariant(TexturedModel.CHAIN.create(unwaxed, this.modelOutput));
|
| 2599 | this.createAxisAlignedPillarBlockCustomModel(unwaxed, model);
|
| 2600 | this.createAxisAlignedPillarBlockCustomModel(waxed, model);
|
| 2601 | }
|
| 2602 |
|
| 2603 | private void createMuddyMangroveRoots() {
|
| 2604 | TextureMapping textures = TextureMapping.column(
|
| 2605 | TextureMapping.getBlockTexture(Blocks.MUDDY_MANGROVE_ROOTS, "_side"), TextureMapping.getBlockTexture(Blocks.MUDDY_MANGROVE_ROOTS, "_top")
|
| 2606 | );
|
| 2607 | MultiVariant model = plainVariant(ModelTemplates.CUBE_COLUMN.create(Blocks.MUDDY_MANGROVE_ROOTS, textures, this.modelOutput));
|
| 2608 | this.blockStateOutput.accept(createAxisAlignedPillarBlock(Blocks.MUDDY_MANGROVE_ROOTS, model));
|
| 2609 | }
|
| 2610 |
|
| 2611 | private void createMangrovePropagule() {
|
| 2612 | this.registerSimpleFlatItemModel(Items.MANGROVE_PROPAGULE);
|
| 2613 | Block block = Blocks.MANGROVE_PROPAGULE;
|
| 2614 | MultiVariant plantedModel = plainVariant(ModelLocationUtils.getModelLocation(block));
|
| 2615 | this.blockStateOutput
|
| 2616 | .accept(
|
| 2617 | MultiVariantGenerator.dispatch(Blocks.MANGROVE_PROPAGULE)
|
| 2618 | .with(
|
| 2619 | PropertyDispatch.initial(MangrovePropaguleBlock.HANGING, MangrovePropaguleBlock.AGE)
|
| 2620 | .generate((hanging, age) -> hanging ? plainVariant(ModelLocationUtils.getModelLocation(block, "_hanging_" + age)) : plantedModel)
|
| 2621 | )
|
| 2622 | );
|
| 2623 | }
|
| 2624 |
|
| 2625 | private void createFrostedIce() {
|
| 2626 | this.blockStateOutput
|
| 2627 | .accept(
|
| 2628 | MultiVariantGenerator.dispatch(Blocks.FROSTED_ICE)
|
| 2629 | .with(
|
| 2630 | PropertyDispatch.initial(BlockStateProperties.AGE_3)
|
| 2631 | .select(0, plainVariant(this.createSuffixedVariant(Blocks.FROSTED_ICE, "_0", ModelTemplates.CUBE_ALL, TextureMapping::cube)))
|
| 2632 | .select(1, plainVariant(this.createSuffixedVariant(Blocks.FROSTED_ICE, "_1", ModelTemplates.CUBE_ALL, TextureMapping::cube)))
|
| 2633 | .select(2, plainVariant(this.createSuffixedVariant(Blocks.FROSTED_ICE, "_2", ModelTemplates.CUBE_ALL, TextureMapping::cube)))
|
| 2634 | .select(3, plainVariant(this.createSuffixedVariant(Blocks.FROSTED_ICE, "_3", ModelTemplates.CUBE_ALL, TextureMapping::cube)))
|
| 2635 | )
|
| 2636 | );
|
| 2637 | }
|
| 2638 |
|
| 2639 | private void createGrassBlocks() {
|
| 2640 | Material bottomTexture = TextureMapping.getBlockTexture(Blocks.DIRT);
|
| 2641 | TextureMapping snowyMapping = new TextureMapping()
|
| 2642 | .put(TextureSlot.BOTTOM, bottomTexture)
|
| 2643 | .copyForced(TextureSlot.BOTTOM, TextureSlot.PARTICLE)
|
| 2644 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(Blocks.GRASS_BLOCK, "_top"))
|
| 2645 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.GRASS_BLOCK, "_snow"));
|
| 2646 | MultiVariant snowyGrass = plainVariant(ModelTemplates.CUBE_BOTTOM_TOP.createWithSuffix(Blocks.GRASS_BLOCK, "_snow", snowyMapping, this.modelOutput));
|
| 2647 | Identifier plainGrassModel = ModelLocationUtils.getModelLocation(Blocks.GRASS_BLOCK);
|
| 2648 | this.createGrassLikeBlock(Blocks.GRASS_BLOCK, createRotatedVariants(plainModel(plainGrassModel)), snowyGrass);
|
| 2649 | this.registerSimpleTintedItemModel(Blocks.GRASS_BLOCK, plainGrassModel, new GrassColorSource());
|
| 2650 | MultiVariant myceliumModel = createRotatedVariants(
|
| 2651 | plainModel(
|
| 2652 | TexturedModel.CUBE_BOTTOM_TOP.get(Blocks.MYCELIUM).updateTextures(m -> m.put(TextureSlot.BOTTOM, bottomTexture)).create(Blocks.MYCELIUM, this.modelOutput)
|
| 2653 | )
|
| 2654 | );
|
| 2655 | this.createGrassLikeBlock(Blocks.MYCELIUM, myceliumModel, snowyGrass);
|
| 2656 | MultiVariant podzolModel = createRotatedVariants(
|
| 2657 | plainModel(
|
| 2658 | TexturedModel.CUBE_BOTTOM_TOP.get(Blocks.PODZOL).updateTextures(m -> m.put(TextureSlot.BOTTOM, bottomTexture)).create(Blocks.PODZOL, this.modelOutput)
|
| 2659 | )
|
| 2660 | );
|
| 2661 | this.createGrassLikeBlock(Blocks.PODZOL, podzolModel, snowyGrass);
|
| 2662 | }
|
| 2663 |
|
| 2664 | /**
|
| 2665 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2666 | */
|
| 2667 | public final void createGrassLikeBlock(final Block block, final MultiVariant normal, final MultiVariant snowy) {
|
| 2668 | this.blockStateOutput
|
| 2669 | .accept(MultiVariantGenerator.dispatch(block).with(PropertyDispatch.initial(BlockStateProperties.SNOWY).select(true, snowy).select(false, normal)));
|
| 2670 | }
|
| 2671 |
|
| 2672 | private void createCocoa() {
|
| 2673 | this.registerSimpleFlatItemModel(Items.COCOA_BEANS);
|
| 2674 | this.blockStateOutput
|
| 2675 | .accept(
|
| 2676 | MultiVariantGenerator.dispatch(Blocks.COCOA)
|
| 2677 | .with(
|
| 2678 | PropertyDispatch.initial(BlockStateProperties.AGE_2)
|
| 2679 | .select(0, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COCOA, "_stage0")))
|
| 2680 | .select(1, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COCOA, "_stage1")))
|
| 2681 | .select(2, plainVariant(ModelLocationUtils.getModelLocation(Blocks.COCOA, "_stage2")))
|
| 2682 | )
|
| 2683 | .with(ROTATION_HORIZONTAL_FACING_ALT)
|
| 2684 | );
|
| 2685 | }
|
| 2686 |
|
| 2687 | private void createShelfMushroom() {
|
| 2688 | Identifier shelfMushroom = ModelLocationUtils.getModelLocation(Blocks.SHELF_MUSHROOM, "_stage0");
|
| 2689 | this.registerSimpleItemModel(Blocks.SHELF_MUSHROOM, shelfMushroom);
|
| 2690 | this.blockStateOutput
|
| 2691 | .accept(
|
| 2692 | MultiVariantGenerator.dispatch(Blocks.SHELF_MUSHROOM)
|
| 2693 | .with(
|
| 2694 | PropertyDispatch.initial(BlockStateProperties.AGE_1)
|
| 2695 | .select(0, plainVariant(ModelLocationUtils.getModelLocation(Blocks.SHELF_MUSHROOM, "_stage0")))
|
| 2696 | .select(1, plainVariant(ModelLocationUtils.getModelLocation(Blocks.SHELF_MUSHROOM, "_stage1")))
|
| 2697 | )
|
| 2698 | .with(ROTATION_HORIZONTAL_FACING)
|
| 2699 | );
|
| 2700 | }
|
| 2701 |
|
| 2702 | /**
|
| 2703 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2704 | */
|
| 2705 | public final void createWeightedPressurePlate(final Block block, final Block appearance) {
|
| 2706 | TextureMapping textures = TextureMapping.defaultTexture(appearance);
|
| 2707 | MultiVariant up = plainVariant(ModelTemplates.PRESSURE_PLATE_UP.create(block, textures, this.modelOutput));
|
| 2708 | MultiVariant down = plainVariant(ModelTemplates.PRESSURE_PLATE_DOWN.create(block, textures, this.modelOutput));
|
| 2709 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(createEmptyOrFullDispatch(BlockStateProperties.POWER, 1, down, up)));
|
| 2710 | }
|
| 2711 |
|
| 2712 | private void createHopper() {
|
| 2713 | MultiVariant downBlock = plainVariant(ModelLocationUtils.getModelLocation(Blocks.HOPPER));
|
| 2714 | MultiVariant sideBlock = plainVariant(ModelLocationUtils.getModelLocation(Blocks.HOPPER, "_side"));
|
| 2715 | this.registerSimpleFlatItemModel(Items.HOPPER);
|
| 2716 | this.blockStateOutput
|
| 2717 | .accept(
|
| 2718 | MultiVariantGenerator.dispatch(Blocks.HOPPER)
|
| 2719 | .with(
|
| 2720 | PropertyDispatch.initial(BlockStateProperties.FACING_HOPPER)
|
| 2721 | .select(Direction.DOWN, downBlock)
|
| 2722 | .select(Direction.NORTH, sideBlock)
|
| 2723 | .select(Direction.EAST, sideBlock.with(Y_ROT_90))
|
| 2724 | .select(Direction.SOUTH, sideBlock.with(Y_ROT_180))
|
| 2725 | .select(Direction.WEST, sideBlock.with(Y_ROT_270))
|
| 2726 | )
|
| 2727 | );
|
| 2728 | }
|
| 2729 |
|
| 2730 | /**
|
| 2731 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2732 | */
|
| 2733 | public final void copyModel(final Block donor, final Block acceptor) {
|
| 2734 | MultiVariant model = plainVariant(ModelLocationUtils.getModelLocation(donor));
|
| 2735 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(acceptor, model));
|
| 2736 | this.itemModelOutput.copy(donor.asItem(), acceptor.asItem());
|
| 2737 | }
|
| 2738 |
|
| 2739 | /**
|
| 2740 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2741 | */
|
| 2742 | public final void createBarsAndItem(final Block block) {
|
| 2743 | TextureMapping textures = TextureMapping.bars(block);
|
| 2744 | this.createBars(
|
| 2745 | block,
|
| 2746 | ModelTemplates.BARS_POST_ENDS.create(block, textures, this.modelOutput),
|
| 2747 | ModelTemplates.BARS_POST.create(block, textures, this.modelOutput),
|
| 2748 | ModelTemplates.BARS_CAP.create(block, textures, this.modelOutput),
|
| 2749 | ModelTemplates.BARS_CAP_ALT.create(block, textures, this.modelOutput),
|
| 2750 | ModelTemplates.BARS_POST_SIDE.create(block, textures, this.modelOutput),
|
| 2751 | ModelTemplates.BARS_POST_SIDE_ALT.create(block, textures, this.modelOutput)
|
| 2752 | );
|
| 2753 | this.registerSimpleFlatItemModel(block);
|
| 2754 | }
|
| 2755 |
|
| 2756 | /**
|
| 2757 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2758 | */
|
| 2759 | public final void createBarsAndItem(final Block unwaxed, final Block waxed) {
|
| 2760 | TextureMapping textures = TextureMapping.bars(unwaxed);
|
| 2761 | Identifier postEndResource = ModelTemplates.BARS_POST_ENDS.create(unwaxed, textures, this.modelOutput);
|
| 2762 | Identifier postResource = ModelTemplates.BARS_POST.create(unwaxed, textures, this.modelOutput);
|
| 2763 | Identifier capResource = ModelTemplates.BARS_CAP.create(unwaxed, textures, this.modelOutput);
|
| 2764 | Identifier capAltResource = ModelTemplates.BARS_CAP_ALT.create(unwaxed, textures, this.modelOutput);
|
| 2765 | Identifier sideResource = ModelTemplates.BARS_POST_SIDE.create(unwaxed, textures, this.modelOutput);
|
| 2766 | Identifier sideAltResource = ModelTemplates.BARS_POST_SIDE_ALT.create(unwaxed, textures, this.modelOutput);
|
| 2767 | this.createBars(unwaxed, postEndResource, postResource, capResource, capAltResource, sideResource, sideAltResource);
|
| 2768 | this.createBars(waxed, postEndResource, postResource, capResource, capAltResource, sideResource, sideAltResource);
|
| 2769 | this.registerSimpleFlatItemModel(unwaxed);
|
| 2770 | this.itemModelOutput.copy(unwaxed.asItem(), waxed.asItem());
|
| 2771 | }
|
| 2772 |
|
| 2773 | /**
|
| 2774 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2775 | */
|
| 2776 | public final void createBars(
|
| 2777 | final Block block,
|
| 2778 | final Identifier postEndResource,
|
| 2779 | final Identifier postResource,
|
| 2780 | final Identifier capResource,
|
| 2781 | final Identifier capAltResource,
|
| 2782 | final Identifier sideResource,
|
| 2783 | final Identifier sideAltResource
|
| 2784 | ) {
|
| 2785 | MultiVariant postEnds = plainVariant(postEndResource);
|
| 2786 | MultiVariant post = plainVariant(postResource);
|
| 2787 | MultiVariant cap = plainVariant(capResource);
|
| 2788 | MultiVariant capAlt = plainVariant(capAltResource);
|
| 2789 | MultiVariant side = plainVariant(sideResource);
|
| 2790 | MultiVariant sideAlt = plainVariant(sideAltResource);
|
| 2791 | this.blockStateOutput
|
| 2792 | .accept(
|
| 2793 | MultiPartGenerator.multiPart(block)
|
| 2794 | .with(postEnds)
|
| 2795 | .with(
|
| 2796 | condition()
|
| 2797 | .term(BlockStateProperties.NORTH, false)
|
| 2798 | .term(BlockStateProperties.EAST, false)
|
| 2799 | .term(BlockStateProperties.SOUTH, false)
|
| 2800 | .term(BlockStateProperties.WEST, false),
|
| 2801 | post
|
| 2802 | )
|
| 2803 | .with(
|
| 2804 | condition()
|
| 2805 | .term(BlockStateProperties.NORTH, true)
|
| 2806 | .term(BlockStateProperties.EAST, false)
|
| 2807 | .term(BlockStateProperties.SOUTH, false)
|
| 2808 | .term(BlockStateProperties.WEST, false),
|
| 2809 | cap
|
| 2810 | )
|
| 2811 | .with(
|
| 2812 | condition()
|
| 2813 | .term(BlockStateProperties.NORTH, false)
|
| 2814 | .term(BlockStateProperties.EAST, true)
|
| 2815 | .term(BlockStateProperties.SOUTH, false)
|
| 2816 | .term(BlockStateProperties.WEST, false),
|
| 2817 | cap.with(Y_ROT_90)
|
| 2818 | )
|
| 2819 | .with(
|
| 2820 | condition()
|
| 2821 | .term(BlockStateProperties.NORTH, false)
|
| 2822 | .term(BlockStateProperties.EAST, false)
|
| 2823 | .term(BlockStateProperties.SOUTH, true)
|
| 2824 | .term(BlockStateProperties.WEST, false),
|
| 2825 | capAlt
|
| 2826 | )
|
| 2827 | .with(
|
| 2828 | condition()
|
| 2829 | .term(BlockStateProperties.NORTH, false)
|
| 2830 | .term(BlockStateProperties.EAST, false)
|
| 2831 | .term(BlockStateProperties.SOUTH, false)
|
| 2832 | .term(BlockStateProperties.WEST, true),
|
| 2833 | capAlt.with(Y_ROT_90)
|
| 2834 | )
|
| 2835 | .with(condition().term(BlockStateProperties.NORTH, true), side)
|
| 2836 | .with(condition().term(BlockStateProperties.EAST, true), side.with(Y_ROT_90))
|
| 2837 | .with(condition().term(BlockStateProperties.SOUTH, true), sideAlt)
|
| 2838 | .with(condition().term(BlockStateProperties.WEST, true), sideAlt.with(Y_ROT_90))
|
| 2839 | );
|
| 2840 | }
|
| 2841 |
|
| 2842 | /**
|
| 2843 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2844 | */
|
| 2845 | public final void createNonTemplateHorizontalBlock(final Block block) {
|
| 2846 | this.blockStateOutput
|
| 2847 | .accept(MultiVariantGenerator.dispatch(block, plainVariant(ModelLocationUtils.getModelLocation(block))).with(ROTATION_HORIZONTAL_FACING));
|
| 2848 | }
|
| 2849 |
|
| 2850 | private void createLever() {
|
| 2851 | MultiVariant off = plainVariant(ModelLocationUtils.getModelLocation(Blocks.LEVER));
|
| 2852 | MultiVariant on = plainVariant(ModelLocationUtils.getModelLocation(Blocks.LEVER, "_on"));
|
| 2853 | this.registerSimpleFlatItemModel(Blocks.LEVER);
|
| 2854 | this.blockStateOutput
|
| 2855 | .accept(
|
| 2856 | MultiVariantGenerator.dispatch(Blocks.LEVER)
|
| 2857 | .with(createBooleanModelDispatch(BlockStateProperties.POWERED, off, on))
|
| 2858 | .with(
|
| 2859 | PropertyDispatch.modify(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING)
|
| 2860 | .select(AttachFace.CEILING, Direction.NORTH, X_ROT_180.then(Y_ROT_180))
|
| 2861 | .select(AttachFace.CEILING, Direction.EAST, X_ROT_180.then(Y_ROT_270))
|
| 2862 | .select(AttachFace.CEILING, Direction.SOUTH, X_ROT_180)
|
| 2863 | .select(AttachFace.CEILING, Direction.WEST, X_ROT_180.then(Y_ROT_90))
|
| 2864 | .select(AttachFace.FLOOR, Direction.NORTH, NOP)
|
| 2865 | .select(AttachFace.FLOOR, Direction.EAST, Y_ROT_90)
|
| 2866 | .select(AttachFace.FLOOR, Direction.SOUTH, Y_ROT_180)
|
| 2867 | .select(AttachFace.FLOOR, Direction.WEST, Y_ROT_270)
|
| 2868 | .select(AttachFace.WALL, Direction.NORTH, X_ROT_90)
|
| 2869 | .select(AttachFace.WALL, Direction.EAST, X_ROT_90.then(Y_ROT_90))
|
| 2870 | .select(AttachFace.WALL, Direction.SOUTH, X_ROT_90.then(Y_ROT_180))
|
| 2871 | .select(AttachFace.WALL, Direction.WEST, X_ROT_90.then(Y_ROT_270))
|
| 2872 | )
|
| 2873 | );
|
| 2874 | }
|
| 2875 |
|
| 2876 | private void createLilyPad() {
|
| 2877 | Identifier itemModel = this.createFlatItemModelWithBlockTexture(Items.LILY_PAD, Blocks.LILY_PAD);
|
| 2878 | this.registerSimpleTintedItemModel(Blocks.LILY_PAD, itemModel, ItemModelUtils.constantTint(-9321636));
|
| 2879 | this.createRotatedVariantBlock(Blocks.LILY_PAD, ModelLocationUtils.getModelLocation(Blocks.LILY_PAD));
|
| 2880 | }
|
| 2881 |
|
| 2882 | private void createFrogspawnBlock() {
|
| 2883 | this.registerSimpleFlatItemModel(Blocks.FROGSPAWN);
|
| 2884 | this.blockStateOutput.accept(createSimpleBlock(Blocks.FROGSPAWN, plainVariant(ModelLocationUtils.getModelLocation(Blocks.FROGSPAWN))));
|
| 2885 | }
|
| 2886 |
|
| 2887 | private void createNetherPortalBlock() {
|
| 2888 | this.blockStateOutput
|
| 2889 | .accept(
|
| 2890 | MultiVariantGenerator.dispatch(Blocks.NETHER_PORTAL)
|
| 2891 | .with(
|
| 2892 | PropertyDispatch.initial(BlockStateProperties.HORIZONTAL_AXIS)
|
| 2893 | .select(Axis.X, plainVariant(ModelLocationUtils.getModelLocation(Blocks.NETHER_PORTAL, "_ns")))
|
| 2894 | .select(Axis.Z, plainVariant(ModelLocationUtils.getModelLocation(Blocks.NETHER_PORTAL, "_ew")))
|
| 2895 | )
|
| 2896 | );
|
| 2897 | }
|
| 2898 |
|
| 2899 | private void createNetherrack() {
|
| 2900 | net.minecraft.client.renderer.block.dispatch.Variant model = plainModel(TexturedModel.CUBE.create(Blocks.NETHERRACK, this.modelOutput));
|
| 2901 | this.blockStateOutput
|
| 2902 | .accept(
|
| 2903 | MultiVariantGenerator.dispatch(
|
| 2904 | Blocks.NETHERRACK,
|
| 2905 | variants(
|
| 2906 | model,
|
| 2907 | model.with(X_ROT_90),
|
| 2908 | model.with(X_ROT_180),
|
| 2909 | model.with(X_ROT_270),
|
| 2910 | model.with(Y_ROT_90),
|
| 2911 | model.with(Y_ROT_90.then(X_ROT_90)),
|
| 2912 | model.with(Y_ROT_90.then(X_ROT_180)),
|
| 2913 | model.with(Y_ROT_90.then(X_ROT_270)),
|
| 2914 | model.with(Y_ROT_180),
|
| 2915 | model.with(Y_ROT_180.then(X_ROT_90)),
|
| 2916 | model.with(Y_ROT_180.then(X_ROT_180)),
|
| 2917 | model.with(Y_ROT_180.then(X_ROT_270)),
|
| 2918 | model.with(Y_ROT_270),
|
| 2919 | model.with(Y_ROT_270.then(X_ROT_90)),
|
| 2920 | model.with(Y_ROT_270.then(X_ROT_180)),
|
| 2921 | model.with(Y_ROT_270.then(X_ROT_270))
|
| 2922 | )
|
| 2923 | )
|
| 2924 | );
|
| 2925 | }
|
| 2926 |
|
| 2927 | private void createObserver() {
|
| 2928 | MultiVariant off = plainVariant(ModelLocationUtils.getModelLocation(Blocks.OBSERVER));
|
| 2929 | MultiVariant on = plainVariant(ModelLocationUtils.getModelLocation(Blocks.OBSERVER, "_on"));
|
| 2930 | this.blockStateOutput
|
| 2931 | .accept(MultiVariantGenerator.dispatch(Blocks.OBSERVER).with(createBooleanModelDispatch(BlockStateProperties.POWERED, on, off)).with(ROTATION_FACING));
|
| 2932 | }
|
| 2933 |
|
| 2934 | private void createPistons() {
|
| 2935 | TextureMapping commonMapping = new TextureMapping()
|
| 2936 | .put(TextureSlot.BOTTOM, TextureMapping.getBlockTexture(Blocks.PISTON, "_bottom"))
|
| 2937 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.PISTON, "_side"));
|
| 2938 | Material topSticky = TextureMapping.getBlockTexture(Blocks.PISTON, "_top_sticky");
|
| 2939 | Material top = TextureMapping.getBlockTexture(Blocks.PISTON, "_top");
|
| 2940 | TextureMapping stickyTextures = commonMapping.copyAndUpdate(TextureSlot.PLATFORM, topSticky);
|
| 2941 | TextureMapping normalTextures = commonMapping.copyAndUpdate(TextureSlot.PLATFORM, top);
|
| 2942 | MultiVariant extendedPiston = plainVariant(ModelLocationUtils.getModelLocation(Blocks.PISTON, "_base"));
|
| 2943 | this.createPistonVariant(Blocks.PISTON, extendedPiston, normalTextures);
|
| 2944 | this.createPistonVariant(Blocks.STICKY_PISTON, extendedPiston, stickyTextures);
|
| 2945 | Identifier normalInventory = ModelTemplates.CUBE_BOTTOM_TOP
|
| 2946 | .createWithSuffix(Blocks.PISTON, "_inventory", commonMapping.copyAndUpdate(TextureSlot.TOP, top), this.modelOutput);
|
| 2947 | Identifier stickyInventory = ModelTemplates.CUBE_BOTTOM_TOP
|
| 2948 | .createWithSuffix(Blocks.STICKY_PISTON, "_inventory", commonMapping.copyAndUpdate(TextureSlot.TOP, topSticky), this.modelOutput);
|
| 2949 | this.registerSimpleItemModel(Blocks.PISTON, normalInventory);
|
| 2950 | this.registerSimpleItemModel(Blocks.STICKY_PISTON, stickyInventory);
|
| 2951 | }
|
| 2952 |
|
| 2953 | /**
|
| 2954 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 2955 | */
|
| 2956 | public final void createPistonVariant(final Block block, final MultiVariant extended, final TextureMapping textures) {
|
| 2957 | MultiVariant retracted = plainVariant(ModelTemplates.PISTON.create(block, textures, this.modelOutput));
|
| 2958 | this.blockStateOutput
|
| 2959 | .accept(MultiVariantGenerator.dispatch(block).with(createBooleanModelDispatch(BlockStateProperties.EXTENDED, extended, retracted)).with(ROTATION_FACING));
|
| 2960 | }
|
| 2961 |
|
| 2962 | private void createPistonHeads() {
|
| 2963 | TextureMapping commonMapping = new TextureMapping()
|
| 2964 | .put(TextureSlot.UNSTICKY, TextureMapping.getBlockTexture(Blocks.PISTON, "_top"))
|
| 2965 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.PISTON, "_side"));
|
| 2966 | TextureMapping stickyTextures = commonMapping.copyAndUpdate(TextureSlot.PLATFORM, TextureMapping.getBlockTexture(Blocks.PISTON, "_top_sticky"));
|
| 2967 | TextureMapping normalTextures = commonMapping.copyAndUpdate(TextureSlot.PLATFORM, TextureMapping.getBlockTexture(Blocks.PISTON, "_top"));
|
| 2968 | this.blockStateOutput
|
| 2969 | .accept(
|
| 2970 | MultiVariantGenerator.dispatch(Blocks.PISTON_HEAD)
|
| 2971 | .with(
|
| 2972 | PropertyDispatch.initial(BlockStateProperties.SHORT, BlockStateProperties.PISTON_TYPE)
|
| 2973 | .select(false, PistonType.DEFAULT, plainVariant(ModelTemplates.PISTON_HEAD.createWithSuffix(Blocks.PISTON, "_head", normalTextures, this.modelOutput)))
|
| 2974 | .select(
|
| 2975 | false, PistonType.STICKY, plainVariant(ModelTemplates.PISTON_HEAD.createWithSuffix(Blocks.PISTON, "_head_sticky", stickyTextures, this.modelOutput))
|
| 2976 | )
|
| 2977 | .select(
|
| 2978 | true,
|
| 2979 | PistonType.DEFAULT,
|
| 2980 | plainVariant(ModelTemplates.PISTON_HEAD_SHORT.createWithSuffix(Blocks.PISTON, "_head_short", normalTextures, this.modelOutput))
|
| 2981 | )
|
| 2982 | .select(
|
| 2983 | true,
|
| 2984 | PistonType.STICKY,
|
| 2985 | plainVariant(ModelTemplates.PISTON_HEAD_SHORT.createWithSuffix(Blocks.PISTON, "_head_short_sticky", stickyTextures, this.modelOutput))
|
| 2986 | )
|
| 2987 | )
|
| 2988 | .with(ROTATION_FACING)
|
| 2989 | );
|
| 2990 | }
|
| 2991 |
|
| 2992 | private void createTrialSpawner() {
|
| 2993 | Block block = Blocks.TRIAL_SPAWNER;
|
| 2994 | TextureMapping inactiveTextures = TextureMapping.trialSpawner(block, "_side_inactive", "_top_inactive");
|
| 2995 | TextureMapping activeTextures = TextureMapping.trialSpawner(block, "_side_active", "_top_active");
|
| 2996 | TextureMapping ejectingRewardTextures = TextureMapping.trialSpawner(block, "_side_active", "_top_ejecting_reward");
|
| 2997 | TextureMapping ominousInactiveTextures = TextureMapping.trialSpawner(block, "_side_inactive_ominous", "_top_inactive_ominous");
|
| 2998 | TextureMapping ominousActiveTextures = TextureMapping.trialSpawner(block, "_side_active_ominous", "_top_active_ominous");
|
| 2999 | TextureMapping ominousEjectingRewardTextures = TextureMapping.trialSpawner(block, "_side_active_ominous", "_top_ejecting_reward_ominous");
|
| 3000 | Identifier inactiveModel = ModelTemplates.CUBE_BOTTOM_TOP_INNER_FACES.create(block, inactiveTextures, this.modelOutput);
|
| 3001 | MultiVariant inactive = plainVariant(inactiveModel);
|
| 3002 | MultiVariant active = plainVariant(ModelTemplates.CUBE_BOTTOM_TOP_INNER_FACES.createWithSuffix(block, "_active", activeTextures, this.modelOutput));
|
| 3003 | MultiVariant ejectingReward = plainVariant(
|
| 3004 | ModelTemplates.CUBE_BOTTOM_TOP_INNER_FACES.createWithSuffix(block, "_ejecting_reward", ejectingRewardTextures, this.modelOutput)
|
| 3005 | );
|
| 3006 | MultiVariant ominousInactive = plainVariant(
|
| 3007 | ModelTemplates.CUBE_BOTTOM_TOP_INNER_FACES.createWithSuffix(block, "_inactive_ominous", ominousInactiveTextures, this.modelOutput)
|
| 3008 | );
|
| 3009 | MultiVariant ominousActive = plainVariant(
|
| 3010 | ModelTemplates.CUBE_BOTTOM_TOP_INNER_FACES.createWithSuffix(block, "_active_ominous", ominousActiveTextures, this.modelOutput)
|
| 3011 | );
|
| 3012 | MultiVariant ominousEjectingReward = plainVariant(
|
| 3013 | ModelTemplates.CUBE_BOTTOM_TOP_INNER_FACES.createWithSuffix(block, "_ejecting_reward_ominous", ominousEjectingRewardTextures, this.modelOutput)
|
| 3014 | );
|
| 3015 | this.registerSimpleItemModel(block, inactiveModel);
|
| 3016 | this.blockStateOutput
|
| 3017 | .accept(
|
| 3018 | MultiVariantGenerator.dispatch(block)
|
| 3019 | .with(PropertyDispatch.initial(BlockStateProperties.TRIAL_SPAWNER_STATE, BlockStateProperties.OMINOUS).generate((state, ominous) -> {
|
| 3020 | return switch (state) {
|
| 3021 | case INACTIVE, COOLDOWN -> ominous ? ominousInactive : inactive;
|
| 3022 | case WAITING_FOR_PLAYERS, ACTIVE, WAITING_FOR_REWARD_EJECTION -> ominous ? ominousActive : active;
|
| 3023 | case EJECTING_REWARD -> ominous ? ominousEjectingReward : ejectingReward;
|
| 3024 | };
|
| 3025 | }))
|
| 3026 | );
|
| 3027 | }
|
| 3028 |
|
| 3029 | private void createVault() {
|
| 3030 | Block block = Blocks.VAULT;
|
| 3031 | TextureMapping inactiveTextures = TextureMapping.vault(block, "_front_off", "_side_off", "_top", "_bottom");
|
| 3032 | TextureMapping activeTextures = TextureMapping.vault(block, "_front_on", "_side_on", "_top", "_bottom");
|
| 3033 | TextureMapping unlockingTextures = TextureMapping.vault(block, "_front_ejecting", "_side_on", "_top", "_bottom");
|
| 3034 | TextureMapping ejectingRewardTextures = TextureMapping.vault(block, "_front_ejecting", "_side_on", "_top_ejecting", "_bottom");
|
| 3035 | Identifier inactiveModel = ModelTemplates.VAULT.create(block, inactiveTextures, this.modelOutput);
|
| 3036 | MultiVariant inactive = plainVariant(inactiveModel);
|
| 3037 | MultiVariant active = plainVariant(ModelTemplates.VAULT.createWithSuffix(block, "_active", activeTextures, this.modelOutput));
|
| 3038 | MultiVariant unlocking = plainVariant(ModelTemplates.VAULT.createWithSuffix(block, "_unlocking", unlockingTextures, this.modelOutput));
|
| 3039 | MultiVariant ejectingReward = plainVariant(ModelTemplates.VAULT.createWithSuffix(block, "_ejecting_reward", ejectingRewardTextures, this.modelOutput));
|
| 3040 | TextureMapping inactiveTexturesOminous = TextureMapping.vault(block, "_front_off_ominous", "_side_off_ominous", "_top_ominous", "_bottom_ominous");
|
| 3041 | TextureMapping activeTexturesOminous = TextureMapping.vault(block, "_front_on_ominous", "_side_on_ominous", "_top_ominous", "_bottom_ominous");
|
| 3042 | TextureMapping unlockingTexturesOminous = TextureMapping.vault(block, "_front_ejecting_ominous", "_side_on_ominous", "_top_ominous", "_bottom_ominous");
|
| 3043 | TextureMapping ejectingRewardTexturesOminous = TextureMapping.vault(
|
| 3044 | block, "_front_ejecting_ominous", "_side_on_ominous", "_top_ejecting_ominous", "_bottom_ominous"
|
| 3045 | );
|
| 3046 | MultiVariant inactiveOminous = plainVariant(ModelTemplates.VAULT.createWithSuffix(block, "_ominous", inactiveTexturesOminous, this.modelOutput));
|
| 3047 | MultiVariant activeOminous = plainVariant(ModelTemplates.VAULT.createWithSuffix(block, "_active_ominous", activeTexturesOminous, this.modelOutput));
|
| 3048 | MultiVariant unlockingOminous = plainVariant(ModelTemplates.VAULT.createWithSuffix(block, "_unlocking_ominous", unlockingTexturesOminous, this.modelOutput));
|
| 3049 | MultiVariant ejectingRewardOminous = plainVariant(
|
| 3050 | ModelTemplates.VAULT.createWithSuffix(block, "_ejecting_reward_ominous", ejectingRewardTexturesOminous, this.modelOutput)
|
| 3051 | );
|
| 3052 | this.registerSimpleItemModel(block, inactiveModel);
|
| 3053 | this.blockStateOutput
|
| 3054 | .accept(MultiVariantGenerator.dispatch(block).with(PropertyDispatch.initial(VaultBlock.STATE, VaultBlock.OMINOUS).generate((state, ominous) -> {
|
| 3055 | return switch (state) {
|
| 3056 | case INACTIVE -> ominous ? inactiveOminous : inactive;
|
| 3057 | case ACTIVE -> ominous ? activeOminous : active;
|
| 3058 | case UNLOCKING -> ominous ? unlockingOminous : unlocking;
|
| 3059 | case EJECTING -> ominous ? ejectingRewardOminous : ejectingReward;
|
| 3060 | };
|
| 3061 | })).with(ROTATION_HORIZONTAL_FACING));
|
| 3062 | }
|
| 3063 |
|
| 3064 | private void createSculkSensor() {
|
| 3065 | Identifier inactiveModel = ModelLocationUtils.getModelLocation(Blocks.SCULK_SENSOR, "_inactive");
|
| 3066 | MultiVariant inactive = plainVariant(inactiveModel);
|
| 3067 | MultiVariant active = plainVariant(ModelLocationUtils.getModelLocation(Blocks.SCULK_SENSOR, "_active"));
|
| 3068 | this.registerSimpleItemModel(Blocks.SCULK_SENSOR, inactiveModel);
|
| 3069 | this.blockStateOutput
|
| 3070 | .accept(
|
| 3071 | MultiVariantGenerator.dispatch(Blocks.SCULK_SENSOR)
|
| 3072 | .with(
|
| 3073 | PropertyDispatch.initial(BlockStateProperties.SCULK_SENSOR_PHASE)
|
| 3074 | .generate(phase -> phase != SculkSensorPhase.ACTIVE && phase != SculkSensorPhase.COOLDOWN ? inactive : active)
|
| 3075 | )
|
| 3076 | );
|
| 3077 | }
|
| 3078 |
|
| 3079 | private void createCalibratedSculkSensor() {
|
| 3080 | Identifier inactiveModel = ModelLocationUtils.getModelLocation(Blocks.CALIBRATED_SCULK_SENSOR, "_inactive");
|
| 3081 | MultiVariant inactive = plainVariant(inactiveModel);
|
| 3082 | MultiVariant active = plainVariant(ModelLocationUtils.getModelLocation(Blocks.CALIBRATED_SCULK_SENSOR, "_active"));
|
| 3083 | this.registerSimpleItemModel(Blocks.CALIBRATED_SCULK_SENSOR, inactiveModel);
|
| 3084 | this.blockStateOutput
|
| 3085 | .accept(
|
| 3086 | MultiVariantGenerator.dispatch(Blocks.CALIBRATED_SCULK_SENSOR)
|
| 3087 | .with(
|
| 3088 | PropertyDispatch.initial(BlockStateProperties.SCULK_SENSOR_PHASE)
|
| 3089 | .generate(phase -> phase != SculkSensorPhase.ACTIVE && phase != SculkSensorPhase.COOLDOWN ? inactive : active)
|
| 3090 | )
|
| 3091 | .with(ROTATION_HORIZONTAL_FACING)
|
| 3092 | );
|
| 3093 | }
|
| 3094 |
|
| 3095 | private void createSculkShrieker() {
|
| 3096 | Identifier sculkShriekerModel = ModelTemplates.SCULK_SHRIEKER.create(Blocks.SCULK_SHRIEKER, TextureMapping.sculkShrieker(false), this.modelOutput);
|
| 3097 | MultiVariant sculkShrieker = plainVariant(sculkShriekerModel);
|
| 3098 | MultiVariant sculkShriekerCanSummon = plainVariant(
|
| 3099 | ModelTemplates.SCULK_SHRIEKER.createWithSuffix(Blocks.SCULK_SHRIEKER, "_can_summon", TextureMapping.sculkShrieker(true), this.modelOutput)
|
| 3100 | );
|
| 3101 | this.registerSimpleItemModel(Blocks.SCULK_SHRIEKER, sculkShriekerModel);
|
| 3102 | this.blockStateOutput
|
| 3103 | .accept(
|
| 3104 | MultiVariantGenerator.dispatch(Blocks.SCULK_SHRIEKER)
|
| 3105 | .with(createBooleanModelDispatch(BlockStateProperties.CAN_SUMMON, sculkShriekerCanSummon, sculkShrieker))
|
| 3106 | );
|
| 3107 | }
|
| 3108 |
|
| 3109 | private void createScaffolding() {
|
| 3110 | Identifier stableModel = ModelLocationUtils.getModelLocation(Blocks.SCAFFOLDING, "_stable");
|
| 3111 | MultiVariant stable = plainVariant(stableModel);
|
| 3112 | MultiVariant unstable = plainVariant(ModelLocationUtils.getModelLocation(Blocks.SCAFFOLDING, "_unstable"));
|
| 3113 | this.registerSimpleItemModel(Blocks.SCAFFOLDING, stableModel);
|
| 3114 | this.blockStateOutput
|
| 3115 | .accept(MultiVariantGenerator.dispatch(Blocks.SCAFFOLDING).with(createBooleanModelDispatch(BlockStateProperties.BOTTOM, unstable, stable)));
|
| 3116 | }
|
| 3117 |
|
| 3118 | private void createCaveVines() {
|
| 3119 | MultiVariant offHead = plainVariant(this.createSuffixedVariant(Blocks.CAVE_VINES, "", ModelTemplates.CROSS, TextureMapping::cross));
|
| 3120 | MultiVariant onHead = plainVariant(this.createSuffixedVariant(Blocks.CAVE_VINES, "_lit", ModelTemplates.CROSS, TextureMapping::cross));
|
| 3121 | this.blockStateOutput
|
| 3122 | .accept(MultiVariantGenerator.dispatch(Blocks.CAVE_VINES).with(createBooleanModelDispatch(BlockStateProperties.BERRIES, onHead, offHead)));
|
| 3123 | MultiVariant offBody = plainVariant(this.createSuffixedVariant(Blocks.CAVE_VINES_PLANT, "", ModelTemplates.CROSS, TextureMapping::cross));
|
| 3124 | MultiVariant onBody = plainVariant(this.createSuffixedVariant(Blocks.CAVE_VINES_PLANT, "_lit", ModelTemplates.CROSS, TextureMapping::cross));
|
| 3125 | this.blockStateOutput
|
| 3126 | .accept(MultiVariantGenerator.dispatch(Blocks.CAVE_VINES_PLANT).with(createBooleanModelDispatch(BlockStateProperties.BERRIES, onBody, offBody)));
|
| 3127 | }
|
| 3128 |
|
| 3129 | private void createRedstoneLamp() {
|
| 3130 | MultiVariant off = plainVariant(TexturedModel.CUBE.create(Blocks.REDSTONE_LAMP, this.modelOutput));
|
| 3131 | MultiVariant on = plainVariant(this.createSuffixedVariant(Blocks.REDSTONE_LAMP, "_on", ModelTemplates.CUBE_ALL, TextureMapping::cube));
|
| 3132 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(Blocks.REDSTONE_LAMP).with(createBooleanModelDispatch(BlockStateProperties.LIT, on, off)));
|
| 3133 | }
|
| 3134 |
|
| 3135 | /**
|
| 3136 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3137 | */
|
| 3138 | public final void createNormalTorch(final Block ground, final Block wall) {
|
| 3139 | TextureMapping textures = TextureMapping.torch(ground);
|
| 3140 | this.blockStateOutput.accept(createSimpleBlock(ground, plainVariant(ModelTemplates.TORCH.create(ground, textures, this.modelOutput))));
|
| 3141 | this.blockStateOutput
|
| 3142 | .accept(MultiVariantGenerator.dispatch(wall, plainVariant(ModelTemplates.WALL_TORCH.create(wall, textures, this.modelOutput))).with(ROTATION_TORCH));
|
| 3143 | this.registerSimpleFlatItemModel(ground);
|
| 3144 | }
|
| 3145 |
|
| 3146 | private void createRedstoneTorch() {
|
| 3147 | TextureMapping onTextures = TextureMapping.torch(Blocks.REDSTONE_TORCH);
|
| 3148 | TextureMapping offTextures = TextureMapping.torch(TextureMapping.getBlockTexture(Blocks.REDSTONE_TORCH, "_off"));
|
| 3149 | MultiVariant groundModelOn = plainVariant(ModelTemplates.REDSTONE_TORCH.create(Blocks.REDSTONE_TORCH, onTextures, this.modelOutput));
|
| 3150 | MultiVariant groundModelOff = plainVariant(ModelTemplates.TORCH_UNLIT.createWithSuffix(Blocks.REDSTONE_TORCH, "_off", offTextures, this.modelOutput));
|
| 3151 | this.blockStateOutput
|
| 3152 | .accept(MultiVariantGenerator.dispatch(Blocks.REDSTONE_TORCH).with(createBooleanModelDispatch(BlockStateProperties.LIT, groundModelOn, groundModelOff)));
|
| 3153 | MultiVariant wallModelOn = plainVariant(ModelTemplates.REDSTONE_WALL_TORCH.create(Blocks.REDSTONE_WALL_TORCH, onTextures, this.modelOutput));
|
| 3154 | MultiVariant wallModelOff = plainVariant(ModelTemplates.WALL_TORCH_UNLIT.createWithSuffix(Blocks.REDSTONE_WALL_TORCH, "_off", offTextures, this.modelOutput));
|
| 3155 | this.blockStateOutput
|
| 3156 | .accept(
|
| 3157 | MultiVariantGenerator.dispatch(Blocks.REDSTONE_WALL_TORCH)
|
| 3158 | .with(createBooleanModelDispatch(BlockStateProperties.LIT, wallModelOn, wallModelOff))
|
| 3159 | .with(ROTATION_TORCH)
|
| 3160 | );
|
| 3161 | this.registerSimpleFlatItemModel(Blocks.REDSTONE_TORCH);
|
| 3162 | }
|
| 3163 |
|
| 3164 | private void createRepeater() {
|
| 3165 | this.registerSimpleFlatItemModel(Items.REPEATER);
|
| 3166 | this.blockStateOutput
|
| 3167 | .accept(
|
| 3168 | MultiVariantGenerator.dispatch(Blocks.REPEATER)
|
| 3169 | .with(
|
| 3170 | PropertyDispatch.initial(BlockStateProperties.DELAY, BlockStateProperties.LOCKED, BlockStateProperties.POWERED).generate((delay, locked, powered) -> {
|
| 3171 | StringBuilder suffix = new StringBuilder();
|
| 3172 | suffix.append('_').append(delay).append("tick");
|
| 3173 | if (powered) {
|
| 3174 | suffix.append("_on");
|
| 3175 | }
|
| 3176 |
|
| 3177 | if (locked) {
|
| 3178 | suffix.append("_locked");
|
| 3179 | }
|
| 3180 |
|
| 3181 | return plainVariant(ModelLocationUtils.getModelLocation(Blocks.REPEATER, suffix.toString()));
|
| 3182 | })
|
| 3183 | )
|
| 3184 | .with(ROTATION_HORIZONTAL_FACING_ALT)
|
| 3185 | );
|
| 3186 | }
|
| 3187 |
|
| 3188 | private void createSeaPickle() {
|
| 3189 | this.registerSimpleFlatItemModel(Items.SEA_PICKLE);
|
| 3190 | this.blockStateOutput
|
| 3191 | .accept(
|
| 3192 | MultiVariantGenerator.dispatch(Blocks.SEA_PICKLE)
|
| 3193 | .with(
|
| 3194 | PropertyDispatch.initial(BlockStateProperties.PICKLES, BlockStateProperties.WATERLOGGED)
|
| 3195 | .select(1, false, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("dead_sea_pickle"))))
|
| 3196 | .select(2, false, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("two_dead_sea_pickles"))))
|
| 3197 | .select(3, false, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("three_dead_sea_pickles"))))
|
| 3198 | .select(4, false, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("four_dead_sea_pickles"))))
|
| 3199 | .select(1, true, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("sea_pickle"))))
|
| 3200 | .select(2, true, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("two_sea_pickles"))))
|
| 3201 | .select(3, true, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("three_sea_pickles"))))
|
| 3202 | .select(4, true, createRotatedVariants(plainModel(ModelLocationUtils.decorateBlockModelLocation("four_sea_pickles"))))
|
| 3203 | )
|
| 3204 | );
|
| 3205 | }
|
| 3206 |
|
| 3207 | private void createSnowBlocks() {
|
| 3208 | TextureMapping textures = TextureMapping.cube(Blocks.SNOW);
|
| 3209 | MultiVariant snowModel = plainVariant(ModelTemplates.CUBE_ALL.create(Blocks.SNOW_BLOCK, textures, this.modelOutput));
|
| 3210 | this.blockStateOutput
|
| 3211 | .accept(
|
| 3212 | MultiVariantGenerator.dispatch(Blocks.SNOW)
|
| 3213 | .with(
|
| 3214 | PropertyDispatch.initial(BlockStateProperties.LAYERS)
|
| 3215 | .generate(level -> level < 8 ? plainVariant(ModelLocationUtils.getModelLocation(Blocks.SNOW, "_height" + level * 2)) : snowModel)
|
| 3216 | )
|
| 3217 | );
|
| 3218 | this.registerSimpleItemModel(Blocks.SNOW, ModelLocationUtils.getModelLocation(Blocks.SNOW, "_height2"));
|
| 3219 | this.blockStateOutput.accept(createSimpleBlock(Blocks.SNOW_BLOCK, snowModel));
|
| 3220 | }
|
| 3221 |
|
| 3222 | private void createStonecutter() {
|
| 3223 | this.blockStateOutput
|
| 3224 | .accept(
|
| 3225 | MultiVariantGenerator.dispatch(Blocks.STONECUTTER, plainVariant(ModelLocationUtils.getModelLocation(Blocks.STONECUTTER))).with(ROTATION_HORIZONTAL_FACING)
|
| 3226 | );
|
| 3227 | }
|
| 3228 |
|
| 3229 | private void createStructureBlock() {
|
| 3230 | Identifier inventory = TexturedModel.CUBE.create(Blocks.STRUCTURE_BLOCK, this.modelOutput);
|
| 3231 | this.registerSimpleItemModel(Blocks.STRUCTURE_BLOCK, inventory);
|
| 3232 | this.blockStateOutput
|
| 3233 | .accept(
|
| 3234 | MultiVariantGenerator.dispatch(Blocks.STRUCTURE_BLOCK)
|
| 3235 | .with(
|
| 3236 | PropertyDispatch.initial(BlockStateProperties.STRUCTUREBLOCK_MODE)
|
| 3237 | .generate(
|
| 3238 | model -> plainVariant(
|
| 3239 | this.createSuffixedVariant(Blocks.STRUCTURE_BLOCK, "_" + model.getSerializedName(), ModelTemplates.CUBE_ALL, TextureMapping::cube)
|
| 3240 | )
|
| 3241 | )
|
| 3242 | )
|
| 3243 | );
|
| 3244 | }
|
| 3245 |
|
| 3246 | private void createTestBlock() {
|
| 3247 | Map<TestBlockMode, Identifier> variantIds = new HashMap<>();
|
| 3248 |
|
| 3249 | for (TestBlockMode mode : TestBlockMode.values()) {
|
| 3250 | variantIds.put(mode, this.createSuffixedVariant(Blocks.TEST_BLOCK, "_" + mode.getSerializedName(), ModelTemplates.CUBE_ALL, TextureMapping::cube));
|
| 3251 | }
|
| 3252 |
|
| 3253 | this.blockStateOutput
|
| 3254 | .accept(
|
| 3255 | MultiVariantGenerator.dispatch(Blocks.TEST_BLOCK)
|
| 3256 | .with(PropertyDispatch.initial(BlockStateProperties.TEST_BLOCK_MODE).generate(modex -> plainVariant(variantIds.get(modex))))
|
| 3257 | );
|
| 3258 | this.itemModelOutput
|
| 3259 | .accept(
|
| 3260 | Items.TEST_BLOCK,
|
| 3261 | ItemModelUtils.selectBlockItemProperty(
|
| 3262 | TestBlock.MODE,
|
| 3263 | ItemModelUtils.plainModel(variantIds.get(TestBlockMode.START)),
|
| 3264 | Map.of(
|
| 3265 | TestBlockMode.FAIL,
|
| 3266 | ItemModelUtils.plainModel(variantIds.get(TestBlockMode.FAIL)),
|
| 3267 | TestBlockMode.LOG,
|
| 3268 | ItemModelUtils.plainModel(variantIds.get(TestBlockMode.LOG)),
|
| 3269 | TestBlockMode.ACCEPT,
|
| 3270 | ItemModelUtils.plainModel(variantIds.get(TestBlockMode.ACCEPT))
|
| 3271 | )
|
| 3272 | )
|
| 3273 | );
|
| 3274 | }
|
| 3275 |
|
| 3276 | private void createSweetBerryBush() {
|
| 3277 | this.registerSimpleFlatItemModel(Items.SWEET_BERRIES);
|
| 3278 | this.blockStateOutput
|
| 3279 | .accept(
|
| 3280 | MultiVariantGenerator.dispatch(Blocks.SWEET_BERRY_BUSH)
|
| 3281 | .with(
|
| 3282 | PropertyDispatch.initial(BlockStateProperties.AGE_3)
|
| 3283 | .generate(age -> plainVariant(this.createSuffixedVariant(Blocks.SWEET_BERRY_BUSH, "_stage" + age, ModelTemplates.CROSS, TextureMapping::cross)))
|
| 3284 | )
|
| 3285 | );
|
| 3286 | }
|
| 3287 |
|
| 3288 | private void createTripwire() {
|
| 3289 | this.registerSimpleFlatItemModel(Items.STRING);
|
| 3290 | this.blockStateOutput
|
| 3291 | .accept(
|
| 3292 | MultiVariantGenerator.dispatch(Blocks.TRIPWIRE)
|
| 3293 | .with(
|
| 3294 | PropertyDispatch.initial(
|
| 3295 | BlockStateProperties.ATTACHED, BlockStateProperties.EAST, BlockStateProperties.NORTH, BlockStateProperties.SOUTH, BlockStateProperties.WEST
|
| 3296 | )
|
| 3297 | .select(false, false, false, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ns")))
|
| 3298 | .select(false, true, false, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")).with(Y_ROT_90))
|
| 3299 | .select(false, false, true, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")))
|
| 3300 | .select(false, false, false, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")).with(Y_ROT_180))
|
| 3301 | .select(false, false, false, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_n")).with(Y_ROT_270))
|
| 3302 | .select(false, true, true, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")))
|
| 3303 | .select(false, true, false, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")).with(Y_ROT_90))
|
| 3304 | .select(false, false, false, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")).with(Y_ROT_180))
|
| 3305 | .select(false, false, true, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ne")).with(Y_ROT_270))
|
| 3306 | .select(false, false, true, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ns")))
|
| 3307 | .select(false, true, false, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_ns")).with(Y_ROT_90))
|
| 3308 | .select(false, true, true, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")))
|
| 3309 | .select(false, true, false, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")).with(Y_ROT_90))
|
| 3310 | .select(false, false, true, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")).with(Y_ROT_180))
|
| 3311 | .select(false, true, true, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nse")).with(Y_ROT_270))
|
| 3312 | .select(false, true, true, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_nsew")))
|
| 3313 | .select(true, false, false, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ns")))
|
| 3314 | .select(true, false, true, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")))
|
| 3315 | .select(true, false, false, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")).with(Y_ROT_180))
|
| 3316 | .select(true, true, false, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")).with(Y_ROT_90))
|
| 3317 | .select(true, false, false, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_n")).with(Y_ROT_270))
|
| 3318 | .select(true, true, true, false, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")))
|
| 3319 | .select(true, true, false, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")).with(Y_ROT_90))
|
| 3320 | .select(true, false, false, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")).with(Y_ROT_180))
|
| 3321 | .select(true, false, true, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ne")).with(Y_ROT_270))
|
| 3322 | .select(true, false, true, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ns")))
|
| 3323 | .select(true, true, false, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_ns")).with(Y_ROT_90))
|
| 3324 | .select(true, true, true, true, false, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")))
|
| 3325 | .select(true, true, false, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")).with(Y_ROT_90))
|
| 3326 | .select(true, false, true, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")).with(Y_ROT_180))
|
| 3327 | .select(true, true, true, false, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nse")).with(Y_ROT_270))
|
| 3328 | .select(true, true, true, true, true, plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE, "_attached_nsew")))
|
| 3329 | )
|
| 3330 | );
|
| 3331 | }
|
| 3332 |
|
| 3333 | private void createTripwireHook() {
|
| 3334 | this.registerSimpleFlatItemModel(Blocks.TRIPWIRE_HOOK);
|
| 3335 | this.blockStateOutput
|
| 3336 | .accept(
|
| 3337 | MultiVariantGenerator.dispatch(Blocks.TRIPWIRE_HOOK)
|
| 3338 | .with(
|
| 3339 | PropertyDispatch.initial(BlockStateProperties.ATTACHED, BlockStateProperties.POWERED)
|
| 3340 | .generate(
|
| 3341 | (attached, powered) -> plainVariant(ModelLocationUtils.getModelLocation(Blocks.TRIPWIRE_HOOK, (attached ? "_attached" : "") + (powered ? "_on" : "")))
|
| 3342 | )
|
| 3343 | )
|
| 3344 | .with(ROTATION_HORIZONTAL_FACING)
|
| 3345 | );
|
| 3346 | }
|
| 3347 |
|
| 3348 | /**
|
| 3349 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3350 | */
|
| 3351 | public final net.minecraft.client.renderer.block.dispatch.Variant createTurtleEggModel(
|
| 3352 | final int count, final String hatchProgress, final TextureMapping texture
|
| 3353 | ) {
|
| 3354 | return switch (count) {
|
| 3355 | case 1 -> plainModel(
|
| 3356 | ModelTemplates.TURTLE_EGG.create(ModelLocationUtils.decorateBlockModelLocation(hatchProgress + "turtle_egg"), texture, this.modelOutput)
|
| 3357 | );
|
| 3358 | case 2 -> plainModel(
|
| 3359 | ModelTemplates.TWO_TURTLE_EGGS.create(ModelLocationUtils.decorateBlockModelLocation("two_" + hatchProgress + "turtle_eggs"), texture, this.modelOutput)
|
| 3360 | );
|
| 3361 | case 3 -> plainModel(
|
| 3362 | ModelTemplates.THREE_TURTLE_EGGS.create(ModelLocationUtils.decorateBlockModelLocation("three_" + hatchProgress + "turtle_eggs"), texture, this.modelOutput)
|
| 3363 | );
|
| 3364 | case 4 -> plainModel(
|
| 3365 | ModelTemplates.FOUR_TURTLE_EGGS.create(ModelLocationUtils.decorateBlockModelLocation("four_" + hatchProgress + "turtle_eggs"), texture, this.modelOutput)
|
| 3366 | );
|
| 3367 | default -> throw new UnsupportedOperationException();
|
| 3368 | };
|
| 3369 | }
|
| 3370 |
|
| 3371 | /**
|
| 3372 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3373 | */
|
| 3374 | public final net.minecraft.client.renderer.block.dispatch.Variant createTurtleEggModel(final int eggs, final int hatch) {
|
| 3375 | return switch (hatch) {
|
| 3376 | case 0 -> this.createTurtleEggModel(eggs, "", TextureMapping.cube(TextureMapping.getBlockTexture(Blocks.TURTLE_EGG)));
|
| 3377 | case 1 -> this.createTurtleEggModel(eggs, "slightly_cracked_", TextureMapping.cube(TextureMapping.getBlockTexture(Blocks.TURTLE_EGG, "_slightly_cracked")));
|
| 3378 | case 2 -> this.createTurtleEggModel(eggs, "very_cracked_", TextureMapping.cube(TextureMapping.getBlockTexture(Blocks.TURTLE_EGG, "_very_cracked")));
|
| 3379 | default -> throw new UnsupportedOperationException();
|
| 3380 | };
|
| 3381 | }
|
| 3382 |
|
| 3383 | private void createTurtleEgg() {
|
| 3384 | this.registerSimpleFlatItemModel(Items.TURTLE_EGG);
|
| 3385 | this.blockStateOutput
|
| 3386 | .accept(
|
| 3387 | MultiVariantGenerator.dispatch(Blocks.TURTLE_EGG)
|
| 3388 | .with(
|
| 3389 | PropertyDispatch.initial(BlockStateProperties.EGGS, BlockStateProperties.HATCH)
|
| 3390 | .generate((eggs, hatch) -> createRotatedVariants(this.createTurtleEggModel(eggs, hatch)))
|
| 3391 | )
|
| 3392 | );
|
| 3393 | }
|
| 3394 |
|
| 3395 | private void createDriedGhastBlock() {
|
| 3396 | Identifier driedGhast = ModelLocationUtils.getModelLocation(Blocks.DRIED_GHAST, "_hydration_0");
|
| 3397 | this.registerSimpleItemModel(Blocks.DRIED_GHAST, driedGhast);
|
| 3398 | Function<Integer, Identifier> createModel = stage -> {
|
| 3399 | String suffix = switch (stage) {
|
| 3400 | case 1 -> "_hydration_1";
|
| 3401 | case 2 -> "_hydration_2";
|
| 3402 | case 3 -> "_hydration_3";
|
| 3403 | default -> "_hydration_0";
|
| 3404 | };
|
| 3405 | TextureMapping texture = TextureMapping.driedGhast(suffix);
|
| 3406 | return ModelTemplates.DRIED_GHAST.createWithSuffix(Blocks.DRIED_GHAST, suffix, texture, this.modelOutput);
|
| 3407 | };
|
| 3408 | this.blockStateOutput
|
| 3409 | .accept(
|
| 3410 | MultiVariantGenerator.dispatch(Blocks.DRIED_GHAST)
|
| 3411 | .with(PropertyDispatch.initial(DriedGhastBlock.HYDRATION_LEVEL).generate(stage -> plainVariant(createModel.apply(stage))))
|
| 3412 | .with(ROTATION_HORIZONTAL_FACING)
|
| 3413 | );
|
| 3414 | }
|
| 3415 |
|
| 3416 | private void createSnifferEgg() {
|
| 3417 | this.registerSimpleFlatItemModel(Items.SNIFFER_EGG);
|
| 3418 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(Blocks.SNIFFER_EGG).with(PropertyDispatch.initial(SnifferEggBlock.HATCH).generate(stage -> {
|
| 3419 | String suffix = switch (stage) {
|
| 3420 | case 1 -> "_slightly_cracked";
|
| 3421 | case 2 -> "_very_cracked";
|
| 3422 | default -> "_not_cracked";
|
| 3423 | };
|
| 3424 | TextureMapping texture = TextureMapping.snifferEgg(suffix);
|
| 3425 | return plainVariant(ModelTemplates.SNIFFER_EGG.createWithSuffix(Blocks.SNIFFER_EGG, suffix, texture, this.modelOutput));
|
| 3426 | })));
|
| 3427 | }
|
| 3428 |
|
| 3429 | /**
|
| 3430 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3431 | */
|
| 3432 | public final void createMultiface(final Block block) {
|
| 3433 | this.registerSimpleFlatItemModel(block);
|
| 3434 | this.createMultifaceBlockStates(block);
|
| 3435 | }
|
| 3436 |
|
| 3437 | /**
|
| 3438 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3439 | */
|
| 3440 | public final void createMultiface(final Block block, final Item item) {
|
| 3441 | this.registerSimpleFlatItemModel(item);
|
| 3442 | this.createMultifaceBlockStates(block);
|
| 3443 | }
|
| 3444 |
|
| 3445 | /**
|
| 3446 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3447 | */
|
| 3448 | public static <T extends Property<?>> Map<T, VariantMutator> selectMultifaceProperties(final StateHolder<?, ?> holder, final Function<Direction, T> converter) {
|
| 3449 | Builder<T, VariantMutator> result = ImmutableMap.builderWithExpectedSize(MULTIFACE_GENERATOR.size());
|
| 3450 | MULTIFACE_GENERATOR.forEach((direction, mutator) -> {
|
| 3451 | T property = converter.apply(direction);
|
| 3452 | if (holder.hasProperty(property)) {
|
| 3453 | result.put(property, mutator);
|
| 3454 | }
|
| 3455 | });
|
| 3456 | return result.build();
|
| 3457 | }
|
| 3458 |
|
| 3459 | /**
|
| 3460 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3461 | */
|
| 3462 | public final void createMultifaceBlockStates(final Block block) {
|
| 3463 | Map<Property<Boolean>, VariantMutator> directionProperties = selectMultifaceProperties(block.defaultBlockState(), MultifaceBlock::getFaceProperty);
|
| 3464 | ConditionBuilder noFaces = condition();
|
| 3465 | directionProperties.forEach((property, mutator) -> noFaces.term((Property<Boolean>)property, false));
|
| 3466 | MultiVariant model = plainVariant(ModelLocationUtils.getModelLocation(block));
|
| 3467 | MultiPartGenerator generator = MultiPartGenerator.multiPart(block);
|
| 3468 | directionProperties.forEach((property, mutator) -> {
|
| 3469 | generator.with(condition().term((Property<Boolean>)property, true), model.with(mutator));
|
| 3470 | generator.with(noFaces, model.with(mutator));
|
| 3471 | });
|
| 3472 | this.blockStateOutput.accept(generator);
|
| 3473 | }
|
| 3474 |
|
| 3475 | /**
|
| 3476 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3477 | */
|
| 3478 | public final void createMossyCarpet(final Block block) {
|
| 3479 | Map<Property<WallSide>, VariantMutator> directionProperties = selectMultifaceProperties(block.defaultBlockState(), MossyCarpetBlock::getPropertyForFace);
|
| 3480 | ConditionBuilder noFaces = condition().term(MossyCarpetBlock.BASE, false);
|
| 3481 | directionProperties.forEach((property, mutator) -> noFaces.term((Property<WallSide>)property, WallSide.NONE));
|
| 3482 | MultiVariant modelCarpet = plainVariant(TexturedModel.CARPET.create(block, this.modelOutput));
|
| 3483 | MultiVariant modelSideTall = plainVariant(
|
| 3484 | TexturedModel.MOSSY_CARPET_SIDE
|
| 3485 | .get(block)
|
| 3486 | .updateTextures(m -> m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_side_tall")))
|
| 3487 | .createWithSuffix(block, "_side_tall", this.modelOutput)
|
| 3488 | );
|
| 3489 | MultiVariant modelSideSmall = plainVariant(
|
| 3490 | TexturedModel.MOSSY_CARPET_SIDE
|
| 3491 | .get(block)
|
| 3492 | .updateTextures(m -> m.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_side_small")))
|
| 3493 | .createWithSuffix(block, "_side_small", this.modelOutput)
|
| 3494 | );
|
| 3495 | MultiPartGenerator generator = MultiPartGenerator.multiPart(block);
|
| 3496 | generator.with(condition().term(MossyCarpetBlock.BASE, true), modelCarpet);
|
| 3497 | generator.with(noFaces, modelCarpet);
|
| 3498 | directionProperties.forEach((property, mutator) -> {
|
| 3499 | generator.with(condition().term((Property<WallSide>)property, WallSide.TALL), modelSideTall.with(mutator));
|
| 3500 | generator.with(condition().term((Property<WallSide>)property, WallSide.LOW), modelSideSmall.with(mutator));
|
| 3501 | generator.with(noFaces, modelSideTall.with(mutator));
|
| 3502 | });
|
| 3503 | this.blockStateOutput.accept(generator);
|
| 3504 | }
|
| 3505 |
|
| 3506 | /**
|
| 3507 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3508 | */
|
| 3509 | public final void createHangingMoss(final Block block) {
|
| 3510 | this.registerSimpleFlatItemModel(block);
|
| 3511 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(block).with(PropertyDispatch.initial(HangingMossBlock.TIP).generate(isTip -> {
|
| 3512 | String suffix = isTip ? "_tip" : "";
|
| 3513 | TextureMapping texture = TextureMapping.cross(TextureMapping.getBlockTexture(block, suffix));
|
| 3514 | return plainVariant(BlockModelGenerators.PlantType.NOT_TINTED.getCross().createWithSuffix(block, suffix, texture, this.modelOutput));
|
| 3515 | })));
|
| 3516 | }
|
| 3517 |
|
| 3518 | private void createSculkCatalyst() {
|
| 3519 | Material bottom = TextureMapping.getBlockTexture(Blocks.SCULK_CATALYST, "_bottom");
|
| 3520 | TextureMapping defaultTextureMap = new TextureMapping()
|
| 3521 | .put(TextureSlot.BOTTOM, bottom)
|
| 3522 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(Blocks.SCULK_CATALYST, "_top"))
|
| 3523 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.SCULK_CATALYST, "_side"));
|
| 3524 | TextureMapping bloomTextureMap = new TextureMapping()
|
| 3525 | .put(TextureSlot.BOTTOM, bottom)
|
| 3526 | .put(TextureSlot.TOP, TextureMapping.getBlockTexture(Blocks.SCULK_CATALYST, "_top_bloom"))
|
| 3527 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.SCULK_CATALYST, "_side_bloom"));
|
| 3528 | Identifier defaultModel = ModelTemplates.CUBE_BOTTOM_TOP.create(Blocks.SCULK_CATALYST, defaultTextureMap, this.modelOutput);
|
| 3529 | MultiVariant defaultVariant = plainVariant(defaultModel);
|
| 3530 | MultiVariant bloom = plainVariant(ModelTemplates.CUBE_BOTTOM_TOP.createWithSuffix(Blocks.SCULK_CATALYST, "_bloom", bloomTextureMap, this.modelOutput));
|
| 3531 | this.blockStateOutput
|
| 3532 | .accept(
|
| 3533 | MultiVariantGenerator.dispatch(Blocks.SCULK_CATALYST)
|
| 3534 | .with(PropertyDispatch.initial(BlockStateProperties.BLOOM).generate(pulse -> pulse ? bloom : defaultVariant))
|
| 3535 | );
|
| 3536 | this.registerSimpleItemModel(Blocks.SCULK_CATALYST, defaultModel);
|
| 3537 | }
|
| 3538 |
|
| 3539 | /**
|
| 3540 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3541 | */
|
| 3542 | public final void createShelf(final Block block, final Block particle) {
|
| 3543 | TextureMapping mapping = new TextureMapping()
|
| 3544 | .put(TextureSlot.ALL, TextureMapping.getBlockTexture(block))
|
| 3545 | .put(TextureSlot.PARTICLE, TextureMapping.getBlockTexture(particle));
|
| 3546 | MultiPartGenerator generator = MultiPartGenerator.multiPart(block);
|
| 3547 | this.addShelfPart(block, mapping, generator, ModelTemplates.SHELF_BODY, null, null);
|
| 3548 | this.addShelfPart(block, mapping, generator, ModelTemplates.SHELF_UNPOWERED, false, null);
|
| 3549 | this.addShelfPart(block, mapping, generator, ModelTemplates.SHELF_UNCONNECTED, true, SideChainPart.UNCONNECTED);
|
| 3550 | this.addShelfPart(block, mapping, generator, ModelTemplates.SHELF_LEFT, true, SideChainPart.LEFT);
|
| 3551 | this.addShelfPart(block, mapping, generator, ModelTemplates.SHELF_CENTER, true, SideChainPart.CENTER);
|
| 3552 | this.addShelfPart(block, mapping, generator, ModelTemplates.SHELF_RIGHT, true, SideChainPart.RIGHT);
|
| 3553 | this.blockStateOutput.accept(generator);
|
| 3554 | this.registerSimpleItemModel(block, ModelTemplates.SHELF_INVENTORY.create(block, mapping, this.modelOutput));
|
| 3555 | }
|
| 3556 |
|
| 3557 | /**
|
| 3558 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3559 | */
|
| 3560 | public final void addShelfPart(
|
| 3561 | final Block block,
|
| 3562 | final TextureMapping mapping,
|
| 3563 | final MultiPartGenerator generator,
|
| 3564 | final ModelTemplate template,
|
| 3565 | final @Nullable Boolean isPowered,
|
| 3566 | final @Nullable SideChainPart sideChainPart
|
| 3567 | ) {
|
| 3568 | MultiVariant variant = plainVariant(template.create(block, mapping, this.modelOutput));
|
| 3569 | forEachHorizontalDirection((direction, rotation) -> generator.with(shelfCondition(direction, isPowered, sideChainPart), variant.with(rotation)));
|
| 3570 | }
|
| 3571 |
|
| 3572 | /**
|
| 3573 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3574 | */
|
| 3575 | public static void forEachHorizontalDirection(final BiConsumer<Direction, VariantMutator> consumer) {
|
| 3576 | List.of(Pair.of(Direction.NORTH, NOP), Pair.of(Direction.EAST, Y_ROT_90), Pair.of(Direction.SOUTH, Y_ROT_180), Pair.of(Direction.WEST, Y_ROT_270))
|
| 3577 | .forEach(pair -> {
|
| 3578 | Direction direction = pair.getFirst();
|
| 3579 | VariantMutator rotation = pair.getSecond();
|
| 3580 | consumer.accept(direction, rotation);
|
| 3581 | });
|
| 3582 | }
|
| 3583 |
|
| 3584 | /**
|
| 3585 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3586 | */
|
| 3587 | public static Condition shelfCondition(final Direction direction, final @Nullable Boolean isPowered, final @Nullable SideChainPart sideChainPart) {
|
| 3588 | ConditionBuilder facing = condition(BlockStateProperties.HORIZONTAL_FACING, direction);
|
| 3589 | if (isPowered == null) {
|
| 3590 | return facing.build();
|
| 3591 | }
|
| 3592 |
|
| 3593 | ConditionBuilder powered = condition(BlockStateProperties.POWERED, isPowered);
|
| 3594 | return sideChainPart != null ? and(facing, powered, condition(BlockStateProperties.SIDE_CHAIN_PART, sideChainPart)) : and(facing, powered);
|
| 3595 | }
|
| 3596 |
|
| 3597 | private void createChiseledBookshelf() {
|
| 3598 | Block block = Blocks.CHISELED_BOOKSHELF;
|
| 3599 | MultiVariant body = plainVariant(ModelLocationUtils.getModelLocation(block));
|
| 3600 | MultiPartGenerator multiPartGenerator = MultiPartGenerator.multiPart(block);
|
| 3601 | forEachHorizontalDirection((direction, rotation) -> {
|
| 3602 | Condition facingCondition = condition().term(BlockStateProperties.HORIZONTAL_FACING, direction).build();
|
| 3603 | multiPartGenerator.with(facingCondition, body.with(rotation).with(UV_LOCK));
|
| 3604 | this.addSlotStateAndRotationVariants(multiPartGenerator, facingCondition, rotation);
|
| 3605 | });
|
| 3606 | this.blockStateOutput.accept(multiPartGenerator);
|
| 3607 | this.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block, "_inventory"));
|
| 3608 | CHISELED_BOOKSHELF_SLOT_MODEL_CACHE.clear();
|
| 3609 | }
|
| 3610 |
|
| 3611 | /**
|
| 3612 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3613 | */
|
| 3614 | public final void addSlotStateAndRotationVariants(final MultiPartGenerator multiPartGenerator, final Condition facingCondition, final VariantMutator mutator) {
|
| 3615 | List.of(
|
| 3616 | Pair.of(ChiseledBookShelfBlock.SLOT_0_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_TOP_LEFT),
|
| 3617 | Pair.of(ChiseledBookShelfBlock.SLOT_1_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_TOP_MID),
|
| 3618 | Pair.of(ChiseledBookShelfBlock.SLOT_2_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_TOP_RIGHT),
|
| 3619 | Pair.of(ChiseledBookShelfBlock.SLOT_3_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_BOTTOM_LEFT),
|
| 3620 | Pair.of(ChiseledBookShelfBlock.SLOT_4_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_BOTTOM_MID),
|
| 3621 | Pair.of(ChiseledBookShelfBlock.SLOT_5_OCCUPIED, ModelTemplates.CHISELED_BOOKSHELF_SLOT_BOTTOM_RIGHT)
|
| 3622 | )
|
| 3623 | .forEach(pair -> {
|
| 3624 | BooleanProperty stateProperty = pair.getFirst();
|
| 3625 | ModelTemplate modelTemplate = pair.getSecond();
|
| 3626 | this.addBookSlotModel(multiPartGenerator, facingCondition, mutator, stateProperty, modelTemplate, true);
|
| 3627 | this.addBookSlotModel(multiPartGenerator, facingCondition, mutator, stateProperty, modelTemplate, false);
|
| 3628 | });
|
| 3629 | }
|
| 3630 |
|
| 3631 | /**
|
| 3632 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3633 | */
|
| 3634 | public final void addBookSlotModel(
|
| 3635 | final MultiPartGenerator multiPartGenerator,
|
| 3636 | final Condition facingCondition,
|
| 3637 | final VariantMutator mutator,
|
| 3638 | final BooleanProperty stateProperty,
|
| 3639 | final ModelTemplate template,
|
| 3640 | final boolean isSlotOccupied
|
| 3641 | ) {
|
| 3642 | String suffix = isSlotOccupied ? "_occupied" : "_empty";
|
| 3643 | TextureMapping mapping = new TextureMapping().put(TextureSlot.TEXTURE, TextureMapping.getBlockTexture(Blocks.CHISELED_BOOKSHELF, suffix));
|
| 3644 | BlockModelGenerators.BookSlotModelCacheKey cacheKey = new BlockModelGenerators.BookSlotModelCacheKey(template, suffix);
|
| 3645 | MultiVariant model = plainVariant(
|
| 3646 | CHISELED_BOOKSHELF_SLOT_MODEL_CACHE.computeIfAbsent(cacheKey, key -> template.createWithSuffix(Blocks.CHISELED_BOOKSHELF, suffix, mapping, this.modelOutput))
|
| 3647 | );
|
| 3648 | multiPartGenerator.with(
|
| 3649 | new CombinedCondition(CombinedCondition.Operation.AND, List.of(facingCondition, condition().term(stateProperty, isSlotOccupied).build())),
|
| 3650 | model.with(mutator)
|
| 3651 | );
|
| 3652 | }
|
| 3653 |
|
| 3654 | private void createMagmaBlock() {
|
| 3655 | Material texture = new Material(Identifier.withDefaultNamespace("block/magma"));
|
| 3656 | MultiVariant model = plainVariant(ModelTemplates.CUBE_ALL.create(Blocks.MAGMA_BLOCK, TextureMapping.cube(texture), this.modelOutput));
|
| 3657 | this.blockStateOutput.accept(createSimpleBlock(Blocks.MAGMA_BLOCK, model));
|
| 3658 | }
|
| 3659 |
|
| 3660 | /**
|
| 3661 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3662 | */
|
| 3663 | public final void createShulkerBox(final Block block, final @Nullable DyeColor color) {
|
| 3664 | this.createParticleOnlyBlock(block);
|
| 3665 | Item item = block.asItem();
|
| 3666 | Identifier baseModel = ModelTemplates.SHULKER_BOX_INVENTORY.create(item, TextureMapping.particle(block), this.modelOutput);
|
| 3667 | Transformation transformation = ShulkerBoxRenderer.modelTransform(Direction.UP);
|
| 3668 | ItemModel.Unbaked itemModel = color != null
|
| 3669 | ? ItemModelUtils.specialModel(baseModel, transformation, new ShulkerBoxSpecialRenderer.Unbaked(color))
|
| 3670 | : ItemModelUtils.specialModel(baseModel, transformation, new ShulkerBoxSpecialRenderer.Unbaked());
|
| 3671 | this.itemModelOutput.accept(item, itemModel);
|
| 3672 | }
|
| 3673 |
|
| 3674 | /**
|
| 3675 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3676 | */
|
| 3677 | public final void createGrowingPlant(final Block kelp, final Block kelpPlant, final BlockModelGenerators.PlantType type) {
|
| 3678 | this.createCrossBlock(kelp, type);
|
| 3679 | this.createCrossBlock(kelpPlant, type);
|
| 3680 | }
|
| 3681 |
|
| 3682 | private void createInfestedStone() {
|
| 3683 | Identifier normalModel = ModelLocationUtils.getModelLocation(Blocks.STONE);
|
| 3684 | net.minecraft.client.renderer.block.dispatch.Variant normal = plainModel(normalModel);
|
| 3685 | net.minecraft.client.renderer.block.dispatch.Variant mirrored = plainModel(ModelLocationUtils.getModelLocation(Blocks.STONE, "_mirrored"));
|
| 3686 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(Blocks.INFESTED_STONE, createRotatedVariants(normal, mirrored)));
|
| 3687 | this.registerSimpleItemModel(Blocks.INFESTED_STONE, normalModel);
|
| 3688 | }
|
| 3689 |
|
| 3690 | private void createInfestedDeepslate() {
|
| 3691 | Identifier normalModel = ModelLocationUtils.getModelLocation(Blocks.DEEPSLATE);
|
| 3692 | net.minecraft.client.renderer.block.dispatch.Variant normal = plainModel(normalModel);
|
| 3693 | net.minecraft.client.renderer.block.dispatch.Variant mirrored = plainModel(ModelLocationUtils.getModelLocation(Blocks.DEEPSLATE, "_mirrored"));
|
| 3694 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(Blocks.INFESTED_DEEPSLATE, createRotatedVariants(normal, mirrored)).with(createRotatedPillar()));
|
| 3695 | this.registerSimpleItemModel(Blocks.INFESTED_DEEPSLATE, normalModel);
|
| 3696 | }
|
| 3697 |
|
| 3698 | /**
|
| 3699 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3700 | */
|
| 3701 | public final void createNetherRoots(final Block roots, final Block pottedRoots) {
|
| 3702 | this.createCrossBlockWithDefaultItem(roots, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 3703 | TextureMapping textures = TextureMapping.plant(TextureMapping.getBlockTexture(roots, "_pot"));
|
| 3704 | MultiVariant model = plainVariant(BlockModelGenerators.PlantType.NOT_TINTED.getCrossPot().create(pottedRoots, textures, this.modelOutput));
|
| 3705 | this.blockStateOutput.accept(createSimpleBlock(pottedRoots, model));
|
| 3706 | }
|
| 3707 |
|
| 3708 | private void createRespawnAnchor() {
|
| 3709 | Material bottom = TextureMapping.getBlockTexture(Blocks.RESPAWN_ANCHOR, "_bottom");
|
| 3710 | Material topOff = TextureMapping.getBlockTexture(Blocks.RESPAWN_ANCHOR, "_top_off");
|
| 3711 | Material topOn = TextureMapping.getBlockTexture(Blocks.RESPAWN_ANCHOR, "_top");
|
| 3712 | Identifier[] chargeLevelModels = new Identifier[5];
|
| 3713 |
|
| 3714 | for (int i = 0; i < 5; i++) {
|
| 3715 | TextureMapping mapping = new TextureMapping()
|
| 3716 | .put(TextureSlot.BOTTOM, bottom)
|
| 3717 | .put(TextureSlot.TOP, i == 0 ? topOff : topOn)
|
| 3718 | .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(Blocks.RESPAWN_ANCHOR, "_side" + i));
|
| 3719 | chargeLevelModels[i] = ModelTemplates.CUBE_BOTTOM_TOP.createWithSuffix(Blocks.RESPAWN_ANCHOR, "_" + i, mapping, this.modelOutput);
|
| 3720 | }
|
| 3721 |
|
| 3722 | this.blockStateOutput
|
| 3723 | .accept(
|
| 3724 | MultiVariantGenerator.dispatch(Blocks.RESPAWN_ANCHOR)
|
| 3725 | .with(PropertyDispatch.initial(BlockStateProperties.RESPAWN_ANCHOR_CHARGES).generate(ix -> plainVariant(chargeLevelModels[ix])))
|
| 3726 | );
|
| 3727 | this.registerSimpleItemModel(Blocks.RESPAWN_ANCHOR, chargeLevelModels[0]);
|
| 3728 | }
|
| 3729 |
|
| 3730 | /**
|
| 3731 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3732 | */
|
| 3733 | public static VariantMutator applyRotation(final FrontAndTop orientation) {
|
| 3734 | return switch (orientation) {
|
| 3735 | case DOWN_NORTH -> X_ROT_90;
|
| 3736 | case DOWN_SOUTH -> X_ROT_90.then(Y_ROT_180);
|
| 3737 | case DOWN_WEST -> X_ROT_90.then(Y_ROT_270);
|
| 3738 | case DOWN_EAST -> X_ROT_90.then(Y_ROT_90);
|
| 3739 | case UP_NORTH -> X_ROT_270.then(Y_ROT_180);
|
| 3740 | case UP_SOUTH -> X_ROT_270;
|
| 3741 | case UP_WEST -> X_ROT_270.then(Y_ROT_90);
|
| 3742 | case UP_EAST -> X_ROT_270.then(Y_ROT_270);
|
| 3743 | case NORTH_UP -> NOP;
|
| 3744 | case SOUTH_UP -> Y_ROT_180;
|
| 3745 | case WEST_UP -> Y_ROT_270;
|
| 3746 | case EAST_UP -> Y_ROT_90;
|
| 3747 | };
|
| 3748 | }
|
| 3749 |
|
| 3750 | private void createJigsaw() {
|
| 3751 | Material front = TextureMapping.getBlockTexture(Blocks.JIGSAW, "_top");
|
| 3752 | Material back = TextureMapping.getBlockTexture(Blocks.JIGSAW, "_bottom");
|
| 3753 | Material side = TextureMapping.getBlockTexture(Blocks.JIGSAW, "_side");
|
| 3754 | Material lock = TextureMapping.getBlockTexture(Blocks.JIGSAW, "_lock");
|
| 3755 | TextureMapping mapping = new TextureMapping()
|
| 3756 | .put(TextureSlot.DOWN, side)
|
| 3757 | .put(TextureSlot.WEST, side)
|
| 3758 | .put(TextureSlot.EAST, side)
|
| 3759 | .put(TextureSlot.PARTICLE, front)
|
| 3760 | .put(TextureSlot.NORTH, front)
|
| 3761 | .put(TextureSlot.SOUTH, back)
|
| 3762 | .put(TextureSlot.UP, lock);
|
| 3763 | this.blockStateOutput
|
| 3764 | .accept(
|
| 3765 | MultiVariantGenerator.dispatch(Blocks.JIGSAW, plainVariant(ModelTemplates.CUBE_DIRECTIONAL.create(Blocks.JIGSAW, mapping, this.modelOutput)))
|
| 3766 | .with(PropertyDispatch.modify(BlockStateProperties.ORIENTATION).generate(BlockModelGenerators::applyRotation))
|
| 3767 | );
|
| 3768 | }
|
| 3769 |
|
| 3770 | private void createPetrifiedOakSlab() {
|
| 3771 | Block fullBlock = Blocks.OAK_PLANKS;
|
| 3772 | MultiVariant fullBlockModel = plainVariant(ModelLocationUtils.getModelLocation(fullBlock));
|
| 3773 | TextureMapping fullBlockTextures = TextureMapping.cube(fullBlock);
|
| 3774 | Block petrifiedSlab = Blocks.PETRIFIED_OAK_SLAB;
|
| 3775 | MultiVariant petrifiedSlabBottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(petrifiedSlab, fullBlockTextures, this.modelOutput));
|
| 3776 | MultiVariant petrifiedSlabTop = plainVariant(ModelTemplates.SLAB_TOP.create(petrifiedSlab, fullBlockTextures, this.modelOutput));
|
| 3777 | this.blockStateOutput.accept(createSlab(petrifiedSlab, petrifiedSlabBottom, petrifiedSlabTop, fullBlockModel));
|
| 3778 | }
|
| 3779 |
|
| 3780 | /**
|
| 3781 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3782 | */
|
| 3783 | public final void createHead(final Block standAlone, final Block wall, final Type skullType, final Identifier itemBase) {
|
| 3784 | MultiVariant blockModel = plainVariant(ModelLocationUtils.decorateBlockModelLocation("skull"));
|
| 3785 | this.blockStateOutput.accept(createSimpleBlock(standAlone, blockModel));
|
| 3786 | this.blockStateOutput.accept(createSimpleBlock(wall, blockModel));
|
| 3787 | if (skullType == Types.PLAYER) {
|
| 3788 | this.itemModelOutput.accept(standAlone.asItem(), ItemModelUtils.specialModel(itemBase, SKULL_TRANSFORM, new PlayerHeadSpecialRenderer.Unbaked()));
|
| 3789 | } else {
|
| 3790 | this.itemModelOutput.accept(standAlone.asItem(), ItemModelUtils.specialModel(itemBase, SKULL_TRANSFORM, new SkullSpecialRenderer.Unbaked(skullType)));
|
| 3791 | }
|
| 3792 | }
|
| 3793 |
|
| 3794 | private void createHeads() {
|
| 3795 | Identifier defaultHeadItemBase = ModelLocationUtils.decorateItemModelLocation("template_skull");
|
| 3796 | this.createHead(Blocks.CREEPER_HEAD, Blocks.CREEPER_WALL_HEAD, Types.CREEPER, defaultHeadItemBase);
|
| 3797 | this.createHead(Blocks.PLAYER_HEAD, Blocks.PLAYER_WALL_HEAD, Types.PLAYER, defaultHeadItemBase);
|
| 3798 | this.createHead(Blocks.ZOMBIE_HEAD, Blocks.ZOMBIE_WALL_HEAD, Types.ZOMBIE, defaultHeadItemBase);
|
| 3799 | this.createHead(Blocks.SKELETON_SKULL, Blocks.SKELETON_WALL_SKULL, Types.SKELETON, defaultHeadItemBase);
|
| 3800 | this.createHead(Blocks.WITHER_SKELETON_SKULL, Blocks.WITHER_SKELETON_WALL_SKULL, Types.WITHER_SKELETON, defaultHeadItemBase);
|
| 3801 | this.createHead(Blocks.PIGLIN_HEAD, Blocks.PIGLIN_WALL_HEAD, Types.PIGLIN, defaultHeadItemBase);
|
| 3802 | this.createHead(Blocks.DRAGON_HEAD, Blocks.DRAGON_WALL_HEAD, Types.DRAGON, ModelLocationUtils.getModelLocation(Items.DRAGON_HEAD));
|
| 3803 | }
|
| 3804 |
|
| 3805 | private void createCopperGolemStatues() {
|
| 3806 | WeatherState.forEach(state -> {
|
| 3807 | this.createCopperGolemStatue(Blocks.COPPER_GOLEM_STATUE.weathering().pick(state), Blocks.COPPER_BLOCK.weathering().pick(state), state);
|
| 3808 | this.copyModel(Blocks.COPPER_GOLEM_STATUE.weathering().pick(state), Blocks.COPPER_GOLEM_STATUE.waxed().pick(state));
|
| 3809 | });
|
| 3810 | }
|
| 3811 |
|
| 3812 | /**
|
| 3813 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3814 | */
|
| 3815 | public final void createCopperGolemStatue(final Block block, final Block particle, final WeatherState state) {
|
| 3816 | MultiVariant blockModel = plainVariant(
|
| 3817 | ModelTemplates.PARTICLE_ONLY.create(block, TextureMapping.particle(TextureMapping.getBlockTexture(particle)), this.modelOutput)
|
| 3818 | );
|
| 3819 | Identifier itemBase = ModelLocationUtils.decorateItemModelLocation("template_copper_golem_statue");
|
| 3820 | this.blockStateOutput.accept(createSimpleBlock(block, blockModel));
|
| 3821 | this.itemModelOutput
|
| 3822 | .accept(
|
| 3823 | block.asItem(),
|
| 3824 | ItemModelUtils.selectBlockItemProperty(
|
| 3825 | new Transformation(new Vector3f(0.5F, 1.5F, 0.5F), null, new Vector3f(1.0F, -1.0F, -1.0F), null),
|
| 3826 | CopperGolemStatueBlock.POSE,
|
| 3827 | ItemModelUtils.specialModel(itemBase, new CopperGolemStatueSpecialRenderer.Unbaked(state, Pose.STANDING)),
|
| 3828 | Map.of(
|
| 3829 | Pose.SITTING,
|
| 3830 | ItemModelUtils.specialModel(itemBase, new CopperGolemStatueSpecialRenderer.Unbaked(state, Pose.SITTING)),
|
| 3831 | Pose.STAR,
|
| 3832 | ItemModelUtils.specialModel(itemBase, new CopperGolemStatueSpecialRenderer.Unbaked(state, Pose.STAR)),
|
| 3833 | Pose.RUNNING,
|
| 3834 | ItemModelUtils.specialModel(itemBase, new CopperGolemStatueSpecialRenderer.Unbaked(state, Pose.RUNNING))
|
| 3835 | )
|
| 3836 | )
|
| 3837 | );
|
| 3838 | }
|
| 3839 |
|
| 3840 | /**
|
| 3841 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3842 | */
|
| 3843 | public final void createBanner(final DyeColor baseColor) {
|
| 3844 | Block standAlone = Blocks.BANNER.pick(baseColor);
|
| 3845 | Block wall = Blocks.WALL_BANNER.pick(baseColor);
|
| 3846 | MultiVariant blockModel = plainVariant(ModelLocationUtils.decorateBlockModelLocation("banner"));
|
| 3847 | Identifier itemModel = ModelLocationUtils.decorateItemModelLocation("template_banner");
|
| 3848 | this.blockStateOutput.accept(createSimpleBlock(standAlone, blockModel));
|
| 3849 | this.blockStateOutput.accept(createSimpleBlock(wall, blockModel));
|
| 3850 | Item item = standAlone.asItem();
|
| 3851 | this.itemModelOutput
|
| 3852 | .accept(
|
| 3853 | item,
|
| 3854 | ItemModelUtils.specialModel(
|
| 3855 | itemModel, BannerRenderer.TRANSFORMATIONS.freeTransformations(0), new BannerSpecialRenderer.Unbaked(baseColor, AttachmentType.GROUND)
|
| 3856 | )
|
| 3857 | );
|
| 3858 | }
|
| 3859 |
|
| 3860 | /**
|
| 3861 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3862 | */
|
| 3863 | public final void createChest(final Block block, final Block particle, final Identifier texture, final boolean hasGiftVariant) {
|
| 3864 | this.createParticleOnlyBlock(block, particle);
|
| 3865 | Item chestItem = block.asItem();
|
| 3866 | Identifier itemModelBase = ModelTemplates.CHEST_INVENTORY.create(chestItem, TextureMapping.particle(particle), this.modelOutput);
|
| 3867 | ItemModel.Unbaked plainModel = ItemModelUtils.specialModel(itemModelBase, new ChestSpecialRenderer.Unbaked(texture));
|
| 3868 | if (hasGiftVariant) {
|
| 3869 | ItemModel.Unbaked giftModel = ItemModelUtils.specialModel(itemModelBase, new ChestSpecialRenderer.Unbaked(ChestSpecialRenderer.CHRISTMAS.single()));
|
| 3870 | this.itemModelOutput.accept(chestItem, ItemModelUtils.isXmas(giftModel, plainModel));
|
| 3871 | } else {
|
| 3872 | this.itemModelOutput.accept(chestItem, plainModel);
|
| 3873 | }
|
| 3874 | }
|
| 3875 |
|
| 3876 | /**
|
| 3877 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3878 | */
|
| 3879 | public final void createChest(final Block block, final Block particle, final MultiblockChestResources<Identifier> textures, final boolean hasGiftVariant) {
|
| 3880 | this.createChest(block, particle, textures.single(), hasGiftVariant);
|
| 3881 | }
|
| 3882 |
|
| 3883 | private void createChests() {
|
| 3884 | this.createChest(Blocks.CHEST, Blocks.OAK_PLANKS, ChestSpecialRenderer.REGULAR, true);
|
| 3885 | this.createChest(Blocks.TRAPPED_CHEST, Blocks.OAK_PLANKS, ChestSpecialRenderer.TRAPPED, true);
|
| 3886 | this.createChest(Blocks.ENDER_CHEST, Blocks.OBSIDIAN, ChestSpecialRenderer.ENDER_CHEST, false);
|
| 3887 | }
|
| 3888 |
|
| 3889 | private void createCopperChests() {
|
| 3890 | WeatherState.forEach(state -> {
|
| 3891 | this.createChest(Blocks.COPPER_CHEST.weathering().pick(state), Blocks.COPPER_BLOCK.weathering().pick(state), ChestSpecialRenderer.COPPER.pick(state), false);
|
| 3892 | this.copyModel(Blocks.COPPER_CHEST.weathering().pick(state), Blocks.COPPER_CHEST.waxed().pick(state));
|
| 3893 | });
|
| 3894 | }
|
| 3895 |
|
| 3896 | /**
|
| 3897 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3898 | */
|
| 3899 | public final void createBed(final DyeColor dyeColor) {
|
| 3900 | Block bed = Blocks.BED.pick(dyeColor);
|
| 3901 | Identifier head = ModelTemplates.BED_HEAD.createWithSuffix(bed, "_" + BedPart.HEAD, TextureMapping.bed(bed, BedPart.HEAD), this.modelOutput);
|
| 3902 | Identifier foot = ModelTemplates.BED_FOOT.createWithSuffix(bed, "_" + BedPart.FOOT, TextureMapping.bed(bed, BedPart.FOOT), this.modelOutput);
|
| 3903 | MultiVariant blockModelHead = plainVariant(head);
|
| 3904 | MultiVariant blockModelFoot = plainVariant(foot);
|
| 3905 | this.blockStateOutput.accept(createBed(bed, blockModelHead, blockModelFoot));
|
| 3906 | Transformation footTransformation = new Transformation(new Vector3f(0.0F, 0.0F, 1.0F), null, null, null);
|
| 3907 | ItemModel.Unbaked itemModelHead = ItemModelUtils.plainModel(head);
|
| 3908 | ItemModel.Unbaked itemModelFoot = ItemModelUtils.plainModel(foot, footTransformation);
|
| 3909 | this.itemModelOutput.accept(bed.asItem(), ItemModelUtils.composite(itemModelHead, itemModelFoot));
|
| 3910 | }
|
| 3911 |
|
| 3912 | private void createStrawBed() {
|
| 3913 | Block strawBed = Blocks.STRAW_BED;
|
| 3914 | Identifier head = ModelLocationUtils.getModelLocation(strawBed, "_head");
|
| 3915 | Identifier foot = ModelLocationUtils.getModelLocation(strawBed, "_foot");
|
| 3916 | this.blockStateOutput.accept(createStrawBed(strawBed, plainVariant(head), plainVariant(foot)));
|
| 3917 | Transformation headTransformation = new Transformation(new Vector3f(1.0F, 0.0F, 1.0F), new Quaternionf().rotationY((float) Math.PI), null, null);
|
| 3918 | Transformation footTransformation = new Transformation(new Vector3f(1.0F, 0.0F, 2.0F), new Quaternionf().rotationY((float) Math.PI), null, null);
|
| 3919 | ItemModel.Unbaked itemModelHead = ItemModelUtils.plainModel(head, headTransformation);
|
| 3920 | ItemModel.Unbaked itemModelFoot = ItemModelUtils.plainModel(foot, footTransformation);
|
| 3921 | this.itemModelOutput.accept(strawBed.asItem(), ItemModelUtils.composite(itemModelHead, itemModelFoot));
|
| 3922 | }
|
| 3923 |
|
| 3924 | /**
|
| 3925 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 3926 | */
|
| 3927 | public final void generateSimpleSpecialItemModel(
|
| 3928 | final Block block, final Optional<Transformation> transformation, final SpecialModelRenderer.Unbaked<?> specialModel
|
| 3929 | ) {
|
| 3930 | Item item = block.asItem();
|
| 3931 | Identifier harcodedModelBase = ModelLocationUtils.getModelLocation(item);
|
| 3932 | this.itemModelOutput.accept(item, ItemModelUtils.specialModel(harcodedModelBase, transformation, specialModel));
|
| 3933 | }
|
| 3934 |
|
| 3935 | public void run() {
|
| 3936 | BlockFamilies.getAllFamilies()
|
| 3937 | .filter(BlockFamily::shouldGenerateModel)
|
| 3938 | .forEach(blockFamily -> this.family(blockFamily.getBaseBlock()).generateFor(blockFamily));
|
| 3939 | WeatherState.forEach(
|
| 3940 | state -> this.family(Blocks.CUT_COPPER.weathering().pick(state))
|
| 3941 | .generateFor(BlockFamilies.CUT_COPPER.weathering().pick(state))
|
| 3942 | .donateModelTo(Blocks.CUT_COPPER.weathering().pick(state), Blocks.CUT_COPPER.waxed().pick(state))
|
| 3943 | .donateModelTo(Blocks.CHISELED_COPPER.weathering().pick(state), Blocks.CHISELED_COPPER.waxed().pick(state))
|
| 3944 | .generateFor(BlockFamilies.CUT_COPPER.waxed().pick(state))
|
| 3945 | );
|
| 3946 | Blocks.COPPER_BULB.zipUnwaxedWaxed((unwaxed, waxed) -> {
|
| 3947 | this.createCopperBulb(unwaxed);
|
| 3948 | this.copyCopperBulbModel(unwaxed, waxed);
|
| 3949 | });
|
| 3950 | this.createNonTemplateModelBlock(Blocks.AIR);
|
| 3951 | this.createNonTemplateModelBlock(Blocks.CAVE_AIR, Blocks.AIR);
|
| 3952 | this.createNonTemplateModelBlock(Blocks.VOID_AIR, Blocks.AIR);
|
| 3953 | this.createNonTemplateModelBlock(Blocks.BEACON);
|
| 3954 | this.createNonTemplateModelBlock(Blocks.CACTUS);
|
| 3955 | this.createNonTemplateModelBlock(Blocks.BUBBLE_COLUMN, Blocks.WATER);
|
| 3956 | this.createNonTemplateModelBlock(Blocks.DRAGON_EGG);
|
| 3957 | this.createNonTemplateModelBlock(Blocks.DRIED_KELP_BLOCK);
|
| 3958 | this.createNonTemplateModelBlock(Blocks.ENCHANTING_TABLE);
|
| 3959 | this.createNonTemplateModelBlock(Blocks.FLOWER_POT);
|
| 3960 | this.registerSimpleFlatItemModel(Items.FLOWER_POT);
|
| 3961 | this.createNonTemplateModelBlock(Blocks.HONEY_BLOCK);
|
| 3962 | this.createNonTemplateModelBlock(Blocks.WATER);
|
| 3963 | this.createNonTemplateModelBlock(Blocks.LAVA);
|
| 3964 | this.createNonTemplateModelBlock(Blocks.SLIME_BLOCK);
|
| 3965 | this.registerSimpleFlatItemModel(Items.IRON_CHAIN);
|
| 3966 | Items.COPPER_CHAIN.zipUnwaxedWaxed(this::createCopperChainItem);
|
| 3967 | ColorCollection.zipApply(Blocks.DYED_CANDLE, Blocks.DYED_CANDLE_CAKE, this::createCandleAndCandleCake);
|
| 3968 | this.createCandleAndCandleCake(Blocks.CANDLE, Blocks.CANDLE_CAKE);
|
| 3969 | this.createNonTemplateModelBlock(Blocks.POTTED_BAMBOO);
|
| 3970 | this.createNonTemplateModelBlock(Blocks.POTTED_CACTUS);
|
| 3971 | this.createNonTemplateModelBlock(Blocks.POWDER_SNOW);
|
| 3972 | this.createNonTemplateModelBlock(Blocks.SPORE_BLOSSOM);
|
| 3973 | this.createAzalea(Blocks.AZALEA);
|
| 3974 | this.createAzalea(Blocks.FLOWERING_AZALEA);
|
| 3975 | this.createPottedAzalea(Blocks.POTTED_AZALEA);
|
| 3976 | this.createPottedAzalea(Blocks.POTTED_FLOWERING_AZALEA);
|
| 3977 | this.createCaveVines();
|
| 3978 | this.createFullAndCarpetBlocks(Blocks.MOSS_BLOCK, Blocks.MOSS_CARPET);
|
| 3979 | this.createMossyCarpet(Blocks.PALE_MOSS_CARPET);
|
| 3980 | this.createHangingMoss(Blocks.PALE_HANGING_MOSS);
|
| 3981 | this.createTrivialCube(Blocks.PALE_MOSS_BLOCK);
|
| 3982 | this.createFlowerBed(Blocks.PINK_PETALS);
|
| 3983 | this.createFlowerBed(Blocks.WILDFLOWERS);
|
| 3984 | this.createLeafLitter(Blocks.LEAF_LITTER);
|
| 3985 | this.createCrossBlock(Blocks.FIREFLY_BUSH, BlockModelGenerators.PlantType.EMISSIVE_NOT_TINTED);
|
| 3986 | this.registerSimpleFlatItemModel(Items.FIREFLY_BUSH);
|
| 3987 | this.createAirLikeBlock(Blocks.BARRIER, Items.BARRIER);
|
| 3988 | this.registerSimpleFlatItemModel(Items.BARRIER);
|
| 3989 | this.createLightBlock();
|
| 3990 | this.createAirLikeBlock(Blocks.STRUCTURE_VOID, Items.STRUCTURE_VOID);
|
| 3991 | this.registerSimpleFlatItemModel(Items.STRUCTURE_VOID);
|
| 3992 | this.createAirLikeBlock(Blocks.MOVING_PISTON, TextureMapping.getBlockTexture(Blocks.PISTON, "_side"));
|
| 3993 | this.createTrivialCube(Blocks.COAL_ORE);
|
| 3994 | this.createTrivialCube(Blocks.DEEPSLATE_COAL_ORE);
|
| 3995 | this.createTrivialCube(Blocks.COAL_BLOCK);
|
| 3996 | this.createTrivialCube(Blocks.DIAMOND_ORE);
|
| 3997 | this.createTrivialCube(Blocks.DEEPSLATE_DIAMOND_ORE);
|
| 3998 | this.createTrivialCube(Blocks.DIAMOND_BLOCK);
|
| 3999 | this.createTrivialCube(Blocks.EMERALD_ORE);
|
| 4000 | this.createTrivialCube(Blocks.DEEPSLATE_EMERALD_ORE);
|
| 4001 | this.createTrivialCube(Blocks.EMERALD_BLOCK);
|
| 4002 | this.createTrivialCube(Blocks.GOLD_ORE);
|
| 4003 | this.createTrivialCube(Blocks.NETHER_GOLD_ORE);
|
| 4004 | this.createTrivialCube(Blocks.DEEPSLATE_GOLD_ORE);
|
| 4005 | this.createTrivialCube(Blocks.GOLD_BLOCK);
|
| 4006 | this.createTrivialCube(Blocks.IRON_ORE);
|
| 4007 | this.createTrivialCube(Blocks.DEEPSLATE_IRON_ORE);
|
| 4008 | this.createTrivialCube(Blocks.IRON_BLOCK);
|
| 4009 | this.createTrivialBlock(Blocks.ANCIENT_DEBRIS, TexturedModel.COLUMN);
|
| 4010 | this.createTrivialCube(Blocks.NETHERITE_BLOCK);
|
| 4011 | this.createTrivialCube(Blocks.LAPIS_ORE);
|
| 4012 | this.createTrivialCube(Blocks.DEEPSLATE_LAPIS_ORE);
|
| 4013 | this.createTrivialCube(Blocks.LAPIS_BLOCK);
|
| 4014 | this.createTrivialCube(Blocks.RESIN_BLOCK);
|
| 4015 | this.createTrivialCube(Blocks.NETHER_QUARTZ_ORE);
|
| 4016 | this.createTrivialCube(Blocks.REDSTONE_ORE);
|
| 4017 | this.createTrivialCube(Blocks.DEEPSLATE_REDSTONE_ORE);
|
| 4018 | this.createTrivialCube(Blocks.REDSTONE_BLOCK);
|
| 4019 | this.createTrivialCube(Blocks.GILDED_BLACKSTONE);
|
| 4020 | this.createTrivialCube(Blocks.BLUE_ICE);
|
| 4021 | this.createTrivialCube(Blocks.CLAY);
|
| 4022 | this.createTrivialCube(Blocks.COARSE_DIRT);
|
| 4023 | this.createTrivialCube(Blocks.CRYING_OBSIDIAN);
|
| 4024 | this.createTrivialCube(Blocks.GLOWSTONE);
|
| 4025 | this.createTrivialCube(Blocks.GRAVEL);
|
| 4026 | this.createTrivialCube(Blocks.HONEYCOMB_BLOCK);
|
| 4027 | this.createTrivialCube(Blocks.ICE);
|
| 4028 | this.createTrivialBlock(Blocks.JUKEBOX, TexturedModel.CUBE_TOP);
|
| 4029 | this.createTrivialBlock(Blocks.LODESTONE, TexturedModel.COLUMN);
|
| 4030 | this.createTrivialBlock(Blocks.MELON, TexturedModel.COLUMN);
|
| 4031 | this.createNonTemplateModelBlock(Blocks.MANGROVE_ROOTS);
|
| 4032 | this.createNonTemplateModelBlock(Blocks.POTTED_MANGROVE_PROPAGULE);
|
| 4033 | this.createTrivialCube(Blocks.NETHER_WART_BLOCK);
|
| 4034 | this.createTrivialCube(Blocks.NOTE_BLOCK);
|
| 4035 | this.createTrivialCube(Blocks.PACKED_ICE);
|
| 4036 | this.createTrivialCube(Blocks.OBSIDIAN);
|
| 4037 | this.createTrivialCube(Blocks.SEA_LANTERN);
|
| 4038 | this.createTrivialCube(Blocks.SHROOMLIGHT);
|
| 4039 | this.createTrivialCube(Blocks.SOUL_SAND);
|
| 4040 | this.createTrivialCube(Blocks.SOUL_SOIL);
|
| 4041 | this.createTrivialBlock(Blocks.SPAWNER, TexturedModel.CUBE_INNER_FACES);
|
| 4042 | this.createCreakingHeart(Blocks.CREAKING_HEART);
|
| 4043 | this.createTrivialCube(Blocks.SPONGE);
|
| 4044 | this.createTrivialBlock(Blocks.SEAGRASS, TexturedModel.SEAGRASS);
|
| 4045 | this.registerSimpleFlatItemModel(Items.SEAGRASS);
|
| 4046 | this.createTrivialBlock(Blocks.TNT, TexturedModel.CUBE_BOTTOM_TOP);
|
| 4047 | this.createTrivialBlock(Blocks.TARGET, TexturedModel.COLUMN);
|
| 4048 | this.createTrivialCube(Blocks.WARPED_WART_BLOCK);
|
| 4049 | this.createTrivialCube(Blocks.WET_SPONGE);
|
| 4050 | this.createTrivialCube(Blocks.AMETHYST_BLOCK);
|
| 4051 | this.createTrivialCube(Blocks.BUDDING_AMETHYST);
|
| 4052 | this.createTrivialCube(Blocks.CALCITE);
|
| 4053 | this.createTrivialCube(Blocks.DRIPSTONE_BLOCK);
|
| 4054 | this.createTrivialCube(Blocks.RAW_IRON_BLOCK);
|
| 4055 | this.createTrivialCube(Blocks.RAW_COPPER_BLOCK);
|
| 4056 | this.createTrivialCube(Blocks.RAW_GOLD_BLOCK);
|
| 4057 | this.createRotatedMirroredVariantBlock(Blocks.SCULK);
|
| 4058 | this.createNonTemplateModelBlock(Blocks.HEAVY_CORE);
|
| 4059 | this.createPetrifiedOakSlab();
|
| 4060 | this.createTrivialCube(Blocks.COPPER_ORE);
|
| 4061 | this.createTrivialCube(Blocks.DEEPSLATE_COPPER_ORE);
|
| 4062 | Blocks.COPPER_BLOCK.zipUnwaxedWaxed((unwaxed, var2) -> this.createTrivialCube(unwaxed));
|
| 4063 | Blocks.COPPER_BLOCK.zipUnwaxedWaxed(this::copyModel);
|
| 4064 | Blocks.COPPER_DOOR.zipUnwaxedWaxed((unwaxed, var2) -> this.createDoor(unwaxed));
|
| 4065 | Blocks.COPPER_DOOR.zipUnwaxedWaxed(this::copyDoorModel);
|
| 4066 | Blocks.COPPER_TRAPDOOR.zipUnwaxedWaxed((unwaxed, var2) -> this.createTrapdoor(unwaxed));
|
| 4067 | Blocks.COPPER_TRAPDOOR.zipUnwaxedWaxed(this::copyTrapdoorModel);
|
| 4068 | Blocks.COPPER_GRATE.zipUnwaxedWaxed((unwaxed, var2) -> this.createTrivialCube(unwaxed));
|
| 4069 | Blocks.COPPER_GRATE.zipUnwaxedWaxed(this::copyModel);
|
| 4070 | Blocks.LIGHTNING_ROD.zipUnwaxedWaxed(this::createLightningRod);
|
| 4071 | this.createWeightedPressurePlate(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, Blocks.GOLD_BLOCK);
|
| 4072 | this.createWeightedPressurePlate(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, Blocks.IRON_BLOCK);
|
| 4073 | this.createShelf(Blocks.ACACIA_SHELF, Blocks.STRIPPED_ACACIA_LOG);
|
| 4074 | this.createShelf(Blocks.BAMBOO_SHELF, Blocks.STRIPPED_BAMBOO_BLOCK);
|
| 4075 | this.createShelf(Blocks.BIRCH_SHELF, Blocks.STRIPPED_BIRCH_LOG);
|
| 4076 | this.createShelf(Blocks.CHERRY_SHELF, Blocks.STRIPPED_CHERRY_LOG);
|
| 4077 | this.createShelf(Blocks.CRIMSON_SHELF, Blocks.STRIPPED_CRIMSON_STEM);
|
| 4078 | this.createShelf(Blocks.DARK_OAK_SHELF, Blocks.STRIPPED_DARK_OAK_LOG);
|
| 4079 | this.createShelf(Blocks.JUNGLE_SHELF, Blocks.STRIPPED_JUNGLE_LOG);
|
| 4080 | this.createShelf(Blocks.MANGROVE_SHELF, Blocks.STRIPPED_MANGROVE_LOG);
|
| 4081 | this.createShelf(Blocks.POPLAR_SHELF, Blocks.STRIPPED_POPLAR_LOG);
|
| 4082 | this.createShelf(Blocks.OAK_SHELF, Blocks.STRIPPED_OAK_LOG);
|
| 4083 | this.createShelf(Blocks.PALE_OAK_SHELF, Blocks.STRIPPED_PALE_OAK_LOG);
|
| 4084 | this.createShelf(Blocks.SPRUCE_SHELF, Blocks.STRIPPED_SPRUCE_LOG);
|
| 4085 | this.createShelf(Blocks.WARPED_SHELF, Blocks.STRIPPED_WARPED_STEM);
|
| 4086 | this.createAmethystClusters();
|
| 4087 | this.createBookshelf();
|
| 4088 | this.createChiseledBookshelf();
|
| 4089 | this.createBrewingStand();
|
| 4090 | this.createCakeBlock();
|
| 4091 | this.createCampfires(Blocks.CAMPFIRE, Blocks.SOUL_CAMPFIRE);
|
| 4092 | this.createCartographyTable();
|
| 4093 | this.createCauldrons();
|
| 4094 | this.createChorusFlower();
|
| 4095 | this.createChorusPlant();
|
| 4096 | this.createComposter();
|
| 4097 | this.createDaylightDetector();
|
| 4098 | this.createEndPortalFrame();
|
| 4099 | this.createRotatableColumn(Blocks.END_ROD);
|
| 4100 | this.createFarmland(
|
| 4101 | Blocks.FARMLAND, TextureMapping.getBlockTexture(Blocks.DIRT), TextureMapping.getBlockTexture(Blocks.DIRT), ModelTemplates.CUBE_BOTTOM_TOP_INDENTED
|
| 4102 | );
|
| 4103 | this.createFire();
|
| 4104 | this.createSoulFire();
|
| 4105 | this.createFrostedIce();
|
| 4106 | this.createGrassBlocks();
|
| 4107 | this.createCocoa();
|
| 4108 | this.createShelfMushroom();
|
| 4109 | this.createRotatedVariantBlock(
|
| 4110 | Blocks.DIRT_PATH, TexturedModel.CUBE_BOTTOM_TOP_INDENTED.updateTexture(m -> m.put(TextureSlot.BOTTOM, TextureMapping.getBlockTexture(Blocks.DIRT)))
|
| 4111 | );
|
| 4112 | this.createGrindstone();
|
| 4113 | this.createHopper();
|
| 4114 | this.createBarsAndItem(Blocks.IRON_BARS);
|
| 4115 | Blocks.COPPER_BARS.zipUnwaxedWaxed(this::createBarsAndItem);
|
| 4116 | this.createLever();
|
| 4117 | this.createLilyPad();
|
| 4118 | this.createNetherPortalBlock();
|
| 4119 | this.createNetherrack();
|
| 4120 | this.createObserver();
|
| 4121 | this.createPistons();
|
| 4122 | this.createPistonHeads();
|
| 4123 | this.createScaffolding();
|
| 4124 | this.createRedstoneTorch();
|
| 4125 | this.createRedstoneLamp();
|
| 4126 | this.createRepeater();
|
| 4127 | this.createSeaPickle();
|
| 4128 | this.createSmithingTable();
|
| 4129 | this.createSnowBlocks();
|
| 4130 | this.createStonecutter();
|
| 4131 | this.createStructureBlock();
|
| 4132 | this.createSweetBerryBush();
|
| 4133 | this.createTestBlock();
|
| 4134 | this.createTrivialCube(Blocks.TEST_INSTANCE_BLOCK);
|
| 4135 | this.createTripwire();
|
| 4136 | this.createTripwireHook();
|
| 4137 | this.createTurtleEgg();
|
| 4138 | this.createSnifferEgg();
|
| 4139 | this.createDriedGhastBlock();
|
| 4140 | this.createVine();
|
| 4141 | this.createMultiface(Blocks.GLOW_LICHEN);
|
| 4142 | this.createMultiface(Blocks.SCULK_VEIN);
|
| 4143 | this.createMultiface(Blocks.RESIN_CLUMP, Items.RESIN_CLUMP);
|
| 4144 | this.createMagmaBlock();
|
| 4145 | this.createJigsaw();
|
| 4146 | this.createSculkSensor();
|
| 4147 | this.createCalibratedSculkSensor();
|
| 4148 | this.createSculkShrieker();
|
| 4149 | this.createFrogspawnBlock();
|
| 4150 | this.createMangrovePropagule();
|
| 4151 | this.createMuddyMangroveRoots();
|
| 4152 | this.createTrialSpawner();
|
| 4153 | this.createVault();
|
| 4154 | this.createNonTemplateHorizontalBlock(Blocks.LADDER);
|
| 4155 | this.registerSimpleFlatItemModel(Blocks.LADDER);
|
| 4156 | this.createNonTemplateHorizontalBlock(Blocks.LECTERN);
|
| 4157 | this.createBigDripLeafBlock();
|
| 4158 | this.createNonTemplateHorizontalBlock(Blocks.BIG_DRIPLEAF_STEM);
|
| 4159 | this.createNormalTorch(Blocks.TORCH, Blocks.WALL_TORCH);
|
| 4160 | this.createNormalTorch(Blocks.SOUL_TORCH, Blocks.SOUL_WALL_TORCH);
|
| 4161 | this.createNormalTorch(Blocks.COPPER_TORCH, Blocks.COPPER_WALL_TORCH);
|
| 4162 | this.createCraftingTableLike(Blocks.CRAFTING_TABLE, Blocks.OAK_PLANKS, TextureMapping::craftingTable);
|
| 4163 | this.createCraftingTableLike(Blocks.FLETCHING_TABLE, Blocks.BIRCH_PLANKS, TextureMapping::fletchingTable);
|
| 4164 | this.createNyliumBlock(Blocks.CRIMSON_NYLIUM);
|
| 4165 | this.createNyliumBlock(Blocks.WARPED_NYLIUM);
|
| 4166 | this.createDispenserBlock(Blocks.DISPENSER);
|
| 4167 | this.createDispenserBlock(Blocks.DROPPER);
|
| 4168 | this.createCrafterBlock();
|
| 4169 | this.createLantern(Blocks.LANTERN);
|
| 4170 | this.createLantern(Blocks.SOUL_LANTERN);
|
| 4171 | Blocks.COPPER_LANTERN.zipUnwaxedWaxed(this::createCopperLantern);
|
| 4172 | this.createAxisAlignedPillarBlockCustomModel(Blocks.IRON_CHAIN, plainVariant(TexturedModel.CHAIN.create(Blocks.IRON_CHAIN, this.modelOutput)));
|
| 4173 | Blocks.COPPER_CHAIN.zipUnwaxedWaxed(this::createCopperChain);
|
| 4174 | this.createAxisAlignedPillarBlock(Blocks.BASALT, TexturedModel.COLUMN);
|
| 4175 | this.createAxisAlignedPillarBlock(Blocks.POLISHED_BASALT, TexturedModel.COLUMN);
|
| 4176 | this.createTrivialCube(Blocks.SMOOTH_BASALT);
|
| 4177 | this.createAxisAlignedPillarBlock(Blocks.BONE_BLOCK, TexturedModel.COLUMN);
|
| 4178 | this.createRotatedVariantBlock(Blocks.DIRT);
|
| 4179 | this.createRotatedVariantBlock(Blocks.ROOTED_DIRT);
|
| 4180 | this.createRotatedVariantBlock(Blocks.SAND);
|
| 4181 | this.createBrushableBlock(Blocks.SUSPICIOUS_SAND);
|
| 4182 | this.createBrushableBlock(Blocks.SUSPICIOUS_GRAVEL);
|
| 4183 | this.createRotatedVariantBlock(Blocks.RED_SAND);
|
| 4184 | this.createRotatedMirroredVariantBlock(Blocks.BEDROCK);
|
| 4185 | this.createTrivialBlock(Blocks.REINFORCED_DEEPSLATE, TexturedModel.CUBE_BOTTOM_TOP);
|
| 4186 | this.createRotatedPillarWithHorizontalVariant(Blocks.HAY_BLOCK, TexturedModel.COLUMN, TexturedModel.COLUMN_HORIZONTAL);
|
| 4187 | this.createRotatedPillarWithHorizontalVariant(Blocks.OCHRE_FROGLIGHT, TexturedModel.COLUMN, TexturedModel.COLUMN_HORIZONTAL);
|
| 4188 | this.createRotatedPillarWithHorizontalVariant(Blocks.VERDANT_FROGLIGHT, TexturedModel.COLUMN, TexturedModel.COLUMN_HORIZONTAL);
|
| 4189 | this.createRotatedPillarWithHorizontalVariant(Blocks.PEARLESCENT_FROGLIGHT, TexturedModel.COLUMN, TexturedModel.COLUMN_HORIZONTAL);
|
| 4190 | this.createHorizontallyRotatedBlock(Blocks.LOOM, TexturedModel.ORIENTABLE);
|
| 4191 | this.createPumpkins();
|
| 4192 | this.createBeeNest(Blocks.BEE_NEST, TextureMapping::orientableCube);
|
| 4193 | this.createBeeNest(Blocks.BEEHIVE, TextureMapping::orientableCubeSameEnds);
|
| 4194 | this.createCropBlock(Blocks.BEETROOTS, BlockStateProperties.AGE_3, 0, 1, 2, 3);
|
| 4195 | this.createCropBlock(Blocks.CARROTS, BlockStateProperties.AGE_7, 0, 0, 1, 1, 2, 2, 2, 3);
|
| 4196 | this.createCropBlock(Blocks.NETHER_WART, BlockStateProperties.AGE_3, 0, 1, 1, 2);
|
| 4197 | this.createCropBlock(Blocks.POTATOES, BlockStateProperties.AGE_7, 0, 0, 1, 1, 2, 2, 2, 3);
|
| 4198 | this.createCropBlock(Blocks.WHEAT, BlockStateProperties.AGE_7, 0, 1, 2, 3, 4, 5, 6, 7);
|
| 4199 | this.createCrossBlock(Blocks.TORCHFLOWER_CROP, BlockModelGenerators.PlantType.NOT_TINTED, BlockStateProperties.AGE_1, 0, 1);
|
| 4200 | this.createPitcherCrop();
|
| 4201 | this.createPitcherPlant();
|
| 4202 | DyeColor.VALUES.forEach(this::createBanner);
|
| 4203 | DyeColor.VALUES.forEach(this::createBed);
|
| 4204 | this.createStrawBed();
|
| 4205 | this.createHeads();
|
| 4206 | this.createChests();
|
| 4207 | this.createCopperChests();
|
| 4208 | this.createShulkerBox(Blocks.SHULKER_BOX, null);
|
| 4209 | ColorCollection.zipApply(ColorCollection.VALUES, Blocks.DYED_SHULKER_BOX, (color, box) -> this.createShulkerBox(box, color));
|
| 4210 | this.createCopperGolemStatues();
|
| 4211 | this.createParticleOnlyBlock(Blocks.CONDUIT);
|
| 4212 | this.generateSimpleSpecialItemModel(Blocks.CONDUIT, Optional.of(ConduitRenderer.DEFAULT_TRANSFORMATION), new ConduitSpecialRenderer.Unbaked());
|
| 4213 | this.createParticleOnlyBlock(Blocks.DECORATED_POT, Blocks.TERRACOTTA);
|
| 4214 | this.generateSimpleSpecialItemModel(Blocks.DECORATED_POT, Optional.empty(), new DecoratedPotSpecialRenderer.Unbaked());
|
| 4215 | this.createParticleOnlyBlock(Blocks.END_PORTAL, Blocks.OBSIDIAN);
|
| 4216 | this.createParticleOnlyBlock(Blocks.END_GATEWAY, Blocks.OBSIDIAN);
|
| 4217 | this.createTrivialCube(Blocks.AZALEA_LEAVES);
|
| 4218 | this.createTrivialCube(Blocks.FLOWERING_AZALEA_LEAVES);
|
| 4219 | this.createColoredBlockWithRandomRotations(TexturedModel.CUBE, Blocks.CONCRETE_POWDER.asList());
|
| 4220 | this.createTrivialCube(Blocks.POTENT_SULFUR);
|
| 4221 | this.createTrivialCube(Blocks.TERRACOTTA);
|
| 4222 | Blocks.DYED_TERRACOTTA.forEach(this::createTrivialCube);
|
| 4223 | this.createTrivialCube(Blocks.TINTED_GLASS);
|
| 4224 | this.createGlassBlocks(Blocks.GLASS, Blocks.GLASS_PANE);
|
| 4225 | ColorCollection.zipApply(Blocks.STAINED_GLASS, Blocks.STAINED_GLASS_PANE, this::createGlassBlocks);
|
| 4226 | this.createColoredBlockWithStateRotations(TexturedModel.GLAZED_TERRACOTTA, Blocks.GLAZED_TERRACOTTA.asList());
|
| 4227 | this.createTrivialCube(Blocks.MUD);
|
| 4228 | this.createTrivialCube(Blocks.PACKED_MUD);
|
| 4229 | this.createPlant(Blocks.FERN, Blocks.POTTED_FERN, BlockModelGenerators.PlantType.TINTED);
|
| 4230 | this.createItemWithGrassTint(Blocks.FERN);
|
| 4231 | this.createPlantWithDefaultItem(Blocks.DANDELION, Blocks.POTTED_DANDELION, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4232 | this.createPlantWithDefaultItem(Blocks.GOLDEN_DANDELION, Blocks.POTTED_GOLDEN_DANDELION, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4233 | this.createPlantWithDefaultItem(Blocks.POPPY, Blocks.POTTED_POPPY, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4234 | this.createPlantWithDefaultItem(Blocks.OPEN_EYEBLOSSOM, Blocks.POTTED_OPEN_EYEBLOSSOM, BlockModelGenerators.PlantType.EMISSIVE_NOT_TINTED);
|
| 4235 | this.createPlantWithDefaultItem(Blocks.CLOSED_EYEBLOSSOM, Blocks.POTTED_CLOSED_EYEBLOSSOM, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4236 | this.createPlantWithDefaultItem(Blocks.BLUE_ORCHID, Blocks.POTTED_BLUE_ORCHID, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4237 | this.createPlantWithDefaultItem(Blocks.ALLIUM, Blocks.POTTED_ALLIUM, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4238 | this.createPlantWithDefaultItem(Blocks.AZURE_BLUET, Blocks.POTTED_AZURE_BLUET, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4239 | this.createPlantWithDefaultItem(Blocks.RED_TULIP, Blocks.POTTED_RED_TULIP, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4240 | this.createPlantWithDefaultItem(Blocks.ORANGE_TULIP, Blocks.POTTED_ORANGE_TULIP, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4241 | this.createPlantWithDefaultItem(Blocks.WHITE_TULIP, Blocks.POTTED_WHITE_TULIP, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4242 | this.createPlantWithDefaultItem(Blocks.PINK_TULIP, Blocks.POTTED_PINK_TULIP, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4243 | this.createPlantWithDefaultItem(Blocks.OXEYE_DAISY, Blocks.POTTED_OXEYE_DAISY, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4244 | this.createPlantWithDefaultItem(Blocks.CORNFLOWER, Blocks.POTTED_CORNFLOWER, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4245 | this.createPlantWithDefaultItem(Blocks.LILY_OF_THE_VALLEY, Blocks.POTTED_LILY_OF_THE_VALLEY, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4246 | this.createPlantWithDefaultItem(Blocks.WITHER_ROSE, Blocks.POTTED_WITHER_ROSE, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4247 | this.createPlantWithDefaultItem(Blocks.RED_MUSHROOM, Blocks.POTTED_RED_MUSHROOM, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4248 | this.createPlantWithDefaultItem(Blocks.BROWN_MUSHROOM, Blocks.POTTED_BROWN_MUSHROOM, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4249 | this.createPlantWithDefaultItem(Blocks.DEAD_BUSH, Blocks.POTTED_DEAD_BUSH, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4250 | this.createPlantWithDefaultItem(Blocks.TORCHFLOWER, Blocks.POTTED_TORCHFLOWER, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4251 | this.createSpeleothem(Blocks.POINTED_DRIPSTONE);
|
| 4252 | this.createSpeleothem(Blocks.SULFUR_SPIKE);
|
| 4253 | this.createMushroomBlock(Blocks.BROWN_MUSHROOM_BLOCK);
|
| 4254 | this.createMushroomBlock(Blocks.RED_MUSHROOM_BLOCK);
|
| 4255 | this.createMushroomBlock(Blocks.MUSHROOM_STEM);
|
| 4256 | this.createCrossBlock(Blocks.SHORT_GRASS, BlockModelGenerators.PlantType.TINTED);
|
| 4257 | this.createItemWithGrassTint(Blocks.SHORT_GRASS);
|
| 4258 | this.createCrossBlockWithDefaultItem(Blocks.SHORT_DRY_GRASS, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4259 | this.createCrossBlockWithDefaultItem(Blocks.TALL_DRY_GRASS, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4260 | this.createCrossBlockWithDefaultItem(Blocks.RED_SHRUB, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4261 | this.createCrossBlock(Blocks.BUSH, BlockModelGenerators.PlantType.TINTED);
|
| 4262 | this.createItemWithGrassTint(Blocks.BUSH);
|
| 4263 | this.createCrossBlock(Blocks.SUGAR_CANE, BlockModelGenerators.PlantType.TINTED);
|
| 4264 | this.registerSimpleFlatItemModel(Items.SUGAR_CANE);
|
| 4265 | this.createGrowingPlant(Blocks.KELP, Blocks.KELP_PLANT, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4266 | this.registerSimpleFlatItemModel(Items.KELP);
|
| 4267 | this.createCrossBlock(Blocks.HANGING_ROOTS, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4268 | this.createGrowingPlant(Blocks.WEEPING_VINES, Blocks.WEEPING_VINES_PLANT, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4269 | this.createGrowingPlant(Blocks.TWISTING_VINES, Blocks.TWISTING_VINES_PLANT, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4270 | this.registerSimpleFlatItemModel(Blocks.WEEPING_VINES, "_plant");
|
| 4271 | this.registerSimpleFlatItemModel(Blocks.TWISTING_VINES, "_plant");
|
| 4272 | this.createCrossBlockWithDefaultItem(
|
| 4273 | Blocks.BAMBOO_SAPLING, BlockModelGenerators.PlantType.TINTED, TextureMapping.cross(TextureMapping.getBlockTexture(Blocks.BAMBOO, "_stage0"))
|
| 4274 | );
|
| 4275 | this.createBamboo();
|
| 4276 | this.createCrossBlockWithDefaultItem(Blocks.CACTUS_FLOWER, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4277 | this.createCrossBlockWithDefaultItem(Blocks.COBWEB, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4278 | this.createDoublePlantWithDefaultItem(Blocks.LILAC, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4279 | this.createDoublePlantWithDefaultItem(Blocks.ROSE_BUSH, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4280 | this.createDoublePlantWithDefaultItem(Blocks.PEONY, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4281 | this.createTintedDoublePlant(Blocks.TALL_GRASS);
|
| 4282 | this.createTintedDoublePlant(Blocks.LARGE_FERN);
|
| 4283 | this.createSunflower();
|
| 4284 | this.createTallSeagrass();
|
| 4285 | this.createSmallDripleaf();
|
| 4286 | this.createCoral(
|
| 4287 | Blocks.TUBE_CORAL,
|
| 4288 | Blocks.DEAD_TUBE_CORAL,
|
| 4289 | Blocks.TUBE_CORAL_BLOCK,
|
| 4290 | Blocks.DEAD_TUBE_CORAL_BLOCK,
|
| 4291 | Blocks.TUBE_CORAL_FAN,
|
| 4292 | Blocks.DEAD_TUBE_CORAL_FAN,
|
| 4293 | Blocks.TUBE_CORAL_WALL_FAN,
|
| 4294 | Blocks.DEAD_TUBE_CORAL_WALL_FAN
|
| 4295 | );
|
| 4296 | this.createCoral(
|
| 4297 | Blocks.BRAIN_CORAL,
|
| 4298 | Blocks.DEAD_BRAIN_CORAL,
|
| 4299 | Blocks.BRAIN_CORAL_BLOCK,
|
| 4300 | Blocks.DEAD_BRAIN_CORAL_BLOCK,
|
| 4301 | Blocks.BRAIN_CORAL_FAN,
|
| 4302 | Blocks.DEAD_BRAIN_CORAL_FAN,
|
| 4303 | Blocks.BRAIN_CORAL_WALL_FAN,
|
| 4304 | Blocks.DEAD_BRAIN_CORAL_WALL_FAN
|
| 4305 | );
|
| 4306 | this.createCoral(
|
| 4307 | Blocks.BUBBLE_CORAL,
|
| 4308 | Blocks.DEAD_BUBBLE_CORAL,
|
| 4309 | Blocks.BUBBLE_CORAL_BLOCK,
|
| 4310 | Blocks.DEAD_BUBBLE_CORAL_BLOCK,
|
| 4311 | Blocks.BUBBLE_CORAL_FAN,
|
| 4312 | Blocks.DEAD_BUBBLE_CORAL_FAN,
|
| 4313 | Blocks.BUBBLE_CORAL_WALL_FAN,
|
| 4314 | Blocks.DEAD_BUBBLE_CORAL_WALL_FAN
|
| 4315 | );
|
| 4316 | this.createCoral(
|
| 4317 | Blocks.FIRE_CORAL,
|
| 4318 | Blocks.DEAD_FIRE_CORAL,
|
| 4319 | Blocks.FIRE_CORAL_BLOCK,
|
| 4320 | Blocks.DEAD_FIRE_CORAL_BLOCK,
|
| 4321 | Blocks.FIRE_CORAL_FAN,
|
| 4322 | Blocks.DEAD_FIRE_CORAL_FAN,
|
| 4323 | Blocks.FIRE_CORAL_WALL_FAN,
|
| 4324 | Blocks.DEAD_FIRE_CORAL_WALL_FAN
|
| 4325 | );
|
| 4326 | this.createCoral(
|
| 4327 | Blocks.HORN_CORAL,
|
| 4328 | Blocks.DEAD_HORN_CORAL,
|
| 4329 | Blocks.HORN_CORAL_BLOCK,
|
| 4330 | Blocks.DEAD_HORN_CORAL_BLOCK,
|
| 4331 | Blocks.HORN_CORAL_FAN,
|
| 4332 | Blocks.DEAD_HORN_CORAL_FAN,
|
| 4333 | Blocks.HORN_CORAL_WALL_FAN,
|
| 4334 | Blocks.DEAD_HORN_CORAL_WALL_FAN
|
| 4335 | );
|
| 4336 | this.createStems(Blocks.MELON_STEM, Blocks.ATTACHED_MELON_STEM);
|
| 4337 | this.createStems(Blocks.PUMPKIN_STEM, Blocks.ATTACHED_PUMPKIN_STEM);
|
| 4338 | this.woodProvider(Blocks.MANGROVE_LOG).logWithHorizontal(Blocks.MANGROVE_LOG).wood(Blocks.MANGROVE_WOOD);
|
| 4339 | this.woodProvider(Blocks.STRIPPED_MANGROVE_LOG).logWithHorizontal(Blocks.STRIPPED_MANGROVE_LOG).wood(Blocks.STRIPPED_MANGROVE_WOOD);
|
| 4340 | this.createTintedLeaves(Blocks.MANGROVE_LEAVES, TexturedModel.LEAVES, -7158200);
|
| 4341 | this.woodProvider(Blocks.ACACIA_LOG).logWithHorizontal(Blocks.ACACIA_LOG).wood(Blocks.ACACIA_WOOD);
|
| 4342 | this.woodProvider(Blocks.STRIPPED_ACACIA_LOG).logWithHorizontal(Blocks.STRIPPED_ACACIA_LOG).wood(Blocks.STRIPPED_ACACIA_WOOD);
|
| 4343 | this.createPlantWithDefaultItem(Blocks.ACACIA_SAPLING, Blocks.POTTED_ACACIA_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4344 | this.createTintedLeaves(Blocks.ACACIA_LEAVES, TexturedModel.LEAVES, -12012264);
|
| 4345 | this.woodProvider(Blocks.CHERRY_LOG).logUVLocked(Blocks.CHERRY_LOG).wood(Blocks.CHERRY_WOOD);
|
| 4346 | this.woodProvider(Blocks.STRIPPED_CHERRY_LOG).logUVLocked(Blocks.STRIPPED_CHERRY_LOG).wood(Blocks.STRIPPED_CHERRY_WOOD);
|
| 4347 | this.createPlantWithDefaultItem(Blocks.CHERRY_SAPLING, Blocks.POTTED_CHERRY_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4348 | this.createTrivialBlock(Blocks.CHERRY_LEAVES, TexturedModel.LEAVES);
|
| 4349 | this.woodProvider(Blocks.BIRCH_LOG).logWithHorizontal(Blocks.BIRCH_LOG).wood(Blocks.BIRCH_WOOD);
|
| 4350 | this.woodProvider(Blocks.STRIPPED_BIRCH_LOG).logWithHorizontal(Blocks.STRIPPED_BIRCH_LOG).wood(Blocks.STRIPPED_BIRCH_WOOD);
|
| 4351 | this.createPlantWithDefaultItem(Blocks.BIRCH_SAPLING, Blocks.POTTED_BIRCH_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4352 | this.createTintedLeaves(Blocks.BIRCH_LEAVES, TexturedModel.LEAVES, -8345771);
|
| 4353 | this.woodProvider(Blocks.OAK_LOG).logWithHorizontal(Blocks.OAK_LOG).wood(Blocks.OAK_WOOD);
|
| 4354 | this.woodProvider(Blocks.STRIPPED_OAK_LOG).logWithHorizontal(Blocks.STRIPPED_OAK_LOG).wood(Blocks.STRIPPED_OAK_WOOD);
|
| 4355 | this.createPlantWithDefaultItem(Blocks.OAK_SAPLING, Blocks.POTTED_OAK_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4356 | this.createTintedLeaves(Blocks.OAK_LEAVES, TexturedModel.LEAVES, -12012264);
|
| 4357 | this.woodProvider(Blocks.SPRUCE_LOG).logWithHorizontal(Blocks.SPRUCE_LOG).wood(Blocks.SPRUCE_WOOD);
|
| 4358 | this.woodProvider(Blocks.STRIPPED_SPRUCE_LOG).logWithHorizontal(Blocks.STRIPPED_SPRUCE_LOG).wood(Blocks.STRIPPED_SPRUCE_WOOD);
|
| 4359 | this.createPlantWithDefaultItem(Blocks.SPRUCE_SAPLING, Blocks.POTTED_SPRUCE_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4360 | this.createTintedLeaves(Blocks.SPRUCE_LEAVES, TexturedModel.LEAVES, -10380959);
|
| 4361 | this.woodProvider(Blocks.DARK_OAK_LOG).logWithHorizontal(Blocks.DARK_OAK_LOG).wood(Blocks.DARK_OAK_WOOD);
|
| 4362 | this.woodProvider(Blocks.STRIPPED_DARK_OAK_LOG).logWithHorizontal(Blocks.STRIPPED_DARK_OAK_LOG).wood(Blocks.STRIPPED_DARK_OAK_WOOD);
|
| 4363 | this.createPlantWithDefaultItem(Blocks.DARK_OAK_SAPLING, Blocks.POTTED_DARK_OAK_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4364 | this.createTintedLeaves(Blocks.DARK_OAK_LEAVES, TexturedModel.LEAVES, -12012264);
|
| 4365 | this.woodProvider(Blocks.PALE_OAK_LOG).logWithHorizontal(Blocks.PALE_OAK_LOG).wood(Blocks.PALE_OAK_WOOD);
|
| 4366 | this.woodProvider(Blocks.STRIPPED_PALE_OAK_LOG).logWithHorizontal(Blocks.STRIPPED_PALE_OAK_LOG).wood(Blocks.STRIPPED_PALE_OAK_WOOD);
|
| 4367 | this.createPlantWithDefaultItem(Blocks.PALE_OAK_SAPLING, Blocks.POTTED_PALE_OAK_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4368 | this.createTrivialBlock(Blocks.PALE_OAK_LEAVES, TexturedModel.LEAVES);
|
| 4369 | this.woodProvider(Blocks.POPLAR_LOG).logWithHorizontal(Blocks.POPLAR_LOG).wood(Blocks.POPLAR_WOOD);
|
| 4370 | this.woodProvider(Blocks.STRIPPED_POPLAR_LOG).logWithHorizontal(Blocks.STRIPPED_POPLAR_LOG).wood(Blocks.STRIPPED_POPLAR_WOOD);
|
| 4371 | this.createPlantWithDefaultItem(Blocks.POPLAR_SAPLING, Blocks.POTTED_POPLAR_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4372 | this.createTrivialCube(Blocks.RED_POPLAR_LEAVES);
|
| 4373 | this.createTrivialCube(Blocks.ORANGE_POPLAR_LEAVES);
|
| 4374 | this.createTrivialCube(Blocks.YELLOW_POPLAR_LEAVES);
|
| 4375 | this.woodProvider(Blocks.JUNGLE_LOG).logWithHorizontal(Blocks.JUNGLE_LOG).wood(Blocks.JUNGLE_WOOD);
|
| 4376 | this.woodProvider(Blocks.STRIPPED_JUNGLE_LOG).logWithHorizontal(Blocks.STRIPPED_JUNGLE_LOG).wood(Blocks.STRIPPED_JUNGLE_WOOD);
|
| 4377 | this.createPlantWithDefaultItem(Blocks.JUNGLE_SAPLING, Blocks.POTTED_JUNGLE_SAPLING, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4378 | this.createTintedLeaves(Blocks.JUNGLE_LEAVES, TexturedModel.LEAVES, -12012264);
|
| 4379 | this.woodProvider(Blocks.CRIMSON_STEM).log(Blocks.CRIMSON_STEM).wood(Blocks.CRIMSON_HYPHAE);
|
| 4380 | this.woodProvider(Blocks.STRIPPED_CRIMSON_STEM).log(Blocks.STRIPPED_CRIMSON_STEM).wood(Blocks.STRIPPED_CRIMSON_HYPHAE);
|
| 4381 | this.createPlantWithDefaultItem(Blocks.CRIMSON_FUNGUS, Blocks.POTTED_CRIMSON_FUNGUS, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4382 | this.createNetherRoots(Blocks.CRIMSON_ROOTS, Blocks.POTTED_CRIMSON_ROOTS);
|
| 4383 | this.woodProvider(Blocks.WARPED_STEM).log(Blocks.WARPED_STEM).wood(Blocks.WARPED_HYPHAE);
|
| 4384 | this.woodProvider(Blocks.STRIPPED_WARPED_STEM).log(Blocks.STRIPPED_WARPED_STEM).wood(Blocks.STRIPPED_WARPED_HYPHAE);
|
| 4385 | this.createPlantWithDefaultItem(Blocks.WARPED_FUNGUS, Blocks.POTTED_WARPED_FUNGUS, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4386 | this.createNetherRoots(Blocks.WARPED_ROOTS, Blocks.POTTED_WARPED_ROOTS);
|
| 4387 | this.woodProvider(Blocks.BAMBOO_BLOCK).logUVLocked(Blocks.BAMBOO_BLOCK);
|
| 4388 | this.woodProvider(Blocks.STRIPPED_BAMBOO_BLOCK).logUVLocked(Blocks.STRIPPED_BAMBOO_BLOCK);
|
| 4389 | this.createCrossBlock(Blocks.NETHER_SPROUTS, BlockModelGenerators.PlantType.NOT_TINTED);
|
| 4390 | this.registerSimpleFlatItemModel(Items.NETHER_SPROUTS);
|
| 4391 | this.createDoor(Blocks.IRON_DOOR);
|
| 4392 | this.createTrapdoor(Blocks.IRON_TRAPDOOR);
|
| 4393 | this.createSmoothStoneSlab();
|
| 4394 | this.createPassiveRail(Blocks.RAIL);
|
| 4395 | this.createActiveRail(Blocks.POWERED_RAIL);
|
| 4396 | this.createActiveRail(Blocks.DETECTOR_RAIL);
|
| 4397 | this.createActiveRail(Blocks.ACTIVATOR_RAIL);
|
| 4398 | this.createComparator();
|
| 4399 | this.createCommandBlock(Blocks.COMMAND_BLOCK);
|
| 4400 | this.createCommandBlock(Blocks.REPEATING_COMMAND_BLOCK);
|
| 4401 | this.createCommandBlock(Blocks.CHAIN_COMMAND_BLOCK);
|
| 4402 | this.createAnvil(Blocks.ANVIL);
|
| 4403 | this.createAnvil(Blocks.CHIPPED_ANVIL);
|
| 4404 | this.createAnvil(Blocks.DAMAGED_ANVIL);
|
| 4405 | this.createBarrel();
|
| 4406 | this.createBell();
|
| 4407 | this.createFurnace(Blocks.FURNACE, TexturedModel.ORIENTABLE_ONLY_TOP);
|
| 4408 | this.createFurnace(Blocks.BLAST_FURNACE, TexturedModel.ORIENTABLE_ONLY_TOP);
|
| 4409 | this.createFurnace(Blocks.SMOKER, TexturedModel.ORIENTABLE);
|
| 4410 | this.createRedstoneWire();
|
| 4411 | this.createRespawnAnchor();
|
| 4412 | this.createSculkCatalyst();
|
| 4413 | this.copyModel(Blocks.CHISELED_STONE_BRICKS, Blocks.INFESTED_CHISELED_STONE_BRICKS);
|
| 4414 | this.copyModel(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE);
|
| 4415 | this.copyModel(Blocks.CRACKED_STONE_BRICKS, Blocks.INFESTED_CRACKED_STONE_BRICKS);
|
| 4416 | this.copyModel(Blocks.MOSSY_STONE_BRICKS, Blocks.INFESTED_MOSSY_STONE_BRICKS);
|
| 4417 | this.createInfestedStone();
|
| 4418 | this.copyModel(Blocks.STONE_BRICKS, Blocks.INFESTED_STONE_BRICKS);
|
| 4419 | this.createInfestedDeepslate();
|
| 4420 | }
|
| 4421 |
|
| 4422 | private void createLightBlock() {
|
| 4423 | Map<Integer, ItemModel.Unbaked> overrides = new HashMap<>(16);
|
| 4424 | PropertyDispatch.C1<MultiVariant, Integer> light = PropertyDispatch.initial(BlockStateProperties.LEVEL);
|
| 4425 |
|
| 4426 | for (int i = 0; i <= 15; i++) {
|
| 4427 | String suffix = String.format(Locale.ROOT, "_%02d", i);
|
| 4428 | Material texture = TextureMapping.getItemTexture(Items.LIGHT, suffix);
|
| 4429 | light.select(i, plainVariant(ModelTemplates.PARTICLE_ONLY.createWithSuffix(Blocks.LIGHT, suffix, TextureMapping.particle(texture), this.modelOutput)));
|
| 4430 | ItemModel.Unbaked overrideItem = ItemModelUtils.plainModel(
|
| 4431 | ModelTemplates.FLAT_ITEM.create(ModelLocationUtils.getModelLocation(Items.LIGHT, suffix), TextureMapping.layer0(texture), this.modelOutput)
|
| 4432 | );
|
| 4433 | overrides.put(i, overrideItem);
|
| 4434 | }
|
| 4435 |
|
| 4436 | this.itemModelOutput.accept(Items.LIGHT, ItemModelUtils.selectBlockItemProperty(LightBlock.LEVEL, overrides.get(15), overrides));
|
| 4437 | this.blockStateOutput.accept(MultiVariantGenerator.dispatch(Blocks.LIGHT).with(light));
|
| 4438 | }
|
| 4439 |
|
| 4440 | /**
|
| 4441 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 4442 | */
|
| 4443 | public final void createCopperChainItem(final Item unwaxed, final Item waxed) {
|
| 4444 | Identifier model = this.createFlatItemModel(unwaxed);
|
| 4445 | this.registerSimpleItemModel(unwaxed, model);
|
| 4446 | this.registerSimpleItemModel(waxed, model);
|
| 4447 | }
|
| 4448 |
|
| 4449 | /**
|
| 4450 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 4451 | */
|
| 4452 | public final void createCandleAndCandleCake(final Block candleBlock, final Block candleCakeBlock) {
|
| 4453 | this.registerSimpleFlatItemModel(candleBlock.asItem());
|
| 4454 | TextureMapping candleTexture = TextureMapping.cube(TextureMapping.getBlockTexture(candleBlock));
|
| 4455 | TextureMapping candleLitTexture = TextureMapping.cube(TextureMapping.getBlockTexture(candleBlock, "_lit"));
|
| 4456 | MultiVariant oneCandle = plainVariant(ModelTemplates.CANDLE.createWithSuffix(candleBlock, "_one_candle", candleTexture, this.modelOutput));
|
| 4457 | MultiVariant twoCandles = plainVariant(ModelTemplates.TWO_CANDLES.createWithSuffix(candleBlock, "_two_candles", candleTexture, this.modelOutput));
|
| 4458 | MultiVariant threeCandles = plainVariant(ModelTemplates.THREE_CANDLES.createWithSuffix(candleBlock, "_three_candles", candleTexture, this.modelOutput));
|
| 4459 | MultiVariant fourCandles = plainVariant(ModelTemplates.FOUR_CANDLES.createWithSuffix(candleBlock, "_four_candles", candleTexture, this.modelOutput));
|
| 4460 | MultiVariant oneCandleLit = plainVariant(ModelTemplates.CANDLE.createWithSuffix(candleBlock, "_one_candle_lit", candleLitTexture, this.modelOutput));
|
| 4461 | MultiVariant twoCandlesLit = plainVariant(ModelTemplates.TWO_CANDLES.createWithSuffix(candleBlock, "_two_candles_lit", candleLitTexture, this.modelOutput));
|
| 4462 | MultiVariant threeCandlesLit = plainVariant(
|
| 4463 | ModelTemplates.THREE_CANDLES.createWithSuffix(candleBlock, "_three_candles_lit", candleLitTexture, this.modelOutput)
|
| 4464 | );
|
| 4465 | MultiVariant fourCandlesLit = plainVariant(ModelTemplates.FOUR_CANDLES.createWithSuffix(candleBlock, "_four_candles_lit", candleLitTexture, this.modelOutput));
|
| 4466 | this.blockStateOutput
|
| 4467 | .accept(
|
| 4468 | MultiVariantGenerator.dispatch(candleBlock)
|
| 4469 | .with(
|
| 4470 | PropertyDispatch.initial(BlockStateProperties.CANDLES, BlockStateProperties.LIT)
|
| 4471 | .select(1, false, oneCandle)
|
| 4472 | .select(2, false, twoCandles)
|
| 4473 | .select(3, false, threeCandles)
|
| 4474 | .select(4, false, fourCandles)
|
| 4475 | .select(1, true, oneCandleLit)
|
| 4476 | .select(2, true, twoCandlesLit)
|
| 4477 | .select(3, true, threeCandlesLit)
|
| 4478 | .select(4, true, fourCandlesLit)
|
| 4479 | )
|
| 4480 | );
|
| 4481 | MultiVariant candleCake = plainVariant(ModelTemplates.CANDLE_CAKE.create(candleCakeBlock, TextureMapping.candleCake(candleBlock, false), this.modelOutput));
|
| 4482 | MultiVariant litCandleCake = plainVariant(
|
| 4483 | ModelTemplates.CANDLE_CAKE.createWithSuffix(candleCakeBlock, "_lit", TextureMapping.candleCake(candleBlock, true), this.modelOutput)
|
| 4484 | );
|
| 4485 | this.blockStateOutput
|
| 4486 | .accept(MultiVariantGenerator.dispatch(candleCakeBlock).with(createBooleanModelDispatch(BlockStateProperties.LIT, litCandleCake, candleCake)));
|
| 4487 | }
|
| 4488 |
|
| 4489 | /**
|
| 4490 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 4491 | */
|
| 4492 | @Environment(EnvType.CLIENT)
|
| 4493 | public class BlockFamilyProvider {
|
| 4494 | private final TextureMapping mapping;
|
| 4495 | private final Map<ModelTemplate, Identifier> models = new HashMap<>();
|
| 4496 | private @Nullable BlockFamily family;
|
| 4497 | private @Nullable Variant fullBlock;
|
| 4498 | private final Set<Block> skipGeneratingModelsFor = new HashSet<>();
|
| 4499 |
|
| 4500 | public BlockFamilyProvider(final TextureMapping mapping) {
|
| 4501 | this.mapping = mapping;
|
| 4502 | }
|
| 4503 |
|
| 4504 | public BlockModelGenerators.BlockFamilyProvider fullBlock(final Block block, final ModelTemplate template) {
|
| 4505 | this.fullBlock = BlockModelGenerators.plainModel(template.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4506 | if (BlockModelGenerators.FULL_BLOCK_MODEL_CUSTOM_GENERATORS.containsKey(block)) {
|
| 4507 | BlockModelGenerators.this.blockStateOutput
|
| 4508 | .accept(
|
| 4509 | BlockModelGenerators.FULL_BLOCK_MODEL_CUSTOM_GENERATORS.get(block).create(block, this.fullBlock, this.mapping, BlockModelGenerators.this.modelOutput)
|
| 4510 | );
|
| 4511 | } else {
|
| 4512 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(block, BlockModelGenerators.variant(this.fullBlock)));
|
| 4513 | }
|
| 4514 |
|
| 4515 | return this;
|
| 4516 | }
|
| 4517 |
|
| 4518 | public BlockModelGenerators.BlockFamilyProvider donateModelTo(final Block donor, final Block copyTo) {
|
| 4519 | Identifier donorModelLocation = ModelLocationUtils.getModelLocation(donor);
|
| 4520 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(copyTo, BlockModelGenerators.plainVariant(donorModelLocation)));
|
| 4521 | BlockModelGenerators.this.itemModelOutput.copy(donor.asItem(), copyTo.asItem());
|
| 4522 | this.skipGeneratingModelsFor.add(copyTo);
|
| 4523 | return this;
|
| 4524 | }
|
| 4525 |
|
| 4526 | public BlockModelGenerators.BlockFamilyProvider button(final Block block) {
|
| 4527 | MultiVariant normal = BlockModelGenerators.plainVariant(ModelTemplates.BUTTON.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4528 | MultiVariant pressed = BlockModelGenerators.plainVariant(ModelTemplates.BUTTON_PRESSED.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4529 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createButton(block, normal, pressed));
|
| 4530 | Identifier inventory = ModelTemplates.BUTTON_INVENTORY.create(block, this.mapping, BlockModelGenerators.this.modelOutput);
|
| 4531 | BlockModelGenerators.this.registerSimpleItemModel(block, inventory);
|
| 4532 | return this;
|
| 4533 | }
|
| 4534 |
|
| 4535 | public BlockModelGenerators.BlockFamilyProvider carpet(final Block block) {
|
| 4536 | TextureMapping carpetMapping = new TextureMapping().put(TextureSlot.WOOL, this.mapping.get(TextureSlot.ALL));
|
| 4537 | Identifier model = ModelTemplates.CARPET.create(block, carpetMapping, BlockModelGenerators.this.modelOutput);
|
| 4538 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(block, BlockModelGenerators.plainVariant(model)));
|
| 4539 | BlockModelGenerators.this.registerSimpleItemModel(block, model);
|
| 4540 | return this;
|
| 4541 | }
|
| 4542 |
|
| 4543 | public BlockModelGenerators.BlockFamilyProvider wall(final Block block) {
|
| 4544 | MultiVariant post = BlockModelGenerators.plainVariant(ModelTemplates.WALL_POST.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4545 | MultiVariant low = BlockModelGenerators.plainVariant(ModelTemplates.WALL_LOW_SIDE.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4546 | MultiVariant high = BlockModelGenerators.plainVariant(ModelTemplates.WALL_TALL_SIDE.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4547 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createWall(block, post, low, high));
|
| 4548 | Identifier inventory = ModelTemplates.WALL_INVENTORY.create(block, this.mapping, BlockModelGenerators.this.modelOutput);
|
| 4549 | BlockModelGenerators.this.registerSimpleItemModel(block, inventory);
|
| 4550 | return this;
|
| 4551 | }
|
| 4552 |
|
| 4553 | public BlockModelGenerators.BlockFamilyProvider customFence(final Block block) {
|
| 4554 | TextureMapping mapping = TextureMapping.customParticle(block);
|
| 4555 | MultiVariant post = BlockModelGenerators.plainVariant(ModelTemplates.CUSTOM_FENCE_POST.create(block, mapping, BlockModelGenerators.this.modelOutput));
|
| 4556 | MultiVariant north = BlockModelGenerators.plainVariant(ModelTemplates.CUSTOM_FENCE_SIDE_NORTH.create(block, mapping, BlockModelGenerators.this.modelOutput));
|
| 4557 | MultiVariant east = BlockModelGenerators.plainVariant(ModelTemplates.CUSTOM_FENCE_SIDE_EAST.create(block, mapping, BlockModelGenerators.this.modelOutput));
|
| 4558 | MultiVariant south = BlockModelGenerators.plainVariant(ModelTemplates.CUSTOM_FENCE_SIDE_SOUTH.create(block, mapping, BlockModelGenerators.this.modelOutput));
|
| 4559 | MultiVariant west = BlockModelGenerators.plainVariant(ModelTemplates.CUSTOM_FENCE_SIDE_WEST.create(block, mapping, BlockModelGenerators.this.modelOutput));
|
| 4560 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createCustomFence(block, post, north, east, south, west));
|
| 4561 | Identifier inventory = ModelTemplates.CUSTOM_FENCE_INVENTORY.create(block, mapping, BlockModelGenerators.this.modelOutput);
|
| 4562 | BlockModelGenerators.this.registerSimpleItemModel(block, inventory);
|
| 4563 | return this;
|
| 4564 | }
|
| 4565 |
|
| 4566 | public BlockModelGenerators.BlockFamilyProvider fence(final Block block) {
|
| 4567 | MultiVariant post = BlockModelGenerators.plainVariant(ModelTemplates.FENCE_POST.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4568 | MultiVariant side = BlockModelGenerators.plainVariant(ModelTemplates.FENCE_SIDE.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4569 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createFence(block, post, side));
|
| 4570 | Identifier inventory = ModelTemplates.FENCE_INVENTORY.create(block, this.mapping, BlockModelGenerators.this.modelOutput);
|
| 4571 | BlockModelGenerators.this.registerSimpleItemModel(block, inventory);
|
| 4572 | return this;
|
| 4573 | }
|
| 4574 |
|
| 4575 | public BlockModelGenerators.BlockFamilyProvider customFenceGate(final Block block) {
|
| 4576 | TextureMapping mapping = TextureMapping.customParticle(block);
|
| 4577 | MultiVariant open = BlockModelGenerators.plainVariant(ModelTemplates.CUSTOM_FENCE_GATE_OPEN.create(block, mapping, BlockModelGenerators.this.modelOutput));
|
| 4578 | MultiVariant closed = BlockModelGenerators.plainVariant(
|
| 4579 | ModelTemplates.CUSTOM_FENCE_GATE_CLOSED.create(block, mapping, BlockModelGenerators.this.modelOutput)
|
| 4580 | );
|
| 4581 | MultiVariant openWall = BlockModelGenerators.plainVariant(
|
| 4582 | ModelTemplates.CUSTOM_FENCE_GATE_WALL_OPEN.create(block, mapping, BlockModelGenerators.this.modelOutput)
|
| 4583 | );
|
| 4584 | MultiVariant closedWall = BlockModelGenerators.plainVariant(
|
| 4585 | ModelTemplates.CUSTOM_FENCE_GATE_WALL_CLOSED.create(block, mapping, BlockModelGenerators.this.modelOutput)
|
| 4586 | );
|
| 4587 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createFenceGate(block, open, closed, openWall, closedWall, false));
|
| 4588 | return this;
|
| 4589 | }
|
| 4590 |
|
| 4591 | public BlockModelGenerators.BlockFamilyProvider fenceGate(final Block block) {
|
| 4592 | MultiVariant open = BlockModelGenerators.plainVariant(ModelTemplates.FENCE_GATE_OPEN.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4593 | MultiVariant closed = BlockModelGenerators.plainVariant(ModelTemplates.FENCE_GATE_CLOSED.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4594 | MultiVariant openWall = BlockModelGenerators.plainVariant(
|
| 4595 | ModelTemplates.FENCE_GATE_WALL_OPEN.create(block, this.mapping, BlockModelGenerators.this.modelOutput)
|
| 4596 | );
|
| 4597 | MultiVariant closedWall = BlockModelGenerators.plainVariant(
|
| 4598 | ModelTemplates.FENCE_GATE_WALL_CLOSED.create(block, this.mapping, BlockModelGenerators.this.modelOutput)
|
| 4599 | );
|
| 4600 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createFenceGate(block, open, closed, openWall, closedWall, true));
|
| 4601 | return this;
|
| 4602 | }
|
| 4603 |
|
| 4604 | public BlockModelGenerators.BlockFamilyProvider pressurePlate(final Block block) {
|
| 4605 | MultiVariant off = BlockModelGenerators.plainVariant(ModelTemplates.PRESSURE_PLATE_UP.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4606 | MultiVariant on = BlockModelGenerators.plainVariant(ModelTemplates.PRESSURE_PLATE_DOWN.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4607 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createPressurePlate(block, off, on));
|
| 4608 | return this;
|
| 4609 | }
|
| 4610 |
|
| 4611 | public BlockModelGenerators.BlockFamilyProvider sign(final Block sign) {
|
| 4612 | if (this.family == null) {
|
| 4613 | throw new IllegalStateException("Family not defined");
|
| 4614 | }
|
| 4615 |
|
| 4616 | TextureMapping mapping = new TextureMapping()
|
| 4617 | .put(TextureSlot.ALL, TextureMapping.getBlockTexture(sign))
|
| 4618 | .put(TextureSlot.PARTICLE, TextureMapping.getBlockTexture(this.family.getBaseBlock()));
|
| 4619 | MultiVariant standingRot0 = BlockModelGenerators.plainVariant(
|
| 4620 | ModelTemplates.SIGN_ROT_0.create(ModelLocationUtils.getModelLocation(sign, "_rot_0"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4621 | );
|
| 4622 | MultiVariant standingRot1 = BlockModelGenerators.plainVariant(
|
| 4623 | ModelTemplates.SIGN_ROT_1.create(ModelLocationUtils.getModelLocation(sign, "_rot_1"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4624 | );
|
| 4625 | MultiVariant standingRot2 = BlockModelGenerators.plainVariant(
|
| 4626 | ModelTemplates.SIGN_ROT_2.create(ModelLocationUtils.getModelLocation(sign, "_rot_2"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4627 | );
|
| 4628 | MultiVariant standingRot3 = BlockModelGenerators.plainVariant(
|
| 4629 | ModelTemplates.SIGN_ROT_3.create(ModelLocationUtils.getModelLocation(sign, "_rot_3"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4630 | );
|
| 4631 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSign(sign, standingRot0, standingRot1, standingRot2, standingRot3));
|
| 4632 | Block wallSign = this.family.getVariants().get(Variant.WALL_SIGN);
|
| 4633 | MultiVariant wallModel = BlockModelGenerators.plainVariant(ModelTemplates.WALL_SIGN.create(wallSign, mapping, BlockModelGenerators.this.modelOutput));
|
| 4634 | BlockModelGenerators.this.blockStateOutput
|
| 4635 | .accept(MultiVariantGenerator.dispatch(wallSign, wallModel).with(BlockModelGenerators.ROTATION_HORIZONTAL_FACING_ALT));
|
| 4636 | BlockModelGenerators.this.registerSimpleFlatItemModel(sign.asItem());
|
| 4637 | return this;
|
| 4638 | }
|
| 4639 |
|
| 4640 | public BlockModelGenerators.BlockFamilyProvider customHangingSign(final Block hangingSign) {
|
| 4641 | return this.hangingSign(hangingSign, this.family.getBaseBlock(), Variant.CUSTOM_WALL_HANGING_SIGN);
|
| 4642 | }
|
| 4643 |
|
| 4644 | public BlockModelGenerators.BlockFamilyProvider hangingSign(final Block hangingSign) {
|
| 4645 | return this.hangingSign(hangingSign, this.family.get(Variant.STRIPPED_LOG), Variant.WALL_HANGING_SIGN);
|
| 4646 | }
|
| 4647 |
|
| 4648 | private BlockModelGenerators.BlockFamilyProvider hangingSign(final Block hangingSign, final Block particleBlock, final Variant wallVarient) {
|
| 4649 | TextureMapping mapping = new TextureMapping()
|
| 4650 | .put(TextureSlot.ALL, TextureMapping.getBlockTexture(hangingSign))
|
| 4651 | .put(TextureSlot.PARTICLE, TextureMapping.getBlockTexture(particleBlock));
|
| 4652 | BlockModelGenerators.this.blockStateOutput
|
| 4653 | .accept(
|
| 4654 | BlockModelGenerators.createHangingSign(
|
| 4655 | hangingSign,
|
| 4656 | BlockModelGenerators.plainVariant(
|
| 4657 | ModelTemplates.HANGING_SIGN_ROT_0.create(ModelLocationUtils.getModelLocation(hangingSign, "_rot_0"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4658 | ),
|
| 4659 | BlockModelGenerators.plainVariant(
|
| 4660 | ModelTemplates.HANGING_SIGN_ROT_1.create(ModelLocationUtils.getModelLocation(hangingSign, "_rot_1"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4661 | ),
|
| 4662 | BlockModelGenerators.plainVariant(
|
| 4663 | ModelTemplates.HANGING_SIGN_ROT_2.create(ModelLocationUtils.getModelLocation(hangingSign, "_rot_2"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4664 | ),
|
| 4665 | BlockModelGenerators.plainVariant(
|
| 4666 | ModelTemplates.HANGING_SIGN_ROT_3.create(ModelLocationUtils.getModelLocation(hangingSign, "_rot_3"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4667 | ),
|
| 4668 | BlockModelGenerators.plainVariant(
|
| 4669 | ModelTemplates.ATTACHED_HANGING_SIGN_ROT_0
|
| 4670 | .create(ModelLocationUtils.getModelLocation(hangingSign, "_attached_rot_0"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4671 | ),
|
| 4672 | BlockModelGenerators.plainVariant(
|
| 4673 | ModelTemplates.ATTACHED_HANGING_SIGN_ROT_1
|
| 4674 | .create(ModelLocationUtils.getModelLocation(hangingSign, "_attached_rot_1"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4675 | ),
|
| 4676 | BlockModelGenerators.plainVariant(
|
| 4677 | ModelTemplates.ATTACHED_HANGING_SIGN_ROT_2
|
| 4678 | .create(ModelLocationUtils.getModelLocation(hangingSign, "_attached_rot_2"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4679 | ),
|
| 4680 | BlockModelGenerators.plainVariant(
|
| 4681 | ModelTemplates.ATTACHED_HANGING_SIGN_ROT_3
|
| 4682 | .create(ModelLocationUtils.getModelLocation(hangingSign, "_attached_rot_3"), mapping, BlockModelGenerators.this.modelOutput)
|
| 4683 | )
|
| 4684 | )
|
| 4685 | );
|
| 4686 | Block wallSign = this.family.get(wallVarient);
|
| 4687 | MultiVariant wallModel = BlockModelGenerators.plainVariant(ModelTemplates.WALL_HANGING_SIGN.create(wallSign, mapping, BlockModelGenerators.this.modelOutput));
|
| 4688 | BlockModelGenerators.this.blockStateOutput
|
| 4689 | .accept(MultiVariantGenerator.dispatch(wallSign, wallModel).with(BlockModelGenerators.ROTATION_HORIZONTAL_FACING_ALT));
|
| 4690 | BlockModelGenerators.this.registerSimpleFlatItemModel(hangingSign.asItem());
|
| 4691 | return this;
|
| 4692 | }
|
| 4693 |
|
| 4694 | public BlockModelGenerators.BlockFamilyProvider slab(final Block slab) {
|
| 4695 | if (this.fullBlock == null) {
|
| 4696 | throw new IllegalStateException("Full block not generated yet");
|
| 4697 | }
|
| 4698 |
|
| 4699 | Identifier bottom = this.getOrCreateModel(ModelTemplates.SLAB_BOTTOM, slab);
|
| 4700 | MultiVariant top = BlockModelGenerators.plainVariant(this.getOrCreateModel(ModelTemplates.SLAB_TOP, slab));
|
| 4701 | BlockModelGenerators.this.blockStateOutput
|
| 4702 | .accept(BlockModelGenerators.createSlab(slab, BlockModelGenerators.plainVariant(bottom), top, BlockModelGenerators.variant(this.fullBlock)));
|
| 4703 | BlockModelGenerators.this.registerSimpleItemModel(slab, bottom);
|
| 4704 | return this;
|
| 4705 | }
|
| 4706 |
|
| 4707 | public BlockModelGenerators.BlockFamilyProvider stairs(final Block stairs) {
|
| 4708 | MultiVariant inner = BlockModelGenerators.plainVariant(this.getOrCreateModel(ModelTemplates.STAIRS_INNER, stairs));
|
| 4709 | Identifier straight = this.getOrCreateModel(ModelTemplates.STAIRS_STRAIGHT, stairs);
|
| 4710 | MultiVariant outer = BlockModelGenerators.plainVariant(this.getOrCreateModel(ModelTemplates.STAIRS_OUTER, stairs));
|
| 4711 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createStairs(stairs, inner, BlockModelGenerators.plainVariant(straight), outer));
|
| 4712 | BlockModelGenerators.this.registerSimpleItemModel(stairs, straight);
|
| 4713 | return this;
|
| 4714 | }
|
| 4715 |
|
| 4716 | private BlockModelGenerators.BlockFamilyProvider fullBlockVariant(final Block variant) {
|
| 4717 | TexturedModel model = BlockModelGenerators.TEXTURED_MODELS.getOrDefault(variant, TexturedModel.CUBE.get(variant));
|
| 4718 | MultiVariant variantModel = BlockModelGenerators.plainVariant(model.create(variant, BlockModelGenerators.this.modelOutput));
|
| 4719 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(variant, variantModel));
|
| 4720 | return this;
|
| 4721 | }
|
| 4722 |
|
| 4723 | private BlockModelGenerators.BlockFamilyProvider pillar(final Block variant) {
|
| 4724 | MultiVariant verticalModel = BlockModelGenerators.plainVariant(TexturedModel.COLUMN.create(variant, BlockModelGenerators.this.modelOutput));
|
| 4725 | MultiVariant horizontalModel = BlockModelGenerators.plainVariant(TexturedModel.COLUMN_HORIZONTAL.create(variant, BlockModelGenerators.this.modelOutput));
|
| 4726 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createRotatedPillarWithHorizontalVariant(variant, verticalModel, horizontalModel));
|
| 4727 | return this;
|
| 4728 | }
|
| 4729 |
|
| 4730 | private BlockModelGenerators.BlockFamilyProvider door(final Block door) {
|
| 4731 | BlockModelGenerators.this.createDoor(door);
|
| 4732 | return this;
|
| 4733 | }
|
| 4734 |
|
| 4735 | private void trapdoor(final Block result) {
|
| 4736 | if (BlockModelGenerators.NON_ORIENTABLE_TRAPDOOR.contains(result)) {
|
| 4737 | BlockModelGenerators.this.createTrapdoor(result);
|
| 4738 | } else {
|
| 4739 | BlockModelGenerators.this.createOrientableTrapdoor(result);
|
| 4740 | }
|
| 4741 | }
|
| 4742 |
|
| 4743 | private Identifier getOrCreateModel(final ModelTemplate modelTemplate, final Block block) {
|
| 4744 | return this.models.computeIfAbsent(modelTemplate, template -> template.create(block, this.mapping, BlockModelGenerators.this.modelOutput));
|
| 4745 | }
|
| 4746 |
|
| 4747 | public BlockModelGenerators.BlockFamilyProvider generateFor(final BlockFamily family) {
|
| 4748 | this.family = family;
|
| 4749 | family.getVariants().forEach((variant, result) -> {
|
| 4750 | boolean modelAlreadyRegisteredAsAnotherFamilyBase = BlockFamilies.getAllFamilies().anyMatch(b -> b.getBaseBlock() == result);
|
| 4751 | if (!this.skipGeneratingModelsFor.contains(result) && !modelAlreadyRegisteredAsAnotherFamilyBase) {
|
| 4752 | BiConsumer<BlockModelGenerators.BlockFamilyProvider, Block> consumer = BlockModelGenerators.SHAPE_CONSUMERS.get(variant);
|
| 4753 | if (consumer != null) {
|
| 4754 | consumer.accept(this, result);
|
| 4755 | }
|
| 4756 | }
|
| 4757 | });
|
| 4758 | return this;
|
| 4759 | }
|
| 4760 | }
|
| 4761 |
|
| 4762 | @FunctionalInterface
|
| 4763 | @Environment(EnvType.CLIENT)
|
| 4764 | private interface BlockStateGeneratorSupplier {
|
| 4765 | BlockModelDefinitionGenerator create(
|
| 4766 | Block block, net.minecraft.client.renderer.block.dispatch.Variant normal, TextureMapping mapping, BiConsumer<Identifier, ModelInstance> modelOutput
|
| 4767 | );
|
| 4768 | }
|
| 4769 |
|
| 4770 | @Environment(EnvType.CLIENT)
|
| 4771 | private record BookSlotModelCacheKey(ModelTemplate template, String modelSuffix) {
|
| 4772 | }
|
| 4773 |
|
| 4774 | /**
|
| 4775 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 4776 | */
|
| 4777 | @Environment(EnvType.CLIENT)
|
| 4778 | public enum PlantType {
|
| 4779 | TINTED(ModelTemplates.TINTED_CROSS, ModelTemplates.TINTED_FLOWER_POT_CROSS, false),
|
| 4780 | NOT_TINTED(ModelTemplates.CROSS, ModelTemplates.FLOWER_POT_CROSS, false),
|
| 4781 | EMISSIVE_NOT_TINTED(ModelTemplates.CROSS_EMISSIVE, ModelTemplates.FLOWER_POT_CROSS_EMISSIVE, true);
|
| 4782 |
|
| 4783 | private final ModelTemplate blockTemplate;
|
| 4784 | private final ModelTemplate flowerPotTemplate;
|
| 4785 | private final boolean isEmissive;
|
| 4786 |
|
| 4787 | PlantType(final ModelTemplate blockTemplate, final ModelTemplate flowerPotTemplate, final boolean isEmissive) {
|
| 4788 | this.blockTemplate = blockTemplate;
|
| 4789 | this.flowerPotTemplate = flowerPotTemplate;
|
| 4790 | this.isEmissive = isEmissive;
|
| 4791 | }
|
| 4792 |
|
| 4793 | public ModelTemplate getCross() {
|
| 4794 | return this.blockTemplate;
|
| 4795 | }
|
| 4796 |
|
| 4797 | public ModelTemplate getCrossPot() {
|
| 4798 | return this.flowerPotTemplate;
|
| 4799 | }
|
| 4800 |
|
| 4801 | public Identifier createItemModelUsingBlockTexture(final BlockModelGenerators generator, final Block block) {
|
| 4802 | return this.createItemModelUsingBlockTexture(generator, block, "");
|
| 4803 | }
|
| 4804 |
|
| 4805 | public Identifier createItemModelUsingBlockTexture(final BlockModelGenerators generator, final Block block, final String suffix) {
|
| 4806 | Material material = TextureMapping.getBlockTexture(block, suffix);
|
| 4807 | return this.isEmissive
|
| 4808 | ? generator.createTwoLayeredItemModel(block.asItem(), material, material.withSuffix("_emissive"))
|
| 4809 | : generator.createFlatItemModel(block.asItem(), material);
|
| 4810 | }
|
| 4811 |
|
| 4812 | public Identifier createItemModelUsingItemTexture(final BlockModelGenerators generator, final Block block) {
|
| 4813 | return this.createItemModelUsingItemTexture(generator, block, "");
|
| 4814 | }
|
| 4815 |
|
| 4816 | public Identifier createItemModelUsingItemTexture(final BlockModelGenerators generator, final Block block, final String suffix) {
|
| 4817 | Material material = TextureMapping.getItemTexture(block.asItem(), suffix);
|
| 4818 | return generator.createFlatItemModel(block.asItem(), material);
|
| 4819 | }
|
| 4820 |
|
| 4821 | public TextureMapping getTextureMapping(final Block block) {
|
| 4822 | return this.isEmissive ? TextureMapping.crossEmissive(block) : TextureMapping.cross(block);
|
| 4823 | }
|
| 4824 |
|
| 4825 | public TextureMapping getPlantTextureMapping(final Block standAlone) {
|
| 4826 | return this.isEmissive ? TextureMapping.plantEmissive(standAlone) : TextureMapping.plant(standAlone);
|
| 4827 | }
|
| 4828 | }
|
| 4829 |
|
| 4830 | /**
|
| 4831 | * Access widened by fabric-data-generation-api-v1 to accessible
|
| 4832 | */
|
| 4833 | @Environment(EnvType.CLIENT)
|
| 4834 | public class WoodProvider {
|
| 4835 | private final TextureMapping logMapping;
|
| 4836 |
|
| 4837 | public WoodProvider(final TextureMapping logMapping) {
|
| 4838 | this.logMapping = logMapping;
|
| 4839 | }
|
| 4840 |
|
| 4841 | public BlockModelGenerators.WoodProvider wood(final Block block) {
|
| 4842 | TextureMapping woodMapping = this.logMapping.copyAndUpdate(TextureSlot.END, this.logMapping.get(TextureSlot.SIDE));
|
| 4843 | Identifier model = ModelTemplates.CUBE_COLUMN.create(block, woodMapping, BlockModelGenerators.this.modelOutput);
|
| 4844 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createAxisAlignedPillarBlock(block, BlockModelGenerators.plainVariant(model)));
|
| 4845 | BlockModelGenerators.this.registerSimpleItemModel(block, model);
|
| 4846 | return this;
|
| 4847 | }
|
| 4848 |
|
| 4849 | public BlockModelGenerators.WoodProvider log(final Block block) {
|
| 4850 | Identifier model = ModelTemplates.CUBE_COLUMN.create(block, this.logMapping, BlockModelGenerators.this.modelOutput);
|
| 4851 | BlockModelGenerators.this.blockStateOutput.accept(BlockModelGenerators.createAxisAlignedPillarBlock(block, BlockModelGenerators.plainVariant(model)));
|
| 4852 | BlockModelGenerators.this.registerSimpleItemModel(block, model);
|
| 4853 | return this;
|
| 4854 | }
|
| 4855 |
|
| 4856 | public BlockModelGenerators.WoodProvider logWithHorizontal(final Block block) {
|
| 4857 | Identifier model = ModelTemplates.CUBE_COLUMN.create(block, this.logMapping, BlockModelGenerators.this.modelOutput);
|
| 4858 | MultiVariant horizontalModel = BlockModelGenerators.plainVariant(
|
| 4859 | ModelTemplates.CUBE_COLUMN_HORIZONTAL.create(block, this.logMapping, BlockModelGenerators.this.modelOutput)
|
| 4860 | );
|
| 4861 | BlockModelGenerators.this.blockStateOutput
|
| 4862 | .accept(BlockModelGenerators.createRotatedPillarWithHorizontalVariant(block, BlockModelGenerators.plainVariant(model), horizontalModel));
|
| 4863 | BlockModelGenerators.this.registerSimpleItemModel(block, model);
|
| 4864 | return this;
|
| 4865 | }
|
| 4866 |
|
| 4867 | public BlockModelGenerators.WoodProvider logUVLocked(final Block block) {
|
| 4868 | BlockModelGenerators.this.blockStateOutput
|
| 4869 | .accept(BlockModelGenerators.createPillarBlockUVLocked(block, this.logMapping, BlockModelGenerators.this.modelOutput));
|
| 4870 | BlockModelGenerators.this.registerSimpleItemModel(block, ModelTemplates.CUBE_COLUMN.create(block, this.logMapping, BlockModelGenerators.this.modelOutput));
|
| 4871 | return this;
|
| 4872 | }
|
| 4873 | }
|
| 4874 | }
|
| 4875 |
|