Tag data-gen

This commit is contained in:
Snownee 2020-12-12 05:00:25 +08:00
parent 517a4f0824
commit 1a052d1ec1
4 changed files with 46 additions and 20 deletions

View file

@ -1,30 +1,31 @@
{
"replace": false,
"values": [
"#signs",
"create:linear_chassis",
"create:secondary_linear_chassis",
"create:radial_chassis",
"create:redstone_link",
"create:creative_motor",
"create:fluid_tank",
"create:creative_fluid_tank",
"create:mechanical_piston",
"create:sticky_mechanical_piston",
"create:mechanical_piston_head",
"create:windmill_bearing",
"create:mechanical_bearing",
"create:clockwork_bearing",
"create:mechanical_piston",
"create:sticky_mechanical_piston",
"create:rope_pulley",
"create:cart_assembler",
"create:linear_chassis",
"create:secondary_linear_chassis",
"create:radial_chassis",
"create:sequenced_gearshift",
"create:creative_motor",
"create:creative_fluid_tank",
"create:creative_crate",
"create:adjustable_repeater",
"create:adjustable_pulse_repeater",
"create:analog_lever",
"create:rotation_speed_controller",
"create:andesite_funnel",
"create:andesite_belt_funnel",
"create:brass_funnel",
"create:brass_belt_funnel",
"create:andesite_funnel",
"create:andesite_belt_funnel"
],
"optional": [
"create:creative_crate",
"create:redstone_link",
"create:analog_lever",
"create:adjustable_repeater",
"create:adjustable_pulse_repeater",
"#minecraft:signs"
]
}

View file

