BlockState gen progress

- Clutch, Gearshift and Gearbox joined the registrate
- Fixed belt and gearbox items not being assigned creative tabs properly
- Cleaned up and extended the blockstate generator helpers
- Removed advancements from static assets
- Added datagen .cache to gitignore
- Split the palettes section into its own Creative tab
- Fixed Clutch and Gearshift rendering their casing in the TER
This commit is contained in:
simibubi 2020-05-12 14:06:50 +02:00
parent 7832e79b13
commit 2696fc2a51
105 changed files with 656 additions and 340 deletions

1
.gitignore vendored
View file

@ -40,3 +40,4 @@ local.properties
# PDT-specific # PDT-specific
.buildpath .buildpath
src/generated/resources/.cache/cache

View file

@ -0,0 +1,28 @@
{
"variants": {
"axis=x,powered=false": {
"model": "create:block/clutch/block",
"x": 90,
"y": 90
},
"axis=y,powered=false": {
"model": "create:block/clutch/block"
},
"axis=z,powered=false": {
"model": "create:block/clutch/block",
"x": 90
},
"axis=x,powered=true": {
"model": "create:block/clutch/block_powered",
"x": 90,
"y": 90
},
"axis=y,powered=true": {
"model": "create:block/clutch/block_powered"
},
"axis=z,powered=true": {
"model": "create:block/clutch/block_powered",
"x": 90
}
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "create:block/creative_crate"
}
}
}

View file

@ -0,0 +1,16 @@
{
"variants": {
"axis=x": {
"model": "create:block/gearbox/block",
"x": 90,
"y": 90
},
"axis=y": {
"model": "create:block/gearbox/block"
},
"axis=z": {
"model": "create:block/gearbox/block",
"x": 90
}
}
}

View file

@ -0,0 +1,28 @@
{
"variants": {
"axis=x,powered=false": {
"model": "create:block/gearshift/block",
"x": 90,
"y": 90
},
"axis=y,powered=false": {
"model": "create:block/gearshift/block"
},
"axis=z,powered=false": {
"model": "create:block/gearshift/block",
"x": 90
},
"axis=x,powered=true": {
"model": "create:block/gearshift/block_powered",
"x": 90,
"y": 90
},
"axis=y,powered=true": {
"model": "create:block/gearshift/block_powered"
},
"axis=z,powered=true": {
"model": "create:block/gearshift/block_powered",
"x": 90
}
}
}

View file

