2020-04-26 06:58:38 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2020-05-02 18:07:46 +02:00
|
|
|
import static com.simibubi.create.modules.Sections.SCHEMATICS;
|
|
|
|
|
2020-05-11 22:34:02 +02:00
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
2020-05-04 19:57:16 +02:00
|
|
|
import com.simibubi.create.foundation.utility.data.BlockStateGen;
|
|
|
|
import com.simibubi.create.modules.Sections;
|
|
|
|
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;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock;
|
2020-04-26 06:58:38 +02:00
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
|
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
|
|
|
|
import com.tterrag.registrate.util.RegistryEntry;
|
|
|
|
|
2020-05-04 19:57:16 +02:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.BlockState;
|
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;
|
|
|
|
import net.minecraft.item.ItemStack;
|
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-04-26 06:58:38 +02:00
|
|
|
private static final CreateRegistrate REGISTRATE = Create.registrate();
|
2020-05-04 19:57:16 +02:00
|
|
|
|
2020-05-11 22:34:02 +02:00
|
|
|
static {
|
|
|
|
REGISTRATE.startSection(SCHEMATICS);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final BlockEntry<SchematicannonBlock> SCHEMATICANNON =
|
|
|
|
REGISTRATE.block("schematicannon", SchematicannonBlock::new, b -> b
|
|
|
|
.initialProperties(() -> Blocks.DISPENSER)
|
|
|
|
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), BlockStateGen.partialBaseModel(ctx, prov)))
|
|
|
|
.item()
|
|
|
|
.model(BlockStateGen::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register());
|
|
|
|
|
|
|
|
public static final BlockEntry<SchematicTableBlock> SCHEMATIC_TABLE =
|
|
|
|
REGISTRATE.block("schematic_table", SchematicTableBlock::new, b -> b
|
|
|
|
.initialProperties(() -> Blocks.LECTERN)
|
|
|
|
.blockstate((ctx, prov) -> prov.horizontalBlock(ctx.getEntry(), prov.models()
|
|
|
|
.getExistingFile(ctx.getId()), 0))
|
|
|
|
.simpleItem()
|
|
|
|
.register());
|
|
|
|
|
|
|
|
static {
|
|
|
|
REGISTRATE.startSection(Sections.KINETICS);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new, b -> b
|
2020-05-04 19:57:16 +02:00
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p)))
|
|
|
|
.simpleItem()
|
2020-05-11 22:34:02 +02:00
|
|
|
.register());
|
|
|
|
|
|
|
|
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small, b -> b
|
|
|
|
.initialProperties(SharedProperties::kinetic)
|
2020-05-04 19:57:16 +02:00
|
|
|
.properties(p -> p.sound(SoundType.WOOD))
|
|
|
|
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p)))
|
2020-05-11 22:34:02 +02:00
|
|
|
.item(CogwheelBlockItem::new)
|
2020-05-04 19:57:16 +02:00
|
|
|
.build()
|
2020-05-11 22:34:02 +02:00
|
|
|
.register());
|
|
|
|
|
|
|
|
public static final BlockEntry<CogWheelBlock> LARGE_COGWHEEL =
|
|
|
|
REGISTRATE.block("large_cogwheel", CogWheelBlock::large, b -> b
|
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.properties(p -> p.sound(SoundType.WOOD))
|
|
|
|
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p)))
|
|
|
|
.item(CogwheelBlockItem::new)
|
|
|
|
.build()
|
|
|
|
.register());
|
|
|
|
|
|
|
|
public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT =
|
|
|
|
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new, b -> b
|
|
|
|
.initialProperties(SharedProperties::kinetic)
|
|
|
|
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.partialBaseModel(c, p)))
|
|
|
|
.item()
|
|
|
|
.model(BlockStateGen::customItemModel)
|
|
|
|
.build()
|
|
|
|
.register());
|
|
|
|
|
|
|
|
public static void register() {
|
2020-05-04 19:57:16 +02:00
|
|
|
}
|
2020-05-11 22:34:02 +02:00
|
|
|
|
|
|
|
public static class BlockEntry<B extends Block> implements Supplier<B> {
|
|
|
|
|
|
|
|
private RegistryEntry<B> delegate;
|
|
|
|
|
|
|
|
public BlockEntry(RegistryEntry<B> entry) {
|
|
|
|
this.delegate = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean typeOf(BlockState state) {
|
|
|
|
return get() == state.getBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack asStack() {
|
|
|
|
return new ItemStack(get());
|
|
|
|
}
|
|
|
|
|
|
|
|
public BlockState getDefault() {
|
|
|
|
return get().getDefaultState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public B get() {
|
|
|
|
return delegate.get();
|
|
|
|
}
|
|
|
|
|
2020-05-04 19:57:16 +02:00
|
|
|
}
|
2020-05-11 22:34:02 +02:00
|
|
|
|
2020-04-26 06:58:38 +02:00
|
|
|
}
|