diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index aab8b94c2..78ca66029 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -403,19 +403,19 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json ce0e5405da381a86625b908c569c5dbe347abdba assets/create/lang/en_ud.json -442123de75c67a2b562194981d62c6a6de053593 assets/create/lang/en_us.json -1a5739ce1ab4a923dcf5a7ed12f16af394aed719 assets/create/lang/unfinished/de_de.json -4f21f855b45e8b44aedcae94e5a41c797d05af45 assets/create/lang/unfinished/es_es.json -e971082462cd5a92a08c3a1481e8e7c6e1afcea1 assets/create/lang/unfinished/es_mx.json -64a39634a36da998fd11553340cd1fc652129ce9 assets/create/lang/unfinished/fr_fr.json -afb72ad7e2713819b3cda0110a41dcdbbcc0bb0b assets/create/lang/unfinished/it_it.json -583b4bddc044614efb1b08f9bfb36a49e0a67e4f assets/create/lang/unfinished/ja_jp.json -9baa3052e1a9440e1cb6d46950d2227f2be3435e assets/create/lang/unfinished/ko_kr.json -7701f3b29b3e92a9943c15000beb9df02143fe90 assets/create/lang/unfinished/nl_nl.json -9f935fe569d793f6ee581ebc24bff5740c91fbab assets/create/lang/unfinished/pt_br.json -9ede4dc1051fea0bcabc30da1d133c0048d29641 assets/create/lang/unfinished/ru_ru.json -2442b5fe4ed2d92ab3081e7422bfecdf1ac06610 assets/create/lang/unfinished/zh_cn.json -56268c452b57cf072f35839ebfa130213a966730 assets/create/lang/unfinished/zh_tw.json +e847bb88a7cf6bfa81f03f87f106a85c7e351da8 assets/create/lang/en_us.json +950f435754c82bb46d0f0bbd7fb0ea5c2a6db2be assets/create/lang/unfinished/de_de.json +953669a0880eb087bff8c6a0f31ab593826410ac assets/create/lang/unfinished/es_es.json +49dcba9e9e74421dc74e24a27f6876a9f9e4bafa assets/create/lang/unfinished/es_mx.json +db5fa9ea3a940cc378657db43d7de6f71abb8da3 assets/create/lang/unfinished/fr_fr.json +144bbca783790c63c1671388227a00780c23e5ba assets/create/lang/unfinished/it_it.json +8ebf781c5e3d8dd78eed9c1445d39a643dd1e2b1 assets/create/lang/unfinished/ja_jp.json +46f41cb9e6870bbb8aa4d58525f7ab07f5e911ff assets/create/lang/unfinished/ko_kr.json +eb16433d9ba6c3f9748074f48c22368c81cc52b3 assets/create/lang/unfinished/nl_nl.json +a4aa6902f68a6e4c2c0ce38dee6623e80a6cc65e assets/create/lang/unfinished/pt_br.json +8f889340f518084c90eba259ddbe822601462c4a assets/create/lang/unfinished/ru_ru.json +737e73147690f40aaae5ed51d24e3016fa9d778c assets/create/lang/unfinished/zh_cn.json +34826633b870307b430c64ec62695852b27cb872 assets/create/lang/unfinished/zh_tw.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 @@ -2914,7 +2914,7 @@ fc75c87159569cb6ee978e6d51b0c3b0f504b5de data/create/recipes/crafting/logistics/ a32ac53848862837f3044ff9c81ed62c1134fe4f data/create/recipes/crafting/logistics/powered_latch.json 660eb73bcc66c1528cbd4d4204ad6b771f4bd721 data/create/recipes/crafting/logistics/powered_toggle_latch.json 74b8a38d252cce564cc63db2ade41ed2d656d025 data/create/recipes/crafting/logistics/pulse_repeater.json -bb73dac60392f4811df033c3d1d3256df5e022af data/create/recipes/crafting/logistics/redstone_contact.json +739f0d8b7f98a5639ed37f7fb8ce474d5e6ba0c6 data/create/recipes/crafting/logistics/redstone_contact.json bc511f7c225750743ae3e985502fa65beb1e7b8d data/create/recipes/crafting/logistics/redstone_link.json 10b16358664f2bb8a11589ef8ba3d69ee8d3b9fc data/create/recipes/crafting/logistics/stockpile_switch.json 0dc99b8a8c68d6a9250c3a1167ffb565be9622ec data/create/recipes/crafting/materials/andesite_alloy.json diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index c7b5d21ad..2032f7448 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1829,6 +1829,7 @@ "create.ponder.previous": "Previous Scene", "create.ponder.replay": "Replay", "create.ponder.think_back": "Think Back", + "create.ponder.slow_text": "Comfy Reading", "create.ponder.shared.movement_anchors": "With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "32 RPM", "create.ponder.shared.sneak_and": "Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 043f0e322..141fee0d9 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1506", + "_": "Missing Localizations: 1507", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_es.json b/src/generated/resources/assets/create/lang/unfinished/es_es.json index b2e8c7da2..b5220f2d3 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_es.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_es.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 541", + "_": "Missing Localizations: 542", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index b6c37a338..8beff1428 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1436", + "_": "Missing Localizations: 1437", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index af65f930a..17937cc79 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1218", + "_": "Missing Localizations: 1219", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index dde52b028..207f43b51 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 558", + "_": "Missing Localizations: 559", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index 73d0995a1..d1f0cfd19 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 565", + "_": "Missing Localizations: 566", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index 0788669d2..506b241b9 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 611", + "_": "Missing Localizations: 612", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index 375fd54da..9ea591d07 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1705", + "_": "Missing Localizations: 1706", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index f3be159ec..cd99e83ca 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1771", + "_": "Missing Localizations: 1772", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index 879ba25c9..7f3f96767 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 561", + "_": "Missing Localizations: 562", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index 3b343e167..e5dba1fb9 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 559", + "_": "Missing Localizations: 560", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json index 6f2d608e7..f51b62266 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 564", + "_": "Missing Localizations: 565", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json b/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json index 840a75afe..d8530defc 100644 --- a/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json +++ b/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json @@ -1,19 +1,19 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - "WDW", " S ", - "WDW" + "CWC", + "CCC" ], "key": { "W": { "tag": "forge:dusts/redstone" }, - "D": { - "item": "create:brass_casing" + "C": { + "item": "minecraft:cobblestone" }, "S": { - "tag": "forge:ingots/iron" + "tag": "forge:plates/iron" } }, "result": { diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 35295937e..87e0dc54a 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -480,15 +480,16 @@ public class AllBlocks { .item() .transform(customItemModel("_", "block")) .register(); - - public static final BlockEntry WEIGHTED_EJECTOR = REGISTRATE.block("weighted_ejector", EjectorBlock::new) - .initialProperties(SharedProperties::stone) - .properties(Block.Properties::nonOpaque) - .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) - .transform(StressConfigDefaults.setImpact(2.0)) - .item(EjectorItem::new) - .transform(customItemModel()) - .register(); + + public static final BlockEntry WEIGHTED_EJECTOR = + REGISTRATE.block("weighted_ejector", EjectorBlock::new) + .initialProperties(SharedProperties::stone) + .properties(Block.Properties::nonOpaque) + .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) + .transform(StressConfigDefaults.setImpact(2.0)) + .item(EjectorItem::new) + .transform(customItemModel()) + .register(); public static final BlockEntry CHUTE = REGISTRATE.block("chute", ChuteBlock::new) .initialProperties(SharedProperties::softMetal) @@ -906,6 +907,15 @@ public class AllBlocks { .transform(customItemModel()) .register(); + public static final BlockEntry REDSTONE_CONTACT = + REGISTRATE.block("redstone_contact", RedstoneContactBlock::new) + .initialProperties(SharedProperties::stone) + .onRegister(addMovementBehaviour(new ContactMovementBehaviour())) + .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) + .item() + .transform(customItemModel("_", "block")) + .register(); + public static final BlockEntry MECHANICAL_HARVESTER = REGISTRATE.block("mechanical_harvester", HarvesterBlock::new) .initialProperties(SharedProperties::stone) @@ -1150,15 +1160,6 @@ public class AllBlocks { .onRegister(connectedTextures(new BrassTunnelCTBehaviour())) .register(); - public static final BlockEntry REDSTONE_CONTACT = - REGISTRATE.block("redstone_contact", RedstoneContactBlock::new) - .initialProperties(SharedProperties::stone) - .onRegister(addMovementBehaviour(new ContactMovementBehaviour())) - .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) - .item() - .transform(customItemModel("_", "block")) - .register(); - public static final BlockEntry CONTENT_OBSERVER = REGISTRATE.block("content_observer", ContentObserverBlock::new) .initialProperties(SharedProperties::stone) diff --git a/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java b/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java index dd29f947e..faa8c2046 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java +++ b/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java @@ -1,6 +1,5 @@ package com.simibubi.create.content.contraptions; -import static com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock.isLargeCog; import static net.minecraft.state.properties.BlockStateProperties.AXIS; import java.util.LinkedList; @@ -12,6 +11,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.content.contraptions.relays.encased.DirectionalShaftHalvesTileEntity; import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock; import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEntity; @@ -66,8 +66,8 @@ public class RotationPropagator { alignedAxes && definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction) && definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite()); - boolean connectedByGears = definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom) - && definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo); + boolean connectedByGears = ICogWheel.isSmallCog(stateFrom) + && ICogWheel.isSmallCog(stateTo); float custom = from.propagateRotationTo(to, stateFrom, stateTo, diff, connectedByAxis, connectedByGears); if (custom != 0) @@ -98,10 +98,10 @@ public class RotationPropagator { } // Gear <-> Large Gear - if (isLargeCog(stateFrom) && definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo)) + if (ICogWheel.isLargeCog(stateFrom) && ICogWheel.isSmallCog(stateTo)) if (isLargeToSmallCog(stateFrom, stateTo, definitionTo, diff)) return -2f; - if (isLargeCog(stateTo) && definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom)) + if (ICogWheel.isLargeCog(stateTo) && ICogWheel.isSmallCog(stateFrom)) if (isLargeToSmallCog(stateTo, stateFrom, definitionFrom, diff)) return -.5f; @@ -109,7 +109,7 @@ public class RotationPropagator { if (connectedByGears) { if (diff.manhattanDistance(BlockPos.ZERO) != 1) return 0; - if (isLargeCog(stateTo)) + if (ICogWheel.isLargeCog(stateTo)) return 0; if (direction.getAxis() == definitionFrom.getRotationAxis(stateFrom)) return 0; @@ -137,7 +137,7 @@ public class RotationPropagator { } private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) { - if (!isLargeCog(from) || !isLargeCog(to)) + if (!ICogWheel.isLargeCog(from) || !ICogWheel.isLargeCog(to)) return false; Axis fromAxis = from.get(AXIS); Axis toAxis = to.get(AXIS); @@ -186,7 +186,7 @@ public class RotationPropagator { } private static boolean isLargeCogToSpeedController(BlockState from, BlockState to, BlockPos diff) { - if (!isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to)) + if (!ICogWheel.isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to)) return false; if (!diff.equals(BlockPos.ZERO.down())) return false; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java b/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java index 225532912..fa025e01a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java @@ -118,8 +118,6 @@ public interface IRotate extends IWrenchable { } public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face); - - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state); public Axis getRotationAxis(BlockState state); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java index ee0734ae3..4836a2d72 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java @@ -72,11 +72,6 @@ public abstract class KineticBlock extends Block implements IRotate { return false; } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return false; - } - @Override public boolean hasTileEntity(BlockState state) { return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java index 18e48cb8f..376f46514 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java @@ -28,12 +28,6 @@ public class KineticData extends BasicData { return setPosition(pos.getX(), pos.getY(), pos.getZ()); } - public KineticData setPosition(int x, int y, int z) { - return setPosition((float) (x), - (float) (y), - (float) (z)); - } - public KineticData setPosition(float x, float y, float z) { this.x = x; this.y = y; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index f38efb6fa..ae701fb85 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -14,6 +14,7 @@ import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.base.IRotate.StressImpact; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.goggles.IHaveHoveringInformation; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; @@ -529,7 +530,7 @@ public abstract class KineticTileEntity extends SmartTileEntity } protected boolean canPropagateDiagonally(IRotate block, BlockState state) { - return block.hasIntegratedCogwheel(world, pos, state); + return ICogWheel.isSmallCog(state); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java index 6ff654402..fe297f718 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java @@ -6,6 +6,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.KineticDebugger; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.render.Compartment; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; @@ -96,7 +97,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer extends T } protected float getRotationOffset(final Direction.Axis axis) { - float offset = CogWheelBlock.isLargeCog(blockState) ? 11.25f : 0; + float offset = ICogWheel.isLargeCog(blockState) ? 11.25f : 0; double d = (((axis == Direction.Axis.X) ? 0 : pos.getX()) + ((axis == Direction.Axis.Y) ? 0 : pos.getY()) + ((axis == Direction.Axis.Z) ? 0 : pos.getZ())) % 2; if (d == 0) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java index 7f4c9d899..5d4d79ce6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; @@ -41,7 +42,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; -public class MechanicalCrafterBlock extends HorizontalKineticBlock implements ITE { +public class MechanicalCrafterBlock extends HorizontalKineticBlock implements ITE, ICogWheel { public static final EnumProperty POINTING = EnumProperty.create("pointing", Pointing.class); @@ -60,11 +61,6 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT return AllTileEntities.MECHANICAL_CRAFTER.create(); } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return true; - } - @Override public Axis getRotationAxis(BlockState state) { return state.get(HORIZONTAL_FACING) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java index 9696e6b11..7c7ecc989 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.millstone; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.KineticBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.Iterate; @@ -30,7 +31,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -public class MillstoneBlock extends KineticBlock implements ITE { +public class MillstoneBlock extends KineticBlock implements ITE, ICogWheel { public MillstoneBlock(Properties properties) { super(properties); @@ -131,11 +132,6 @@ public class MillstoneBlock extends KineticBlock implements ITE { +public class MechanicalMixerBlock extends KineticBlock implements ITE, ICogWheel { public MechanicalMixerBlock(Properties properties) { super(properties); @@ -51,11 +52,6 @@ public class MechanicalMixerBlock extends KineticBlock implements ITE mixerHead; - private final InstanceKey mixerPole; + private final InstanceKey mixerHead; + private final InstanceKey mixerPole; + private final MechanicalMixerTileEntity mixer; - public MixerInstance(InstancedTileRenderer dispatcher, KineticTileEntity tile) { - super(dispatcher, tile); + public MixerInstance(InstancedTileRenderer dispatcher, MechanicalMixerTileEntity tile) { + super(dispatcher, tile); + this.mixer = tile; - mixerHead = getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState) - .createInstance(); + mixerHead = getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState) + .createInstance(); - mixerHead.getInstance() - .setRotationAxis(Direction.Axis.Y); + mixerHead.getInstance() + .setRotationAxis(Direction.Axis.Y); - mixerPole = getTransformMaterial() - .getModel(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState) - .createInstance(); + mixerPole = getOrientedMaterial() + .getModel(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState) + .createInstance(); - MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) tile; - float renderedHeadOffset = getRenderedHeadOffset(mixer); + float renderedHeadOffset = getRenderedHeadOffset(); - transformPole(renderedHeadOffset); - transformHead(mixer, renderedHeadOffset); - } + transformPole(renderedHeadOffset); + transformHead(renderedHeadOffset); + } - @Override - public void beginFrame() { - MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) tile; + @Override + public void beginFrame() { - float renderedHeadOffset = getRenderedHeadOffset(mixer); + float renderedHeadOffset = getRenderedHeadOffset(); - if (mixer.running) { - transformPole(renderedHeadOffset); - } + transformPole(renderedHeadOffset); + transformHead(renderedHeadOffset); + } - transformHead(mixer, renderedHeadOffset); - } + private void transformHead(float renderedHeadOffset) { + float speed = mixer.getRenderedHeadRotationSpeed(AnimationTickHolder.getPartialTicks()); - private void transformHead(MechanicalMixerTileEntity mixer, float renderedHeadOffset) { - float speed = mixer.getRenderedHeadRotationSpeed(AnimationTickHolder.getPartialTicks()); + mixerHead.getInstance() + .setPosition(getInstancePosition()) + .nudge(0, -renderedHeadOffset, 0) + .setRotationalSpeed(speed * 2); + } - mixerHead.getInstance() - .setPosition(getInstancePosition()) - .nudge(0, -renderedHeadOffset, 0) - .setRotationalSpeed(speed * 2); - } + private void transformPole(float renderedHeadOffset) { + mixerPole.getInstance() + .setPosition(getInstancePosition()) + .nudge(0, -renderedHeadOffset, 0); + } - private void transformPole(float renderedHeadOffset) { - MatrixStack ms = new MatrixStack(); + private float getRenderedHeadOffset() { + return mixer.getRenderedHeadOffset(AnimationTickHolder.getPartialTicks()); + } - MatrixStacker msr = MatrixStacker.of(ms); - msr.translate(getInstancePosition()); - msr.translate(0, -renderedHeadOffset, 0); + @Override + public void updateLight() { + super.updateLight(); - mixerPole.getInstance().setTransform(ms); - } + relight(pos.down(), mixerHead.getInstance()); + relight(pos, mixerPole.getInstance()); + } - private float getRenderedHeadOffset(MechanicalMixerTileEntity mixer) { - return mixer.getRenderedHeadOffset(AnimationTickHolder.getPartialTicks()); - } - - @Override - public void updateLight() { - super.updateLight(); - - relight(pos.down(), mixerHead.getInstance()); - - relight(pos, mixerPole.getInstance()); - } - - @Override - public void remove() { - super.remove(); - mixerHead.delete(); - mixerPole.delete(); - } + @Override + public void remove() { + super.remove(); + mixerHead.delete(); + mixerPole.delete(); + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java index e9985adb6..d40e9d421 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.contraptions.components.press; +import net.minecraft.client.renderer.Quaternion; +import net.minecraft.client.renderer.Vector3f; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -8,19 +11,28 @@ import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance import com.simibubi.create.foundation.render.backend.instancing.InstanceKey; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.impl.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.impl.OrientedData; +import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; public class PressInstance extends ShaftInstance implements IDynamicInstance { - private final InstanceKey pressHead; + private final InstanceKey pressHead; private final MechanicalPressTileEntity press; public PressInstance(InstancedTileRenderer dispatcher, MechanicalPressTileEntity tile) { super(dispatcher, tile); press = tile; - pressHead = AllBlockPartials.MECHANICAL_PRESS_HEAD.renderOnHorizontalModel(dispatcher, blockState).createInstance(); + pressHead = dispatcher.getOrientedMaterial() + .getModel(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState) + .createInstance(); + + Quaternion q = Vector3f.POSITIVE_Y.getDegreesQuaternion(AngleHelper.horizontalAngle(blockState.get(MechanicalPressBlock.HORIZONTAL_FACING))); + + pressHead.getInstance().setRotation(q); + transformModels(); } @@ -35,14 +47,9 @@ public class PressInstance extends ShaftInstance implements IDynamicInstance { private void transformModels() { float renderedHeadOffset = getRenderedHeadOffset(press); - MatrixStack ms = new MatrixStack(); - - MatrixStacker msr = MatrixStacker.of(ms); - msr.translate(getInstancePosition()); - msr.translate(0, -renderedHeadOffset, 0); - pressHead.getInstance() - .setTransform(ms); + .setPosition(getInstancePosition()) + .nudge(0, -renderedHeadOffset, 0); } private float getRenderedHeadOffset(MechanicalPressTileEntity press) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java index fa8313f88..1ec92bd1e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.fluids; import java.util.Random; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import org.apache.commons.lang3.mutable.MutableBoolean; import com.simibubi.create.AllShapes; @@ -31,7 +32,7 @@ import net.minecraft.world.TickPriority; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable { +public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable, ICogWheel { public PumpBlock(Properties p_i48415_1_) { super(p_i48415_1_); @@ -82,11 +83,6 @@ public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable return AllShapes.PUMP.get(state.get(FACING)); } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return true; - } - @Override public void neighborChanged(BlockState state, World world, BlockPos pos, Block otherBlock, BlockPos neighborPos, boolean isMoving) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java index 14df97837..5a7edbd98 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java @@ -1,5 +1,16 @@ package com.simibubi.create.content.contraptions.relays.advanced; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllShapes; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; +import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; +import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.placement.IPlacementHelper; +import com.simibubi.create.foundation.utility.placement.PlacementHelpers; +import com.simibubi.create.foundation.utility.placement.PlacementOffset; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -18,18 +29,11 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import javax.annotation.ParametersAreNonnullByDefault; import java.util.function.Predicate; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.AllShapes; -import com.simibubi.create.AllTileEntities; -import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; -import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; -import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem; -import com.simibubi.create.foundation.block.ITE; -import com.simibubi.create.foundation.utility.placement.IPlacementHelper; -import com.simibubi.create.foundation.utility.placement.PlacementHelpers; -import com.simibubi.create.foundation.utility.placement.PlacementOffset; +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements ITE { private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper()); @@ -48,7 +52,7 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements BlockState above = context.getWorld() .getBlockState(context.getPos() .up()); - if (CogWheelBlock.isLargeCog(above) && above.get(CogWheelBlock.AXIS) + if (ICogWheel.isLargeCog(above) && above.get(CogWheelBlock.AXIS) .isHorizontal()) return getDefaultState().with(HORIZONTAL_AXIS, above.get(CogWheelBlock.AXIS) == Axis.X ? Axis.Z : Axis.X); return super.getStateForPlacement(context); @@ -82,7 +86,7 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements private static class PlacementHelper implements IPlacementHelper { @Override public Predicate getItemPredicate() { - return AllBlocks.LARGE_COGWHEEL::isIn; + return ((Predicate) ICogWheel::isLargeCogItem).and(ICogWheel::isDedicatedCogItem); } @Override @@ -100,8 +104,7 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements Axis newAxis = state.get(HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X; - if (CogwheelBlockItem.hasLargeCogwheelNeighbor(world, newPos, newAxis) - || CogwheelBlockItem.hasSmallCogwheelNeighbor(world, newPos, newAxis)) + if (!CogWheelBlock.isValidCogwheelPosition(true, world, newPos, newAxis)) return PlacementOffset.fail(); return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java index 8c225b86a..725d2e204 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.RotationPropagator; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.motor.CreativeMotorTileEntity; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; @@ -118,8 +119,8 @@ public class SpeedControllerTileEntity extends KineticTileEntity { if (world == null || !world.isRemote) return; BlockState stateAbove = world.getBlockState(pos.up()); - hasBracket = AllBlocks.LARGE_COGWHEEL.has(stateAbove) && stateAbove.get(CogWheelBlock.AXIS) - .isHorizontal(); + hasBracket = ICogWheel.isDedicatedCogWheel(stateAbove.getBlock()) && ICogWheel.isLargeCog(stateAbove) + && stateAbove.get(CogWheelBlock.AXIS).isHorizontal(); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java index a3c370ccb..deb5c17df 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java @@ -5,18 +5,14 @@ import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.foundation.utility.Iterate; - +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; -import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; @@ -24,11 +20,16 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class CogWheelBlock extends AbstractShaftBlock { +import javax.annotation.ParametersAreNonnullByDefault; + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@SuppressWarnings("deprecation") +public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel { boolean isLarge; - private CogWheelBlock(boolean large, Properties properties) { + protected CogWheelBlock(boolean large, Properties properties) { super(properties); isLarge = large; } @@ -41,12 +42,14 @@ public class CogWheelBlock extends AbstractShaftBlock { return new CogWheelBlock(true, properties); } - public static boolean isSmallCog(BlockState state) { - return AllBlocks.COGWHEEL.has(state); + @Override + public boolean isLargeCog() { + return isLarge; } - public static boolean isLargeCog(BlockState state) { - return AllBlocks.LARGE_COGWHEEL.has(state); + @Override + public boolean isSmallCog() { + return !isLarge; } @Override @@ -56,8 +59,12 @@ public class CogWheelBlock extends AbstractShaftBlock { @Override public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { + return isValidCogwheelPosition(ICogWheel.isLargeCog(state), worldIn, pos, state.get(AXIS)); + } + + public static boolean isValidCogwheelPosition(boolean large, IWorldReader worldIn, BlockPos pos, Axis cogAxis) { for (Direction facing : Iterate.directions) { - if (facing.getAxis() == state.get(AXIS)) + if (facing.getAxis() == cogAxis) continue; BlockPos offsetPos = pos.offset(facing); @@ -65,75 +72,53 @@ public class CogWheelBlock extends AbstractShaftBlock { if (blockState.has(AXIS) && facing.getAxis() == blockState.get(AXIS)) continue; - boolean smallCog = isSmallCog(blockState); - if (!smallCog && blockState.getBlock() instanceof IRotate) - smallCog = ((IRotate) blockState.getBlock()).hasIntegratedCogwheel(worldIn, offsetPos, blockState); - - if (isLargeCog(blockState) || isLarge && smallCog) + if (ICogWheel.isLargeCog(blockState) || large && ICogWheel.isSmallCog(blockState)) return false; } return true; } + protected Axis getAxisForPlacement(BlockItemUseContext context) { + if (context.getPlayer() != null && context.getPlayer().isSneaking()) + return context.getFace().getAxis(); + + World world = context.getWorld(); + BlockState stateBelow = world.getBlockState(context.getPos().down()); + + if (AllBlocks.ROTATION_SPEED_CONTROLLER.has(stateBelow) && isLargeCog()) + return stateBelow.get(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X; + + BlockPos placedOnPos = context.getPos().offset(context.getFace().getOpposite()); + BlockState placedAgainst = world.getBlockState(placedOnPos); + + Block block = placedAgainst.getBlock(); + if (ICogWheel.isSmallCog(placedAgainst)) + return ((IRotate) block).getRotationAxis(placedAgainst); + + Axis preferredAxis = getPreferredAxis(context); + return preferredAxis != null ? preferredAxis : context.getFace().getAxis(); + } + @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - BlockPos placedOnPos = context.getPos() - .offset(context.getFace() - .getOpposite()); - World world = context.getWorld(); - BlockState placedAgainst = world.getBlockState(placedOnPos); - Block block = placedAgainst.getBlock(); - - if (context.getPlayer() != null && context.getPlayer() - .isSneaking()) - return this.getDefaultState() - .with(AXIS, context.getFace() - .getAxis()); - - BlockState stateBelow = world.getBlockState(context.getPos() - .down()); - IFluidState ifluidstate = context.getWorld() - .getFluidState(context.getPos()); - if (AllBlocks.ROTATION_SPEED_CONTROLLER.has(stateBelow) && isLarge) { - return this.getDefaultState() - .with(BlockStateProperties.WATERLOGGED, ifluidstate.getFluid() == Fluids.WATER) - .with(AXIS, stateBelow.get(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X); - } - - if (!(block instanceof IRotate) - || !(((IRotate) block).hasIntegratedCogwheel(world, placedOnPos, placedAgainst))) { - Axis preferredAxis = getPreferredAxis(context); - if (preferredAxis != null) - return this.getDefaultState() - .with(AXIS, preferredAxis) - .with(BlockStateProperties.WATERLOGGED, ifluidstate.getFluid() == Fluids.WATER); - return this.getDefaultState() - .with(AXIS, context.getFace() - .getAxis()) - .with(BlockStateProperties.WATERLOGGED, ifluidstate.getFluid() == Fluids.WATER); - } - - return getDefaultState().with(AXIS, ((IRotate) block).getRotationAxis(placedAgainst)); + boolean shouldWaterlog = context.getWorld().getFluidState(context.getPos()).getFluid() == Fluids.WATER; + return this.getDefaultState() + .with(AXIS, getAxisForPlacement(context)) + .with(BlockStateProperties.WATERLOGGED, shouldWaterlog); } @Override public float getParticleTargetRadius() { - return isLarge ? 1.125f : .65f; + return isLargeCog() ? 1.125f : .65f; } @Override public float getParticleInitialRadius() { - return isLarge ? 1f : .75f; + return isLargeCog() ? 1f : .75f; } - public void fillItemGroup(ItemGroup group, NonNullList items) { - items.add(new ItemStack(this)); - } - - // IRotate - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return !isLarge; + public boolean isDedicatedCogWheel() { + return true; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java index 6d8018e30..b8b0a0d5e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java @@ -17,11 +17,9 @@ import net.minecraft.world.World; import java.util.List; import java.util.function.Predicate; -import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; -import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; @@ -100,7 +98,7 @@ public class CogwheelBlockItem extends BlockItem { continue; if (blockState.get(CogWheelBlock.AXIS) != axis) continue; - if (AllBlocks.LARGE_COGWHEEL.has(blockState) == large) + if (ICogWheel.isLargeCog(blockState) == large) continue; AllTriggers.triggerFor(AllTriggers.SHIFTING_GEARS, player); } @@ -114,7 +112,7 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getItemPredicate() { - return AllBlocks.COGWHEEL::isIn; + return ((Predicate) ICogWheel::isSmallCogItem).and(ICogWheel::isDedicatedCogItem); } @Override @@ -129,7 +127,7 @@ public class CogwheelBlockItem extends BlockItem { for (Direction dir : directions) { BlockPos newPos = pos.offset(dir); - if (hasLargeCogwheelNeighbor(world, newPos, state.get(AXIS))) + if (!CogWheelBlock.isValidCogwheelPosition(false, world, newPos, state.get(AXIS))) continue; if (!world.getBlockState(newPos) @@ -153,7 +151,7 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getItemPredicate() { - return AllBlocks.LARGE_COGWHEEL::isIn; + return ((Predicate) ICogWheel::isLargeCogItem).and(ICogWheel::isDedicatedCogItem); } @Override @@ -170,7 +168,7 @@ public class CogwheelBlockItem extends BlockItem { BlockPos newPos = pos.offset(dir) .offset(side); - if (hasLargeCogwheelNeighbor(world, newPos, dir.getAxis()) || hasSmallCogwheelNeighbor(world, newPos, dir.getAxis())) + if (!CogWheelBlock.isValidCogwheelPosition(true, world, newPos, dir.getAxis())) continue; if (!world.getBlockState(newPos) @@ -212,7 +210,7 @@ public class CogwheelBlockItem extends BlockItem { .isReplaceable()) continue; - if (AllBlocks.COGWHEEL.has(state) && hasSmallCogwheelNeighbor(world, newPos, state.get(AXIS))) + if (!CogWheelBlock.isValidCogwheelPosition(ICogWheel.isLargeCog(state), world, newPos, state.get(AXIS))) continue; return PlacementOffset.success(newPos, s -> s.with(AXIS, state.get(AXIS))); @@ -236,13 +234,12 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getItemPredicate() { - return AllBlocks.LARGE_COGWHEEL::isIn; + return ((Predicate) ICogWheel::isLargeCogItem).and(ICogWheel::isDedicatedCogItem); } @Override public Predicate getStatePredicate() { - return s -> !AllBlocks.COGWHEEL.has(s) && s.getBlock() instanceof IRotate - && ((IRotate) s.getBlock()).hasIntegratedCogwheel(null, null, null); + return s -> !ICogWheel.isDedicatedCogWheel(s.getBlock()) && ICogWheel.isSmallCog(s); } @Override @@ -274,8 +271,7 @@ public class CogwheelBlockItem extends BlockItem { .isReplaceable()) continue; - if (hasLargeCogwheelNeighbor(world, newPos, newAxis) - || hasSmallCogwheelNeighbor(world, newPos, newAxis)) + if (!CogWheelBlock.isValidCogwheelPosition(false, world, newPos, newAxis)) return PlacementOffset.fail(); return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis)); @@ -285,27 +281,4 @@ public class CogwheelBlockItem extends BlockItem { } } - static public boolean hasLargeCogwheelNeighbor(World world, BlockPos pos, Axis axis) { - for (Direction dir : Iterate.directions) { - if (dir.getAxis() == axis) - continue; - - if (AllBlocks.LARGE_COGWHEEL.has(world.getBlockState(pos.offset(dir)))) - return true; - } - - return false; - } - - static public boolean hasSmallCogwheelNeighbor(World world, BlockPos pos, Axis axis) { - for (Direction dir : Iterate.directions) { - if (dir.getAxis() == axis) - continue; - - if (AllBlocks.COGWHEEL.has(world.getBlockState(pos.offset(dir)))) - return true; - } - - return false; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java new file mode 100644 index 000000000..7f2ad6f2c --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java @@ -0,0 +1,64 @@ +package com.simibubi.create.content.contraptions.relays.elementary; + +import com.simibubi.create.content.contraptions.base.IRotate; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public interface ICogWheel extends IRotate { + + static boolean isSmallCog(BlockState state) { + return isSmallCog(state.getBlock()); + } + + static boolean isLargeCog(BlockState state) { + return isLargeCog(state.getBlock()); + } + + static boolean isSmallCog(Block block) { + return block instanceof ICogWheel && ((ICogWheel) block).isSmallCog(); + } + + static boolean isLargeCog(Block block) { + return block instanceof ICogWheel && ((ICogWheel) block).isLargeCog(); + } + + static boolean isDedicatedCogWheel(Block block) { + return block instanceof ICogWheel && ((ICogWheel) block).isDedicatedCogWheel(); + } + + static boolean isDedicatedCogItem(ItemStack test) { + Item item = test.getItem(); + if (!(item instanceof BlockItem)) + return false; + return isDedicatedCogWheel(((BlockItem) item).getBlock()); + } + + static boolean isSmallCogItem(ItemStack test) { + Item item = test.getItem(); + if (!(item instanceof BlockItem)) + return false; + return isSmallCog(((BlockItem) item).getBlock()); + } + + static boolean isLargeCogItem(ItemStack test) { + Item item = test.getItem(); + if (!(item instanceof BlockItem)) + return false; + return isLargeCog(((BlockItem) item).getBlock()); + } + + default boolean isLargeCog() { + return false; + } + + default boolean isSmallCog() { + return !isLargeCog(); + } + + default boolean isDedicatedCogWheel() { + return false; + } +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java index ddf55f972..2c3f47a6a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java @@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.relays.elementary; import java.util.List; -import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.foundation.advancement.AllTriggers; @@ -34,7 +33,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity { @Override public List addPropagationLocations(IRotate block, BlockState state, List neighbours) { - if (!AllBlocks.LARGE_COGWHEEL.has(state)) + if (!ICogWheel.isLargeCog(state)) return super.addPropagationLocations(block, state, neighbours); BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java index 8218fa025..69cc84372 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java @@ -302,22 +302,27 @@ public class EjectorTileEntity extends KineticTileEntity { } if (state == State.RETRACTING) { - lidProgress.updateChaseSpeed(0); - if (lidProgress.getValue() == 0 && doLogic) { - state = State.CHARGED; - lidProgress.setValue(0); - sendData(); + if (lidProgress.getChaseTarget() == 1 && !lidProgress.settled()) { + lidProgress.tickChaser(); + } else { + lidProgress.updateChaseTarget(0); + lidProgress.updateChaseSpeed(0); + if (lidProgress.getValue() == 0 && doLogic) { + state = State.CHARGED; + lidProgress.setValue(0); + sendData(); + } + + float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1); + lidProgress.setValue(value); + + int soundRate = (int) (1 / (getWindUpSpeed() * 5)) + 1; + float volume = .125f; + float pitch = 1.5f - lidProgress.getValue(); + if (((int) world.getGameTime()) % soundRate == 0 && doLogic) + world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume, + pitch); } - - float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1); - lidProgress.setValue(value); - - int soundRate = (int) (1 / (getWindUpSpeed() * 5)) + 1; - float volume = .125f; - float pitch = 1.5f - lidProgress.getValue(); - if (((int) world.getGameTime()) % soundRate == 0 && doLogic) - world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume, - pitch); } if (state != prevState) @@ -509,10 +514,6 @@ public class EjectorTileEntity extends KineticTileEntity { public void setTarget(int horizontalDistance, int verticalDistance) { launcher.set(Math.max(1, horizontalDistance), verticalDistance); - if (horizontalDistance == 0 && verticalDistance == 0) { - state = State.CHARGED; - lidProgress.startWithValue(0); - } sendData(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java index cf91ddfef..752fff659 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java @@ -36,7 +36,7 @@ public class EntityLauncher { public void applyMotion(Entity entity, Direction facing) { Vec3d motionVec = new Vec3d(0, yMotion, xMotion); motionVec = VecHelper.rotate(motionVec, AngleHelper.horizontalAngle(facing), Axis.Y); - entity.setMotion(motionVec.x, motionVec.y, motionVec.z); + entity.setMotion(motionVec.x * .91, motionVec.y * .98, motionVec.z * .91); } public int getHorizontalDistance() { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java index 13354fc17..cbf44210c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import org.apache.commons.lang3.mutable.MutableBoolean; import com.simibubi.create.AllShapes; @@ -29,7 +30,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class ArmBlock extends KineticBlock implements ITE { +public class ArmBlock extends KineticBlock implements ITE, ICogWheel { public static final BooleanProperty CEILING = BooleanProperty.create("ceiling"); @@ -48,11 +49,6 @@ public class ArmBlock extends KineticBlock implements ITE { return getDefaultState().with(CEILING, ctx.getFace() == Direction.DOWN); } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return true; - } - @Override public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index 5fddcde92..a05b192a2 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -790,11 +790,11 @@ public class StandardRecipeGen extends CreateRecipeProvider { REDSTONE_CONTACT = create(AllBlocks.REDSTONE_CONTACT).returns(2) .unlockedBy(I::brassCasing) .viaShaped(b -> b.key('W', I.redstone()) - .key('D', I.brassCasing()) - .key('S', I.iron()) - .patternLine("WDW") + .key('C', Blocks.COBBLESTONE) + .key('S', I.ironSheet()) .patternLine(" S ") - .patternLine("WDW")), + .patternLine("CWC") + .patternLine("CCC")), ANDESITE_FUNNEL = create(AllBlocks.ANDESITE_FUNNEL).returns(2) .unlockedBy(I::andesite) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java index 577ea8028..cb12f0517 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java @@ -123,7 +123,8 @@ public class AllIcons implements IScreenRenderable { I_MTD_RIGHT = next(), I_MTD_SCAN = next(), I_MTD_REPLAY = next(), - I_MTD_USER_MODE = next(); + I_MTD_USER_MODE = next(), + I_MTD_SLOW_MODE = next(); public AllIcons(int x, int y) { iconX = x * 16; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java index 62e359ab2..ad8a895fa 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java @@ -80,6 +80,7 @@ public class PonderLocalization { addGeneral(object, PonderUI.PREVIOUS, "Previous Scene"); addGeneral(object, PonderUI.REPLAY, "Replay"); addGeneral(object, PonderUI.THINK_BACK, "Think Back"); + addGeneral(object, PonderUI.SLOW_TEXT, "Comfy Reading"); shared.forEach((k, v) -> object.addProperty(Create.ID + "." + langKeyForShared(k), v)); tag.forEach((k, v) -> { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 8cc99fedd..0c0e0c630 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.ponder; +import static com.simibubi.create.foundation.ponder.PonderLocalization.LANG_PREFIX; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -21,6 +23,7 @@ import com.simibubi.create.foundation.ponder.content.PonderChapter; import com.simibubi.create.foundation.ponder.content.PonderIndex; import com.simibubi.create.foundation.ponder.content.PonderTag; import com.simibubi.create.foundation.ponder.content.PonderTagScreen; +import com.simibubi.create.foundation.ponder.elements.TextWindowElement; import com.simibubi.create.foundation.ponder.ui.PonderButton; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.ColorHelper; @@ -58,14 +61,15 @@ public class PonderUI extends NavigatableSimiScreen { public static int ponderTicks; public static float ponderPartialTicksPaused; - public static final String PONDERING = PonderLocalization.LANG_PREFIX + "pondering"; - public static final String IDENTIFY_MODE = PonderLocalization.LANG_PREFIX + "identify_mode"; - public static final String IN_CHAPTER = PonderLocalization.LANG_PREFIX + "in_chapter"; - public static final String IDENTIFY = PonderLocalization.LANG_PREFIX + "identify"; - public static final String PREVIOUS = PonderLocalization.LANG_PREFIX + "previous"; - public static final String CLOSE = PonderLocalization.LANG_PREFIX + "close"; - public static final String NEXT = PonderLocalization.LANG_PREFIX + "next"; - public static final String REPLAY = PonderLocalization.LANG_PREFIX + "replay"; + public static final String PONDERING = LANG_PREFIX + "pondering"; + public static final String IDENTIFY_MODE = LANG_PREFIX + "identify_mode"; + public static final String IN_CHAPTER = LANG_PREFIX + "in_chapter"; + public static final String IDENTIFY = LANG_PREFIX + "identify"; + public static final String PREVIOUS = LANG_PREFIX + "previous"; + public static final String CLOSE = LANG_PREFIX + "close"; + public static final String NEXT = LANG_PREFIX + "next"; + public static final String REPLAY = LANG_PREFIX + "replay"; + public static final String SLOW_TEXT = LANG_PREFIX + "slow_text"; private List scenes; private List tags; @@ -76,6 +80,7 @@ public class PonderUI extends NavigatableSimiScreen { PonderChapter chapter = null; private boolean userViewMode; + private boolean slowTextMode; private boolean identifyMode; private ItemStack hoveredTooltipItem; private BlockPos hoveredBlockPos; @@ -90,10 +95,13 @@ public class PonderUI extends NavigatableSimiScreen { private int index = 0; private PonderTag referredToByTag; - private PonderButton left, right, scan, chap, userMode, close, replay; + private PonderButton left, right, scan, chap, userMode, close, replay, slowMode; private PonderProgressBar progressBar; private int skipCooling = 0; + private int extendedTickLength = 0; + private int extendedTickTimer = 0; + public static PonderUI of(ResourceLocation id) { return new PonderUI(PonderRegistry.compile(id)); } @@ -196,8 +204,13 @@ public class PonderUI extends NavigatableSimiScreen { .shortcut(bindings.keyBindDrop) .fade(0, -1)); + widgets.add(slowMode = new PonderButton(width - 20 - 31, bY, () -> { + slowTextMode = !slowTextMode; + }).showing(AllIcons.I_MTD_SLOW_MODE) + .fade(0, -1)); + if (PonderIndex.EDITOR_MODE) { - widgets.add(userMode = new PonderButton(width - 20 - 31, bY, () -> { + widgets.add(userMode = new PonderButton(width - 50 - 31, bY, () -> { userViewMode = !userViewMode; }).showing(AllIcons.I_MTD_USER_MODE) .fade(0, -1)); @@ -250,16 +263,32 @@ public class PonderUI extends NavigatableSimiScreen { referredToByTag = null; } - PonderScene activeScene = scenes.get(index); - if (!identifyMode) { - ponderTicks++; - if (skipCooling == 0) - activeScene.tick(); - } - lazyIndex.tickChaser(); fadeIn.tickChaser(); finishingFlash.tickChaser(); + PonderScene activeScene = scenes.get(index); + + extendedTickLength = 0; + if (slowTextMode) + activeScene.forEachVisible(TextWindowElement.class, twe -> extendedTickLength = 2); + + if (extendedTickTimer == 0) { + if (!identifyMode) { + ponderTicks++; + if (skipCooling == 0) + activeScene.tick(); + } + + if (!identifyMode) { + float lazyIndexValue = lazyIndex.getValue(); + if (Math.abs(lazyIndexValue - index) > 1 / 512f) + scenes.get(lazyIndexValue < index ? index - 1 : index + 1) + .tick(); + } + extendedTickTimer = extendedTickLength; + } else + extendedTickTimer--; + progressBar.tick(); if (activeScene.currentTime == activeScene.totalTime - 1) @@ -272,13 +301,6 @@ public class PonderUI extends NavigatableSimiScreen { } } - if (!identifyMode) { - float lazyIndexValue = lazyIndex.getValue(); - if (Math.abs(lazyIndexValue - index) > 1 / 512f) - scenes.get(lazyIndexValue < index ? index - 1 : index + 1) - .tick(); - } - updateIdentifiedItem(activeScene); } @@ -357,6 +379,7 @@ public class PonderUI extends NavigatableSimiScreen { @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + partialTicks = getPartialTicks(); RenderSystem.enableBlend(); renderVisibleScenes(mouseX, mouseY, skipCooling > 0 ? 0 : identifyMode ? ponderPartialTicksPaused : partialTicks); @@ -369,7 +392,6 @@ public class PonderUI extends NavigatableSimiScreen { } protected void renderVisibleScenes(int mouseX, int mouseY, float partialTicks) { - SuperRenderTypeBuffer.vertexSortingOrigin = new BlockPos(0, 0, 800); renderScene(mouseX, mouseY, index, partialTicks); float lazyIndexValue = lazyIndex.getValue(partialTicks); if (Math.abs(lazyIndexValue - index) > 1 / 512f) @@ -388,7 +410,13 @@ public class PonderUI extends NavigatableSimiScreen { RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); + RenderSystem.pushMatrix(); + + // has to be outside of MS transforms, important for vertex sorting + RenderSystem.translated(0, 0, 800); + ms.push(); + ms.translate(0, 0, -800); story.transform.updateScreenParams(width, height, slide); story.transform.apply(ms, partialTicks, false); story.transform.updateSceneRVE(partialTicks); @@ -485,8 +513,8 @@ public class PonderUI extends NavigatableSimiScreen { } RenderSystem.popMatrix(); - ms.pop(); + RenderSystem.popMatrix(); } protected void renderWidgets(int mouseX, int mouseY, float partialTicks) { @@ -540,7 +568,7 @@ public class PonderUI extends NavigatableSimiScreen { drawRightAlignedString(font, Lang.translate(IN_CHAPTER), 0, 0, tooltipColor); drawRightAlignedString(font, - Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee); + Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee); RenderSystem.popMatrix(); } @@ -587,6 +615,11 @@ public class PonderUI extends NavigatableSimiScreen { else userMode.dim(); } + + if (slowTextMode) + slowMode.flash(); + else + slowMode.dim(); { // Scene overlay @@ -673,6 +706,10 @@ public class PonderUI extends NavigatableSimiScreen { drawCenteredString(font, Lang.translate(NEXT), right.x + 10, tooltipY, tooltipColor); if (replay.isHovered()) drawCenteredString(font, Lang.translate(REPLAY), replay.x + 10, tooltipY, tooltipColor); + if (slowMode.isHovered()) + drawCenteredString(font, Lang.translate(SLOW_TEXT), slowMode.x + 5, tooltipY, tooltipColor); + if (PonderIndex.EDITOR_MODE && userMode.isHovered()) + drawCenteredString(font, "Editor View", userMode.x + 10, tooltipY, tooltipColor); RenderSystem.popMatrix(); } @@ -787,7 +824,7 @@ public class PonderUI extends NavigatableSimiScreen { @Override protected String getBreadcrumbTitle() { if (chapter != null) - return Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()); + return Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()); return stack.getItem() .getName() @@ -915,13 +952,18 @@ public class PonderUI extends NavigatableSimiScreen { } public static float getPartialTicks() { + float renderPartialTicks = Minecraft.getInstance() + .getRenderPartialTicks(); + if (Minecraft.getInstance().currentScreen instanceof PonderUI) { PonderUI ui = (PonderUI) Minecraft.getInstance().currentScreen; if (ui.identifyMode) return ponderPartialTicksPaused; + + return (renderPartialTicks + (ui.extendedTickLength - ui.extendedTickTimer)) / (ui.extendedTickLength + 1); } - return Minecraft.getInstance() - .getRenderPartialTicks(); + + return renderPartialTicks; } @Override @@ -933,10 +975,4 @@ public class PonderUI extends NavigatableSimiScreen { skipCooling = 15; } - @Override - public void removed() { - super.removed(); - SuperRenderTypeBuffer.vertexSortingOrigin = BlockPos.ZERO; - } - } diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java index 97a741182..2b4c8a185 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java @@ -35,14 +35,6 @@ public class OrientedData extends BasicData { return setPosition(pos.getX(), pos.getY(), pos.getZ()); } - public OrientedData setPosition(int x, int y, int z) { - BlockPos origin = owner.renderer.getOriginCoordinate(); - - return setPosition((float) (x - origin.getX()), - (float) (y - origin.getY()), - (float) (z - origin.getZ())); - } - public OrientedData setPosition(float x, float y, float z) { this.posX = x; this.posY = y; diff --git a/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java b/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java index 66cefb99d..9f64634bc 100644 --- a/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java @@ -1,7 +1,5 @@ package com.simibubi.create.foundation.renderState; -import java.util.Objects; -import java.util.Optional; import java.util.SortedMap; import com.mojang.blaze3d.systems.RenderSystem; @@ -15,11 +13,9 @@ import net.minecraft.client.renderer.RegionRenderCacheBuilder; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; public class SuperRenderTypeBuffer implements IRenderTypeBuffer { - public static BlockPos vertexSortingOrigin = BlockPos.ZERO; static SuperRenderTypeBuffer instance; public static SuperRenderTypeBuffer getInstance() { @@ -100,20 +96,6 @@ public class SuperRenderTypeBuffer implements IRenderTypeBuffer { super(new BufferBuilder(256), createEntityBuilders()); } - public void draw(RenderType p_228462_1_) { - BlockPos v = vertexSortingOrigin; - BufferBuilder bufferbuilder = layerBuffers.getOrDefault(p_228462_1_, this.fallbackBuffer); - boolean flag = Objects.equals(this.currentLayer, p_228462_1_.asOptional()); - if (flag || bufferbuilder != this.fallbackBuffer) { - if (this.activeConsumers.remove(bufferbuilder)) { - p_228462_1_.draw(bufferbuilder, v.getX(), v.getY(), v.getZ()); - if (flag) { - this.currentLayer = Optional.empty(); - } - } - } - } - } } diff --git a/src/main/resources/assets/create/textures/gui/icons.png b/src/main/resources/assets/create/textures/gui/icons.png index c9d661aee..1dff79b36 100644 Binary files a/src/main/resources/assets/create/textures/gui/icons.png and b/src/main/resources/assets/create/textures/gui/icons.png differ