Add registrate as dependency, experimental refactor of AllBlocks

This commit is contained in:
tterrag 2020-04-13 02:58:57 -04:00
parent ed19a65b9f
commit 2cccbca11b
24 changed files with 353 additions and 348 deletions

View file

@ -8,6 +8,9 @@ buildscript {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
} }
} }
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
}
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse' apply plugin: 'eclipse'
@ -77,15 +80,23 @@ repositories {
url "http://maven.blamejared.com/" url "http://maven.blamejared.com/"
} }
maven { maven {
// for mixed mappings //location of the maven for mixed mappings and registrate
name = "tterrag maven" name = "tterrag maven"
url = "https://maven.tterrag.com/" url = "https://maven.tterrag.com/"
} }
} }
configurations {
shade
}
dependencies { dependencies {
minecraft 'net.minecraftforge:forge:1.15.2-31.1.36' minecraft 'net.minecraftforge:forge:1.15.2-31.1.36'
def registrate = "com.tterrag.registrate:Registrate:MC1.14.4-0.0.3.35"
implementation fg.deobf(registrate)
shade registrate
// compile against the JEI API but do not include it at runtime // compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api") compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api")
// at runtime, use the full JEI jar // at runtime, use the full JEI jar
@ -110,6 +121,15 @@ jar {
} }
} }
shadowJar {
configurations = [project.configurations.shade]
relocate 'com.tterrag.registrate', 'com.simibubi.create.repack.registrate'
}
reobf {
shadowJar {}
}
// Example configuration to allow publishing using the maven-publish task // Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task // we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published // and then declare that to be published

View file

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip

View file