@ -1,6 +1,6 @@
{ {
"block.create.clutch": "\u0265\u0254\u0287n\u05DF\u0186",
"block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186", "block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186",
"block.create.creative_crate": "\u01DD\u0287\u0250\u0279\u0186 \u01DD\u028C\u0131\u0287\u0250\u01DD\u0279\u0186",
"block.create.dark_scoria_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1", "block.create.dark_scoria_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
"block.create.dark_scoria_bricks_stairs": "s\u0279\u0131\u0250\u0287S s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1", "block.create.dark_scoria_bricks_stairs": "s\u0279\u0131\u0250\u0287S s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
"block.create.dark_scoria_bricks_wall": "\u05DF\u05DF\u0250M s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1", "block.create.dark_scoria_bricks_wall": "\u05DF\u05DF\u0250M s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
@ -15,6 +15,8 @@
"block.create.gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141", "block.create.gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141",
"block.create.gabbro_stairs": "s\u0279\u0131\u0250\u0287S o\u0279qq\u0250\u2141", "block.create.gabbro_stairs": "s\u0279\u0131\u0250\u0287S o\u0279qq\u0250\u2141",
"block.create.gabbro_wall": "\u05DF\u05DF\u0250M o\u0279qq\u0250\u2141", "block.create.gabbro_wall": "\u05DF\u05DF\u0250M o\u0279qq\u0250\u2141",
"block.create.gearbox": "xoq\u0279\u0250\u01DD\u2141",
"block.create.gearshift": "\u0287\u025F\u0131\u0265s\u0279\u0250\u01DD\u2141",
"block.create.indented_gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141 p\u01DD\u0287u\u01DDpuI", "block.create.indented_gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141 p\u01DD\u0287u\u01DDpuI",
"block.create.large_cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186 \u01DDb\u0279\u0250\uA780", "block.create.large_cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186 \u01DDb\u0279\u0250\uA780",
"block.create.limestone_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780", "block.create.limestone_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780",

View file

@ -1,6 +1,6 @@
{ {
"block.create.clutch": "Clutch",
"block.create.cogwheel": "Cogwheel", "block.create.cogwheel": "Cogwheel",
"block.create.creative_crate": "Creative Crate",
"block.create.dark_scoria_bricks_slab": "Dark Scoria Bricks Slab", "block.create.dark_scoria_bricks_slab": "Dark Scoria Bricks Slab",
"block.create.dark_scoria_bricks_stairs": "Dark Scoria Bricks Stairs", "block.create.dark_scoria_bricks_stairs": "Dark Scoria Bricks Stairs",
"block.create.dark_scoria_bricks_wall": "Dark Scoria Bricks Wall", "block.create.dark_scoria_bricks_wall": "Dark Scoria Bricks Wall",
@ -15,6 +15,8 @@
"block.create.gabbro_slab": "Gabbro Slab", "block.create.gabbro_slab": "Gabbro Slab",
"block.create.gabbro_stairs": "Gabbro Stairs", "block.create.gabbro_stairs": "Gabbro Stairs",
"block.create.gabbro_wall": "Gabbro Wall", "block.create.gabbro_wall": "Gabbro Wall",
"block.create.gearbox": "Gearbox",
"block.create.gearshift": "Gearshift",
"block.create.indented_gabbro_slab": "Indented Gabbro Slab", "block.create.indented_gabbro_slab": "Indented Gabbro Slab",
"block.create.large_cogwheel": "Large Cogwheel", "block.create.large_cogwheel": "Large Cogwheel",
"block.create.limestone_bricks_slab": "Limestone Bricks Slab", "block.create.limestone_bricks_slab": "Limestone Bricks Slab",

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/clutch/item"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/creative_crate"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/gearbox/item"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/gearshift/item"
}

View file

@ -2,7 +2,8 @@
"parent": "create:refined_radiance", "parent": "create:refined_radiance",
"display": { "display": {
"icon": { "icon": {
"item": "create:deforester" "item": "create:deforester",
"nbt": "{Damage:0}"
}, },
"title": { "title": {
"translate": "advancement.create.deforester" "translate": "advancement.create.deforester"

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"#forge:ingots/copper",
"#forge:ingots/zinc",
"#forge:ingots/brass"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:brass_ingot"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:copper_ingot"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:zinc_ingot"
],
"optional": []
}

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"#forge:nuggets/copper",
"#forge:nuggets/zinc",
"#forge:nuggets/brass"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:brass_nugget"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:copper_nugget"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:zinc_nugget"
],
"optional": []
}

View file

@ -0,0 +1,11 @@
{
"replace": false,
"values": [
"#forge:plates/iron",
"#forge:plates/gold",
"#forge:plates/copper",
"#forge:plates/brass",
"#forge:plates/lapis"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:brass_sheet"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:copper_sheet"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:gold_sheet"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:iron_sheet"
],
"optional": []
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"create:lapis_plate"
],
"optional": []
}

View file

@ -51,11 +51,8 @@ import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerB
import com.simibubi.create.modules.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock; import com.simibubi.create.modules.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock; import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock;
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock; import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock;
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock;
import com.simibubi.create.modules.curiosities.CocoaLogBlock; import com.simibubi.create.modules.curiosities.CocoaLogBlock;
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockBlock; import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock; import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
@ -124,9 +121,9 @@ public enum AllBlocks implements NonNullSupplier<Block> {
// COGWHEEL(() -> new CogWheelBlock(false), (b, p) -> new CogwheelBlockItem(b, p, false)), // COGWHEEL(() -> new CogWheelBlock(false), (b, p) -> new CogwheelBlockItem(b, p, false)),
// LARGE_COGWHEEL(() -> new CogWheelBlock(true), (b, p) -> new CogwheelBlockItem(b, p, true)), // LARGE_COGWHEEL(() -> new CogWheelBlock(true), (b, p) -> new CogwheelBlockItem(b, p, true)),
// ENCASED_SHAFT(EncasedShaftBlock::new), // ENCASED_SHAFT(EncasedShaftBlock::new),
GEARBOX(GearboxBlock::new), // GEARBOX(GearboxBlock::new),
CLUTCH(ClutchBlock::new), // CLUTCH(ClutchBlock::new),
GEARSHIFT(GearshiftBlock::new), // GEARSHIFT(GearshiftBlock::new),
ENCASED_BELT(EncasedBeltBlock::new), ENCASED_BELT(EncasedBeltBlock::new),
ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new), ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new),

View file

@ -2,12 +2,16 @@ package com.simibubi.create;
import static com.simibubi.create.modules.Sections.SCHEMATICS; import static com.simibubi.create.modules.Sections.SCHEMATICS;
import com.simibubi.create.foundation.utility.data.AssetLookup;
import com.simibubi.create.foundation.utility.data.BlockStateGen; import com.simibubi.create.foundation.utility.data.BlockStateGen;
import com.simibubi.create.modules.Sections; import com.simibubi.create.modules.Sections;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem; import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock;
import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock;
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.BlockEntry;
@ -26,9 +30,9 @@ public class AllBlocksNew {
public static final BlockEntry<SchematicannonBlock> SCHEMATICANNON = public static final BlockEntry<SchematicannonBlock> SCHEMATICANNON =
REGISTRATE.block("schematicannon", SchematicannonBlock::new) REGISTRATE.block("schematicannon", SchematicannonBlock::new)
.initialProperties(() -> Blocks.DISPENSER) .initialProperties(() -> Blocks.DISPENSER)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), BlockStateGen.partialBaseModel(ctx, prov))) .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.item() .item()
.model(BlockStateGen::customItemModel) .model(AssetLookup::customItemModel)
.build() .build()
.register(); .register();
@ -46,14 +50,14 @@ public class AllBlocksNew {
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new) public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
.initialProperties(SharedProperties::kinetic) .initialProperties(SharedProperties::kinetic)
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p))) .blockstate(BlockStateGen.axisBlockProvider(false))
.simpleItem() .simpleItem()
.register(); .register();
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small) public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small)
.initialProperties(SharedProperties::kinetic) .initialProperties(SharedProperties::kinetic)
.properties(p -> p.sound(SoundType.WOOD)) .properties(p -> p.sound(SoundType.WOOD))
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p))) .blockstate(BlockStateGen.axisBlockProvider(false))
.item(CogwheelBlockItem::new) .item(CogwheelBlockItem::new)
.build() .build()
.register(); .register();
@ -62,7 +66,7 @@ public class AllBlocksNew {
REGISTRATE.block("large_cogwheel", CogWheelBlock::large) REGISTRATE.block("large_cogwheel", CogWheelBlock::large)
.initialProperties(SharedProperties::kinetic) .initialProperties(SharedProperties::kinetic)
.properties(p -> p.sound(SoundType.WOOD)) .properties(p -> p.sound(SoundType.WOOD))
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p))) .blockstate(BlockStateGen.axisBlockProvider(false))
.item(CogwheelBlockItem::new) .item(CogwheelBlockItem::new)
.build() .build()
.register(); .register();
@ -70,9 +74,33 @@ public class AllBlocksNew {
public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT = public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT =
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new) REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
.initialProperties(SharedProperties::kinetic) .initialProperties(SharedProperties::kinetic)
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.partialBaseModel(c, p))) .blockstate(BlockStateGen.axisBlockProvider(true))
.item() .item()
.model(BlockStateGen::customItemModel) .model(AssetLookup::customItemModel)
.build()
.register();
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
.initialProperties(SharedProperties::kinetic)
.blockstate(BlockStateGen.axisBlockProvider(true))
.item()
.model(AssetLookup::customItemModel)
.build()
.register();
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
.initialProperties(SharedProperties::kinetic)
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item()
.model(AssetLookup::customItemModel)
.build()
.register();
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
.initialProperties(SharedProperties::kinetic)
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item()
.model(AssetLookup::customItemModel)
.build() .build()
.register(); .register();

