From 2cccbca11b736ef7b0ffb6ef6c36d7b9934074b3 Mon Sep 17 00:00:00 2001 From: tterrag Date: Mon, 13 Apr 2020 02:58:57 -0400 Subject: [PATCH] Add registrate as dependency, experimental refactor of AllBlocks --- build.gradle | 22 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/com/simibubi/create/AllBlocks.java | 480 +++++++++--------- .../java/com/simibubi/create/AllItems.java | 2 - src/main/java/com/simibubi/create/Create.java | 15 +- .../com/simibubi/create/CreateItemGroup.java | 15 +- .../block/IHaveCustomBlockItem.java | 10 - .../foundation/block/IHaveNoBlockItem.java | 12 - .../foundation/block/IRenderUtilityBlock.java | 2 +- .../foundation/utility/data/ITaggable.java | 48 +- .../foundation/world/AllWorldFeatures.java | 18 +- .../foundation/world/ChanceOreFeature.java | 4 +- .../foundation/world/CountedOreFeature.java | 4 +- .../create/foundation/world/OreFeature.java | 10 +- .../piston/MechanicalPistonHeadBlock.java | 3 +- .../contraptions/pulley/PulleyBlock.java | 3 +- .../crusher/CrushingWheelControllerBlock.java | 3 +- .../mixer/BasinOperatorBlockItem.java | 5 +- .../mixer/MechanicalMixerBlock.java | 9 +- .../press/MechanicalPressBlock.java | 10 +- .../contraptions/relays/belt/BeltBlock.java | 3 +- .../relays/elementary/CogWheelBlock.java | 10 +- .../partialWindows/WindowInABlockBlock.java | 3 +- .../block/AttachedLogisticalBlock.java | 8 +- 24 files changed, 353 insertions(+), 348 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockItem.java delete mode 100644 src/main/java/com/simibubi/create/foundation/block/IHaveNoBlockItem.java diff --git a/build.gradle b/build.gradle index a8e1224f0..1ddc10340 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,9 @@ buildscript { 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' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' @@ -77,15 +80,23 @@ repositories { url "http://maven.blamejared.com/" } maven { - // for mixed mappings + //location of the maven for mixed mappings and registrate name = "tterrag maven" url = "https://maven.tterrag.com/" } } +configurations { + shade +} + dependencies { 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 compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api") // 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 // we define a custom artifact that is sourced from the reobfJar output task // and then declare that to be published diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 949819d28..a055b814c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME 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 diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 9cb2e32ff..5adae6a5b 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -1,11 +1,11 @@ package com.simibubi.create; -import java.util.HashSet; -import java.util.Set; +import javax.annotation.Nonnull; +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.IHaveCustomBlockItem; -import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.ProperStairsBlock; import com.simibubi.create.foundation.utility.Lang; 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.engine.FurnaceEngineBlock; 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.motor.MotorBlock; 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.belt.BeltBlock; 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.AdjustablePulleyBlock; 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.SchematicTableBlock; 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.Properties; @@ -103,274 +112,262 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.item.BlockItem; 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.OnlyIn; import net.minecraftforge.common.ToolType; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.registries.IForgeRegistry; -public enum AllBlocks { +public enum AllBlocks implements NonNullSupplier { __SCHEMATICS__(), - SCHEMATICANNON(new SchematicannonBlock()), - CREATIVE_CRATE(new CreativeCrateBlock()), - SCHEMATIC_TABLE(new SchematicTableBlock()), + SCHEMATICANNON(SchematicannonBlock::new), + CREATIVE_CRATE(CreativeCrateBlock::new), + SCHEMATIC_TABLE(SchematicTableBlock::new), __CONTRAPTIONS__(), - SHAFT(new ShaftBlock(Properties.from(Blocks.ANDESITE))), - COGWHEEL(new CogWheelBlock(false)), - LARGE_COGWHEEL(new CogWheelBlock(true)), - ENCASED_SHAFT(new EncasedShaftBlock()), - GEARBOX(new GearboxBlock()), - CLUTCH(new ClutchBlock()), - GEARSHIFT(new GearshiftBlock()), - ENCASED_BELT(new EncasedBeltBlock()), - ADJUSTABLE_PULLEY(new AdjustablePulleyBlock()), - BELT(new BeltBlock()), - CREATIVE_MOTOR(new MotorBlock()), - WATER_WHEEL(new WaterWheelBlock()), - ENCASED_FAN(new EncasedFanBlock()), - NOZZLE(new NozzleBlock()), - TURNTABLE(new TurntableBlock()), - HAND_CRANK(new HandCrankBlock()), - CUCKOO_CLOCK(new CuckooClockBlock(false)), - MYSTERIOUS_CUCKOO_CLOCK(new CuckooClockBlock(true)), + SHAFT(() -> new ShaftBlock(Properties.from(Blocks.ANDESITE))), + COGWHEEL(() -> new CogWheelBlock(false), (b, p) -> new CogwheelBlockItem(b, p, false)), + LARGE_COGWHEEL(() -> new CogWheelBlock(true), (b, p) -> new CogwheelBlockItem(b, p, true)), + ENCASED_SHAFT(EncasedShaftBlock::new), + GEARBOX(GearboxBlock::new), + CLUTCH(ClutchBlock::new), + GEARSHIFT(GearshiftBlock::new), + ENCASED_BELT(EncasedBeltBlock::new), + ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new), + BELT(BeltBlock::new, ComesWith.NO_BLOCKITEM), + CREATIVE_MOTOR(MotorBlock::new), + WATER_WHEEL(WaterWheelBlock::new), + ENCASED_FAN(EncasedFanBlock::new), + NOZZLE(NozzleBlock::new), + TURNTABLE(TurntableBlock::new), + HAND_CRANK(HandCrankBlock::new), + CUCKOO_CLOCK(() -> new CuckooClockBlock(false)), + MYSTERIOUS_CUCKOO_CLOCK(() -> new CuckooClockBlock(true)), - MILLSTONE(new MillstoneBlock()), - CRUSHING_WHEEL(new CrushingWheelBlock()), - CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()), - MECHANICAL_PRESS(new MechanicalPressBlock()), - MECHANICAL_MIXER(new MechanicalMixerBlock()), - BASIN(new BasinBlock()), - SPEED_GAUGE(new GaugeBlock(GaugeBlock.Type.SPEED)), - STRESS_GAUGE(new GaugeBlock(GaugeBlock.Type.STRESS)), + MILLSTONE(MillstoneBlock::new), + CRUSHING_WHEEL(CrushingWheelBlock::new), + CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerBlock::new, ComesWith.NO_BLOCKITEM), + MECHANICAL_PRESS(MechanicalPressBlock::new, BasinOperatorBlockItem::new), + MECHANICAL_MIXER(MechanicalMixerBlock::new, BasinOperatorBlockItem::new), + BASIN(BasinBlock::new), + SPEED_GAUGE(() -> new GaugeBlock(GaugeBlock.Type.SPEED)), + STRESS_GAUGE(() -> new GaugeBlock(GaugeBlock.Type.STRESS)), - MECHANICAL_PISTON(new MechanicalPistonBlock(false)), - STICKY_MECHANICAL_PISTON(new MechanicalPistonBlock(true)), - MECHANICAL_PISTON_HEAD(new MechanicalPistonHeadBlock()), - PISTON_POLE(new PistonPoleBlock()), - MECHANICAL_BEARING(new MechanicalBearingBlock()), - CLOCKWORK_BEARING(new ClockworkBearingBlock()), - ROPE_PULLEY(new PulleyBlock()), - ROPE(new PulleyBlock.RopeBlock()), - PULLEY_MAGNET(new PulleyBlock.MagnetBlock()), - CART_ASSEMBLER(new TaggedBlock(new CartAssemblerBlock()).withVanillaTags(ITaggable.TagType.BLOCK, "rails")), - MINECART_ANCHOR(new MinecartAnchorBlock()), - TRANSLATION_CHASSIS(new LinearChassisBlock()), - TRANSLATION_CHASSIS_SECONDARY(new LinearChassisBlock()), - ROTATION_CHASSIS(new RadialChassisBlock()), - DRILL(new DrillBlock()), - SAW(new SawBlock()), - HARVESTER(new HarvesterBlock()), - DEPLOYER(new DeployerBlock()), - PORTABLE_STORAGE_INTERFACE(new PortableStorageInterfaceBlock()), - ANALOG_LEVER(new AnalogLeverBlock()), + MECHANICAL_PISTON(() -> new MechanicalPistonBlock(false)), + STICKY_MECHANICAL_PISTON(() -> new MechanicalPistonBlock(true)), + MECHANICAL_PISTON_HEAD(MechanicalPistonHeadBlock::new, ComesWith.NO_BLOCKITEM), + PISTON_POLE(PistonPoleBlock::new), + MECHANICAL_BEARING(MechanicalBearingBlock::new), + CLOCKWORK_BEARING(ClockworkBearingBlock::new), + ROPE_PULLEY(PulleyBlock::new), + ROPE(PulleyBlock.RopeBlock::new, ComesWith.NO_BLOCKITEM), + PULLEY_MAGNET(PulleyBlock.MagnetBlock::new, ComesWith.NO_BLOCKITEM), + CART_ASSEMBLER(CartAssemblerBlock::new, ITaggable.create().withVanillaTags(ITaggable.BLOCK, "rails")), + MINECART_ANCHOR(MinecartAnchorBlock::new, ComesWith.NO_BLOCKITEM), + TRANSLATION_CHASSIS(LinearChassisBlock::new), + TRANSLATION_CHASSIS_SECONDARY(LinearChassisBlock::new), + ROTATION_CHASSIS(RadialChassisBlock::new), + DRILL(DrillBlock::new), + SAW(SawBlock::new), + HARVESTER(HarvesterBlock::new), + DEPLOYER(DeployerBlock::new), + PORTABLE_STORAGE_INTERFACE(PortableStorageInterfaceBlock::new), + ANALOG_LEVER(AnalogLeverBlock::new), - ANDESITE_CASING(new CasingBlock("andesite_casing")), - COPPER_CASING(new CasingBlock("copper_casing")), - BRASS_CASING(new CasingBlock("crafter_top")), + ANDESITE_CASING(() -> new CasingBlock("andesite_casing")), + COPPER_CASING(() -> new CasingBlock("copper_casing")), + BRASS_CASING(() -> new CasingBlock("crafter_top")), - MECHANICAL_CRAFTER(new MechanicalCrafterBlock()), - SEQUENCED_GEARSHIFT(new SequencedGearshiftBlock()), - FLYWHEEL(new FlywheelBlock()), - FURNACE_ENGINE(new FurnaceEngineBlock()), - ROTATION_SPEED_CONTROLLER(new SpeedControllerBlock()), + MECHANICAL_CRAFTER(MechanicalCrafterBlock::new), + SEQUENCED_GEARSHIFT(SequencedGearshiftBlock::new), + FLYWHEEL(FlywheelBlock::new), + FURNACE_ENGINE(FurnaceEngineBlock::new), + ROTATION_SPEED_CONTROLLER(SpeedControllerBlock::new), __LOGISTICS__(), - CONTACT(new ContactBlock()), - REDSTONE_BRIDGE(new RedstoneLinkBlock()), - STOCKSWITCH(new StockswitchBlock()), - FLEXCRATE(new FlexcrateBlock()), - EXTRACTOR(new ExtractorBlock()), - VERTICAL_EXTRACTOR(new ExtractorBlock.Vertical()), - LINKED_EXTRACTOR(new LinkedExtractorBlock()), - VERTICAL_LINKED_EXTRACTOR(new LinkedExtractorBlock.Vertical()), - TRANSPOSER(new TransposerBlock()), - VERTICAL_TRANSPOSER(new TransposerBlock.Vertical()), - LINKED_TRANSPOSER(new LinkedTransposerBlock()), - VERTICAL_LINKED_TRANSPOSER(new LinkedTransposerBlock.Vertical()), - BELT_FUNNEL(new FunnelBlock()), - VERTICAL_FUNNEL(new FunnelBlock.Vertical()), - BELT_TUNNEL(new BeltTunnelBlock()), - ENTITY_DETECTOR(new BeltObserverBlock()), - PULSE_REPEATER(new PulseRepeaterBlock()), - FLEXPEATER(new FlexpeaterBlock()), - FLEXPULSEPEATER(new FlexpeaterBlock()), - REDSTONE_LATCH(new LatchBlock()), - TOGGLE_LATCH(new ToggleLatchBlock()), + CONTACT(ContactBlock::new), + REDSTONE_BRIDGE(RedstoneLinkBlock::new), + STOCKSWITCH(StockswitchBlock::new), + FLEXCRATE(FlexcrateBlock::new), + EXTRACTOR(ExtractorBlock::new), + VERTICAL_EXTRACTOR(ExtractorBlock.Vertical::new, ComesWith.NO_BLOCKITEM), + LINKED_EXTRACTOR(LinkedExtractorBlock::new), + VERTICAL_LINKED_EXTRACTOR(LinkedExtractorBlock.Vertical::new, ComesWith.NO_BLOCKITEM), + TRANSPOSER(TransposerBlock::new), + VERTICAL_TRANSPOSER(TransposerBlock.Vertical::new, ComesWith.NO_BLOCKITEM), + LINKED_TRANSPOSER(LinkedTransposerBlock::new), + VERTICAL_LINKED_TRANSPOSER(LinkedTransposerBlock.Vertical::new, ComesWith.NO_BLOCKITEM), + BELT_FUNNEL(FunnelBlock::new), + VERTICAL_FUNNEL(FunnelBlock.Vertical::new, ComesWith.NO_BLOCKITEM), + BELT_TUNNEL(BeltTunnelBlock::new), + ENTITY_DETECTOR(BeltObserverBlock::new), + PULSE_REPEATER(PulseRepeaterBlock::new), + FLEXPEATER(FlexpeaterBlock::new), + FLEXPULSEPEATER(FlexpeaterBlock::new), + REDSTONE_LATCH(LatchBlock::new), + TOGGLE_LATCH(ToggleLatchBlock::new), __CURIOSITIES__(), - SYMMETRY_PLANE(new PlaneSymmetryBlock()), - SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()), - SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()), - WINDOW_IN_A_BLOCK(new WindowInABlockBlock()), - COCOA_LOG(new TaggedBlock(new CocoaLogBlock()).withVanillaTags(ITaggable.TagType.BLOCK, "jungle_logs")), + SYMMETRY_PLANE(PlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM), + SYMMETRY_CROSSPLANE(CrossPlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM), + SYMMETRY_TRIPLEPLANE(TriplePlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM), + WINDOW_IN_A_BLOCK(WindowInABlockBlock::new, ComesWith.NO_BLOCKITEM), + COCOA_LOG(CocoaLogBlock::new, ITaggable.create().withVanillaTags(ITaggable.BLOCK, "jungle_logs")), __PALETTES__(), - TILED_GLASS(new TaggedBlock(new GlassBlock(Properties.from(Blocks.GLASS))).withVanillaTags(ITaggable.TagType.BLOCK, "impermeable").withForgeTags("glass")), - FRAMED_GLASS(new CTGlassBlock(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)), + TILED_GLASS(() -> new GlassBlock(Properties.from(Blocks.GLASS)), ITaggable.create().withVanillaTags(ITaggable.BLOCK, "impermeable").withForgeTags("glass")), + FRAMED_GLASS(() -> new CTGlassBlock(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)), - OAK_GLASS(new CTWindowBlock(AllCTs.OAK_GLASS, false)), - SPRUCE_GLASS(new CTWindowBlock(AllCTs.SPRUCE_GLASS, false)), - BIRCH_GLASS(new CTWindowBlock(AllCTs.BIRCH_GLASS, true)), - JUNGLE_GLASS(new CTWindowBlock(AllCTs.JUNGLE_GLASS, false)), - DARK_OAK_GLASS(new CTWindowBlock(AllCTs.DARK_OAK_GLASS, false)), - ACACIA_GLASS(new CTWindowBlock(AllCTs.ACACIA_GLASS, false)), - IRON_GLASS(new CTWindowBlock(AllCTs.IRON_GLASS, false)), + OAK_GLASS(() -> new CTWindowBlock(AllCTs.OAK_GLASS, false)), + SPRUCE_GLASS(() -> new CTWindowBlock(AllCTs.SPRUCE_GLASS, false)), + BIRCH_GLASS(() -> new CTWindowBlock(AllCTs.BIRCH_GLASS, true)), + JUNGLE_GLASS(() -> new CTWindowBlock(AllCTs.JUNGLE_GLASS, false)), + DARK_OAK_GLASS(() -> new CTWindowBlock(AllCTs.DARK_OAK_GLASS, false)), + ACACIA_GLASS(() -> new CTWindowBlock(AllCTs.ACACIA_GLASS, false)), + IRON_GLASS(() -> new CTWindowBlock(AllCTs.IRON_GLASS, false)), - TILED_GLASS_PANE(new TaggedBlock(new GlassPaneBlock(Properties.from(Blocks.GLASS))).withForgeTags("glass_panes")), - FRAMED_GLASS_PANE(new CTGlassPaneBlock(FRAMED_GLASS.get())), - HORIZONTAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(HORIZONTAL_FRAMED_GLASS.get())), - VERTICAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(VERTICAL_FRAMED_GLASS.get())), - OAK_GLASS_PANE(new CTGlassPaneBlock(OAK_GLASS.get())), - SPRUCE_GLASS_PANE(new CTGlassPaneBlock(SPRUCE_GLASS.get())), - BIRCH_GLASS_PANE(new CTGlassPaneBlock(BIRCH_GLASS.get())), - JUNGLE_GLASS_PANE(new CTGlassPaneBlock(JUNGLE_GLASS.get())), - DARK_OAK_GLASS_PANE(new CTGlassPaneBlock(DARK_OAK_GLASS.get())), - ACACIA_GLASS_PANE(new CTGlassPaneBlock(ACACIA_GLASS.get())), - IRON_GLASS_PANE(new CTGlassPaneBlock(IRON_GLASS.get())), + TILED_GLASS_PANE(() -> new GlassPaneBlock(Properties.from(Blocks.GLASS)), ITaggable.create().withForgeTags("glass_panes")), + FRAMED_GLASS_PANE(() -> new CTGlassPaneBlock(FRAMED_GLASS.get())), + HORIZONTAL_FRAMED_GLASS_PANE(() -> new CTGlassPaneBlock(HORIZONTAL_FRAMED_GLASS.get())), + VERTICAL_FRAMED_GLASS_PANE(() -> new CTGlassPaneBlock(VERTICAL_FRAMED_GLASS.get())), + OAK_GLASS_PANE(() -> new CTGlassPaneBlock(OAK_GLASS.get())), + SPRUCE_GLASS_PANE(() -> new CTGlassPaneBlock(SPRUCE_GLASS.get())), + BIRCH_GLASS_PANE(() -> new CTGlassPaneBlock(BIRCH_GLASS.get())), + JUNGLE_GLASS_PANE(() -> new CTGlassPaneBlock(JUNGLE_GLASS.get())), + DARK_OAK_GLASS_PANE(() -> new CTGlassPaneBlock(DARK_OAK_GLASS.get())), + ACACIA_GLASS_PANE(() -> new CTGlassPaneBlock(ACACIA_GLASS.get())), + IRON_GLASS_PANE(() -> new CTGlassPaneBlock(IRON_GLASS.get())), - GRANITE_BRICKS(new Block(Properties.from(Blocks.GRANITE))), - GRANITE_LAYERS(new LayeredCTBlock(Properties.from(Blocks.GRANITE), AllCTs.GRANITE_LAYERS, AllCTs.POLISHED_GRANITE)), - DIORITE_BRICKS(new Block(Properties.from(Blocks.DIORITE))), - DIORITE_LAYERS(new LayeredCTBlock(Properties.from(Blocks.DIORITE), AllCTs.DIORITE_LAYERS, AllCTs.POLISHED_DIORITE)), - ANDESITE_BRICKS(new Block(Properties.from(Blocks.ANDESITE))), - ANDESITE_LAYERS( + GRANITE_BRICKS(() -> new Block(Properties.from(Blocks.GRANITE))), + GRANITE_LAYERS(() -> new LayeredCTBlock(Properties.from(Blocks.GRANITE), AllCTs.GRANITE_LAYERS, AllCTs.POLISHED_GRANITE)), + DIORITE_BRICKS(() -> new Block(Properties.from(Blocks.DIORITE))), + DIORITE_LAYERS(() -> new LayeredCTBlock(Properties.from(Blocks.DIORITE), AllCTs.DIORITE_LAYERS, AllCTs.POLISHED_DIORITE)), + ANDESITE_BRICKS(() -> new Block(Properties.from(Blocks.ANDESITE))), + ANDESITE_LAYERS(() -> 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), - POLISHED_GABBRO(new TaggedBlock(new Block(Properties.from(GABBRO.get()))).withForgeTags("stone")), - GABBRO_BRICKS(new Block(Properties.from(GABBRO.get())), ComesWith.STAIRS, ComesWith.WALL), - PAVED_GABBRO_BRICKS(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()))), - MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get()))), - GABBRO_LAYERS(new LayeredCTBlock(Properties.from(GABBRO.get()), AllCTs.GABBRO_LAYERS, AllCTs.POLISHED_GABBRO)), + GABBRO(() -> new Block(Properties.from(Blocks.GRANITE)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), + POLISHED_GABBRO(() -> new Block(Properties.from(GABBRO.get())), ITaggable.create().withForgeTags("stone")), + GABBRO_BRICKS(() -> new Block(Properties.from(GABBRO.get())), ComesWith.STAIRS, ComesWith.WALL), + PAVED_GABBRO_BRICKS(() -> 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()))), + MOSSY_GABBRO_BRICKS(() -> new Block(Properties.from(GABBRO.get()))), + 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_BRICKS(new Block(Properties.from(DOLOMITE.get()))), - POLISHED_DOLOMITE(new TaggedBlock(new Block(Properties.from(DOLOMITE.get()))).withForgeTags("stone")), - DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.get()))), - DOLOMITE_LAYERS( + 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()))), + POLISHED_DOLOMITE(() -> new Block(Properties.from(DOLOMITE.get())), ITaggable.create().withForgeTags("stone")), + DOLOMITE_PILLAR(() -> new RotatedPillarBlock(Properties.from(DOLOMITE.get()))), + DOLOMITE_LAYERS(() -> new LayeredCTBlock(Properties.from(DOLOMITE.get()), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)), - 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_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), - LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(LIMESTONE.get()))), - LIMESTONE_LAYERS( + LIMESAND(() -> new FallingBlock(Properties.from(Blocks.SAND))), + 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), + POLISHED_LIMESTONE(() -> new Block(Properties.from(LIMESTONE.get())), ITaggable.create().withForgeTags("stone"), ComesWith.SLAB), + LIMESTONE_PILLAR(() -> new RotatedPillarBlock(Properties.from(LIMESTONE.get()))), + LIMESTONE_LAYERS(() -> 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_BRICKS(new Block(Properties.from(WEATHERED_LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB, + 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, ComesWith.WALL), - POLISHED_WEATHERED_LIMESTONE(new TaggedBlock(new Block(Properties.from(WEATHERED_LIMESTONE.get()))).withForgeTags("stone"), ComesWith.SLAB), - WEATHERED_LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(WEATHERED_LIMESTONE.get()))), - WEATHERED_LIMESTONE_LAYERS(new LayeredCTBlock(Properties.from(WEATHERED_LIMESTONE.get()), + 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_LAYERS(() -> new LayeredCTBlock(Properties.from(WEATHERED_LIMESTONE.get()), AllCTs.WEATHERED_LIMESTONE_LAYERS, AllCTs.POLISHED_WEATHERED_LIMESTONE)), - NATURAL_SCORIA(new ScoriaBlock()), - SCORIA(new TaggedBlock(new Block(Properties.from(Blocks.ANDESITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), - POLISHED_SCORIA(new TaggedBlock(new Block(Properties.from(SCORIA.get()))).withForgeTags("stone"), ComesWith.SLAB), - SCORIA_BRICKS(new Block(Properties.from(SCORIA.get()))), - SCORIA_LAYERS(new LayeredCTBlock(Properties.from(SCORIA.get()), AllCTs.SCORIA_LAYERS, AllCTs.POLISHED_SCORIA)), - SCORIA_PILLAR(new RotatedPillarBlock(Properties.from(SCORIA.get()))), + NATURAL_SCORIA(ScoriaBlock::new), + SCORIA(() -> new Block(Properties.from(Blocks.ANDESITE)), ITaggable.create().withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), + POLISHED_SCORIA(() -> new Block(Properties.from(SCORIA.get())), ITaggable.create().withForgeTags("stone"), ComesWith.SLAB), + SCORIA_BRICKS(() -> new Block(Properties.from(SCORIA.get()))), + SCORIA_LAYERS(() -> new LayeredCTBlock(Properties.from(SCORIA.get()), AllCTs.SCORIA_LAYERS, AllCTs.POLISHED_SCORIA)), + SCORIA_PILLAR(() -> new RotatedPillarBlock(Properties.from(SCORIA.get()))), - DARK_SCORIA(new Block(Properties.from(Blocks.ANDESITE))), - 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_BRICKS(new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), + DARK_SCORIA(() -> new Block(Properties.from(Blocks.ANDESITE))), + 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_BRICKS(() -> new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), __MATERIALS__(), - COPPER_ORE(new TaggedBlock(new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1)).withForgeTags("ores/copper")), - ZINC_ORE(new TaggedBlock(new Block(Properties.from(Blocks.GOLD_ORE).harvestLevel(2).harvestTool(ToolType.PICKAXE))).withForgeTags("ores/zinc")), - COPPER_BLOCK(new TaggedBlock(new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)).withForgeTags("storage_blocks/copper")), - 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")), - BRASS_BLOCK(new TaggedBlock(new Block(Properties.from(Blocks.IRON_BLOCK))).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")), ; - + private enum ComesWith { - WALL, FENCE, FENCE_GATE, SLAB, STAIRS + NO_BLOCKITEM, WALL, FENCE, FENCE_GATE, SLAB, STAIRS } private static class CategoryTracker { static IModule currentModule; } - private TaggedBlock taggedBlock; - public TaggedBlock[] alsoRegistered; - public IModule module; + public final RegistryEntry block; + public final ImmutableList> alsoRegistered; + public final IModule module; AllBlocks() { CategoryTracker.currentModule = () -> Lang.asId(name()).replaceAll("__", ""); - taggedBlock = new TaggedBlock(null); - } - - 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.block = null; + this.alsoRegistered = ImmutableList.of(); 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 event) { - IForgeRegistry registry = event.getRegistry(); + AllBlocks(NonNullSupplier block, ComesWith... comesWith) { + this(block, ITaggable.create(), comesWith); + } + + AllBlocks(NonNullSupplier block, NonNullBiFunction customItemCreator, ComesWith... comesWith) { + this(block, customItemCreator, ITaggable.create(), comesWith); + } - for (AllBlocks block : values()) { - if (block.get() == null) - continue; + AllBlocks(NonNullSupplier block, ITaggable tags, ComesWith... comesWith) { + this(block, null, tags, comesWith); + } - registry.register(block.get()); - for (TaggedBlock extra : block.alsoRegistered) - registry.register(extra.block); + AllBlocks(NonNullSupplier block, NonNullBiFunction customItemCreator, ITaggable tags, ComesWith... comesWith){ + this.module = CategoryTracker.currentModule; + + 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> 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 registry) { - 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); - } + public static void register() { } - private static void registerAsItem(IForgeRegistry registry, Block blockIn) { - BlockItem blockItem; - Item.Properties standardItemProperties = AllItems.includeInItemGroup(); - - if (blockIn instanceof IHaveCustomBlockItem) - blockItem = ((IHaveCustomBlockItem) blockIn).getCustomItem(standardItemProperties); - else - blockItem = new BlockItem(blockIn, standardItemProperties); - - registry.register(blockItem.setRegistryName(blockIn.getRegistryName())); + public BlockBuilder registerItemBlock(BlockBuilder builder, NonNullBiFunction customItemCreator, ComesWith... comesWith) { + if (ArrayUtils.contains(comesWith, ComesWith.NO_BLOCKITEM)) { + return builder; + } + return registerAsItem(builder, customItemCreator); } - public Block get() { - return taggedBlock.getBlock(); + private BlockBuilder registerAsItem(BlockBuilder builder, NonNullBiFunction customItemCreator) { + ItemBuilder> itemBuilder = customItemCreator == null ? builder.item() : builder.item(customItemCreator); + return itemBuilder.properties($ -> AllItems.includeInItemGroup()).build(); } - public ITaggable getTaggable() { - return taggedBlock; + @Override + public @Nonnull Block get() { + return block == null ? Blocks.AIR : block.get(); } public BlockState getDefault() { @@ -381,32 +378,46 @@ public enum AllBlocks { return state.getBlock() == get(); } - private TaggedBlock makeRelatedBlock(Block block, ComesWith feature) { - Properties properties = Properties.from(block); - TaggedBlock featured; + private RegistryEntry makeRelatedBlock(RegistryEntry block, ComesWith feature) { + NonNullFunction creator; + final Tag tag; switch (feature) { case FENCE: - featured = new TaggedBlock(new FenceBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "fences"); + creator = FenceBlock::new; + tag = BlockTags.FENCES; break; case SLAB: - featured = new TaggedBlock(new SlabBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "slabs"); + creator = SlabBlock::new; + tag = BlockTags.SLABS; break; case STAIRS: - featured = new TaggedBlock(new ProperStairsBlock(block)).withVanillaTags(ITaggable.TagType.BLOCK, "stairs"); + creator = p -> new ProperStairsBlock(block.get()); + tag = BlockTags.STAIRS; break; case WALL: - featured = new TaggedBlock(new WallBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "walls"); + creator = WallBlock::new; + tag = BlockTags.WALLS; break; case FENCE_GATE: - featured = new TaggedBlock(new FenceGateBlock(properties)); + creator = FenceGateBlock::new; + tag = null; break; default: - return null; + throw new IllegalArgumentException("Unknown ComesWith type?"); } - featured.block.setRegistryName(Create.ID, block.getRegistryName().getPath() + "_" + Lang.asId(feature.name())); - return featured; + return Create.registrate().block(block.getId().getPath() + "_" + Lang.asId(feature.name()), creator) + .simpleItem() + .transform(b -> tag != null ? b.tag(tag) : b) + .register(); + } + + private NonNullUnaryOperator> applyTags(ITaggable tags) { + return b -> { + tags.getDataTags(ITaggable.BLOCK).forEach(b::tag); + return b; + }; } @OnlyIn(Dist.CLIENT) @@ -418,25 +429,4 @@ public enum AllBlocks { } } } - - public static class TaggedBlock implements ITaggable { - //A wrapper around Block that allows for tags to be included. needed for datagen - - private Set tagSetBlock = new HashSet<>(); - private Set tagSetBlockItem = new HashSet<>(); - private Block block; - - public TaggedBlock(Block blockIn){ - block = blockIn; - } - - public Block getBlock() { - return block; - } - - @Override - public Set getTagSet(TagType type) { - return type == TagType.BLOCK ? tagSetBlock : tagSetBlockItem; - } - } } diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 268453faa..ca350f96d 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -201,8 +201,6 @@ public enum AllItems { entry.item.setRegistryName(Create.ID, Lang.asId(entry.name())); registry.register(entry.item); } - - AllBlocks.registerItemBlocks(registry); } public Item get() { diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 45518f05a..cf6b44482 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -12,6 +12,8 @@ import com.simibubi.create.modules.ModuleLoadedCondition; import com.simibubi.create.modules.contraptions.TorquePropagator; import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler; 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.entity.EntityType; @@ -43,6 +45,7 @@ public class Create { public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler; public static TorquePropagator torquePropagator; public static ServerLagger lagger; + private static final LazyValue registrate = new LazyValue<>(() -> Registrate.create(ID)); public Create() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); @@ -50,7 +53,8 @@ public class Create { 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(IRecipeSerializer.class, AllRecipes::register); modEventBus.addGenericListener(TileEntityType.class, AllTileEntities::register); @@ -59,14 +63,14 @@ public class Create { modEventBus.addGenericListener(ParticleType.class, AllParticles::register); modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register); - AllConfigs.registerAll(); modEventBus.addListener(AllConfigs::onLoad); modEventBus.addListener(AllConfigs::onReload); CreateClient.addListeners(modEventBus); - AllWorldFeatures.reload(); } public static void init(final FMLCommonSetupEvent event) { + AllConfigs.registerAll(); + schematicReceiver = new ServerSchematicLoader(); redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler(); torquePropagator = new TorquePropagator(); @@ -75,6 +79,8 @@ public class Create { CraftingHelper.register(new ModuleLoadedCondition.Serializer()); AllPackets.registerPackets(); AllTriggers.register(); + + AllWorldFeatures.reload(); } public static void serverStarting(FMLServerStartingEvent event) { @@ -93,4 +99,7 @@ public class Create { schematicReceiver.shutdown(); } + public static Registrate registrate() { + return registrate.get(); + } } diff --git a/src/main/java/com/simibubi/create/CreateItemGroup.java b/src/main/java/com/simibubi/create/CreateItemGroup.java index 5fd92d08c..9102040bc 100644 --- a/src/main/java/com/simibubi/create/CreateItemGroup.java +++ b/src/main/java/com/simibubi/create/CreateItemGroup.java @@ -1,14 +1,16 @@ package com.simibubi.create; -import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.item.IAddedByOther; +import com.tterrag.registrate.util.RegistryEntry; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.util.NonNullList; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -40,14 +42,15 @@ public final class CreateItemGroup extends ItemGroup { continue; if (!block.module.isEnabled()) continue; - if (def instanceof IHaveNoBlockItem && !((IHaveNoBlockItem) def).hasBlockItem()) - continue; if (def instanceof IAddedByOther) continue; - def.asItem().fillItemGroup(this, items); - for (AllBlocks.TaggedBlock alsoRegistered : block.alsoRegistered) - alsoRegistered.getBlock().asItem().fillItemGroup(this, items); + Item item = def.asItem(); + if (item != Items.AIR) { + item.fillItemGroup(this, items); + for (RegistryEntry alsoRegistered : block.alsoRegistered) + alsoRegistered.get().asItem().fillItemGroup(this, items); + } } } diff --git a/src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockItem.java b/src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockItem.java deleted file mode 100644 index 857fb50c6..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockItem.java +++ /dev/null @@ -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); - -} diff --git a/src/main/java/com/simibubi/create/foundation/block/IHaveNoBlockItem.java b/src/main/java/com/simibubi/create/foundation/block/IHaveNoBlockItem.java deleted file mode 100644 index 3bb4bae20..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/IHaveNoBlockItem.java +++ /dev/null @@ -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; - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/block/IRenderUtilityBlock.java b/src/main/java/com/simibubi/create/foundation/block/IRenderUtilityBlock.java index 8cf942db3..9757cd295 100644 --- a/src/main/java/com/simibubi/create/foundation/block/IRenderUtilityBlock.java +++ b/src/main/java/com/simibubi/create/foundation/block/IRenderUtilityBlock.java @@ -3,6 +3,6 @@ package com.simibubi.create.foundation.block; /** * Blocks only registered for use in other blocks' renderers. */ -public interface IRenderUtilityBlock extends IHaveNoBlockItem { +public interface IRenderUtilityBlock { } diff --git a/src/main/java/com/simibubi/create/foundation/utility/data/ITaggable.java b/src/main/java/com/simibubi/create/foundation/utility/data/ITaggable.java index 37c3ca525..c0152d212 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/data/ITaggable.java +++ b/src/main/java/com/simibubi/create/foundation/utility/data/ITaggable.java @@ -2,22 +2,50 @@ package com.simibubi.create.foundation.utility.data; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; 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; public interface ITaggable> { + + interface TagType { + + TagCollection getCollection(); + } - enum TagType { - BLOCK, ITEM - } + class Impl implements ITaggable { + + private Map, Set> tags = new HashMap<>(); + + @Override + public Set getTagSet(TagType type) { + return tags.computeIfAbsent(type, $ -> new HashSet<>()); + } + } + + static ITaggable create() { + return new Impl(); + } + + static TagType BLOCK = BlockTags::getCollection; + static TagType ITEM = ItemTags::getCollection; 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") - default T withTags(TagType type, ResourceLocation... tagsIn) { + default T withTags(TagType type, ResourceLocation... tagsIn) { Collections.addAll(getTagSet(type), tagsIn); return (T) this; } @@ -26,7 +54,7 @@ public interface ITaggable> { 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)); } @@ -42,10 +70,14 @@ public interface ITaggable> { return withTagsInNamespace("minecraft", tagsIn); } - default T withVanillaTags(TagType type, String... tagsIn) { + default T withVanillaTags(TagType type, String... tagsIn) { return withTagsInNamespace(type, "minecraft", tagsIn); } //take a look at AllBlocks.TaggedBlock for more info - Set getTagSet(TagType type); + Set getTagSet(TagType type); + + default Set> getDataTags(TagType type) { + return getTagSet(type).stream().map(type.getCollection()::getOrCreate).collect(Collectors.toSet()); + } } diff --git a/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java b/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java index d0de6732c..1adff8170 100644 --- a/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java +++ b/src/main/java/com/simibubi/create/foundation/world/AllWorldFeatures.java @@ -19,17 +19,17 @@ import net.minecraftforge.registries.ForgeRegistries; public enum AllWorldFeatures { - COPPER_ORE(new CountedOreFeature(AllBlocks.COPPER_ORE.get(), 18, 2).between(40, 86)), - COPPER_ORE_OCEAN(new CountedOreFeature(AllBlocks.COPPER_ORE.get(), 15, 4).between(20, 55).inBiomes(OCEAN)), + COPPER_ORE(new CountedOreFeature(AllBlocks.COPPER_ORE, 18, 2).between(40, 86)), + 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_DESERT(new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 17, 5).between(10, 85).inBiomes(DESERT)), + ZINC_ORE(new CountedOreFeature(AllBlocks.ZINC_ORE, 14, 4).between(15, 70)), + 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)), - WEATHERED_LIMESTONE(new ChanceOreFeature(AllBlocks.WEATHERED_LIMESTONE.get(), 128, 1 / 32f).between(10, 30)), - DOLOMITE(new ChanceOreFeature(AllBlocks.DOLOMITE.get(), 128, 1 / 64f).between(20, 70)), - GABBRO(new ChanceOreFeature(AllBlocks.GABBRO.get(), 128, 1 / 64f).between(20, 70)), - SCORIA(new ChanceOreFeature(AllBlocks.NATURAL_SCORIA.get(), 128, 1 / 32f).between(0, 10)), + LIMESTONE(new ChanceOreFeature(AllBlocks.LIMESTONE, 128, 1 / 32f).between(30, 70)), + WEATHERED_LIMESTONE(new ChanceOreFeature(AllBlocks.WEATHERED_LIMESTONE, 128, 1 / 32f).between(10, 30)), + DOLOMITE(new ChanceOreFeature(AllBlocks.DOLOMITE, 128, 1 / 64f).between(20, 70)), + GABBRO(new ChanceOreFeature(AllBlocks.GABBRO, 128, 1 / 64f).between(20, 70)), + SCORIA(new ChanceOreFeature(AllBlocks.NATURAL_SCORIA, 128, 1 / 32f).between(0, 10)), ; diff --git a/src/main/java/com/simibubi/create/foundation/world/ChanceOreFeature.java b/src/main/java/com/simibubi/create/foundation/world/ChanceOreFeature.java index 67ccdc995..d8bfb74dc 100644 --- a/src/main/java/com/simibubi/create/foundation/world/ChanceOreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/world/ChanceOreFeature.java @@ -2,6 +2,8 @@ package com.simibubi.create.foundation.world; import org.apache.commons.lang3.tuple.Pair; +import com.tterrag.registrate.util.nullness.NonNullSupplier; + import net.minecraft.block.Block; import net.minecraft.world.gen.placement.ChanceRangeConfig; import net.minecraft.world.gen.placement.Placement; @@ -10,7 +12,7 @@ public class ChanceOreFeature extends OreFeature { private ConfigFloat clusterChance; - public ChanceOreFeature(Block block, int clusterSize, float clusterChance) { + public ChanceOreFeature(NonNullSupplier block, int clusterSize, float clusterChance) { super(block, clusterSize); this.clusterChance = f(clusterChance, 0, 1, "clusterChance"); } diff --git a/src/main/java/com/simibubi/create/foundation/world/CountedOreFeature.java b/src/main/java/com/simibubi/create/foundation/world/CountedOreFeature.java index de069f8d0..609bc0af0 100644 --- a/src/main/java/com/simibubi/create/foundation/world/CountedOreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/world/CountedOreFeature.java @@ -2,6 +2,8 @@ package com.simibubi.create.foundation.world; import org.apache.commons.lang3.tuple.Pair; +import com.tterrag.registrate.util.nullness.NonNullSupplier; + import net.minecraft.block.Block; import net.minecraft.world.gen.placement.CountRangeConfig; import net.minecraft.world.gen.placement.Placement; @@ -10,7 +12,7 @@ public class CountedOreFeature extends OreFeature { private ConfigInt clusterCount; - public CountedOreFeature(Block block, int clusterSize, int clusterCount) { + public CountedOreFeature(NonNullSupplier block, int clusterSize, int clusterCount) { super(block, clusterSize); this.clusterCount = i(clusterCount, 0, "clusterCount"); } diff --git a/src/main/java/com/simibubi/create/foundation/world/OreFeature.java b/src/main/java/com/simibubi/create/foundation/world/OreFeature.java index ee881a034..6150b6a81 100644 --- a/src/main/java/com/simibubi/create/foundation/world/OreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/world/OreFeature.java @@ -1,11 +1,15 @@ package com.simibubi.create.foundation.world; import java.util.Optional; +import java.util.function.Supplier; + +import javax.annotation.Nonnull; import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.ConfigBase; +import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.block.Block; import net.minecraft.world.biome.Biome; @@ -27,10 +31,10 @@ public abstract class OreFeature extends ConfigBase protected ConfigInt minHeight; protected ConfigInt maxHeight; - private Block block; + private NonNullSupplier block; private Biome.Category specificCategory; - public OreFeature(Block block, int clusterSize) { + public OreFeature(NonNullSupplier block, int clusterSize) { this.block = block; this.enable = b(true, "enable", "Whether to spawn this in your World"); this.clusterSize = i(clusterSize, 0, "clusterSize"); @@ -65,7 +69,7 @@ public abstract class OreFeature extends ConfigBase Pair, T> placement = getPlacement(); 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())); return Optional.of(createdFeature); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonHeadBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonHeadBlock.java index fdeb87f99..ec2403e4b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonHeadBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonHeadBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.components.contraptions.piston; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.utility.AllShapes; 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.World; -public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements IHaveNoBlockItem { +public class MechanicalPistonHeadBlock extends ProperDirectionalBlock { public static final EnumProperty TYPE = BlockStateProperties.PISTON_TYPE; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/pulley/PulleyBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/pulley/PulleyBlock.java index 46f0906b8..8b0fa38e2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/pulley/PulleyBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/pulley/PulleyBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.components.contraptions.pulley; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.modules.contraptions.base.HorizontalAxisKineticBlock; @@ -70,7 +69,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE { + implements ITE { public static final BooleanProperty VALID = BooleanProperty.create("valid"); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/BasinOperatorBlockItem.java b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/BasinOperatorBlockItem.java index e210d7597..49cff787a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/BasinOperatorBlockItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/BasinOperatorBlockItem.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.components.mixer; import com.simibubi.create.AllBlocks; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; @@ -11,8 +12,8 @@ import net.minecraft.util.math.BlockPos; public class BasinOperatorBlockItem extends BlockItem { - public BasinOperatorBlockItem(AllBlocks block, Properties builder) { - super(block.get(), builder); + public BasinOperatorBlockItem(Block block, Properties builder) { + super(block, builder); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerBlock.java index 54f1ca97c..80bbb17fb 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.components.mixer; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.IHaveCustomBlockItem; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.AllShapes; 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.Blocks; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItem; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; @@ -20,7 +18,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; public class MechanicalMixerBlock extends KineticBlock - implements ITE, IHaveCustomBlockItem { + implements ITE { public MechanicalMixerBlock() { super(Properties.from(Blocks.ANDESITE)); @@ -84,11 +82,6 @@ public class MechanicalMixerBlock extends KineticBlock return SpeedLevel.MEDIUM; } - @Override - public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) { - return new BasinOperatorBlockItem(AllBlocks.MECHANICAL_MIXER, properties); - } - @Override public Class getTileEntityClass() { return MechanicalMixerTileEntity.class; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressBlock.java index 961c6535e..33a2dac6e 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressBlock.java @@ -5,12 +5,10 @@ import java.util.List; import java.util.Optional; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.IHaveCustomBlockItem; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.AllShapes; 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.relays.belt.AllBeltAttachments.BeltAttachmentState; 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.Blocks; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -38,7 +35,7 @@ import net.minecraft.world.IWorldReader; import net.minecraft.world.World; public class MechanicalPressBlock extends HorizontalKineticBlock - implements ITE, IBeltAttachment, IHaveCustomBlockItem { + implements ITE, IBeltAttachment { public MechanicalPressBlock() { super(Properties.from(Blocks.PISTON)); @@ -190,11 +187,6 @@ public class MechanicalPressBlock extends HorizontalKineticBlock return false; } - @Override - public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) { - return new BasinOperatorBlockItem(AllBlocks.MECHANICAL_PRESS, properties); - } - @Override public Class getTileEntityClass() { return MechanicalPressTileEntity.class; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java index 3d28578be..e64f8317b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java @@ -9,7 +9,6 @@ import org.apache.commons.lang3.mutable.MutableInt; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; 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.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; @@ -62,7 +61,7 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class BeltBlock extends HorizontalKineticBlock - implements IHaveNoBlockItem, ITE, IHaveColorHandler { + implements ITE, IHaveColorHandler { public static final IProperty SLOPE = EnumProperty.create("slope", Slope.class); public static final IProperty PART = EnumProperty.create("part", Part.class); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogWheelBlock.java index 34edfe075..646af6a35 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogWheelBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.relays.elementary; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.IHaveCustomBlockItem; import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.modules.contraptions.base.IRotate; 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.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; @@ -23,7 +21,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class CogWheelBlock extends ShaftBlock implements IHaveCustomBlockItem { +public class CogWheelBlock extends ShaftBlock { private boolean isLarge; @@ -94,10 +92,4 @@ public class CogWheelBlock extends ShaftBlock implements IHaveCustomBlockItem { public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { return !isLarge; } - - @Override - public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) { - return new CogwheelBlockItem(this, properties, isLarge); - } - } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java index c22c599a2..38bf8bb32 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java @@ -5,7 +5,6 @@ import java.util.Collections; import java.util.List; import com.simibubi.create.foundation.block.IHaveCustomBlockModel; -import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.ITE; import net.minecraft.block.Block; @@ -46,7 +45,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class WindowInABlockBlock extends PaneBlock - implements ITE, IHaveNoBlockItem, IHaveCustomBlockModel { + implements ITE, IHaveCustomBlockModel { public WindowInABlockBlock() { super(Properties.create(Material.ROCK)); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java index a15cacd5d..4974a6270 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.logistics.block; 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.logistics.block.transposer.TransposerBlock; @@ -23,7 +22,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; 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"); @@ -31,11 +30,6 @@ public abstract class AttachedLogisticalBlock extends HorizontalBlock implements super(Properties.from(Blocks.ANDESITE)); } - @Override - public boolean hasBlockItem() { - return !isVertical(); - } - protected abstract boolean isVertical(); protected abstract BlockState getVerticalDefaultState();