@ -1,11 +1,11 @@
package com.simibubi.create; package com.simibubi.create;
import java.util.HashSet; import javax.annotation.Nonnull;
import java.util.Set;
import org.apache.commons.lang3.ArrayUtils;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.foundation.block.IHaveColorHandler; import com.simibubi.create.foundation.block.IHaveColorHandler;
import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ProperStairsBlock; import com.simibubi.create.foundation.block.ProperStairsBlock;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.data.ITaggable; import com.simibubi.create.foundation.utility.data.ITaggable;
@ -36,6 +36,7 @@ import com.simibubi.create.modules.contraptions.components.fan.NozzleBlock;
import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelBlock; import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelBlock;
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock; import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock;
import com.simibubi.create.modules.contraptions.components.millstone.MillstoneBlock; import com.simibubi.create.modules.contraptions.components.millstone.MillstoneBlock;
import com.simibubi.create.modules.contraptions.components.mixer.BasinOperatorBlockItem;
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerBlock; import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerBlock;
import com.simibubi.create.modules.contraptions.components.motor.MotorBlock; import com.simibubi.create.modules.contraptions.components.motor.MotorBlock;
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressBlock; import com.simibubi.create.modules.contraptions.components.press.MechanicalPressBlock;
@ -49,6 +50,7 @@ import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerB
import com.simibubi.create.modules.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock; import com.simibubi.create.modules.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock; 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.elementary.ShaftBlock;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock; import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock; import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
@ -87,6 +89,13 @@ import com.simibubi.create.modules.palettes.VerticalCTGlassBlock;
import com.simibubi.create.modules.schematics.block.CreativeCrateBlock; import com.simibubi.create.modules.schematics.block.CreativeCrateBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.ItemBuilder;
import com.tterrag.registrate.util.RegistryEntry;
import com.tterrag.registrate.util.nullness.NonNullBiFunction;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Block.Properties; import net.minecraft.block.Block.Properties;
@ -103,274 +112,262 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.registries.IForgeRegistry;
public enum AllBlocks { public enum AllBlocks implements NonNullSupplier<Block> {
__SCHEMATICS__(), __SCHEMATICS__(),
SCHEMATICANNON(new SchematicannonBlock()), SCHEMATICANNON(SchematicannonBlock::new),
CREATIVE_CRATE(new CreativeCrateBlock()), CREATIVE_CRATE(CreativeCrateBlock::new),
SCHEMATIC_TABLE(new SchematicTableBlock()), SCHEMATIC_TABLE(SchematicTableBlock::new),
__CONTRAPTIONS__(), __CONTRAPTIONS__(),
SHAFT(new ShaftBlock(Properties.from(Blocks.ANDESITE))), SHAFT(() -> new ShaftBlock(Properties.from(Blocks.ANDESITE))),
COGWHEEL(new CogWheelBlock(false)), COGWHEEL(() -> new CogWheelBlock(false), (b, p) -> new CogwheelBlockItem(b, p, false)),
LARGE_COGWHEEL(new CogWheelBlock(true)), LARGE_COGWHEEL(() -> new CogWheelBlock(true), (b, p) -> new CogwheelBlockItem(b, p, true)),
ENCASED_SHAFT(new EncasedShaftBlock()), ENCASED_SHAFT(EncasedShaftBlock::new),
GEARBOX(new GearboxBlock()), GEARBOX(GearboxBlock::new),
CLUTCH(new ClutchBlock()), CLUTCH(ClutchBlock::new),
GEARSHIFT(new GearshiftBlock()), GEARSHIFT(GearshiftBlock::new),
ENCASED_BELT(new EncasedBeltBlock()), ENCASED_BELT(EncasedBeltBlock::new),
ADJUSTABLE_PULLEY(new AdjustablePulleyBlock()), ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new),
BELT(new BeltBlock()), BELT(BeltBlock::new, ComesWith.NO_BLOCKITEM),
CREATIVE_MOTOR(new MotorBlock()), CREATIVE_MOTOR(MotorBlock::new),
WATER_WHEEL(new WaterWheelBlock()), WATER_WHEEL(WaterWheelBlock::new),
ENCASED_FAN(new EncasedFanBlock()), ENCASED_FAN(EncasedFanBlock::new),
NOZZLE(new NozzleBlock()), NOZZLE(NozzleBlock::new),
TURNTABLE(new TurntableBlock()), TURNTABLE(TurntableBlock::new),
HAND_CRANK(new HandCrankBlock()), HAND_CRANK(HandCrankBlock::new),
CUCKOO_CLOCK(new CuckooClockBlock(false)), CUCKOO_CLOCK(() -> new CuckooClockBlock(false)),
MYSTERIOUS_CUCKOO_CLOCK(new CuckooClockBlock(true)), MYSTERIOUS_CUCKOO_CLOCK(() -> new CuckooClockBlock(true)),
MILLSTONE(new MillstoneBlock()), MILLSTONE(MillstoneBlock::new),
CRUSHING_WHEEL(new CrushingWheelBlock()), CRUSHING_WHEEL(CrushingWheelBlock::new),
CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()), CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerBlock::new, ComesWith.NO_BLOCKITEM),
MECHANICAL_PRESS(new MechanicalPressBlock()), MECHANICAL_PRESS(MechanicalPressBlock::new, BasinOperatorBlockItem::new),
MECHANICAL_MIXER(new MechanicalMixerBlock()), MECHANICAL_MIXER(MechanicalMixerBlock::new, BasinOperatorBlockItem::new),
BASIN(new BasinBlock()), BASIN(BasinBlock::new),
SPEED_GAUGE(new GaugeBlock(GaugeBlock.Type.SPEED)), SPEED_GAUGE(() -> new GaugeBlock(GaugeBlock.Type.SPEED)),
STRESS_GAUGE(new GaugeBlock(GaugeBlock.Type.STRESS)), STRESS_GAUGE(() -> new GaugeBlock(GaugeBlock.Type.STRESS)),
MECHANICAL_PISTON(new MechanicalPistonBlock(false)), MECHANICAL_PISTON(() -> new MechanicalPistonBlock(false)),
STICKY_MECHANICAL_PISTON(new MechanicalPistonBlock(true)), STICKY_MECHANICAL_PISTON(() -> new MechanicalPistonBlock(true)),
MECHANICAL_PISTON_HEAD(new MechanicalPistonHeadBlock()), MECHANICAL_PISTON_HEAD(MechanicalPistonHeadBlock::new, ComesWith.NO_BLOCKITEM),
PISTON_POLE(new PistonPoleBlock()), PISTON_POLE(PistonPoleBlock::new),
MECHANICAL_BEARING(new MechanicalBearingBlock()), MECHANICAL_BEARING(MechanicalBearingBlock::new),
CLOCKWORK_BEARING(new ClockworkBearingBlock()), CLOCKWORK_BEARING(ClockworkBearingBlock::new),
ROPE_PULLEY(new PulleyBlock()), ROPE_PULLEY(PulleyBlock::new),
ROPE(new PulleyBlock.RopeBlock()), ROPE(PulleyBlock.RopeBlock::new, ComesWith.NO_BLOCKITEM),
PULLEY_MAGNET(new PulleyBlock.MagnetBlock()), PULLEY_MAGNET(PulleyBlock.MagnetBlock::new, ComesWith.NO_BLOCKITEM),
CART_ASSEMBLER(new TaggedBlock(new CartAssemblerBlock()).withVanillaTags(ITaggable.TagType.BLOCK, "rails")), CART_ASSEMBLER(CartAssemblerBlock::new, ITaggable.create().withVanillaTags(ITaggable.BLOCK, "rails")),
MINECART_ANCHOR(new MinecartAnchorBlock()), MINECART_ANCHOR(MinecartAnchorBlock::new, ComesWith.NO_BLOCKITEM),
TRANSLATION_CHASSIS(new LinearChassisBlock()), TRANSLATION_CHASSIS(LinearChassisBlock::new),
TRANSLATION_CHASSIS_SECONDARY(new LinearChassisBlock()), TRANSLATION_CHASSIS_SECONDARY(LinearChassisBlock::new),
ROTATION_CHASSIS(new RadialChassisBlock()), ROTATION_CHASSIS(RadialChassisBlock::new),
DRILL(new DrillBlock()), DRILL(DrillBlock::new),
SAW(new SawBlock()), SAW(SawBlock::new),
HARVESTER(new HarvesterBlock()), HARVESTER(HarvesterBlock::new),
DEPLOYER(new DeployerBlock()), DEPLOYER(DeployerBlock::new),
PORTABLE_STORAGE_INTERFACE(new PortableStorageInterfaceBlock()), PORTABLE_STORAGE_INTERFACE(PortableStorageInterfaceBlock::new),
ANALOG_LEVER(new AnalogLeverBlock()), ANALOG_LEVER(AnalogLeverBlock::new),
ANDESITE_CASING(new CasingBlock("andesite_casing")), ANDESITE_CASING(() -> new CasingBlock("andesite_casing")),
COPPER_CASING(new CasingBlock("copper_casing")), COPPER_CASING(() -> new CasingBlock("copper_casing")),
BRASS_CASING(new CasingBlock("crafter_top")), BRASS_CASING(() -> new CasingBlock("crafter_top")),
MECHANICAL_CRAFTER(new MechanicalCrafterBlock()), MECHANICAL_CRAFTER(MechanicalCrafterBlock::new),
SEQUENCED_GEARSHIFT(new SequencedGearshiftBlock()), SEQUENCED_GEARSHIFT(SequencedGearshiftBlock::new),
FLYWHEEL(new FlywheelBlock()), FLYWHEEL(FlywheelBlock::new),
FURNACE_ENGINE(new FurnaceEngineBlock()), FURNACE_ENGINE(FurnaceEngineBlock::new),
ROTATION_SPEED_CONTROLLER(new SpeedControllerBlock()), ROTATION_SPEED_CONTROLLER(SpeedControllerBlock::new),
__LOGISTICS__(), __LOGISTICS__(),
CONTACT(new ContactBlock()), CONTACT(ContactBlock::new),
REDSTONE_BRIDGE(new RedstoneLinkBlock()), REDSTONE_BRIDGE(RedstoneLinkBlock::new),
STOCKSWITCH(new StockswitchBlock()), STOCKSWITCH(StockswitchBlock::new),
FLEXCRATE(new FlexcrateBlock()), FLEXCRATE(FlexcrateBlock::new),
EXTRACTOR(new ExtractorBlock()), EXTRACTOR(ExtractorBlock::new),
VERTICAL_EXTRACTOR(new ExtractorBlock.Vertical()), VERTICAL_EXTRACTOR(ExtractorBlock.Vertical::new, ComesWith.NO_BLOCKITEM),
LINKED_EXTRACTOR(new LinkedExtractorBlock()), LINKED_EXTRACTOR(LinkedExtractorBlock::new),
VERTICAL_LINKED_EXTRACTOR(new LinkedExtractorBlock.Vertical()), VERTICAL_LINKED_EXTRACTOR(LinkedExtractorBlock.Vertical::new, ComesWith.NO_BLOCKITEM),
TRANSPOSER(new TransposerBlock()), TRANSPOSER(TransposerBlock::new),
VERTICAL_TRANSPOSER(new TransposerBlock.Vertical()), VERTICAL_TRANSPOSER(TransposerBlock.Vertical::new, ComesWith.NO_BLOCKITEM),
LINKED_TRANSPOSER(new LinkedTransposerBlock()), LINKED_TRANSPOSER(LinkedTransposerBlock::new),
VERTICAL_LINKED_TRANSPOSER(new LinkedTransposerBlock.Vertical()), VERTICAL_LINKED_TRANSPOSER(LinkedTransposerBlock.Vertical::new, ComesWith.NO_BLOCKITEM),
BELT_FUNNEL(new FunnelBlock()), BELT_FUNNEL(FunnelBlock::new),
VERTICAL_FUNNEL(new FunnelBlock.Vertical()), VERTICAL_FUNNEL(FunnelBlock.Vertical::new, ComesWith.NO_BLOCKITEM),
BELT_TUNNEL(new BeltTunnelBlock()), BELT_TUNNEL(BeltTunnelBlock::new),
ENTITY_DETECTOR(new BeltObserverBlock()), ENTITY_DETECTOR(BeltObserverBlock::new),
PULSE_REPEATER(new PulseRepeaterBlock()), PULSE_REPEATER(PulseRepeaterBlock::new),
FLEXPEATER(new FlexpeaterBlock()), FLEXPEATER(FlexpeaterBlock::new),
FLEXPULSEPEATER(new FlexpeaterBlock()), FLEXPULSEPEATER(FlexpeaterBlock::new),
REDSTONE_LATCH(new LatchBlock()), REDSTONE_LATCH(LatchBlock::new),
TOGGLE_LATCH(new ToggleLatchBlock()), TOGGLE_LATCH(ToggleLatchBlock::new),
__CURIOSITIES__(), __CURIOSITIES__(),
SYMMETRY_PLANE(new PlaneSymmetryBlock()), SYMMETRY_PLANE(PlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()), SYMMETRY_CROSSPLANE(CrossPlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()), SYMMETRY_TRIPLEPLANE(TriplePlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
WINDOW_IN_A_BLOCK(new WindowInABlockBlock()), WINDOW_IN_A_BLOCK(WindowInABlockBlock::new, ComesWith.NO_BLOCKITEM),
COCOA_LOG(new TaggedBlock(new CocoaLogBlock()).withVanillaTags(ITaggable.TagType.BLOCK, "jungle_logs")), COCOA_LOG(CocoaLogBlock::new, ITaggable.create().withVanillaTags(ITaggable.BLOCK, "jungle_logs")),
__PALETTES__(), __PALETTES__(),
TILED_GLASS(new TaggedBlock(new GlassBlock(Properties.from(Blocks.GLASS))).withVanillaTags(ITaggable.TagType.BLOCK, "impermeable").withForgeTags("glass")), TILED_GLASS(() -> new GlassBlock(Properties.from(Blocks.GLASS)), ITaggable.create().withVanillaTags(ITaggable.BLOCK, "impermeable").withForgeTags("glass")),
FRAMED_GLASS(new CTGlassBlock(AllCTs.FRAMED_GLASS, false)), FRAMED_GLASS(() -> new CTGlassBlock(AllCTs.FRAMED_GLASS, false)),
HORIZONTAL_FRAMED_GLASS(new HorizontalCTGlassBlock(AllCTs.HORIZONTAL_FRAMED_GLASS, AllCTs.FRAMED_GLASS, false)), HORIZONTAL_FRAMED_GLASS(() -> new HorizontalCTGlassBlock(AllCTs.HORIZONTAL_FRAMED_GLASS, AllCTs.FRAMED_GLASS, false)),
VERTICAL_FRAMED_GLASS(new VerticalCTGlassBlock(AllCTs.VERTICAL_FRAMED_GLASS, false)), VERTICAL_FRAMED_GLASS(() -> new VerticalCTGlassBlock(AllCTs.VERTICAL_FRAMED_GLASS, false)),
OAK_GLASS(new CTWindowBlock(AllCTs.OAK_GLASS, false)), OAK_GLASS(() -> new CTWindowBlock(AllCTs.OAK_GLASS, false)),
SPRUCE_GLASS(new CTWindowBlock(AllCTs.SPRUCE_GLASS, false)), SPRUCE_GLASS(() -> new CTWindowBlock(AllCTs.SPRUCE_GLASS, false)),
BIRCH_GLASS(new CTWindowBlock(AllCTs.BIRCH_GLASS, true)), BIRCH_GLASS(() -> new CTWindowBlock(AllCTs.BIRCH_GLASS, true)),
JUNGLE_GLASS(new CTWindowBlock(AllCTs.JUNGLE_GLASS, false)), JUNGLE_GLASS(() -> new CTWindowBlock(AllCTs.JUNGLE_GLASS, false)),
DARK_OAK_GLASS(new CTWindowBlock(AllCTs.DARK_OAK_GLASS, false)), DARK_OAK_GLASS(() -> new CTWindowBlock(AllCTs.DARK_OAK_GLASS, false)),
ACACIA_GLASS(new CTWindowBlock(AllCTs.ACACIA_GLASS, false)), ACACIA_GLASS(() -> new CTWindowBlock(AllCTs.ACACIA_GLASS, false)),
IRON_GLASS(new CTWindowBlock(AllCTs.IRON_GLASS, false)), IRON_GLASS(() -> new CTWindowBlock(AllCTs.IRON_GLASS, false)),
TILED_GLASS_PANE(new TaggedBlock(new GlassPaneBlock(Properties.from(Blocks.GLASS))).withForgeTags("glass_panes")), TILED_GLASS_PANE(() -> new GlassPaneBlock(Properties.from(Blocks.GLASS)), ITaggable.create().withForgeTags("glass_panes")),
FRAMED_GLASS_PANE(new CTGlassPaneBlock(FRAMED_GLASS.get())), FRAMED_GLASS_PANE(() -> new CTGlassPaneBlock(FRAMED_GLASS.get())),
HORIZONTAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(HORIZONTAL_FRAMED_GLASS.get())), HORIZONTAL_FRAMED_GLASS_PANE(() -> new CTGlassPaneBlock(HORIZONTAL_FRAMED_GLASS.get())),
VERTICAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(VERTICAL_FRAMED_GLASS.get())), VERTICAL_FRAMED_GLASS_PANE(() -> new CTGlassPaneBlock(VERTICAL_FRAMED_GLASS.get())),
OAK_GLASS_PANE(new CTGlassPaneBlock(OAK_GLASS.get())), OAK_GLASS_PANE(() -> new CTGlassPaneBlock(OAK_GLASS.get())),
SPRUCE_GLASS_PANE(new CTGlassPaneBlock(SPRUCE_GLASS.get())), SPRUCE_GLASS_PANE(() -> new CTGlassPaneBlock(SPRUCE_GLASS.get())),
BIRCH_GLASS_PANE(new CTGlassPaneBlock(BIRCH_GLASS.get())), BIRCH_GLASS_PANE(() -> new CTGlassPaneBlock(BIRCH_GLASS.get())),
JUNGLE_GLASS_PANE(new CTGlassPaneBlock(JUNGLE_GLASS.get())), JUNGLE_GLASS_PANE(() -> new CTGlassPaneBlock(JUNGLE_GLASS.get())),
DARK_OAK_GLASS_PANE(new CTGlassPaneBlock(DARK_OAK_GLASS.get())), DARK_OAK_GLASS_PANE(() -> new CTGlassPaneBlock(DARK_OAK_GLASS.get())),
ACACIA_GLASS_PANE(new CTGlassPaneBlock(ACACIA_GLASS.get())), ACACIA_GLASS_PANE(() -> new CTGlassPaneBlock(ACACIA_GLASS.get())),
IRON_GLASS_PANE(new CTGlassPaneBlock(IRON_GLASS.get())), IRON_GLASS_PANE(() -> new CTGlassPaneBlock(IRON_GLASS.get())),
GRANITE_BRICKS(new Block(Properties.from(Blocks.GRANITE))), GRANITE_BRICKS(() -> new Block(Properties.from(Blocks.GRANITE))),
GRANITE_LAYERS(new LayeredCTBlock(Properties.from(Blocks.GRANITE), AllCTs.GRANITE_LAYERS, AllCTs.POLISHED_GRANITE)), GRANITE_LAYERS(() -> new LayeredCTBlock(Properties.from(Blocks.GRANITE), AllCTs.GRANITE_LAYERS, AllCTs.POLISHED_GRANITE)),
DIORITE_BRICKS(new Block(Properties.from(Blocks.DIORITE))), DIORITE_BRICKS(() -> new Block(Properties.from(Blocks.DIORITE))),
DIORITE_LAYERS(new LayeredCTBlock(Properties.from(Blocks.DIORITE), AllCTs.DIORITE_LAYERS, AllCTs.POLISHED_DIORITE)), DIORITE_LAYERS(() -> new LayeredCTBlock(Properties.from(Blocks.DIORITE), AllCTs.DIORITE_LAYERS, AllCTs.POLISHED_DIORITE)),
ANDESITE_BRICKS(new Block(Properties.from(Blocks.ANDESITE))), ANDESITE_BRICKS(() -> new Block(Properties.from(Blocks.ANDESITE))),
ANDESITE_LAYERS( ANDESITE_LAYERS(() ->
new LayeredCTBlock(Properties.from(Blocks.ANDESITE), AllCTs.ANDESITE_LAYERS, AllCTs.POLISHED_ANDESITE)), new LayeredCTBlock(Properties.from(Blocks.ANDESITE), AllCTs.ANDESITE_LAYERS, AllCTs.POLISHED_ANDESITE)),
GABBRO(new TaggedBlock(new Block(Properties.from(Blocks.GRANITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), GABBRO(() -> new Block(Properties.from(Blocks.GRANITE)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
POLISHED_GABBRO(new TaggedBlock(new Block(Properties.from(GABBRO.get()))).withForgeTags("stone")), POLISHED_GABBRO(() -> new Block(Properties.from(GABBRO.get())), ITaggable.create().withForgeTags("stone")),
GABBRO_BRICKS(new Block(Properties.from(GABBRO.get())), ComesWith.STAIRS, ComesWith.WALL), GABBRO_BRICKS(() -> new Block(Properties.from(GABBRO.get())), ComesWith.STAIRS, ComesWith.WALL),
PAVED_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get())), ComesWith.SLAB), PAVED_GABBRO_BRICKS(() -> new Block(Properties.from(GABBRO.get())), ComesWith.SLAB),
INDENTED_GABBRO(new Block(Properties.from(GABBRO.get())), ComesWith.SLAB), INDENTED_GABBRO(() -> new Block(Properties.from(GABBRO.get())), ComesWith.SLAB),
SLIGHTLY_MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get()))), SLIGHTLY_MOSSY_GABBRO_BRICKS(() -> new Block(Properties.from(GABBRO.get()))),
MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get()))), MOSSY_GABBRO_BRICKS(() -> new Block(Properties.from(GABBRO.get()))),
GABBRO_LAYERS(new LayeredCTBlock(Properties.from(GABBRO.get()), AllCTs.GABBRO_LAYERS, AllCTs.POLISHED_GABBRO)), GABBRO_LAYERS(() -> new LayeredCTBlock(Properties.from(GABBRO.get()), AllCTs.GABBRO_LAYERS, AllCTs.POLISHED_GABBRO)),
DOLOMITE(new TaggedBlock(new Block(Properties.from(Blocks.QUARTZ_BLOCK))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), DOLOMITE(() -> new Block(Properties.from(Blocks.QUARTZ_BLOCK)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
DOLOMITE_BRICKS(new Block(Properties.from(DOLOMITE.get()))), DOLOMITE_BRICKS(() -> new Block(Properties.from(DOLOMITE.get()))),
POLISHED_DOLOMITE(new TaggedBlock(new Block(Properties.from(DOLOMITE.get()))).withForgeTags("stone")), POLISHED_DOLOMITE(() -> new Block(Properties.from(DOLOMITE.get())), ITaggable.create().withForgeTags("stone")),
DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.get()))), DOLOMITE_PILLAR(() -> new RotatedPillarBlock(Properties.from(DOLOMITE.get()))),
DOLOMITE_LAYERS( DOLOMITE_LAYERS(() ->
new LayeredCTBlock(Properties.from(DOLOMITE.get()), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)), new LayeredCTBlock(Properties.from(DOLOMITE.get()), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)),
LIMESAND(new FallingBlock(Properties.from(Blocks.SAND))), LIMESAND(() -> new FallingBlock(Properties.from(Blocks.SAND))),
LIMESTONE(new TaggedBlock(new Block(Properties.from(Blocks.SANDSTONE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), LIMESTONE(() -> new Block(Properties.from(Blocks.SANDSTONE)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
LIMESTONE_BRICKS(new Block(Properties.from(LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), LIMESTONE_BRICKS(() -> new Block(Properties.from(LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
POLISHED_LIMESTONE(new TaggedBlock(new Block(Properties.from(LIMESTONE.get()))).withForgeTags("stone"), ComesWith.SLAB), POLISHED_LIMESTONE(() -> new Block(Properties.from(LIMESTONE.get())), ITaggable.create().withForgeTags("stone"), ComesWith.SLAB),
LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(LIMESTONE.get()))), LIMESTONE_PILLAR(() -> new RotatedPillarBlock(Properties.from(LIMESTONE.get()))),
LIMESTONE_LAYERS( LIMESTONE_LAYERS(() ->
new LayeredCTBlock(Properties.from(LIMESTONE.get()), AllCTs.LIMESTONE_LAYERS, AllCTs.POLISHED_LIMESTONE)), new LayeredCTBlock(Properties.from(LIMESTONE.get()), AllCTs.LIMESTONE_LAYERS, AllCTs.POLISHED_LIMESTONE)),
WEATHERED_LIMESTONE(new TaggedBlock(new Block(Properties.from(Blocks.ANDESITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), WEATHERED_LIMESTONE(() -> new Block(Properties.from(Blocks.ANDESITE)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
WEATHERED_LIMESTONE_BRICKS(new Block(Properties.from(WEATHERED_LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB, WEATHERED_LIMESTONE_BRICKS(() -> new Block(Properties.from(WEATHERED_LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB,
ComesWith.WALL), ComesWith.WALL),
POLISHED_WEATHERED_LIMESTONE(new TaggedBlock(new Block(Properties.from(WEATHERED_LIMESTONE.get()))).withForgeTags("stone"), ComesWith.SLAB), POLISHED_WEATHERED_LIMESTONE(() -> new Block(Properties.from(WEATHERED_LIMESTONE.get())), ITaggable.create().withForgeTags("stone"), ComesWith.SLAB),
WEATHERED_LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(WEATHERED_LIMESTONE.get()))), WEATHERED_LIMESTONE_PILLAR(() -> new RotatedPillarBlock(Properties.from(WEATHERED_LIMESTONE.get()))),
WEATHERED_LIMESTONE_LAYERS(new LayeredCTBlock(Properties.from(WEATHERED_LIMESTONE.get()), WEATHERED_LIMESTONE_LAYERS(() -> new LayeredCTBlock(Properties.from(WEATHERED_LIMESTONE.get()),
AllCTs.WEATHERED_LIMESTONE_LAYERS, AllCTs.POLISHED_WEATHERED_LIMESTONE)), AllCTs.WEATHERED_LIMESTONE_LAYERS, AllCTs.POLISHED_WEATHERED_LIMESTONE)),
NATURAL_SCORIA(new ScoriaBlock()), NATURAL_SCORIA(ScoriaBlock::new),
SCORIA(new TaggedBlock(new Block(Properties.from(Blocks.ANDESITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), SCORIA(() -> new Block(Properties.from(Blocks.ANDESITE)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
POLISHED_SCORIA(new TaggedBlock(new Block(Properties.from(SCORIA.get()))).withForgeTags("stone"), ComesWith.SLAB), POLISHED_SCORIA(() -> new Block(Properties.from(SCORIA.get())), ITaggable.create().withForgeTags("stone"), ComesWith.SLAB),
SCORIA_BRICKS(new Block(Properties.from(SCORIA.get()))), SCORIA_BRICKS(() -> new Block(Properties.from(SCORIA.get()))),
SCORIA_LAYERS(new LayeredCTBlock(Properties.from(SCORIA.get()), AllCTs.SCORIA_LAYERS, AllCTs.POLISHED_SCORIA)), SCORIA_LAYERS(() -> new LayeredCTBlock(Properties.from(SCORIA.get()), AllCTs.SCORIA_LAYERS, AllCTs.POLISHED_SCORIA)),
SCORIA_PILLAR(new RotatedPillarBlock(Properties.from(SCORIA.get()))), SCORIA_PILLAR(() -> new RotatedPillarBlock(Properties.from(SCORIA.get()))),
DARK_SCORIA(new Block(Properties.from(Blocks.ANDESITE))), DARK_SCORIA(() -> new Block(Properties.from(Blocks.ANDESITE))),
POLISHED_DARK_SCORIA(new Block(Properties.from(DARK_SCORIA.get()))), POLISHED_DARK_SCORIA(() -> new Block(Properties.from(DARK_SCORIA.get()))),
DARK_SCORIA_TILES(new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB), DARK_SCORIA_TILES(() -> new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB),
DARK_SCORIA_BRICKS(new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), DARK_SCORIA_BRICKS(() -> new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
__MATERIALS__(), __MATERIALS__(),
COPPER_ORE(new TaggedBlock(new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1)).withForgeTags("ores/copper")), COPPER_ORE(() -> new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1), ITaggable.create().withForgeTags("ores/copper")),
ZINC_ORE(new TaggedBlock(new Block(Properties.from(Blocks.GOLD_ORE).harvestLevel(2).harvestTool(ToolType.PICKAXE))).withForgeTags("ores/zinc")), ZINC_ORE(() -> new Block(Properties.from(Blocks.GOLD_ORE).harvestLevel(2).harvestTool(ToolType.PICKAXE)), ITaggable.create().withForgeTags("ores/zinc")),
COPPER_BLOCK(new TaggedBlock(new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)).withForgeTags("storage_blocks/copper")), 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)), COPPER_SHINGLES(() -> new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)),
ZINC_BLOCK(new TaggedBlock(new Block(Properties.from(Blocks.IRON_BLOCK))).withForgeTags("storage_blocks/zinc")), ZINC_BLOCK(() -> new Block(Properties.from(Blocks.IRON_BLOCK)), ITaggable.create().withForgeTags("storage_blocks/zinc")),
BRASS_BLOCK(new TaggedBlock(new Block(Properties.from(Blocks.IRON_BLOCK))).withForgeTags("storage_blocks/brass")), BRASS_BLOCK(() -> new Block(Properties.from(Blocks.IRON_BLOCK)), ITaggable.create().withForgeTags("storage_blocks/brass")),
; ;
private enum ComesWith { private enum ComesWith {
WALL, FENCE, FENCE_GATE, SLAB, STAIRS NO_BLOCKITEM, WALL, FENCE, FENCE_GATE, SLAB, STAIRS
} }
private static class CategoryTracker { private static class CategoryTracker {
static IModule currentModule; static IModule currentModule;
} }
private TaggedBlock taggedBlock; public final RegistryEntry<? extends Block> block;
public TaggedBlock[] alsoRegistered; public final ImmutableList<RegistryEntry<? extends Block>> alsoRegistered;
public IModule module; public final IModule module;
AllBlocks() { AllBlocks() {
CategoryTracker.currentModule = () -> Lang.asId(name()).replaceAll("__", ""); CategoryTracker.currentModule = () -> Lang.asId(name()).replaceAll("__", "");
taggedBlock = new TaggedBlock(null); this.block = null;
} this.alsoRegistered = ImmutableList.of();
AllBlocks(Block block, ComesWith... comesWith) {
this(new TaggedBlock(block), comesWith);
}
AllBlocks(TaggedBlock taggedBlockIn, ComesWith... comesWith){
this.taggedBlock = taggedBlockIn;
this.taggedBlock.getBlock().setRegistryName(Create.ID, Lang.asId(name()));
this.module = CategoryTracker.currentModule; this.module = CategoryTracker.currentModule;
alsoRegistered = new TaggedBlock[comesWith.length];
for (int i = 0; i < comesWith.length; i++)
alsoRegistered[i] = makeRelatedBlock(taggedBlock.getBlock(), comesWith[i]);
} }
public static void register(RegistryEvent.Register<Block> event) { AllBlocks(NonNullSupplier<? extends Block> block, ComesWith... comesWith) {
IForgeRegistry<Block> registry = event.getRegistry(); this(block, ITaggable.create(), comesWith);
}
AllBlocks(NonNullSupplier<? extends Block> block, NonNullBiFunction<? super Block, Item.Properties, ? extends BlockItem> customItemCreator, ComesWith... comesWith) {
this(block, customItemCreator, ITaggable.create(), comesWith);
}
for (AllBlocks block : values()) { AllBlocks(NonNullSupplier<? extends Block> block, ITaggable<?> tags, ComesWith... comesWith) {
if (block.get() == null) this(block, null, tags, comesWith);
continue; }
registry.register(block.get()); AllBlocks(NonNullSupplier<? extends Block> block, NonNullBiFunction<? super Block, Item.Properties, ? extends BlockItem> customItemCreator, ITaggable<?> tags, ComesWith... comesWith){
for (TaggedBlock extra : block.alsoRegistered) this.module = CategoryTracker.currentModule;
registry.register(extra.block);
this.block = Create.registrate().block(Lang.asId(name()), $ -> block.get()) // TODO take properties as input
.transform(applyTags(tags))
.transform(b -> registerItemBlock(b, customItemCreator, comesWith))
.register();
ImmutableList.Builder<RegistryEntry<? extends Block>> alsoRegistered = ImmutableList.builder();
for (ComesWith with : comesWith) {
if (with != ComesWith.NO_BLOCKITEM) {
alsoRegistered.add(makeRelatedBlock(this.block, with));
}
} }
this.alsoRegistered = alsoRegistered.build();
} }
public static void registerItemBlocks(IForgeRegistry<Item> registry) { public static void register() {
for (AllBlocks block : values()) {
Block def = block.get();
if (def == null)
continue;
if (def instanceof IHaveNoBlockItem && !((IHaveNoBlockItem) def).hasBlockItem())
continue;
registerAsItem(registry, def);
for (TaggedBlock extra : block.alsoRegistered)
registerAsItem(registry, extra.block);
}
} }
private static void registerAsItem(IForgeRegistry<Item> registry, Block blockIn) { public <B extends Block, P> BlockBuilder<B, P> registerItemBlock(BlockBuilder<B, P> builder, NonNullBiFunction<? super B, Item.Properties, ? extends BlockItem> customItemCreator, ComesWith... comesWith) {
BlockItem blockItem; if (ArrayUtils.contains(comesWith, ComesWith.NO_BLOCKITEM)) {
Item.Properties standardItemProperties = AllItems.includeInItemGroup(); return builder;
}
if (blockIn instanceof IHaveCustomBlockItem) return registerAsItem(builder, customItemCreator);
blockItem = ((IHaveCustomBlockItem) blockIn).getCustomItem(standardItemProperties);
else
blockItem = new BlockItem(blockIn, standardItemProperties);
registry.register(blockItem.setRegistryName(blockIn.getRegistryName()));
} }
public Block get() { private <B extends Block, P> BlockBuilder<B, P> registerAsItem(BlockBuilder<B, P> builder, NonNullBiFunction<? super B, Item.Properties, ? extends BlockItem> customItemCreator) {
return taggedBlock.getBlock(); ItemBuilder<? extends BlockItem, BlockBuilder<B, P>> itemBuilder = customItemCreator == null ? builder.item() : builder.item(customItemCreator);
return itemBuilder.properties($ -> AllItems.includeInItemGroup()).build();
} }
public ITaggable<?> getTaggable() { @Override
return taggedBlock; public @Nonnull Block get() {
return block == null ? Blocks.AIR : block.get();
} }
public BlockState getDefault() { public BlockState getDefault() {
@ -381,32 +378,46 @@ public enum AllBlocks {
return state.getBlock() == get(); return state.getBlock() == get();
} }
private TaggedBlock makeRelatedBlock(Block block, ComesWith feature) { private RegistryEntry<? extends Block> makeRelatedBlock(RegistryEntry<? extends Block> block, ComesWith feature) {
Properties properties = Properties.from(block); NonNullFunction<Block.Properties, ? extends Block> creator;
TaggedBlock featured; final Tag<Block> tag;
switch (feature) { switch (feature) {
case FENCE: case FENCE:
featured = new TaggedBlock(new FenceBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "fences"); creator = FenceBlock::new;
tag = BlockTags.FENCES;
break; break;
case SLAB: case SLAB:
featured = new TaggedBlock(new SlabBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "slabs"); creator = SlabBlock::new;
tag = BlockTags.SLABS;
break; break;
case STAIRS: case STAIRS:
featured = new TaggedBlock(new ProperStairsBlock(block)).withVanillaTags(ITaggable.TagType.BLOCK, "stairs"); creator = p -> new ProperStairsBlock(block.get());
tag = BlockTags.STAIRS;
break; break;
case WALL: case WALL:
featured = new TaggedBlock(new WallBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "walls"); creator = WallBlock::new;
tag = BlockTags.WALLS;
break; break;
case FENCE_GATE: case FENCE_GATE:
featured = new TaggedBlock(new FenceGateBlock(properties)); creator = FenceGateBlock::new;
tag = null;
break; break;
default: default:
return null; throw new IllegalArgumentException("Unknown ComesWith type?");
} }
featured.block.setRegistryName(Create.ID, block.getRegistryName().getPath() + "_" + Lang.asId(feature.name())); return Create.registrate().block(block.getId().getPath() + "_" + Lang.asId(feature.name()), creator)
return featured; .simpleItem()
.transform(b -> tag != null ? b.tag(tag) : b)
.register();
}
private <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> applyTags(ITaggable<?> tags) {
return b -> {
tags.getDataTags(ITaggable.BLOCK).forEach(b::tag);
return b;
};
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -418,25 +429,4 @@ public enum AllBlocks {
} }
} }
} }
public static class TaggedBlock implements ITaggable<TaggedBlock> {
//A wrapper around Block that allows for tags to be included. needed for datagen
private Set<ResourceLocation> tagSetBlock = new HashSet<>();
private Set<ResourceLocation> tagSetBlockItem = new HashSet<>();
private Block block;
public TaggedBlock(Block blockIn){
block = blockIn;
}
public Block getBlock() {
return block;
}
@Override
public Set<ResourceLocation> getTagSet(TagType type) {
return type == TagType.BLOCK ? tagSetBlock : tagSetBlockItem;
}
}
} }

View file

@ -201,8 +201,6 @@ public enum AllItems {
entry.item.setRegistryName(Create.ID, Lang.asId(entry.name())); entry.item.setRegistryName(Create.ID, Lang.asId(entry.name()));
registry.register(entry.item); registry.register(entry.item);
} }
AllBlocks.registerItemBlocks(registry);
} }
public Item get() { public Item get() {

View file

@ -12,6 +12,8 @@ import com.simibubi.create.modules.ModuleLoadedCondition;
import com.simibubi.create.modules.contraptions.TorquePropagator; import com.simibubi.create.modules.contraptions.TorquePropagator;
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler; import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
import com.simibubi.create.modules.schematics.ServerSchematicLoader; import com.simibubi.create.modules.schematics.ServerSchematicLoader;
import com.tterrag.registrate.Registrate;
import com.tterrag.registrate.util.LazyValue;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@ -43,6 +45,7 @@ public class Create {
public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler; public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler;
public static TorquePropagator torquePropagator; public static TorquePropagator torquePropagator;
public static ServerLagger lagger; public static ServerLagger lagger;
private static final LazyValue<Registrate> registrate = new LazyValue<>(() -> Registrate.create(ID));
public Create() { public Create() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
@ -50,7 +53,8 @@ public class Create {
MinecraftForge.EVENT_BUS.addListener(Create::serverStarting); MinecraftForge.EVENT_BUS.addListener(Create::serverStarting);
modEventBus.addGenericListener(Block.class, AllBlocks::register); AllBlocks.register();
// modEventBus.addGenericListener(Block.class, AllBlocks::register);
modEventBus.addGenericListener(Item.class, AllItems::register); modEventBus.addGenericListener(Item.class, AllItems::register);
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipes::register); modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipes::register);
modEventBus.addGenericListener(TileEntityType.class, AllTileEntities::register); modEventBus.addGenericListener(TileEntityType.class, AllTileEntities::register);
@ -59,14 +63,14 @@ public class Create {
modEventBus.addGenericListener(ParticleType.class, AllParticles::register); modEventBus.addGenericListener(ParticleType.class, AllParticles::register);
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register); modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
AllConfigs.registerAll();
modEventBus.addListener(AllConfigs::onLoad); modEventBus.addListener(AllConfigs::onLoad);
modEventBus.addListener(AllConfigs::onReload); modEventBus.addListener(AllConfigs::onReload);
CreateClient.addListeners(modEventBus); CreateClient.addListeners(modEventBus);
AllWorldFeatures.reload();
} }
public static void init(final FMLCommonSetupEvent event) { public static void init(final FMLCommonSetupEvent event) {
AllConfigs.registerAll();
schematicReceiver = new ServerSchematicLoader(); schematicReceiver = new ServerSchematicLoader();
redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler(); redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler();
torquePropagator = new TorquePropagator(); torquePropagator = new TorquePropagator();
@ -75,6 +79,8 @@ public class Create {
CraftingHelper.register(new ModuleLoadedCondition.Serializer()); CraftingHelper.register(new ModuleLoadedCondition.Serializer());
AllPackets.registerPackets(); AllPackets.registerPackets();
AllTriggers.register(); AllTriggers.register();
AllWorldFeatures.reload();
} }
public static void serverStarting(FMLServerStartingEvent event) { public static void serverStarting(FMLServerStartingEvent event) {
@ -93,4 +99,7 @@ public class Create {
schematicReceiver.shutdown(); schematicReceiver.shutdown();
} }
public static Registrate registrate() {
return registrate.get();
}
} }

View file

@ -1,14 +1,16 @@
package com.simibubi.create; package com.simibubi.create;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.item.IAddedByOther; import com.simibubi.create.foundation.item.IAddedByOther;
import com.tterrag.registrate.util.RegistryEntry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -40,14 +42,15 @@ public final class CreateItemGroup extends ItemGroup {
continue; continue;
if (!block.module.isEnabled()) if (!block.module.isEnabled())
continue; continue;
if (def instanceof IHaveNoBlockItem && !((IHaveNoBlockItem) def).hasBlockItem())
continue;
if (def instanceof IAddedByOther) if (def instanceof IAddedByOther)
continue; continue;
def.asItem().fillItemGroup(this, items); Item item = def.asItem();
for (AllBlocks.TaggedBlock alsoRegistered : block.alsoRegistered) if (item != Items.AIR) {
alsoRegistered.getBlock().asItem().fillItemGroup(this, items); item.fillItemGroup(this, items);
for (RegistryEntry<? extends Block> alsoRegistered : block.alsoRegistered)
alsoRegistered.get().asItem().fillItemGroup(this, items);
}
} }
} }

View file

@ -1,10 +0,0 @@
package com.simibubi.create.foundation.block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item.Properties;
public interface IHaveCustomBlockItem {
public BlockItem getCustomItem(Properties properties);
}

View file

@ -1,12 +0,0 @@
package com.simibubi.create.foundation.block;
/**
* Blocks only registered for use outside of the inventory
*/
public interface IHaveNoBlockItem {
default boolean hasBlockItem() {
return false;
}
}

View file

@ -3,6 +3,6 @@ package com.simibubi.create.foundation.block;
/** /**
* Blocks only registered for use in other blocks' renderers. * Blocks only registered for use in other blocks' renderers.
*/ */
public interface IRenderUtilityBlock extends IHaveNoBlockItem { public interface IRenderUtilityBlock {
} }

View file

@ -2,22 +2,50 @@ package com.simibubi.create.foundation.utility.data;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
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.minecraft.util.ResourceLocation;
public interface ITaggable<T extends ITaggable<T>> { public interface ITaggable<T extends ITaggable<T>> {
interface TagType<T> {
TagCollection<T> getCollection();
}
enum TagType { class Impl implements ITaggable<Impl> {
BLOCK, ITEM
} private Map<TagType<?>, Set<ResourceLocation>> tags = new HashMap<>();
@Override
public Set<ResourceLocation> getTagSet(TagType<?> type) {
return tags.computeIfAbsent(type, $ -> new HashSet<>());
}
}
static ITaggable<Impl> create() {
return new Impl();
}
static TagType<Block> BLOCK = BlockTags::getCollection;
static TagType<Item> ITEM = ItemTags::getCollection;
default T withTags(ResourceLocation... tagsIn) { default T withTags(ResourceLocation... tagsIn) {
return this.withTags(TagType.BLOCK, tagsIn).withTags(TagType.ITEM, tagsIn); return this.withTags(BLOCK, tagsIn).withTags(ITEM, tagsIn);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
default T withTags(TagType type, ResourceLocation... tagsIn) { default T withTags(TagType<?> type, ResourceLocation... tagsIn) {
Collections.addAll(getTagSet(type), tagsIn); Collections.addAll(getTagSet(type), tagsIn);
return (T) this; return (T) this;
} }
@ -26,7 +54,7 @@ public interface ITaggable<T extends ITaggable<T>> {
return withTags(Arrays.stream(tagsIn).map(s -> new ResourceLocation(namespace, s)).toArray(ResourceLocation[]::new)); return withTags(Arrays.stream(tagsIn).map(s -> new ResourceLocation(namespace, s)).toArray(ResourceLocation[]::new));
} }
default T withTagsInNamespace(TagType type, String namespace, String... tagsIn) { default T withTagsInNamespace(TagType<?> type, String namespace, String... tagsIn) {
return withTags(type, Arrays.stream(tagsIn).map(s -> new ResourceLocation(namespace, s)).toArray(ResourceLocation[]::new)); return withTags(type, Arrays.stream(tagsIn).map(s -> new ResourceLocation(namespace, s)).toArray(ResourceLocation[]::new));
} }
@ -42,10 +70,14 @@ public interface ITaggable<T extends ITaggable<T>> {
return withTagsInNamespace("minecraft", tagsIn); return withTagsInNamespace("minecraft", tagsIn);
} }
default T withVanillaTags(TagType type, String... tagsIn) { default T withVanillaTags(TagType<?> type, String... tagsIn) {
return withTagsInNamespace(type, "minecraft", tagsIn); return withTagsInNamespace(type, "minecraft", tagsIn);
} }
//take a look at AllBlocks.TaggedBlock for more info //take a look at AllBlocks.TaggedBlock for more info
Set<ResourceLocation> getTagSet(TagType type); Set<ResourceLocation> getTagSet(TagType<?> type);
default <C> Set<Tag<C>> getDataTags(TagType<C> type) {
return getTagSet(type).stream().map(type.getCollection()::getOrCreate).collect(Collectors.toSet());
}
} }

View file

@ -19,17 +19,17 @@ import net.minecraftforge.registries.ForgeRegistries;
public enum AllWorldFeatures { public enum AllWorldFeatures {
COPPER_ORE(new CountedOreFeature(AllBlocks.COPPER_ORE.get(), 18, 2).between(40, 86)), COPPER_ORE(new CountedOreFeature(AllBlocks.COPPER_ORE, 18, 2).between(40, 86)),
COPPER_ORE_OCEAN(new CountedOreFeature(AllBlocks.COPPER_ORE.get(), 15, 4).between(20, 55).inBiomes(OCEAN)), COPPER_ORE_OCEAN(new CountedOreFeature(AllBlocks.COPPER_ORE, 15, 4).between(20, 55).inBiomes(OCEAN)),
ZINC_ORE(new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 14, 4).between(15, 70)), ZINC_ORE(new CountedOreFeature(AllBlocks.ZINC_ORE, 14, 4).between(15, 70)),
ZINC_ORE_DESERT(new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 17, 5).between(10, 85).inBiomes(DESERT)), ZINC_ORE_DESERT(new CountedOreFeature(AllBlocks.ZINC_ORE, 17, 5).between(10, 85).inBiomes(DESERT)),
LIMESTONE(new ChanceOreFeature(AllBlocks.LIMESTONE.get(), 128, 1 / 32f).between(30, 70)), LIMESTONE(new ChanceOreFeature(AllBlocks.LIMESTONE, 128, 1 / 32f).between(30, 70)),
WEATHERED_LIMESTONE(new ChanceOreFeature(AllBlocks.WEATHERED_LIMESTONE.get(), 128, 1 / 32f).between(10, 30)), WEATHERED_LIMESTONE(new ChanceOreFeature(AllBlocks.WEATHERED_LIMESTONE, 128, 1 / 32f).between(10, 30)),
DOLOMITE(new ChanceOreFeature(AllBlocks.DOLOMITE.get(), 128, 1 / 64f).between(20, 70)), DOLOMITE(new ChanceOreFeature(AllBlocks.DOLOMITE, 128, 1 / 64f).between(20, 70)),
GABBRO(new ChanceOreFeature(AllBlocks.GABBRO.get(), 128, 1 / 64f).between(20, 70)), GABBRO(new ChanceOreFeature(AllBlocks.GABBRO, 128, 1 / 64f).between(20, 70)),
SCORIA(new ChanceOreFeature(AllBlocks.NATURAL_SCORIA.get(), 128, 1 / 32f).between(0, 10)), SCORIA(new ChanceOreFeature(AllBlocks.NATURAL_SCORIA, 128, 1 / 32f).between(0, 10)),
; ;

View file

@ -2,6 +2,8 @@ package com.simibubi.create.foundation.world;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.gen.placement.ChanceRangeConfig; import net.minecraft.world.gen.placement.ChanceRangeConfig;
import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.placement.Placement;
@ -10,7 +12,7 @@ public class ChanceOreFeature extends OreFeature<ChanceRangeConfig> {
private ConfigFloat clusterChance; private ConfigFloat clusterChance;
public ChanceOreFeature(Block block, int clusterSize, float clusterChance) { public ChanceOreFeature(NonNullSupplier<Block> block, int clusterSize, float clusterChance) {
super(block, clusterSize); super(block, clusterSize);
this.clusterChance = f(clusterChance, 0, 1, "clusterChance"); this.clusterChance = f(clusterChance, 0, 1, "clusterChance");
} }

View file

@ -2,6 +2,8 @@ package com.simibubi.create.foundation.world;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.gen.placement.CountRangeConfig; import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.placement.Placement;
@ -10,7 +12,7 @@ public class CountedOreFeature extends OreFeature<CountRangeConfig> {
private ConfigInt clusterCount; private ConfigInt clusterCount;
public CountedOreFeature(Block block, int clusterSize, int clusterCount) { public CountedOreFeature(NonNullSupplier<Block> block, int clusterSize, int clusterCount) {
super(block, clusterSize); super(block, clusterSize);
this.clusterCount = i(clusterCount, 0, "clusterCount"); this.clusterCount = i(clusterCount, 0, "clusterCount");
} }

View file

@ -1,11 +1,15 @@
package com.simibubi.create.foundation.world; package com.simibubi.create.foundation.world;
import java.util.Optional; import java.util.Optional;
import java.util.function.Supplier;
import javax.annotation.Nonnull;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.AllConfigs;
import com.simibubi.create.config.ConfigBase; import com.simibubi.create.config.ConfigBase;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@ -27,10 +31,10 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
protected ConfigInt minHeight; protected ConfigInt minHeight;
protected ConfigInt maxHeight; protected ConfigInt maxHeight;
private Block block; private NonNullSupplier<Block> block;
private Biome.Category specificCategory; private Biome.Category specificCategory;
public OreFeature(Block block, int clusterSize) { public OreFeature(NonNullSupplier<Block> block, int clusterSize) {
this.block = block; this.block = block;
this.enable = b(true, "enable", "Whether to spawn this in your World"); this.enable = b(true, "enable", "Whether to spawn this in your World");
this.clusterSize = i(clusterSize, 0, "clusterSize"); this.clusterSize = i(clusterSize, 0, "clusterSize");
@ -65,7 +69,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
Pair<Placement<T>, T> placement = getPlacement(); Pair<Placement<T>, T> placement = getPlacement();
ConfiguredFeature<?, ?> createdFeature = Feature.ORE ConfiguredFeature<?, ?> createdFeature = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, block.getDefaultState(), clusterSize.get())) .configure(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, block.get().getDefaultState(), clusterSize.get()))
.createDecoratedFeature(placement.getKey().configure(placement.getValue())); .createDecoratedFeature(placement.getKey().configure(placement.getValue()));
return Optional.of(createdFeature); return Optional.of(createdFeature);

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.components.contraptions.piston; package com.simibubi.create.modules.contraptions.components.contraptions.piston;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState; import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState;
@ -24,7 +23,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements IHaveNoBlockItem { public class MechanicalPistonHeadBlock extends ProperDirectionalBlock {
public static final EnumProperty<PistonType> TYPE = BlockStateProperties.PISTON_TYPE; public static final EnumProperty<PistonType> TYPE = BlockStateProperties.PISTON_TYPE;

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.components.contraptions.pulley; package com.simibubi.create.modules.contraptions.components.contraptions.pulley;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.base.HorizontalAxisKineticBlock; import com.simibubi.create.modules.contraptions.base.HorizontalAxisKineticBlock;
@ -70,7 +69,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
pulley.sendData(); pulley.sendData();
} }
private static class RopeBlockBase extends Block implements IHaveNoBlockItem { private static class RopeBlockBase extends Block {
public RopeBlockBase(Properties properties) { public RopeBlockBase(Properties properties) {
super(properties); super(properties);

View file

@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.components.crusher;
import java.util.Random; import java.util.Random;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -35,7 +34,7 @@ import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
public class CrushingWheelControllerBlock extends Block public class CrushingWheelControllerBlock extends Block
implements IHaveNoBlockItem, ITE<CrushingWheelControllerTileEntity> { implements ITE<CrushingWheelControllerTileEntity> {
public static final BooleanProperty VALID = BooleanProperty.create("valid"); public static final BooleanProperty VALID = BooleanProperty.create("valid");

View file

@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.components.mixer;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
@ -11,8 +12,8 @@ import net.minecraft.util.math.BlockPos;
public class BasinOperatorBlockItem extends BlockItem { public class BasinOperatorBlockItem extends BlockItem {
public BasinOperatorBlockItem(AllBlocks block, Properties builder) { public BasinOperatorBlockItem(Block block, Properties builder) {
super(block.get(), builder); super(block, builder);
} }
@Override @Override

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.components.mixer; package com.simibubi.create.modules.contraptions.components.mixer;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.base.KineticBlock; import com.simibubi.create.modules.contraptions.base.KineticBlock;
@ -9,7 +8,6 @@ import com.simibubi.create.modules.contraptions.base.KineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
@ -20,7 +18,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
public class MechanicalMixerBlock extends KineticBlock public class MechanicalMixerBlock extends KineticBlock
implements ITE<MechanicalMixerTileEntity>, IHaveCustomBlockItem { implements ITE<MechanicalMixerTileEntity> {
public MechanicalMixerBlock() { public MechanicalMixerBlock() {
super(Properties.from(Blocks.ANDESITE)); super(Properties.from(Blocks.ANDESITE));
@ -84,11 +82,6 @@ public class MechanicalMixerBlock extends KineticBlock
return SpeedLevel.MEDIUM; return SpeedLevel.MEDIUM;
} }
@Override
public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) {
return new BasinOperatorBlockItem(AllBlocks.MECHANICAL_MIXER, properties);
}
@Override @Override
public Class<MechanicalMixerTileEntity> getTileEntityClass() { public Class<MechanicalMixerTileEntity> getTileEntityClass() {
return MechanicalMixerTileEntity.class; return MechanicalMixerTileEntity.class;

View file

@ -5,12 +5,10 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.components.mixer.BasinOperatorBlockItem;
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressTileEntity.Mode; import com.simibubi.create.modules.contraptions.components.press.MechanicalPressTileEntity.Mode;
import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState; import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState;
import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.IBeltAttachment; import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.IBeltAttachment;
@ -23,7 +21,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -38,7 +35,7 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class MechanicalPressBlock extends HorizontalKineticBlock public class MechanicalPressBlock extends HorizontalKineticBlock
implements ITE<MechanicalPressTileEntity>, IBeltAttachment, IHaveCustomBlockItem { implements ITE<MechanicalPressTileEntity>, IBeltAttachment {
public MechanicalPressBlock() { public MechanicalPressBlock() {
super(Properties.from(Blocks.PISTON)); super(Properties.from(Blocks.PISTON));
@ -190,11 +187,6 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return false; return false;
} }
@Override
public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) {
return new BasinOperatorBlockItem(AllBlocks.MECHANICAL_PRESS, properties);
}
@Override @Override
public Class<MechanicalPressTileEntity> getTileEntityClass() { public Class<MechanicalPressTileEntity> getTileEntityClass() {
return MechanicalPressTileEntity.class; return MechanicalPressTileEntity.class;

View file

@ -9,7 +9,6 @@ import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.block.IHaveColorHandler; import com.simibubi.create.foundation.block.IHaveColorHandler;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
@ -62,7 +61,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
public class BeltBlock extends HorizontalKineticBlock public class BeltBlock extends HorizontalKineticBlock
implements IHaveNoBlockItem, ITE<BeltTileEntity>, IHaveColorHandler { implements ITE<BeltTileEntity>, IHaveColorHandler {
public static final IProperty<Slope> SLOPE = EnumProperty.create("slope", Slope.class); public static final IProperty<Slope> SLOPE = EnumProperty.create("slope", Slope.class);
public static final IProperty<Part> PART = EnumProperty.create("part", Part.class); public static final IProperty<Part> PART = EnumProperty.create("part", Part.class);

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.relays.elementary; package com.simibubi.create.modules.contraptions.relays.elementary;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerBlock;
@ -9,7 +8,6 @@ import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerB
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -23,7 +21,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class CogWheelBlock extends ShaftBlock implements IHaveCustomBlockItem { public class CogWheelBlock extends ShaftBlock {
private boolean isLarge; private boolean isLarge;
@ -94,10 +92,4 @@ public class CogWheelBlock extends ShaftBlock implements IHaveCustomBlockItem {
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) {
return !isLarge; return !isLarge;
} }
@Override
public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) {
return new CogwheelBlockItem(this, properties, isLarge);
}
} }

View file

@ -5,7 +5,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import com.simibubi.create.foundation.block.IHaveCustomBlockModel; import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -46,7 +45,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class WindowInABlockBlock extends PaneBlock public class WindowInABlockBlock extends PaneBlock
implements ITE<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel { implements ITE<WindowInABlockTileEntity>, IHaveCustomBlockModel {
public WindowInABlockBlock() { public WindowInABlockBlock() {
super(Properties.create(Material.ROCK)); super(Properties.create(Material.ROCK));

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.logistics.block; package com.simibubi.create.modules.logistics.block;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock; import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock;
@ -23,7 +22,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public abstract class AttachedLogisticalBlock extends HorizontalBlock implements IHaveNoBlockItem { public abstract class AttachedLogisticalBlock extends HorizontalBlock {
public static final BooleanProperty UPWARD = BooleanProperty.create("upward"); public static final BooleanProperty UPWARD = BooleanProperty.create("upward");
@ -31,11 +30,6 @@ public abstract class AttachedLogisticalBlock extends HorizontalBlock implements
super(Properties.from(Blocks.ANDESITE)); super(Properties.from(Blocks.ANDESITE));
} }
@Override
public boolean hasBlockItem() {
return !isVertical();
}
protected abstract boolean isVertical(); protected abstract boolean isVertical();
protected abstract BlockState getVerticalDefaultState(); protected abstract BlockState getVerticalDefaultState();