View file

@ -194,7 +194,7 @@ public enum AllItems {
} }
public static Properties includeInItemGroup() { public static Properties includeInItemGroup() {
return new Properties().group(Create.creativeTab); return new Properties().group(Create.baseCreativeTab);
} }
public static void register(RegistryEvent.Register<Item> event) { public static void register(RegistryEvent.Register<Item> event) {

View file

@ -111,14 +111,14 @@ public enum AllTileEntities {
// Kinetics // Kinetics
SHAFT(ShaftTileEntity::new, AllBlocksNew.SHAFT, AllBlocksNew.COGWHEEL, AllBlocksNew.LARGE_COGWHEEL, AllBlocksNew.ENCASED_SHAFT), SHAFT(ShaftTileEntity::new, AllBlocksNew.SHAFT, AllBlocksNew.COGWHEEL, AllBlocksNew.LARGE_COGWHEEL, AllBlocksNew.ENCASED_SHAFT),
MOTOR(MotorTileEntity::new, AllBlocks.CREATIVE_MOTOR), MOTOR(MotorTileEntity::new, AllBlocks.CREATIVE_MOTOR),
GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX), GEARBOX(GearboxTileEntity::new, AllBlocksNew.GEARBOX),
TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE), TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE),
ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocksNew.ENCASED_SHAFT, AllBlocks.ENCASED_BELT), ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocksNew.ENCASED_SHAFT, AllBlocks.ENCASED_BELT),
ADJUSTABLE_PULLEY(AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY), ADJUSTABLE_PULLEY(AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY),
ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN), ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN),
NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE), NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE),
CLUTCH(ClutchTileEntity::new, AllBlocks.CLUTCH), CLUTCH(ClutchTileEntity::new, AllBlocksNew.CLUTCH),
GEARSHIFT(GearshiftTileEntity::new, AllBlocks.GEARSHIFT), GEARSHIFT(GearshiftTileEntity::new, AllBlocksNew.GEARSHIFT),
HAND_CRANK(HandCrankTileEntity::new, AllBlocks.HAND_CRANK), HAND_CRANK(HandCrankTileEntity::new, AllBlocks.HAND_CRANK),
CUCKOO_CLOCK(CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK), CUCKOO_CLOCK(CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK),

View file

@ -10,6 +10,7 @@ import com.simibubi.create.foundation.command.ServerLagger;
import com.simibubi.create.foundation.world.AllWorldFeatures; import com.simibubi.create.foundation.world.AllWorldFeatures;
import com.simibubi.create.modules.contraptions.TorquePropagator; import com.simibubi.create.modules.contraptions.TorquePropagator;
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler; import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
import com.simibubi.create.modules.palettes.PalettesItemGroup;
import com.simibubi.create.modules.schematics.ServerSchematicLoader; import com.simibubi.create.modules.schematics.ServerSchematicLoader;
import com.tterrag.registrate.util.NonNullLazyValue; import com.tterrag.registrate.util.NonNullLazyValue;
@ -36,11 +37,14 @@ public class Create {
public static final String VERSION = "0.1.1b"; public static final String VERSION = "0.1.1b";
public static Logger logger = LogManager.getLogger(); public static Logger logger = LogManager.getLogger();
public static ItemGroup creativeTab = new CreateItemGroup(); public static ItemGroup baseCreativeTab = new CreateItemGroup();
public static ItemGroup palettesCreativeTab = new PalettesItemGroup();
public static ServerSchematicLoader schematicReceiver; public static ServerSchematicLoader schematicReceiver;
public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler; public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler;
public static TorquePropagator torquePropagator; public static TorquePropagator torquePropagator;
public static ServerLagger lagger; public static ServerLagger lagger;
private static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(ID); private static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(ID);
public Create() { public Create() {

View file

@ -1,24 +1,27 @@
package com.simibubi.create; package com.simibubi.create;
import com.simibubi.create.foundation.item.IAddedByOther; import com.simibubi.create.modules.Sections;
import com.tterrag.registrate.util.entry.RegistryEntry; import com.tterrag.registrate.util.entry.RegistryEntry;
import net.minecraft.block.Block; 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.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.NonNullList;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public final class CreateItemGroup extends ItemGroup { public class CreateItemGroup extends CreateItemGroupBase {
public CreateItemGroup() { public CreateItemGroup() {
super(getGroupCountSafe(), Create.ID); super("base");
}
@Override
protected boolean shouldAdd(RegistryEntry<? extends Block> block) {
Sections section = Create.registrate()
.getSection(block);
return section != Sections.PALETTES;
}
@Override
protected boolean shouldAdd(AllItems item) {
return item.section != Sections.PALETTES;
} }
@Override @Override
@ -26,43 +29,4 @@ public final class CreateItemGroup extends ItemGroup {
return AllBlocksNew.COGWHEEL.asStack(); return AllBlocksNew.COGWHEEL.asStack();
} }
@Override
@OnlyIn(Dist.CLIENT)
public void fill(NonNullList<ItemStack> items) {
addItems(items, true);
addBlocks(items);
addItems(items, false);
}
@OnlyIn(Dist.CLIENT)
public void addBlocks(NonNullList<ItemStack> items) {
for (RegistryEntry<? extends Block> entry : Create.registrate().getAll(Block.class)) {
Block def = entry.get();
if (def == null)
continue;
if (def instanceof IAddedByOther)
continue;
Item item = def.asItem();
if (item != Items.AIR)
item.fillItemGroup(this, items);
}
}
@OnlyIn(Dist.CLIENT)
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
for (AllItems item : AllItems.values()) {
if (item.get() == null)
continue;
IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null);
if (model.isGui3d() != specialItems)
continue;
if (item.get() instanceof IAddedByOther)
continue;
item.get().fillItemGroup(this, items);
}
}
} }

