diff --git a/CHANGELOG.md b/CHANGELOG.md index 389ae4c2..719616b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,40 @@ # Mining Gadgets Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -## [1.15.2, 1.3.5] - 2020-03-29 -### Added +## 1.16.2 +### [1.5.0] - 2020-08-14 + +#### Changed +- Updated to 1.16 :+1: + +## 1.16.1 +### [1.4.1] - unreleased +#### Added +- Added a (disabled by default) key binding to open the Gadgets settings screen. (When enabled, it will disable the shift right click action) +- Added a Laser Beam preview to the Mining Gadget Visual Screen +- Added `Paver` upgrade which will place cobble (cost of 10FE per block) to create a path as you mine to cover up any holes. It will not place above your player's height, and we plan on changing it from cobble :D +- Modification table can now have upgrades dropped into it's upgrade area (pick up and drop down) +- Modification table now has an `empty state` to show helper text on how to use the table. +- Modification table now has a title :eyes: + +#### Changed +- Improved the look of the Mining Gadget Visual Screen +- The modification table will now show the full tooltip for you upgrades +- Bumped forge version + +#### Fixed + +- [#98] Config changes did not affect upgrade costs. +- Fixed client crash on shift clicking items to the Modification Table +- Fixed laser rendering through walls when another player is using the gadget + +### [1.4.0] - 2020-08-03 +#### Changed +- Updated the mod to 1.16.1 :+1: + +## 1.15.2 +### [1.3.5] - 2020-03-29 +#### Added - Support for all (if they respect events) items that pick up items (dank storage, pocket storage, etc) - Added the `E` key as a way to get out the Mining Gadget shift-click screen - Added support for both the Silk touch and Fortune upgrades to be applied to the same gadget but only one can be active at a time @@ -12,14 +44,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Added a charged variant of the gadget to the creative and JEI (1.3.3) - Added RU translations (Thanks to @Smollet777) -### Changed +#### Changed - Disabled the default overlay when using the gadget to stop showing two highlights at the same time - There is no longer a middle man slot for upgrades in the upgrade table. You can now shift click upgrades right into the gadget and click the upgrade to remove it - Slightly improved the light particle - The Mining Gadget can now ray trace through non-collidable blocks meaning it can now shoot though the Miners Light! - The Mining Gadget now adds to your break block stats :D -### Fixed +#### Fixed - Fixed Mining gadget being voided when left in a Modification table and breaking the table - Fixed an issue with OneProbe on RenderBlock look at - Fixed typo in tooltips @@ -28,8 +60,46 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Fixed voiding upgrades when normal clicking them in the modification table. - Allowing the Gadget to be used for infinite energy (1.3.3) -## [1.14.4, 1.0.0] - ? -### Added +### [1.3.1] - 2020-03-08 +#### Fixed +- Beta release now. Fixed a few bugs reporting in 1.3.0 + +### [1.3.0] - 2020-03-03 +#### Added +- The first release for 1.15.2 - I think its pretty stable? :) + +## 1.14.4 +### [1.2.4] +#### Added +- Added `ru` translations thanks to @Smollet777 +- You can now use the scroll wheel to change the sliders :D +- You can now shift click into the filter + +#### Fixed +- Fixed the filters not working #42 +- Fixed blacklist filtering system +- Added checking to make sure the dimention also allows for block breaking +- Partialy fixed an odd energy bug +- Fixed edgecase crashing on the render block + +#### Changed +- Optimised images and json files for a smaller mod build size +- Took the time to bump Forge up to `28.2.4` + +### [1.2.3] +#### Added +- Added Precision Mode (A Soaryn request!) + +### [1.2.2] +#### Fixed +- Fixed a dupe bug - Thanks Soaryn. + +### [1.2.1] +#### Added +- Added a tooltip to the upgrades and gadget to show RF costs. + +### [1.2.0] - ? +#### Added - The whole mod! # Example diff --git a/build.gradle b/build.gradle index 12c9666b..1a6c2333 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,7 @@ minecraft { } sourceSets.main.resources { srcDir 'src/generated/resources' } + repositories { maven { // JEI @@ -104,6 +105,7 @@ repositories { url 'https://www.dogforce-games.com/maven/' } } + dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. diff --git a/gradle.properties b/gradle.properties index e8fdaac4..e947618c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false #Mod Info -mod_version=1.4.0 +mod_version=1.4.1 #Dependencies -forge_version=1.16.1-32.0.63 +forge_version=1.16.1-32.0.108 mcp_version=20200712-1.16.1 -jei_version=1.16.1:7.0.0.6 \ No newline at end of file +jei_version=1.16.1:7.0.1.10 \ No newline at end of file diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 49abc6c9..869b7fab 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -1,33 +1,34 @@ b7013e95c0f001eefb22e978563099d6af098f17 assets/mininggadgets/blockstates/minerslight.json c2b2d34c116a3d6da9c62ce72021bd999590e3f2 assets/mininggadgets/blockstates/modificationtable.json 17f3e42d932950bb56cf0f43004c2badcef8cdc0 assets/mininggadgets/blockstates/renderblock.json -9b0d83d36145975cf2e0f2aa60cbbc4ed6e976de assets/mininggadgets/lang/en_us.json -ce3df1f391ab2c77491ef868783a7172ab3d99c8 assets/mininggadgets/models/block/minerslight.json -2a77a20ef18ce7564fd36090887955828fbc2d85 assets/mininggadgets/models/block/modificationtable.json -36717b860f1ae48e4ab1a72cd4cf5cdc481c5d2a assets/mininggadgets/models/block/renderblock.json +7b6864bd530b82aea92048d3b5208b716a30ae07 assets/mininggadgets/lang/en_us.json +973359b4f13b4c70416dd8b3e68a3a4d8886f14f assets/mininggadgets/models/block/minerslight.json +a28c42b7d4a511d87ae88461f1845ed1b6bbc401 assets/mininggadgets/models/block/modificationtable.json +30eb13c57d2684c6de2f1d2edfb7e535599b3a61 assets/mininggadgets/models/block/renderblock.json c7cb89cde2f2fa96162238c434620e5c5093e1e0 assets/mininggadgets/models/item/minerslight.json 18734ba6f77297dd2b3ca6f3b8ef706a4456e52b assets/mininggadgets/models/item/modificationtable.json -101767260cae85358ea8066f2b29497bbd39c241 assets/mininggadgets/models/item/upgrade_battery_1.json -441b07000c7e33c678aea7f84e348c816540d4db assets/mininggadgets/models/item/upgrade_battery_2.json -f90ee7125d690af479c91ba321e392258a3292f6 assets/mininggadgets/models/item/upgrade_battery_3.json -b2a4e32e2dd984c2c02ac943954d5c49cc987d6d assets/mininggadgets/models/item/upgrade_efficiency_1.json -f81d050842a1a25de54f285e7854260b70497aef assets/mininggadgets/models/item/upgrade_efficiency_2.json -9aa706e419c45edde9a55b62a71abf1c95bbadf1 assets/mininggadgets/models/item/upgrade_efficiency_3.json -99b3a6f834cb2a9cbffcc62984a0174b0960891d assets/mininggadgets/models/item/upgrade_efficiency_4.json -608ba244eba169219fe8b7da1c653dc556b42c24 assets/mininggadgets/models/item/upgrade_efficiency_5.json -05c7b227dea9c2191dae904668e25b4191caea26 assets/mininggadgets/models/item/upgrade_empty.json -c390605ae8278743d37fdd983fc5a14beb83626a assets/mininggadgets/models/item/upgrade_fortune_1.json -b7f9668b5187a8f327caa4d2b6f04be792ca8b6a assets/mininggadgets/models/item/upgrade_fortune_2.json -573fbcd143a7e6235fae38e18917df94f1a0cefa assets/mininggadgets/models/item/upgrade_fortune_3.json -d3c6a1e5bf2e5bb4e86390c564275618c1a90cd7 assets/mininggadgets/models/item/upgrade_freezing.json -b17d79c81dc26f54521cfd43d38f89716f9a613f assets/mininggadgets/models/item/upgrade_light_placer.json -7858a8472687d37e6bb382ba488a8fd25afb0e44 assets/mininggadgets/models/item/upgrade_magnet.json -b9bf7d0ef3f307e386537f388a3ef1e21fda91f8 assets/mininggadgets/models/item/upgrade_range_1.json -158c7fe8365e6ad0821db0fe327f78002793c964 assets/mininggadgets/models/item/upgrade_range_2.json -79fc52072c1ef8afd510215ac84b324ef4bac4d7 assets/mininggadgets/models/item/upgrade_range_3.json -830d8d2a7922eb33942d6f73aaa7b1708fd1777c assets/mininggadgets/models/item/upgrade_silk.json -27a1c29dec507aa043fcd44962ebe1d03d81e950 assets/mininggadgets/models/item/upgrade_three_by_three.json -50e40e2cd1b5afd7f06b32987b424e6d94d74539 assets/mininggadgets/models/item/upgrade_void_junk.json +03124e1ba86f9be7fb64caa66fe5bbb752cae3f2 assets/mininggadgets/models/item/upgrade_battery_1.json +0bf32736a1afe3582737acd30e13b91f1928c45d assets/mininggadgets/models/item/upgrade_battery_2.json +fdee7ff3eea155e8947b3a67398bacd160e75e48 assets/mininggadgets/models/item/upgrade_battery_3.json +7b95ba53768f6d2c1f810c983d58c3d827b23fbc assets/mininggadgets/models/item/upgrade_efficiency_1.json +49f634bcad8f9f0f9a30fa3fb78233fe546adb1d assets/mininggadgets/models/item/upgrade_efficiency_2.json +7c51e8a30851c918d414a827f3c6c757f08717bd assets/mininggadgets/models/item/upgrade_efficiency_3.json +31c29ea8c58ce269610dbcd92bcdc5658c2792c1 assets/mininggadgets/models/item/upgrade_efficiency_4.json +191def03fffa72f3aa414c0c85c59d56d76f5779 assets/mininggadgets/models/item/upgrade_efficiency_5.json +194518d5d2faf78756434fa1a18f8f2ad9583296 assets/mininggadgets/models/item/upgrade_empty.json +e6161f1c39ffd96a5005da98f5f8ca4282bda0ce assets/mininggadgets/models/item/upgrade_fortune_1.json +e2815e3ce5b9f75cbd4af7d54aa9366d06f52f77 assets/mininggadgets/models/item/upgrade_fortune_2.json +8e9049ad71e2f33f613b6669a5ca80ac5bc57786 assets/mininggadgets/models/item/upgrade_fortune_3.json +ba8917e3c2d877da76ab22c8b74527d88035fb46 assets/mininggadgets/models/item/upgrade_freezing.json +27927c9fb7122ba8e3a22f79b03af9b3390da023 assets/mininggadgets/models/item/upgrade_light_placer.json +a886745775c5c632a20d5232a3bbec5650815a47 assets/mininggadgets/models/item/upgrade_magnet.json +f73ebc92f07527746d919afe2797686a4c8ec76d assets/mininggadgets/models/item/upgrade_paver.json +9490052868ec9732110ac60f56f0d3225537ecd2 assets/mininggadgets/models/item/upgrade_range_1.json +cb0c341c014dd44118b38cd3e92ee791868411b1 assets/mininggadgets/models/item/upgrade_range_2.json +7f4c09db6454ab72dc8728d88f6c781b1072f3cc assets/mininggadgets/models/item/upgrade_range_3.json +72a06fd3b75df16c683ce816a52802f603580c47 assets/mininggadgets/models/item/upgrade_silk.json +874d2494436b644dd14a7fd929681b977f611e4f assets/mininggadgets/models/item/upgrade_three_by_three.json +78c4ab195fe9b83b63edfaef11c9c2819947bc90 assets/mininggadgets/models/item/upgrade_void_junk.json a4843d0fda4ad7b586ea116b9bce8718d7f84c4d data/mininggadgets/advancements/recipes/mininggadgets/mininggadget.json 3e054d08ee649172d7f210b913d870fe1db1371e data/mininggadgets/advancements/recipes/mininggadgets/modificationtable.json 0fcaaf2f4b432fd60d54449fefdd5706db990acd data/mininggadgets/advancements/recipes/mininggadgets/upgrade_battery_1.json @@ -45,6 +46,7 @@ bd2411710dbace4b2fd6bd497f1b72f5c38bb1cb data/mininggadgets/advancements/recipes 0dadf0a570e4dd3f6a58dfc3e353358189c7d7cc data/mininggadgets/advancements/recipes/mininggadgets/upgrade_freezing.json 1d5c700c2094424a0d8715bcb06f824c6b7f586f data/mininggadgets/advancements/recipes/mininggadgets/upgrade_light_placer.json 1d39e37715fc3cbb835061e6b3a0368233afd12e data/mininggadgets/advancements/recipes/mininggadgets/upgrade_magnet.json +eb2745d644ec190f2ce7f89cf10f9d6b99463562 data/mininggadgets/advancements/recipes/mininggadgets/upgrade_paver.json 309536ff89d635953a5e4667cd9acc23803d9bf7 data/mininggadgets/advancements/recipes/mininggadgets/upgrade_range_1.json e8da478c9942f6af968c57b1a8cbabe4618d2a90 data/mininggadgets/advancements/recipes/mininggadgets/upgrade_range_2.json f807888493861b3ee63ed74a2bddf997b216a7cd data/mininggadgets/advancements/recipes/mininggadgets/upgrade_range_3.json @@ -69,6 +71,7 @@ aa2f3c7f4bac48370c1fe3caed05cce522a042d7 data/mininggadgets/recipes/upgrade_fort b467cc07cf27fba3063df81a633a47bc25be5435 data/mininggadgets/recipes/upgrade_freezing.json 7af68c6d0182139282d7dd736de48e77077bec44 data/mininggadgets/recipes/upgrade_light_placer.json e10f01adc6b02ca619c083abc87890fd713fbd8b data/mininggadgets/recipes/upgrade_magnet.json +36ede190249a62220d76ea7e599caa3bf1a793fa data/mininggadgets/recipes/upgrade_paver.json 4b4bf63d46c738ff042d3216373ff29e0df6625f data/mininggadgets/recipes/upgrade_range_1.json ef0547b32ed33ab3a42b7a39ab0cf3c689466472 data/mininggadgets/recipes/upgrade_range_2.json 1e4dbf81b1aed88f76c29c26c00a65ddc6ee93b1 data/mininggadgets/recipes/upgrade_range_3.json diff --git a/src/generated/resources/assets/mininggadgets/lang/en_us.json b/src/generated/resources/assets/mininggadgets/lang/en_us.json index 1badf53a..8c8a0574 100644 --- a/src/generated/resources/assets/mininggadgets/lang/en_us.json +++ b/src/generated/resources/assets/mininggadgets/lang/en_us.json @@ -19,6 +19,7 @@ "item.mininggadgets.upgrade_freezing": "Upgrade: Freezing", "item.mininggadgets.upgrade_light_placer": "Upgrade: Light Placer", "item.mininggadgets.upgrade_magnet": "Upgrade: Magnet", + "item.mininggadgets.upgrade_paver": "Upgrade: Paver", "item.mininggadgets.upgrade_range_1": "Upgrade: Range, Tier 1", "item.mininggadgets.upgrade_range_2": "Upgrade: Range, Tier 2", "item.mininggadgets.upgrade_range_3": "Upgrade: Range, Tier 3", @@ -28,27 +29,31 @@ "itemGroup.mininggadgets": "Mining Gadgets", "mininggadgets.gadget.energy": "Energy: %d/%d", "mininggadgets.gadget.range_change": "Range Change: %1$d x %1$d", + "mininggadgets.text.empty_table_helper": "Shift click to insert from your slots\nor drop upgrade onto this screen.\n\nClick upgrade to remove.", + "mininggadgets.text.modification_table": "Modification Table", + "mininggadgets.text.open_gui": "Open Mining Gadget Settings", "mininggadgets.tooltip.item.battery_boost": "Battery Boost: %1$d", "mininggadgets.tooltip.item.break_cost": "Per Block Cost: %1$d", "mininggadgets.tooltip.item.show_upgrades": "Hold %s to show upgrades", "mininggadgets.tooltip.item.upgrade_cost": "Upgrade Cost: %1$d", "mininggadgets.tooltip.item.upgrades": "Current Upgrades:", "mininggadgets.tooltip.item.use_cost": "+%1$d FE per use", + "mininggadgets.tooltip.screen.beam_preview": "Beam preview", "mininggadgets.tooltip.screen.blacklist": "Blacklist active", - "mininggadgets.tooltip.screen.blue_inner": "Blue Inner", - "mininggadgets.tooltip.screen.blue_outer": "Blue Outer", + "mininggadgets.tooltip.screen.block_break_style": "Breaking Style", + "mininggadgets.tooltip.screen.blue": "Blue", "mininggadgets.tooltip.screen.delay_explain": "Controls how often a freeze particle is spawned\nby default it is one particle every tick, to reduce\nthe amount of particles add more delay", "mininggadgets.tooltip.screen.edit_filters": "Edit Filters", "mininggadgets.tooltip.screen.fade": "Fade Blocks", "mininggadgets.tooltip.screen.freeze_delay": "Freeze Delay", - "mininggadgets.tooltip.screen.green_inner": "Green Inner", - "mininggadgets.tooltip.screen.green_outer": "Green Outer", + "mininggadgets.tooltip.screen.green": "Green", + "mininggadgets.tooltip.screen.inner_color": "Inner beam color", "mininggadgets.tooltip.screen.mining_gadget": "Gadget Settings", "mininggadgets.tooltip.screen.no_upgrades": "No Upgrades available", + "mininggadgets.tooltip.screen.outer_color": "Outer glow color", "mininggadgets.tooltip.screen.precision_mode": "Precision Mode: %1$d", "mininggadgets.tooltip.screen.range": "Range", - "mininggadgets.tooltip.screen.red_inner": "Red Inner", - "mininggadgets.tooltip.screen.red_outer": "Red Outer", + "mininggadgets.tooltip.screen.red": "Red", "mininggadgets.tooltip.screen.shrink": "Shrink Blocks", "mininggadgets.tooltip.screen.size": "Size: %1$d x %1$d", "mininggadgets.tooltip.screen.ticks": "ticks", @@ -67,6 +72,7 @@ "tooltop.mininggadgets.freezing": "Freezes water and stops lava in it's place!", "tooltop.mininggadgets.light_placer": "Places touches whenever the surroundings light level is lower than 8", "tooltop.mininggadgets.magnet": "Deconstructs blocks right into your inventory", + "tooltop.mininggadgets.paver": "Creates a path for you as you mine", "tooltop.mininggadgets.range": "Extends your range by 5 times with each tier", "tooltop.mininggadgets.silk": "Applies the silk touch enchant to the Mining Gadget", "tooltop.mininggadgets.three_by_three": "Allows for a 3x3 mining radius", diff --git a/src/generated/resources/assets/mininggadgets/models/block/minerslight.json b/src/generated/resources/assets/mininggadgets/models/block/minerslight.json index df3316a2..6c6253b1 100644 --- a/src/generated/resources/assets/mininggadgets/models/block/minerslight.json +++ b/src/generated/resources/assets/mininggadgets/models/block/minerslight.json @@ -1,5 +1,5 @@ { - "parent": "block/cube_all", + "parent": "minecraft:block/cube_all", "textures": { "all": "mininggadgets:block/minerslight" } diff --git a/src/generated/resources/assets/mininggadgets/models/block/modificationtable.json b/src/generated/resources/assets/mininggadgets/models/block/modificationtable.json index d3cebec4..ae3dabc7 100644 --- a/src/generated/resources/assets/mininggadgets/models/block/modificationtable.json +++ b/src/generated/resources/assets/mininggadgets/models/block/modificationtable.json @@ -1,5 +1,5 @@ { - "parent": "block/cube", + "parent": "minecraft:block/cube", "textures": { "down": "mininggadgets:block/modificationtable_bottom", "up": "mininggadgets:block/modificationtable_top", diff --git a/src/generated/resources/assets/mininggadgets/models/block/renderblock.json b/src/generated/resources/assets/mininggadgets/models/block/renderblock.json index 6bab74a6..37d1d10c 100644 --- a/src/generated/resources/assets/mininggadgets/models/block/renderblock.json +++ b/src/generated/resources/assets/mininggadgets/models/block/renderblock.json @@ -1,5 +1,5 @@ { - "parent": "block/cube_all", + "parent": "minecraft:block/cube_all", "textures": { "all": "mininggadgets:block/renderblock" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_1.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_1.json index 58a66e7f..e41ee7b8 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_1.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_1.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_battery_1" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_2.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_2.json index ff1592ff..2f1315ad 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_2.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_2.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_battery_2" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_3.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_3.json index b082cda1..2e4fe14b 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_3.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_battery_3.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_battery_3" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_1.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_1.json index deab10b0..2df644ee 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_1.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_1.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_efficiency_1" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_2.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_2.json index 408b33b6..10fb4ea2 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_2.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_2.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_efficiency_2" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_3.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_3.json index d3b38474..58ec9161 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_3.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_3.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_efficiency_3" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_4.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_4.json index d0d201ef..028036bb 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_4.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_4.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_efficiency_4" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_5.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_5.json index bef078ac..1ccdaeae 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_5.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_efficiency_5.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_efficiency_5" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_empty.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_empty.json index 8098bf25..9fc5ef4f 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_empty.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_empty.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_empty" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_1.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_1.json index bb3eaec6..d3832e6b 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_1.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_1.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_fortune_1" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_2.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_2.json index 67d9540d..cfb83349 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_2.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_2.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_fortune_2" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_3.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_3.json index 7c5c00a8..c0effa52 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_3.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_fortune_3.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_fortune_3" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_freezing.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_freezing.json index ce0b2b90..6760e302 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_freezing.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_freezing.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_freezing" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_light_placer.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_light_placer.json index 30f5e73b..6280c878 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_light_placer.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_light_placer.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_light_placer" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_magnet.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_magnet.json index 84c707aa..5eb797b0 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_magnet.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_magnet.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_magnet" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_paver.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_paver.json new file mode 100644 index 00000000..969f8614 --- /dev/null +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_paver.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "mininggadgets:item/upgrade_paver" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_1.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_1.json index bd4212a7..1a1a25a5 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_1.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_1.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_range_1" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_2.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_2.json index 6b6ff382..2bb16cf7 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_2.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_2.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_range_2" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_3.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_3.json index dfaac2ce..f78bafa5 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_3.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_range_3.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_range_3" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_silk.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_silk.json index 364b2ca9..daad4d61 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_silk.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_silk.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_silk" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_three_by_three.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_three_by_three.json index fd292537..0842ee89 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_three_by_three.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_three_by_three.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_three_by_three" } diff --git a/src/generated/resources/assets/mininggadgets/models/item/upgrade_void_junk.json b/src/generated/resources/assets/mininggadgets/models/item/upgrade_void_junk.json index d89a98d5..262c6876 100644 --- a/src/generated/resources/assets/mininggadgets/models/item/upgrade_void_junk.json +++ b/src/generated/resources/assets/mininggadgets/models/item/upgrade_void_junk.json @@ -1,5 +1,5 @@ { - "parent": "item/handheld", + "parent": "minecraft:item/handheld", "textures": { "layer0": "mininggadgets:item/upgrade_void_junk" } diff --git a/src/generated/resources/data/mininggadgets/advancements/recipes/mininggadgets/upgrade_paver.json b/src/generated/resources/data/mininggadgets/advancements/recipes/mininggadgets/upgrade_paver.json new file mode 100644 index 00000000..b60faf9e --- /dev/null +++ b/src/generated/resources/data/mininggadgets/advancements/recipes/mininggadgets/upgrade_paver.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "mininggadgets:upgrade_paver" + ] + }, + "criteria": { + "has_upgrade": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "mininggadgets:upgrade_empty" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "mininggadgets:upgrade_paver" + } + } + }, + "requirements": [ + [ + "has_upgrade", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/mininggadgets/recipes/upgrade_paver.json b/src/generated/resources/data/mininggadgets/recipes/upgrade_paver.json new file mode 100644 index 00000000..362965a7 --- /dev/null +++ b/src/generated/resources/data/mininggadgets/recipes/upgrade_paver.json @@ -0,0 +1,34 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "rgr", + "cuc", + "lpw" + ], + "key": { + "r": { + "tag": "forge:dusts/redstone" + }, + "c": { + "tag": "forge:cobblestone" + }, + "u": { + "item": "mininggadgets:upgrade_empty" + }, + "g": { + "tag": "forge:nuggets/gold" + }, + "l": { + "item": "minecraft:lava_bucket" + }, + "p": { + "item": "minecraft:piston" + }, + "w": { + "item": "minecraft:water_bucket" + } + }, + "result": { + "item": "mininggadgets:upgrade_paver" + } +} \ No newline at end of file diff --git a/src/main/java/com/direwolf20/mininggadgets/client/ClientEvents.java b/src/main/java/com/direwolf20/mininggadgets/client/ClientEvents.java index 1e5211cf..0e9bd4fb 100644 --- a/src/main/java/com/direwolf20/mininggadgets/client/ClientEvents.java +++ b/src/main/java/com/direwolf20/mininggadgets/client/ClientEvents.java @@ -2,12 +2,15 @@ import com.direwolf20.mininggadgets.client.renderer.BlockOverlayRender; import com.direwolf20.mininggadgets.client.renderer.RenderMiningLaser2; +import com.direwolf20.mininggadgets.client.screens.ModScreens; +import com.direwolf20.mininggadgets.common.MiningGadgets; import com.direwolf20.mininggadgets.common.items.MiningGadget; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.AbstractClientPlayerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.DrawHighlightEvent; +import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -44,4 +47,20 @@ static void renderWorldLastEvent(RenderWorldLastEvent evt) { } } } + + @SubscribeEvent + static void keyPressed(InputEvent.KeyInputEvent event) { + if (OurKeys.shiftClickGuiBinding.isPressed() && Minecraft.getInstance().currentScreen == null) { + if (Minecraft.getInstance().player == null) { + return; + } + + ItemStack gadget = MiningGadget.getGadget(Minecraft.getInstance().player); + if (gadget.isEmpty()) { + return; + } + + ModScreens.openGadgetSettingsScreen(gadget); + } + } } diff --git a/src/main/java/com/direwolf20/mininggadgets/client/OurKeys.java b/src/main/java/com/direwolf20/mininggadgets/client/OurKeys.java new file mode 100644 index 00000000..3e305236 --- /dev/null +++ b/src/main/java/com/direwolf20/mininggadgets/client/OurKeys.java @@ -0,0 +1,13 @@ +package com.direwolf20.mininggadgets.client; + +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.client.util.InputMappings; +import net.minecraftforge.fml.client.registry.ClientRegistry; + +public class OurKeys { + public static final KeyBinding shiftClickGuiBinding = new KeyBinding("mininggadgets.text.open_gui", InputMappings.INPUT_INVALID.getKeyCode(), "itemGroup.mininggadgets"); + + public static void register() { + ClientRegistry.registerKeyBinding(shiftClickGuiBinding); + } +} diff --git a/src/main/java/com/direwolf20/mininggadgets/client/renderer/RenderMiningLaser2.java b/src/main/java/com/direwolf20/mininggadgets/client/renderer/RenderMiningLaser2.java index 5e1cf653..3d433fe8 100644 --- a/src/main/java/com/direwolf20/mininggadgets/client/renderer/RenderMiningLaser2.java +++ b/src/main/java/com/direwolf20/mininggadgets/client/renderer/RenderMiningLaser2.java @@ -6,7 +6,6 @@ import com.direwolf20.mininggadgets.common.items.upgrade.Upgrade; import com.direwolf20.mininggadgets.common.items.upgrade.UpgradeTools; import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; @@ -67,7 +66,7 @@ private static void drawLasers(RenderWorldLastEvent event, Vector3d from, RayTra IVertexBuilder builder; ItemStack stack = player.getHeldItem(activeHand); - double distance = from.subtract(trace.getHitVec()).length(); + double distance = Math.max(1, from.subtract(trace.getHitVec()).length()); long gameTime = player.world.getGameTime(); double v = gameTime * speedModifier; float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime); @@ -104,7 +103,7 @@ private static void drawLasers(RenderWorldLastEvent event, Vector3d from, RayTra builder = buffer.getBuffer(MyRenderType.LASER_MAIN_CORE); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness/2, activeHand, distance, v, v + distance * 1.5, ticks, beam2r,beam2g,beam2b,1f); matrix.pop(); - RenderSystem.disableDepthTest(); +// RenderSystem.disableDepthTest(); buffer.finish(); } @@ -128,8 +127,8 @@ private static void drawBeam(double xOffset, double yOffset, double zOffset, IVe } float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch)); float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw)); - startXOffset = startXOffset + (f1 / 100000000); - startYOffset = startYOffset + (f / 100000000); + startXOffset = startXOffset + (f1 / 750); + startYOffset = startYOffset + (f / 750); Vector4f vec1 = new Vector4f(startXOffset, -thickness + startYOffset, startZOffset, 1.0F); vec1.transform(positionMatrix); diff --git a/src/main/java/com/direwolf20/mininggadgets/client/screens/MiningVisualsScreen.java b/src/main/java/com/direwolf20/mininggadgets/client/screens/MiningVisualsScreen.java index be5f70e1..8d6a891a 100644 --- a/src/main/java/com/direwolf20/mininggadgets/client/screens/MiningVisualsScreen.java +++ b/src/main/java/com/direwolf20/mininggadgets/client/screens/MiningVisualsScreen.java @@ -5,6 +5,7 @@ import com.direwolf20.mininggadgets.common.network.packets.PacketChangeBreakType; import com.direwolf20.mininggadgets.common.network.packets.PacketChangeColor; import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.util.InputMappings; @@ -52,7 +53,7 @@ protected void init() { else buttonText = new TranslationTextComponent("mininggadgets.tooltip.screen.fade"); - blockBreakButton = new Button(baseX - (150 / 2), baseY - 50, 150, 20, buttonText, (button) -> { + blockBreakButton = new Button(baseX - (150), baseY - 55, 150, 20, buttonText, (button) -> { if (blockBreakButton.getMessage().getString().contains("Shrink")) button.setMessage(new TranslationTextComponent("mininggadgets.tooltip.screen.fade")); else @@ -63,18 +64,18 @@ protected void init() { addButton(blockBreakButton); - sliderRedInner = new Slider(baseX - (150), baseY - 25, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.red_outer").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.red, false, true, s -> { + sliderRedInner = new Slider(baseX - (150), baseY - 10, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.red").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.red, false, true, s -> { }, this); - sliderGreenInner = new Slider(baseX - (150), baseY + 5, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.green_outer").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.green, false, true, s -> { + sliderGreenInner = new Slider(baseX - (150), baseY + 15, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.green").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.green, false, true, s -> { }, this); - sliderBlueInner = new Slider(baseX - (150), baseY + 35, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.blue_outer").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.blue, false, true, s -> { + sliderBlueInner = new Slider(baseX - (150), baseY + 40, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.blue").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.blue, false, true, s -> { }, this); - sliderRedOuter = new Slider(baseX + (25), baseY - 25, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.red_inner").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.red_inner, false, true, s -> { + sliderRedOuter = new Slider(baseX + (25), baseY - 10, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.red").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.red_inner, false, true, s -> { }, this); - sliderGreenOuter = new Slider(baseX + (25), baseY + 5, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.green_inner").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.green_inner, false, true, s -> { + sliderGreenOuter = new Slider(baseX + (25), baseY + 15, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.green").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.green_inner, false, true, s -> { }, this); - sliderBlueOuter = new Slider(baseX + (25), baseY + 35, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.blue_inner").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.blue_inner, false, true, s -> { + sliderBlueOuter = new Slider(baseX + (25), baseY + 40, 150, 20, new TranslationTextComponent("mininggadgets.tooltip.screen.blue").appendString(": "), StringTextComponent.EMPTY, 0, 255, this.blue_inner, false, true, s -> { }, this); addButton(sliderRedInner); @@ -90,9 +91,24 @@ public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks this.renderBackground(stack); super.render(stack, mouseX, mouseY, partialTicks); - drawCenteredString(stack, getMinecraft().fontRenderer, new TranslationTextComponent("mininggadgets.tooltip.screen.visual_settings").getUnformattedComponentText(), (width / 2), (height / 2) - 70, Color.WHITE.getRGB()); - //drawCenteredString(getMinecraft().fontRenderer, "Toggle Upgrades", (width / 2), (height / 2) + 20, Color.WHITE.getRGB()); + drawCenteredString(stack, font, new TranslationTextComponent("mininggadgets.tooltip.screen.visual_settings"), (width / 2), (height / 2) - 95, 0xFFFFFF); + drawString(stack, font, new TranslationTextComponent("mininggadgets.tooltip.screen.block_break_style"), (width / 2) - 150, (height / 2) - 70, 0xFFFFFF); + drawString(stack, font, new TranslationTextComponent("mininggadgets.tooltip.screen.beam_preview"), (width / 2) + 25, (height / 2) - 70, 0xFFFFFF); + drawString(stack, font, new TranslationTextComponent("mininggadgets.tooltip.screen.outer_color"), (width / 2) - 150, (height / 2) - 25, 0xFFFFFF); + drawString(stack, font, new TranslationTextComponent("mininggadgets.tooltip.screen.inner_color"), (width / 2) + 25, (height / 2) - 25, 0xFFFFFF); + stack.push(); + fill(stack, (width / 2) + 25, (height / 2) - 55, ((width / 2) + 25) + 150, ((height / 2) - 55) + 20, this.rgbToInt(this.red, this.green, this.blue)); + fill(stack, (width / 2) + 25, (height / 2) - 50, ((width / 2) + 25) + 150, ((height / 2) - 50) + 10, this.rgbToInt(this.red_inner, this.green_inner, this.blue_inner)); + stack.pop(); + } + + private int rgbToInt(int r, int g, int b) { + int red = (r << 16) & 0x00FF0000; + int green = (g << 8) & 0x0000FF00; + int blue = b & 0x000000FF; + + return 0xFF000000 | red | green | blue; } @Override @@ -103,17 +119,28 @@ public boolean isPauseScreen() { @Override public void onClose() { super.onClose(); + } + + private void syncColors() { PacketHandler.sendToServer(new PacketChangeColor(this.red, this.green, this.blue, this.red_inner, this.green_inner, this.blue_inner)); } @Override public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { InputMappings.Input mouseKey = InputMappings.getInputByCode(p_keyPressed_1_, p_keyPressed_2_); - if (p_keyPressed_1_ == 256 || minecraft.gameSettings.keyBindInventory.isActiveAndMatches(mouseKey)) { + if (p_keyPressed_1_ == 256) { + syncColors(); + ModScreens.openGadgetSettingsScreen(this.gadget); + return true; + } + + if (getMinecraft().gameSettings.keyBindInventory.isActiveAndMatches(mouseKey)) { + syncColors(); onClose(); return true; } + return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_); } diff --git a/src/main/java/com/direwolf20/mininggadgets/client/screens/ModificationTableScreen.java b/src/main/java/com/direwolf20/mininggadgets/client/screens/ModificationTableScreen.java index ced9f6c1..5b5618ea 100644 --- a/src/main/java/com/direwolf20/mininggadgets/client/screens/ModificationTableScreen.java +++ b/src/main/java/com/direwolf20/mininggadgets/client/screens/ModificationTableScreen.java @@ -2,27 +2,34 @@ import com.direwolf20.mininggadgets.common.MiningGadgets; import com.direwolf20.mininggadgets.common.containers.ModificationTableContainer; +import com.direwolf20.mininggadgets.common.items.MiningGadget; +import com.direwolf20.mininggadgets.common.items.UpgradeCard; import com.direwolf20.mininggadgets.common.items.upgrade.Upgrade; import com.direwolf20.mininggadgets.common.network.PacketHandler; import com.direwolf20.mininggadgets.common.network.packets.PacketExtractUpgrade; +import com.direwolf20.mininggadgets.common.network.packets.PacketInsertUpgrade; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.client.gui.ScrollPanel; +import net.minecraftforge.fml.ForgeI18n; public class ModificationTableScreen extends ContainerScreen { private ResourceLocation GUI = new ResourceLocation(MiningGadgets.MOD_ID, "textures/gui/modificationtable.png"); private BlockPos tePos; private ModificationTableContainer container; + private PlayerInventory playerInventory; private ScrollingUpgrades scrollingUpgrades; @@ -30,6 +37,7 @@ public ModificationTableScreen(ModificationTableContainer container, PlayerInven super(container, inv, name); this.tePos = container.getTE().getPos(); this.container = container; + this.playerInventory = inv; } @Override @@ -39,12 +47,33 @@ public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks this.scrollingUpgrades.render(stack, mouseX, mouseY, partialTicks); this.func_230459_a_(stack, mouseX, mouseY); // @mcp: func_230459_a_ = renderHoveredToolTip + + int relX = (this.width) / 2; + int relY = (this.height) / 2; + + drawCenteredString(stack, font, ForgeI18n.getPattern(String.format("%s.%s", MiningGadgets.MOD_ID, "text.modification_table")), relX, relY - 105, 0xFFFFFF); + + if (this.container.getUpgradesCache().size() == 0) { + String string = ForgeI18n.getPattern(String.format("%s.%s", MiningGadgets.MOD_ID, "text.empty_table_helper")); + String[] parts = string.split("\n"); + for (int i = 0; i < parts.length; i++) { + drawScaledCenteredString(stack, (relX + 17) - (font.getStringWidth(parts[0]) / 2), (relY - 68) + (i * font.FONT_HEIGHT), .8f, parts[i], 0xFFFFFF); + } + } } @Override protected void func_230451_b_(MatrixStack stack, int mouseX, int mouseY) { // @mcp: func_230451_b_ = drawGuiContainerForegroundLayer } + private void drawScaledCenteredString(MatrixStack matrices, int x, int y, float scale, String textComponent, int color) { + matrices.push(); + matrices.translate(x, y, 0); + matrices.scale(scale, scale, scale); + drawString(matrices, font, textComponent, 0, 0, color); + matrices.pop(); + } + @Override protected void func_230450_a_(MatrixStack stack, float partialTicks, int mouseX, int mouseY) { // @mcp: func_230450_a_ = drawGuiContainerBackgroundLayer RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -62,6 +91,20 @@ public void init() { this.children.add(this.scrollingUpgrades); } + @Override + public boolean mouseClicked(double mouseXIn, double mouseYIn, int p_231044_5_) { + ItemStack heldStack = this.playerInventory.getItemStack(); + ItemStack gadget = this.container.inventorySlots.get(0).getStack(); + if (!gadget.isEmpty() && gadget.getItem() instanceof MiningGadget && !heldStack.isEmpty() && heldStack.getItem() instanceof UpgradeCard) { + if (scrollingUpgrades.isMouseOver(mouseXIn, mouseYIn)) { + // Send packet to remove the item from the inventory and add it to the table + PacketHandler.sendToServer(new PacketInsertUpgrade(this.tePos, heldStack)); + playerInventory.setItemStack(ItemStack.EMPTY); + } + } + return super.mouseClicked(mouseXIn, mouseYIn, p_231044_5_); + } + private static class ScrollingUpgrades extends ScrollPanel { ModificationTableScreen parent; Upgrade upgrade = null; @@ -124,7 +167,7 @@ public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks super.render(stack, mouseX, mouseY, partialTicks); if( this.upgrade != null ) - this.parent.renderTooltip(stack, new TranslationTextComponent(this.upgrade.getLocal()), mouseX, mouseY); + this.parent.renderTooltip(stack, this.upgrade.getStack().getTooltip(this.parent.getMinecraft().player, ITooltipFlag.TooltipFlags.NORMAL), mouseX, mouseY); } } } diff --git a/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java b/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java index af5e09d7..c036fda0 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java @@ -2,12 +2,15 @@ import com.direwolf20.mininggadgets.client.ClientEvents; import com.direwolf20.mininggadgets.client.ClientSetup; +import com.direwolf20.mininggadgets.client.OurKeys; import com.direwolf20.mininggadgets.common.blocks.ModBlocks; import com.direwolf20.mininggadgets.common.containers.ModContainers; import com.direwolf20.mininggadgets.common.events.ServerTickHandler; import com.direwolf20.mininggadgets.common.items.MiningGadget; import com.direwolf20.mininggadgets.common.items.ModItems; import com.direwolf20.mininggadgets.common.network.PacketHandler; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.client.util.InputMappings; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; @@ -15,6 +18,7 @@ import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -23,6 +27,7 @@ import net.minecraftforge.fml.loading.FMLPaths; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.lwjgl.glfw.GLFW; @Mod(MiningGadgets.MOD_ID) public class MiningGadgets @@ -82,6 +87,7 @@ private void setup(final FMLCommonSetupEvent event) private void setupClient(final FMLClientSetupEvent event) { // Register the container screens. ClientSetup.setup(); + OurKeys.register(); MinecraftForge.EVENT_BUS.register(ClientEvents.class); } diff --git a/src/main/java/com/direwolf20/mininggadgets/common/containers/ModificationTableContainer.java b/src/main/java/com/direwolf20/mininggadgets/common/containers/ModificationTableContainer.java index 7bfc36e9..1a8d8ddb 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/containers/ModificationTableContainer.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/containers/ModificationTableContainer.java @@ -134,7 +134,7 @@ public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { else return ItemStack.EMPTY; } else if (index < 29) { - if (!this.mergeItemStack(stack, 29, 38, false)) { + if (!this.mergeItemStack(stack, 29, 37, false)) { return ItemStack.EMPTY; } } else if (index < 38 && !this.mergeItemStack(stack, 1, 29, false)) { diff --git a/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorLanguage.java b/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorLanguage.java index 5cba7441..372755e8 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorLanguage.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorLanguage.java @@ -27,6 +27,7 @@ protected void addTranslations() { addItem(ModItems.LIGHT_PLACER, "Upgrade: Light Placer"); addItem(ModItems.MAGNET, "Upgrade: Magnet"); addItem(ModItems.THREE_BY_THREE, "Upgrade: 3x3"); + addItem(ModItems.PAVER, "Upgrade: Paver"); addItem(ModItems.VOID_JUNK, "Upgrade: Void Junk"); addItem(ModItems.FORTUNE_1, "Upgrade: Fortune, Tier 1"); addItem(ModItems.FORTUNE_2, "Upgrade: Fortune, Tier 2"); @@ -55,6 +56,7 @@ protected void addTranslations() { add("tooltop.mininggadgets.battery", "Upgrades the internal capacitors"); add("tooltop.mininggadgets.range", "Extends your range by 5 times with each tier"); add("tooltop.mininggadgets.efficiency", "Applies efficiency to the Mining Gadget"); + add("tooltop.mininggadgets.paver", "Creates a path for you as you mine"); // Blocks addBlock(ModBlocks.MINERS_LIGHT, "Miner's Light"); @@ -77,6 +79,10 @@ protected void addTranslations() { addPrefixed("tooltip.item.battery_boost", "Battery Boost: %1$d"); addPrefixed("tooltip.item.break_cost", "Per Block Cost: %1$d"); + addPrefixed("text.modification_table", "Modification Table"); + addPrefixed("text.empty_table_helper", "Shift click to insert from your slots\nor drop upgrade onto this screen.\n\nClick upgrade to remove."); + addPrefixed("text.open_gui", "Open Mining Gadget Settings"); + // Screen Buttons and text addPrefixed("tooltip.screen.size", "Size: %1$d x %1$d"); addPrefixed("tooltip.screen.range", "Range"); @@ -84,12 +90,13 @@ protected void addTranslations() { addPrefixed("tooltip.screen.mining_gadget", "Gadget Settings"); addPrefixed("tooltip.screen.shrink", "Shrink Blocks"); addPrefixed("tooltip.screen.fade", "Fade Blocks"); - addPrefixed("tooltip.screen.red_inner", "Red Inner"); - addPrefixed("tooltip.screen.green_inner", "Green Inner"); - addPrefixed("tooltip.screen.blue_inner", "Blue Inner"); - addPrefixed("tooltip.screen.red_outer", "Red Outer"); - addPrefixed("tooltip.screen.green_outer", "Green Outer"); - addPrefixed("tooltip.screen.blue_outer", "Blue Outer"); + addPrefixed("tooltip.screen.red", "Red"); + addPrefixed("tooltip.screen.green", "Green"); + addPrefixed("tooltip.screen.blue", "Blue"); + addPrefixed("tooltip.screen.block_break_style", "Breaking Style"); + addPrefixed("tooltip.screen.outer_color", "Outer glow color"); + addPrefixed("tooltip.screen.inner_color", "Inner beam color"); + addPrefixed("tooltip.screen.beam_preview", "Beam preview"); addPrefixed("tooltip.screen.visual_settings", "Visual Settings"); addPrefixed("tooltip.screen.toggle_upgrades", "Toggle Upgrades"); addPrefixed("tooltip.screen.edit_filters", "Edit Filters"); diff --git a/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorRecipes.java b/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorRecipes.java index 08dd0a3f..46402a7c 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorRecipes.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/data/GeneratorRecipes.java @@ -276,5 +276,19 @@ protected void registerRecipes(Consumer consumer) { .patternLine("ror") .addCriterion("has_upgrade", hasItem(UPGRADE_EMPTY.get())) .build(consumer); + + ShapedRecipeBuilder.shapedRecipe(PAVER.get()) + .key('r', Tags.Items.DUSTS_REDSTONE) + .key('c', Tags.Items.COBBLESTONE) + .key('u', UPGRADE_EMPTY.get()) + .key('g', Tags.Items.NUGGETS_GOLD) + .key('l', Items.LAVA_BUCKET) + .key('p', Blocks.PISTON) + .key('w', Items.WATER_BUCKET) + .patternLine("rgr") + .patternLine("cuc") + .patternLine("lpw") + .addCriterion("has_upgrade", hasItem(UPGRADE_EMPTY.get())) + .build(consumer); } } diff --git a/src/main/java/com/direwolf20/mininggadgets/common/items/MiningGadget.java b/src/main/java/com/direwolf20/mininggadgets/common/items/MiningGadget.java index 0d68fca5..54904171 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/items/MiningGadget.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/items/MiningGadget.java @@ -1,5 +1,6 @@ package com.direwolf20.mininggadgets.common.items; +import com.direwolf20.mininggadgets.client.OurKeys; import com.direwolf20.mininggadgets.client.particles.playerparticle.PlayerParticleData; import com.direwolf20.mininggadgets.client.screens.ModScreens; import com.direwolf20.mininggadgets.common.Config; @@ -53,6 +54,7 @@ import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.ForgeI18n; +import org.lwjgl.glfw.GLFW; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -225,8 +227,11 @@ private ActionResult onItemShiftRightClick(World world, PlayerEntity if (!world.isRemote) MiningProperties.setCanMine(itemstack, true); - if (world.isRemote) - ModScreens.openGadgetSettingsScreen(itemstack); + if (world.isRemote) { + if (OurKeys.shiftClickGuiBinding.getKey() == InputMappings.INPUT_INVALID) { + ModScreens.openGadgetSettingsScreen(itemstack); + } + } return new ActionResult<>(ActionResultType.SUCCESS, itemstack); } diff --git a/src/main/java/com/direwolf20/mininggadgets/common/items/ModItems.java b/src/main/java/com/direwolf20/mininggadgets/common/items/ModItems.java index 801519ce..b4ca8c62 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/items/ModItems.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/items/ModItems.java @@ -49,4 +49,5 @@ public class ModItems { public static final RegistryObject EFFICIENCY_3 = UPGRADE_ITEMS.register("upgrade_efficiency_3", Upgrade.EFFICIENCY_3::getCard); public static final RegistryObject EFFICIENCY_4 = UPGRADE_ITEMS.register("upgrade_efficiency_4", Upgrade.EFFICIENCY_4::getCard); public static final RegistryObject EFFICIENCY_5 = UPGRADE_ITEMS.register("upgrade_efficiency_5", Upgrade.EFFICIENCY_5::getCard); + public static final RegistryObject PAVER = UPGRADE_ITEMS.register("upgrade_paver", Upgrade.PAVER::getCard); } diff --git a/src/main/java/com/direwolf20/mininggadgets/common/items/UpgradeCard.java b/src/main/java/com/direwolf20/mininggadgets/common/items/UpgradeCard.java index 598353cd..7d67e2fa 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/items/UpgradeCard.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/items/UpgradeCard.java @@ -42,7 +42,7 @@ public void addInformation(ItemStack stack, @Nullable World world, List 0, false), + + SILK("silk", () -> Config.UPGRADECOST_SILKTOUCH.get(), true), + VOID_JUNK("void_junk", () -> Config.UPGRADECOST_VOID.get()), + MAGNET("magnet", () -> Config.UPGRADECOST_MAGNET.get()), + FREEZING("freezing", () -> 0), + THREE_BY_THREE("three_by_three", () -> 0, false), + LIGHT_PLACER("light_placer", () -> 0), + PAVER("paver", () -> 10), + // Tiered - FORTUNE_1("fortune_1", 1, Config.UPGRADECOST_FORTUNE1.get(), true), - FORTUNE_2("fortune_2", 2, Config.UPGRADECOST_FORTUNE2.get(), true), - FORTUNE_3("fortune_3", 3, Config.UPGRADECOST_FORTUNE3.get(), true), - - BATTERY_1("battery_1", 1, 0), - BATTERY_2("battery_2", 2, 0), - BATTERY_3("battery_3", 3, 0), - - RANGE_1("range_1", 1, 0), - RANGE_2("range_2", 2, 0), - RANGE_3("range_3", 3, 0), - - EFFICIENCY_1("efficiency_1", 1, Config.UPGRADECOST_EFFICIENCY1.get(), true), - EFFICIENCY_2("efficiency_2", 2, Config.UPGRADECOST_EFFICIENCY2.get(), true), - EFFICIENCY_3("efficiency_3", 3, Config.UPGRADECOST_EFFICIENCY3.get(), true), - EFFICIENCY_4("efficiency_4", 4, Config.UPGRADECOST_EFFICIENCY4.get(), true), - EFFICIENCY_5("efficiency_5", 5, Config.UPGRADECOST_EFFICIENCY5.get(), true); - - private String name; - private String baseName; - private UpgradeCard card; - private int tier; - private int costPerBlock; + FORTUNE_1("fortune_1", 1, () -> Config.UPGRADECOST_FORTUNE1.get(), true), + FORTUNE_2("fortune_2", 2, () -> Config.UPGRADECOST_FORTUNE2.get(), true), + FORTUNE_3("fortune_3", 3, () -> Config.UPGRADECOST_FORTUNE3.get(), true), + + BATTERY_1("battery_1", 1, () -> 0), + BATTERY_2("battery_2", 2, () -> 0), + BATTERY_3("battery_3", 3, () -> 0), + + RANGE_1("range_1", 1, () -> 0), + RANGE_2("range_2", 2, () -> 0), + RANGE_3("range_3", 3, () -> 0), + + EFFICIENCY_1("efficiency_1", 1, () -> Config.UPGRADECOST_EFFICIENCY1.get(), true), + EFFICIENCY_2("efficiency_2", 2, () -> Config.UPGRADECOST_EFFICIENCY2.get(), true), + EFFICIENCY_3("efficiency_3", 3, () -> Config.UPGRADECOST_EFFICIENCY3.get(), true), + EFFICIENCY_4("efficiency_4", 4, () -> Config.UPGRADECOST_EFFICIENCY4.get(), true), + EFFICIENCY_5("efficiency_5", 5, () -> Config.UPGRADECOST_EFFICIENCY5.get(), true); + + private final String name; + private final String baseName; + private final UpgradeCard card; + private final int tier; + private final Supplier costPerBlock; private boolean active = true; - private boolean isToggleable; - private String tooltop; + private final boolean isToggleable; + private final String toolTip; + private final ItemStack upgradeStack; - Upgrade(String name, int tier, int costPerBlock, boolean isToggleable) { + Upgrade(String name, int tier, Supplier costPerBlock, boolean isToggleable) { this.name = name; this.tier = tier; this.costPerBlock = costPerBlock; this.card = new UpgradeCard(this, name.equals("empty") ? 64 : 1); + this.upgradeStack = new ItemStack(this.card); this.baseName = tier == -1 ? name : name.substring(0, name.lastIndexOf('_')); this.isToggleable = isToggleable; - this.tooltop = "tooltop.mininggadgets." + this.baseName; + this.toolTip = "tooltop.mininggadgets." + this.baseName; } - Upgrade(String name, int tier, int costPerBlock) { + Upgrade(String name, int tier, Supplier costPerBlock) { this(name, tier, costPerBlock, false); } - Upgrade(String name, int costPerBlock) { + Upgrade(String name, Supplier costPerBlock) { this(name, -1, costPerBlock, true); } - Upgrade(String name, int costPerBlock, boolean isToggleable) { + Upgrade(String name, Supplier costPerBlock, boolean isToggleable) { this(name, -1, costPerBlock, isToggleable); } @@ -85,12 +92,16 @@ public UpgradeCard getCard() { return card; } + public ItemStack getStack() { + return upgradeStack; + } + public int getTier() { return tier; } public int getCostPerBlock() { - return costPerBlock; + return costPerBlock.get(); } // Try and always use base name eval @@ -123,8 +134,8 @@ public boolean isToggleable() { return isToggleable; } - public String getTooltop() { - return tooltop; + public String getToolTip() { + return toolTip; } /** diff --git a/src/main/java/com/direwolf20/mininggadgets/common/network/PacketHandler.java b/src/main/java/com/direwolf20/mininggadgets/common/network/PacketHandler.java index de87282b..f04a9a8e 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/network/PacketHandler.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/network/PacketHandler.java @@ -29,22 +29,25 @@ public class PacketHandler { .simpleChannel(); public static void register() { + int id = 0; + // Server side - registerMessage(PacketExtractUpgrade.class, PacketExtractUpgrade::encode, PacketExtractUpgrade::decode, PacketExtractUpgrade.Handler::handle); - registerMessage(PacketUpdateUpgrade.class, PacketUpdateUpgrade::encode, PacketUpdateUpgrade::decode, PacketUpdateUpgrade.Handler::handle); - registerMessage(PacketChangeMiningSize.class, PacketChangeMiningSize::encode, PacketChangeMiningSize::decode, PacketChangeMiningSize.Handler::handle); - registerMessage(PacketChangeRange.class, PacketChangeRange::encode, PacketChangeRange::decode, PacketChangeRange.Handler::handle); - registerMessage(PacketChangeBreakType.class, PacketChangeBreakType::encode, PacketChangeBreakType::decode, PacketChangeBreakType.Handler::handle); - registerMessage(PacketChangeColor.class, PacketChangeColor::encode, PacketChangeColor::decode, PacketChangeColor.Handler::handle); - registerMessage(PacketGhostSlot.class, PacketGhostSlot::encode, PacketGhostSlot::decode, PacketGhostSlot.Handler::handle); - registerMessage(PacketOpenFilterContainer.class,PacketOpenFilterContainer::encode, PacketOpenFilterContainer::decode, PacketOpenFilterContainer.Handler::handle); - registerMessage(PacketToggleFilters.class, PacketToggleFilters::encode, PacketToggleFilters::decode, PacketToggleFilters.Handler::handle); - registerMessage(PacketTogglePrecision.class, PacketTogglePrecision::encode, PacketTogglePrecision::decode, PacketTogglePrecision.Handler::handle); - registerMessage(PacketChangeVolume.class, PacketChangeVolume::encode, PacketChangeVolume::decode, PacketChangeVolume.Handler::handle); - registerMessage(PacketChangeFreezeDelay.class, PacketChangeFreezeDelay::encode, PacketChangeFreezeDelay::decode, PacketChangeFreezeDelay.Handler::handle); + HANDLER.registerMessage(id++, PacketExtractUpgrade.class, PacketExtractUpgrade::encode, PacketExtractUpgrade::decode, PacketExtractUpgrade.Handler::handle); + HANDLER.registerMessage(id++, PacketUpdateUpgrade.class, PacketUpdateUpgrade::encode, PacketUpdateUpgrade::decode, PacketUpdateUpgrade.Handler::handle); + HANDLER.registerMessage(id++, PacketChangeMiningSize.class, PacketChangeMiningSize::encode, PacketChangeMiningSize::decode, PacketChangeMiningSize.Handler::handle); + HANDLER.registerMessage(id++, PacketChangeRange.class, PacketChangeRange::encode, PacketChangeRange::decode, PacketChangeRange.Handler::handle); + HANDLER.registerMessage(id++, PacketChangeBreakType.class, PacketChangeBreakType::encode, PacketChangeBreakType::decode, PacketChangeBreakType.Handler::handle); + HANDLER.registerMessage(id++, PacketChangeColor.class, PacketChangeColor::encode, PacketChangeColor::decode, PacketChangeColor.Handler::handle); + HANDLER.registerMessage(id++, PacketGhostSlot.class, PacketGhostSlot::encode, PacketGhostSlot::decode, PacketGhostSlot.Handler::handle); + HANDLER.registerMessage(id++, PacketOpenFilterContainer.class,PacketOpenFilterContainer::encode, PacketOpenFilterContainer::decode, PacketOpenFilterContainer.Handler::handle); + HANDLER.registerMessage(id++, PacketToggleFilters.class, PacketToggleFilters::encode, PacketToggleFilters::decode, PacketToggleFilters.Handler::handle); + HANDLER.registerMessage(id++, PacketTogglePrecision.class, PacketTogglePrecision::encode, PacketTogglePrecision::decode, PacketTogglePrecision.Handler::handle); + HANDLER.registerMessage(id++, PacketChangeVolume.class, PacketChangeVolume::encode, PacketChangeVolume::decode, PacketChangeVolume.Handler::handle); + HANDLER.registerMessage(id++, PacketChangeFreezeDelay.class, PacketChangeFreezeDelay::encode, PacketChangeFreezeDelay::decode, PacketChangeFreezeDelay.Handler::handle); //Client Side - registerMessage(PacketDurabilitySync.class, PacketDurabilitySync::encode, PacketDurabilitySync::decode, PacketDurabilitySync.Handler::handle); + HANDLER.registerMessage(id++, PacketDurabilitySync.class, PacketDurabilitySync::encode, PacketDurabilitySync::decode, PacketDurabilitySync.Handler::handle); + HANDLER.registerMessage(id++, PacketInsertUpgrade.class, PacketInsertUpgrade::encode, PacketInsertUpgrade::decode, PacketInsertUpgrade::handler); } public static void sendTo(Object msg, ServerPlayerEntity player) { @@ -63,11 +66,4 @@ public static void sendToAll(Object msg, World world) { public static void sendToServer(Object msg) { HANDLER.sendToServer(msg); } - - private static void registerMessage(Class messageType, BiConsumer encoder, Function decoder, BiConsumer> messageConsumer) { - HANDLER.registerMessage(index, messageType, encoder, decoder, messageConsumer); - index++; - if (index > 0xFF) - throw new RuntimeException("Too many messages!"); - } } diff --git a/src/main/java/com/direwolf20/mininggadgets/common/network/packets/PacketInsertUpgrade.java b/src/main/java/com/direwolf20/mininggadgets/common/network/packets/PacketInsertUpgrade.java new file mode 100644 index 00000000..de72d99d --- /dev/null +++ b/src/main/java/com/direwolf20/mininggadgets/common/network/packets/PacketInsertUpgrade.java @@ -0,0 +1,58 @@ +package com.direwolf20.mininggadgets.common.network.packets; + +import com.direwolf20.mininggadgets.common.containers.ModificationTableCommands; +import com.direwolf20.mininggadgets.common.containers.ModificationTableContainer; +import com.direwolf20.mininggadgets.common.tiles.ModificationTableTileEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.network.NetworkEvent; + +import javax.swing.*; +import java.util.function.Supplier; + +public final class PacketInsertUpgrade { + public static PacketInsertUpgrade decode(PacketBuffer buffer) { + return new PacketInsertUpgrade(buffer.readBlockPos(), buffer.readItemStack()); + } + + private final BlockPos pos; + private final ItemStack upgrade; + + public PacketInsertUpgrade(BlockPos blockPos, ItemStack stack) { + this.pos = blockPos; + this.upgrade = stack; + } + + public void encode(PacketBuffer buffer) { + buffer.writeBlockPos(pos); + buffer.writeItemStack(upgrade); + } + + public void handler(Supplier ctx) { + ctx.get().enqueueWork(() -> { + ServerPlayerEntity player = ctx.get().getSender(); + if (player == null) return; + + World world = player.world; + BlockPos pos = this.pos; + + TileEntity te = world.getTileEntity(pos); + if (!(te instanceof ModificationTableTileEntity)) return; + ModificationTableContainer container = ((ModificationTableTileEntity) te).getContainer(player); + + ItemStack stack = player.inventory.getItemStack(); + if (!stack.isItemEqual(upgrade)) { + return; + } + + ModificationTableCommands.insertButton(container, this.upgrade); + player.inventory.setItemStack(ItemStack.EMPTY); + }); + + ctx.get().setPacketHandled(true); + } +} diff --git a/src/main/java/com/direwolf20/mininggadgets/common/tiles/RenderBlockTileEntity.java b/src/main/java/com/direwolf20/mininggadgets/common/tiles/RenderBlockTileEntity.java index 0f95d0bb..3f173f91 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/tiles/RenderBlockTileEntity.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/tiles/RenderBlockTileEntity.java @@ -47,7 +47,7 @@ public class RenderBlockTileEntity extends TileEntity implements ITickableTileEn private int durability; private UUID playerUUID; private int originalDurability; - private Random rand = new Random(); + private final Random rand = new Random(); private int ticksSinceMine = 0; private List gadgetUpgrades; private List gadgetFilters; @@ -61,14 +61,37 @@ public RenderBlockTileEntity() { super(RENDERBLOCK_TILE.get()); } - public void setRenderBlock(BlockState state) { - renderBlock = state; + public static boolean blockAllowed(List drops, List filters, boolean isWhiteList) { + boolean blockAllowed = false; + for (ItemStack dropStack : drops) { + if (filters.size() == 0) + return true; + + boolean contains = false; + for (ItemStack filter : filters) { + if (dropStack.isItemEqual(filter)) { + contains = true; + break; + } + } + + blockAllowed = (isWhiteList && contains) || (!isWhiteList && !contains); + + if (blockAllowed) + break; + } + + return blockAllowed; } public BlockState getRenderBlock() { return renderBlock; } + public void setRenderBlock(BlockState state) { + renderBlock = state; + } + public MiningProperties.BreakTypes getBreakType() { return breakType; } @@ -149,20 +172,20 @@ public void setOriginalDurability(int originalDurability) { } public PlayerEntity getPlayer() { - if( getWorld() == null ) + if (getWorld() == null) return null; return this.getWorld().getPlayerByUuid(playerUUID); } - public UUID getPlayerUUID() { - return this.playerUUID; - } - public void setPlayer(PlayerEntity player) { this.playerUUID = player.getUniqueID(); } + public UUID getPlayerUUID() { + return this.playerUUID; + } + public int getTicksSinceMine() { return ticksSinceMine; } @@ -222,16 +245,16 @@ public SUpdateTileEntityPacket getUpdatePacket() { return new SUpdateTileEntityPacket(pos, 0, getUpdateTag()); } - @Override - public CompoundNBT getUpdateTag() { - return write(new CompoundNBT()); - } - /*@Override public void handleUpdateTag(CompoundNBT tag) { read(tag); }*/ //TODO Figure out if this is still necessary + @Override + public CompoundNBT getUpdateTag() { + return write(new CompoundNBT()); + } + @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { read(this.getBlockState(), pkt.getNbtCompound()); @@ -263,7 +286,7 @@ public void read(BlockState state, CompoundNBT tag) { @Override public CompoundNBT write(CompoundNBT tag) { - if (renderBlock!= null) + if (renderBlock != null) tag.put("renderBlock", NBTUtil.writeBlockState(renderBlock)); tag.putInt("originalDurability", originalDurability); tag.putInt("priorDurability", priorDurability); @@ -280,7 +303,7 @@ public CompoundNBT write(CompoundNBT tag) { } private void removeBlock() { - if (world == null || world.isRemote || playerUUID == null || playerUUID.equals(null)) + if (world == null || world.isRemote || playerUUID == null) return; PlayerEntity player = world.getPlayerByUuid(playerUUID); @@ -309,7 +332,7 @@ private void removeBlock() { List drops = Block.getDrops(renderBlock, (ServerWorld) world, this.pos, null, player, tempTool); - if ( blockAllowed ) { + if (blockAllowed) { int exp = renderBlock.getExpDrop(world, pos, fortune, silk); boolean magnetMode = (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.MAGNET)); for (ItemStack drop : drops) { @@ -319,7 +342,7 @@ private void removeBlock() { // 1 = someone allowed the event meaning it's handled, // -1 = someone blocked the event and thus we shouldn't drop it nor insert it // 0 = no body captured the event and we should handle it by hand. - if( wasPickedUp == 0 ) { + if (wasPickedUp == 0) { if (!player.addItemStackToInventory(drop)) Block.spawnAsEntity(world, pos, drop); } @@ -339,19 +362,27 @@ private void removeBlock() { renderBlock.spawnAdditionalDrops(world, pos, tempTool); // Fixes silver fish basically... } + BlockState underState = world.getBlockState(this.pos.down()); + world.removeTileEntity(this.pos); world.setBlockState(this.pos, Blocks.AIR.getDefaultState()); + if (UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.PAVER)) { + if (this.pos.getY() <= player.getPosY() && underState == Blocks.AIR.getDefaultState()) { + world.setBlockState(this.pos.down(), Blocks.COBBLESTONE.getDefaultState()); + } + } + // Add to the break stats player.addStat(Stats.BLOCK_MINED.get(renderBlock.getBlock())); // Handle special cases - if(SpecialBlockActions.getRegister().containsKey(renderBlock.getBlock())) + if (SpecialBlockActions.getRegister().containsKey(renderBlock.getBlock())) SpecialBlockActions.getRegister().get(renderBlock.getBlock()).accept(world, pos, renderBlock); } private void resetBlock() { - if(world == null) + if (world == null) return; if (!world.isRemote) { @@ -390,7 +421,6 @@ public void tick() { } - } //Server Only if (!world.isRemote) { @@ -413,29 +443,6 @@ public void tick() { } } - public static boolean blockAllowed(List drops, List filters, boolean isWhiteList) { - boolean blockAllowed = false; - for (ItemStack dropStack : drops) { - if( filters.size() == 0 ) - return true; - - boolean contains = false; - for (ItemStack filter: filters) { - if( dropStack.isItemEqual(filter) ) { - contains = true; - break; - } - } - - blockAllowed = (isWhiteList && contains) || (!isWhiteList && !contains); - - if( blockAllowed ) - break; - } - - return blockAllowed; - } - public void setBlockAllowed() { if (!UpgradeTools.containsActiveUpgradeFromList(gadgetUpgrades, Upgrade.VOID_JUNK)) { this.blockAllowed = true; diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_1.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_1.png index f76be08d..4c1539a6 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_1.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_1.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_2.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_2.png index fa553da7..9cd93f2a 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_2.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_2.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_3.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_3.png index 51f99bea..187a333f 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_3.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_battery_3.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_1.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_1.png index b61d8a67..e4b2a00c 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_1.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_1.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_2.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_2.png index e53e3a3e..9efc55fd 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_2.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_2.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_3.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_3.png index 9467905b..415a1893 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_3.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_3.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_4.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_4.png index 2ecfd03a..ffa96de2 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_4.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_4.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_5.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_5.png index db635743..fec09634 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_5.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_efficiency_5.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_empty.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_empty.png index 19e99e5a..20d46e6f 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_empty.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_empty.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_1.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_1.png index de21fb02..c12f971e 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_1.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_1.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_2.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_2.png index e9f66deb..ce2cf2dc 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_2.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_2.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_3.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_3.png index a0ceb590..6f776cc3 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_3.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_fortune_3.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_freezing.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_freezing.png index 8b7d073f..1d294fc1 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_freezing.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_freezing.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_heatsink.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_heatsink.png index 78a96e63..f2b83d3e 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_heatsink.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_heatsink.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_light_placer.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_light_placer.png index 0a5de319..e67533a9 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_light_placer.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_light_placer.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_magnet.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_magnet.png index 5c67c465..63066d36 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_magnet.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_magnet.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_paver.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_paver.png new file mode 100644 index 00000000..b2d6d700 Binary files /dev/null and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_paver.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_1.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_1.png index 4d4a8617..a67ae926 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_1.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_1.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_2.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_2.png index de3f463f..8bb92888 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_2.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_2.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_3.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_3.png index 57d1fa10..3850db4d 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_3.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_range_3.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_silk.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_silk.png index fc37449f..8774c444 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_silk.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_silk.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_three_by_three.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_three_by_three.png index 1ee2e678..bd54a16c 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_three_by_three.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_three_by_three.png differ diff --git a/src/main/resources/assets/mininggadgets/textures/item/upgrade_void_junk.png b/src/main/resources/assets/mininggadgets/textures/item/upgrade_void_junk.png index 30b9de6c..d7e56038 100644 Binary files a/src/main/resources/assets/mininggadgets/textures/item/upgrade_void_junk.png and b/src/main/resources/assets/mininggadgets/textures/item/upgrade_void_junk.png differ