2020-04-26 06:58:38 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2020-05-15 17:13:38 +02:00
|
|
|
import static com.simibubi.create.foundation.utility.data.BlockStateGen.oxidizedBlockstate;
|
|
|
|
import static com.simibubi.create.foundation.utility.data.ModelGen.oxidizedItemModel;
|
2020-05-02 18:07:46 +02:00
|
|
|
import static com.simibubi.create.modules.Sections.SCHEMATICS;
|
|
|
|
|
2020-05-19 15:25:21 +02:00
|
|
|
import com.simibubi.create.config.StressConfigDefaults;
|
2020-05-13 21:56:46 +02:00
|
|
|
import com.simibubi.create.foundation.registrate.CreateRegistrate;
|
2020-05-12 14:06:50 +02:00
|
|
|
import com.simibubi.create.foundation.utility.data.AssetLookup;
|
2020-05-04 19:57:16 +02:00
|
|
|
import com.simibubi.create.foundation.utility.data.BlockStateGen;
|
2020-05-15 04:07:19 +02:00
|
|
|
import com.simibubi.create.foundation.world.OxidizingBlock;
|
2020-05-04 19:57:16 +02:00
|
|
|
import com.simibubi.create.modules.Sections;
|
2020-05-19 01:07:45 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.components.motor.MotorBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.components.motor.MotorGenerator;
|
2020-05-19 15:25:21 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltGenerator;
|
2020-05-04 19:57:16 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
2020-05-18 22:01:09 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
|
2020-05-12 14:06:50 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
|
2020-05-18 22:01:09 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltGenerator;
|
2020-05-04 19:57:16 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock;
|
2020-05-12 14:06:50 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock;
|
2020-04-26 06:58:38 +02:00
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
|
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
|
2020-05-15 04:07:19 +02:00
|
|
|
import com.tterrag.registrate.builders.BlockBuilder;
|
2020-05-15 05:17:31 +02:00
|
|
|
import com.tterrag.registrate.builders.ItemBuilder;
|
2020-05-15 04:07:19 +02:00
|
|
|
import com.tterrag.registrate.util.DataIngredient;
|
2020-05-12 05:18:49 +02:00
|
|
|
import com.tterrag.registrate.util.entry.BlockEntry;
|
2020-05-15 05:17:31 +02:00
|
|
|
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
2020-04-26 06:58:38 +02:00
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
import net.minecraft.block.Block;
|
2020-05-02 18:07:46 +02:00
|
|
|
import net.minecraft.block.Blocks;
|
2020-05-04 19:57:16 +02:00
|
|
|
import net.minecraft.block.SoundType;
|
2020-05-19 15:25:21 +02:00
|
|
|
import net.minecraft.block.material.MaterialColor;
|
2020-05-15 05:17:31 +02:00
|
|
|
import net.minecraft.item.BlockItem;
|
2020-05-15 04:07:19 +02:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.tags.BlockTags;
|
|
|
|
import net.minecraft.tags.ItemTags;
|
|
|
|
import net.minecraft.tags.Tag;
|
|
|
|
import net.minecraft.tags.TagCollection;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraftforge.common.ToolType;
|
2020-05-02 18:07:46 +02:00
|
|
|
|
2020-04-26 06:58:38 +02:00
|
|
|
public class AllBlocksNew {
|
2020-05-11 22:34:02 +02:00
|
|
|
|
2020-05-15 04:32:36 +02:00
|
|
|
private static final CreateRegistrate REGISTRATE = Create.registrate()
|
2020-05-15 17:13:38 +02:00
|
|
|
.itemGroup(() -> Create.baseCreativeTab);
|
2020-05-04 19:57:16 +02:00
|
|
|
|
2020-05-18 22:01:09 +02:00
|
|
|
// Schematics
|
2020-05-19 15:25:21 +02:00
|
|
|
|
2020-05-11 22:34:02 +02:00
|
|
|
static {
|
|
|
|
REGISTRATE.startSection(SCHEMATICS);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final BlockEntry<SchematicannonBlock> SCHEMATICANNON =
|
2020-05-14 06:53:12 +02:00
|
|
|
REGISTRATE.block("schematicannon", SchematicannonBlock::new)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(() -> Blocks.DISPENSER)
|
|
|
|
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
|
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
2020-05-11 22:34:02 +02:00
|
|
|
|
|
|
|
public static final BlockEntry<SchematicTableBlock> SCHEMATIC_TABLE =
|
2020-05-14 06:53:12 +02:00
|
|
|
REGISTRATE.block("schematic_table", SchematicTableBlock::new)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(() -> Blocks.LECTERN)
|
|
|
|
.blockstate((ctx, prov) -> prov.horizontalBlock(ctx.getEntry(), prov.models()
|
|
|
|
.getExistingFile(ctx.getId()), 0))
|
|
|
|
.simpleItem()
|
|
|
|
.register();
|
2020-05-11 22:34:02 +02:00
|
|
|
|
2020-05-18 22:01:09 +02:00
|
|
|
// Kinetics
|
2020-05-19 15:25:21 +02:00
|
|
|
|
2020-05-11 22:34:02 +02:00
|
|
|
static {
|
|
|
|
REGISTRATE.startSection(Sections.KINETICS);
|
|
|
|
}
|
|
|
|
|
2020-05-14 06:53:12 +02:00
|
|
|
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
|
|
|
.simpleItem()
|
|
|
|
.register();
|
2020-05-11 22:34:02 +02:00
|
|
|
|
2020-05-14 06:53:12 +02:00
|
|
|
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.properties(p -> p.sound(SoundType.WOOD))
|
|
|
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
|
|
|
.item(CogwheelBlockItem::new)
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
|
|
|
public static final BlockEntry<CogWheelBlock> LARGE_COGWHEEL =
|
2020-05-14 06:53:12 +02:00
|
|
|
REGISTRATE.block("large_cogwheel", CogWheelBlock::large)
|
2020-05-11 22:34:02 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
2020-05-04 19:57:16 +02:00
|
|
|
.properties(p -> p.sound(SoundType.WOOD))
|
2020-05-12 14:06:50 +02:00
|
|
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
2020-05-11 22:34:02 +02:00
|
|
|
.item(CogwheelBlockItem::new)
|
2020-05-12 14:06:50 +02:00
|
|
|
.build()
|
2020-05-12 05:18:49 +02:00
|
|
|
.register();
|
2020-05-11 22:34:02 +02:00
|
|
|
|
|
|
|
public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT =
|
2020-05-14 06:53:12 +02:00
|
|
|
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
|
2020-05-12 14:06:50 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate(BlockStateGen.axisBlockProvider(true))
|
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
2020-05-14 06:53:12 +02:00
|
|
|
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate(BlockStateGen.axisBlockProvider(true))
|
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
2020-05-14 06:53:12 +02:00
|
|
|
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
2020-05-14 06:53:12 +02:00
|
|
|
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
|
2020-05-13 21:56:46 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
2020-05-15 17:13:38 +02:00
|
|
|
|
2020-05-18 22:01:09 +02:00
|
|
|
public static final BlockEntry<EncasedBeltBlock> ENCASED_BELT =
|
|
|
|
REGISTRATE.block("encased_belt", EncasedBeltBlock::new)
|
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
|
|
|
|
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
|
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
|
|
|
public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_PULLEY =
|
|
|
|
REGISTRATE.block("adjustable_pulley", AdjustablePulleyBlock::new)
|
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> {
|
|
|
|
String powered = state.get(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
|
|
|
|
return p.models()
|
|
|
|
.withExistingParent(c.getName() + "_" + suffix + powered, p.modLoc("block/encased_belt/" + suffix))
|
|
|
|
.texture("side", p.modLoc("block/" + c.getName() + powered));
|
|
|
|
}).generate(c, p))
|
|
|
|
.item()
|
|
|
|
.model((c, p) -> p.withExistingParent(c.getName(), p.modLoc("block/encased_belt/item"))
|
|
|
|
.texture("side", p.modLoc("block/" + c.getName())))
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
2020-05-19 15:25:21 +02:00
|
|
|
public static final BlockEntry<BeltBlock> BELT = REGISTRATE.block("belt", BeltBlock::new)
|
|
|
|
.initialProperties(SharedProperties.beltMaterial, MaterialColor.GRAY)
|
|
|
|
.transform(StressConfigDefaults.setImpact(1.0))
|
|
|
|
.blockstate(new BeltGenerator()::generate)
|
|
|
|
.register();
|
|
|
|
|
2020-05-19 01:07:45 +02:00
|
|
|
public static final BlockEntry<MotorBlock> CREATIVE_MOTOR = REGISTRATE.block("creative_motor", MotorBlock::new)
|
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate(new MotorGenerator()::generate)
|
2020-05-19 15:25:21 +02:00
|
|
|
.transform(StressConfigDefaults.setCapacity(16384.0))
|
2020-05-19 01:07:45 +02:00
|
|
|
.item()
|
|
|
|
.model(AssetLookup::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register();
|
|
|
|
|
2020-05-18 22:01:09 +02:00
|
|
|
// Materials
|
2020-05-19 15:25:21 +02:00
|
|
|
|
2020-05-15 17:13:38 +02:00
|
|
|
static {
|
|
|
|
REGISTRATE.startSection(Sections.MATERIALS);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final BlockEntry<OxidizingBlock> COPPER_ORE =
|
|
|
|
REGISTRATE.block("copper_ore", p -> new OxidizingBlock(p, 1))
|
|
|
|
.initialProperties(() -> Blocks.IRON_ORE)
|
|
|
|
.transform(oxidizedBlockstate())
|
|
|
|
.transform(tagBlockAndItem("ores/copper"))
|
2020-05-15 05:17:31 +02:00
|
|
|
.transform(oxidizedItemModel())
|
2020-05-15 17:13:38 +02:00
|
|
|
.register();
|
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
public static final BlockEntry<Block> ZINC_ORE = REGISTRATE.block("zinc_ore", Block::new)
|
|
|
|
.initialProperties(() -> Blocks.GOLD_BLOCK)
|
2020-05-15 17:13:38 +02:00
|
|
|
.properties(p -> p.harvestLevel(2)
|
|
|
|
.harvestTool(ToolType.PICKAXE))
|
2020-05-15 04:07:19 +02:00
|
|
|
.transform(tagBlockAndItem("ores/zinc"))
|
2020-05-15 17:13:38 +02:00
|
|
|
.build()
|
2020-05-15 04:07:19 +02:00
|
|
|
.register();
|
2020-05-15 17:13:38 +02:00
|
|
|
|
|
|
|
public static final BlockEntry<OxidizingBlock> COPPER_BLOCK =
|
|
|
|
REGISTRATE.block("copper_block", p -> new OxidizingBlock(p, 1 / 32f))
|
|
|
|
.initialProperties(() -> Blocks.IRON_BLOCK)
|
|
|
|
.transform(tagBlockAndItem("storage_blocks/copper"))
|
2020-05-15 05:17:31 +02:00
|
|
|
.transform(oxidizedItemModel())
|
2020-05-15 17:13:38 +02:00
|
|
|
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("ingots/copper")), ctx, false))
|
|
|
|
.transform(oxidizedBlockstate())
|
|
|
|
.register();
|
|
|
|
|
|
|
|
public static final BlockEntry<OxidizingBlock> COPPER_SHINGLES =
|
|
|
|
REGISTRATE.block("copper_shingles", p -> new OxidizingBlock(p, 1 / 32f))
|
|
|
|
.initialProperties(() -> Blocks.IRON_BLOCK)
|
|
|
|
.item()
|
|
|
|
.transform(oxidizedItemModel())
|
|
|
|
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("plates/copper")), ctx, true))
|
|
|
|
.transform(oxidizedBlockstate())
|
|
|
|
.register();
|
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
public static final BlockEntry<Block> ZINC_BLOCK = REGISTRATE.block("zinc_block", Block::new)
|
|
|
|
.initialProperties(() -> Blocks.IRON_BLOCK)
|
|
|
|
.transform(tagBlockAndItem("storage_blocks/zinc"))
|
2020-05-15 17:13:38 +02:00
|
|
|
.build()
|
2020-05-15 04:07:19 +02:00
|
|
|
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("ingots/zinc")), ctx, false))
|
|
|
|
.register();
|
2020-05-15 17:13:38 +02:00
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
public static final BlockEntry<Block> BRASS_BLOCK = REGISTRATE.block("brass_block", Block::new)
|
|
|
|
.initialProperties(() -> Blocks.IRON_BLOCK)
|
|
|
|
.transform(tagBlockAndItem("storage_blocks/brass"))
|
2020-05-15 17:13:38 +02:00
|
|
|
.build()
|
2020-05-15 04:07:19 +02:00
|
|
|
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("ingots/brass")), ctx, false))
|
|
|
|
.register();
|
2020-05-12 14:06:50 +02:00
|
|
|
|
2020-05-15 17:13:38 +02:00
|
|
|
// Utility
|
2020-05-18 22:01:09 +02:00
|
|
|
|
2020-05-15 17:13:38 +02:00
|
|
|
private static <T extends Block, P> NonNullFunction<BlockBuilder<T, P>, ItemBuilder<BlockItem, BlockBuilder<T, P>>> tagBlockAndItem(
|
|
|
|
String tagName) {
|
2020-05-15 04:07:19 +02:00
|
|
|
return b -> b.tag(forgeBlockTag(tagName))
|
2020-05-15 17:13:38 +02:00
|
|
|
.item()
|
|
|
|
.tag(forgeItemTag(tagName));
|
2020-05-15 04:07:19 +02:00
|
|
|
}
|
2020-05-15 17:13:38 +02:00
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
private static Tag<Block> forgeBlockTag(String name) {
|
|
|
|
return forgeTag(BlockTags.getCollection(), name);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Tag<Item> forgeItemTag(String name) {
|
|
|
|
return forgeTag(ItemTags.getCollection(), name);
|
|
|
|
}
|
2020-05-15 17:13:38 +02:00
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
private static <T> Tag<T> forgeTag(TagCollection<T> collection, String name) {
|
|
|
|
return tag(collection, "forge", name);
|
|
|
|
}
|
2020-05-15 17:13:38 +02:00
|
|
|
|
2020-05-15 04:07:19 +02:00
|
|
|
private static <T> Tag<T> tag(TagCollection<T> collection, String domain, String name) {
|
|
|
|
return collection.getOrCreate(new ResourceLocation(domain, name));
|
|
|
|
}
|
2020-05-15 17:13:38 +02:00
|
|
|
|
2020-05-13 01:11:07 +02:00
|
|
|
public static void register() {}
|
2020-05-13 21:56:46 +02:00
|
|
|
|
2020-04-26 06:58:38 +02:00
|
|
|
}
|