View file

@ -0,0 +1,69 @@
package com.simibubi.create;
import com.tterrag.registrate.util.entry.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;
public abstract class CreateItemGroupBase extends ItemGroup {
public CreateItemGroupBase(String id) {
super(getGroupCountSafe(), Create.ID + "." + id);
}
@Override
@OnlyIn(Dist.CLIENT)
public void fill(NonNullList<ItemStack> items) {
addItems(items, true);
addBlocks(items);
addItems(items, false);
}
@OnlyIn(Dist.CLIENT)
public void addBlocks(NonNullList<ItemStack> items) {
for (RegistryEntry<? extends Block> entry : Create.registrate()
.getAll(Block.class)) {
if (!shouldAdd(entry))
continue;
Block def = entry.get();
if (def == null)
continue;
Item item = def.asItem();
if (item != Items.AIR)
def.fillItemGroup(this, items);
}
}
protected abstract boolean shouldAdd(RegistryEntry<? extends Block> block);
protected abstract boolean shouldAdd(AllItems item);
@OnlyIn(Dist.CLIENT)
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
for (AllItems item : AllItems.values()) {
if (!shouldAdd(item))
continue;
if (item.get() == null)
continue;
IBakedModel model =
itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null);
if (model.isGui3d() != specialItems)
continue;
item.get()
.fillItemGroup(this, items);
}
}
}

View file

@ -28,7 +28,7 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
public static CreateRegistrate create(String modid) { public static CreateRegistrate create(String modid) {
return new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get() return new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get()
.getModEventBus()) .getModEventBus())
.itemGroup(() -> Create.creativeTab); .itemGroup(() -> Create.baseCreativeTab);
} }
public static NonNullLazyValue<CreateRegistrate> lazy(String modid) { public static NonNullLazyValue<CreateRegistrate> lazy(String modid) {

View file

@ -1,5 +0,0 @@
package com.simibubi.create.foundation.item;
public interface IAddedByOther {
}

View file

@ -0,0 +1,58 @@
package com.simibubi.create.foundation.utility.data;
import java.util.function.Function;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.providers.RegistrateItemModelProvider;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraftforge.client.model.generators.ItemModelBuilder;
import net.minecraftforge.client.model.generators.ModelFile;
public class AssetLookup {
/**
* Custom block models packaged with other partials. Example:
* models/block/schematicannon/block.json <br>
* <br>
* Adding "powered", "vertical" will look for /block_powered_vertical.json
*/
public static ModelFile partialBaseModel(DataGenContext<?, ?> ctx, RegistrateBlockstateProvider prov,
String... suffix) {
String string = "/block";
for (String suf : suffix)
string += "_" + suf;
final String location = "block/" + ctx.getName() + string;
return prov.models()
.getExistingFile(prov.modLoc(location));
}
/**
* Custom block model from models/block/x.json
*/
public static ModelFile standardModel(DataGenContext<?, ?> ctx, RegistrateBlockstateProvider prov) {
return prov.models()
.getExistingFile(prov.modLoc("block/" + ctx.getName()));
}
/**
* Generate item model inheriting from a seperate model in
* models/block/x/item.json
*/
public static ItemModelBuilder customItemModel(DataGenContext<Item, ? extends BlockItem> ctx,
RegistrateItemModelProvider prov) {
return prov.blockItem(() -> ctx.getEntry()
.getBlock(), "/item");
}
public static Function<BlockState, ModelFile> forPowered(DataGenContext<?, ?> ctx,
RegistrateBlockstateProvider prov) {
return state -> state.get(BlockStateProperties.POWERED) ? partialBaseModel(ctx, prov, "powered")
: partialBaseModel(ctx, prov);
}
}

View file

@ -1,60 +1,38 @@
package com.simibubi.create.foundation.utility.data; package com.simibubi.create.foundation.utility.data;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import java.util.function.Function;
import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider; import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.providers.RegistrateItemModelProvider; import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
import com.tterrag.registrate.util.nullness.NonnullType;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.RotatedPillarBlock; import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.item.Item;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraftforge.client.model.generators.ItemModelBuilder; import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.client.model.generators.ModelFile.ExistingModelFile; import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.client.model.generators.VariantBlockStateBuilder;
public class BlockStateGen { public class BlockStateGen {
/** public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> axisBlockProvider(
* Equivalent to BlockStateProvider#axisBlock without the need for a boolean customItem) {
* RotatedPillarBlock instance return (c, p) -> BlockStateGen.axisBlock(c, p,
*/ $ -> customItem ? AssetLookup.partialBaseModel(c, p) : AssetLookup.standardModel(c, p));
public static <T extends RotatedPillarKineticBlock> VariantBlockStateBuilder axisKineticBlock(
DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, ExistingModelFile model) {
RotatedPillarKineticBlock block = ctx.getEntry();
return prov.getVariantBuilder(block).partialState().with(RotatedPillarBlock.AXIS, Axis.Y).modelForState()
.modelFile(model).addModel().partialState().with(RotatedPillarBlock.AXIS, Axis.Z).modelForState()
.modelFile(model).rotationX(90).addModel().partialState().with(RotatedPillarBlock.AXIS, Axis.X)
.modelForState().modelFile(model).rotationX(90).rotationY(90).addModel();
} }
/** public static <T extends Block> void axisBlock(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
* Custom block models packaged with other partials. Example: Function<BlockState, ModelFile> modelFunc) {
* models/block/schematicannon/block.json prov.getVariantBuilder(ctx.getEntry())
*/ .forAllStates(state -> {
public static ExistingModelFile partialBaseModel(@NonnullType DataGenContext<?, ?> ctx, Axis axis = state.get(BlockStateProperties.AXIS);
@NonnullType RegistrateBlockstateProvider prov) { return ConfiguredModel.builder()
return prov.models().getExistingFile(prov.modLoc("block/" + ctx.getName() + "/block")); .modelFile(modelFunc.apply(state))
} .rotationX(axis == Axis.Y ? 0 : 90)
.rotationY(axis == Axis.X ? 90 : 0)
/** .build();
* Custom block model from models/block/x.json });
*/
public static ExistingModelFile standardModel(@NonnullType DataGenContext<?, ?> ctx,
@NonnullType RegistrateBlockstateProvider prov) {
return prov.models().getExistingFile(prov.modLoc("block/" + ctx.getName()));
}
/**
* Generate item model inheriting from a seperate model in
* models/block/x/item.json
*/
public static ItemModelBuilder customItemModel(@NonnullType DataGenContext<Item, ? extends BlockItem> ctx,
@NonnullType RegistrateItemModelProvider prov) {
return prov.blockItem(() -> ctx.getEntry().getBlock(), "/item");
} }
} }

View file

@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.base;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
@ -15,6 +16,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -36,12 +38,14 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid())); renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid()));
} }
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms, IVertexBuilder buffer) { public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms,
IVertexBuilder buffer) {
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState); SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState);
renderRotatingBuffer(te, superByteBuffer, ms, buffer); renderRotatingBuffer(te, superByteBuffer, ms, buffer);
} }
public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms, IVertexBuilder buffer) { public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms,
IVertexBuilder buffer) {
standardKineticRotationTransform(superBuffer, te).renderInto(ms, buffer); standardKineticRotationTransform(superBuffer, te).renderInto(ms, buffer);
} }
@ -54,13 +58,15 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te) { public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te) {
final BlockPos pos = te.getPos(); final BlockPos pos = te.getPos();
Axis axis = ((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()); Axis axis = ((IRotate) te.getBlockState()
.getBlock()).getRotationAxis(te.getBlockState());
return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis)); return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis));
} }
public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis, public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis,
float angle) { float angle) {
int light = te.getBlockState().getLightValue(te.getWorld(), te.getPos()); int light = te.getBlockState()
.getLightValue(te.getWorld(), te.getPos());
buffer.light((0xF0 << 16) | (light << 4)); buffer.light((0xF0 << 16) | (light << 4));
buffer.rotateCentered(axis, angle); buffer.rotateCentered(axis, angle);
@ -92,6 +98,16 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
return offset; return offset;
} }
public static BlockState shaft(Axis axis) {
return AllBlocksNew.SHAFT.getDefaultState()
.with(BlockStateProperties.AXIS, axis);
}
public static Axis getRotationAxisOf(KineticTileEntity te) {
return ((IRotate) te.getBlockState()
.getBlock()).getRotationAxis(te.getBlockState());
}
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
return te.getBlockState(); return te.getBlockState();
} }

