mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-24 14:06:42 +01:00
Add registrate as dependency, experimental refactor of AllBlocks
This commit is contained in:
parent
ed19a65b9f
commit
2cccbca11b
24 changed files with 353 additions and 348 deletions
22
build.gradle
22
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
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||
|
|
|
@ -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<Block> {
|
||||
|
||||
__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<? extends Block> block;
|
||||
public final ImmutableList<RegistryEntry<? extends Block>> alsoRegistered;
|
||||
public final IModule module;
|
||||
|
||||
AllBlocks() {
|
||||
CategoryTracker.currentModule = () -> Lang.asId(name()).replaceAll("__", "");
|
||||
taggedBlock = new TaggedBlock(null);
|
||||
this.block = null;
|
||||
this.alsoRegistered = ImmutableList.of();
|
||||
this.module = CategoryTracker.currentModule;
|
||||
}
|
||||
|
||||
AllBlocks(Block block, ComesWith... comesWith) {
|
||||
this(new TaggedBlock(block), comesWith);
|
||||
AllBlocks(NonNullSupplier<? extends Block> block, ComesWith... comesWith) {
|
||||
this(block, ITaggable.create(), comesWith);
|
||||
}
|
||||
|
||||
AllBlocks(TaggedBlock taggedBlockIn, ComesWith... comesWith){
|
||||
this.taggedBlock = taggedBlockIn;
|
||||
this.taggedBlock.getBlock().setRegistryName(Create.ID, Lang.asId(name()));
|
||||
AllBlocks(NonNullSupplier<? extends Block> block, NonNullBiFunction<? super Block, Item.Properties, ? extends BlockItem> customItemCreator, ComesWith... comesWith) {
|
||||
this(block, customItemCreator, ITaggable.create(), comesWith);
|
||||
}
|
||||
|
||||
AllBlocks(NonNullSupplier<? extends Block> block, ITaggable<?> tags, ComesWith... comesWith) {
|
||||
this(block, null, tags, comesWith);
|
||||
}
|
||||
|
||||
AllBlocks(NonNullSupplier<? extends Block> block, NonNullBiFunction<? super Block, Item.Properties, ? extends BlockItem> customItemCreator, ITaggable<?> tags, ComesWith... comesWith){
|
||||
this.module = CategoryTracker.currentModule;
|
||||
|
||||
alsoRegistered = new TaggedBlock[comesWith.length];
|
||||
for (int i = 0; i < comesWith.length; i++)
|
||||
alsoRegistered[i] = makeRelatedBlock(taggedBlock.getBlock(), comesWith[i]);
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
public static void register(RegistryEvent.Register<Block> event) {
|
||||
IForgeRegistry<Block> registry = event.getRegistry();
|
||||
|
||||
for (AllBlocks block : values()) {
|
||||
if (block.get() == null)
|
||||
continue;
|
||||
|
||||
registry.register(block.get());
|
||||
for (TaggedBlock extra : block.alsoRegistered)
|
||||
registry.register(extra.block);
|
||||
ImmutableList.Builder<RegistryEntry<? extends Block>> alsoRegistered = ImmutableList.builder();
|
||||
for (ComesWith with : comesWith) {
|
||||
if (with != ComesWith.NO_BLOCKITEM) {
|
||||
alsoRegistered.add(makeRelatedBlock(this.block, with));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerItemBlocks(IForgeRegistry<Item> 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);
|
||||
}
|
||||
this.alsoRegistered = alsoRegistered.build();
|
||||
}
|
||||
|
||||
private static void registerAsItem(IForgeRegistry<Item> 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 static void register() {
|
||||
}
|
||||
|
||||
public Block get() {
|
||||
return taggedBlock.getBlock();
|
||||
public <B extends Block, P> BlockBuilder<B, P> registerItemBlock(BlockBuilder<B, P> builder, NonNullBiFunction<? super B, Item.Properties, ? extends BlockItem> customItemCreator, ComesWith... comesWith) {
|
||||
if (ArrayUtils.contains(comesWith, ComesWith.NO_BLOCKITEM)) {
|
||||
return builder;
|
||||
}
|
||||
return registerAsItem(builder, customItemCreator);
|
||||
}
|
||||
|
||||
public ITaggable<?> getTaggable() {
|
||||
return taggedBlock;
|
||||
private <B extends Block, P> BlockBuilder<B, P> registerAsItem(BlockBuilder<B, P> builder, NonNullBiFunction<? super B, Item.Properties, ? extends BlockItem> customItemCreator) {
|
||||
ItemBuilder<? extends BlockItem, BlockBuilder<B, P>> itemBuilder = customItemCreator == null ? builder.item() : builder.item(customItemCreator);
|
||||
return itemBuilder.properties($ -> AllItems.includeInItemGroup()).build();
|
||||
}
|
||||
|
||||
@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<? extends Block> makeRelatedBlock(RegistryEntry<? extends Block> block, ComesWith feature) {
|
||||
NonNullFunction<Block.Properties, ? extends Block> creator;
|
||||
final Tag<Block> 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 <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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<? extends Block> alsoRegistered : block.alsoRegistered)
|
||||
alsoRegistered.get().asItem().fillItemGroup(this, items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
||||
}
|
||||
|
|
|
@ -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<T extends ITaggable<T>> {
|
||||
|
||||
enum TagType {
|
||||
BLOCK, ITEM
|
||||
interface TagType<T> {
|
||||
|
||||
TagCollection<T> getCollection();
|
||||
}
|
||||
|
||||
class Impl implements ITaggable<Impl> {
|
||||
|
||||
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) {
|
||||
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<T extends ITaggable<T>> {
|
|||
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<T extends ITaggable<T>> {
|
|||
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<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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)),
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -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<ChanceRangeConfig> {
|
|||
|
||||
private ConfigFloat clusterChance;
|
||||
|
||||
public ChanceOreFeature(Block block, int clusterSize, float clusterChance) {
|
||||
public ChanceOreFeature(NonNullSupplier<Block> block, int clusterSize, float clusterChance) {
|
||||
super(block, clusterSize);
|
||||
this.clusterChance = f(clusterChance, 0, 1, "clusterChance");
|
||||
}
|
||||
|
|
|
@ -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<CountRangeConfig> {
|
|||
|
||||
private ConfigInt clusterCount;
|
||||
|
||||
public CountedOreFeature(Block block, int clusterSize, int clusterCount) {
|
||||
public CountedOreFeature(NonNullSupplier<Block> block, int clusterSize, int clusterCount) {
|
||||
super(block, clusterSize);
|
||||
this.clusterCount = i(clusterCount, 0, "clusterCount");
|
||||
}
|
||||
|
|
|
@ -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<T extends IPlacementConfig> extends ConfigBase
|
|||
protected ConfigInt minHeight;
|
||||
protected ConfigInt maxHeight;
|
||||
|
||||
private Block block;
|
||||
private NonNullSupplier<Block> block;
|
||||
private Biome.Category specificCategory;
|
||||
|
||||
public OreFeature(Block block, int clusterSize) {
|
||||
public OreFeature(NonNullSupplier<Block> 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<T extends IPlacementConfig> extends ConfigBase
|
|||
|
||||
Pair<Placement<T>, 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);
|
||||
|
|
|
@ -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<PistonType> TYPE = BlockStateProperties.PISTON_TYPE;
|
||||
|
||||
|
|
|
@ -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<Pulle
|
|||
pulley.sendData();
|
||||
}
|
||||
|
||||
private static class RopeBlockBase extends Block implements IHaveNoBlockItem {
|
||||
private static class RopeBlockBase extends Block {
|
||||
|
||||
public RopeBlockBase(Properties properties) {
|
||||
super(properties);
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.components.crusher;
|
|||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
|
@ -35,7 +34,7 @@ import net.minecraft.world.IWorld;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public class CrushingWheelControllerBlock extends Block
|
||||
implements IHaveNoBlockItem, ITE<CrushingWheelControllerTileEntity> {
|
||||
implements ITE<CrushingWheelControllerTileEntity> {
|
||||
|
||||
public static final BooleanProperty VALID = BooleanProperty.create("valid");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<MechanicalMixerTileEntity>, IHaveCustomBlockItem {
|
||||
implements ITE<MechanicalMixerTileEntity> {
|
||||
|
||||
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<MechanicalMixerTileEntity> getTileEntityClass() {
|
||||
return MechanicalMixerTileEntity.class;
|
||||
|
|
|
@ -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<MechanicalPressTileEntity>, IBeltAttachment, IHaveCustomBlockItem {
|
||||
implements ITE<MechanicalPressTileEntity>, 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<MechanicalPressTileEntity> getTileEntityClass() {
|
||||
return MechanicalPressTileEntity.class;
|
||||
|
|
|
@ -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<BeltTileEntity>, IHaveColorHandler {
|
||||
implements ITE<BeltTileEntity>, IHaveColorHandler {
|
||||
|
||||
public static final IProperty<Slope> SLOPE = EnumProperty.create("slope", Slope.class);
|
||||
public static final IProperty<Part> PART = EnumProperty.create("part", Part.class);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel {
|
||||
implements ITE<WindowInABlockTileEntity>, IHaveCustomBlockModel {
|
||||
|
||||
public WindowInABlockBlock() {
|
||||
super(Properties.create(Material.ROCK));
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue