Fourth state of matter

- Fix some blocks incorrectly being not solid
- Slightly clean up creative mode tab item collection and related code
This commit is contained in:
PepperCode1 2023-09-09 10:11:05 -07:00
parent 9a70cfff41
commit 6ea0776854
6 changed files with 186 additions and 207 deletions

View file

@ -310,8 +310,10 @@ import net.minecraftforge.common.Tags;
import net.minecraftforge.common.util.ForgeSoundType;
public class AllBlocks {
static { REGISTRATE.useCreativeTab(AllCreativeModeTabs.MAIN_TAB); }
static {
REGISTRATE.setCreativeTab(AllCreativeModeTabs.BASE_CREATIVE_TAB);
}
// Schematics
@ -339,7 +341,7 @@ public class AllBlocks {
public static final BlockEntry<SchematicTableBlock> SCHEMATIC_TABLE =
REGISTRATE.block("schematic_table", SchematicTableBlock::new)
.initialProperties(() -> Blocks.LECTERN)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.mapColor(MapColor.PODZOL).forceSolidOn())
.transform(axeOrPickaxe())
.blockstate((ctx, prov) -> prov.horizontalBlock(ctx.getEntry(), prov.models()
.getExistingFile(ctx.getId()), 0))
@ -350,7 +352,7 @@ public class AllBlocks {
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.METAL))
.properties(p -> p.mapColor(MapColor.METAL).forceSolidOn())
.transform(BlockStressDefaults.setNoImpact())
.transform(pickaxeOnly())
.blockstate(BlockStateGen.axisBlockProvider(false))
@ -360,8 +362,7 @@ public class AllBlocks {
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small)
.initialProperties(SharedProperties::stone)
.properties(p -> p.sound(SoundType.WOOD))
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(p -> p.sound(SoundType.WOOD).mapColor(MapColor.DIRT))
.transform(BlockStressDefaults.setNoImpact())
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.axisBlockProvider(false))
@ -373,8 +374,7 @@ public class AllBlocks {
public static final BlockEntry<CogWheelBlock> LARGE_COGWHEEL =
REGISTRATE.block("large_cogwheel", CogWheelBlock::large)
.initialProperties(SharedProperties::stone)
.properties(p -> p.sound(SoundType.WOOD))
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(p -> p.sound(SoundType.WOOD).mapColor(MapColor.DIRT))
.transform(axeOrPickaxe())
.transform(BlockStressDefaults.setNoImpact())
.blockstate(BlockStateGen.axisBlockProvider(false))
@ -440,8 +440,7 @@ public class AllBlocks {
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
.initialProperties(SharedProperties::stone)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.noOcclusion().mapColor(MapColor.PODZOL))
.transform(BlockStressDefaults.setNoImpact())
.transform(axeOrPickaxe())
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING)))
@ -454,8 +453,7 @@ public class AllBlocks {
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
.initialProperties(SharedProperties::stone)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.noOcclusion().mapColor(MapColor.PODZOL))
.addLayer(() -> RenderType::cutoutMipped)
.transform(BlockStressDefaults.setNoImpact())
.transform(axeOrPickaxe())
@ -466,8 +464,7 @@ public class AllBlocks {
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
.initialProperties(SharedProperties::stone)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.noOcclusion().mapColor(MapColor.PODZOL))
.addLayer(() -> RenderType::cutoutMipped)
.transform(BlockStressDefaults.setNoImpact())
.transform(axeOrPickaxe())
@ -479,8 +476,7 @@ public class AllBlocks {
public static final BlockEntry<ChainDriveBlock> ENCASED_CHAIN_DRIVE =
REGISTRATE.block("encased_chain_drive", ChainDriveBlock::new)
.initialProperties(SharedProperties::stone)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.noOcclusion().mapColor(MapColor.PODZOL))
.transform(BlockStressDefaults.setNoImpact())
.transform(axeOrPickaxe())
.blockstate((c, p) -> new ChainDriveGenerator((state, suffix) -> p.models()
@ -492,8 +488,7 @@ public class AllBlocks {
public static final BlockEntry<ChainGearshiftBlock> ADJUSTABLE_CHAIN_GEARSHIFT =
REGISTRATE.block("adjustable_chain_gearshift", ChainGearshiftBlock::new)
.initialProperties(SharedProperties::stone)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.mapColor(MapColor.NETHER))
.properties(p -> p.noOcclusion().mapColor(MapColor.NETHER))
.transform(BlockStressDefaults.setNoImpact())
.transform(axeOrPickaxe())
.blockstate((c, p) -> new ChainDriveGenerator((state, suffix) -> {
@ -524,7 +519,7 @@ public class AllBlocks {
public static final BlockEntry<CreativeMotorBlock> CREATIVE_MOTOR =
REGISTRATE.block("creative_motor", CreativeMotorBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.COLOR_PURPLE))
.properties(p -> p.mapColor(MapColor.COLOR_PURPLE).forceSolidOn())
.tag(AllBlockTags.SAFE_NBT.tag)
.transform(pickaxeOnly())
.blockstate(new CreativeMotorGenerator()::generate)
@ -537,8 +532,7 @@ public class AllBlocks {
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.DIRT))
.transform(axeOrPickaxe())
.blockstate(
(c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, s -> AssetLookup.partialBaseModel(c, p)))
@ -552,8 +546,7 @@ public class AllBlocks {
public static final BlockEntry<LargeWaterWheelBlock> LARGE_WATER_WHEEL =
REGISTRATE.block("large_water_wheel", LargeWaterWheelBlock::new)
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.DIRT))
.transform(axeOrPickaxe())
.blockstate((c, p) -> axisBlock(c, p,
s -> s.getValue(LargeWaterWheelBlock.EXTENSION) ? AssetLookup.partialBaseModel(c, p, "extension")
@ -569,8 +562,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::wooden)
.blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStatesExcept(BlockStateGen.mapToAir(p), WaterWheelStructuralBlock.FACING))
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.DIRT))
.transform(axeOrPickaxe())
.lang("Large Water Wheel")
.register();
@ -675,8 +667,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS =
REGISTRATE.block("mechanical_press", MechanicalPressBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.PODZOL))
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(BlockStressDefaults.setImpact(8.0))
@ -687,8 +678,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER =
REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.STONE))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.STONE))
.transform(axeOrPickaxe())
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.addLayer(() -> RenderType::cutoutMipped)
@ -699,8 +689,7 @@ public class AllBlocks {
public static final BlockEntry<BasinBlock> BASIN = REGISTRATE.block("basin", BasinBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY).sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.blockstate(new BasinGenerator()::generate)
.addLayer(() -> RenderType::cutoutMipped)
@ -712,8 +701,7 @@ public class AllBlocks {
public static final BlockEntry<BlazeBurnerBlock> BLAZE_BURNER =
REGISTRATE.block("blaze_burner", BlazeBurnerBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.lightLevel(BlazeBurnerBlock::getLight))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY).lightLevel(BlazeBurnerBlock::getLight))
.transform(pickaxeOnly())
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.PASSIVE_BOILER_HEATERS.tag)
@ -729,8 +717,7 @@ public class AllBlocks {
public static final BlockEntry<LitBlazeBurnerBlock> LIT_BLAZE_BURNER =
REGISTRATE.block("lit_blaze_burner", LitBlazeBurnerBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.COLOR_LIGHT_GRAY))
.properties(p -> p.lightLevel(LitBlazeBurnerBlock::getLight))
.properties(p -> p.mapColor(MapColor.COLOR_LIGHT_GRAY).lightLevel(LitBlazeBurnerBlock::getLight))
.transform(pickaxeOnly())
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.PASSIVE_BOILER_HEATERS.tag)
@ -758,8 +745,7 @@ public class AllBlocks {
public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR =
REGISTRATE.block("weighted_ejector", EjectorBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.COLOR_GRAY))
.transform(axeOrPickaxe())
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180))
.transform(BlockStressDefaults.setImpact(2.0))
@ -771,8 +757,7 @@ public class AllBlocks {
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
.addLayer(() -> RenderType::cutoutMipped)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY).sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.addLayer(() -> RenderType::cutoutMipped)
.blockstate(new ChuteGenerator()::generate)
@ -783,10 +768,10 @@ public class AllBlocks {
public static final BlockEntry<SmartChuteBlock> SMART_CHUTE = REGISTRATE.block("smart_chute", SmartChuteBlock::new)
.addLayer(() -> RenderType::cutoutMipped)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.noOcclusion())
.properties(p -> p.isRedstoneConductor((level, pos, state) -> false))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY)
.sound(SoundType.NETHERITE_BLOCK)
.noOcclusion()
.isRedstoneConductor((level, pos, state) -> false))
.transform(pickaxeOnly())
.blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p)))
.item()
@ -835,6 +820,7 @@ public class AllBlocks {
public static final BlockEntry<FluidPipeBlock> FLUID_PIPE = REGISTRATE.block("fluid_pipe", FluidPipeBlock::new)
.initialProperties(SharedProperties::copperMetal)
.properties(p -> p.forceSolidOn())
.transform(pickaxeOnly())
.blockstate(BlockStateGen.pipe())
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
@ -845,8 +831,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE =
REGISTRATE.block("encased_fluid_pipe", p -> new EncasedPipeBlock(p, AllBlocks.COPPER_CASING::get))
.initialProperties(SharedProperties::copperMetal)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_LIGHT_GRAY))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.TERRACOTTA_LIGHT_GRAY))
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.encasedPipe())
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
@ -860,6 +845,7 @@ public class AllBlocks {
public static final BlockEntry<GlassFluidPipeBlock> GLASS_FLUID_PIPE =
REGISTRATE.block("glass_fluid_pipe", GlassFluidPipeBlock::new)
.initialProperties(SharedProperties::copperMetal)
.properties(p -> p.forceSolidOn())
.addLayer(() -> RenderType::cutoutMipped)
.transform(pickaxeOnly())
.blockstate((c, p) -> {
@ -935,8 +921,7 @@ public class AllBlocks {
public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular)
.initialProperties(SharedProperties::copperMetal)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.isRedstoneConductor((p1, p2, p3) -> true))
.properties(p -> p.noOcclusion().isRedstoneConductor((p1, p2, p3) -> true))
.transform(pickaxeOnly())
.blockstate(new FluidTankGenerator()::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard))
@ -950,8 +935,7 @@ public class AllBlocks {
public static final BlockEntry<FluidTankBlock> CREATIVE_FLUID_TANK =
REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative)
.initialProperties(SharedProperties::copperMetal)
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.mapColor(MapColor.COLOR_PURPLE))
.properties(p -> p.noOcclusion().mapColor(MapColor.COLOR_PURPLE))
.transform(pickaxeOnly())
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new FluidTankGenerator("creative_")::generate)
@ -1030,7 +1014,7 @@ public class AllBlocks {
public static final BlockEntry<WhistleExtenderBlock> STEAM_WHISTLE_EXTENSION =
REGISTRATE.block("steam_whistle_extension", WhistleExtenderBlock::new)
.initialProperties(SharedProperties::copperMetal)
.properties(p -> p.mapColor(MapColor.GOLD))
.properties(p -> p.mapColor(MapColor.GOLD).forceSolidOn())
.transform(pickaxeOnly())
.blockstate(BlockStateGen.whistleExtender())
.register();
@ -1038,7 +1022,7 @@ public class AllBlocks {
public static final BlockEntry<PoweredShaftBlock> POWERED_SHAFT =
REGISTRATE.block("powered_shaft", PoweredShaftBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.METAL))
.properties(p -> p.mapColor(MapColor.METAL).forceSolidOn())
.transform(pickaxeOnly())
.blockstate(BlockStateGen.axisBlockProvider(false))
.loot((lt, block) -> lt.dropOther(block, AllBlocks.SHAFT.get()))
@ -1065,8 +1049,7 @@ public class AllBlocks {
public static final BlockEntry<PistonExtensionPoleBlock> PISTON_EXTENSION_POLE =
REGISTRATE.block("piston_extension_pole", PistonExtensionPoleBlock::new)
.initialProperties(() -> Blocks.PISTON_HEAD)
.properties(p -> p.sound(SoundType.SCAFFOLDING))
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(p -> p.sound(SoundType.SCAFFOLDING).mapColor(MapColor.DIRT).forceSolidOn())
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false))
.simpleItem()
@ -1086,8 +1069,7 @@ public class AllBlocks {
public static final BlockEntry<GantryCarriageBlock> GANTRY_CARRIAGE =
REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.PODZOL))
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.directionalAxisBlockProvider())
.item()
@ -1097,7 +1079,7 @@ public class AllBlocks {
public static final BlockEntry<GantryShaftBlock> GANTRY_SHAFT =
REGISTRATE.block("gantry_shaft", GantryShaftBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.NETHER))
.properties(p -> p.mapColor(MapColor.NETHER).forceSolidOn())
.transform(axeOrPickaxe())
.blockstate((c, p) -> p.directionalBlock(c.get(), s -> {
boolean isPowered = s.getValue(GantryShaftBlock.POWERED);
@ -1192,8 +1174,7 @@ public class AllBlocks {
public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER =
REGISTRATE.block("cart_assembler", CartAssemblerBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.COLOR_GRAY))
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.cartAssembler())
.addLayer(() -> RenderType::cutoutMipped)
@ -1349,8 +1330,7 @@ public class AllBlocks {
public static final BlockEntry<ElevatorContactBlock> ELEVATOR_CONTACT =
REGISTRATE.block("elevator_contact", ElevatorContactBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW))
.properties(p -> p.lightLevel(ElevatorContactBlock::getLight))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW).lightLevel(ElevatorContactBlock::getLight))
.transform(axeOrPickaxe())
.blockstate((c, p) -> p.directionalBlock(c.get(), state -> {
Boolean calling = state.getValue(ElevatorContactBlock.CALLING);
@ -1367,7 +1347,7 @@ public class AllBlocks {
public static final BlockEntry<HarvesterBlock> MECHANICAL_HARVESTER =
REGISTRATE.block("mechanical_harvester", HarvesterBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.METAL))
.properties(p -> p.mapColor(MapColor.METAL).forceSolidOn())
.transform(axeOrPickaxe())
.onRegister(movementBehaviour(new HarvesterMovementBehaviour()))
.blockstate(BlockStateGen.horizontalBlockProvider(true))
@ -1380,7 +1360,7 @@ public class AllBlocks {
public static final BlockEntry<PloughBlock> MECHANICAL_PLOUGH =
REGISTRATE.block("mechanical_plough", PloughBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY).forceSolidOn())
.transform(axeOrPickaxe())
.onRegister(movementBehaviour(new PloughMovementBehaviour()))
.blockstate(BlockStateGen.horizontalBlockProvider(false))
@ -1405,8 +1385,8 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p))
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(MapColor.DIRT))
.properties(p -> p.sound(SoundType.SCAFFOLDING)
.properties(p -> p.mapColor(MapColor.DIRT)
.sound(SoundType.SCAFFOLDING)
.noOcclusion())
.transform(axeOnly())
.blockstate(BlockStateGen.directionalBlockProvider(false))
@ -1419,8 +1399,8 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL =
REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p, DyeColor.WHITE))
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(MapColor.SNOW))
.properties(p -> p.sound(SoundType.SCAFFOLDING)
.properties(p -> p.mapColor(MapColor.SNOW)
.sound(SoundType.SCAFFOLDING)
.noOcclusion())
.transform(axeOnly())
.blockstate(BlockStateGen.directionalBlockProvider(false))
@ -1437,8 +1417,8 @@ public class AllBlocks {
String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p, colour))
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(colour.getMapColor()))
.properties(p -> p.sound(SoundType.SCAFFOLDING)
.properties(p -> p.mapColor(colour.getMapColor())
.sound(SoundType.SCAFFOLDING)
.noOcclusion())
.transform(axeOnly())
.blockstate((c, p) -> p.directionalBlock(c.get(), p.models()
@ -1460,8 +1440,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<CasingBlock> COPPER_CASING = REGISTRATE.block("copper_casing", CasingBlock::new)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_LIGHT_GRAY))
.properties(p -> p.sound(SoundType.COPPER))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_LIGHT_GRAY).sound(SoundType.COPPER))
.transform(BuilderTransformers.casing(() -> AllSpriteShifts.COPPER_CASING))
.register();
@ -1483,8 +1462,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER =
REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.TERRACOTTA_YELLOW))
.transform(axeOrPickaxe())
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(BlockStressDefaults.setImpact(2.0))
@ -1509,8 +1487,7 @@ public class AllBlocks {
public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW))
.properties(BlockBehaviour.Properties::noOcclusion)
.properties(p -> p.noOcclusion().mapColor(MapColor.TERRACOTTA_YELLOW))
.transform(axeOrPickaxe())
.transform(BlockStressDefaults.setNoImpact())
.blockstate(BlockStateGen.axisBlockProvider(true))
@ -1551,7 +1528,8 @@ public class AllBlocks {
.properties(p -> p.mapColor(MapColor.METAL)
.strength(0.8F)
.sound(SoundType.METAL)
.noOcclusion())
.noOcclusion()
.forceSolidOn())
.addLayer(() -> RenderType::cutoutMipped)
.transform(pickaxeOnly())
.onRegister(CreateRegistrate.blockModel(() -> TrackModel::new))
@ -1578,15 +1556,13 @@ public class AllBlocks {
public static final BlockEntry<CasingBlock> RAILWAY_CASING = REGISTRATE.block("railway_casing", CasingBlock::new)
.transform(BuilderTransformers.layeredCasing(() -> AllSpriteShifts.RAILWAY_CASING_SIDE,
() -> AllSpriteShifts.RAILWAY_CASING))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_CYAN))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_CYAN).sound(SoundType.NETHERITE_BLOCK))
.lang("Train Casing")
.register();
public static final BlockEntry<StationBlock> TRACK_STATION = REGISTRATE.block("track_station", StationBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.PODZOL).sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.partialBaseModel(c, p)))
.onRegister(assignDataBehaviour(new StationSummaryDisplaySource(), "station_summary"))
@ -1598,9 +1574,9 @@ public class AllBlocks {
public static final BlockEntry<SignalBlock> TRACK_SIGNAL = REGISTRATE.block("track_signal", SignalBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.noOcclusion())
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.PODZOL)
.noOcclusion()
.sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStates(state -> ConfiguredModel.builder()
@ -1615,9 +1591,9 @@ public class AllBlocks {
public static final BlockEntry<TrackObserverBlock> TRACK_OBSERVER =
REGISTRATE.block("track_observer", TrackObserverBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.PODZOL))
.properties(p -> p.noOcclusion())
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.PODZOL)
.noOcclusion()
.sound(SoundType.NETHERITE_BLOCK))
.blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p)))
.transform(pickaxeOnly())
.onRegister(assignDataBehaviour(new ObservedTrainNameSource(), "observed_train_name"))
@ -1640,8 +1616,7 @@ public class AllBlocks {
public static final BlockEntry<ControlsBlock> TRAIN_CONTROLS = REGISTRATE.block("controls", ControlsBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN).sound(SoundType.NETHERITE_BLOCK))
.addLayer(() -> RenderType::cutoutMipped)
.transform(pickaxeOnly())
.blockstate((c, p) -> p.horizontalBlock(c.get(),
@ -1656,8 +1631,7 @@ public class AllBlocks {
public static final BlockEntry<ItemVaultBlock> ITEM_VAULT = REGISTRATE.block("item_vault", ItemVaultBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BLUE))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BLUE).sound(SoundType.NETHERITE_BLOCK)
.explosionResistance(1200))
.transform(pickaxeOnly())
.blockstate((c, p) -> p.getVariantBuilder(c.get())
@ -1742,8 +1716,7 @@ public class AllBlocks {
public static final BlockEntry<SmartObserverBlock> SMART_OBSERVER =
REGISTRATE.block("content_observer", SmartObserverBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN))
.properties(p -> p.noOcclusion())
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN).noOcclusion())
.transform(axeOrPickaxe())
.blockstate(new SmartObserverGenerator()::generate)
.onRegister(assignDataBehaviour(new ItemCountDisplaySource(), "count_items"))
@ -1758,8 +1731,7 @@ public class AllBlocks {
public static final BlockEntry<ThresholdSwitchBlock> THRESHOLD_SWITCH =
REGISTRATE.block("stockpile_switch", ThresholdSwitchBlock::new)
.initialProperties(SharedProperties::stone)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN))
.properties(p -> p.noOcclusion())
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN).noOcclusion())
.transform(axeOrPickaxe())
.blockstate(new ThresholdSwitchGenerator()::generate)
.onRegister(assignDataBehaviour(new FillLevelDisplaySource(), "fill_level"))
@ -1802,8 +1774,7 @@ public class AllBlocks {
public static final BlockEntry<NixieTubeBlock> ORANGE_NIXIE_TUBE =
REGISTRATE.block("nixie_tube", p -> new NixieTubeBlock(p, DyeColor.ORANGE))
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.lightLevel($ -> 5))
.properties(p -> p.mapColor(DyeColor.ORANGE))
.properties(p -> p.lightLevel($ -> 5).mapColor(DyeColor.ORANGE).forceSolidOn())
.transform(pickaxeOnly())
.blockstate(new NixieTubeGenerator()::generate)
.addLayer(() -> RenderType::translucent)
@ -1817,8 +1788,7 @@ public class AllBlocks {
String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_nixie_tube", p -> new NixieTubeBlock(p, colour))
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(colour))
.properties(p -> p.lightLevel($ -> 5))
.properties(p -> p.lightLevel($ -> 5).mapColor(colour).forceSolidOn())
.transform(pickaxeOnly())
.blockstate(new NixieTubeGenerator()::generate)
.loot((p, b) -> p.dropOther(b, ORANGE_NIXIE_TUBE.get()))
@ -1844,7 +1814,7 @@ public class AllBlocks {
public static final BlockEntry<RedstoneLinkBlock> REDSTONE_LINK =
REGISTRATE.block("redstone_link", RedstoneLinkBlock::new)
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN))
.properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN).forceSolidOn())
.transform(axeOrPickaxe())
.tag(AllBlockTags.BRITTLE.tag, AllBlockTags.SAFE_NBT.tag)
.blockstate(new RedstoneLinkGenerator()::generate)
@ -1866,6 +1836,7 @@ public class AllBlocks {
public static final BlockEntry<PlacardBlock> PLACARD = REGISTRATE.block("placard", PlacardBlock::new)
.initialProperties(SharedProperties::copperMetal)
.properties(p -> p.forceSolidOn())
.transform(pickaxeOnly())
.blockstate((c, p) -> p.horizontalFaceBlock(c.get(), AssetLookup.standardModel(c, p)))
.simpleItem()
@ -1935,14 +1906,14 @@ public class AllBlocks {
public static final BlockEntry<PeculiarBellBlock> PECULIAR_BELL =
REGISTRATE.block("peculiar_bell", PeculiarBellBlock::new)
.properties(p -> p.mapColor(MapColor.GOLD))
.properties(p -> p.mapColor(MapColor.GOLD).forceSolidOn())
.transform(BuilderTransformers.bell())
.onRegister(movementBehaviour(new BellMovementBehaviour()))
.register();
public static final BlockEntry<HauntedBellBlock> HAUNTED_BELL =
REGISTRATE.block("haunted_bell", HauntedBellBlock::new)
.properties(p -> p.mapColor(MapColor.SAND))
.properties(p -> p.mapColor(MapColor.SAND).forceSolidOn())
.transform(BuilderTransformers.bell())
.onRegister(movementBehaviour(new HauntedBellMovementBehaviour()))
.register();
@ -1951,8 +1922,7 @@ public class AllBlocks {
String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_toolbox", p -> new ToolboxBlock(p, colour))
.initialProperties(SharedProperties::wooden)
.properties(p -> p.sound(SoundType.WOOD))
.properties(p -> p.mapColor(colour))
.properties(p -> p.sound(SoundType.WOOD).mapColor(colour).forceSolidOn())
.addLayer(() -> RenderType::cutoutMipped)
.loot((lt, block) -> {
Builder builder = LootTable.lootTable();
@ -1984,6 +1954,7 @@ public class AllBlocks {
public static final BlockEntry<ClipboardBlock> CLIPBOARD = REGISTRATE.block("clipboard", ClipboardBlock::new)
.initialProperties(SharedProperties::wooden)
.properties(p -> p.forceSolidOn())
.transform(axeOrPickaxe())
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate((c, p) -> p.horizontalFaceBlock(c.get(),
@ -1996,8 +1967,10 @@ public class AllBlocks {
.register();
// Materials
static { REGISTRATE.useCreativeTab(AllCreativeModeTabs.BUILDING_BLOCKS_TAB); }
static {
REGISTRATE.setCreativeTab(AllCreativeModeTabs.PALETTES_CREATIVE_TAB);
}
public static final BlockEntry<MetalLadderBlock> ANDESITE_LADDER =
REGISTRATE.block("andesite_ladder", MetalLadderBlock::new)
@ -2048,8 +2021,7 @@ public class AllBlocks {
public static final BlockEntry<GirderBlock> METAL_GIRDER = REGISTRATE.block("metal_girder", GirderBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate(GirderBlockStateGenerator::blockState)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY).sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.onRegister(CreateRegistrate.blockModel(() -> ConnectedGirderModel::new))
.item()
@ -2060,8 +2032,7 @@ public class AllBlocks {
REGISTRATE.block("metal_girder_encased_shaft", GirderEncasedShaftBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate(GirderBlockStateGenerator::blockStateWithShaft)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.mapColor(MapColor.COLOR_GRAY).sound(SoundType.NETHERITE_BLOCK))
.transform(pickaxeOnly())
.loot((p, b) -> p.add(b, p.createSingleItemTable(METAL_GIRDER.get())
.withPool(p.applyExplosionCondition(SHAFT.get(), LootPool.lootPool()
@ -2081,6 +2052,7 @@ public class AllBlocks {
public static final BlockEntry<CopycatStepBlock> COPYCAT_STEP =
REGISTRATE.block("copycat_step", CopycatStepBlock::new)
.properties(p -> p.forceSolidOn())
.transform(BuilderTransformers.copycat())
.onRegister(CreateRegistrate.blockModel(() -> CopycatStepModel::new))
.item()
@ -2203,8 +2175,8 @@ public class AllBlocks {
public static final BlockEntry<Block> ZINC_ORE = REGISTRATE.block("zinc_ore", Block::new)
.initialProperties(() -> Blocks.GOLD_ORE)
.properties(p -> p.mapColor(MapColor.METAL))
.properties(p -> p.requiresCorrectToolForDrops()
.properties(p -> p.mapColor(MapColor.METAL)
.requiresCorrectToolForDrops()
.sound(SoundType.STONE))
.transform(pickaxeOnly())
.loot((lt, b) -> lt.add(b,
@ -2220,8 +2192,8 @@ public class AllBlocks {
public static final BlockEntry<Block> DEEPSLATE_ZINC_ORE = REGISTRATE.block("deepslate_zinc_ore", Block::new)
.initialProperties(() -> Blocks.DEEPSLATE_GOLD_ORE)
.properties(p -> p.mapColor(MapColor.STONE))
.properties(p -> p.requiresCorrectToolForDrops()
.properties(p -> p.mapColor(MapColor.STONE)
.requiresCorrectToolForDrops()
.sound(SoundType.DEEPSLATE))
.transform(pickaxeOnly())
.loot((lt, b) -> lt.add(b,
@ -2237,8 +2209,7 @@ public class AllBlocks {
public static final BlockEntry<Block> RAW_ZINC_BLOCK = REGISTRATE.block("raw_zinc_block", Block::new)
.initialProperties(() -> Blocks.RAW_GOLD_BLOCK)
.properties(p -> p.mapColor(MapColor.GLOW_LICHEN))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.GLOW_LICHEN).requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.tag(Tags.Blocks.STORAGE_BLOCKS)
.tag(BlockTags.NEEDS_IRON_TOOL)
@ -2250,8 +2221,7 @@ public class AllBlocks {
public static final BlockEntry<Block> ZINC_BLOCK = REGISTRATE.block("zinc_block", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.mapColor(MapColor.GLOW_LICHEN))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.GLOW_LICHEN).requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.tag(BlockTags.NEEDS_IRON_TOOL)
.tag(Tags.Blocks.STORAGE_BLOCKS)
@ -2264,8 +2234,7 @@ public class AllBlocks {
public static final BlockEntry<Block> ANDESITE_ALLOY_BLOCK = REGISTRATE.block("andesite_alloy_block", Block::new)
.initialProperties(() -> Blocks.ANDESITE)
.properties(p -> p.mapColor(MapColor.STONE))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.STONE).requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("andesite_block"))
.tag(Tags.Blocks.STORAGE_BLOCKS)
@ -2277,9 +2246,9 @@ public class AllBlocks {
public static final BlockEntry<Block> INDUSTRIAL_IRON_BLOCK = REGISTRATE.block("industrial_iron_block", Block::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.COLOR_GRAY))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.COLOR_GRAY)
.sound(SoundType.NETHERITE_BLOCK)
.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models()
.cubeColumn(c.getName(), p.modLoc("block/industrial_iron_block"),
@ -2293,8 +2262,7 @@ public class AllBlocks {
public static final BlockEntry<Block> BRASS_BLOCK = REGISTRATE.block("brass_block", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW).requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("brass_block"))
.tag(BlockTags.NEEDS_IRON_TOOL)
@ -2309,12 +2277,12 @@ public class AllBlocks {
public static final BlockEntry<ExperienceBlock> EXPERIENCE_BLOCK =
REGISTRATE.block("experience_block", ExperienceBlock::new)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.mapColor(MapColor.PLANT))
.properties(p -> p.sound(new ForgeSoundType(1, .5f, () -> SoundEvents.AMETHYST_BLOCK_BREAK,
() -> SoundEvents.AMETHYST_BLOCK_STEP, () -> SoundEvents.AMETHYST_BLOCK_PLACE,
() -> SoundEvents.AMETHYST_BLOCK_HIT, () -> SoundEvents.AMETHYST_BLOCK_FALL)))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.lightLevel(s -> 15))
.properties(p -> p.mapColor(MapColor.PLANT)
.sound(new ForgeSoundType(1, .5f, () -> SoundEvents.AMETHYST_BLOCK_BREAK,
() -> SoundEvents.AMETHYST_BLOCK_STEP, () -> SoundEvents.AMETHYST_BLOCK_PLACE,
() -> SoundEvents.AMETHYST_BLOCK_HIT, () -> SoundEvents.AMETHYST_BLOCK_FALL))
.requiresCorrectToolForDrops()
.lightLevel(s -> 15))
.blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.standardModel(c, p)))
.transform(pickaxeOnly())
.lang("Block of Experience")
@ -2343,8 +2311,7 @@ public class AllBlocks {
public static final BlockEntry<Block> ROSE_QUARTZ_TILES = REGISTRATE.block("rose_quartz_tiles", Block::new)
.initialProperties(() -> Blocks.DEEPSLATE)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK).requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("palettes/rose_quartz_tiles"))
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.POLISHED_ROSE_QUARTZ.get()),
@ -2355,8 +2322,7 @@ public class AllBlocks {
public static final BlockEntry<Block> SMALL_ROSE_QUARTZ_TILES =
REGISTRATE.block("small_rose_quartz_tiles", Block::new)
.initialProperties(() -> Blocks.DEEPSLATE)
.properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK))
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK).requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("palettes/small_rose_quartz_tiles"))
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.POLISHED_ROSE_QUARTZ.get()),

View file

@ -7,14 +7,16 @@ import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.commons.lang3.mutable.MutableObject;
import com.simibubi.create.content.contraptions.actors.seat.SeatBlock;
import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks;
import com.simibubi.create.content.equipment.armor.BacktankUtil;
import com.simibubi.create.content.equipment.toolbox.ToolboxBlock;
import com.simibubi.create.content.kinetics.crank.ValveHandleBlock;
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.simibubi.create.foundation.item.TagDependentIngredientItem;
import com.simibubi.create.foundation.utility.Components;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.entry.ItemEntry;
import com.tterrag.registrate.util.entry.ItemProviderEntry;
@ -29,7 +31,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTab.DisplayItemsGenerator;
@ -53,45 +54,63 @@ import net.minecraftforge.registries.RegistryObject;
@EventBusSubscriber(bus = Bus.MOD)
public class AllCreativeModeTabs {
private static final DeferredRegister<CreativeModeTab> TAB_REGISTER =
private static final DeferredRegister<CreativeModeTab> REGISTER =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Create.ID);
public static final RegistryObject<CreativeModeTab> MAIN_TAB = TAB_REGISTER.register("base",
public static final RegistryObject<CreativeModeTab> BASE_CREATIVE_TAB = REGISTER.register("base",
() -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.create.base"))
.title(Components.translatable("itemGroup.create.base"))
.withTabsBefore(CreativeModeTabs.SPAWN_EGGS)
.icon(() -> AllBlocks.COGWHEEL.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(true))
.displayItems(new RegistrateDisplayItemsGenerator(true, AllCreativeModeTabs.BASE_CREATIVE_TAB))
.build());
public static final RegistryObject<CreativeModeTab> BUILDING_BLOCKS_TAB = TAB_REGISTER.register("palettes",
public static final RegistryObject<CreativeModeTab> PALETTES_CREATIVE_TAB = REGISTER.register("palettes",
() -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup.create.palettes"))
.withTabsBefore(MAIN_TAB.getKey())
.title(Components.translatable("itemGroup.create.palettes"))
.withTabsBefore(BASE_CREATIVE_TAB.getKey())
.icon(() -> AllPaletteBlocks.ORNATE_IRON_WINDOW.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(false))
.displayItems(new RegistrateDisplayItemsGenerator(false, AllCreativeModeTabs.PALETTES_CREATIVE_TAB))
.build());
public static void register(IEventBus modEventBus) {
TAB_REGISTER.register(modEventBus);
REGISTER.register(modEventBus);
}
public static CreativeModeTab getBaseTab() {
return MAIN_TAB.get();
}
private static class RegistrateDisplayItemsGenerator implements DisplayItemsGenerator {
private static final Predicate<Item> IS_ITEM_3D_PREDICATE;
public static CreativeModeTab getPalettesTab() {
return BUILDING_BLOCKS_TAB.get();
}
public static class RegistrateDisplayItemsGenerator implements DisplayItemsGenerator {
private final boolean mainTab;
public RegistrateDisplayItemsGenerator(boolean mainTab) {
this.mainTab = mainTab;
static {
MutableObject<Predicate<Item>> isItem3d = new MutableObject<>(item -> false);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
isItem3d.setValue(item -> {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
BakedModel model = itemRenderer.getModel(new ItemStack(item), null, null, 0);
return model.isGui3d();
});
});
IS_ITEM_3D_PREDICATE = isItem3d.getValue();
}
@OnlyIn(Dist.CLIENT)
private static Predicate<Item> makeClient3dItemPredicate() {
return item -> {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
BakedModel model = itemRenderer.getModel(new ItemStack(item), null, null, 0);
return model.isGui3d();
};
}
private final boolean addItems;
private final RegistryObject<CreativeModeTab> tabFilter;
public RegistrateDisplayItemsGenerator(boolean addItems, RegistryObject<CreativeModeTab> tabFilter) {
this.addItems = addItems;
this.tabFilter = tabFilter;
}
private static Predicate<Item> makeExclusionPredicate() {
Set<Item> exclusions = new ReferenceOpenHashSet<>();
@ -145,22 +164,6 @@ public class AllCreativeModeTabs {
return exclusions::contains;
}
private static Predicate<Item> make3DPredicate(boolean model3d) {
return item -> {
MutableBoolean result = new MutableBoolean(false);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> result.setValue(isItem3d(item) == model3d));
return result.getValue();
};
}
@OnlyIn(Dist.CLIENT)
private static boolean isItem3d(Item item) {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
BakedModel model = itemRenderer.getModel(new ItemStack(item), null, null, 0);
return model.isGui3d();
}
private static List<ItemOrdering> makeOrderings() {
List<ItemOrdering> orderings = new ReferenceArrayList<>();
@ -253,26 +256,29 @@ public class AllCreativeModeTabs {
}
@Override
public void accept(ItemDisplayParameters pParameters, Output output) {
public void accept(ItemDisplayParameters parameters, Output output) {
Predicate<Item> exclusionPredicate = makeExclusionPredicate();
List<ItemOrdering> orderings = makeOrderings();
Function<Item, ItemStack> stackFunc = makeStackFunc();
Function<Item, TabVisibility> visibilityFunc = makeVisibilityFunc();
RegistryObject<CreativeModeTab> tab = mainTab ? MAIN_TAB : BUILDING_BLOCKS_TAB;
List<Item> items = new LinkedList<>();
items.addAll(collectItems(tab, exclusionPredicate.or(make3DPredicate(false))));
items.addAll(collectBlocks(tab, exclusionPredicate));
items.addAll(collectItems(tab, exclusionPredicate.or(make3DPredicate(true))));
if (addItems) {
items.addAll(collectItems(exclusionPredicate.or(IS_ITEM_3D_PREDICATE.negate())));
}
items.addAll(collectBlocks(exclusionPredicate));
if (addItems) {
items.addAll(collectItems(exclusionPredicate.or(IS_ITEM_3D_PREDICATE)));
}
applyOrderings(items, orderings);
outputAll(output, items, stackFunc, visibilityFunc);
}
private List<Item> collectBlocks(RegistryObject<CreativeModeTab> tab, Predicate<Item> exclusionPredicate) {
private List<Item> collectBlocks(Predicate<Item> exclusionPredicate) {
List<Item> items = new ReferenceArrayList<>();
for (RegistryEntry<Block> entry : Create.REGISTRATE.getAll(Registries.BLOCK)) {
if (!Create.REGISTRATE.isInCreativeTab(entry, tab))
if (!CreateRegistrate.isInCreativeTab(entry, tabFilter))
continue;
Item item = entry.get()
.asItem();
@ -285,14 +291,10 @@ public class AllCreativeModeTabs {
return items;
}
private List<Item> collectItems(RegistryObject<CreativeModeTab> tab, Predicate<Item> exclusionPredicate) {
private List<Item> collectItems(Predicate<Item> exclusionPredicate) {
List<Item> items = new ReferenceArrayList<>();
if (!mainTab)
return items;
for (RegistryEntry<Item> entry : Create.REGISTRATE.getAll(Registries.ITEM)) {
if (!Create.REGISTRATE.isInCreativeTab(entry, tab))
if (!CreateRegistrate.isInCreativeTab(entry, tabFilter))
continue;
Item item = entry.get();
if (item instanceof BlockItem)

View file

@ -66,8 +66,10 @@ import net.minecraft.world.item.Rarity;
import net.minecraftforge.common.Tags;
public class AllItems {
static { REGISTRATE.useCreativeTab(AllCreativeModeTabs.MAIN_TAB); }
static {
REGISTRATE.setCreativeTab(AllCreativeModeTabs.BASE_CREATIVE_TAB);
}
public static final ItemEntry<Item> WHEAT_FLOUR =
taggedIngredient("wheat_flour", forgeItemTag("flour/wheat"), forgeItemTag("flour")),

View file

@ -31,8 +31,10 @@ import net.minecraftforge.common.Tags;
public class AllPaletteBlocks {
static { REGISTRATE.useCreativeTab(AllCreativeModeTabs.BUILDING_BLOCKS_TAB); }
static {
REGISTRATE.setCreativeTab(AllCreativeModeTabs.PALETTES_CREATIVE_TAB);
}
// Windows and Glass
public static final BlockEntry<GlassBlock> TILED_GLASS = REGISTRATE.block("tiled_glass", GlassBlock::new)

View file

@ -224,7 +224,7 @@ public abstract class PaletteBlockPartial<B extends Block> {
@Override
protected WallBlock createBlock(Supplier<? extends Block> block) {
return new WallBlock(Properties.copy(block.get()));
return new WallBlock(Properties.copy(block.get()).forceSolidOn());
}
@Override

View file

@ -53,8 +53,12 @@ import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.registries.RegistryObject;
public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
private static final Map<RegistryEntry<?>, RegistryObject<CreativeModeTab>> TAB_LOOKUP = new IdentityHashMap<>();
@Nullable
protected Function<Item, TooltipModifier> currentTooltipModifierFactory;
@Nullable
protected RegistryObject<CreativeModeTab> currentTab;
protected CreateRegistrate(String modid) {
super(modid);
@ -64,6 +68,10 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
return new CreateRegistrate(modid);
}
public static boolean isInCreativeTab(RegistryEntry<?> entry, RegistryObject<CreativeModeTab> tab) {
return TAB_LOOKUP.get(entry) == tab;
}
public CreateRegistrate setTooltipModifierFactory(@Nullable Function<Item, TooltipModifier> factory) {
currentTooltipModifierFactory = factory;
return self();
@ -74,22 +82,20 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
return currentTooltipModifierFactory;
}
@Nullable
public CreateRegistrate setCreativeTab(RegistryObject<CreativeModeTab> tab) {
currentTab = tab;
return self();
}
public RegistryObject<CreativeModeTab> getCreativeTab() {
return currentTab;
}
@Override
public CreateRegistrate registerEventListeners(IEventBus bus) {
return super.registerEventListeners(bus);
}
private static Map<RegistryEntry<?>, RegistryObject<CreativeModeTab>> tabLookup = new IdentityHashMap<>();
private RegistryObject<CreativeModeTab> currentTab;
public CreateRegistrate useCreativeTab(RegistryObject<CreativeModeTab> tab) {
this.currentTab = tab;
return this;
}
public boolean isInCreativeTab(RegistryEntry<?> entry, RegistryObject<CreativeModeTab> tab) {
return tabLookup.get(entry) == tab;
}
@Override
protected <R, T extends R> RegistryEntry<T> accept(String name, ResourceKey<? extends Registry<R>> type,
@ -101,8 +107,9 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
TooltipModifier.REGISTRY.registerDeferred(entry.getId(), currentTooltipModifierFactory);
}
}
if (currentTab != null)
tabLookup.put(entry, currentTab);
if (currentTab != null) {
TAB_LOOKUP.put(entry, currentTab);
}
return entry;
}