View file

@ -1,13 +1,10 @@
package com.simibubi.create.modules.contraptions.components.contraptions.piston; package com.simibubi.create.modules.contraptions.components.contraptions.piston;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BlockStateProperties;
public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRenderer { public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRenderer {
@ -17,8 +14,7 @@ public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRendere
@Override @Override
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, return shaft(getRotationAxisOf(te));
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
} }
} }

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.components.deployer;
import static com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; import static com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
import static com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock.FACING; import static com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock.FACING;
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -10,8 +9,6 @@ import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
@ -19,7 +16,6 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext; import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext;
@ -27,7 +23,6 @@ import com.simibubi.create.modules.contraptions.components.deployer.DeployerTile
import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntity.State; import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntity.State;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
@ -136,10 +131,7 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
} }
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
BlockState state = te.getBlockState(); return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te));
if (!AllBlocks.DEPLOYER.typeOf(state))
return Blocks.AIR.getDefaultState();
return AllBlocksNew.SHAFT.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
} }
private static SuperByteBuffer renderAndTransform(World world, AllBlockPartials renderBlock, private static SuperByteBuffer renderAndTransform(World world, AllBlockPartials renderBlock,

View file

@ -1,10 +1,7 @@
package com.simibubi.create.modules.contraptions.components.press; package com.simibubi.create.modules.contraptions.components.press;
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
@ -14,7 +11,6 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer { public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer {
@ -39,8 +35,7 @@ public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer
@Override @Override
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, return shaft(getRotationAxisOf(te));
te.getBlockState().get(HORIZONTAL_FACING).getAxis());
} }
} }

View file

@ -1,16 +1,13 @@
package com.simibubi.create.modules.contraptions.components.saw; package com.simibubi.create.modules.contraptions.components.saw;
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import static net.minecraft.state.properties.BlockStateProperties.FACING; import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
@ -90,8 +87,7 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
} }
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
BlockState state = te.getBlockState(); return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te));
return AllBlocksNew.SHAFT.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
} }
} }

View file

@ -1,14 +1,11 @@
package com.simibubi.create.modules.contraptions.relays.advanced; package com.simibubi.create.modules.contraptions.relays.advanced;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer; import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
@ -24,13 +21,13 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
IRenderTypeBuffer buffer, int light, int overlay) { IRenderTypeBuffer buffer, int light, int overlay) {
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay); super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, buffer.getBuffer(RenderType.getSolid())); KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms,
buffer.getBuffer(RenderType.getSolid()));
} }
private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) { private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) {
BlockState state = te.getBlockState();
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE, return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
AllBlocksNew.SHAFT.getDefaultState().with(ShaftBlock.AXIS, state.get(SpeedControllerBlock.HORIZONTAL_AXIS))); KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)));
} }
} }

View file