@ -320,6 +320,7 @@ public class AllBlocks {
public static final BlockEntry<CreativeMotorBlock> CREATIVE_MOTOR =
REGISTRATE.block("creative_motor", CreativeMotorBlock::new)
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new CreativeMotorGenerator()::generate)
.transform(StressConfigDefaults.setCapacity(16384.0))
.item()
@ -592,6 +593,7 @@ public class AllBlocks {
public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular)
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.properties(Block.Properties::nonOpaque)
.blockstate(new FluidTankGenerator()::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard))
@ -604,6 +606,7 @@ public class AllBlocks {
public static final BlockEntry<FluidTankBlock> CREATIVE_FLUID_TANK =
REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative)
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.properties(Block.Properties::nonOpaque)
.blockstate(new FluidTankGenerator("creative_")::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::creative))
@ -653,11 +656,13 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPistonBlock> MECHANICAL_PISTON =
REGISTRATE.block("mechanical_piston", MechanicalPistonBlock::normal)
.transform(BuilderTransformers.mechanicalPiston(PistonType.DEFAULT))
.tag(AllBlockTags.SAFE_NBT.tag)
.register();
public static final BlockEntry<MechanicalPistonBlock> STICKY_MECHANICAL_PISTON =
REGISTRATE.block("sticky_mechanical_piston", MechanicalPistonBlock::sticky)
.transform(BuilderTransformers.mechanicalPiston(PistonType.STICKY))
.tag(AllBlockTags.SAFE_NBT.tag)
.register();
public static final BlockEntry<PistonExtensionPoleBlock> PISTON_EXTENSION_POLE =
@ -670,6 +675,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPistonHeadBlock> MECHANICAL_PISTON_HEAD =
REGISTRATE.block("mechanical_piston_head", MechanicalPistonHeadBlock::new)
.initialProperties(() -> Blocks.PISTON_HEAD)
.tag(AllBlockTags.SAFE_NBT.tag)
.loot((p, b) -> p.registerDropping(b, PISTON_EXTENSION_POLE.get()))
.blockstate((c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, state -> p.models()
.getExistingFile(p.modLoc("block/mechanical_piston/" + state.get(MechanicalPistonHeadBlock.TYPE)
@ -680,12 +686,14 @@ public class AllBlocks {
REGISTRATE.block("windmill_bearing", WindmillBearingBlock::new)
.transform(BuilderTransformers.bearing("windmill", "gearbox", true))
.transform(StressConfigDefaults.setCapacity(512.0))
.tag(AllBlockTags.SAFE_NBT.tag)
.register();
public static final BlockEntry<MechanicalBearingBlock> MECHANICAL_BEARING =
REGISTRATE.block("mechanical_bearing", MechanicalBearingBlock::new)
.transform(BuilderTransformers.bearing("mechanical", "gearbox", false))
.transform(StressConfigDefaults.setImpact(4.0))
.tag(AllBlockTags.SAFE_NBT.tag)
.onRegister(addMovementBehaviour(new StabilizedBearingMovementBehaviour()))
.register();
@ -693,10 +701,12 @@ public class AllBlocks {
REGISTRATE.block("clockwork_bearing", ClockworkBearingBlock::new)
.transform(BuilderTransformers.bearing("clockwork", "brass_gearbox", false))
.transform(StressConfigDefaults.setImpact(4.0))
.tag(AllBlockTags.SAFE_NBT.tag)
.register();
public static final BlockEntry<PulleyBlock> ROPE_PULLEY = REGISTRATE.block("rope_pulley", PulleyBlock::new)
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(BlockStateGen.horizontalAxisBlockProvider(true))
.transform(StressConfigDefaults.setImpact(4.0))
.item()
@ -725,7 +735,7 @@ public class AllBlocks {
.properties(Block.Properties::nonOpaque)
.blockstate(BlockStateGen.cartAssembler())
.addLayer(() -> RenderType::getCutoutMipped)
.tag(BlockTags.RAILS)
.tag(BlockTags.RAILS, AllBlockTags.SAFE_NBT.tag)
.item(CartAssemblerBlockItem::new)
.transform(customItemModel())
.register();
@ -765,6 +775,7 @@ public class AllBlocks {
public static final BlockEntry<LinearChassisBlock> LINEAR_CHASSIS =
REGISTRATE.block("linear_chassis", LinearChassisBlock::new)
.initialProperties(SharedProperties::wooden)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(BlockStateGen.linearChassis())
.onRegister(connectedTextures(new ChassisCTBehaviour()))
.lang("Linear Chassis")
@ -774,6 +785,7 @@ public class AllBlocks {
public static final BlockEntry<LinearChassisBlock> SECONDARY_LINEAR_CHASSIS =
REGISTRATE.block("secondary_linear_chassis", LinearChassisBlock::new)
.initialProperties(SharedProperties::wooden)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(BlockStateGen.linearChassis())
.onRegister(connectedTextures(new ChassisCTBehaviour()))
.simpleItem()
@ -782,6 +794,7 @@ public class AllBlocks {
public static final BlockEntry<RadialChassisBlock> RADIAL_CHASSIS =
REGISTRATE.block("radial_chassis", RadialChassisBlock::new)
.initialProperties(SharedProperties::wooden)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(BlockStateGen.radialChassis())
.item()
.model((c, p) -> {
@ -968,6 +981,7 @@ public class AllBlocks {
public static final BlockEntry<SequencedGearshiftBlock> SEQUENCED_GEARSHIFT =
REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new)
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.properties(Block.Properties::nonOpaque)
.transform(StressConfigDefaults.setNoImpact())
.blockstate(new SequencedGearshiftGenerator()::generate)
@ -997,6 +1011,7 @@ public class AllBlocks {
public static final BlockEntry<SpeedControllerBlock> ROTATION_SPEED_CONTROLLER =
REGISTRATE.block("rotation_speed_controller", SpeedControllerBlock::new)
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.transform(StressConfigDefaults.setNoImpact())
.blockstate(BlockStateGen.horizontalAxisBlockProvider(true))
.item()
@ -1024,6 +1039,7 @@ public class AllBlocks {
public static final BlockEntry<AndesiteFunnelBlock> ANDESITE_FUNNEL =
REGISTRATE.block("andesite_funnel", AndesiteFunnelBlock::new)
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.onRegister(addMovementBehaviour(FunnelMovementBehaviour.andesite()))
.transform(BuilderTransformers.funnel("andesite", Create.asResource("block/andesite_casing")))
.register();
@ -1031,6 +1047,7 @@ public class AllBlocks {
public static final BlockEntry<AndesiteBeltFunnelBlock> ANDESITE_BELT_FUNNEL =
REGISTRATE.block("andesite_belt_funnel", AndesiteBeltFunnelBlock::new)
.initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new BeltFunnelGenerator("andesite", new ResourceLocation("block/polished_andesite"))::generate)
.loot((p, b) -> p.registerDropping(b, ANDESITE_FUNNEL.get()))
.register();
@ -1038,6 +1055,7 @@ public class AllBlocks {
public static final BlockEntry<BrassFunnelBlock> BRASS_FUNNEL =
REGISTRATE.block("brass_funnel", BrassFunnelBlock::new)
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.onRegister(addMovementBehaviour(FunnelMovementBehaviour.brass()))
.transform(BuilderTransformers.funnel("brass", Create.asResource("block/brass_casing")))
.register();
@ -1045,6 +1063,7 @@ public class AllBlocks {
public static final BlockEntry<BrassBeltFunnelBlock> BRASS_BELT_FUNNEL =
REGISTRATE.block("brass_belt_funnel", BrassBeltFunnelBlock::new)
.initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new BeltFunnelGenerator("brass", Create.asResource("block/brass_block"))::generate)
.loot((p, b) -> p.registerDropping(b, BRASS_FUNNEL.get()))
.register();
@ -1093,6 +1112,7 @@ public class AllBlocks {
public static final BlockEntry<CreativeCrateBlock> CREATIVE_CRATE =
REGISTRATE.block("creative_crate", CreativeCrateBlock::new)
.transform(BuilderTransformers.crate("creative"))
.tag(AllBlockTags.SAFE_NBT.tag)
.register();
public static final BlockEntry<NixieTubeBlock> NIXIE_TUBE = REGISTRATE.block("nixie_tube", NixieTubeBlock::new)
@ -1107,7 +1127,7 @@ public class AllBlocks {
public static final BlockEntry<RedstoneLinkBlock> REDSTONE_LINK =
REGISTRATE.block("redstone_link", RedstoneLinkBlock::new)
.initialProperties(SharedProperties::wooden)
.tag(AllBlockTags.BRITTLE.tag)
.tag(AllBlockTags.BRITTLE.tag, AllBlockTags.SAFE_NBT.tag)
.blockstate(new RedstoneLinkGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.item()
@ -1117,6 +1137,7 @@ public class AllBlocks {
public static final BlockEntry<AnalogLeverBlock> ANALOG_LEVER =
REGISTRATE.block("analog_lever", AnalogLeverBlock::new)
.initialProperties(() -> Blocks.LEVER)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate((c, p) -> p.horizontalFaceBlock(c.get(), AssetLookup.partialBaseModel(c, p)))
.item()
.transform(customItemModel())
@ -1134,6 +1155,7 @@ public class AllBlocks {
public static final BlockEntry<AdjustableRepeaterBlock> ADJUSTABLE_REPEATER =
REGISTRATE.block("adjustable_repeater", AdjustableRepeaterBlock::new)
.initialProperties(() -> Blocks.REPEATER)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new AdjustableRepeaterGenerator()::generate)
.item()
.model(AbstractDiodeGenerator.diodeItemModel(true))
@ -1143,6 +1165,7 @@ public class AllBlocks {
public static final BlockEntry<AdjustableRepeaterBlock> ADJUSTABLE_PULSE_REPEATER =
REGISTRATE.block("adjustable_pulse_repeater", AdjustableRepeaterBlock::new)
.initialProperties(() -> Blocks.REPEATER)
.tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new AdjustableRepeaterGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped)
.item()

View file

@ -163,5 +163,7 @@ public class AllTags {
AllBlockTags.FAN_TRANSPARENT.add(Blocks.IRON_BARS);
AllBlockTags.FAN_HEATERS.add(Blocks.MAGMA_BLOCK, Blocks.CAMPFIRE, Blocks.LAVA, Blocks.FIRE);
AllBlockTags.SAFE_NBT.includeAll(BlockTags.SIGNS);
}
}

View file

@ -74,7 +74,7 @@ public class BlockMovementTraits {
return true;
if (blockState.getBlockHardness(world, pos) == -1)
return false;
if (AllBlockTags.NON_MOVABLE.tag.contains(block))
if (AllBlockTags.NON_MOVABLE.matches(blockState))
return false;
// Move controllers only when they aren't moving