From e669bb3b27bcfc617713d955d54f708c5c53b443 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Fri, 5 Jun 2020 23:26:22 +0200 Subject: [PATCH] Added Nixie Tubes --- src/generated/resources/.cache/cache | 9 +- .../assets/create/blockstates/nixie_tube.json | 38 +++ .../create/blockstates/radial_chassis.json | 24 +- .../resources/assets/create/lang/en_ud.json | 1 + .../resources/assets/create/lang/en_us.json | 8 +- .../assets/create/models/item/nixie_tube.json | 3 + .../create/loot_tables/blocks/nixie_tube.json | 19 ++ .../java/com/simibubi/create/AllBlocks.java | 89 ++++--- .../java/com/simibubi/create/AllShapes.java | 8 +- .../com/simibubi/create/AllTileEntities.java | 225 +++++++++--------- .../block/redstone/NixieTubeBlock.java | 111 +++++++++ .../block/redstone/NixieTubeGenerator.java | 30 +++ .../block/redstone/NixieTubeRenderer.java | 89 +++++++ .../block/redstone/NixieTubeTileEntity.java | 41 ++++ .../render/BakedModelBuiltInRenderer.java | 16 ++ .../item/PartialItemModelRenderer.java | 2 - .../assets/create/lang/default/tooltips.json | 7 +- .../create/models/block/nixie_tube/block.json | 83 +++++++ .../create/models/block/nixie_tube/item.json | 83 +++++++ .../create/textures/block/nixie_tube.png | Bin 0 -> 1024 bytes .../mechanical_crafting/nixie_tube.json | 18 ++ 21 files changed, 736 insertions(+), 168 deletions(-) create mode 100644 src/generated/resources/assets/create/blockstates/nixie_tube.json create mode 100644 src/generated/resources/assets/create/models/item/nixie_tube.json create mode 100644 src/generated/resources/data/create/loot_tables/blocks/nixie_tube.json create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeGenerator.java create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java create mode 100644 src/main/java/com/simibubi/create/foundation/block/render/BakedModelBuiltInRenderer.java create mode 100644 src/main/resources/assets/create/models/block/nixie_tube/block.json create mode 100644 src/main/resources/assets/create/models/block/nixie_tube/item.json create mode 100644 src/main/resources/assets/create/textures/block/nixie_tube.png create mode 100644 src/main/resources/data/create/recipes/mechanical_crafting/nixie_tube.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index fa5d3c11f..0dfd12300 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -192,6 +192,7 @@ a3ae5fb61cb07ae6fcb78ba68435bda8c31d4430 assets\create\blockstates\mossy_granite 3feafb33a6ba03687a521c1b196536c0427fff77 assets\create\blockstates\mossy_weathered_limestone.json b1126c191877cff86b4e2de83e1fcbd151451cb7 assets\create\blockstates\mysterious_cuckoo_clock.json 8d56251190c94204fa238ff32734a0761273669f assets\create\blockstates\natural_scoria.json +0f7635a4fec6961ec09788b3c5e3992ed1fdfde7 assets\create\blockstates\nixie_tube.json 36e46e65003a8d0b8555fe5e8f8dc980d6559bc5 assets\create\blockstates\nozzle.json cf60989f63f02067fc4e4ad25033ac83167cdeb0 assets\create\blockstates\oak_window.json 4a796509c3953171f04f957351282205840b3760 assets\create\blockstates\oak_window_pane.json @@ -272,7 +273,7 @@ b7829c2ef2c47188713f8cab21b2c9bc7f9c5b79 assets\create\blockstates\portable_stor e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets\create\blockstates\powered_toggle_latch.json 3a739f9d4276828d83f2d2750bf3227c87bcd438 assets\create\blockstates\pulley_magnet.json 469e430d96cb0a5e1aaf6b7cc5d401d488c9e600 assets\create\blockstates\pulse_repeater.json -4e1fb033316e9230d2f024d67c27940ea731643a assets\create\blockstates\radial_chassis.json +5c1df061eb5efe49beee7219e113206fc31a4733 assets\create\blockstates\radial_chassis.json 8929677f2cc5354aa19ef182af69f9f0b41eb242 assets\create\blockstates\redstone_contact.json c29213b77ac0c78d8979c5f6188d2b265696f9b9 assets\create\blockstates\redstone_link.json e2990fe70ad5d10437a376e70e167d1856277cc1 assets\create\blockstates\rope.json @@ -323,8 +324,8 @@ c60c3115fd6eeaa3a696428a87a74d184ab7d62d assets\create\blockstates\weathered_lim c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets\create\blockstates\weathered_limestone_pillar.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets\create\blockstates\zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets\create\blockstates\zinc_ore.json -bf385ee965d828085374a6a31614cf0fc04c0c0c assets\create\lang\en_ud.json -4524b8b3180676a54234d5c97c2bbda0f239b1d1 assets\create\lang\en_us.json +32c39a2fb42bb9ca9c6d51ca521ea36791b32448 assets\create\lang\en_ud.json +00207f0dea9dd779d33cb1ddd2690d1185caeb94 assets\create\lang\en_us.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets\create\models\block\acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets\create\models\block\acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets\create\models\block\acacia_window_pane_noside_alt.json @@ -1110,6 +1111,7 @@ ec459f0f04f75e5c2c27bdad0375adb9768d1ba1 assets\create\models\item\mossy_gabbro. f384d2e28309c54207bd1c33abff99d015d698bd assets\create\models\item\mossy_weathered_limestone.json dae5cffa4e1263d6a113469f79fba8695fa8232a assets\create\models\item\mysterious_cuckoo_clock.json b5c73d353fbe1d073f6a2901f221f178b858e385 assets\create\models\item\natural_scoria.json +bafe601f186e868819da3d29f7be7dc96f9ba790 assets\create\models\item\nixie_tube.json 366a60447bbbd61eb25aecf191a01e8d9417ad61 assets\create\models\item\nozzle.json 7a336a340f3e4927d7a35f9d79e8a03693b802aa assets\create\models\item\oak_window.json f274fe391ac584656c9817a5650b1c1e38e44c58 assets\create\models\item\oak_window_pane.json @@ -1861,6 +1863,7 @@ bd4ff2a38643d53cdc63e1af08af90e9adadcc0f data\create\loot_tables\blocks\mossy_gr fdff3d59c214ecbcc2ddcaef778ea661df128b56 data\create\loot_tables\blocks\mossy_weathered_limestone.json fedbee3e023d469c9f3aba9d11d5be6cdae77083 data\create\loot_tables\blocks\mysterious_cuckoo_clock.json ecd7afac9eb0989075fced6626e1061d5487c2f4 data\create\loot_tables\blocks\natural_scoria.json +d3ea271bb5774c73d44ab2e73195c9d5a4ff9c92 data\create\loot_tables\blocks\nixie_tube.json 6237eb3999181f1db09ca01b08e7785b70722d3b data\create\loot_tables\blocks\nozzle.json 0b2b142cfb3ebe9d4506e498a8e31f48d00db58d data\create\loot_tables\blocks\oak_window.json 90cc4d5857f47c48e2b82f394de9567023c5c8ce data\create\loot_tables\blocks\oak_window_pane.json diff --git a/src/generated/resources/assets/create/blockstates/nixie_tube.json b/src/generated/resources/assets/create/blockstates/nixie_tube.json new file mode 100644 index 000000000..aa96a9615 --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/nixie_tube.json @@ -0,0 +1,38 @@ +{ + "variants": { + "ceiling=false,facing=north": { + "model": "create:block/nixie_tube/block", + "y": 180 + }, + "ceiling=true,facing=north": { + "model": "create:block/nixie_tube/block", + "x": 180, + "y": 180 + }, + "ceiling=false,facing=south": { + "model": "create:block/nixie_tube/block" + }, + "ceiling=true,facing=south": { + "model": "create:block/nixie_tube/block", + "x": 180 + }, + "ceiling=false,facing=west": { + "model": "create:block/nixie_tube/block", + "y": 90 + }, + "ceiling=true,facing=west": { + "model": "create:block/nixie_tube/block", + "x": 180, + "y": 90 + }, + "ceiling=false,facing=east": { + "model": "create:block/nixie_tube/block", + "y": 270 + }, + "ceiling=true,facing=east": { + "model": "create:block/nixie_tube/block", + "x": 180, + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/radial_chassis.json b/src/generated/resources/assets/create/blockstates/radial_chassis.json index 80ab92133..7a1df3438 100644 --- a/src/generated/resources/assets/create/blockstates/radial_chassis.json +++ b/src/generated/resources/assets/create/blockstates/radial_chassis.json @@ -29,8 +29,8 @@ }, { "when": { - "axis": "x", - "sticky_south": "true" + "sticky_south": "true", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -39,8 +39,8 @@ }, { "when": { - "axis": "y", - "sticky_south": "true" + "sticky_south": "true", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky" @@ -48,8 +48,8 @@ }, { "when": { - "axis": "z", - "sticky_south": "true" + "sticky_south": "true", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -59,8 +59,8 @@ }, { "when": { - "axis": "x", - "sticky_south": "false" + "sticky_south": "false", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -69,8 +69,8 @@ }, { "when": { - "axis": "y", - "sticky_south": "false" + "sticky_south": "false", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y" @@ -78,8 +78,8 @@ }, { "when": { - "axis": "z", - "sticky_south": "false" + "sticky_south": "false", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_x", diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index 8d5f4b5a0..c30a188a7 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -193,6 +193,7 @@ "block.create.mossy_weathered_limestone": "\u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM \u028EssoW", "block.create.mysterious_cuckoo_clock": "\u029E\u0254o\u05DF\u0186 oo\u029E\u0254n\u0186", "block.create.natural_scoria": "\u0250\u0131\u0279o\u0254S \u05DF\u0250\u0279n\u0287\u0250N", + "block.create.nixie_tube": "\u01DDqn\u27D8 \u01DD\u0131x\u0131N", "block.create.nozzle": "\u01DD\u05DFzzoN", "block.create.oak_window": "\u028Dopu\u0131M \u029E\u0250O", "block.create.oak_window_pane": "\u01DDu\u0250\u0500 \u028Dopu\u0131M \u029E\u0250O", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 3dfe691e0..9e9830c7d 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -196,6 +196,7 @@ "block.create.mossy_weathered_limestone": "Mossy Weathered Limestone", "block.create.mysterious_cuckoo_clock": "Cuckoo Clock", "block.create.natural_scoria": "Natural Scoria", + "block.create.nixie_tube": "Nixie Tube", "block.create.nozzle": "Nozzle", "block.create.oak_window": "Oak Window", "block.create.oak_window_pane": "Oak Window Pane", @@ -1167,7 +1168,12 @@ "block.create.redstone_link.tooltip.control2": "When R-Clicked while Sneaking", "block.create.redstone_link.tooltip.action2": "Toggles between _Receiver_ and _Transmitter_ Mode.", - "block.create.redstone_contact.tooltip": "REDSTONE redstone_contact", + "block.create.nixie_tube.tooltip": "NIXIE TUBE", + "block.create.nixie_tube.tooltip.summary": "A fancy redstone-powered _Number_ _Display_ ranging from 0 to 15.", + "block.create.nixie_tube.tooltip.condition1": "When Powered", + "block.create.nixie_tube.tooltip.behaviour1": "Shows the current redstone _Signal_ _Strength_ as its displayed value.", + + "block.create.redstone_contact.tooltip": "REDSTONE CONTACT", "block.create.redstone_contact.tooltip.summary": "Only emits redstone power in pairs. It is movable with _Mechanical_ _Pistons_, _Bearings_ or other controllers.", "block.create.redstone_contact.tooltip.condition1": "When facing other redstone_contact", "block.create.redstone_contact.tooltip.behaviour1": "Provides a _Redstone_ _Signal_.", diff --git a/src/generated/resources/assets/create/models/item/nixie_tube.json b/src/generated/resources/assets/create/models/item/nixie_tube.json new file mode 100644 index 000000000..4db27f523 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/nixie_tube.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/nixie_tube/item" +} \ No newline at end of file diff --git a/src/generated/resources/data/create/loot_tables/blocks/nixie_tube.json b/src/generated/resources/data/create/loot_tables/blocks/nixie_tube.json new file mode 100644 index 000000000..68e7a85d0 --- /dev/null +++ b/src/generated/resources/data/create/loot_tables/blocks/nixie_tube.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "create:nixie_tube" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 729e9b1ac..41e15e03b 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -85,6 +85,8 @@ import com.simibubi.create.content.logistics.block.funnel.VerticalFunnelGenerato import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; import com.simibubi.create.content.logistics.block.inventories.CreativeCrateBlock; import com.simibubi.create.content.logistics.block.redstone.AnalogLeverBlock; +import com.simibubi.create.content.logistics.block.redstone.NixieTubeBlock; +import com.simibubi.create.content.logistics.block.redstone.NixieTubeGenerator; import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkGenerator; @@ -248,13 +250,14 @@ public class AllBlocks { .blockstate(new BeltGenerator()::generate) .register(); - public static final BlockEntry CREATIVE_MOTOR = REGISTRATE.block("creative_motor", CreativeMotorBlock::new) - .initialProperties(SharedProperties::stone) - .blockstate(new CreativeMotorGenerator()::generate) - .transform(StressConfigDefaults.setCapacity(16384.0)) - .item() - .transform(customItemModel()) - .register(); + public static final BlockEntry CREATIVE_MOTOR = + REGISTRATE.block("creative_motor", CreativeMotorBlock::new) + .initialProperties(SharedProperties::stone) + .blockstate(new CreativeMotorGenerator()::generate) + .transform(StressConfigDefaults.setCapacity(16384.0)) + .item() + .transform(customItemModel()) + .register(); public static final BlockEntry WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new) .initialProperties(SharedProperties::wooden) @@ -523,19 +526,21 @@ public class AllBlocks { .simpleItem() .register(); - public static final BlockEntry MECHANICAL_HARVESTER = REGISTRATE.block("mechanical_harvester", HarvesterBlock::new) - .initialProperties(SharedProperties::stone) - .blockstate(BlockStateGen.horizontalBlockProvider(true)) - .addLayer(() -> RenderType::getCutoutMipped) - .item() - .transform(customItemModel()) - .register(); + public static final BlockEntry MECHANICAL_HARVESTER = + REGISTRATE.block("mechanical_harvester", HarvesterBlock::new) + .initialProperties(SharedProperties::stone) + .blockstate(BlockStateGen.horizontalBlockProvider(true)) + .addLayer(() -> RenderType::getCutoutMipped) + .item() + .transform(customItemModel()) + .register(); - public static final BlockEntry MECHANICAL_PLOUGH = REGISTRATE.block("mechanical_plough", PloughBlock::new) - .initialProperties(SharedProperties::stone) - .blockstate(BlockStateGen.horizontalBlockProvider(false)) - .simpleItem() - .register(); + public static final BlockEntry MECHANICAL_PLOUGH = + REGISTRATE.block("mechanical_plough", PloughBlock::new) + .initialProperties(SharedProperties::stone) + .blockstate(BlockStateGen.horizontalBlockProvider(false)) + .simpleItem() + .register(); public static final BlockEntry ANDESITE_CASING = REGISTRATE.block("andesite_casing", CasingBlock::new) .transform(BuilderTransformers.casing(AllSpriteShifts.ANDESITE_CASING)) @@ -621,6 +626,15 @@ public class AllBlocks { .transform(customItemModel("_", "transmitter")) .register(); + public static final BlockEntry NIXIE_TUBE = REGISTRATE.block("nixie_tube", NixieTubeBlock::new) + .initialProperties(SharedProperties::softMetal) + .properties(p -> p.lightValue(5)) + .blockstate(new NixieTubeGenerator()::generate) + .addLayer(() -> RenderType::getTranslucent) + .item() + .transform(customItemModel()) + .register(); + public static final BlockEntry STOCKPILE_SWITCH = REGISTRATE.block("stockpile_switch", StockpileSwitchBlock::new) .initialProperties(SharedProperties::stone) @@ -675,15 +689,14 @@ public class AllBlocks { .loot((p, b) -> p.registerDropping(b, EXTRACTOR.get())) .register(); - public static final BlockEntry LINKED_EXTRACTOR = - REGISTRATE.block("linked_extractor", LinkedExtractorBlock::new) - .initialProperties(SharedProperties::softMetal) - .addLayer(() -> RenderType::getCutoutMipped) - .blockstate( - (c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, "extractor/horizontal_linked"))) - .item() - .transform(customItemModel("extractor", "horizontal_linked")) - .register(); + public static final BlockEntry LINKED_EXTRACTOR = REGISTRATE + .block("linked_extractor", LinkedExtractorBlock::new) + .initialProperties(SharedProperties::softMetal) + .addLayer(() -> RenderType::getCutoutMipped) + .blockstate((c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, "extractor/horizontal_linked"))) + .item() + .transform(customItemModel("extractor", "horizontal_linked")) + .register(); public static final BlockEntry VERTICAL_LINKED_EXTRACTOR = REGISTRATE.block("vertical_linked_extractor", LinkedExtractorBlock.Vertical::new) @@ -722,15 +735,15 @@ public class AllBlocks { .loot((p, b) -> p.registerDropping(b, TRANSPOSER.get())) .register(); - public static final BlockEntry LINKED_TRANSPOSER = REGISTRATE - .block("linked_transposer", LinkedTransposerBlock::new) - .initialProperties(SharedProperties::softMetal) - .addLayer(() -> RenderType::getCutoutMipped) - .blockstate( - (c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, "transposer/horizontal_linked"), 180)) - .item() - .transform(customItemModel("transposer", "horizontal_linked")) - .register(); + public static final BlockEntry LINKED_TRANSPOSER = + REGISTRATE.block("linked_transposer", LinkedTransposerBlock::new) + .initialProperties(SharedProperties::softMetal) + .addLayer(() -> RenderType::getCutoutMipped) + .blockstate( + (c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, "transposer/horizontal_linked"), 180)) + .item() + .transform(customItemModel("transposer", "horizontal_linked")) + .register(); public static final BlockEntry VERTICAL_LINKED_TRANSPOSER = REGISTRATE.block("vertical_linked_transposer", LinkedTransposerBlock.Vertical::new) @@ -847,7 +860,7 @@ public class AllBlocks { .register(); // Load this class - + public static void register() {} } diff --git a/src/main/java/com/simibubi/create/AllShapes.java b/src/main/java/com/simibubi/create/AllShapes.java index a780567e4..20597aad8 100644 --- a/src/main/java/com/simibubi/create/AllShapes.java +++ b/src/main/java/com/simibubi/create/AllShapes.java @@ -58,7 +58,13 @@ public class AllShapes { STOCKPILE_SWITCH = shape(0, 0, 0, 16, 2, 16).add(1, 0, 1, 15, 16, 15) .add(0, 14, 0, 16, 16, 16) .add(3, 3, -1, 13, 13, 2) - .forHorizontal(NORTH) + .forHorizontal(NORTH), + NIXIE_TUBE = shape(0, 0, 0, 16, 4, 16).add(9, 0, 5, 15, 15, 11) + .add(1, 0, 5, 7, 15, 11) + .forHorizontalAxis(), + NIXIE_TUBE_CEILING = shape(0, 12, 0, 16, 16, 16).add(9, 1, 5, 15, 16, 11) + .add(1, 1, 5, 7, 16, 11) + .forHorizontalAxis() ; diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 0ac617bd1..bb608778d 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -78,6 +78,8 @@ import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateTi import com.simibubi.create.content.logistics.block.inventories.CreativeCrateTileEntity; import com.simibubi.create.content.logistics.block.redstone.AnalogLeverRenderer; import com.simibubi.create.content.logistics.block.redstone.AnalogLeverTileEntity; +import com.simibubi.create.content.logistics.block.redstone.NixieTubeRenderer; +import com.simibubi.create.content.logistics.block.redstone.NixieTubeTileEntity; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkTileEntity; import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchTileEntity; import com.simibubi.create.content.logistics.block.transposer.LinkedTransposerTileEntity; @@ -102,126 +104,128 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; public class AllTileEntities { // Schematics - public static final TileEntityEntry SCHEMATICANNON = register( - "schematicannon", SchematicannonTileEntity::new, AllBlocks.SCHEMATICANNON); - public static final TileEntityEntry SCHEMATIC_TABLE = register( - "schematic_table", SchematicTableTileEntity::new, AllBlocks.SCHEMATIC_TABLE); + public static final TileEntityEntry SCHEMATICANNON = + register("schematicannon", SchematicannonTileEntity::new, AllBlocks.SCHEMATICANNON); + public static final TileEntityEntry SCHEMATIC_TABLE = + register("schematic_table", SchematicTableTileEntity::new, AllBlocks.SCHEMATIC_TABLE); // Kinetics - public static final TileEntityEntry SIMPLE_KINETIC = register( - "simple_kinetic", SimpleKineticTileEntity::new, AllBlocks.SHAFT, AllBlocks.COGWHEEL, + public static final TileEntityEntry SIMPLE_KINETIC = + register("simple_kinetic", SimpleKineticTileEntity::new, AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL, AllBlocks.ENCASED_SHAFT); - public static final TileEntityEntry MOTOR = register( - "motor", CreativeMotorTileEntity::new, AllBlocks.CREATIVE_MOTOR); - public static final TileEntityEntry GEARBOX = register( - "gearbox", GearboxTileEntity::new, AllBlocks.GEARBOX); - public static final TileEntityEntry ENCASED_SHAFT = register( - "encased_shaft", EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT); - public static final TileEntityEntry ADJUSTABLE_PULLEY = register( - "adjustable_pulley", AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY); - public static final TileEntityEntry ENCASED_FAN = register( - "encased_fan", EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN); - public static final TileEntityEntry NOZZLE = register( - "nozzle", NozzleTileEntity::new, AllBlocks.NOZZLE); - public static final TileEntityEntry CLUTCH = register( - "clutch", ClutchTileEntity::new, AllBlocks.CLUTCH); - public static final TileEntityEntry GEARSHIFT = register( - "gearshift", GearshiftTileEntity::new, AllBlocks.GEARSHIFT); - public static final TileEntityEntry TURNTABLE = register( - "turntable", TurntableTileEntity::new, AllBlocks.TURNTABLE); - public static final TileEntityEntry HAND_CRANK = register( - "hand_crank", HandCrankTileEntity::new, AllBlocks.HAND_CRANK); - public static final TileEntityEntry CUCKOO_CLOCK = register( - "cuckoo_clock", CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK); + public static final TileEntityEntry MOTOR = + register("motor", CreativeMotorTileEntity::new, AllBlocks.CREATIVE_MOTOR); + public static final TileEntityEntry GEARBOX = + register("gearbox", GearboxTileEntity::new, AllBlocks.GEARBOX); + public static final TileEntityEntry ENCASED_SHAFT = + register("encased_shaft", EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT); + public static final TileEntityEntry ADJUSTABLE_PULLEY = + register("adjustable_pulley", AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY); + public static final TileEntityEntry ENCASED_FAN = + register("encased_fan", EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN); + public static final TileEntityEntry NOZZLE = + register("nozzle", NozzleTileEntity::new, AllBlocks.NOZZLE); + public static final TileEntityEntry CLUTCH = + register("clutch", ClutchTileEntity::new, AllBlocks.CLUTCH); + public static final TileEntityEntry GEARSHIFT = + register("gearshift", GearshiftTileEntity::new, AllBlocks.GEARSHIFT); + public static final TileEntityEntry TURNTABLE = + register("turntable", TurntableTileEntity::new, AllBlocks.TURNTABLE); + public static final TileEntityEntry HAND_CRANK = + register("hand_crank", HandCrankTileEntity::new, AllBlocks.HAND_CRANK); + public static final TileEntityEntry CUCKOO_CLOCK = + register("cuckoo_clock", CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK); - public static final TileEntityEntry BELT = register( - "belt", BeltTileEntity::new, AllBlocks.BELT); - public static final TileEntityEntry BELT_TUNNEL = register( - "belt_tunnel", BeltTunnelTileEntity::new, AllBlocks.BELT_TUNNEL); - public static final TileEntityEntry MECHANICAL_PISTON = register( - "mechanical_piston", MechanicalPistonTileEntity::new, AllBlocks.MECHANICAL_PISTON, - AllBlocks.STICKY_MECHANICAL_PISTON); - public static final TileEntityEntry MECHANICAL_BEARING = register( - "mechanical_bearing", MechanicalBearingTileEntity::new, AllBlocks.MECHANICAL_BEARING); - public static final TileEntityEntry CLOCKWORK_BEARING = register( - "clockwork_bearing", ClockworkBearingTileEntity::new, AllBlocks.CLOCKWORK_BEARING); - public static final TileEntityEntry ROPE_PULLEY = register( - "rope_pulley", PulleyTileEntity::new, AllBlocks.ROPE_PULLEY); - public static final TileEntityEntry CHASSIS = register( - "chassis", ChassisTileEntity::new, AllBlocks.RADIAL_CHASSIS, AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS); - public static final TileEntityEntry DRILL = register( - "drill", DrillTileEntity::new, AllBlocks.MECHANICAL_DRILL); - public static final TileEntityEntry SAW = register( - "saw", SawTileEntity::new, AllBlocks.MECHANICAL_SAW); - public static final TileEntityEntry HARVESTER = register( - "harvester", HarvesterTileEntity::new, AllBlocks.MECHANICAL_HARVESTER); - public static final TileEntityEntry FLYWHEEL = register( - "flywheel", FlywheelTileEntity::new, AllBlocks.FLYWHEEL); - public static final TileEntityEntry FURNACE_ENGINE = register( - "furnace_engine", FurnaceEngineTileEntity::new, AllBlocks.FURNACE_ENGINE); + public static final TileEntityEntry BELT = register("belt", BeltTileEntity::new, AllBlocks.BELT); + public static final TileEntityEntry BELT_TUNNEL = + register("belt_tunnel", BeltTunnelTileEntity::new, AllBlocks.BELT_TUNNEL); + public static final TileEntityEntry MECHANICAL_PISTON = register("mechanical_piston", + MechanicalPistonTileEntity::new, AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON); + public static final TileEntityEntry MECHANICAL_BEARING = + register("mechanical_bearing", MechanicalBearingTileEntity::new, AllBlocks.MECHANICAL_BEARING); + public static final TileEntityEntry CLOCKWORK_BEARING = + register("clockwork_bearing", ClockworkBearingTileEntity::new, AllBlocks.CLOCKWORK_BEARING); + public static final TileEntityEntry ROPE_PULLEY = + register("rope_pulley", PulleyTileEntity::new, AllBlocks.ROPE_PULLEY); + public static final TileEntityEntry CHASSIS = register("chassis", ChassisTileEntity::new, + AllBlocks.RADIAL_CHASSIS, AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS); + public static final TileEntityEntry DRILL = + register("drill", DrillTileEntity::new, AllBlocks.MECHANICAL_DRILL); + public static final TileEntityEntry SAW = + register("saw", SawTileEntity::new, AllBlocks.MECHANICAL_SAW); + public static final TileEntityEntry HARVESTER = + register("harvester", HarvesterTileEntity::new, AllBlocks.MECHANICAL_HARVESTER); + public static final TileEntityEntry FLYWHEEL = + register("flywheel", FlywheelTileEntity::new, AllBlocks.FLYWHEEL); + public static final TileEntityEntry FURNACE_ENGINE = + register("furnace_engine", FurnaceEngineTileEntity::new, AllBlocks.FURNACE_ENGINE); - public static final TileEntityEntry MILLSTONE = register( - "millstone", MillstoneTileEntity::new, AllBlocks.MILLSTONE); - public static final TileEntityEntry CRUSHING_WHEEL = register( - "crushing_wheel", CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL); + public static final TileEntityEntry MILLSTONE = + register("millstone", MillstoneTileEntity::new, AllBlocks.MILLSTONE); + public static final TileEntityEntry CRUSHING_WHEEL = + register("crushing_wheel", CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL); public static final TileEntityEntry CRUSHING_WHEEL_CONTROLLER = register( - "crushing_wheel_controller", CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER); - public static final TileEntityEntry WATER_WHEEL = register( - "water_wheel", WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL); - public static final TileEntityEntry MECHANICAL_PRESS = register( - "mechanical_press", MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS); - public static final TileEntityEntry MECHANICAL_MIXER = register( - "mechanical_mixer", MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER); - public static final TileEntityEntry DEPLOYER = register( - "deployer", DeployerTileEntity::new, AllBlocks.DEPLOYER); - public static final TileEntityEntry BASIN = register( - "basin", BasinTileEntity::new, AllBlocks.BASIN); - public static final TileEntityEntry MECHANICAL_CRAFTER = register( - "mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER); - public static final TileEntityEntry SEQUENCED_GEARSHIFT = register( - "sequenced_gearshift", SequencedGearshiftTileEntity::new, AllBlocks.SEQUENCED_GEARSHIFT); - public static final TileEntityEntry ROTATION_SPEED_CONTROLLER = register( - "rotation_speed_controller", SpeedControllerTileEntity::new, AllBlocks.ROTATION_SPEED_CONTROLLER); - public static final TileEntityEntry SPEEDOMETER = register( - "speedometer", SpeedGaugeTileEntity::new, AllBlocks.SPEEDOMETER); - public static final TileEntityEntry STRESSOMETER = register( - "stressometer", StressGaugeTileEntity::new, AllBlocks.STRESSOMETER); - public static final TileEntityEntry ANALOG_LEVER = register( - "analog_lever", AnalogLeverTileEntity::new, AllBlocks.ANALOG_LEVER); - public static final TileEntityEntry CART_ASSEMBLER = register( - "cart_assembler", CartAssemblerTileEntity::new, AllBlocks.CART_ASSEMBLER); + "crushing_wheel_controller", CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER); + public static final TileEntityEntry WATER_WHEEL = + register("water_wheel", WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL); + public static final TileEntityEntry MECHANICAL_PRESS = + register("mechanical_press", MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS); + public static final TileEntityEntry MECHANICAL_MIXER = + register("mechanical_mixer", MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER); + public static final TileEntityEntry DEPLOYER = + register("deployer", DeployerTileEntity::new, AllBlocks.DEPLOYER); + public static final TileEntityEntry BASIN = + register("basin", BasinTileEntity::new, AllBlocks.BASIN); + public static final TileEntityEntry MECHANICAL_CRAFTER = + register("mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER); + public static final TileEntityEntry SEQUENCED_GEARSHIFT = + register("sequenced_gearshift", SequencedGearshiftTileEntity::new, AllBlocks.SEQUENCED_GEARSHIFT); + public static final TileEntityEntry ROTATION_SPEED_CONTROLLER = + register("rotation_speed_controller", SpeedControllerTileEntity::new, AllBlocks.ROTATION_SPEED_CONTROLLER); + public static final TileEntityEntry SPEEDOMETER = + register("speedometer", SpeedGaugeTileEntity::new, AllBlocks.SPEEDOMETER); + public static final TileEntityEntry STRESSOMETER = + register("stressometer", StressGaugeTileEntity::new, AllBlocks.STRESSOMETER); + public static final TileEntityEntry ANALOG_LEVER = + register("analog_lever", AnalogLeverTileEntity::new, AllBlocks.ANALOG_LEVER); + public static final TileEntityEntry CART_ASSEMBLER = + register("cart_assembler", CartAssemblerTileEntity::new, AllBlocks.CART_ASSEMBLER); // Logistics - public static final TileEntityEntry REDSTONE_LINK = register( - "redstone_link", RedstoneLinkTileEntity::new, AllBlocks.REDSTONE_LINK); - public static final TileEntityEntry STOCKPILE_SWITCH = register( - "stockpile_switch", StockpileSwitchTileEntity::new, AllBlocks.STOCKPILE_SWITCH); - public static final TileEntityEntry ADJUSTABLE_CRATE = register( - "adjustable_crate", AdjustableCrateTileEntity::new, AllBlocks.ADJUSTABLE_CRATE); - public static final TileEntityEntry CREATIVE_CRATE = register( - "creative_crate", CreativeCrateTileEntity::new, AllBlocks.CREATIVE_CRATE); - public static final TileEntityEntry EXTRACTOR = register( - "extractor", ExtractorTileEntity::new, AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR); - public static final TileEntityEntry LINKED_EXTRACTOR = register( - "linked_extractor", LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR); - public static final TileEntityEntry TRANSPOSER = register( - "transposer", TransposerTileEntity::new, AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER); - public static final TileEntityEntry LINKED_TRANSPOSER = register( - "linked_transposer", LinkedTransposerTileEntity::new, AllBlocks.LINKED_TRANSPOSER, AllBlocks.VERTICAL_LINKED_TRANSPOSER); - public static final TileEntityEntry FUNNEL = register( - "funnel", FunnelTileEntity::new, AllBlocks.FUNNEL, AllBlocks.VERTICAL_FUNNEL); - public static final TileEntityEntry BELT_OBSERVER = register( - "belt_observer", BeltObserverTileEntity::new, AllBlocks.BELT_OBSERVER); - public static final TileEntityEntry ADJUSTABLE_REPEATER = register( - "adjustable_repeater", AdjustableRepeaterTileEntity::new, AllBlocks.ADJUSTABLE_REPEATER); + public static final TileEntityEntry REDSTONE_LINK = + register("redstone_link", RedstoneLinkTileEntity::new, AllBlocks.REDSTONE_LINK); + public static final TileEntityEntry NIXIE_TUBE = + register("nixie_tube", NixieTubeTileEntity::new, AllBlocks.NIXIE_TUBE); + public static final TileEntityEntry STOCKPILE_SWITCH = + register("stockpile_switch", StockpileSwitchTileEntity::new, AllBlocks.STOCKPILE_SWITCH); + public static final TileEntityEntry ADJUSTABLE_CRATE = + register("adjustable_crate", AdjustableCrateTileEntity::new, AllBlocks.ADJUSTABLE_CRATE); + public static final TileEntityEntry CREATIVE_CRATE = + register("creative_crate", CreativeCrateTileEntity::new, AllBlocks.CREATIVE_CRATE); + public static final TileEntityEntry EXTRACTOR = + register("extractor", ExtractorTileEntity::new, AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR); + public static final TileEntityEntry LINKED_EXTRACTOR = register("linked_extractor", + LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR); + public static final TileEntityEntry TRANSPOSER = + register("transposer", TransposerTileEntity::new, AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER); + public static final TileEntityEntry LINKED_TRANSPOSER = register("linked_transposer", + LinkedTransposerTileEntity::new, AllBlocks.LINKED_TRANSPOSER, AllBlocks.VERTICAL_LINKED_TRANSPOSER); + public static final TileEntityEntry FUNNEL = + register("funnel", FunnelTileEntity::new, AllBlocks.FUNNEL, AllBlocks.VERTICAL_FUNNEL); + public static final TileEntityEntry BELT_OBSERVER = + register("belt_observer", BeltObserverTileEntity::new, AllBlocks.BELT_OBSERVER); + public static final TileEntityEntry ADJUSTABLE_REPEATER = + register("adjustable_repeater", AdjustableRepeaterTileEntity::new, AllBlocks.ADJUSTABLE_REPEATER); public static final TileEntityEntry ADJUSTABLE_PULSE_REPEATER = register( - "adjustable_pulse_repeater", AdjustablePulseRepeaterTileEntity::new, AllBlocks.ADJUSTABLE_PULSE_REPEATER); + "adjustable_pulse_repeater", AdjustablePulseRepeaterTileEntity::new, AllBlocks.ADJUSTABLE_PULSE_REPEATER); @SafeVarargs - public static TileEntityEntry register(String name, NonNullFunction, ? extends T> supplier, NonNullSupplier... blocks) { - return Create.registrate().tileEntity(name, supplier) - .validBlocks(blocks) - .register(); + public static TileEntityEntry register(String name, + NonNullFunction, ? extends T> supplier, NonNullSupplier... blocks) { + return Create.registrate() + .tileEntity(name, supplier) + .validBlocks(blocks) + .register(); } // TODO move to TileEntityBuilder#renderer @@ -268,6 +272,7 @@ public class AllTileEntities { bind(CREATIVE_CRATE, SmartTileEntityRenderer::new); bind(REDSTONE_LINK, SmartTileEntityRenderer::new); + bind(NIXIE_TUBE, NixieTubeRenderer::new); bind(EXTRACTOR, SmartTileEntityRenderer::new); bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new); bind(TRANSPOSER, SmartTileEntityRenderer::new); @@ -284,6 +289,6 @@ public class AllTileEntities { Function> renderer) { ClientRegistry.bindTileEntityRenderer(type.get(), renderer); } - + public static void register() {} } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java new file mode 100644 index 000000000..0efc5957e --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java @@ -0,0 +1,111 @@ +package com.simibubi.create.content.logistics.block.redstone; + +import com.simibubi.create.AllShapes; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.Iterate; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.HorizontalBlock; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class NixieTubeBlock extends HorizontalBlock implements ITE { + + public static final BooleanProperty CEILING = BooleanProperty.create("ceiling"); + + public NixieTubeBlock(Properties properties) { + super(properties); + setDefaultState(getDefaultState().with(CEILING, false)); + } + + @Override + protected void fillStateContainer(Builder builder) { + super.fillStateContainer(builder.add(CEILING, HORIZONTAL_FACING)); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, + ISelectionContext p_220053_4_) { + return (state.get(CEILING) ? AllShapes.NIXIE_TUBE_CEILING : AllShapes.NIXIE_TUBE) + .get(state.get(HORIZONTAL_FACING) + .getAxis()); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + BlockPos pos = context.getPos(); + boolean ceiling = context.getFace() == Direction.DOWN; + Vec3d hitVec = context.getHitVec(); + if (hitVec != null) + ceiling = hitVec.y - pos.getY() > .5f; + return getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing() + .getOpposite()) + .with(CEILING, ceiling); + } + + @Override + public void neighborChanged(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, + BlockPos p_220069_5_, boolean p_220069_6_) { + updateDisplayedValue(p_220069_1_, p_220069_2_, p_220069_3_); + } + + @Override + public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + updateDisplayedValue(state, worldIn, pos); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new NixieTubeTileEntity(AllTileEntities.NIXIE_TUBE.get()); + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + private void updateDisplayedValue(BlockState state, World worldIn, BlockPos pos) { + if (worldIn.isRemote) + return; + int power = getPower(worldIn, pos); + String display = (power < 10 ? "0" : "") + power; + withTileEntityDo(worldIn, pos, te -> te.display(display.charAt(0), display.charAt(1))); + } + + static boolean isValidBlock(IBlockReader world, BlockPos pos, boolean above) { + BlockState state = world.getBlockState(pos.up(above ? 1 : -1)); + return !state.getShape(world, pos) + .isEmpty(); + } + + private int getPower(World worldIn, BlockPos pos) { + int power = 0; + for (Direction direction : Iterate.directions) + power = Math.max(worldIn.getRedstonePower(pos.offset(direction), direction), power); + for (Direction direction : Iterate.directions) + power = Math.max(worldIn.getRedstonePower(pos.offset(direction), Direction.UP), power); + return power; + } + + @Override + public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) { + return side != null; + } + + @Override + public Class getTileEntityClass() { + return NixieTubeTileEntity.class; + } + +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeGenerator.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeGenerator.java new file mode 100644 index 000000000..a27658395 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeGenerator.java @@ -0,0 +1,30 @@ +package com.simibubi.create.content.logistics.block.redstone; + +import com.simibubi.create.foundation.data.AssetLookup; +import com.simibubi.create.foundation.data.SpecialBlockStateGen; +import com.tterrag.registrate.providers.DataGenContext; +import com.tterrag.registrate.providers.RegistrateBlockstateProvider; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraftforge.client.model.generators.ModelFile; + +public class NixieTubeGenerator extends SpecialBlockStateGen { + + @Override + protected int getXRotation(BlockState state) { + return state.get(NixieTubeBlock.CEILING) ? 180 : 0; + } + + @Override + protected int getYRotation(BlockState state) { + return horizontalAngle(state.get(NixieTubeBlock.HORIZONTAL_FACING)); + } + + @Override + public ModelFile getModel(DataGenContext ctx, RegistrateBlockstateProvider prov, + BlockState state) { + return AssetLookup.partialBaseModel(ctx, prov); + } + +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java new file mode 100644 index 000000000..5993f4d04 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeRenderer.java @@ -0,0 +1,89 @@ +package com.simibubi.create.content.logistics.block.redstone; + +import java.util.Random; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.ColorHelper; +import com.simibubi.create.foundation.utility.MatrixStacker; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; + +public class NixieTubeRenderer extends SafeTileEntityRenderer { + + Random r = new Random(); + + public NixieTubeRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + + @Override + protected void renderSafe(NixieTubeTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, + int light, int overlay) { + + ms.push(); + BlockState blockState = te.getBlockState(); + MatrixStacker.of(ms) + .centre() + .rotateY(AngleHelper.horizontalAngle(blockState + .get(NixieTubeBlock.HORIZONTAL_FACING))); + + float height = blockState.get(NixieTubeBlock.CEILING) ? 2 : 6; + float scale = 1 / 20f; + + ms.push(); + ms.translate(-4/16f, 0, 0); + ms.scale(scale, -scale, scale); + drawTube(ms, buffer, te.tube1, height); + ms.pop(); + + ms.push(); + ms.translate(4/16f, 0, 0); + ms.scale(scale, -scale, scale); + drawTube(ms, buffer, te.tube2, height); + ms.pop(); + + ms.pop(); + } + + private void drawTube(MatrixStack ms, IRenderTypeBuffer buffer, char c, float height) { + FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; + float charWidth = fontRenderer.getCharWidth(c); + float shadowOffset = .5f; + float flicker = r.nextFloat(); + int brightColor = 0xFF982B; + int darkColor = 0xE03221; + int flickeringBrightColor = ColorHelper.mixColors(brightColor, darkColor, flicker / 4); + + ms.push(); + ms.translate((charWidth - shadowOffset) / -2f, -height, 0); + drawChar(ms, buffer, c, flickeringBrightColor); + ms.push(); + ms.translate(shadowOffset, shadowOffset, -1/16f); + drawChar(ms, buffer, c, darkColor); + ms.pop(); + ms.pop(); + + ms.push(); + ms.scale(-1, 1, 1); + ms.translate((charWidth - shadowOffset) / -2f, -height, 0); + drawChar(ms, buffer, c, darkColor); + ms.push(); + ms.translate(-shadowOffset, shadowOffset, -1/16f); + drawChar(ms, buffer, c, 0x99180F); + ms.pop(); + ms.pop(); + } + + private static void drawChar(MatrixStack ms, IRenderTypeBuffer buffer, char c, int color) { + FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; + fontRenderer.draw(String.valueOf(c), 0, 0, color, false, ms.peek() + .getModel(), buffer, false, 0, 15728880); + } + +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java new file mode 100644 index 000000000..a8d7ac454 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java @@ -0,0 +1,41 @@ +package com.simibubi.create.content.logistics.block.redstone; + +import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntityType; + +public class NixieTubeTileEntity extends SyncedTileEntity { + + char tube1; + char tube2; + + public NixieTubeTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + tube1 = '0'; + tube2 = '0'; + } + + @Override + public CompoundNBT write(CompoundNBT nbt) { + super.write(nbt); + nbt.putInt("tube1", tube1); + nbt.putInt("tube2", tube2); + return nbt; + } + + public void display(char tube1, char tube2) { + this.tube1 = tube1; + this.tube2 = tube2; + markDirty(); + sendData(); + } + + @Override + public void read(CompoundNBT nbt) { + tube1 = (char) nbt.getInt("tube1"); + tube2 = (char) nbt.getInt("tube2"); + super.read(nbt); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/block/render/BakedModelBuiltInRenderer.java b/src/main/java/com/simibubi/create/foundation/block/render/BakedModelBuiltInRenderer.java new file mode 100644 index 000000000..c995c35f5 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/block/render/BakedModelBuiltInRenderer.java @@ -0,0 +1,16 @@ +package com.simibubi.create.foundation.block.render; + +import net.minecraft.client.renderer.model.IBakedModel; + +public class BakedModelBuiltInRenderer extends WrappedBakedModel { + + public BakedModelBuiltInRenderer(IBakedModel template) { + super(template); + } + + @Override + public boolean isBuiltInRenderer() { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java b/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java index b626cc9f7..2478c6d34 100644 --- a/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java @@ -12,7 +12,6 @@ import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraftforge.client.model.data.EmptyModelData; @@ -63,7 +62,6 @@ public class PartialItemModelRenderer { return; ms.push(); - model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ms, model, TransformType.NONE, false); ms.translate(-0.5D, -0.5D, -0.5D); if (!model.isBuiltInRenderer()) diff --git a/src/main/resources/assets/create/lang/default/tooltips.json b/src/main/resources/assets/create/lang/default/tooltips.json index bade60b20..ff88c71f9 100644 --- a/src/main/resources/assets/create/lang/default/tooltips.json +++ b/src/main/resources/assets/create/lang/default/tooltips.json @@ -349,7 +349,12 @@ "block.create.redstone_link.tooltip.control2": "When R-Clicked while Sneaking", "block.create.redstone_link.tooltip.action2": "Toggles between _Receiver_ and _Transmitter_ Mode.", - "block.create.redstone_contact.tooltip": "REDSTONE redstone_contact", + "block.create.nixie_tube.tooltip": "NIXIE TUBE", + "block.create.nixie_tube.tooltip.summary": "A fancy redstone-powered _Number_ _Display_ ranging from 0 to 15.", + "block.create.nixie_tube.tooltip.condition1": "When Powered", + "block.create.nixie_tube.tooltip.behaviour1": "Shows the current redstone _Signal_ _Strength_ as its displayed value.", + + "block.create.redstone_contact.tooltip": "REDSTONE CONTACT", "block.create.redstone_contact.tooltip.summary": "Only emits redstone power in pairs. It is movable with _Mechanical_ _Pistons_, _Bearings_ or other controllers.", "block.create.redstone_contact.tooltip.condition1": "When facing other redstone_contact", "block.create.redstone_contact.tooltip.behaviour1": "Provides a _Redstone_ _Signal_.", diff --git a/src/main/resources/assets/create/models/block/nixie_tube/block.json b/src/main/resources/assets/create/models/block/nixie_tube/block.json new file mode 100644 index 000000000..f967089e5 --- /dev/null +++ b/src/main/resources/assets/create/models/block/nixie_tube/block.json @@ -0,0 +1,83 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/nixie_tube", + "1": "create:block/brass_casing", + "particle": "create:block/nixie_tube" + }, + "elements": [ + { + "name": "base", + "from": [0, 0, 0], + "to": [16, 4, 16], + "faces": { + "north": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "east": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "south": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "west": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + }, + { + "name": "connector1", + "from": [1, 4, 5], + "to": [7, 6, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 12, 13]}, + "faces": { + "north": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "east": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "south": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "west": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "up": {"uv": [11, 5, 14, 8], "texture": "#0"} + } + }, + { + "name": "connector2", + "from": [9, 4, 5], + "to": [15, 6, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [17, 12, 13]}, + "faces": { + "north": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "east": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "south": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "west": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "up": {"uv": [11, 5, 14, 8], "texture": "#0"} + } + }, + { + "name": "tube1", + "from": [1, 6, 5], + "to": [7, 15, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 14, 13]}, + "faces": { + "north": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "east": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "south": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "west": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "up": {"uv": [11, 2, 14, 5], "texture": "#0"} + } + }, + { + "name": "tube2", + "from": [9, 6, 5], + "to": [15, 15, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [17, 14, 13]}, + "faces": { + "north": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "east": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "south": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "west": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "up": {"uv": [11, 2, 14, 5], "texture": "#0"} + } + } + ], + "groups": [ + { + "name": "nixie", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/nixie_tube/item.json b/src/main/resources/assets/create/models/block/nixie_tube/item.json new file mode 100644 index 000000000..a52864d85 --- /dev/null +++ b/src/main/resources/assets/create/models/block/nixie_tube/item.json @@ -0,0 +1,83 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/nixie_tube", + "1": "create:block/brass_casing", + "particle": "create:block/nixie_tube" + }, + "elements": [ + { + "name": "base", + "from": [0, 0, 0], + "to": [16, 4, 16], + "faces": { + "north": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "east": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "south": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "west": {"uv": [8, 0, 16, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + }, + { + "name": "connector1", + "from": [1, 4, 5], + "to": [7, 6, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 12, 13]}, + "faces": { + "north": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "east": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "south": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "west": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "up": {"uv": [11, 5, 14, 8], "texture": "#0"} + } + }, + { + "name": "connector2", + "from": [9, 4, 5], + "to": [15, 6, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [17, 12, 13]}, + "faces": { + "north": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "east": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "south": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "west": {"uv": [8, 7, 11, 8], "texture": "#0"}, + "up": {"uv": [11, 5, 14, 8], "texture": "#0"} + } + }, + { + "name": "tube1", + "from": [1, 6, 5], + "to": [7, 15, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 14, 13]}, + "faces": { + "north": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "east": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "south": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "west": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "up": {"uv": [11, 2, 14, 5], "texture": "#0"} + } + }, + { + "name": "tube2", + "from": [9, 6, 5], + "to": [15, 15, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [17, 14, 13]}, + "faces": { + "north": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "east": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "south": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "west": {"uv": [8, 2.5, 11, 7], "texture": "#0"}, + "up": {"uv": [11, 2, 14, 5], "texture": "#0"} + } + } + ], + "groups": [ + { + "name": "nixie", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/nixie_tube.png b/src/main/resources/assets/create/textures/block/nixie_tube.png new file mode 100644 index 0000000000000000000000000000000000000000..3574f8f1fb79cf66a8977e090ce737b86186ae13 GIT binary patch literal 1024 zcmV+b1poVqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TccK~z{r?Nv)_ zQ$ZB|?oD!UUQPN+(@JeCYO7T!x)8*QxUfZquG~snL=n-YJAZ)SLMZrJh>r^5R`5YV zT(}W8MM0EW(bj63rfHkBdEMsbI_KQnG>suHEV?is3^Q|P=A7?5W=0x+IAAQq)6g;r zjE+Un+-yT7%+BgK*%yGKdQk6kvg}XJOD}Hq8FV<4isM6gGdi~hd1Eq}hTHAro{-kE z+)sRt;6PUts>{bp2+K<$#KH>hjfG)1Vl2yQIjrV*2$xef2Lf5ikHNkm{6P&hwJngI zjT|t@I4QXCBn(+k@J72sLUz^Qz8E=paQbKyDl?pV7o(LR*DL zaX^O|wRF~GC!OfuW^`@oz>Ak3QRlJ4t!T`?7^J{bn$lGy#d>dVCnl$-P+!MlxLtO0 zAfV?A*kp-&g2Q1(ASd)#GD0S!L%J~7Wn@1YW%iv7i)g#Vn|# zrgLA4gNIu%a^~`IIYWhh>Jv~~FXjy_>+U;pm$s>P85xm=wdyE?fKUCU27ZBMC>G7P zBI7h~-ww=77uGrg9&SF7?#^a!WdamVN=ZdnUM?-HGgQF)abVY;{6rL~2tPH_OSM&z zfK?B_1%-HJ1@L;;NKh0g?5%Ak!F&qHDCwj|H)8`LAdG$c%Eq+?@dl7VGG?WM#*~J9 zT0)B{F5-A1i%3k{pdus^ussnVkkmr&bAkVc_(j+NBW0Fzc38asllTRHF;_&Vz zoa%4l7mk?45*j}er7bj{;yv^fAKbA3I=imes2Hi@+jg;$a`PIQf=a@SUth*Qn`Qo{yPqJFBU$d(Z?ExwlvpP3alt7E;lv>8?d*>!wUU1F2t5o zSoa;@e;z?FC|7*TDeOZc0@inW@yaACZ>kmH7noaGVWX`rO=XGIG=>T<8~+7{vGzIq u3sigu{syW9ssyS8ssyS8ss#Rb0>DqqNb+f`zoVT10000