@ -34,6 +34,7 @@ import net.minecraft.entity.MobEntity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor; import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.pathfinding.PathNodeType; import net.minecraft.pathfinding.PathNodeType;
@ -49,6 +50,7 @@ import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.Rotation; import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@ -79,6 +81,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
setDefaultState(getDefaultState().with(SLOPE, Slope.HORIZONTAL).with(PART, Part.START).with(CASING, false)); setDefaultState(getDefaultState().with(SLOPE, Slope.HORIZONTAL).with(PART, Part.START).with(CASING, false));
} }
@Override
public void fillItemGroup(ItemGroup p_149666_1_, NonNullList<ItemStack> p_149666_2_) {
p_149666_2_.add(AllItems.BELT_CONNECTOR.asStack());
}
@Override @Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
if (face.getAxis() != getRotationAxis(state)) if (face.getAxis() != getRotationAxis(state))

View file

@ -4,9 +4,9 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.AllConfigs;
import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.item.IAddedByOther;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part;
@ -15,6 +15,8 @@ import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NBTUtil;
@ -24,10 +26,11 @@ import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BeltConnectorItem extends BlockItem implements IAddedByOther { public class BeltConnectorItem extends BlockItem {
public BeltConnectorItem(Properties properties) { public BeltConnectorItem(Properties properties) {
super(AllBlocks.BELT.get(), properties); super(AllBlocks.BELT.get(), properties);
@ -38,10 +41,19 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
return getDefaultTranslationKey(); return getDefaultTranslationKey();
} }
@Override
public void fillItemGroup(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
if (p_150895_1_ == Create.baseCreativeTab)
return;
super.fillItemGroup(p_150895_1_, p_150895_2_);
}
@Override @Override
public ActionResultType onItemUse(ItemUseContext context) { public ActionResultType onItemUse(ItemUseContext context) {
if (context.getPlayer().isSneaking()) { if (context.getPlayer()
context.getItem().setTag(null); .isSneaking()) {
context.getItem()
.setTag(null);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
@ -52,7 +64,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
if (world.isRemote) if (world.isRemote)
return validAxis ? ActionResultType.SUCCESS : ActionResultType.FAIL; return validAxis ? ActionResultType.SUCCESS : ActionResultType.FAIL;
CompoundNBT tag = context.getItem().getOrCreateTag(); CompoundNBT tag = context.getItem()
.getOrCreateTag();
BlockPos firstPulley = null; BlockPos firstPulley = null;
// Remove first if no longer existant or valid // Remove first if no longer existant or valid
@ -60,7 +73,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley")); firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
if (!validateAxis(world, firstPulley)) { if (!validateAxis(world, firstPulley)) {
tag.remove("FirstPulley"); tag.remove("FirstPulley");
context.getItem().setTag(tag); context.getItem()
.setTag(tag);
} }
} }
@ -75,20 +89,29 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
if (firstPulley != null && !firstPulley.equals(pos) && !world.isRemote) { if (firstPulley != null && !firstPulley.equals(pos) && !world.isRemote) {
createBelts(world, firstPulley, pos); createBelts(world, firstPulley, pos);
AllTriggers.triggerFor(AllTriggers.CONNECT_BELT, context.getPlayer()); AllTriggers.triggerFor(AllTriggers.CONNECT_BELT, context.getPlayer());
if (!context.getPlayer().isCreative()) if (!context.getPlayer()
context.getItem().shrink(1); .isCreative())
context.getItem()
.shrink(1);
} }
if (!context.getItem().isEmpty()) { if (!context.getItem()
context.getItem().setTag(null); .isEmpty()) {
context.getPlayer().getCooldownTracker().setCooldown(this, 5); context.getItem()
.setTag(null);
context.getPlayer()
.getCooldownTracker()
.setCooldown(this, 5);
} }
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
tag.put("FirstPulley", NBTUtil.writeBlockPos(pos)); tag.put("FirstPulley", NBTUtil.writeBlockPos(pos));
context.getItem().setTag(tag); context.getItem()
context.getPlayer().getCooldownTracker().setCooldown(this, 5); .setTag(tag);
context.getPlayer()
.getCooldownTracker()
.setCooldown(this, 5);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
@ -99,25 +122,21 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
BlockPos diff = end.subtract(start); BlockPos diff = end.subtract(start);
if (diff.getX() == diff.getZ()) if (diff.getX() == diff.getZ())
facing = Direction facing = Direction.getFacingFromAxis(facing.getAxisDirection(), world.getBlockState(start)
.getFacingFromAxis(facing.getAxisDirection(), .get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X);
world.getBlockState(start).get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X);
List<BlockPos> beltsToCreate = getBeltChainBetween(start, end, slope, facing); List<BlockPos> beltsToCreate = getBeltChainBetween(start, end, slope, facing);
BlockState beltBlock = AllBlocks.BELT.get().getDefaultState(); BlockState beltBlock = AllBlocks.BELT.get()
.getDefaultState();
for (BlockPos pos : beltsToCreate) { for (BlockPos pos : beltsToCreate) {
BeltBlock.Part part = pos.equals(start) ? Part.START : pos.equals(end) ? Part.END : Part.MIDDLE; BeltBlock.Part part = pos.equals(start) ? Part.START : pos.equals(end) ? Part.END : Part.MIDDLE;
boolean pulley = ShaftBlock.isShaft(world.getBlockState(pos)); boolean pulley = ShaftBlock.isShaft(world.getBlockState(pos));
if (part == Part.MIDDLE && pulley) if (part == Part.MIDDLE && pulley)
part = Part.PULLEY; part = Part.PULLEY;
world world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope)
.setBlockState(pos,
beltBlock
.with(BeltBlock.SLOPE, slope)
.with(BeltBlock.PART, part) .with(BeltBlock.PART, part)
.with(BeltBlock.HORIZONTAL_FACING, facing), .with(BeltBlock.HORIZONTAL_FACING, facing), 3);
3);
} }
} }
@ -178,7 +197,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
return false; return false;
BlockPos diff = second.subtract(first); BlockPos diff = second.subtract(first);
Axis axis = world.getBlockState(first).get(BlockStateProperties.AXIS); Axis axis = world.getBlockState(first)
.get(BlockStateProperties.AXIS);
int x = diff.getX(); int x = diff.getX();
int y = diff.getY(); int y = diff.getY();
@ -190,7 +210,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
return false; return false;
if (sames != 1) if (sames != 1)
return false; return false;
if (axis != world.getBlockState(second).get(BlockStateProperties.AXIS)) if (axis != world.getBlockState(second)
.get(BlockStateProperties.AXIS))
return false; return false;
TileEntity tileEntity = world.getTileEntity(first); TileEntity tileEntity = world.getTileEntity(first);
@ -213,7 +234,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
BlockState blockState = world.getBlockState(currentPos); BlockState blockState = world.getBlockState(currentPos);
if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == axis) if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == axis)
continue; continue;
if (!blockState.getMaterial().isReplaceable()) if (!blockState.getMaterial()
.isReplaceable())
return false; return false;
} }
@ -226,7 +248,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
return false; return false;
if (!ShaftBlock.isShaft(world.getBlockState(pos))) if (!ShaftBlock.isShaft(world.getBlockState(pos)))
return false; return false;
if (world.getBlockState(pos).get(BlockStateProperties.AXIS) == Axis.Y) if (world.getBlockState(pos)
.get(BlockStateProperties.AXIS) == Axis.Y)
return false; return false;
return true; return true;
} }

