Port material blocks to Registrate

This commit is contained in:
tterrag 2020-05-14 22:07:19 -04:00
parent 7897968a63
commit 02d052ed44
17 changed files with 1662 additions and 20 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"create:brass_block"
]
},
"criteria": {
"has_ingots_brass": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/brass"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "create:brass_block"
}
}
},
"requirements": [
[
"has_ingots_brass",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"create:copper_block"
]
},
"criteria": {
"has_ingots_copper": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/copper"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "create:copper_block"
}
}
},
"requirements": [
[
"has_ingots_copper",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"create:copper_shingles"
]
},
"criteria": {
"has_plates_copper": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:plates/copper"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "create:copper_shingles"
}
}
},
"requirements": [
[
"has_plates_copper",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"create:zinc_block"
]
},
"criteria": {
"has_ingots_zinc": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:ingots/zinc"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "create:zinc_block"
}
}
},
"requirements": [
[
"has_ingots_zinc",
"has_the_recipe"
]
]
}

View file

@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "create:linked_transposer"
"name": "minecraft:air"
}
],
"conditions": [

View file

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"XXX",
"XXX",
"XXX"
],
"key": {
"X": {
"tag": "forge:ingots/brass"
}
},
"result": {
"item": "create:brass_block"
}
}

View file

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"XXX",
"XXX",
"XXX"
],
"key": {
"X": {
"tag": "forge:ingots/copper"
}
},
"result": {
"item": "create:copper_block"
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"XX",
"XX"
],
"key": {
"X": {
"tag": "forge:plates/copper"
}
},
"result": {
"item": "create:copper_shingles"
}
}

View file

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"XXX",
"XXX",
"XXX"
],
"key": {
"X": {
"tag": "forge:ingots/zinc"
}
},
"result": {
"item": "create:zinc_block"
}
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:copper_ore"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:zinc_ore"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:brass_block"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:copper_block"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:zinc_block"
],
"optional": []
}

View file

@ -193,19 +193,19 @@ public enum AllBlocks implements NonNullSupplier<Block> {
_3_(Sections.MATERIALS),
COPPER_ORE(() -> new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1), ITaggable.create()
.withForgeTags("ores/copper")),
ZINC_ORE(() -> new Block(Properties.from(Blocks.GOLD_ORE)
.harvestLevel(2)
.harvestTool(ToolType.PICKAXE)), ITaggable.create()
.withForgeTags("ores/zinc")),
COPPER_BLOCK(() -> new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f), ITaggable.create()
.withForgeTags("storage_blocks/copper")),
COPPER_SHINGLES(() -> new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)),
ZINC_BLOCK(() -> new Block(Properties.from(Blocks.IRON_BLOCK)), ITaggable.create()
.withForgeTags("storage_blocks/zinc")),
BRASS_BLOCK(() -> new Block(Properties.from(Blocks.IRON_BLOCK)), ITaggable.create()
.withForgeTags("storage_blocks/brass")),
// COPPER_ORE(() -> new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1), ITaggable.create()
// .withForgeTags("ores/copper")),
// ZINC_ORE(() -> new Block(Properties.from(Blocks.GOLD_ORE)
// .harvestLevel(2)
// .harvestTool(ToolType.PICKAXE)), ITaggable.create()
// .withForgeTags("ores/zinc")),
// COPPER_BLOCK(() -> new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f), ITaggable.create()
// .withForgeTags("storage_blocks/copper")),
// COPPER_SHINGLES(() -> new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)),
// ZINC_BLOCK(() -> new Block(Properties.from(Blocks.IRON_BLOCK)), ITaggable.create()
// .withForgeTags("storage_blocks/zinc")),
// BRASS_BLOCK(() -> new Block(Properties.from(Blocks.IRON_BLOCK)), ITaggable.create()
// .withForgeTags("storage_blocks/brass")),
_4_(Sections.CURIOSITIES),

View file

@ -5,6 +5,7 @@ import static com.simibubi.create.modules.Sections.SCHEMATICS;
import com.simibubi.create.foundation.registrate.CreateRegistrate;
import com.simibubi.create.foundation.utility.data.AssetLookup;
import com.simibubi.create.foundation.utility.data.BlockStateGen;
import com.simibubi.create.foundation.world.OxidizingBlock;
import com.simibubi.create.modules.Sections;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem;
@ -15,10 +16,21 @@ import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock;
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.util.DataIngredient;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.SoundType;
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;
public class AllBlocksNew {
@ -105,6 +117,65 @@ public class AllBlocksNew {
.build()
.register();
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(tagBlockAndItem("ores/copper"))
.register();
public static final BlockEntry<Block> ZINC_ORE = REGISTRATE.block("zinc_ore", Block::new)
.initialProperties(() -> Blocks.GOLD_BLOCK)
.properties(p -> p.harvestLevel(2).harvestTool(ToolType.PICKAXE))
.transform(tagBlockAndItem("ores/zinc"))
.register();
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"))
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("ingots/copper")), ctx, false))
.register();
public static final BlockEntry<OxidizingBlock> COPPER_SHINGLES = REGISTRATE.block("copper_shingles", p -> new OxidizingBlock(p, 1 / 32f))
.initialProperties(() -> Blocks.IRON_BLOCK)
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("plates/copper")), ctx, true))
.register();
public static final BlockEntry<Block> ZINC_BLOCK = REGISTRATE.block("zinc_block", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.transform(tagBlockAndItem("storage_blocks/zinc"))
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("ingots/zinc")), ctx, false))
.register();
public static final BlockEntry<Block> BRASS_BLOCK = REGISTRATE.block("brass_block", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.transform(tagBlockAndItem("storage_blocks/brass"))
.recipe((ctx, prov) -> prov.square(DataIngredient.tag(forgeItemTag("ingots/brass")), ctx, false))
.register();
private static <T extends Block, P> NonNullUnaryOperator<BlockBuilder<T, P>> tagBlockAndItem(String tagName) {
return b -> b.tag(forgeBlockTag(tagName))
.item()
.tag(forgeItemTag(tagName))
.build();
}
private static Tag<Block> forgeBlockTag(String name) {
return forgeTag(BlockTags.getCollection(), name);
}
private static Tag<Item> forgeItemTag(String name) {
return forgeTag(ItemTags.getCollection(), name);
}
private static <T> Tag<T> forgeTag(TagCollection<T> collection, String name) {
return tag(collection, "forge", name);
}
private static <T> Tag<T> tag(TagCollection<T> collection, String domain, String name) {
return collection.getOrCreate(new ResourceLocation(domain, name));
}
public static void register() {}
}