View file

@ -9,6 +9,10 @@ import net.minecraft.world.World;
public class ClutchBlock extends GearshiftBlock { public class ClutchBlock extends GearshiftBlock {
public ClutchBlock(Properties properties) {
super(properties);
}
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new ClutchTileEntity(); return new ClutchTileEntity();

View file

@ -1,12 +1,10 @@
package com.simibubi.create.modules.contraptions.relays.encased; package com.simibubi.create.modules.contraptions.relays.encased;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BlockStateProperties;
public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer { public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer {
@ -16,8 +14,7 @@ public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer {
@Override @Override
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, return shaft(getRotationAxisOf(te));
te.getBlockState().get(BlockStateProperties.AXIS));
} }
} }

View file

@ -9,7 +9,6 @@ import com.simibubi.create.modules.contraptions.relays.gearbox.GearshiftTileEnti
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
@ -27,8 +26,8 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTi
public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public GearshiftBlock() { public GearshiftBlock(Properties properties) {
super(Properties.from(Blocks.ANDESITE)); super(properties);
setDefaultState(getDefaultState().with(POWERED, false)); setDefaultState(getDefaultState().with(POWERED, false));
} }

View file

@ -25,7 +25,6 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
@Override @Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
Block block = te.getBlockState().getBlock(); Block block = te.getBlockState().getBlock();
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState()); final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
final BlockPos pos = te.getPos(); final BlockPos pos = te.getPos();

View file

@ -3,9 +3,7 @@ package com.simibubi.create.modules.contraptions.relays.gauge;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type; import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type;
@ -15,7 +13,6 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -37,8 +34,9 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
GaugeTileEntity gaugeTE = (GaugeTileEntity) te; GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), gaugeState, te.getPos()); int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), gaugeState, te.getPos());
SuperByteBuffer headBuffer = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED SuperByteBuffer headBuffer =
: AllBlockPartials.GAUGE_HEAD_STRESS).renderOn(gaugeState); (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS)
.renderOn(gaugeState);
SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState); SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState);
for (Direction facing : Direction.values()) { for (Direction facing : Direction.values()) {
@ -48,20 +46,22 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
float dialPivot = -5.75f / 16; float dialPivot = -5.75f / 16;
float progress = MathHelper.lerp(partialTicks, gaugeTE.prevDialState, gaugeTE.dialState); float progress = MathHelper.lerp(partialTicks, gaugeTE.prevDialState, gaugeTE.dialState);
dialBuffer.translate(0, dialPivot, dialPivot).rotate(Axis.X, (float) (Math.PI / 2 * -progress)).translate(0, dialBuffer.translate(0, dialPivot, dialPivot)
-dialPivot, -dialPivot); .rotate(Axis.X, (float) (Math.PI / 2 * -progress))
.translate(0, -dialPivot, -dialPivot);
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid()); IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
rotateBufferTowards(dialBuffer, facing).light(lightCoords).renderInto(ms, vb); rotateBufferTowards(dialBuffer, facing).light(lightCoords)
rotateBufferTowards(headBuffer, facing).light(lightCoords).renderInto(ms, vb); .renderInto(ms, vb);
rotateBufferTowards(headBuffer, facing).light(lightCoords)
.renderInto(ms, vb);
} }
} }
@Override @Override
protected BlockState getRenderedBlockState(KineticTileEntity te) { protected BlockState getRenderedBlockState(KineticTileEntity te) {
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, return shaft(getRotationAxisOf(te));
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
} }
protected SuperByteBuffer rotateBufferTowards(SuperByteBuffer buffer, Direction target) { protected SuperByteBuffer rotateBufferTowards(SuperByteBuffer buffer, Direction target) {

View file

@ -7,7 +7,6 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.PushReaction; import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
@ -25,8 +24,8 @@ import net.minecraft.world.storage.loot.LootContext.Builder;
public class GearboxBlock extends RotatedPillarKineticBlock { public class GearboxBlock extends RotatedPillarKineticBlock {
public GearboxBlock() { public GearboxBlock(Properties properties) {
super(Properties.from(Blocks.ANDESITE)); super(properties);
} }
@Override @Override
@ -42,7 +41,7 @@ public class GearboxBlock extends RotatedPillarKineticBlock {
@Override @Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) { public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
super.fillItemGroup(group, items); super.fillItemGroup(group, items);
items.add(new ItemStack(AllItems.VERTICAL_GEARBOX.get())); items.add(AllItems.VERTICAL_GEARBOX.asStack());
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View file

@ -1,30 +1,44 @@
package com.simibubi.create.modules.contraptions.relays.gearbox; package com.simibubi.create.modules.contraptions.relays.gearbox;
import com.simibubi.create.AllBlocks; import java.util.Map;
import com.simibubi.create.foundation.item.IAddedByOther;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.IRotate;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class VerticalGearboxItem extends BlockItem implements IAddedByOther { public class VerticalGearboxItem extends BlockItem {
public VerticalGearboxItem(Properties builder) { public VerticalGearboxItem(Properties builder) {
super(AllBlocks.GEARBOX.get(), builder); super(AllBlocksNew.GEARBOX.get(), builder);
}
@Override
public void fillItemGroup(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
}
@Override
public void addToBlockToItemMap(Map<Block, Item> p_195946_1_, Item p_195946_2_) {
} }
@Override @Override
protected boolean onBlockPlaced(BlockPos pos, World world, PlayerEntity player, ItemStack stack, BlockState state) { protected boolean onBlockPlaced(BlockPos pos, World world, PlayerEntity player, ItemStack stack, BlockState state) {
Axis prefferedAxis = null; Axis prefferedAxis = null;
for (Direction side : Direction.values()) { for (Direction side : Direction.values()) {
if (side.getAxis().isVertical()) if (side.getAxis()
.isVertical())
continue; continue;
BlockState blockState = world.getBlockState(pos.offset(side)); BlockState blockState = world.getBlockState(pos.offset(side));
if (blockState.getBlock() instanceof IRotate) { if (blockState.getBlock() instanceof IRotate) {
@ -39,8 +53,9 @@ public class VerticalGearboxItem extends BlockItem implements IAddedByOther {
} }
} }
Axis axis = prefferedAxis == null ? player.getHorizontalFacing().rotateY().getAxis() Axis axis = prefferedAxis == null ? player.getHorizontalFacing()
: prefferedAxis == Axis.X ? Axis.Z : Axis.X; .rotateY()
.getAxis() : prefferedAxis == Axis.X ? Axis.Z : Axis.X;
world.setBlockState(pos, state.with(BlockStateProperties.AXIS, axis)); world.setBlockState(pos, state.with(BlockStateProperties.AXIS, axis));
return super.onBlockPlaced(pos, world, player, stack, state); return super.onBlockPlaced(pos, world, player, stack, state);
} }

View file

@ -77,7 +77,7 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel
@Override @Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) { public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
if (group == Create.creativeTab) { if (group == Create.baseCreativeTab) {
ItemStack gunWithoutStuff = new ItemStack(this); ItemStack gunWithoutStuff = new ItemStack(this);
items.add(gunWithoutStuff); items.add(gunWithoutStuff);

View file

@ -0,0 +1,37 @@
package com.simibubi.create.modules.palettes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.Create;
import com.simibubi.create.CreateItemGroupBase;
import com.simibubi.create.modules.Sections;
import com.tterrag.registrate.util.entry.RegistryEntry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
public class PalettesItemGroup extends CreateItemGroupBase {
public PalettesItemGroup() {
super("palettes");
}
@Override
protected boolean shouldAdd(RegistryEntry<? extends Block> block) {
Sections section = Create.registrate()
.getSection(block);
return section == Sections.PALETTES;
}
@Override
protected boolean shouldAdd(AllItems item) {
return item.section == Sections.PALETTES;
}
@Override
public ItemStack createIcon() {
return new ItemStack(AllBlocks.IRON_GLASS.get());
}
}

View file

@ -1,10 +0,0 @@
{
"variants": {
"powered=true,axis=x": { "model": "create:block/clutch_on", "y": 90 },
"powered=true,axis=y": { "model": "create:block/clutch_on", "x": 90 },
"powered=true,axis=z": { "model": "create:block/clutch_on" },
"powered=false,axis=x": { "model": "create:block/clutch_off", "y": 90 },
"powered=false,axis=y": { "model": "create:block/clutch_off", "x": 90 },
"powered=false,axis=z": { "model": "create:block/clutch_off" }
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"axis=y": { "model": "create:block/gearbox" },
"axis=z": { "model": "create:block/gearbox", "x": 90 },
"axis=x": { "model": "create:block/gearbox", "x": 90, "y": 90 }
}
}

View file

@ -1,10 +0,0 @@
{
"variants": {
"powered=true,axis=x": { "model": "create:block/gearshift_on", "y": 90 },
"powered=true,axis=y": { "model": "create:block/gearshift_on", "x": 90 },
"powered=true,axis=z": { "model": "create:block/gearshift_on" },
"powered=false,axis=x": { "model": "create:block/gearshift_off", "y": 90 },
"powered=false,axis=y": { "model": "create:block/gearshift_off", "x": 90 },
"powered=false,axis=z": { "model": "create:block/gearshift_off" }
}
}

View file

@ -1221,5 +1221,6 @@
"tool.create.rose_quartz.tooltip": "ROSE QUARTZ TOOLS", "tool.create.rose_quartz.tooltip": "ROSE QUARTZ TOOLS",
"tool.create.rose_quartz.tooltip.summary": "This tool grants you a _greater_ _reach_ for _breaking_ _blocks_ or _placing_ _blocks_ from the off-hand.", "tool.create.rose_quartz.tooltip.summary": "This tool grants you a _greater_ _reach_ for _breaking_ _blocks_ or _placing_ _blocks_ from the off-hand.",
"itemGroup.create": "Create" "itemGroup.create.base": "Create",
"itemGroup.create.palettes": "Create Palettes"
} }

View file

@ -1,5 +1,5 @@
{ {
"parent": "create:block/gearshift_off", "parent": "create:block/gearshift/block",
"textures": { "textures": {
"0": "create:block/clutch_off", "0": "create:block/clutch_off",
"particle": "create:block/clutch_off" "particle": "create:block/clutch_off"

View file

@ -1,5 +1,5 @@
{ {
"parent": "create:block/gearshift_off", "parent": "create:block/clutch/block",
"textures": { "textures": {
"0": "create:block/clutch_on", "0": "create:block/clutch_on",
"particle": "create:block/clutch_on" "particle": "create:block/clutch_on"

Some files were not shown because too many files have changed in this diff Show more