From 8b62c8a4b805aebc7fd327218b83483af5983b39 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Fri, 22 Dec 2023 11:11:05 -0800 Subject: [PATCH 01/17] bump to latest mc1.16.5 dependences --- build.gradle | 5 ++++- gradle.properties | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index b6b092ea1..35a253b4f 100644 --- a/build.gradle +++ b/build.gradle @@ -94,7 +94,10 @@ dependencies { compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}:api") runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") - implementation fg.deobf("curse.maven:crafttweaker-239197:3433252") + + implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-${mc_version}:${crafttweaker_version}") + + // runtimeOnly fg.deobf("curse.maven:just-enough-effect-descriptions-jeed-532286:3541185") runtimeOnly fg.deobf("curse.maven:liquid-blocks-301999:3323640") diff --git a/gradle.properties b/gradle.properties index fff02ce7a..5fe0eaff8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,17 +4,19 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false curse_id=239286 -mod_version=1.5.21 +mod_version=1.5.22-SNAPSHOT mc_version=1.16.5 forge_version=36.2.34 mappings_version=20201028-1.16.3 # optional dependencies -jei_version=jei-1.16.5:7.7.1.138 -curios_version=1.16.5-4.0.5.3 -patchouli_version=1.16.4-53.2 botania_version=1.16.5-419 +crafttweaker_version=7.1.2.526 +curios_version=1.16.5-4.1.0.0 +jei_version=jei-1.16.5:7.8.0.1009 +patchouli_version=1.16.4-53.3 # folder to copy the build output jar dist_folder=c:/temp + From bfeb28ec320a5a605f7796e1a1ee24cf86717c5b Mon Sep 17 00:00:00 2001 From: lothrazar Date: Tue, 6 Feb 2024 08:46:57 -0800 Subject: [PATCH 02/17] cleanup gradle and update optional dependencies --- build.gradle | 5 ----- gradle.properties | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 35a253b4f..2525e98a5 100644 --- a/build.gradle +++ b/build.gradle @@ -222,11 +222,6 @@ task signJar(type: SignJar, dependsOn: jar) { outputFile = jar.archivePath } -task copyJar(type: Copy) { - from jar - into "${dist_folder}" -} - task cleanJar { delete 'build/libs' } diff --git a/gradle.properties b/gradle.properties index 5fe0eaff8..e5928ac55 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,12 +11,9 @@ forge_version=36.2.34 mappings_version=20201028-1.16.3 # optional dependencies -botania_version=1.16.5-419 +botania_version=1.16.5-420.3 crafttweaker_version=7.1.2.526 curios_version=1.16.5-4.1.0.0 jei_version=jei-1.16.5:7.8.0.1009 patchouli_version=1.16.4-53.3 -# folder to copy the build output jar -dist_folder=c:/temp - From 676db8f13b90a8bc08b912471b42c05452ffdcf3 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sun, 31 Mar 2024 20:15:53 -0700 Subject: [PATCH 03/17] 1.5.22 #2351 crafting stick fix --- gradle.properties | 2 +- .../item/crafting/CraftingBagContainer.java | 16 +--------------- update.json | 3 ++- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index e5928ac55..3360d1996 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false curse_id=239286 -mod_version=1.5.22-SNAPSHOT +mod_version=1.5.22 mc_version=1.16.5 forge_version=36.2.34 diff --git a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java index 083a7af1d..a0c2894fe 100644 --- a/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java +++ b/src/main/java/com/lothrazar/cyclic/item/crafting/CraftingBagContainer.java @@ -1,6 +1,5 @@ package com.lothrazar.cyclic.item.crafting; -import com.lothrazar.cyclic.ModCyclic; import com.lothrazar.cyclic.base.ContainerBase; import com.lothrazar.cyclic.data.IContainerCraftingAction; import com.lothrazar.cyclic.registry.ContainerScreenRegistry; @@ -42,9 +41,8 @@ public CraftingBagContainer(int id, PlayerInventory playerInventory, PlayerEntit // if (slot > -1) { this.bag = playerInventory.getStackInSlot(slot); - ModCyclic.LOGGER.info("bag " + bag); } - if (bag.isEmpty()) { + if (bag == null || bag.isEmpty()) { this.bag = super.findBag(ItemRegistry.crafting_bag); } //grid @@ -59,11 +57,7 @@ public boolean isItemValid(ItemStack stack) { }); } } - // - // this.nbt = bag.getOrCreateTag(); bag.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { - // this.handler = h; - // this.slots = h.getSlots(); for (int j = 0; j < h.getSlots(); j++) { ItemStack inBag = h.getStackInSlot(j); if (!inBag.isEmpty()) { @@ -80,25 +74,17 @@ public void onContainerClosed(PlayerEntity playerIn) { this.craftResult.setInventorySlotContents(0, ItemStack.EMPTY); //this is not the saving version if (playerIn.world.isRemote == false) { - // if (this.handler == null) { IItemHandler handler = bag.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElse(null); if (handler == null) { return; } - // } for (int i = 0; i < 9; i++) { ItemStack crafty = this.craftMatrix.getStackInSlot(i); - // if (crafty.isEmpty()) { - // continue; - // } handler.extractItem(i, 64, false); ItemStack failtest = handler.insertItem(i, crafty, false); if (!failtest.isEmpty()) { // } - // - // ItemStack doubleTest = h.extractItem(i, 64, true); - // ModCyclic.LOGGER.info(doubleTest + " got saved in " + i); } } // clearContainer(playerIn, playerIn.world, craftMatrix); diff --git a/update.json b/update.json index 00c0d726d..aaf9faa75 100644 --- a/update.json +++ b/update.json @@ -1,7 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/cyclic", "promos": { - "1.16.5-latest": "1.5.21" + "1.16.5-latest": "1.5.22" }, "1.16.5": { "0.6.1": "Ported ", @@ -78,5 +78,6 @@ ,"1.5.19":"Backports from mc1.18.2: right-click the Crafting Stick anywhere in your inventory screen, even while not holding it, to open it. Fix logs about 'unused frames'. Fixed logs about ' Unknown recipe category: cyclic:'. Fix Combustion Generator consumes Empty Bucket #2146. Fix #2171 Rich Soil acting translucent and blocksounds. #2138 /cyclic commands can run in functions and command blocks" ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " + ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " } } From 9f01e65ab773857865c6b9657ade25d13c35198d Mon Sep 17 00:00:00 2001 From: lothrazar Date: Mon, 1 Apr 2024 10:26:31 -0700 Subject: [PATCH 04/17] 1.18.2 dependencies gradle update --- checkstyle.xml => .eclipse/checkstyle.xml | 0 build.gradle | 2 +- gradle.properties | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- update.json | 8 ++------ 5 files changed, 7 insertions(+), 11 deletions(-) rename checkstyle.xml => .eclipse/checkstyle.xml (100%) diff --git a/checkstyle.xml b/.eclipse/checkstyle.xml similarity index 100% rename from checkstyle.xml rename to .eclipse/checkstyle.xml diff --git a/build.gradle b/build.gradle index 3172baed7..82641228d 100644 --- a/build.gradle +++ b/build.gradle @@ -75,7 +75,7 @@ dependencies { minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" // optional compat: jei plugin for custom recipes - implementation fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") + implementation fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") // optional compat: many items useable in curios slots implementation fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}") diff --git a/gradle.properties b/gradle.properties index 25a8d60a2..4c9893126 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,13 +8,13 @@ org.gradle.daemon=false curse_id=239286 -mod_version=1.7.17 +mod_version=1.7.18-SNAPSHOT mc_version=1.18.2 -forge_version=40.2.9 +forge_version=40.2.17 # optional dependencies -jei_version=9.7.1.255 +jei_version=10.2.1.1005 patchouli_version=71.1 curios_version=5.0.7.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb8790..ae04661ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/update.json b/update.json index 5e187672b..a4a7320d1 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,5 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/cyclic", - "promos": { "1.18-latest": "1.6.7", "1.18.1-latest": "1.6.15", @@ -73,9 +72,7 @@ ,"1.5.9":"Fix Battery energy tooltip not updating when charged in an item slot. Added charging slot to Battery. Fix sleeping mat bug when used in nether. Fix Fluid cables visual disconnection when placing. " ,"1.5.10":"Machines that use fluid ingredients now accept fluid tags such as 'forge:experience' in place of fluid ID; updated some existing recipes on Solidifier and Evap Generator to match (old recipe JSONs still all compatible/valid). Fixed battery energy item stack capability provider. Refreshed texture of Air charm. Vision helmet compat with curios head slot. Revert GPS card fixes to v1.5.6. One recipe added to cyclic:generator_fluid for tag forge:biomass. Default config value updated for disable_pickup on the Sack of Holding. Add compat for Beheading enchant with the 7 Tinkers Construct mob heads (config heads are still checked last. no changes if tinkers not installed). " ,"1.5.11":"Fix a bugged interaction with Settings data card and Filter data card #1970 . Torch Charm now tries to avoid placing on non-solid blocks such as top side of a bottom Slab where the torch breaks right away. " - ,"1.5.12":"PR #1976 by metalshark :Item, Energy, and Fluid Cables now have Increased performance (compile time optimisations, reduction in cyclomatic complexity and removal of redundant checks) " - }, "1.18.2": { "1.6.0": "Ported Cyclic[1.16.5]-1.5.8 to Minecraft [1.17.1] & forge-37.0.85+. Altered a few crafting recipes to use new items. Removed Peat Generator (Use Peat items in Material Generator). Removed 5 Mason blocks, replaced with Compressed Cobblestone, Flint Block. Added Peace Candle, Translocation Platform, Stone Mattock, Crushing Macerator, and Lava Sponge. Added Copper Tools and Amethyst Tools, Copper Lantern, Copper Chain, Copper Bars, Gold Chain, Gold Bars, Gold Lantern (Art by @shynieke). Added Copper Nuggets and Netherite Nuggets. Added Netherite Lanterns, chains, and bars. Added 3 Pressure Plates: Copper Netherite and Obsidian. ", @@ -114,9 +111,8 @@ ,"1.7.14":"Added new config section [cyclic.potion] to disable BASE potion recipes. Marked minimum forge version of 40.1.84+ to prevent conflicts and errors. Fix lunchbox eating 'endless' items like Everlasting Beef. Lunchbox now can be inserted into while hovering with a food item, without opening gui-screen (texture shifts to indicate). New command /cyclic scoreboard orandom; works the same as /cyclic scoreboard random except it takes objectives as arguments for min and max values. Merge pull request #2219 from nexonerr/fluid_gen_fluid_filter Fixed issue #2096 " ,"1.7.15":"Life Leech no longer refills hunger (#2241). Merged Typo: double 'consume' (#2275)@Pifanjr. Update Simplified Chinese Transaction (#2277)@UraraChiya. " ,"1.7.16":"Fix #2243 User output buffer (milk and other tranforming outputs from entity interactions). fix #2236 recipe conflict for moss block in solidifier_moss_block.json. fix #2247 Charm Talisman Missing lava protection. Fix #2259: crates and other heavy blocks that keep their contents now drop motionless to avoid bouncing away for small base situations. #2261 Smooth glass can be reverse-smelted back into plain glass. Fix items that use RF not charging items on servers #2274 #2169. fix #2272 #2260 typos. Fix #2268 material generator recipe. update candle models from #2182. Fix Smooth Glass looks incorrect underwater #2263. Fix Tempered dark glass does not cull against itself #2262 " - ,"1.7.17":"This update ports some features that had previously been exlusive to the mc 1.16.5-1.15.12 thru 1.16.5-1.15.21; all are listed below. New configs: [cyclic.enchantment.disarm] now has 'ignoredMobs' and 'percentPerLevel', [cyclic.items.tile_transporter] now has 'overrideChestSingle', read on or see cyclic.yml for more details. PR #1976 by metalshark :Item, Energy, and Fluid Cables now have Increased performance (compile time optimisations, reduction in cyclomatic complexity and removal of redundant checks). PR #1994 by 'metalshark' Fixes issue #1992. Merge pull request #2013 from metalshark : Add caching of packager recipes and move static methods out of main class for scaling. Merge pull request #2011 from metalshark : Invalidate capabilities when declaring them. #1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node. Now all git branches can be merged from mc-1.16.5 downstream to mc-1.20.1 and future updates as well. " - - + ,"1.7.18":"" + } } From 466abb37140112fffb8e66c31d3a0fade19917a3 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Mon, 1 Apr 2024 17:14:47 -0700 Subject: [PATCH 05/17] prep and cleanup --- build.gradle | 57 +++---------------- gradle.properties | 2 +- .../redstone/TileWirelessTransmit.java | 1 + .../cyclic/compat/botania/BotaniaWrapper.java | 3 +- .../com/lothrazar/cyclic/util/CharmUtil.java | 1 + 5 files changed, 11 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index 2525e98a5..7f7d408f8 100644 --- a/build.gradle +++ b/build.gradle @@ -94,57 +94,14 @@ dependencies { compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}:api") runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") - +/* implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-${mc_version}:${crafttweaker_version}") - - - - // runtimeOnly fg.deobf("curse.maven:just-enough-effect-descriptions-jeed-532286:3541185") - runtimeOnly fg.deobf("curse.maven:liquid-blocks-301999:3323640") - runtimeOnly fg.deobf("curse.maven:caelus-308989:3522094") - runtimeOnly fg.deobf("curse.maven:elytra-slot-317716:3522097") - // implementation fg.deobf("curse.maven:openblocks-elevator-250832:3238352") - // implementation fg.deobf("curse.maven:mantle-74924:3482897") - // implementation fg.deobf("curse.maven:tinkers-construct-74072:3482903") - // implementation fg.deobf("curse.maven:construction-wand-399558:3499311") - // implementation fg.deobf("curse.maven:glass-cutter-368921:3185268") - // implementation fg.deobf("curse.maven:mob-grinding-utils-254241:3498537") - - // implementation fg.deobf("curse.maven:inspirations-284007:3414517") - // implementation fg.deobf("curse.maven:simple-storage-network-268495:3462942") - // implementation fg.deobf("curse.maven:valkyrielib-245480:3396151") - // implementation fg.deobf("curse.maven:simple-generators-246010:3464413") - // implementation fg.deobf("curse.maven:autoreglib-250363:3326041") - // implementation fg.deobf("curse.maven:quark-243121:3394265") - // implementation fg.deobf("curse.maven:titanium-287342:3346366") - // implementation fg.deobf("curse.maven:industrial-foregoing-266515:3446262") - // implementation fg.deobf("curse.maven:forcecraft-454802:3495606") - // implementation fg.deobf("curse.maven:plain-grinder-452000:3389092") - - // implementation fg.deobf("curse.maven:cofh-core-69162:3407019") - // implementation fg.deobf("curse.maven:thermal-foundation-222880:3412300") - // implementation fg.deobf("curse.maven:mekanism-268560:3206392") - // implementation fg.deobf("curse.maven:mekanism-generators-268566:3206395") - // implementation fg.deobf("curse.maven:mcjtylib-233105:3402861") - // implementation fg.deobf("curse.maven:rftools-base-326041:3380271") - // implementation fg.deobf("curse.maven:biomes-o-plenty-220318:3360574") - // implementation fg.deobf("curse.maven:aquaculture-60028:3401886") - // implementation fg.deobf("curse.maven:ensorcellation-349447:3407021") - // implementation fg.deobf("curse.maven:liquid-blocks-301999:3323640") - // implementation fg.deobf("curse.maven:gardening-tools-351990:3230668") - // implementation fg.deobf("curse.maven:cucumber-272335:3349690") - // implementation fg.deobf("curse.maven:mystical-agriculture-246640:3467262") - // implementation fg.deobf("curse.maven:refined-storage-243076:3157354") - // implementation fg.deobf("curse.maven:ex-nihilo-sequentia-400012:3060647") - // implementation fg.deobf("curse.maven:storage-drawers-223852:3180569") - // implementation fg.deobf("curse.maven:create-328085:328085") - - // implementation fg.deobf("curse.maven:selene-499980:3472679") - // implementation fg.deobf("curse.maven:supplementaries-412082:3466032") - // implementation fg.deobf("curse.maven:resourceful-bees-384508:3206649") - // implementation fg.deobf("curse.maven:architectury-forge-419699:3188530") - // implementation fg.deobf("curse.maven:rhino-416294:3187177") - // implementation fg.deobf("curse.maven:kubejs-238086:3137415") + implementation fg.deobf("curse.maven:mantle-74924:3482897") + implementation fg.deobf("curse.maven:tinkers-construct-74072:3482903") + implementation fg.deobf("curse.maven:cucumber-272335:3507886") + implementation fg.deobf("curse.maven:mystical-agriculture-246640:3562127") + implementation fg.deobf("curse.maven:chunknogobyebye-332695:3195333") +*/ // To use any mod in /libs/ folder, place it in and set the mod and version to match jar filename // runtimeOnly fg.deobf("libs:SimpleStorageNetwork:1.16.4-1.3.1") diff --git a/gradle.properties b/gradle.properties index 3360d1996..b8d718125 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false curse_id=239286 -mod_version=1.5.22 +mod_version=1.5.23-SNAPSHOT mc_version=1.16.5 forge_version=36.2.34 diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java index 7befcce7e..999cf21f4 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java @@ -95,6 +95,7 @@ public CompoundNBT write(CompoundNBT tag) { return super.write(tag); } + @SuppressWarnings("deprecation") private void toggleTarget(BlockPosDim dimPos) { if (world.isRemote) { return; diff --git a/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java b/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java index e9e6e6c84..3638790ab 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java +++ b/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java @@ -2,13 +2,12 @@ import net.minecraft.entity.LivingEntity; import net.minecraftforge.fml.ModList; -import vazkii.botania.api.BotaniaAPI; public class BotaniaWrapper { public static boolean hasSolegnoliaAround(LivingEntity entity) { try { - return ModList.get().isLoaded("botania") && BotaniaAPI.instance().hasSolegnoliaAround(entity); + return ModList.get().isLoaded("botania") && vazkii.botania.api.BotaniaAPI.instance().hasSolegnoliaAround(entity); } catch (Exception e) { //ive never seen an exception here yet, just being safe diff --git a/src/main/java/com/lothrazar/cyclic/util/CharmUtil.java b/src/main/java/com/lothrazar/cyclic/util/CharmUtil.java index 1328cd34d..089e209f3 100644 --- a/src/main/java/com/lothrazar/cyclic/util/CharmUtil.java +++ b/src/main/java/com/lothrazar/cyclic/util/CharmUtil.java @@ -10,6 +10,7 @@ import org.apache.commons.lang3.tuple.Triple; import top.theillusivec4.curios.api.CuriosApi; +@SuppressWarnings("deprecation") public class CharmUtil { public static ItemStack getIfEnabled(PlayerEntity player, Item match) { From 66909490ab36aec98d09b9f1c29add5c9a71c7d1 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Mon, 1 Apr 2024 19:16:42 -0700 Subject: [PATCH 06/17] allow transmitters to cross-dimensions; add examples folder --- checkstyle.xml => .eclipse/checkstyle.xml | 0 build.gradle | 9 +-- .../config/cyclic-client.toml | 2 +- cyclic.toml => examples/config/cyclic.toml | 2 + .../datapacks/cyclic_diable_emerald_stuff.zip | Bin 0 -> 3992 bytes {crafttweaker => examples/scripts}/melter.zs | 0 .../scripts}/remove_by_modid.zs | 0 {crafttweaker => examples/scripts}/script.zs | 0 .../scripts}/solidifier.zs | 0 .../lothrazar/cyclic/base/TileEntityBase.java | 62 +++++++++++++++--- .../wireless/energy/TileWirelessEnergy.java | 12 +++- .../wireless/fluid/TileWirelessFluid.java | 10 ++- .../block/wireless/item/TileWirelessItem.java | 10 ++- .../redstone/TileWirelessTransmit.java | 26 +++----- .../cyclic/config/ConfigRegistry.java | 6 ++ .../lothrazar/cyclic/data/BlockPosDim.java | 7 ++ 16 files changed, 107 insertions(+), 39 deletions(-) rename checkstyle.xml => .eclipse/checkstyle.xml (100%) rename cyclic-client.toml => examples/config/cyclic-client.toml (98%) rename cyclic.toml => examples/config/cyclic.toml (98%) create mode 100644 examples/datapacks/cyclic_diable_emerald_stuff.zip rename {crafttweaker => examples/scripts}/melter.zs (100%) rename {crafttweaker => examples/scripts}/remove_by_modid.zs (100%) rename {crafttweaker => examples/scripts}/script.zs (100%) rename {crafttweaker => examples/scripts}/solidifier.zs (100%) diff --git a/checkstyle.xml b/.eclipse/checkstyle.xml similarity index 100% rename from checkstyle.xml rename to .eclipse/checkstyle.xml diff --git a/build.gradle b/build.gradle index 7f7d408f8..9c495c27f 100644 --- a/build.gradle +++ b/build.gradle @@ -87,6 +87,7 @@ dependencies { implementation fg.deobf("mezz.jei:${jei_version}") implementation fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") + implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-${mc_version}:${crafttweaker_version}") compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api") runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}") @@ -94,15 +95,15 @@ dependencies { compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}:api") runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") -/* - implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-${mc_version}:${crafttweaker_version}") + // optional dependencies & mods for testing compat + implementation fg.deobf("curse.maven:mantle-74924:3482897") implementation fg.deobf("curse.maven:tinkers-construct-74072:3482903") implementation fg.deobf("curse.maven:cucumber-272335:3507886") implementation fg.deobf("curse.maven:mystical-agriculture-246640:3562127") implementation fg.deobf("curse.maven:chunknogobyebye-332695:3195333") -*/ - + + // To use any mod in /libs/ folder, place it in and set the mod and version to match jar filename // runtimeOnly fg.deobf("libs:SimpleStorageNetwork:1.16.4-1.3.1") // runtimeOnly fg.deobf("libs:refinedstorage:1.16.4-1.9.11") diff --git a/cyclic-client.toml b/examples/config/cyclic-client.toml similarity index 98% rename from cyclic-client.toml rename to examples/config/cyclic-client.toml index 9edc0f2f7..c288260bc 100644 --- a/cyclic-client.toml +++ b/examples/config/cyclic-client.toml @@ -11,7 +11,7 @@ [cyclic.blocks.text] #True means this will hide the fluid contents chat message (right click) on relevant blocks (pylon, fluid generator, fluid hopper, solidifier, sprinkler, tank, cask) - FluidContents = false + FluidContents = true [cyclic.blocks.colors] #Specify hex color of preview mode. default #00EE00 diff --git a/cyclic.toml b/examples/config/cyclic.toml similarity index 98% rename from cyclic.toml rename to examples/config/cyclic.toml index 7f5dc0ac8..857fbbbf6 100644 --- a/cyclic.toml +++ b/examples/config/cyclic.toml @@ -72,6 +72,8 @@ # Block specific configs ##################################################################################### [cyclic.blocks] + # Allows the dimensional Transfer Nodes to cross dimensions (no chunk loading is done, you have to do that on your own); This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; If you change it to false it will only work if the target is in the same dimension. + wireless_transfer_dimensional = true #Ender shelf settings [cyclic.blocks.ender_shelf] diff --git a/examples/datapacks/cyclic_diable_emerald_stuff.zip b/examples/datapacks/cyclic_diable_emerald_stuff.zip new file mode 100644 index 0000000000000000000000000000000000000000..26c520b705d5840a23e11b7b154e72d4ee538740 GIT binary patch literal 3992 zcma)<2{@E%8^>Q;MPp55Un9v_qAw&)wu45NQs^@=#yVphV>u(sh)G0Ql2XYbYh-QI zA+k+mn;K-NQc9-nlReHmMc$gPoN`yYf4gE6fCsP0D=t9X z26x)B0D$~Yu0Uhae$E(Ir1PI>xECJh6PnP@6{!Xzc5>AiHutsO3f;=DTII^iMA0u^V^{YK!AoOOTWIGgFgMQCs?To;?kVu@_TN zKB;Qc<@RdO_Euqu<>1bH?%u5ZhtUxRQCbF)0{s~WLdS{f*mCWUl7$r~A|@<1ccr@v z>Z|G&dp36Iy=kNAr@NE=Y*P7AJ=C%Rh4B2R$Gv7Vt|=g-N|RMW zuXGa-0BSGKP$=1;t|X|fu#UD14(E^mB91s$#}g?HJKYKI)78{F*_U!uouXEF4pwKN zx2>Uyml~f)T|_Jwho4{I22#qi+~^pCM|CXC3+6ij#c_9mWX%XZ*(oeJ7b$U;e53m6 zu?q$CeNm~$JsZihb}a{o6}(dyk~ps(kEY(ZRkFxjD25W(=XMfq3{{bo7 zCoy`K4C`L-AtDKE?G?mD&K%My4Yn@APAv&#)~4?FF)xEMwY?0pKCn&iwROb_(gNZf zu`<`QJ9TMdYsLi7SV~B8Iu|sR0*w{dG4?=XuxS64-Xgf7)L^71JZ%!@Jw9#&H_!YY zW8FGs+JA@d^-yk6$6nHD;g2=d;+@fa#Nqg~+d=%UiaadU#q2is#~Kd$*(eB{k)J2` z{;yWTPPaZo;o@zt|M31{tsGCa8!5P?bO%E>4}ZK}KwTHE!WTPvXbf?Z{G?U%{&kGO zZu^ArL|3I9yANE;wV~aWwHkyWJ;H?3vH~?lYe!2GN*iZn!tkWvl>P54Al*F)x_awu zfA?=suLo}R^p^5ONy7}>RX<3jb-*h>DpR)E6bNjEjh={G4wFtF_LtY(9$Kt9)G7=l zX_;@t#+zC<@N6TKtbxFuPrG!q2_}0p@&zQ{8MgJSY4>sbVS=6S;q`MSb+@Q!um>t+ z2F&f`J5$2ijBpVVGRndYZbv3E3MOF z4BFk@)5rbm0seMNLk=)sVH~Uukc@jebd#hJk2oVA;|=D6PKuD?F%*;c}}UR+_s?>UZ#Iv7z^tT z;Vvk~Q03FC7sYcfpQ@1SA;7hy7`JrJmKQ;pAzrpUdAxg%Jx+^!pd5?*?^DU_@%TCJ zHQfkMx2n@j{Vu3^6x7|Zj;^mK%6siOUB`G%pYG(D=8)+y-~^V@F?R693#mD0C;GI3bLcLCDv zQ=mR;8(Fpz)VBK<2O95z3q)g9rqqi4w<(oq-Tx}~b_$t?VLx#-cdO`9!m*RItFcibTFW9&a$?3-~xnB3GG(%X!MD&e^0bo`pdp^0t|y zy^JxH0eBO$I8%SahtcfG8?~wRUHeZ&%qMZA8Og;Cw5p3}jXDiYG!!q*dESsN+8-m% z3u9~Q16z;Jtj;jD&#IALrq;GNMJnr89n|yd_)O+qYkd^x4tM3PVYnXw-PfB__#m90 z>xz0Oqwy5zfX4b8W3!83{3D^C$H_ESZse;Oiz`HV40jXPZScGn{{mK6c?w zUERGn6}B8YUFX30W6^<6AkT3hOW~tgmsP6Hfa-U@_{Ifnsb7nqRSfwwHTjHr*cpm+}JT(T)?92NGJy$f^bbQ(lWB4X#0 z8r5qOKY7w^qOk$`epducFZ>-mn1mZRyae8-EUfy#&$1jNPBC75Uze|8j0=$d@{tAD z21pYMimu-4V_98~`7|XlK10hg=Ras!Ij|Nq<3XzzR%ul-s;#aUA2c&nXU>e!>WCkz zuO>(+<*)8}3WIW`x2uh@);MlW{@&sL<;+zIg~A1d z+Cdg<-~A+{Q&@O@aGPAlRN}V0Kh-Z61$K9 literal 0 HcmV?d00001 diff --git a/crafttweaker/melter.zs b/examples/scripts/melter.zs similarity index 100% rename from crafttweaker/melter.zs rename to examples/scripts/melter.zs diff --git a/crafttweaker/remove_by_modid.zs b/examples/scripts/remove_by_modid.zs similarity index 100% rename from crafttweaker/remove_by_modid.zs rename to examples/scripts/remove_by_modid.zs diff --git a/crafttweaker/script.zs b/examples/scripts/script.zs similarity index 100% rename from crafttweaker/script.zs rename to examples/scripts/script.zs diff --git a/crafttweaker/solidifier.zs b/examples/scripts/solidifier.zs similarity index 100% rename from crafttweaker/solidifier.zs rename to examples/scripts/solidifier.zs diff --git a/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java b/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java index e21300002..03fda9b0c 100644 --- a/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java +++ b/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java @@ -4,6 +4,7 @@ import com.lothrazar.cyclic.block.breaker.BlockBreaker; import com.lothrazar.cyclic.block.cable.energy.TileCableEnergy; import com.lothrazar.cyclic.capability.CustomEnergyStorage; +import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.filter.FilterCardItem; import com.lothrazar.cyclic.net.PacketEnergySync; import com.lothrazar.cyclic.registry.PacketRegistry; @@ -257,7 +258,14 @@ public boolean requiresRedstone() { return this.needsRedstone == 1; } - public void moveFluids(Direction myFacingDir, BlockPos posTarget, int toFlow, IFluidHandler tank) { + protected void moveFluidsDimensional(BlockPosDim loc, int toFlow, IFluidHandler tank) { + Direction myFacingDir = loc.getSide(); + final Direction themFacingMe = myFacingDir.getOpposite(); + // moveFluidsInternal is just util tryFillPositionFromTank + UtilFluid.tryFillPositionFromTank(loc.getServerLevel(world.getServer()), loc.getPos(), themFacingMe, tank, toFlow); + } + + protected void moveFluids(Direction myFacingDir, BlockPos posTarget, int toFlow, IFluidHandler tank) { if (tank == null || tank.getFluidInTank(0).isEmpty()) { return; } @@ -358,18 +366,29 @@ public boolean moveItems(Direction myFacingDir, int max, IItemHandler handlerHer return moveItems(myFacingDir, pos.offset(myFacingDir), max, handlerHere, 0); } + public boolean moveItemsDimensional(BlockPosDim loc, int max, IItemHandler handlerHere, int theslot) { + Direction myFacingDir = loc.getSide(); + final Direction themFacingMe = myFacingDir.getOpposite(); + ServerWorld serverWorld = loc.getServerLevel(world.getServer()); + return moveItemsInternal(max, handlerHere, theslot, themFacingMe, serverWorld.getTileEntity(loc.getPos())); + } + public boolean moveItems(Direction myFacingDir, BlockPos posTarget, int max, IItemHandler handlerHere, int theslot) { - if (max <= 0 || this.world.isRemote() || handlerHere == null) { + if (max <= 0 || this.world.isRemote()) { return false; } //first get the original ItemStack as creating new ones is expensive - final ItemStack originalItemStack = handlerHere.getStackInSlot(theslot); - if (originalItemStack.isEmpty()) { - return false; - } final Direction themFacingMe = myFacingDir.getOpposite(); final TileEntity tileTarget = world.getTileEntity(posTarget); - if (tileTarget == null) { + return moveItemsInternal(max, handlerHere, theslot, themFacingMe, tileTarget); + } + + private static boolean moveItemsInternal(int max, IItemHandler handlerHere, int theslot, final Direction themFacingMe, final TileEntity tileTarget) { + if (max <= 0 || tileTarget == null || handlerHere == null) { + return false; + } + final ItemStack originalItemStack = handlerHere.getStackInSlot(theslot); + if (originalItemStack.isEmpty()) { return false; } final IItemHandler handlerOutput = tileTarget.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, themFacingMe).orElse(null); @@ -401,19 +420,41 @@ protected boolean moveEnergy(Direction myFacingDir, int quantity) { return moveEnergy(myFacingDir, pos.offset(myFacingDir), quantity); } - protected boolean moveEnergy(final Direction myFacingDir, final BlockPos posTarget, final int quantity) { + protected boolean moveEnergyDimensional(final BlockPosDim loc, final int quantity) { + //validation pre-move if (quantity <= 0) { return false; } if (this.world.isRemote) { return false; //important to not desync cables } + Direction myFacingDir = loc.getSide(); final IEnergyStorage handlerHere = this.getCapability(CapabilityEnergy.ENERGY, myFacingDir).orElse(null); - if (handlerHere == null) { + ServerWorld serverWorld = loc.getServerLevel(world.getServer()); + final TileEntity tileTarget = serverWorld.getTileEntity(loc.getPos()); + final Direction themFacingMe = myFacingDir.getOpposite(); + return moveEnergyInternal(quantity, handlerHere, themFacingMe, tileTarget); + } + + //assums posTarget is in the same dimension as this.world + protected boolean moveEnergy(final Direction myFacingDir, final BlockPos posTarget, final int quantity) { + //validation pre-move + if (quantity <= 0) { return false; } + if (this.world.isRemote) { + return false; //important to not desync cables + } + final IEnergyStorage handlerHere = this.getCapability(CapabilityEnergy.ENERGY, myFacingDir).orElse(null); final Direction themFacingMe = myFacingDir.getOpposite(); final TileEntity tileTarget = world.getTileEntity(posTarget); + return moveEnergyInternal(quantity, handlerHere, themFacingMe, tileTarget); + } + + private static boolean moveEnergyInternal(final int quantity, final IEnergyStorage handlerHere, final Direction themFacingMe, final TileEntity tileTarget) { + if (handlerHere == null) { + return false; + } if (tileTarget == null) { return false; } @@ -425,7 +466,8 @@ protected boolean moveEnergy(final Direction myFacingDir, final BlockPos posTarg if (capacity <= 0) { return false; } - //first simulate + //validation is done + //next, simulate final int drain = handlerHere.extractEnergy(Math.min(quantity, capacity), true); if (drain <= 0) { return false; diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java b/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java index 524fff3f2..db8239c07 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/energy/TileWirelessEnergy.java @@ -2,6 +2,7 @@ import com.lothrazar.cyclic.base.TileEntityBase; import com.lothrazar.cyclic.capability.CustomEnergyStorage; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -100,8 +101,15 @@ public void tick() { boolean moved = false; //run the transfer. one slot only BlockPosDim loc = getTargetInSlot(0); - if (loc != null && UtilWorld.dimensionIsEqual(loc, world)) { - moved = moveEnergy(Direction.UP, loc.getPos(), transferRate); + if (loc != null) { + if (UtilWorld.dimensionIsEqual(loc, world)) { + // assume position is in the same level/dimension/world + moved = moveEnergy(loc.getSide(), loc.getPos(), transferRate); + } + else if (ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + //allows config to disable this cross dimension feature for modpack balance purposes + moved = moveEnergyDimensional(loc, transferRate); + } } this.setLitProperty(moved); } diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java b/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java index ca0be573d..aaf6c5123 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/fluid/TileWirelessFluid.java @@ -2,6 +2,7 @@ import com.lothrazar.cyclic.base.FluidTankBase; import com.lothrazar.cyclic.base.TileEntityBase; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -115,8 +116,13 @@ public void tick() { boolean moved = false; //run the transfer. one slot only BlockPosDim loc = getTargetInSlot(0); - if (loc != null && UtilWorld.dimensionIsEqual(loc, world)) { - this.moveFluids(loc.getSide(), loc.getPos(), this.transferRate, tank); + if (loc != null) { + if (UtilWorld.dimensionIsEqual(loc, world)) { + this.moveFluids(loc.getSide(), loc.getPos(), this.transferRate, tank); + } + else if (ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + this.moveFluidsDimensional(loc, this.transferRate, tank); + } } this.setLitProperty(moved); } diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java b/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java index 7c4defd44..5f7f6bc1a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/item/TileWirelessItem.java @@ -1,6 +1,7 @@ package com.lothrazar.cyclic.block.wireless.item; import com.lothrazar.cyclic.base.TileEntityBase; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -98,8 +99,13 @@ public void tick() { boolean moved = false; //run the transfer. one slot only BlockPosDim loc = getTargetInSlot(); - if (loc != null && UtilWorld.dimensionIsEqual(loc, world)) { - moved = moveItems(Direction.UP, loc.getPos(), this.transferRate, this.inventory, 0); + if (loc != null) { + if (UtilWorld.dimensionIsEqual(loc, world)) { + moved = moveItems(loc.getSide(), loc.getPos(), this.transferRate, this.inventory, 0); + } + else if (ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + moved = moveItemsDimensional(loc, this.transferRate, this.inventory, 0); + } } this.setLitProperty(moved); } diff --git a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java index 999cf21f4..567ee9bf0 100644 --- a/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java +++ b/src/main/java/com/lothrazar/cyclic/block/wireless/redstone/TileWirelessTransmit.java @@ -2,6 +2,7 @@ import com.lothrazar.cyclic.ModCyclic; import com.lothrazar.cyclic.base.TileEntityBase; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.BlockPosDim; import com.lothrazar.cyclic.item.datacard.LocationGpsCard; import com.lothrazar.cyclic.registry.TileRegistry; @@ -97,11 +98,11 @@ public CompoundNBT write(CompoundNBT tag) { @SuppressWarnings("deprecation") private void toggleTarget(BlockPosDim dimPos) { - if (world.isRemote) { + if (dimPos == null || world.isRemote) { return; } BlockPos targetPos = dimPos.getPos(); - ServerWorld serverLevel = world.getServer().getWorld(UtilWorld.stringToDimension(dimPos.getDimension())); + ServerWorld serverLevel = dimPos.getServerLevel(world.getServer()); // world.getServer().getWorld(UtilWorld.stringToDimension(dimPos.getDimension())); if (serverLevel == null) { ModCyclic.LOGGER.info("Dimension not found " + dimPos.getDimension()); return; @@ -111,41 +112,30 @@ private void toggleTarget(BlockPosDim dimPos) { return; } boolean isPowered = world.isBlockPowered(pos); - // BlockState target = serverLevel.getBlockState(targetPos); if (serverLevel.getTileEntity(targetPos) instanceof TileWirelessRec) { TileWirelessRec receiver = (TileWirelessRec) serverLevel.getTileEntity(targetPos); //am I powered? if (isPowered) { + // ModCyclic.LOGGER.info(" POWER UP target" + dimPos); receiver.putPowerSender(this.id); } else { + // ModCyclic.LOGGER.info(" turn off target" + dimPos); receiver.removePowerSender(this.id); } } world.setBlockState(pos, world.getBlockState(pos).with(BlockStateProperties.POWERED, isPowered)); - // if (target.hasProperty(BlockStateProperties.POWERED)) { - // boolean targetPowered = target.get(BlockStateProperties.POWERED); - // //update target based on my state - // boolean isPowered = world.isBlockPowered(pos); - // if (targetPowered != isPowered) { - // serverLevel.setBlockState(targetPos, target.with(BlockStateProperties.POWERED, isPowered)); - // //and update myself too - // world.setBlockState(pos, world.getBlockState(pos).with(BlockStateProperties.POWERED, isPowered)); - // //TODO: send exact 1-16 power level - // // world.getTileEntity(targetPos) instanceof TileWirelessRec - // // && target.getBlock() instanceof BlockWirelessRec - // } - // } } @Override public void tick() { for (int s = 0; s < inventory.getSlots(); s++) { BlockPosDim targetPos = getTargetInSlot(s); - if (targetPos == null || - UtilWorld.dimensionIsEqual(targetPos, world) == false) { + if (!UtilWorld.dimensionIsEqual(targetPos, world) && !ConfigRegistry.TRANSFER_NODES_DIMENSIONAL.get()) { + //if dimensions dont match, AND config disables x-dimension communication, then skip this one continue; } + //else gogogo toggleTarget(targetPos); } } diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 95a455b56..e40da7f8a 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -105,6 +105,7 @@ public class ConfigRegistry { public static BooleanValue COMMANDHUNGER; public static BooleanValue COMMANDPING; public static BooleanValue LOGINFO; + public static BooleanValue TRANSFER_NODES_DIMENSIONAL; public static IntValue HEARTXPMINUS; private static ConfigValue> BEHEADING_SKINS; private static ConfigValue> MBALL_IGNORE_LIST; @@ -384,6 +385,11 @@ private static void initConfig() { CFG.pop(); //items CFG.comment(WALL, " Block specific configs", WALL) .push("blocks"); + TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions " + + "(no chunk loading is done, you have to do that on your own); " + + "This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; " + + "If you change it to false it will only work if the target is in the same dimension.") + .define("wireless_transfer_dimensional", true); CFG.comment("Ender shelf settings").push("sound"); BlockSoundRecorder.RADIUS = CFG.comment("Sound Recorder - how far out does it listen to record sounds").defineInRange("radius", 8, 1, 64); CFG.pop(); diff --git a/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java b/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java index 407aed378..a2eda44ab 100644 --- a/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java +++ b/src/main/java/com/lothrazar/cyclic/data/BlockPosDim.java @@ -1,10 +1,13 @@ package com.lothrazar.cyclic.data; +import com.lothrazar.cyclic.util.UtilWorld; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; +import net.minecraft.world.server.ServerWorld; public class BlockPosDim { @@ -112,4 +115,8 @@ public BlockPos getPos() { public void setPos(BlockPos pos) { this.pos = pos; } + + public ServerWorld getServerLevel(MinecraftServer server) { + return server.getWorld(UtilWorld.stringToDimension(this.getDimension())); + } } From 9726cf5f94d8cad709160f8cd44dc2025f4a3698 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Mon, 1 Apr 2024 22:20:55 -0700 Subject: [PATCH 07/17] backport #2182 candle model assets -INooBTooMuch --- .../cyclic/models/block/my_water_candle.json | 91 ++++++++++++ .../models/block/my_water_candle_lit.json | 132 ++++++++++++++++++ .../cyclic/models/block/water_candle.json | 89 +----------- .../cyclic/models/block/water_candle_lit.json | 129 +---------------- .../textures/blocks/machine/water_candle.png | Bin 0 -> 215 bytes .../blocks/machine/water_candle_holder.png | Bin 0 -> 347 bytes .../blocks/machine/water_candle_sides.png | Bin 0 -> 324 bytes update.json | 1 + 8 files changed, 226 insertions(+), 216 deletions(-) create mode 100644 src/main/resources/assets/cyclic/models/block/my_water_candle.json create mode 100644 src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json create mode 100644 src/main/resources/assets/cyclic/textures/blocks/machine/water_candle.png create mode 100644 src/main/resources/assets/cyclic/textures/blocks/machine/water_candle_holder.png create mode 100644 src/main/resources/assets/cyclic/textures/blocks/machine/water_candle_sides.png diff --git a/src/main/resources/assets/cyclic/models/block/my_water_candle.json b/src/main/resources/assets/cyclic/models/block/my_water_candle.json new file mode 100644 index 000000000..4f0bbe3c0 --- /dev/null +++ b/src/main/resources/assets/cyclic/models/block/my_water_candle.json @@ -0,0 +1,91 @@ + { + "credit": "Made with Blockbench @INooBTooMuch https://github.com/Lothrazar/Cyclic/issues/2182", + "parent": "block/block", + "textures": { + "holder": "cyclic:blocks/machine/water_candle_holder", + "2": "cyclic:blocks/machine/water_candle", + "sides": "cyclic:blocks/machine/water_candle_sides" + }, + "elements": [ + { + "name": "pillar", + "from": [7, 0.25, 7], + "to": [9, 8, 9], + "rotation": {"angle": 0, "axis": "z", "origin": [1, 0, 0]}, + "faces": { + "north": {"uv": [0, 0, 3, 12], "texture": "#sides"}, + "east": {"uv": [6, 0, 9, 12], "texture": "#sides"}, + "south": {"uv": [3, 0, 6, 12], "texture": "#sides"}, + "west": {"uv": [9, 0, 12, 12], "texture": "#sides"}, + "up": {"uv": [15, 2, 12, 0], "texture": "#sides"}, + "down": {"uv": [15, 2, 12, 4], "texture": "#sides"} + } + }, + { + "name": "center", + "from": [4, 0, 4], + "to": [12, 0.25, 12], + "faces": { + "north": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "east": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "south": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "west": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "up": {"uv": [9, 9, 0, 0], "texture": "#holder"}, + "down": {"uv": [9, 0, 0, 9], "texture": "#holder"} + } + }, + { + "name": "sh", + "from": [4, 0, 3], + "to": [12, 0.75, 4], + "faces": { + "north": {"uv": [0, 0, 8, 1], "texture": "#2"}, + "east": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "south": {"uv": [0, 1, 8, 2], "texture": "#2"}, + "west": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "up": {"uv": [8, 3, 0, 2], "texture": "#2"}, + "down": {"uv": [8, 3, 0, 4], "texture": "#2"} + } + }, + { + "name": "sh", + "from": [3, 0, 4], + "to": [4, 0.75, 12], + "faces": { + "north": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "east": {"uv": [0, 15, 8, 16], "texture": "#2"}, + "south": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "west": {"uv": [0, 14, 8, 15], "texture": "#2"}, + "up": {"uv": [14, 8, 15, 16], "texture": "#2"}, + "down": {"uv": [15, 8, 16, 16], "texture": "#2"} + } + }, + { + "name": "sh", + "from": [12, 0, 4], + "to": [13, 0.75, 12], + "faces": { + "north": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "east": {"uv": [0, 12, 8, 13], "texture": "#2"}, + "south": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "west": {"uv": [0, 13, 8, 14], "texture": "#2"}, + "up": {"uv": [14, 0, 15, 8], "texture": "#2"}, + "down": {"uv": [15, 0, 16, 8], "texture": "#2"} + } + }, + { + "name": "sh", + "from": [4, 0, 12], + "to": [12, 0.75, 13], + "faces": { + "north": {"uv": [0, 11, 8, 12], "texture": "#2"}, + "east": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "south": {"uv": [0, 8, 8, 9], "texture": "#2"}, + "west": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "up": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "down": {"uv": [0, 7, 8, 8], "texture": "#2"} + } + } + ], + "display": {} +} \ No newline at end of file diff --git a/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json b/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json new file mode 100644 index 000000000..731f877b0 --- /dev/null +++ b/src/main/resources/assets/cyclic/models/block/my_water_candle_lit.json @@ -0,0 +1,132 @@ + { + "credit": "Made with Blockbench @INooBTooMuch https://github.com/Lothrazar/Cyclic/issues/2182", + "parent": "block/block", + "textures": { + "holder": "cyclic:blocks/machine/water_candle_holder", + "2": "cyclic:blocks/machine/water_candle", + "centerwater": "cyclic:blocks/water_fake", + "sides": "cyclic:blocks/machine/water_candle_sides", + "flame": "cyclic:blocks/machine/gold" + }, + "elements": [ + { + "name": "centerwater", + "from": [4, 0.4, 4], + "to": [12, 0.6, 12], + "faces": { + "north": {"uv": [0, 0, 9, 0.25], "texture": "#centerwater"}, + "east": {"uv": [0, 0, 8, 0.25], "texture": "#centerwater"}, + "south": {"uv": [0, 0, 9, 0.25], "texture": "#centerwater"}, + "west": {"uv": [0, 0, 8, 0.25], "texture": "#centerwater"}, + "up": {"uv": [0, 0, 9, 8], "texture": "#centerwater"}, + "down": {"uv": [0, 0, 9, 8], "texture": "#centerwater"} + } + }, + { + "name": "flame", + "from": [7, 8, 8], + "to": [9, 10, 8], + "faces": { + "north": {"uv": [0, 0, 2, 2], "texture": "#flame"}, + "east": {"uv": [0, 0, 0, 2], "texture": "#flame"}, + "south": {"uv": [0, 0, 2, 2], "texture": "#flame"}, + "west": {"uv": [0, 0, 0, 2], "texture": "#flame"}, + "up": {"uv": [0, 0, 2, 0], "texture": "#flame"}, + "down": {"uv": [0, 0, 2, 0], "texture": "#flame"} + } + }, + { + "name": "flame", + "from": [8, 8, 7], + "to": [8, 10, 9], + "faces": { + "north": {"uv": [0, 0, 0, 2], "texture": "#flame"}, + "east": {"uv": [0, 0, 2, 2], "texture": "#flame"}, + "south": {"uv": [0, 0, 0, 2], "texture": "#flame"}, + "west": {"uv": [0, 0, 2, 2], "texture": "#flame"}, + "up": {"uv": [0, 0, 0, 2], "texture": "#flame"}, + "down": {"uv": [0, 0, 0, 2], "texture": "#flame"} + } + }, + { + "name": "pillar", + "from": [7, 0.25, 7], + "to": [9, 8, 9], + "rotation": {"angle": 0, "axis": "z", "origin": [1, 0, 0]}, + "faces": { + "north": {"uv": [0, 0, 3, 12], "texture": "#sides"}, + "east": {"uv": [6, 0, 9, 12], "texture": "#sides"}, + "south": {"uv": [3, 0, 6, 12], "texture": "#sides"}, + "west": {"uv": [9, 0, 12, 12], "texture": "#sides"}, + "up": {"uv": [15, 2, 12, 0], "texture": "#sides"}, + "down": {"uv": [15, 2, 12, 4], "texture": "#sides"} + } + }, + { + "name": "center", + "from": [4, 0, 4], + "to": [12, 0.25, 12], + "faces": { + "north": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "east": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "south": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "west": {"uv": [10, 0, 9, 6], "texture": "#holder"}, + "up": {"uv": [9, 9, 0, 0], "texture": "#holder"}, + "down": {"uv": [9, 0, 0, 9], "texture": "#holder"} + } + }, + { + "name": "sh", + "from": [4, 0, 3], + "to": [12, 0.75, 4], + "faces": { + "north": {"uv": [0, 0, 8, 1], "texture": "#2"}, + "east": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "south": {"uv": [0, 1, 8, 2], "texture": "#2"}, + "west": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "up": {"uv": [8, 3, 0, 2], "texture": "#2"}, + "down": {"uv": [8, 3, 0, 4], "texture": "#2"} + } + }, + { + "name": "sh", + "from": [3, 0, 4], + "to": [4, 0.75, 12], + "faces": { + "north": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "east": {"uv": [0, 15, 8, 16], "texture": "#2"}, + "south": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "west": {"uv": [0, 14, 8, 15], "texture": "#2"}, + "up": {"uv": [14, 8, 15, 16], "texture": "#2"}, + "down": {"uv": [15, 8, 16, 16], "texture": "#2"} + } + }, + { + "name": "sh", + "from": [12, 0, 4], + "to": [13, 0.75, 12], + "faces": { + "north": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "east": {"uv": [0, 12, 8, 13], "texture": "#2"}, + "south": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "west": {"uv": [0, 13, 8, 14], "texture": "#2"}, + "up": {"uv": [14, 0, 15, 8], "texture": "#2"}, + "down": {"uv": [15, 0, 16, 8], "texture": "#2"} + } + }, + { + "name": "sh", + "from": [4, 0, 12], + "to": [12, 0.75, 13], + "faces": { + "north": {"uv": [0, 11, 8, 12], "texture": "#2"}, + "east": {"uv": [0, 4, 1, 5], "texture": "#2"}, + "south": {"uv": [0, 8, 8, 9], "texture": "#2"}, + "west": {"uv": [1, 4, 2, 5], "texture": "#2"}, + "up": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "down": {"uv": [0, 7, 8, 8], "texture": "#2"} + } + } + ], + "display": {} +} \ No newline at end of file diff --git a/src/main/resources/assets/cyclic/models/block/water_candle.json b/src/main/resources/assets/cyclic/models/block/water_candle.json index 4a3d6f72d..4bc1f137d 100644 --- a/src/main/resources/assets/cyclic/models/block/water_candle.json +++ b/src/main/resources/assets/cyclic/models/block/water_candle.json @@ -1,90 +1,3 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "parent": "block/block", - "textures": { - "pillar": "cyclic:blocks/machine/lapis", - "center": "cyclic:blocks/machine/gold", - "base": "cyclic:blocks/machine/stone", - "particle": "cyclic:blocks/machine/gold" - }, - "elements": [ - { - "name": "pillar", - "from": [7, 0.25, 7], - "to": [9, 12, 9], - "faces": { - "north": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "east": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "south": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "west": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "up": {"uv": [0, 0, 2, 2], "texture": "#pillar"}, - "down": {"uv": [0, 0, 2, 2], "texture": "#pillar"} - } - }, - { - "name": "center", - "from": [3, 0, 4], - "to": [12, 0.25, 12], - "faces": { - "north": {"uv": [0, 0, 9, 0.25], "texture": "#center"}, - "east": {"uv": [0, 0, 8, 0.25], "texture": "#center"}, - "south": {"uv": [0, 0, 9, 0.25], "texture": "#center"}, - "west": {"uv": [0, 0, 8, 0.25], "texture": "#center"}, - "up": {"uv": [0, 0, 9, 8], "texture": "#center"}, - "down": {"uv": [1, 2, 10, 10], "texture": "#center"} - } - }, - { - "name": "sh", - "from": [3, 0, 2], - "to": [12, 0.75, 4], - "faces": { - "north": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "up": {"uv": [2, 0, 11, 2], "texture": "#base"}, - "down": {"uv": [0, 0, 9, 2], "texture": "#base"} - } - }, - { - "name": "sh", - "from": [1, 0, 4], - "to": [3, 0.75, 12], - "faces": { - "north": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "up": {"uv": [0, 1, 2, 9], "texture": "#base"}, - "down": {"uv": [0, 0, 2, 8], "texture": "#base"} - } - }, - { - "name": "sh", - "from": [12, 0, 4], - "to": [14, 0.75, 12], - "faces": { - "north": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "up": {"uv": [14, 3, 16, 11], "texture": "#base"}, - "down": {"uv": [0, 0, 2, 8], "texture": "#base"} - } - }, - { - "name": "sh", - "from": [3, 0, 12], - "to": [12, 0.75, 14], - "faces": { - "north": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "up": {"uv": [4, 14, 13, 16], "texture": "#base"}, - "down": {"uv": [0, 0, 9, 2], "texture": "#base"} - } - } - ] + "parent": "cyclic:block/my_water_candle" } \ No newline at end of file diff --git a/src/main/resources/assets/cyclic/models/block/water_candle_lit.json b/src/main/resources/assets/cyclic/models/block/water_candle_lit.json index 8513accf1..48bbee606 100644 --- a/src/main/resources/assets/cyclic/models/block/water_candle_lit.json +++ b/src/main/resources/assets/cyclic/models/block/water_candle_lit.json @@ -1,130 +1,3 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "pillar": "cyclic:blocks/machine/lapis", - "center": "cyclic:blocks/machine/gold", - "base": "cyclic:blocks/machine/stone", - "particle": "cyclic:blocks/machine/gold", - "centerwater": "cyclic:blocks/water_fake", - "flame": "cyclic:blocks/machine/gold" - }, - "elements": [ - { - "name": "pillar", - "from": [7, 0.25, 7], - "to": [9, 12, 9], - "faces": { - "north": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "east": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "south": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "west": {"uv": [0, 0, 2, 11.75], "texture": "#pillar"}, - "up": {"uv": [0, 0, 2, 2], "texture": "#pillar"}, - "down": {"uv": [0, 0, 2, 2], "texture": "#pillar"} - } - }, - { - "name": "center", - "from": [3, 0, 4], - "to": [12, 0.25, 12], - "faces": { - "north": {"uv": [0, 0, 9, 0.25], "texture": "#center"}, - "east": {"uv": [0, 0, 8, 0.25], "texture": "#center"}, - "south": {"uv": [0, 0, 9, 0.25], "texture": "#center"}, - "west": {"uv": [0, 0, 8, 0.25], "texture": "#center"}, - "up": {"uv": [0, 0, 9, 8], "texture": "#center"}, - "down": {"uv": [3, 5, 12, 13], "texture": "#center"} - } - }, - { - "name": "centerwater", - "from": [3, 0.5, 4], - "to": [12, 0.75, 12], - "faces": { - "north": {"uv": [0, 0, 9, 0.25], "texture": "#centerwater"}, - "east": {"uv": [0, 0, 8, 0.25], "texture": "#centerwater"}, - "south": {"uv": [0, 0, 9, 0.25], "texture": "#centerwater"}, - "west": {"uv": [0, 0, 8, 0.25], "texture": "#centerwater"}, - "up": {"uv": [0, 0, 9, 8], "texture": "#centerwater"}, - "down": {"uv": [0, 0, 9, 8], "texture": "#centerwater"} - } - }, - { - "name": "sh", - "from": [3, 0, 2], - "to": [12, 0.75, 4], - "faces": { - "north": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "up": {"uv": [2, 0, 11, 2], "texture": "#base"}, - "down": {"uv": [0, 0, 9, 2], "texture": "#base"} - } - }, - { - "name": "sh", - "from": [1, 0, 4], - "to": [3, 0.75, 12], - "faces": { - "north": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "up": {"uv": [0, 1, 2, 9], "texture": "#base"}, - "down": {"uv": [0, 0, 2, 8], "texture": "#base"} - } - }, - { - "name": "sh", - "from": [12, 0, 4], - "to": [14, 0.75, 12], - "faces": { - "north": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 8, 0.75], "texture": "#base"}, - "up": {"uv": [14, 3, 16, 11], "texture": "#base"}, - "down": {"uv": [0, 0, 2, 8], "texture": "#base"} - } - }, - { - "name": "sh", - "from": [3, 0, 12], - "to": [12, 0.75, 14], - "faces": { - "north": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "east": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "south": {"uv": [0, 0, 9, 0.75], "texture": "#base"}, - "west": {"uv": [0, 0, 2, 0.75], "texture": "#base"}, - "up": {"uv": [4, 14, 13, 16], "texture": "#base"}, - "down": {"uv": [0, 0, 9, 2], "texture": "#base"} - } - }, - { - "name": "flame", - "from": [7, 12, 8], - "to": [9, 14, 8], - "faces": { - "north": {"uv": [0, 0, 2, 2], "texture": "#flame"}, - "east": {"uv": [0, 0, 0, 2], "texture": "#flame"}, - "south": {"uv": [0, 0, 2, 2], "texture": "#flame"}, - "west": {"uv": [0, 0, 0, 2], "texture": "#flame"}, - "up": {"uv": [0, 0, 2, 0], "texture": "#flame"}, - "down": {"uv": [0, 0, 2, 0], "texture": "#flame"} - } - }, - { - "name": "flame", - "from": [8, 12, 7], - "to": [8, 14, 9], - "faces": { - "north": {"uv": [0, 0, 0, 2], "texture": "#flame"}, - "east": {"uv": [0, 0, 2, 2], "texture": "#flame"}, - "south": {"uv": [0, 0, 0, 2], "texture": "#flame"}, - "west": {"uv": [0, 0, 2, 2], "texture": "#flame"}, - "up": {"uv": [0, 0, 0, 2], "texture": "#flame"}, - "down": {"uv": [0, 0, 0, 2], "texture": "#flame"} - } - } - ] + "parent": "cyclic:block/my_water_candle_lit" } \ No newline at end of file diff --git a/src/main/resources/assets/cyclic/textures/blocks/machine/water_candle.png b/src/main/resources/assets/cyclic/textures/blocks/machine/water_candle.png new file mode 100644 index 0000000000000000000000000000000000000000..6b060114991fa1f8ea1cc0f778d2868c3169ab8c GIT binary patch literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`^E_P~Lo9mNPTt6MSV6!czB#Vh z#Ch`%)!hI8i(}3_Ti|SM;>G0@^2>qGMZSD_d8JK!ewj;)L~^I@ir>4K64tUFuw-}m zvd?$JTXysJ7o*H$nJz?44ob4hTQ=pC)#GhC4Evkpik=;AI5QV?lZjxP%3xbd*Y5NR5aZB%g6+xOtVzcH)H`@zAgkpNv(sMbS`DV_HJU%@~ zog^p`=6Mc4*L460kQu|<>x*zl+E|OVmZB&)91gT?%W}CS#>mlo(lou-djW_Di^YPO zwE#Hh2q6$-#9GVwe4YjXSYvR`;hY0NDa9}h)OC$N9wz~6wOS!cT?@t-X0sVdl8|K? z`~7|z5MyNMdp@d)EXyv_Pbak2G~Q1(11J&ULF>!W+7_i0aU5ye7J#BCZvEfBp{lAP z&vW{|$2Se{Wr_Fxdc56kHwnO1y=NGPTmSfDreD`>CRwl7 t>6qv9Sl2p)AYIoTH=E7ppKbR~^aal^d{sL_(P01p002ovPDHLkV1fW2mOKCe literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/cyclic/textures/blocks/machine/water_candle_sides.png b/src/main/resources/assets/cyclic/textures/blocks/machine/water_candle_sides.png new file mode 100644 index 0000000000000000000000000000000000000000..d2baad2c4418242e4e05dda9044887850df03854 GIT binary patch literal 324 zcmV-K0lWT*P)yoj`(xF==6e$_nrCTK<8D%OS5Md!*`ddKE z6Z95~^Zj@Co9O56>8c+e5HyDq^KZa&`+iQHu9_PCC#;&9TxWi0j^=Rk z!|&%W0939sK413}p`?YHm7Qf*AF)FVK=iS`zvepg!m6nOSmJi|(evAji{i0JhD`6E znbsF>dvVd2SAgF~k|a$GbDdEnY4BZ?>D>(}Vlk96q*Wp|y`$``7tP Date: Mon, 1 Apr 2024 23:40:07 -0700 Subject: [PATCH 08/17] excavate enchant improvements --- src/main/java/com/lothrazar/cyclic/data/DataTags.java | 1 + .../lothrazar/cyclic/enchant/EnchantExcavation.java | 10 ++++++++++ .../data/cyclic/tags/blocks/ignored/excavate.json | 9 +++++++++ update.json | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json diff --git a/src/main/java/com/lothrazar/cyclic/data/DataTags.java b/src/main/java/com/lothrazar/cyclic/data/DataTags.java index c9b23b586..b976a8ff1 100644 --- a/src/main/java/com/lothrazar/cyclic/data/DataTags.java +++ b/src/main/java/com/lothrazar/cyclic/data/DataTags.java @@ -21,6 +21,7 @@ public class DataTags { public static final INamedTag VINES = BlockTags.makeWrapperTag("forge:vines"); public static final INamedTag CACTUS = BlockTags.makeWrapperTag("forge:cactus"); public static final INamedTag CROP_BLOCKS = BlockTags.makeWrapperTag("forge:crop_blocks"); + public static final INamedTag EXCAVATE_IGNORED = BlockTags.makeWrapperTag("cyclic:ignored/excavate"); public static final INamedTag FISHING_RODS = ItemTags.makeWrapperTag("forge:fishing_rods"); public static final INamedTag BOOKS = ItemTags.makeWrapperTag("forge:books"); public static final INamedTag ANVIL_IMMUNE = ItemTags.makeWrapperTag("cyclic:anvil_immune"); diff --git a/src/main/java/com/lothrazar/cyclic/enchant/EnchantExcavation.java b/src/main/java/com/lothrazar/cyclic/enchant/EnchantExcavation.java index 63d38e126..6e473ab22 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/EnchantExcavation.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/EnchantExcavation.java @@ -25,6 +25,7 @@ import com.lothrazar.cyclic.ModCyclic; import com.lothrazar.cyclic.base.EnchantBase; +import com.lothrazar.cyclic.data.DataTags; import com.lothrazar.cyclic.registry.EnchantRegistry; import com.lothrazar.cyclic.util.UtilItemStack; import java.util.Arrays; @@ -64,6 +65,7 @@ public EnchantExcavation(Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotT public static BooleanValue CFG; public static final String ID = "excavate"; + public static boolean effectiveToolRequired = true; // non-config lets hardcode this actually @Override public boolean isEnabled() { @@ -105,6 +107,14 @@ public void onBreakEvent(BreakEvent event) { if (level <= 0) { return; } + if (effectiveToolRequired && !ForgeHooks.isToolEffective(world, pos, stackHarvestingWith)) { + ModCyclic.LOGGER.info("excavate trigger cancelled; tool not effective"); + return; + } + if (eventState.isIn(DataTags.EXCAVATE_IGNORED)) { + ModCyclic.LOGGER.info("excavate trigger cancelled; see blocktag " + DataTags.EXCAVATE_IGNORED.toString()); + return; + } if (ForgeHooks.canHarvestBlock(eventState, player, world, pos)) { int harvested = this.harvestSurrounding((World) world, player, pos, block, 1, level, player.swingingHand); if (harvested > 0) { diff --git a/src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json b/src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json new file mode 100644 index 000000000..cf52e968c --- /dev/null +++ b/src/main/resources/data/cyclic/tags/blocks/ignored/excavate.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "#minecraft:shulker_boxes", + {"required":false, "id": "cyclic:crate"}, + {"required":false, "id": "minecraft:chest"}, + {"required":false, "id": "minecraft:command_block"} + ] +} \ No newline at end of file diff --git a/update.json b/update.json index af83baa95..2f4b754f1 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"Backport #2182 candle model assets. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions if possible. " + ,"1.5.23":"Backport #2182 candle model assets. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions if possible #1913. Excavate enchant will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. Excavate enchant will not trigger on anything matching the new block tag [cyclic:ignored/excavate] #2116 " } } From 3510b65ba4a98d64728b28dda882da6ea7056b21 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Tue, 2 Apr 2024 21:29:01 -0700 Subject: [PATCH 09/17] backported some features from /1.20 --- build.gradle | 8 +- examples/scripts/durability.zs | 10 +++ examples/scripts/generator_fluid.zs | 14 ++++ examples/scripts/generator_item.zs | 12 +++ .../cyclic/block/breaker/TileBreaker.java | 41 ++++++---- .../cyclic/compat/CompatConstants.java | 12 +++ .../cyclic/compat/botania/BotaniaWrapper.java | 15 ++-- .../compat/crafttweaker/EnergyFluidZen.java | 57 ++++++++++++++ .../compat/crafttweaker/EnergyItemZen.java | 42 ++++++++++ .../cyclic/config/ConfigRegistry.java | 4 +- .../lothrazar/cyclic/event/EventRender.java | 9 ++- .../cyclic/event/PlayerAbilityEvents.java | 1 - .../cyclic/item/EdibleFlightItem.java | 2 +- .../lothrazar/cyclic/item/EdibleSpecItem.java | 2 +- .../cyclic/item/apple/AppleBuffs.java | 5 -- .../item/endereye/ItemEnderEyeReuse.java | 27 +++---- .../recipes/charm_knockback_resistance.json | 4 +- .../data/cyclic/recipes/charm_longfall.json | 2 +- .../data/cyclic/recipes/experience_pylon.json | 2 +- .../resources/data/cyclic/recipes/ghost.json | 2 +- .../data/cyclic/recipes/magic_net.json | 10 +-- .../cyclic/recipes/randomize_scepter.json | 4 +- .../cyclic/recipes/scaffold_responsive.json | 2 +- .../resources/data/cyclic/recipes/screen.json | 6 +- .../data/cyclic/recipes/solidifier_apple.json | 2 +- .../cyclic/recipes/solidifier_apple0.json | 2 +- .../data/cyclic/recipes/soundproofing.json | 2 +- .../data/cyclic/recipes/spawner_seeker.json | 2 +- .../data/cyclic/recipes/spelunker.json | 2 +- .../data/forge/tags/items/mushrooms.json | 76 +++++++++++++++++++ .../data/forge/tags/items/sandstone.json | 8 ++ .../data/forge/tags/items/vines.json | 24 ++++++ .../data/forge/tags/items/workbench.json | 6 ++ update.json | 2 +- 34 files changed, 344 insertions(+), 75 deletions(-) create mode 100644 examples/scripts/durability.zs create mode 100644 examples/scripts/generator_fluid.zs create mode 100644 examples/scripts/generator_item.zs create mode 100644 src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java create mode 100644 src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java create mode 100644 src/main/resources/data/forge/tags/items/mushrooms.json create mode 100644 src/main/resources/data/forge/tags/items/sandstone.json create mode 100644 src/main/resources/data/forge/tags/items/vines.json create mode 100644 src/main/resources/data/forge/tags/items/workbench.json diff --git a/build.gradle b/build.gradle index 9c495c27f..fe2ca0f24 100644 --- a/build.gradle +++ b/build.gradle @@ -96,14 +96,16 @@ dependencies { runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") // optional dependencies & mods for testing compat - +/* implementation fg.deobf("curse.maven:mantle-74924:3482897") implementation fg.deobf("curse.maven:tinkers-construct-74072:3482903") implementation fg.deobf("curse.maven:cucumber-272335:3507886") implementation fg.deobf("curse.maven:mystical-agriculture-246640:3562127") implementation fg.deobf("curse.maven:chunknogobyebye-332695:3195333") - - + implementation fg.deobf("curse.maven:yungs-api-421850:3494919") + implementation fg.deobf("curse.maven:yungs-better-strongholds-465575:3412586") + implementation fg.deobf("curse.maven:v-tweaks-238048:3675562") +*/ // To use any mod in /libs/ folder, place it in and set the mod and version to match jar filename // runtimeOnly fg.deobf("libs:SimpleStorageNetwork:1.16.4-1.3.1") // runtimeOnly fg.deobf("libs:refinedstorage:1.16.4-1.9.11") diff --git a/examples/scripts/durability.zs b/examples/scripts/durability.zs new file mode 100644 index 000000000..4c5258d03 --- /dev/null +++ b/examples/scripts/durability.zs @@ -0,0 +1,10 @@ + + +// change max damage aka durability aka number of tool uses like this + +val glove = ; +glove.maxDamage = 64; + + +val wand = ; +wand.maxDamage = 16; diff --git a/examples/scripts/generator_fluid.zs b/examples/scripts/generator_fluid.zs new file mode 100644 index 000000000..dbdeb34f2 --- /dev/null +++ b/examples/scripts/generator_fluid.zs @@ -0,0 +1,14 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var generator = ; + +generator.removeRecipe("cyclic:generator/generate_xp"); +generator.removeRecipe("cyclic:generator/generate_lava"); + + + +generator.addRecipe("zoldo", *250, 5, 10); + +generator.addRecipe("lava_tag", "minecraft:lava", 1000, 200, 500); diff --git a/examples/scripts/generator_item.zs b/examples/scripts/generator_item.zs new file mode 100644 index 000000000..33c62da67 --- /dev/null +++ b/examples/scripts/generator_item.zs @@ -0,0 +1,12 @@ +// https://docs.blamejared.com/ +// https://www.curseforge.com/minecraft/mc-mods/crafttweaker +// use /ct dump fluids to see all fluid IDs + +var generator = ; + +// recipe IDS, not item ids +generator.removeRecipe("cyclic:generator/generate_redstone"); +generator.removeRecipe("cyclic:generator/generate_star"); + +// ID, input, output, RF per tick, ticks, bonus, percentage of bonus +generator.addRecipe("zelda", , 500, 120); diff --git a/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java b/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java index c596ae1e3..ea4872763 100644 --- a/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java +++ b/src/main/java/com/lothrazar/cyclic/block/breaker/TileBreaker.java @@ -9,10 +9,12 @@ import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.world.World; public class TileBreaker extends TileEntityBase implements INamedContainerProvider, ITickableTileEntity { @@ -41,25 +43,32 @@ public void tick() { return; } BlockPos target = pos.offset(this.getCurrentFacing()); - BlockState state = world.getBlockState(target); - if (state.getBlock() != Blocks.AIR && - state.getBlockHardness(world, target) >= 0) { + if (this.isValid(target)) { this.world.destroyBlock(target, true); - // int cost = POWERCONF.get(); - // ModCyclic.LOGGER.info("cost" + cost + " have " + energy.getEnergyStored()); - // if (cost > 0) { - // energy.extractEnergy(cost, false); - // } } - //else unbreakable } - // @Override - // public LazyOptional getCapability(Capability cap, Direction side) { - // if (cap == CapabilityEnergy.ENERGY && POWERCONF.get() > 0) { - // return energyCap.cast(); - // } - // return super.getCapability(cap, side); - // } + + /** + * Avoid mining source liquid blocks and unbreakable + */ + private boolean isValid(BlockPos target) { + World level = world; + BlockState state = level.getBlockState(target); + if (state.getBlock() == Blocks.AIR) { + return false; + } + if (state.getBlockHardness(level, target) < 0) { + return false; + } + if (state.getFluidState() != null && state.getFluidState().isEmpty() == false) { + //am i a solid waterlogged state block? + if (state.hasProperty(BlockStateProperties.WATERLOGGED) == false) { + //pure liquid. but this will make canHarvestBlock go true + return false; + } + } + return true; + } @Override public ITextComponent getDisplayName() { diff --git a/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java b/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java index d2ff8fdde..1e1068301 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java +++ b/src/main/java/com/lothrazar/cyclic/compat/CompatConstants.java @@ -1,4 +1,7 @@ package com.lothrazar.cyclic.compat; + +import net.minecraft.util.ResourceLocation; + public class CompatConstants { public static final String RESYNTH_GROWTH_STAGE = "growth_stage"; @@ -6,4 +9,13 @@ public class CompatConstants { public static final String CRAFTTWEAKER = "crafttweaker"; public static final String CURIOS = "curios"; public static final String TCONSTRUCT = "tconstruct"; + // + //compat with Repurposed Structures Mod see #1517 + public static final String RS_MODID = "repurposed_structures"; + public static final String RS_STRONGHOLD_ID = "stronghold_stonebrick"; + public static final String RS_NETHER_STRONGHOLD_ID = "stronghold_nether"; + public static final String YUSTRONG_MODID = "betterstrongholds"; // https://github.com/yungnickyoung/YUNGs-Better-Strongholds + public static final ResourceLocation RS_RESOURCE_LOCATION = new ResourceLocation(RS_MODID, RS_STRONGHOLD_ID); + public static final ResourceLocation RS_NETHER_RESOURCE_LOCATION = new ResourceLocation(RS_MODID, RS_NETHER_STRONGHOLD_ID); + public static final ResourceLocation YUNG_STRONGHOLD_LOCATION = new ResourceLocation(YUSTRONG_MODID, "stronghold"); } diff --git a/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java b/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java index 3638790ab..1a5cb5ac6 100644 --- a/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java +++ b/src/main/java/com/lothrazar/cyclic/compat/botania/BotaniaWrapper.java @@ -5,14 +5,19 @@ public class BotaniaWrapper { + /** + * If the botania mod is loaded, use the botania-api to check for hasSolegnoliaAround(entity); otherwise return false + * + * @param entity + * @return true if botania has found a solegnolia around the entity + */ public static boolean hasSolegnoliaAround(LivingEntity entity) { try { - return ModList.get().isLoaded("botania") && vazkii.botania.api.BotaniaAPI.instance().hasSolegnoliaAround(entity); + if (ModList.get().isLoaded("botania")) { + return vazkii.botania.api.BotaniaAPI.instance().hasSolegnoliaAround(entity); + } } - catch (Exception e) { - //ive never seen an exception here yet, just being safe - } - //either botania does not exist or an error was thrown + catch (Exception e) {} return false; } } diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java new file mode 100644 index 000000000..fd84f61a9 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyFluidZen.java @@ -0,0 +1,57 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.annotations.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.managers.IRecipeManager; +import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; +import com.lothrazar.cyclic.block.generatorfluid.RecipeGeneratorFluid; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.CyclicRecipeType; +import com.lothrazar.cyclic.recipe.FluidTagIngredient; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.generator_fluid") +public class EnergyFluidZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public IRecipeType getRecipeType() { + return CyclicRecipeType.GENERATOR_FLUID; + } + + @SuppressWarnings("rawtypes") + @ZenCodeType.Method + public void addRecipe(String name, IFluidStack fluid, int rfPertick, int ticks) { + name = fixRecipeName(name); + RecipeGeneratorFluid m = new RecipeGeneratorFluid(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), + new FluidTagIngredient(new FluidStack(fluid.getFluid(), 1), "", fluid.getAmount()), + ticks, rfPertick); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe loaded " + m.getId().toString()); + } + + @SuppressWarnings("rawtypes") + @ZenCodeType.Method + public void addRecipe(String name, String fluidTag, int amount, int rfPertick, int ticks) { + name = fixRecipeName(name); + RecipeGeneratorFluid m = new RecipeGeneratorFluid(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), + new FluidTagIngredient(null, fluidTag, amount), + ticks, rfPertick); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe (tag %s) loaded " + m.getId().toString(), fluidTag); + } + + @ZenCodeType.Method + public void removeRecipe(String names) { + removeByName(names); + logger.debug("Recipe removed " + names); + } +} diff --git a/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java new file mode 100644 index 000000000..fdf11b3a1 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/compat/crafttweaker/EnergyItemZen.java @@ -0,0 +1,42 @@ +package com.lothrazar.cyclic.compat.crafttweaker; + +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.annotations.ZenRegister; +import com.blamejared.crafttweaker.api.item.IIngredient; +import com.blamejared.crafttweaker.api.managers.IRecipeManager; +import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; +import com.lothrazar.cyclic.block.generatoritem.RecipeGeneratorItem; +import com.lothrazar.cyclic.compat.CompatConstants; +import com.lothrazar.cyclic.recipe.CyclicRecipeType; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openzen.zencode.java.ZenCodeType; + +@ZenRegister +@ZenCodeType.Name("mods.cyclic.generator_item") +public class EnergyItemZen implements IRecipeManager { + + private final Logger logger = LogManager.getLogger(); + + @Override + public IRecipeType getRecipeType() { + return CyclicRecipeType.GENERATOR_ITEM; + } + + @SuppressWarnings("rawtypes") + @ZenCodeType.Method + public void addRecipe(String name, IIngredient input, int rfPertick, int ticks) { + name = fixRecipeName(name); + RecipeGeneratorItem m = new RecipeGeneratorItem(new ResourceLocation(CompatConstants.CRAFTTWEAKER, name), input.asVanillaIngredient(), ticks, rfPertick); + CraftTweakerAPI.apply(new ActionAddRecipe(this, m, "")); + logger.debug("Recipe loaded " + m.getId().toString()); + } + + @ZenCodeType.Method + public void removeRecipe(String names) { + removeByName(names); + logger.debug("Recipe removed " + names); + } +} diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index e40da7f8a..b28a5f4ca 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -260,11 +260,11 @@ private static void initConfig() { .defineInRange("generator_food.rf_per_tick", 60, 1, 6400); TileGeneratorFood.TICKS_PER_FOOD = CFG.comment("This [factor * (item.food + item.saturation) = ticks] results in the number of ticks food will burn at. IE Bread has (5 + 0.6) with factor 100, will burn for 560 ticks.") .defineInRange("generator_food.ticks_per_food", 100, 1, 6400); - CFG.comment(WALL, "Energy cost for various machines, either per use of an action or per tick (twenty ticks per second).", WALL) + CFG.comment(WALL, "Energy cost for various machines, either per use of an action or per tick (twenty ticks per second). Setting as zero (0) lets machine run for free", WALL) .push("cost"); TilePackager.POWERCONF = CFG.comment("Power per recipe in the packager").defineInRange("packager", 50, 0, 64000); TileDisenchant.POWERCONF = CFG.comment("Power per use disenchanter").defineInRange("disenchanter", 2500, 0, 64000); - TileUser.POWERCONF = CFG.comment("Power per use user").defineInRange("user", 50, 0, 64000); + TileUser.POWERCONF = CFG.comment("Power per use user").defineInRange("user", 0, 0, 64000); TileAnvilAuto.POWERCONF = CFG.comment("Power per repair anvil").defineInRange("anvil", 250, 0, 64000); TileMelter.POWERCONF = CFG.comment("Power per recipe melter").defineInRange("melter", 5000, 0, 64000); TileSolidifier.POWERCONF = CFG.comment("Power per recipe solidifier").defineInRange("solidifier", 5000, 0, 64000); diff --git a/src/main/java/com/lothrazar/cyclic/event/EventRender.java b/src/main/java/com/lothrazar/cyclic/event/EventRender.java index 86cb1f2d1..18edd1c19 100644 --- a/src/main/java/com/lothrazar/cyclic/event/EventRender.java +++ b/src/main/java/com/lothrazar/cyclic/event/EventRender.java @@ -121,6 +121,7 @@ public static void drawStack(ItemStack stack) { // } ///////////////////// asdfasdf TODO REFACTOR THIS + @SuppressWarnings("deprecation") @SubscribeEvent public void renderOverlay(RenderWorldLastEvent event) { PlayerEntity player = Minecraft.getInstance().player; @@ -159,7 +160,13 @@ public void renderOverlay(RenderWorldLastEvent event) { } List coords = RandomizerItem.getPlaces(lookingAt.getPos(), lookingAt.getFace()); for (BlockPos e : coords) { - renderCubes.put(e, RandomizerItem.canMove(player.world.getBlockState(e), player.world, e) ? ClientConfigCyclic.getColor(stack) : Color.RED); + BlockState stHere = player.world.getBlockState(e); + if (!RandomizerItem.canMove(stHere, world, e) && !stHere.isAir()) { + renderCubes.put(e, ClientConfigCyclic.getColor(stack)); + } + else if (!stHere.isAir()) { + UtilRender.createBox(event.getMatrixStack(), e); // see: RenderBlockUtils and event.getPoseStack() + } } } stack = OreProspector.getIfHeld(player); diff --git a/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java b/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java index e571d2bad..12203f680 100644 --- a/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java +++ b/src/main/java/com/lothrazar/cyclic/event/PlayerAbilityEvents.java @@ -41,7 +41,6 @@ private void tickFlying(PlayerEntity player, CyclicFile datFile) { } if (datFile.flyTicks > DISABLE_OFFSET) { player.abilities.allowFlying = true; - ModCyclic.LOGGER.info("allowFlying"); } else if (datFile.flyTicks <= DISABLE_OFFSET) { player.abilities.allowFlying = false; diff --git a/src/main/java/com/lothrazar/cyclic/item/EdibleFlightItem.java b/src/main/java/com/lothrazar/cyclic/item/EdibleFlightItem.java index da0df4a3a..b7118d6da 100644 --- a/src/main/java/com/lothrazar/cyclic/item/EdibleFlightItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/EdibleFlightItem.java @@ -17,7 +17,7 @@ public class EdibleFlightItem extends ItemBase { public static IntValue TICKS; public EdibleFlightItem(Properties properties) { - super(properties.rarity(Rarity.RARE).food(new Food.Builder().hunger(3).saturation(0).setAlwaysEdible().build())); + super(properties.rarity(Rarity.RARE).food(new Food.Builder().hunger(1).saturation(0).setAlwaysEdible().build())); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/item/EdibleSpecItem.java b/src/main/java/com/lothrazar/cyclic/item/EdibleSpecItem.java index 2f164fbe4..248e94946 100644 --- a/src/main/java/com/lothrazar/cyclic/item/EdibleSpecItem.java +++ b/src/main/java/com/lothrazar/cyclic/item/EdibleSpecItem.java @@ -17,7 +17,7 @@ public class EdibleSpecItem extends ItemBase { public static IntValue TICKS; public EdibleSpecItem(Properties properties) { - super(properties.rarity(Rarity.EPIC).food(new Food.Builder().hunger(3).saturation(0).setAlwaysEdible().build())); + super(properties.rarity(Rarity.EPIC).food(new Food.Builder().hunger(1).saturation(0).setAlwaysEdible().build())); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/item/apple/AppleBuffs.java b/src/main/java/com/lothrazar/cyclic/item/apple/AppleBuffs.java index 0a5fe62be..c1b2fdae3 100644 --- a/src/main/java/com/lothrazar/cyclic/item/apple/AppleBuffs.java +++ b/src/main/java/com/lothrazar/cyclic/item/apple/AppleBuffs.java @@ -6,7 +6,6 @@ import java.util.List; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.potion.EffectInstance; import net.minecraft.util.text.ITextComponent; @@ -40,10 +39,6 @@ public void addInformation(ItemStack stack, World worldIn, List @Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) { - if (entityLiving instanceof PlayerEntity) { - // TOOD - ((PlayerEntity) entityLiving).getCooldownTracker().setCooldown(this, 30); - } return super.onItemUseFinish(stack, worldIn, entityLiving); } } diff --git a/src/main/java/com/lothrazar/cyclic/item/endereye/ItemEnderEyeReuse.java b/src/main/java/com/lothrazar/cyclic/item/endereye/ItemEnderEyeReuse.java index fe8a9bb69..845b66645 100644 --- a/src/main/java/com/lothrazar/cyclic/item/endereye/ItemEnderEyeReuse.java +++ b/src/main/java/com/lothrazar/cyclic/item/endereye/ItemEnderEyeReuse.java @@ -1,6 +1,7 @@ package com.lothrazar.cyclic.item.endereye; import com.lothrazar.cyclic.base.ItemBase; +import com.lothrazar.cyclic.compat.CompatConstants; import com.lothrazar.cyclic.util.UtilItemStack; import com.lothrazar.cyclic.util.UtilWorld; import net.minecraft.advancements.CriteriaTriggers; @@ -10,7 +11,6 @@ import net.minecraft.stats.Stats; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; @@ -27,15 +27,6 @@ public ItemEnderEyeReuse(Properties properties) { super(properties.maxDamage(256)); } - //compat with Repurposed Structures Mod see #1517 - private static final String RS_MODID = "repurposed_structures"; - private static final String RS_STRONGHOLD_ID = "stronghold_stonebrick"; - private static final String RS_NETHER_STRONGHOLD_ID = "stronghold_nether"; - private static final String YUSTRONG_MODID = "betterstrongholds"; // https://github.com/yungnickyoung/YUNGs-Better-Strongholds - private static final ResourceLocation RS_RESOURCE_LOCATION = new ResourceLocation(RS_MODID, RS_STRONGHOLD_ID); - private static final ResourceLocation RS_NETHER_RESOURCE_LOCATION = new ResourceLocation(RS_MODID, RS_NETHER_STRONGHOLD_ID); - private static final ResourceLocation YUNG_STRONGHOLD_LOCATION = new ResourceLocation(YUSTRONG_MODID, "stronghold"); - @Override public ActionResult onItemRightClick(World worldIn, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); @@ -48,22 +39,22 @@ public ActionResult onItemRightClick(World worldIn, PlayerEntity play Structure rsNetherStronghold; BlockPos closestBlockPos = chunkGenerator.func_235956_a_(sw, vanillaStronghold, new BlockPos(player.getPosition()), 100, false); BlockPos rsBlockPos; - if (ModList.get().isLoaded(RS_MODID)) { - if (ForgeRegistries.STRUCTURE_FEATURES.containsKey(RS_RESOURCE_LOCATION)) { - rsStronghold = ForgeRegistries.STRUCTURE_FEATURES.getValue(RS_RESOURCE_LOCATION); + if (ModList.get().isLoaded(CompatConstants.RS_MODID)) { + if (ForgeRegistries.STRUCTURE_FEATURES.containsKey(CompatConstants.RS_RESOURCE_LOCATION)) { + rsStronghold = ForgeRegistries.STRUCTURE_FEATURES.getValue(CompatConstants.RS_RESOURCE_LOCATION); rsBlockPos = chunkGenerator.func_235956_a_(sw, rsStronghold, new BlockPos(player.getPosition()), 100, false); closestBlockPos = returnClosest(player.getPosition(), closestBlockPos, rsBlockPos); } - if (ForgeRegistries.STRUCTURE_FEATURES.containsKey(RS_NETHER_RESOURCE_LOCATION)) { - rsNetherStronghold = ForgeRegistries.STRUCTURE_FEATURES.getValue(RS_NETHER_RESOURCE_LOCATION); + if (ForgeRegistries.STRUCTURE_FEATURES.containsKey(CompatConstants.RS_NETHER_RESOURCE_LOCATION)) { + rsNetherStronghold = ForgeRegistries.STRUCTURE_FEATURES.getValue(CompatConstants.RS_NETHER_RESOURCE_LOCATION); rsBlockPos = chunkGenerator.func_235956_a_(sw, rsNetherStronghold, new BlockPos(player.getPosition()), 100, false); closestBlockPos = returnClosest(player.getPosition(), closestBlockPos, rsBlockPos); } } //what if both YUNG and RS: ok not else if - if (closestBlockPos == null && ModList.get().isLoaded(YUSTRONG_MODID)) { - if (ForgeRegistries.STRUCTURE_FEATURES.containsKey(YUNG_STRONGHOLD_LOCATION)) { - rsStronghold = ForgeRegistries.STRUCTURE_FEATURES.getValue(YUNG_STRONGHOLD_LOCATION); + if (closestBlockPos == null && ModList.get().isLoaded(CompatConstants.YUSTRONG_MODID)) { + if (ForgeRegistries.STRUCTURE_FEATURES.containsKey(CompatConstants.YUNG_STRONGHOLD_LOCATION)) { + rsStronghold = ForgeRegistries.STRUCTURE_FEATURES.getValue(CompatConstants.YUNG_STRONGHOLD_LOCATION); rsBlockPos = chunkGenerator.func_235956_a_(sw, rsStronghold, new BlockPos(player.getPosition()), 100, false); closestBlockPos = returnClosest(player.getPosition(), closestBlockPos, rsBlockPos); } diff --git a/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json b/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json index e6e8f6300..bab31086e 100644 --- a/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json +++ b/src/main/resources/data/cyclic/recipes/charm_knockback_resistance.json @@ -7,13 +7,13 @@ ], "key": { "g": { - "item": "minecraft:diamond" + "item": "minecraft:gold_ingot" }, "f": { "item": "minecraft:obsidian" }, "a": { - "item": "cyclic:gem_amber" + "item": "cyclic:gem_obsidian" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/charm_longfall.json b/src/main/resources/data/cyclic/recipes/charm_longfall.json index d858f2c85..53f49060e 100644 --- a/src/main/resources/data/cyclic/recipes/charm_longfall.json +++ b/src/main/resources/data/cyclic/recipes/charm_longfall.json @@ -16,7 +16,7 @@ "tag": "forge:feathers" }, "a": { - "item": "minecraft:diamond_boots" + "item": "cyclic:gem_amber" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/experience_pylon.json b/src/main/resources/data/cyclic/recipes/experience_pylon.json index 823e183e7..163cbd523 100644 --- a/src/main/resources/data/cyclic/recipes/experience_pylon.json +++ b/src/main/resources/data/cyclic/recipes/experience_pylon.json @@ -16,7 +16,7 @@ "item": "cyclic:gem_amber" }, "g": { - "item": "minecraft:lime_dye" + "tag": "forge:dyes/lime" }, "r": { "item": "minecraft:fire_charge" diff --git a/src/main/resources/data/cyclic/recipes/ghost.json b/src/main/resources/data/cyclic/recipes/ghost.json index 47a1214be..4ffa03530 100644 --- a/src/main/resources/data/cyclic/recipes/ghost.json +++ b/src/main/resources/data/cyclic/recipes/ghost.json @@ -13,7 +13,7 @@ "item": "minecraft:iron_nugget" }, "r": { - "item": "minecraft:gray_dye" + "tag": "forge:dyes/gray" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/magic_net.json b/src/main/resources/data/cyclic/recipes/magic_net.json index 0ba6a9dba..c646171ef 100644 --- a/src/main/resources/data/cyclic/recipes/magic_net.json +++ b/src/main/resources/data/cyclic/recipes/magic_net.json @@ -7,20 +7,20 @@ ], "key": { "i": { - "item": "minecraft:iron_ingot" + "tag": "forge:ingots/gold" }, "l": { - "tag": "minecraft:coral_blocks" + "tag": "forge:vines" }, "a": { - "item": "minecraft:cyan_dye" + "tag": "forge:dyes/cyan" }, "q": { - "item": "minecraft:snowball" + "item": "minecraft:ice" } }, "result": { "item": "cyclic:magic_net", - "count": 2 + "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/cyclic/recipes/randomize_scepter.json b/src/main/resources/data/cyclic/recipes/randomize_scepter.json index e6dbf9742..6b131236e 100644 --- a/src/main/resources/data/cyclic/recipes/randomize_scepter.json +++ b/src/main/resources/data/cyclic/recipes/randomize_scepter.json @@ -7,10 +7,10 @@ ], "key": { "p": { - "item": "minecraft:purple_dye" + "tag": "forge:dyes/purple" }, "i": { - "item": "minecraft:iron_ingot" + "tag": "forge:ingots/iron" }, "g": { "item": "minecraft:redstone" diff --git a/src/main/resources/data/cyclic/recipes/scaffold_responsive.json b/src/main/resources/data/cyclic/recipes/scaffold_responsive.json index b17e30865..926297a1d 100644 --- a/src/main/resources/data/cyclic/recipes/scaffold_responsive.json +++ b/src/main/resources/data/cyclic/recipes/scaffold_responsive.json @@ -10,7 +10,7 @@ "item": "minecraft:stick" }, "d": { - "item": "minecraft:red_dye" + "tag": "forge:dyes/red" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/screen.json b/src/main/resources/data/cyclic/recipes/screen.json index ca7784aa1..52b58c2a2 100644 --- a/src/main/resources/data/cyclic/recipes/screen.json +++ b/src/main/resources/data/cyclic/recipes/screen.json @@ -16,13 +16,13 @@ "item": "minecraft:iron_bars" }, "r": { - "item": "minecraft:red_dye" + "tag": "forge:dyes/red" }, "g": { - "item": "minecraft:green_dye" + "tag": "forge:dyes/green" }, "b": { - "item": "minecraft:blue_dye" + "tag": "forge:dyes/blue" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/solidifier_apple.json b/src/main/resources/data/cyclic/recipes/solidifier_apple.json index 4004af659..707ae14a6 100644 --- a/src/main/resources/data/cyclic/recipes/solidifier_apple.json +++ b/src/main/resources/data/cyclic/recipes/solidifier_apple.json @@ -12,7 +12,7 @@ "mix": { "fluid": "cyclic:honey", "tag": "forge:honey", - "count": 300 + "count": 3000 }, "result": { "item": "cyclic:apple_honey", diff --git a/src/main/resources/data/cyclic/recipes/solidifier_apple0.json b/src/main/resources/data/cyclic/recipes/solidifier_apple0.json index 3c669592c..0c67f8522 100644 --- a/src/main/resources/data/cyclic/recipes/solidifier_apple0.json +++ b/src/main/resources/data/cyclic/recipes/solidifier_apple0.json @@ -6,7 +6,7 @@ "mix": { "fluid": "cyclic:honey", "tag": "forge:honey", - "count": 100 + "count": 1000 }, "result": { "item": "cyclic:apple_honey", diff --git a/src/main/resources/data/cyclic/recipes/soundproofing.json b/src/main/resources/data/cyclic/recipes/soundproofing.json index 8123aeb9b..393f63c32 100644 --- a/src/main/resources/data/cyclic/recipes/soundproofing.json +++ b/src/main/resources/data/cyclic/recipes/soundproofing.json @@ -7,7 +7,7 @@ ], "key": { "s": { - "item": "minecraft:orange_dye" + "tag": "forge:dyes/orange" }, "o": { "item": "minecraft:bone_block" diff --git a/src/main/resources/data/cyclic/recipes/spawner_seeker.json b/src/main/resources/data/cyclic/recipes/spawner_seeker.json index 78765dd96..db3192e51 100644 --- a/src/main/resources/data/cyclic/recipes/spawner_seeker.json +++ b/src/main/resources/data/cyclic/recipes/spawner_seeker.json @@ -16,7 +16,7 @@ "item": "minecraft:ender_pearl" }, "d": { - "item": "minecraft:purple_dye" + "tag": "forge:dyes/purple" } }, "result": { diff --git a/src/main/resources/data/cyclic/recipes/spelunker.json b/src/main/resources/data/cyclic/recipes/spelunker.json index 53888d727..d750dd3f6 100644 --- a/src/main/resources/data/cyclic/recipes/spelunker.json +++ b/src/main/resources/data/cyclic/recipes/spelunker.json @@ -13,7 +13,7 @@ "item": "minecraft:flint" }, "g": { - "item": "minecraft:light_blue_dye" + "tag": "forge:dyes/light_blue" } }, "result": { diff --git a/src/main/resources/data/forge/tags/items/mushrooms.json b/src/main/resources/data/forge/tags/items/mushrooms.json new file mode 100644 index 000000000..d73b12788 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/mushrooms.json @@ -0,0 +1,76 @@ +{ + "replace": false, + "values": [ + "minecraft:red_mushroom", + "minecraft:brown_mushroom", + "minecraft:warped_fungus", + "minecraft:crimson_fungus", + {"required":false, "id": "mushroomquest:tinyfungibunch" }, + {"required":false, "id": "mushroomquest:tall_warped_fungus" }, + {"required":false, "id": "mushroomquest:tall_crimson_fungi" }, + {"required":false, "id": "mushroomquest:tinyfungibunch" }, + {"required":false, "id": "mushroomquest:toadstool" }, + {"required":false, "id": "mushroomquest:glowstoolbunch" }, + {"required":false, "id": "mushroomquest:shrump" }, + {"required":false, "id": "mushroomquest:bigmushroombunch" }, + {"required":false, "id": "mushroomquest:tinyfungibunch" }, + {"required":false, "id": "mushroomquest:greenglowshroom" }, + {"required":false, "id": "mushroomquest:magentaglowshroom" }, + {"required":false, "id": "mushroomquest:blueglowshroom" }, + {"required":false, "id": "bettermushrooms:big_mushroom" }, + {"required":false, "id": "bettermushrooms:glowing_mushroom" }, + {"required":false, "id": "bettermushrooms:champignon_food" }, + {"required":false, "id": "thebeginning:reko_shroom" }, + {"required":false, "id": "thebeginning:plana_shroom" }, + {"required":false, "id": "aoa3:blue_glowshroom" }, + {"required":false, "id": "aoa3:green_glowshroom" }, + {"required":false, "id": "aoa3:orange_glowshroom" }, + {"required":false, "id": "aoa3:purple_glowshroom" }, + {"required":false, "id": "aoa3:yellow_glowshroom" }, + {"required":false, "id": "mystic_plants:nausea_mushroom" }, + {"required":false, "id": "gaiadimension:missingno_fungus" }, + {"required":false, "id": "gaiadimension:gold_orb_tucher" }, + {"required":false, "id": "gaiadimension:elder_imklia" }, + {"required":false, "id": "gaiadimension:corrupted_gaia_eye" }, + {"required":false, "id": "gaiadimension:mystical_murgni" }, + {"required":false, "id": "gaiadimension:stickly_cupsir" }, + {"required":false, "id": "gaiadimension:bulbous_hobina" }, + {"required":false, "id": "gaiadimension:roofed_agaric" }, + {"required":false, "id": "gaiadimension:thorny_wiltha" }, + {"required":false, "id": "gaiadimension:spotted_kersi" }, + {"required":false, "id": "byg:death_cap" }, + {"required":false, "id": "byg:fungal_imparius" }, + {"required":false, "id": "byg:imparius_mushroom" }, + {"required":false, "id": "byg:blue_glowshroom" }, + {"required":false, "id": "byg:purple_glowshroom" }, + {"required":false, "id": "byg:green_mushroom" }, + {"required":false, "id": "byg:soul_shroom" }, + {"required":false, "id": "byg:soul_shroom_spore_end" }, + {"required":false, "id": "byg:black_puff" }, + {"required":false, "id": "byg:wood_blewit" }, + {"required":false, "id": "byg:weeping_milkcap" }, + {"required":false, "id": "byg:shulkren_fungus" }, + {"required":false, "id": "byg:sythian_fungus" }, + {"required":false, "id": "quark:glowshroom" }, + {"required":false, "id": "tconstruct:blood_slime_sapling" }, + {"required":false, "id": "biomesoplenty:toadstool" }, + {"required":false, "id": "biomesoplenty:glowshroom" }, + {"required":false, "id": "botania:white_mushroom" }, + {"required":false, "id": "botania:orange_mushroom" }, + {"required":false, "id": "botania:pink_mushroom" }, + {"required":false, "id": "botania:cyan_mushroom" }, + {"required":false, "id": "botania:yellow_mushroom" }, + {"required":false, "id": "botania:lime_mushroom" }, + {"required":false, "id": "botania:light_blue_mushroom" }, + {"required":false, "id": "botania:magenta_mushroom" }, + {"required":false, "id": "botania:gray_mushroom" }, + {"required":false, "id": "botania:light_gray_mushroom" }, + {"required":false, "id": "botania:cyan_mushroom" }, + {"required":false, "id": "botania:purple_mushroom" }, + {"required":false, "id": "botania:blue_mushroom" }, + {"required":false, "id": "botania:brown_mushroom" }, + {"required":false, "id": "botania:green_mushroom" }, + {"required":false, "id": "botania:red_mushroom" } + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/sandstone.json b/src/main/resources/data/forge/tags/items/sandstone.json new file mode 100644 index 000000000..1c1719163 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/sandstone.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "minecraft:cut_sandstone", + "minecraft:chiseled_sandstone", + "minecraft:sandstone" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/vines.json b/src/main/resources/data/forge/tags/items/vines.json new file mode 100644 index 000000000..11295d61d --- /dev/null +++ b/src/main/resources/data/forge/tags/items/vines.json @@ -0,0 +1,24 @@ +{ + "replace": false, + "values": [ + "minecraft:vine", + "minecraft:weeping_vines", + "minecraft:twisting_vines", + {"required":false, "id": "tconstruct:sky_slime_vine" }, + {"required":false, "id": "tconstruct:ender_slime_vine" }, + {"required":false, "id": "biomesoplenty:willow_vine" }, + {"required":false, "id": "biomesoplenty:spanish_moss" }, + {"required":false, "id": "quark:root" }, + {"required":false, "id": "byg:skyris_vine" }, + {"required":false, "id": "byg:poison_ivy" }, + {"required":false, "id": "byg:lament_vine" }, + {"required":false, "id": "byg:lament_vine_plant" }, + {"required":false, "id": "byg:imparius_vine" }, + {"required":false, "id": "byg:imparius_vine_plant" }, + {"required":false, "id": "byg:shulkren_vine" }, + {"required":false, "id": "byg:shulkren_vine_plant" }, + {"required":false, "id": "byg:fungal_imparius_filament" }, + {"required":false, "id": "byg:whaling_vine" } + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/workbench.json b/src/main/resources/data/forge/tags/items/workbench.json new file mode 100644 index 000000000..3fb43c027 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/workbench.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "cyclic:workbench" + ] +} \ No newline at end of file diff --git a/update.json b/update.json index 2f4b754f1..bcac7ca28 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"Backport #2182 candle model assets. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions if possible #1913. Excavate enchant will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. Excavate enchant will not trigger on anything matching the new block tag [cyclic:ignored/excavate] #2116 " + ,"1.5.23":"New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } } From d5fe4f7d7b56f440d4bd48570f0ac8072b97f1ae Mon Sep 17 00:00:00 2001 From: lothrazar Date: Wed, 3 Apr 2024 07:02:49 -0700 Subject: [PATCH 10/17] fix cables #2245 #2230 to match 1.18+ setup --- build.gradle | 4 +- .../lothrazar/cyclic/base/TileEntityBase.java | 6 +- .../cyclic/block/cable/CableBase.java | 2 +- .../cyclic/block/cable/TileCableBase.java | 15 +--- .../block/cable/energy/TileCableEnergy.java | 14 ++-- .../block/cable/fluid/TileCableFluid.java | 22 +++--- .../block/cable/item/ContainerCableItem.java | 2 - .../block/cable/item/ScreenCableItem.java | 28 ------- .../block/cable/item/TileCableItem.java | 74 ++++++++++--------- update.json | 2 +- 10 files changed, 68 insertions(+), 101 deletions(-) diff --git a/build.gradle b/build.gradle index fe2ca0f24..6e92681eb 100644 --- a/build.gradle +++ b/build.gradle @@ -96,7 +96,7 @@ dependencies { runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") // optional dependencies & mods for testing compat -/* + implementation fg.deobf("curse.maven:mantle-74924:3482897") implementation fg.deobf("curse.maven:tinkers-construct-74072:3482903") implementation fg.deobf("curse.maven:cucumber-272335:3507886") @@ -105,7 +105,7 @@ dependencies { implementation fg.deobf("curse.maven:yungs-api-421850:3494919") implementation fg.deobf("curse.maven:yungs-better-strongholds-465575:3412586") implementation fg.deobf("curse.maven:v-tweaks-238048:3675562") -*/ + // To use any mod in /libs/ folder, place it in and set the mod and version to match jar filename // runtimeOnly fg.deobf("libs:SimpleStorageNetwork:1.16.4-1.3.1") // runtimeOnly fg.deobf("libs:refinedstorage:1.16.4-1.9.11") diff --git a/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java b/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java index 03fda9b0c..58537fcdb 100644 --- a/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java +++ b/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java @@ -277,11 +277,7 @@ public void tryExtract(IItemHandler myself, Direction extractSide, int qty, Item if (qty <= 0) { return; } - final ItemStack stackInSlot = myself.getStackInSlot(0); - if (!stackInSlot.isEmpty()) { - return; - } - if (extractSide == null) { + if (myself == null || extractSide == null || !myself.getStackInSlot(0).isEmpty()) { return; } final BlockPos posTarget = pos.offset(extractSide); diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java b/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java index eb1a28716..1d4f8b540 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/CableBase.java @@ -214,7 +214,7 @@ else if (hitZ > 1 - hitLimit) { break; } if (world.getBlockState(pos).getBlock() == this && world.setBlockState(pos, newState)) { - updateConnection(world, pos, sideToToggle, newState.get(prop)); + // updateConnection(world, pos, sideToToggle, newState.get(prop)); if (updatePost) { newState.updatePostPlacement(sideToToggle, world.getBlockState(pos.offset(sideToToggle)), world, pos, pos.offset(sideToToggle)); } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/TileCableBase.java b/src/main/java/com/lothrazar/cyclic/block/cable/TileCableBase.java index f38d4e764..db99d5062 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/TileCableBase.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/TileCableBase.java @@ -1,15 +1,12 @@ package com.lothrazar.cyclic.block.cable; import com.lothrazar.cyclic.base.TileEntityBase; -import java.util.HashMap; -import java.util.Map; +import net.minecraft.state.EnumProperty; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; public abstract class TileCableBase extends TileEntityBase { - protected final Map connectTypeMap = new HashMap<>(); - public TileCableBase(TileEntityType tileEntityTypeIn) { super(tileEntityTypeIn); } @@ -21,13 +18,9 @@ public TileCableBase(TileEntityType tileEntityTypeIn) { public abstract int getField(int field); public EnumConnectType getConnectionType(final Direction side) { - if (connectTypeMap.containsKey(side)) { - return connectTypeMap.get(side); - } - return connectTypeMap.computeIfAbsent(side, k -> getBlockState().get(CableBase.FACING_TO_PROPERTY_MAP.get(k))); + EnumProperty property = CableBase.FACING_TO_PROPERTY_MAP.get(side); + return getBlockState().get(property); } - public void updateConnection(final Direction side, final EnumConnectType connectType) { - connectTypeMap.put(side, connectType); - } + public void updateConnection(final Direction side, final EnumConnectType connectType) {} } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/energy/TileCableEnergy.java b/src/main/java/com/lothrazar/cyclic/block/cable/energy/TileCableEnergy.java index 6d849d5be..943cc5a30 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/energy/TileCableEnergy.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/energy/TileCableEnergy.java @@ -27,7 +27,7 @@ public class TileCableEnergy extends TileCableBase implements ITickableTileEntit private static final int MAX = 32000; final CustomEnergyStorage energy = new CustomEnergyStorage(MAX, MAX); private final LazyOptional energyCap = LazyOptional.of(() -> energy); - private final ConcurrentHashMap> energyCapSides = new ConcurrentHashMap<>(); + private final ConcurrentHashMap> flow = new ConcurrentHashMap<>(); private final Map mapIncomingEnergy = Maps.newHashMap(); private int energyLastSynced = -1; //fluid tanks have 'onchanged', energy caps do not @@ -42,14 +42,14 @@ public TileCableEnergy() { public void updateConnection(final Direction side, final EnumConnectType connectType) { final EnumConnectType oldConnectType = getConnectionType(side); if (connectType == EnumConnectType.BLOCKED && oldConnectType != EnumConnectType.BLOCKED) { - final LazyOptional sidedCap = energyCapSides.get(side); + final LazyOptional sidedCap = flow.get(side); if (sidedCap != null) { sidedCap.invalidate(); - energyCapSides.remove(side); + flow.remove(side); } } else if (oldConnectType == EnumConnectType.BLOCKED && connectType != EnumConnectType.BLOCKED) { - energyCapSides.put(side, LazyOptional.of(() -> energy)); + flow.put(side, LazyOptional.of(() -> energy)); } super.updateConnection(side, connectType); } @@ -131,11 +131,11 @@ public LazyOptional getCapability(Capability cap, Direction side) { if (side == null) { return energyCap.cast(); } - LazyOptional sidedCap = energyCapSides.get(side); + LazyOptional sidedCap = flow.get(side); if (sidedCap == null) { if (getConnectionType(side) != EnumConnectType.BLOCKED) { sidedCap = LazyOptional.of(() -> energy); - energyCapSides.put(side, sidedCap); + flow.put(side, sidedCap); return sidedCap.cast(); } } @@ -149,7 +149,7 @@ public LazyOptional getCapability(Capability cap, Direction side) { @Override public void invalidateCaps() { energyCap.invalidate(); - for (final LazyOptional sidedCap : energyCapSides.values()) { + for (final LazyOptional sidedCap : flow.values()) { sidedCap.invalidate(); } super.invalidateCaps(); diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/fluid/TileCableFluid.java b/src/main/java/com/lothrazar/cyclic/block/cable/fluid/TileCableFluid.java index 4aad1d988..272930a5e 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/fluid/TileCableFluid.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/fluid/TileCableFluid.java @@ -17,6 +17,7 @@ import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.state.EnumProperty; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; @@ -44,7 +45,7 @@ public boolean isItemValid(int slot, ItemStack stack) { public static final int EXTRACT_RATE = CAPACITY; private final FluidTank fluidTank = new FluidTankBase(this, CAPACITY, fluidStack -> FilterCardItem.filterAllowsExtract(filter.getStackInSlot(0), fluidStack)); private final LazyOptional fluidCap = LazyOptional.of(() -> fluidTank); - private final ConcurrentHashMap> fluidCapSides = new ConcurrentHashMap<>(); + private final ConcurrentHashMap> flow = new ConcurrentHashMap<>(); public TileCableFluid() { super(TileRegistry.fluid_pipeTile); @@ -52,15 +53,16 @@ public TileCableFluid() { @Override public void updateConnection(final Direction side, final EnumConnectType connectType) { - final EnumConnectType oldConnectType = connectTypeMap.computeIfAbsent(side, k -> getBlockState().get(CableBase.FACING_TO_PROPERTY_MAP.get(k))); + EnumProperty property = CableBase.FACING_TO_PROPERTY_MAP.get(side); + final EnumConnectType oldConnectType = getBlockState().get(property); if (connectType == EnumConnectType.BLOCKED && oldConnectType != EnumConnectType.BLOCKED) { - fluidCapSides.computeIfPresent(side, (k, v) -> { + flow.computeIfPresent(side, (k, v) -> { v.invalidate(); return null; }); } else if (oldConnectType == EnumConnectType.BLOCKED && connectType != EnumConnectType.BLOCKED) { - fluidCapSides.put(side, LazyOptional.of(() -> fluidTank)); + flow.put(side, LazyOptional.of(() -> fluidTank)); } super.updateConnection(side, connectType); } @@ -94,11 +96,11 @@ private void tryExtract(Direction extractSide) { return; } //handle special cases - if (!fluidCapSides.containsKey(extractSide)) { + if (!flow.containsKey(extractSide)) { final LazyOptional hax = LazyOptional.of(() -> fluidTank); - fluidCapSides.put(extractSide, hax); + flow.put(extractSide, hax); } - IFluidHandler tank = fluidCapSides.get(extractSide).orElse(null); + IFluidHandler tank = flow.get(extractSide).orElse(null); if (fluidTank.getSpace() > -FluidAttributes.BUCKET_VOLUME) { UtilFluid.extractSourceWaterloggedCauldron(world, target, tank); } @@ -120,11 +122,11 @@ public LazyOptional getCapability(Capability cap, Direction side) { if (side == null) { return fluidCap.cast(); } - LazyOptional sidedCap = fluidCapSides.get(side); + LazyOptional sidedCap = flow.get(side); if (sidedCap == null) { if (getConnectionType(side) != EnumConnectType.BLOCKED) { sidedCap = LazyOptional.of(() -> fluidTank); - fluidCapSides.put(side, sidedCap); + flow.put(side, sidedCap); return sidedCap.cast(); } } @@ -153,7 +155,7 @@ public LazyOptional getCapability(Capability cap, Direction side) { @Override public void invalidateCaps() { fluidCap.invalidate(); - for (final LazyOptional sidedCap : fluidCapSides.values()) { + for (final LazyOptional sidedCap : flow.values()) { sidedCap.invalidate(); } super.invalidateCaps(); diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java b/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java index a615350a6..a58f60eb0 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/item/ContainerCableItem.java @@ -19,11 +19,9 @@ public ContainerCableItem(int windowId, World world, BlockPos pos, PlayerInvento tile = (TileCableItem) world.getTileEntity(pos); this.playerEntity = player; this.playerInventory = playerInventory; - // tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { this.endInv = tile.filter.getSlots(); //dont show 0 thats the actual thing in the slot addSlot(new SlotItemHandler(tile.filter, 0, 80, 29)); - // }); layoutPlayerInventorySlots(8, 84); this.trackEnergy(tile); } diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java b/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java index 5bfe821e3..731449475 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/item/ScreenCableItem.java @@ -10,39 +10,11 @@ public class ScreenCableItem extends ScreenBase { public ScreenCableItem(ContainerCableItem screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); - // fluid = new FluidBar(this, TileFluidCollect.CAPACITY); - // energy = new EnergyBar(this, TileFluidCollect.MAX); } @Override public void init() { super.init(); - // energy.guiLeft = fluid.guiLeft = guiLeft; - // energy.guiTop = fluid.guiTop = guiTop; - // energy.visible = TileFluidCollect.POWERCONF.get() > 0; - // int x, y; - // x = guiLeft + 8; - // y = guiTop + 8; - // btnRedstone = addButton(new ButtonMachineRedstone(x, y, TileFluidCollect.Fields.REDSTONE.ordinal(), container.tile.getPos())); - // btnRender = addButton(new ButtonMachineRedstone(x, y + 20, TileFluidCollect.Fields.RENDER.ordinal(), - // container.tile.getPos(), TextureEnum.RENDER_HIDE, TextureEnum.RENDER_SHOW, "gui.cyclic.render")); - // // - // // - // int w = 96; - // int h = 20; - // x = guiLeft + 32; - // y += h + 1; - // int f = TileFluidCollect.Fields.HEIGHT.ordinal(); - // GuiSliderInteger height = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), - // 0, TileFluidCollect.MAX_HEIGHT, container.tile.getField(f))); - // height.setTooltip("buildertype.height.tooltip"); - // y += h + 1; - // // - // // - // f = TileFluidCollect.Fields.SIZE.ordinal(); - // GuiSliderInteger size = this.addButton(new GuiSliderInteger(x, y, w, h, f, container.tile.getPos(), - // 0, TileMiner.MAX_SIZE, container.tile.getField(f))); - // size.setTooltip("buildertype.size.tooltip"); } @Override diff --git a/src/main/java/com/lothrazar/cyclic/block/cable/item/TileCableItem.java b/src/main/java/com/lothrazar/cyclic/block/cable/item/TileCableItem.java index 7a18fc578..440b06e54 100644 --- a/src/main/java/com/lothrazar/cyclic/block/cable/item/TileCableItem.java +++ b/src/main/java/com/lothrazar/cyclic/block/cable/item/TileCableItem.java @@ -1,8 +1,8 @@ package com.lothrazar.cyclic.block.cable.item; +import com.lothrazar.cyclic.block.cable.CableBase; import com.lothrazar.cyclic.block.cable.EnumConnectType; import com.lothrazar.cyclic.block.cable.TileCableBase; -import com.lothrazar.cyclic.item.datacard.filter.FilterCardItem; import com.lothrazar.cyclic.registry.ItemRegistry; import com.lothrazar.cyclic.registry.TileRegistry; import com.lothrazar.cyclic.util.UtilDirection; @@ -36,41 +36,44 @@ public boolean isItemValid(int slot, ItemStack stack) { return stack.getItem() == ItemRegistry.filter_data; } }; - private final IItemHandler itemHandler = new ItemStackHandler(1) { - - @Override - public boolean isItemValid(final int slot, final ItemStack stack) { - return FilterCardItem.filterAllowsExtract(filter.getStackInSlot(0), stack); - } - }; - private final LazyOptional itemCap = LazyOptional.of(() -> itemHandler); - private final ConcurrentHashMap> itemCapSides = new ConcurrentHashMap<>(); + private final ConcurrentHashMap> flow = new ConcurrentHashMap<>(); public TileCableItem() { super(TileRegistry.item_pipeTile); + for (Direction f : Direction.values()) { + flow.put(f, LazyOptional.of(TileCableItem::createHandler)); + } + } + + private static ItemStackHandler createHandler() { + return new ItemStackHandler(1); } @Override public void updateConnection(final Direction side, final EnumConnectType connectType) { final EnumConnectType oldConnectType = getConnectionType(side); if (connectType == EnumConnectType.BLOCKED && oldConnectType != EnumConnectType.BLOCKED) { - final LazyOptional sidedCap = itemCapSides.get(side); - if (sidedCap != null) { + final LazyOptional sidedCap = flow.get(side); + if (sidedCap != null) { //redundant safety? sidedCap.invalidate(); } } else if (oldConnectType == EnumConnectType.BLOCKED && connectType != EnumConnectType.BLOCKED) { - itemCapSides.put(side, LazyOptional.of(() -> itemHandler)); + flow.put(side, LazyOptional.of(TileCableItem::createHandler)); } super.updateConnection(side, connectType); } @Override public void tick() { + if (world.isRemote) { + return; + } for (final Direction extractSide : Direction.values()) { final EnumConnectType connection = getConnectionType(extractSide); if (connection.isExtraction()) { - tryExtract(itemHandler, extractSide, extractQty, filter); + final IItemHandler sideHandler = flow.get(extractSide).orElse(null); + tryExtract(sideHandler, extractSide, extractQty, filter); } } normalFlow(); @@ -80,6 +83,7 @@ private void normalFlow() { // Label for loop for shortcutting, used to continue after items have been moved incomingSideLoop: for (final Direction incomingSide : Direction.values()) { //in all cases sideHandler is required + final IItemHandler sideHandler = flow.get(incomingSide).orElse(null); for (final Direction outgoingSide : UtilDirection.getAllInDifferentOrder()) { if (outgoingSide == incomingSide) { continue; @@ -88,31 +92,20 @@ private void normalFlow() { if (outgoingConnection.isExtraction() || outgoingConnection.isBlocked()) { continue; } - if (this.moveItems(outgoingSide, FLOW_QTY, itemHandler)) { + if (this.moveItems(outgoingSide, FLOW_QTY, sideHandler)) { continue incomingSideLoop; //if items have been moved then change side } } //if no items have been moved then move items in from adjacent - this.moveItems(incomingSide, FLOW_QTY, itemHandler); + this.moveItems(incomingSide, FLOW_QTY, sideHandler); } } @Override public LazyOptional getCapability(Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - if (side == null) { - return itemCap.cast(); - } - LazyOptional sidedCap = itemCapSides.get(side); - if (sidedCap == null) { - if (getConnectionType(side) != EnumConnectType.BLOCKED) { - sidedCap = LazyOptional.of(() -> itemHandler); - itemCapSides.put(side, sidedCap); - return sidedCap.cast(); - } - } - else { - return sidedCap.cast(); + if (side != null && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (!CableBase.isCableBlocked(this.getBlockState(), side)) { + return flow.get(side).cast(); } } return super.getCapability(cap, side); @@ -121,8 +114,7 @@ public LazyOptional getCapability(Capability cap, Direction side) { @Override public void invalidateCaps() { super.invalidateCaps(); - itemCap.invalidate(); - for (final LazyOptional sidedCap : itemCapSides.values()) { + for (final LazyOptional sidedCap : flow.values()) { sidedCap.invalidate(); } } @@ -131,8 +123,15 @@ public void invalidateCaps() { @Override public void read(BlockState bs, CompoundNBT tag) { extractQty = tag.getInt("extractCount"); - ((INBTSerializable) itemHandler).deserializeNBT(tag.getCompound(NBTINV)); filter.deserializeNBT(tag.getCompound("filter")); + LazyOptional item; + for (Direction f : Direction.values()) { + item = flow.get(f); + item.ifPresent(h -> { + CompoundNBT itemTag = tag.getCompound("item" + f.toString()); + ((INBTSerializable) h).deserializeNBT(itemTag); + }); + } super.read(bs, tag); } @@ -141,7 +140,14 @@ public void read(BlockState bs, CompoundNBT tag) { public CompoundNBT write(CompoundNBT tag) { tag.put("filter", filter.serializeNBT()); tag.putInt("extractCount", extractQty); - tag.put(NBTINV, ((INBTSerializable) itemHandler).serializeNBT()); + LazyOptional item; + for (Direction f : Direction.values()) { + item = flow.get(f); + item.ifPresent(h -> { + CompoundNBT compound = ((INBTSerializable) h).serializeNBT(); + tag.put("item" + f.toString(), compound); + }); + } return super.write(tag); } diff --git a/update.json b/update.json index bcac7ca28..b3feb8e86 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " + ,"1.5.23":"Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } } From 20bfb6edcfe5bab7c17ab7d525a5ea022a406e9c Mon Sep 17 00:00:00 2001 From: lothrazar Date: Wed, 3 Apr 2024 21:42:34 -0700 Subject: [PATCH 11/17] Fix Soundproofing block not muting Mekanism sounds #2389 --- build.gradle | 1 + examples/config/cyclic.toml | 10 +++++-- .../block/soundmuff/SoundmufflerBlock.java | 29 +++++++++++-------- .../cyclic/config/ConfigRegistry.java | 4 +++ .../resources/assets/cyclic/lang/en_us.json | 2 +- update.json | 2 +- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 6e92681eb..0954c7173 100644 --- a/build.gradle +++ b/build.gradle @@ -105,6 +105,7 @@ dependencies { implementation fg.deobf("curse.maven:yungs-api-421850:3494919") implementation fg.deobf("curse.maven:yungs-better-strongholds-465575:3412586") implementation fg.deobf("curse.maven:v-tweaks-238048:3675562") + implementation fg.deobf("curse.maven:mekanism-268560:3659389") // To use any mod in /libs/ folder, place it in and set the mod and version to match jar filename // runtimeOnly fg.deobf("libs:SimpleStorageNetwork:1.16.4-1.3.1") diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index 857fbbbf6..ae6b55963 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -159,12 +159,18 @@ #Range: 1 ~ 32 radius = 12 + #soundproofing settings + [cyclic.blocks.soundproofing] + #Radius of sound proofing (distance from each block that it will listen) + #Range: 1 ~ 16 + radius = 6 + ##################################################################################### # Logging related configs ##################################################################################### [cyclic.logging] #Unblock info logs; very spammy; can be useful for testing certain issues - info = false + info = true ##################################################################################### #Fluid cost for various machines @@ -393,7 +399,7 @@ [cyclic.energy] ##################################################################################### - #Energy cost for various machines, either per use of an action or per tick (twenty ticks per second). + #Energy cost for various machines, either per use of an action or per tick (twenty ticks per second). Setting as zero (0) lets machine run for free ##################################################################################### [cyclic.energy.cost] #Power per use disenchanter diff --git a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java index babed8c48..0e08c6e5f 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java @@ -2,12 +2,12 @@ import com.lothrazar.cyclic.ModCyclic; import com.lothrazar.cyclic.base.BlockBase; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.util.UtilBlockstates; import java.util.List; import net.minecraft.block.SoundType; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; -import net.minecraft.client.audio.ITickableSound; import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; @@ -18,8 +18,7 @@ public class SoundmufflerBlock extends BlockBase { - private static final int VOL_REDUCE_PER_BLOCK = 2; - private static final int RADIUS = 6; + public static final int VOL_REDUCE_PER_BLOCK = 2; public SoundmufflerBlock(Properties properties) { super(properties.hardnessAndResistance(1F).sound(SoundType.SCAFFOLDING)); @@ -30,26 +29,32 @@ public SoundmufflerBlock(Properties properties) { @SubscribeEvent public void onPlaySound(PlaySoundEvent event) { ClientWorld clientWorld = Minecraft.getInstance().world; - if (event.getResultSound() == null || event.getResultSound() instanceof ITickableSound || clientWorld == null) { + if (event.getResultSound() == null || clientWorld == null) { return; - } //long term/repeating/music + } ISound sound = event.getResultSound(); - List blocks = UtilBlockstates.findBlocks(clientWorld, new BlockPos(sound.getX(), sound.getY(), sound.getZ()), this, RADIUS); + List blocks = UtilBlockstates.findBlocks(clientWorld, new BlockPos(sound.getX(), sound.getY(), sound.getZ()), this, ConfigRegistry.SOUND_RADIUS.get()); if (blocks == null || blocks.size() == 0) { return; } + float reduce = VOL_REDUCE_PER_BLOCK; + float radius = ConfigRegistry.SOUND_RADIUS.get(); + //the number of nearby blocks informs how much we muffle the sound by + //at 6 blocks, it caps off the reduction + float volume = (float) (Math.min(reduce / radius, 1.0) / blocks.size()); + rebuildSoundWithVolume(event, sound, volume); + } + + private static void rebuildSoundWithVolume(PlaySoundEvent event, ISound sound, float volume) { try { //WARNING": DO NOT USE getVolume anywhere here it just crashes - //we do use it inside the sound class, but the engine callss tat later on, and our factor is tacked in + //we do use it inside the sound class, but the engine calls tat later on, and our factor is tacked in SoundVolumeControlled newSound = new SoundVolumeControlled(sound); - //the number of nearby blocks informs how much we muffle the sound by - float pct = (VOL_REDUCE_PER_BLOCK) / 6F; - //at 6 blocks, it caps off the reduction - newSound.setVolume((float) (Math.min(pct, 1.0) / blocks.size())); + newSound.setVolume(volume); event.setResultSound(newSound); } catch (Exception e) { - ModCyclic.LOGGER.error("Error trying to detect volume of sound from 3rd party ", e); + ModCyclic.LOGGER.error("Error trying to replace volume of sound ", e); } } } diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index b28a5f4ca..3526b93f5 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -97,6 +97,7 @@ public class ConfigRegistry { private static ForgeConfigSpec CLIENT_CONFIG; public static IntValue PEATERICHPOWER; public static IntValue PEATPOWER; + public static IntValue SOUND_RADIUS; public static DoubleValue PEATCHANCE; public static BooleanValue COMMANDDEV; public static BooleanValue COMMANDGETHOME; @@ -397,6 +398,9 @@ private static void initConfig() { EnderShelfItemHandler.BOOKS_PER_ROW = CFG.comment("Each shelf has five rows. Set the number of books stored per row here").defineInRange("books_per_row", 64, 1, 64); EnderShelfHelper.MAX_DIST = CFG.comment("Controller Max distance to search (using manhattan distance)").defineInRange("controller_distance", 64, 1, 256); CFG.pop(); // ender_shelf*6 + CFG.comment("soundproofing settings").push("soundproofing"); //soundproofing + SOUND_RADIUS = CFG.comment("Radius of sound proofing (distance from each block that it will listen)").defineInRange("radius", 6, 1, 16); + CFG.pop(); //soundproofing CFG.comment("Sprinkler settings").push("sprinkler"); TileSprinkler.RADIUS = CFG.comment("Radius").defineInRange("radius", 4, 1, 32); TileSprinkler.WATERCOST = CFG.comment("Water consumption").defineInRange("water", 5, 0, 1000); diff --git a/src/main/resources/assets/cyclic/lang/en_us.json b/src/main/resources/assets/cyclic/lang/en_us.json index 24fe1eee8..039397b95 100644 --- a/src/main/resources/assets/cyclic/lang/en_us.json +++ b/src/main/resources/assets/cyclic/lang/en_us.json @@ -274,7 +274,7 @@ "block.cyclic.soundproofing_ghost.guide": "Prevents sound, and copies a block appearance. Use block on it to copy appearance", "block.cyclic.soundproofing_ghost.tooltip": "Use block on it to copy appearance", "block.cyclic.soundproofing": "Soundproofing", - "block.cyclic.soundproofing.tooltip": "Each block reduces sound volume nearby", + "block.cyclic.soundproofing.tooltip": "Each block muffles sound volume nearby", "block.cyclic.soundproofing.guide": "Place to reduce the volume of nearby sounds in the world. Multiple can be placed in close proximity for a stronger effect.", "block.cyclic.fan": "Fan", "block.cyclic.fan.tooltip": "Pushes entities", diff --git a/update.json b/update.json index b3feb8e86..cd2513d34 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " + ,"1.5.23":"Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } } From fc6f09549a73ba6b712e6b56ee88877b68dcdefd Mon Sep 17 00:00:00 2001 From: lothrazar Date: Wed, 3 Apr 2024 21:51:32 -0700 Subject: [PATCH 12/17] gloomIgnore config added --- examples/config/cyclic.toml | 36 ++++++++++--------- scripts/clean_config.sh | 6 ++++ scripts/example_config.sh | 4 +++ .../cyclic/config/ConfigRegistry.java | 11 +++++- .../cyclic/enchant/EnchantGloom.java | 7 ++++ update.json | 2 +- 6 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 scripts/clean_config.sh create mode 100644 scripts/example_config.sh diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index ae6b55963..d05d35945 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -15,17 +15,26 @@ growthRadius = 2 #Set false to disable enchantment reach = true - #Enchant level increase drop rate. % = beheadingDrop + (level-1)*beheadingPerLevel - #Range: 1 ~ 100 - beheadingPerLevel = 25 #Set false to disable enchantment beekeeper = true #Set false to disable enchantment experience_boost = true - #Set false to disable Multi Jump enchantment - launch = true #Set false to disable enchantment ender = true + #Beheading enchant add player skin head drop, add any mob id and any skin + beheadingEntityMHF = ["minecraft:blaze:MHF_Blaze", "minecraft:cat:MHF_Ocelot", "minecraft:cave_spider:MHF_CaveSpider", "minecraft:chicken:MHF_Chicken", "minecraft:cow:MHF_Cow", "minecraft:enderman:MHF_Enderman", "minecraft:ghast:MHF_Ghast", "minecraft:iron_golem:MHF_Golem", "minecraft:magma_cube:MHF_LavaSlime", "minecraft:mooshroom:MHF_MushroomCow", "minecraft:ocelot:MHF_Ocelot", "minecraft:pig:MHF_Pig", "minecraft:zombie_pigman:MHF_PigZombie", "minecraft:sheep:MHF_Sheep", "minecraft:slime:MHF_Slime", "minecraft:spider:MHF_Spider", "minecraft:squid:MHF_Squid", "minecraft:villager:MHF_Villager", "minecraft:witch:MHF_Witch", "minecraft:wolf:MHF_Wolf", "minecraft:guardian:MHF_Guardian", "minecraft:elder_guardian:MHF_Guardian", "minecraft:snow_golem:MHF_SnowGolem", "minecraft:silverfish:MHF_Silverfish", "minecraft:endermite:MHF_Endermite"] + #Set false to disable enchantment + venom = true + #Set false to disable enchantment + auto_smelt = true + #Initial level drop rate. So level I of enchant gives this % drop chance + #Range: 1 ~ 100 + beheadingDrop = 20 + #Enchant level increase drop rate. % = beheadingDrop + (level-1)*beheadingPerLevel + #Range: 1 ~ 100 + beheadingPerLevel = 25 + #Set false to disable Multi Jump enchantment + launch = true #Enchant level drop rate. % = drop + (level-1)*drop #Range: 1 ~ 100 disarmPercentPerLevel = 15 @@ -35,31 +44,24 @@ excavate = true #Set false to disable enchantment magnet = true - #Beheading enchant add player skin head drop, add any mob id and any skin - beheadingEntityMHF = ["minecraft:blaze:MHF_Blaze", "minecraft:cat:MHF_Ocelot", "minecraft:cave_spider:MHF_CaveSpider", "minecraft:chicken:MHF_Chicken", "minecraft:cow:MHF_Cow", "minecraft:enderman:MHF_Enderman", "minecraft:ghast:MHF_Ghast", "minecraft:iron_golem:MHF_Golem", "minecraft:magma_cube:MHF_LavaSlime", "minecraft:mooshroom:MHF_MushroomCow", "minecraft:ocelot:MHF_Ocelot", "minecraft:pig:MHF_Pig", "minecraft:zombie_pigman:MHF_PigZombie", "minecraft:sheep:MHF_Sheep", "minecraft:slime:MHF_Slime", "minecraft:spider:MHF_Spider", "minecraft:squid:MHF_Squid", "minecraft:villager:MHF_Villager", "minecraft:witch:MHF_Witch", "minecraft:wolf:MHF_Wolf", "minecraft:guardian:MHF_Guardian", "minecraft:elder_guardian:MHF_Guardian", "minecraft:snow_golem:MHF_SnowGolem", "minecraft:silverfish:MHF_Silverfish", "minecraft:endermite:MHF_Endermite"] #Set false to disable enchantment multishot = true #Set false to disable enchantment beheading = true + #Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these + gloomIgnored = ["minecraft:bad_omen", "minecraft:nausea", "botania:clear"] #Set false to disable enchantment quickshot = true #Mobs in this list cannot be disarmed and have their weapon stolen by the disarm enchantment disarmIngoredMobs = ["alexsmobs:mimicube"] #Set false to disable enchantment - venom = true - #Set false to disable enchantment life_leech = true - #Set false to disable enchantment + #Set false to disable gloom enchantment curse = true #Set false to disable enchantment - auto_smelt = true - #Set false to disable enchantment growth = true #Set false to disable enchantment step = true - #Initial level drop rate. So level I of enchant gives this % drop chance - #Range: 1 ~ 100 - beheadingDrop = 20 ##################################################################################### # Worldgen settings @@ -170,7 +172,7 @@ ##################################################################################### [cyclic.logging] #Unblock info logs; very spammy; can be useful for testing certain issues - info = true + info = false ##################################################################################### #Fluid cost for various machines @@ -446,7 +448,7 @@ crafter = 500 #Power per use user #Range: 0 ~ 64000 - user = 50 + user = 0 #Power per recipe solidifier #Range: 0 ~ 64000 solidifier = 5000 diff --git a/scripts/clean_config.sh b/scripts/clean_config.sh new file mode 100644 index 000000000..fb8a1e434 --- /dev/null +++ b/scripts/clean_config.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +rm run/config/cyclic.toml +rm run/config/cyclic-client.toml + +echo "configs reset" diff --git a/scripts/example_config.sh b/scripts/example_config.sh new file mode 100644 index 000000000..23ecdd889 --- /dev/null +++ b/scripts/example_config.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cp run/config/cyclic.toml examples/config/cyclic.toml +cp run/config/cyclic-client.toml examples/config/cyclic-client.toml diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 3526b93f5..383426d41 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -111,6 +111,7 @@ public class ConfigRegistry { private static ConfigValue> BEHEADING_SKINS; private static ConfigValue> MBALL_IGNORE_LIST; private static ConfigValue> DISARM_IGNORE_LIST; + public static ConfigValue> GLOOM_IGNORE_LIST; public static BooleanValue CYAN_GENERATES; public static IntValue CHARM_LUCK; public static DoubleValue CHARM_SPEED; @@ -204,7 +205,10 @@ private static void initConfig() { EnchantAutoSmelt.CFG = CFG.comment("Set false to disable enchantment").define(EnchantAutoSmelt.ID, true); EnchantBeekeeper.CFG = CFG.comment("Set false to disable enchantment").define(EnchantBeekeeper.ID, true); EnchantBeheading.CFG = CFG.comment("Set false to disable enchantment").define(EnchantBeheading.ID, true); - EnchantGloom.CFG = CFG.comment("Set false to disable enchantment").define(EnchantGloom.ID, true); + GLOOM_IGNORE_LIST = CFG.comment("Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these") + .defineList("gloomIgnored", Arrays.asList("minecraft:bad_omen", "minecraft:nausea", "botania:clear"), + it -> it instanceof String); + EnchantGloom.CFG = CFG.comment("Set false to disable gloom enchantment").define(EnchantGloom.ID, true); EnchantDisarm.CFG = CFG.comment("Set false to disable enchantment").define(EnchantDisarm.ID, true); EnchantDisarm.PERCENTPERLEVEL = CFG.comment("Enchant level drop rate. % = drop + (level-1)*drop").defineInRange(EnchantDisarm.ID + "PercentPerLevel", 15, 1, 100); DISARM_IGNORE_LIST = CFG.comment("Mobs in this list cannot be disarmed and have their weapon stolen by the disarm enchantment") @@ -511,6 +515,11 @@ public static List getDisarmIgnoreList() { return (List) DISARM_IGNORE_LIST.get(); } + @SuppressWarnings("unchecked") + public static List getGloomIgnoreList() { + return (List) GLOOM_IGNORE_LIST.get(); + } + public static Map getMappedBeheading() { Map mappedBeheading = new HashMap(); for (String s : BEHEADING_SKINS.get()) { diff --git a/src/main/java/com/lothrazar/cyclic/enchant/EnchantGloom.java b/src/main/java/com/lothrazar/cyclic/enchant/EnchantGloom.java index 9af528b31..0d7451e5f 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/EnchantGloom.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/EnchantGloom.java @@ -1,8 +1,11 @@ package com.lothrazar.cyclic.enchant; +import com.lothrazar.cyclic.ModCyclic; import com.lothrazar.cyclic.base.EnchantBase; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.util.UtilEnchant; import com.lothrazar.cyclic.util.UtilFakePlayer; +import com.lothrazar.cyclic.util.UtilString; import java.util.Collections; import java.util.List; import net.minecraft.enchantment.EnchantmentType; @@ -65,6 +68,10 @@ public void onUserHurt(LivingEntity user, Entity attacker, int level) { continue; //should be impossible, but i had a random NPE crash log } + if (UtilString.isInList(ConfigRegistry.getGloomIgnoreList(), effect.getRegistryName())) { + ModCyclic.LOGGER.info("Gloom(curse) effect cannot apply " + effect.getRegistryName()); + continue; + } if (appliedEffects < MIN_EFFECTS || BASE_APPLY_CHANCE > user.world.rand.nextDouble()) { //the OR means, if we are under minimum, always go thru diff --git a/update.json b/update.json index cd2513d34..3d4510005 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " + ,"1.5.23":"New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } } From 25af3f6b09b9c27f6d1998588cb141e83194da48 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Thu, 4 Apr 2024 20:31:20 -0700 Subject: [PATCH 13/17] terra growth system refactor shared and new configs added --- examples/config/cyclic.toml | 80 ++++++++++++------- .../cyclic/block/apple/AppleCropBlock.java | 2 +- .../cyclic/block/sprinkler/TileSprinkler.java | 8 +- .../block/terraglass/TileTerraGlass.java | 18 ++--- .../block/terrasoil/TileTerraPreta.java | 55 +++---------- .../cyclic/config/ConfigRegistry.java | 12 ++- .../cyclic/enchant/EnchantGrowth.java | 52 ++---------- .../cyclic/registry/TileRegistry.java | 2 +- .../com/lothrazar/cyclic/util/GrowthUtil.java | 73 +++++++++++++++++ .../minecraft/tags/blocks/crops.json.disabled | 6 ++ update.json | 2 +- 11 files changed, 169 insertions(+), 141 deletions(-) create mode 100644 src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java create mode 100644 src/main/resources/data/minecraft/tags/blocks/crops.json.disabled diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index d05d35945..4eedae6c9 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -77,15 +77,6 @@ # Allows the dimensional Transfer Nodes to cross dimensions (no chunk loading is done, you have to do that on your own); This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; If you change it to false it will only work if the target is in the same dimension. wireless_transfer_dimensional = true - #Ender shelf settings - [cyclic.blocks.ender_shelf] - #Controller Max distance to search (using manhattan distance) - #Range: 1 ~ 256 - controller_distance = 64 - #Each shelf has five rows. Set the number of books stored per row here - #Range: 1 ~ 64 - books_per_row = 64 - #Ender Anchor settings [cyclic.blocks.eye_teleport] #Maximum distance to activate @@ -101,6 +92,45 @@ #Range: 1 ~ 20 frequency = 5 + #Ender shelf settings + [cyclic.blocks.sound] + #Sound Recorder - how far out does it listen to record sounds + #Range: 1 ~ 64 + radius = 8 + + #battery settings + [cyclic.blocks.battery] + #RF/t charging rate for the battery item slot + #Range: 1 ~ 6400000 + charge = 8000 + + #fisher settings + [cyclic.blocks.fisher] + #Chance to Fish from nearby water. Smaller values is slower fish + #Range: 1.0E-5 ~ 0.999 + chance = 0.1 + #Radius to Fish from nearby water + #Range: 1 ~ 32 + radius = 12 + + #Ender shelf settings + [cyclic.blocks.ender_shelf] + #Controller Max distance to search (using manhattan distance) + #Range: 1 ~ 256 + controller_distance = 64 + #Each shelf has five rows. Set the number of books stored per row here + #Range: 1 ~ 64 + books_per_row = 64 + + #terra_preta settings + [cyclic.blocks.terra_preta] + #ticks between growth cycles + #Range: 1 ~ 10000 + timer = 100 + #growth height above the soil + #Range: 2 ~ 32 + height = 8 + #Uncrafter settings [cyclic.blocks.uncrafter] #False will mean you cannot uncraft damaged repairable items. When searching for a recipe, does it ignore all NBT values (such as enchantments, RepairCost, Damage, etc). For example, if false it will not uncraft damaged or enchanted items @@ -113,12 +143,6 @@ #RECIPE IDS HERE. Block these recipe ids from being reversed, but do not block all recipes for this output item ignore_recipes = ["botania:cobweb", "minecraft:magma_cream", "minecraft:beacon", "minecraft:stick_from_bamboo_item", "minecraft:netherite_ingot_from_netherite_block", "mysticalagriculture:essence*", "mysticalagriculture:farmland_till", "refinedstorage:coloring_recipes*", "forcecraft:transmutation*"] - #Ender shelf settings - [cyclic.blocks.sound] - #Sound Recorder - how far out does it listen to record sounds - #Range: 1 ~ 64 - radius = 8 - #Ender Trigger settings [cyclic.blocks.eye_redstone] #Maximum distance to activate @@ -128,12 +152,6 @@ #Range: 1 ~ 20 frequency = 5 - #battery settings - [cyclic.blocks.battery] - #RF/t charging rate for the battery item slot - #Range: 1 ~ 6400000 - charge = 8000 - #Sprinkler settings [cyclic.blocks.sprinkler] #Tick rate. 20 will fire one block per second @@ -146,21 +164,21 @@ #Range: 0 ~ 1000 water = 5 + #terra_glass settings + [cyclic.blocks.terra_glass] + #ticks between growth cycles + #Range: 1 ~ 10000 + timer = 100 + #growth height below the glass + #Range: 0 ~ 32 + height = 8 + #experience_pylon settings [cyclic.blocks.experience_pylon] #Radius to pickup xp orbs #Range: 1 ~ 64 radius = 16 - #fisher settings - [cyclic.blocks.fisher] - #Chance to Fish from nearby water. Smaller values is slower fish - #Range: 1.0E-5 ~ 0.999 - chance = 0.1 - #Radius to Fish from nearby water - #Range: 1 ~ 32 - radius = 12 - #soundproofing settings [cyclic.blocks.soundproofing] #Radius of sound proofing (distance from each block that it will listen) @@ -172,7 +190,7 @@ ##################################################################################### [cyclic.logging] #Unblock info logs; very spammy; can be useful for testing certain issues - info = false + info = true ##################################################################################### #Fluid cost for various machines diff --git a/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java b/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java index 909460cfd..6c6c8b381 100644 --- a/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/apple/AppleCropBlock.java @@ -78,7 +78,7 @@ public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { int age = state.get(AGE); if (age < MAX_AGE && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, worldIn.rand.nextInt(5) == 0)) { - worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(age + 1)), 2); + this.grow(worldIn, random, pos, state); ForgeHooks.onCropsGrowPost(worldIn, pos, state); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java b/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java index 28d4383d5..88d524661 100644 --- a/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java +++ b/src/main/java/com/lothrazar/cyclic/block/sprinkler/TileSprinkler.java @@ -2,8 +2,8 @@ import com.lothrazar.cyclic.base.FluidTankBase; import com.lothrazar.cyclic.base.TileEntityBase; -import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.registry.TileRegistry; +import com.lothrazar.cyclic.util.GrowthUtil; import com.lothrazar.cyclic.util.UtilFluid; import com.lothrazar.cyclic.util.UtilParticle; import com.lothrazar.cyclic.util.UtilShape; @@ -56,14 +56,14 @@ public void tick() { if (shapeIndex >= shape.size()) { shapeIndex = 0; } - if (world.isRemote && TileTerraPreta.isValidGrow(world, shape.get(shapeIndex))) { + if (world.isRemote && GrowthUtil.isValidGrow(world, shape.get(shapeIndex))) { UtilParticle.spawnParticle(world, ParticleTypes.FALLING_WATER, shape.get(shapeIndex), 9); } - if (TileTerraPreta.grow(world, shape.get(shapeIndex), 1)) { + if (GrowthUtil.tryGrow(world, shape.get(shapeIndex), 1)) { //it worked so pay tank.drain(WATERCOST.get(), FluidAction.EXECUTE); //run it again since sprinkler costs fluid and therefore should double what the glass and soil do - TileTerraPreta.grow(world, shape.get(shapeIndex), 1); + GrowthUtil.tryGrow(world, shape.get(shapeIndex), 1); } } diff --git a/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java b/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java index 83e29882a..479fc179a 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java +++ b/src/main/java/com/lothrazar/cyclic/block/terraglass/TileTerraGlass.java @@ -2,20 +2,21 @@ import com.lothrazar.cyclic.base.BlockBase; import com.lothrazar.cyclic.base.TileEntityBase; -import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.registry.TileRegistry; +import com.lothrazar.cyclic.util.GrowthUtil; import net.minecraft.block.BlockState; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; public class TileTerraGlass extends TileEntityBase implements ITickableTileEntity { - private static final int TIMER_FULL = TileTerraPreta.TIMER_FULL / 2; - private static final int DISTANCE = TileTerraPreta.HEIGHT / 2; + public static IntValue TIMER_FULL; + public static IntValue HEIGHT; public TileTerraGlass() { - super(TileRegistry.TERRAGLASS.get()); + super(TileRegistry.TERRA_GLASS.get()); } @Override @@ -28,7 +29,7 @@ public void tick() { if (timer > 0) { return; } - timer = TIMER_FULL; + timer = TIMER_FULL.get(); boolean lit = this.getBlockState().get(BlockBase.LIT); boolean newLit = canBlockSeeSky(world, pos); if (lit != newLit) { @@ -38,9 +39,9 @@ public void tick() { if (!newLit) { return; } - for (int h = 0; h < DISTANCE; h++) { + for (int h = 0; h < HEIGHT.get(); h++) { BlockPos current = pos.down(h); - TileTerraPreta.grow(world, current, 0.25); + GrowthUtil.tryGrow(world, current, 0.25); } } @@ -48,8 +49,6 @@ private boolean canBlockSeeSky(World world, BlockPos pos) { if (world.canSeeSky(pos)) { return true; } - // world.isOutsideBuildHeight(pos) - // else { for (BlockPos blockpos1 = pos.up(); blockpos1.getY() < 256; blockpos1 = blockpos1.up()) { if (World.isYOutOfBounds(blockpos1.getY())) { continue; @@ -61,7 +60,6 @@ private boolean canBlockSeeSky(World world, BlockPos pos) { } } return true; - // } } @Override diff --git a/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java b/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java index 40b6c102c..65556b030 100644 --- a/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java +++ b/src/main/java/com/lothrazar/cyclic/block/terrasoil/TileTerraPreta.java @@ -2,19 +2,17 @@ import com.lothrazar.cyclic.base.TileEntityBase; import com.lothrazar.cyclic.registry.TileRegistry; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.IGrowable; -import net.minecraft.tags.BlockTags; +import com.lothrazar.cyclic.util.GrowthUtil; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; public class TileTerraPreta extends TileEntityBase implements ITickableTileEntity { - public static final int TIMER_FULL = 100; - public static final int HEIGHT = 16; + public static final double ODDS_DEFAULT = 0.5; + //see: [cyclic.blocks.terra_preta] + public static IntValue TIMER_FULL; + public static IntValue HEIGHT; public TileTerraPreta() { super(TileRegistry.terra_preta); @@ -27,48 +25,13 @@ public void tick() { if (timer > 0) { return; } - timer = TIMER_FULL; - for (int h = 0; h < HEIGHT; h++) { + timer = TIMER_FULL.get(); + for (int h = 0; h < HEIGHT.get(); h++) { BlockPos current = this.getPos().up(h); - grow(world, current, 0.5); + GrowthUtil.tryGrow(world, current, ODDS_DEFAULT); } } - @SuppressWarnings("deprecation") - public static boolean grow(World world, BlockPos current, double d) { - if (!isValidGrow(world, current)) { - return false; - } - BlockState bState = world.getBlockState(current); - Block block = bState.getBlock(); - if (world instanceof ServerWorld) { - try { - ServerWorld sw = (ServerWorld) world; - if (d >= 1 || world.rand.nextDouble() < d) { - block.randomTick(bState, sw, current, world.rand); - block.randomTick(bState, sw, current, world.rand); - block.randomTick(bState, sw, current, world.rand); - } - } - catch (Exception e) { - return false; - } - } - return true; - } - - public static boolean isValidGrow(World world, BlockPos current) { - BlockState bState = world.getBlockState(current); - if (bState.getBlock() instanceof IGrowable) { - IGrowable crop = ((IGrowable) bState.getBlock()); - if (!crop.canGrow(world, current, bState, world.isRemote) || !crop.canUseBonemeal(world, world.rand, current, bState)) { - return false; //cant grow, or cant bonemeal. no - } - } - //check tags - return bState.isIn(BlockTags.CROPS) || bState.isIn(BlockTags.SAPLINGS); - } - @Override public void setField(int field, int value) {} diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 383426d41..e934fa347 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -30,6 +30,8 @@ import com.lothrazar.cyclic.block.solidifier.TileSolidifier; import com.lothrazar.cyclic.block.soundrecord.BlockSoundRecorder; import com.lothrazar.cyclic.block.sprinkler.TileSprinkler; +import com.lothrazar.cyclic.block.terraglass.TileTerraGlass; +import com.lothrazar.cyclic.block.terrasoil.TileTerraPreta; import com.lothrazar.cyclic.block.uncrafter.TileUncraft; import com.lothrazar.cyclic.block.user.TileUser; import com.lothrazar.cyclic.enchant.EnchantAutoSmelt; @@ -232,7 +234,7 @@ private static void initConfig() { it -> it instanceof String); EnchantBeheading.PERCENTDROP = CFG.comment("Initial level drop rate. So level I of enchant gives this % drop chance").defineInRange("beheadingDrop", 20, 1, 100); EnchantBeheading.PERCENTPERLEVEL = CFG.comment("Enchant level increase drop rate. % = beheadingDrop + (level-1)*beheadingPerLevel").defineInRange("beheadingPerLevel", 25, 1, 100); - EnchantGrowth.RADIUSFACTOR = CFG.comment("Radius per level. size around player to perform growth logic").defineInRange("growthRadius", 2, 1, 16); + EnchantGrowth.RADIUSFACTOR = CFG.comment("Radius per level. size around player to perform growth logic").defineInRange("growthRadius", 6, 1, 16); CFG.pop(); //enchantment CFG.comment(WALL, " Worldgen settings ", WALL) .push("worldgen"); @@ -410,6 +412,14 @@ private static void initConfig() { TileSprinkler.WATERCOST = CFG.comment("Water consumption").defineInRange("water", 5, 0, 1000); TileSprinkler.TIMER_FULL = CFG.comment("Tick rate. 20 will fire one block per second").defineInRange("ticks", 20, 1, 20); CFG.pop(); // sprinkler + CFG.comment("terra_preta settings").push("terra_preta"); + TileTerraPreta.TIMER_FULL = CFG.comment("ticks between growth cycles").defineInRange("timer", 100, 1, 10000); + TileTerraPreta.HEIGHT = CFG.comment("growth height above the soil").defineInRange("height", 8, 2, 32); + CFG.pop(); // terra_preta + CFG.comment("terra_glass settings").push("terra_glass"); + TileTerraGlass.TIMER_FULL = CFG.comment("ticks between growth cycles").defineInRange("timer", 100, 1, 10000); + TileTerraGlass.HEIGHT = CFG.comment("growth height below the glass").defineInRange("height", 8, 0, 32); + CFG.pop(); // terra_preta CFG.comment("Ender Anchor settings").push("eye_teleport"); TileEyeTp.RANGE = CFG.comment("Maximum distance to activate").defineInRange("range", 128, 2, 256); TileEyeTp.HUNGER = CFG.comment("Hunger cost on teleport").defineInRange("hunger", 1, 0, 20); diff --git a/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java b/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java index a3869210e..1845a9fe3 100644 --- a/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java +++ b/src/main/java/com/lothrazar/cyclic/enchant/EnchantGrowth.java @@ -24,18 +24,15 @@ package com.lothrazar.cyclic.enchant; import com.lothrazar.cyclic.base.EnchantBase; -import com.lothrazar.cyclic.util.HarvestUtil; +import com.lothrazar.cyclic.util.GrowthUtil; import com.lothrazar.cyclic.util.UtilItemStack; import com.lothrazar.cyclic.util.UtilShape; import java.util.Collections; import java.util.List; -import net.minecraft.block.BlockState; -import net.minecraft.block.IGrowable; import net.minecraft.enchantment.EnchantmentType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.state.IntegerProperty; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; @@ -46,7 +43,8 @@ public class EnchantGrowth extends EnchantBase { - private static final double ODDS_ROTATE = 0.04; + public static final int HEIGHT = 2; + public static final double ODDS = 0.04; public EnchantGrowth(Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotType... slots) { super(rarityIn, typeIn, slots); @@ -79,61 +77,23 @@ public void onEntityUpdate(LivingUpdateEvent event) { //Ticking int level = getCurrentLevelTool(entity.getHeldItem(Hand.MAIN_HAND)); if (level > 0 && !entity.world.isRemote) { - if (entity.world.rand.nextDouble() > ODDS_ROTATE / level) { + if (entity.world.rand.nextDouble() > ODDS * level) { return; //slow the dice down } final int growthLimit = level * 2 + (entity.world.isRaining() ? 4 : 1); //faster when raining too int grown = 0; List shape = UtilShape.squareHorizontalFull(entity.getPosition().down(), level * RADIUSFACTOR.get()); - shape = UtilShape.repeatShapeByHeight(shape, 2); + shape = UtilShape.repeatShapeByHeight(shape, HEIGHT); Collections.shuffle(shape); for (int i = 0; i < shape.size(); i++) { if (grown >= growthLimit) { break; } - //do one - BlockPos pos = shape.get(i); - BlockState target = entity.world.getBlockState(pos); - if (target.getBlock() instanceof IGrowable) { - IGrowable igrowable = (IGrowable) target.getBlock(); - if (!igrowable.canGrow(entity.world, pos, target, entity.world.isRemote)) { - continue; // not allowed to grow - } - } - IntegerProperty propAge = HarvestUtil.getAgeProp(target); - if (propAge == null) { - continue; - } - int maxAge = Collections.max(propAge.getAllowedValues()); - Integer currentAge = target.get(propAge); - if (currentAge < maxAge) { - if (entity.world.setBlockState(pos, - target.with(propAge, currentAge + 1))) { - grown++; - } - } + GrowthUtil.tryGrow(entity.world, shape.get(i), ODDS * 10); } if (grown > 0) { UtilItemStack.damageItem(entity, entity.getHeldItem(Hand.MAIN_HAND)); } - // works but hits grass flowers and makes a mess - // for (int i = 0; i < shape.size(); i++) { - // if (grown >= growthLimit) { - // break; - // } - // //do one - // BlockPos pos = shape.get(i); - // BlockState blockstate = entity.world.getBlockState(pos); - // if (blockstate.getBlock() instanceof IGrowable) { - // IGrowable igrowable = (IGrowable) blockstate.getBlock(); - // if (igrowable.canGrow(worldIn, pos, blockstate, worldIn.isRemote) - // && igrowable.canUseBonemeal(worldIn, worldIn.rand, pos, blockstate)) { - // igrowable.grow((ServerWorld) worldIn, worldIn.rand, pos, blockstate); - // grown++; - // worldIn.markBlockRangeForRenderUpdate(pos, blockstate, worldIn.getBlockState(pos)); - // } - // } - // } } } } diff --git a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java index 6508539c5..c569dcd02 100644 --- a/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/registry/TileRegistry.java @@ -100,7 +100,7 @@ public class TileRegistry { public static final RegistryObject> ROTATOR = TILES.register("rotator", () -> TileEntityType.Builder.create(() -> new TileRotator(), BlockRegistry.ROTATOR.get()).build(null)); public static final RegistryObject> DETECTORMOON = TILES.register("detector_moon", () -> TileEntityType.Builder.create(() -> new TileMoon(), BlockRegistry.DETECTORMOON.get()).build(null)); public static final RegistryObject> DETECTORWEATHER = TILES.register("detector_weather", () -> TileEntityType.Builder.create(() -> new TileWeather(), BlockRegistry.DETECTORWEATHER.get()).build(null)); - public static final RegistryObject> TERRAGLASS = TILES.register("terra_glass", () -> TileEntityType.Builder.create(() -> new TileTerraGlass(), BlockRegistry.TERRAGLASS.get()).build(null)); + public static final RegistryObject> TERRA_GLASS = TILES.register("terra_glass", () -> TileEntityType.Builder.create(() -> new TileTerraGlass(), BlockRegistry.TERRAGLASS.get()).build(null)); public static final RegistryObject> SPRINKLER = TILES.register("sprinkler", () -> TileEntityType.Builder.create(() -> new TileSprinkler(), BlockRegistry.SPRINKLER.get()).build(null)); public static final RegistryObject> ENDER_ITEM_SHELF = TILES.register("ender_item_shelf", () -> TileEntityType.Builder.create(() -> new TileItemShelf(), BlockRegistry.ENDER_ITEM_SHELF.get()).build(null)); public static final RegistryObject> WIRELESS_ENERGY = TILES.register("wireless_energy", () -> TileEntityType.Builder.create(() -> new TileWirelessEnergy(), BlockRegistry.WIRELESS_ENERGY.get()).build(null)); diff --git a/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java b/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java new file mode 100644 index 000000000..397466819 --- /dev/null +++ b/src/main/java/com/lothrazar/cyclic/util/GrowthUtil.java @@ -0,0 +1,73 @@ +package com.lothrazar.cyclic.util; + +import com.lothrazar.cyclic.ModCyclic; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.IGrowable; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; + +public class GrowthUtil { + + public static boolean isValidGrow(World world, BlockPos current) { + if (world.isAirBlock(current)) { + return false; + } + BlockState bState = world.getBlockState(current); + if (!bState.isIn(BlockTags.CROPS) && !bState.isIn(BlockTags.SAPLINGS)) { + ModCyclic.LOGGER.info("terra-grow can only grow minecraft:crops | minecraft:saplings : " + bState.getBlock()); + return false; + } + if (bState.getBlock() instanceof IGrowable) { + IGrowable crop = ((IGrowable) bState.getBlock()); + if (!crop.canGrow(world, current, bState, world.isRemote)) { + ModCyclic.LOGGER.info("terra-grow crop cannot grow right now " + bState.getBlock()); + return false; //cant grow, or cant bonemeal. no + } + if (!crop.canUseBonemeal(world, world.rand, current, bState)) { + ModCyclic.LOGGER.info("terra-grow canUseBonemeal is false " + bState.getBlock()); + return false; //cant grow, or cant bonemeal. no + } + } + return true; + } + + /** + * grow if valid + */ + public static boolean tryGrow(World world, BlockPos current, double d) { + if (!isValidGrow(world, current)) { + return false; + } + if (d >= 1 || world.rand.nextDouble() < d) { + BlockState bState = world.getBlockState(current); + Block block = bState.getBlock(); + if (world instanceof ServerWorld) { + try { + grow(world, current, bState, block); + } + catch (Exception e) { + return false; + } + } + } + return true; + } + + @SuppressWarnings("deprecation") + private static void grow(World world, BlockPos current, BlockState bState, Block block) { + ServerWorld sw = (ServerWorld) world; + if (bState.getBlock() instanceof IGrowable) { + IGrowable crop = ((IGrowable) bState.getBlock()); + crop.grow(sw, world.rand, current, bState); + } + else { // saplings, etc + block.randomTick(bState, sw, current, world.rand); + block.randomTick(bState, sw, current, world.rand); + block.randomTick(bState, sw, current, world.rand); + } + ModCyclic.LOGGER.info("terra-grow Successful growth" + block); + } +} diff --git a/src/main/resources/data/minecraft/tags/blocks/crops.json.disabled b/src/main/resources/data/minecraft/tags/blocks/crops.json.disabled new file mode 100644 index 000000000..709b67d13 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/crops.json.disabled @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#mysticalagriculture:crops" + ] +} \ No newline at end of file diff --git a/update.json b/update.json index 3d4510005..9bebd5c71 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " + ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } } From 2e40cbf5ea7b42883bd52829157461525b772415 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Fri, 5 Apr 2024 22:58:43 -0700 Subject: [PATCH 14/17] sided safety testing --- .../com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java index 0e08c6e5f..6099b4739 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java @@ -45,6 +45,7 @@ public void onPlaySound(PlaySoundEvent event) { rebuildSoundWithVolume(event, sound, volume); } + @OnlyIn(Dist.CLIENT) private static void rebuildSoundWithVolume(PlaySoundEvent event, ISound sound, float volume) { try { //WARNING": DO NOT USE getVolume anywhere here it just crashes From fa97ad05eab83a91fbc6cdf2b65bd62780f3a6f4 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Fri, 5 Apr 2024 23:02:24 -0700 Subject: [PATCH 15/17] more server/client safety fixes --- .../cyclic/block/soundmuff/SoundmufflerBlock.java | 4 +--- .../cyclic/block/soundrecord/BlockSoundRecorder.java | 7 +++---- .../java/com/lothrazar/cyclic/config/ConfigRegistry.java | 9 +++------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java index 3fa5dfadd..2d894ace4 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundmuff/SoundmufflerBlock.java @@ -13,14 +13,12 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; public class SoundmufflerBlock extends BlockCyclic { private static final int VOL_REDUCE_PER_BLOCK = 2; - public static IntValue RADIUS; // 6 public SoundmufflerBlock(Properties properties) { super(properties.strength(1F).sound(SoundType.SCAFFOLDING)); @@ -37,7 +35,7 @@ public void onPlaySound(PlaySoundEvent event) { SoundInstance sound = event.getSound(); final boolean isPowered = false; // if im NOT powered, im running List blocks = BlockstatesUtil.findBlocks(clientWorld, new BlockPos(sound.getX(), sound.getY(), sound.getZ()), this, - RADIUS.get(), + ConfigRegistry.SOUND_RADIUS.get(), isPowered); if (blocks == null || blocks.size() == 0) { return; diff --git a/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java b/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java index 03f391abf..2d9030c94 100644 --- a/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java +++ b/src/main/java/com/lothrazar/cyclic/block/soundrecord/BlockSoundRecorder.java @@ -2,6 +2,7 @@ import java.util.List; import com.lothrazar.cyclic.block.BlockCyclic; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.net.PacketRecordSound; import com.lothrazar.cyclic.registry.MenuTypeRegistry; import com.lothrazar.cyclic.registry.PacketRegistry; @@ -17,14 +18,11 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; public class BlockSoundRecorder extends BlockCyclic { - public static IntValue RADIUS; - public BlockSoundRecorder(Properties properties) { super(properties.strength(1F).sound(SoundType.SCAFFOLDING)); MinecraftForge.EVENT_BUS.register(this); @@ -50,7 +48,8 @@ public void onPlaySound(PlaySoundEvent event) { } //long term/repeating/music final boolean isPowered = false; // if im NOT powered, im running List blocks = BlockstatesUtil.findBlocks(clientWorld, - new BlockPos(event.getSound().getX(), event.getSound().getY(), event.getSound().getZ()), this, RADIUS.get(), isPowered); + new BlockPos(event.getSound().getX(), event.getSound().getY(), event.getSound().getZ()), this, + ConfigRegistry.RECORDER_RADIUS.get(), isPowered); for (BlockPos nearby : blocks) { String sid = event.getSound().getLocation().toString(); PacketRegistry.INSTANCE.sendToServer(new PacketRecordSound(sid, nearby)); diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index 9b81423b4..abd9d2223 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -41,8 +41,6 @@ import com.lothrazar.cyclic.block.packager.TilePackager; import com.lothrazar.cyclic.block.peatfarm.TilePeatFarm; import com.lothrazar.cyclic.block.shapebuilder.TileStructure; -import com.lothrazar.cyclic.block.soundmuff.SoundmufflerBlock; -import com.lothrazar.cyclic.block.soundrecord.BlockSoundRecorder; import com.lothrazar.cyclic.block.spawntriggers.BlockAltarNoTraders; import com.lothrazar.cyclic.block.spawntriggers.CandlePeaceBlock; import com.lothrazar.cyclic.block.sprinkler.TileSprinkler; @@ -126,6 +124,7 @@ public class ConfigRegistry { public static BooleanValue CYAN_PODZOL_LEGACY; public static BooleanValue TRANSFER_NODES_DIMENSIONAL; public static IntValue SOUND_RADIUS; + public static IntValue RECORDER_RADIUS; static { buildDefaults(); initConfig(); @@ -405,8 +404,6 @@ private static void initConfig() { CFG.pop(); //items CFG.comment(WALL, " Block specific configs", WALL).push("blocks"); //////////////////////////////////////////////////////////////////////////////////// blocks //buffer size for cables - SoundmufflerBlock.RADIUS = CFG.comment("Radius to find and muffle sounds. ") - .defineInRange("soundproofing.radius", 6, 1, 128); TileAntiBeacon.HARMFUL_POTIONS = CFG.comment("If true, then all potions marked as harmful/negative will be used in addition to the 'anti_beacon.potion_list' for cures and immunities (used by both sponge and artemisbeacon).") .define("harmful_potions", true); TileAntiBeacon.RADIUS = CFG.comment("Radius to protect players and entities from potion effects being applied (used by both sponge and artemisbeacon). ") @@ -484,8 +481,8 @@ private static void initConfig() { + "This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; " + "If you change it to false it will only work if the target is in the same dimension.") .define("wireless_transfer_dimensional", true); - CFG.comment("Ender shelf settings").push("sound"); - BlockSoundRecorder.RADIUS = CFG.comment("Sound Recorder - how far out does it listen to record sounds").defineInRange("radius", 8, 1, 64); + CFG.push("sound_recorder"); + RECORDER_RADIUS = CFG.comment("Sound Recorder - how far out does it listen to record sounds").defineInRange("radius", 8, 1, 64); CFG.pop(); CFG.push("ender_shelf"); EnderShelfItemHandler.BOOKS_PER_ROW = CFG.comment("Each shelf has five rows. Set the number of books stored per row here").defineInRange("books_per_row", 256, 1, 1024); From 827a6a9bac10edff097a608368f5e8e5823c3052 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 6 Apr 2024 08:12:51 -0700 Subject: [PATCH 16/17] strip out users ability to drop on the ground --- .../com/lothrazar/cyclic/base/TileEntityBase.java | 15 --------------- .../cyclic/block/spikes/TileDiamondSpikes.java | 15 +++++++++++++++ .../com/lothrazar/cyclic/block/user/TileUser.java | 1 - update.json | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java b/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java index 58537fcdb..dc66c6401 100644 --- a/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java +++ b/src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java @@ -12,9 +12,7 @@ import com.lothrazar.cyclic.util.UtilEntity; import com.lothrazar.cyclic.util.UtilFakePlayer; import com.lothrazar.cyclic.util.UtilFluid; -import com.lothrazar.cyclic.util.UtilItemStack; import java.lang.ref.WeakReference; -import java.util.ArrayList; import java.util.List; import java.util.UUID; import net.minecraft.block.BlockState; @@ -91,19 +89,6 @@ protected PlayerEntity getLookingPlayer(int maxRange, boolean mustCrouch) { return null; } - public void tryDumpFakePlayerInvo(WeakReference fp, boolean includeMainHand) { - int start = (includeMainHand) ? 0 : 1; - ArrayList toDrop = new ArrayList(); - for (int i = start; i < fp.get().inventory.mainInventory.size(); i++) { - ItemStack s = fp.get().inventory.mainInventory.get(i); - if (s.isEmpty() == false) { - toDrop.add(s.copy()); - fp.get().inventory.mainInventory.set(i, ItemStack.EMPTY); - } - } - UtilItemStack.drop(this.world, this.pos.up(), toDrop); - } - public static void tryEquipItem(ItemStack item, WeakReference fp, Hand hand) { if (fp == null) { return; diff --git a/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java b/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java index 00bd51d01..ae674f6e5 100644 --- a/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java +++ b/src/main/java/com/lothrazar/cyclic/block/spikes/TileDiamondSpikes.java @@ -3,7 +3,9 @@ import com.google.common.collect.Maps; import com.lothrazar.cyclic.base.TileEntityBase; import com.lothrazar.cyclic.registry.TileRegistry; +import com.lothrazar.cyclic.util.UtilItemStack; import java.lang.ref.WeakReference; +import java.util.ArrayList; import java.util.Map; import java.util.UUID; import net.minecraft.block.BlockState; @@ -70,6 +72,19 @@ public void tick() { } } + private void tryDumpFakePlayerInvo(WeakReference fp, boolean includeMainHand) { + int start = (includeMainHand) ? 0 : 1; + ArrayList toDrop = new ArrayList(); + for (int i = start; i < fp.get().inventory.mainInventory.size(); i++) { + ItemStack s = fp.get().inventory.mainInventory.get(i); + if (s.isEmpty() == false) { + toDrop.add(s.copy()); + fp.get().inventory.mainInventory.set(i, ItemStack.EMPTY); + } + } + UtilItemStack.drop(this.world, this.pos.up(), toDrop); + } + @Override public void setField(int field, int value) {} diff --git a/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java b/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java index 27a864ddc..fb113e0e0 100644 --- a/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java +++ b/src/main/java/com/lothrazar/cyclic/block/user/TileUser.java @@ -117,7 +117,6 @@ public void tick() { catch (Exception e) { ModCyclic.LOGGER.error("User action item error", e); } - tryDumpFakePlayerInvo(fakePlayer, false); } public boolean isUsingLeftHand() { diff --git a/update.json b/update.json index 9bebd5c71..d469244b8 100644 --- a/update.json +++ b/update.json @@ -79,6 +79,6 @@ ,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml" ,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node " ,"1.5.22":"Fix #2351 advanced crafting stick not opening. " - ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " + ,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ " } } From a652db7b9031de218c9cc89f8c6eba715825681d Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 6 Apr 2024 12:41:30 -0700 Subject: [PATCH 17/17] fix config alignment --- build.gradle | 20 +- examples/config/cyclic.toml | 227 +++++++++--------- gradle.properties | 2 +- .../cyclic/config/ConfigRegistry.java | 14 +- .../cyclic/event/ClientInputEvents.java | 8 - .../cyclic/item/lunchbox/ItemLunchbox.java | 6 +- 6 files changed, 124 insertions(+), 153 deletions(-) diff --git a/build.gradle b/build.gradle index 858660b82..c9943e3e2 100644 --- a/build.gradle +++ b/build.gradle @@ -81,7 +81,6 @@ dependencies { implementation fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}") implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-${mc_version}:${crafttweaker_version}") - compileOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}:api") runtimeOnly fg.deobf("vazkii.botania:Botania:${mc_version}-${botania_version}") @@ -90,24 +89,21 @@ dependencies { compileOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}:api") runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}") - + // implementation fg.deobf("curse.maven:autoreglib-250363:3642382") + // implementation fg.deobf("curse.maven:quark-243121:3840125") + // implementation fg.deobf("curse.maven:more-villagers-484954:3843498") + // implementation fg.deobf("curse.maven:yungs-api-421850:4428184") + // implementation fg.deobf("curse.maven:yungs-better-strongholds-465575:3778231") + // implementation fg.deobf("curse.maven:mekanism-268560:3875976") - implementation fg.deobf("curse.maven:yungs-api-421850:4428184") - implementation fg.deobf("curse.maven:yungs-better-strongholds-465575:3778231") - implementation fg.deobf("curse.maven:mekanism-268560:3875976") - -// implementation fg.deobf("curse.maven:absent-by-design-305840:3686851") - } repositories { // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: - flatDir { - dir 'libs' - } + // flatDir { dir 'libs' } maven { // TOP name 'tterrag maven' url "https://maven.tterrag.com/" @@ -120,7 +116,7 @@ repositories { maven { url 'https://maven.theillusivec4.top/' } maven { url 'https://maven.blamejared.com' } maven { url 'https://modmaven.dev' } - maven { url 'https://www.cursemaven.com' } +// maven { url 'https://www.cursemaven.com' } } // Example for how to get properties into the manifest for reading by the runtime.. jar { diff --git a/examples/config/cyclic.toml b/examples/config/cyclic.toml index c3eef42d5..503e8381e 100644 --- a/examples/config/cyclic.toml +++ b/examples/config/cyclic.toml @@ -151,14 +151,14 @@ #Set false to disable enchantment enabled = true - [cyclic.enchantment.life_leech] - #Set false to disable enchantment - enabled = true - [cyclic.enchantment.gloom] #Set list of effects for Gloom enchant (cyclic:curse) to ignore and not use these ignored = ["minecraft:bad_omen", "minecraft:nausea", "botania:clear"] + [cyclic.enchantment.life_leech] + #Set false to disable enchantment + enabled = true + [cyclic.enchantment.curse] #(Gloom) Set false to disable enchantment enabled = true @@ -212,6 +212,8 @@ # Block specific configs ##################################################################################### [cyclic.blocks] + # Allows the dimensional Transfer Nodes to cross dimensions (no chunk loading is done, you have to do that on your own); This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; If you change it to false it will only work if the target is in the same dimension. + wireless_transfer_dimensional = true #If true, then all potions marked as harmful/negative will be used in addition to the 'anti_beacon.potion_list' for cures and immunities (used by both sponge and artemisbeacon). harmful_potions = true @@ -231,6 +233,21 @@ #Range: 1 ~ 512 height = 8 + #Ender Anchor settings + [cyclic.blocks.eye_teleport] + #Maximum distance to activate + #Range: 2 ~ 256 + range = 128 + #Exp cost on teleport + #Range: 0 ~ 500 + exp = 0 + #Hunger cost on teleport + #Range: 0 ~ 20 + hunger = 1 + #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) + #Range: 1 ~ 20 + frequency = 5 + [cyclic.blocks.disenchanter] #Power per use disenchanter #Range: 0 ~ 64000 @@ -266,121 +283,15 @@ energy_cost_xdim = 8000 [cyclic.blocks.sound] + #Sound Recorder - how far out does it listen to record sounds + #Range: 1 ~ 64 + radius = 8 - ##################################################################################### - # Block specific configs - ##################################################################################### - [cyclic.blocks.sound.blocks] - # Allows the dimensional Transfer Nodes to cross dimensions (no chunk loading is done, you have to do that on your own); This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; If you change it to false it will only work if the target is in the same dimension. - wireless_transfer_dimensional = true - - #Ender Anchor settings - [cyclic.blocks.sound.blocks.eye_teleport] - #Maximum distance to activate - #Range: 2 ~ 256 - range = 128 - #Exp cost on teleport - #Range: 0 ~ 500 - exp = 0 - #Hunger cost on teleport - #Range: 0 ~ 20 - hunger = 1 - #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) - #Range: 1 ~ 20 - frequency = 5 - - #Ender shelf settings - [cyclic.blocks.sound.blocks.sound] - #Sound Recorder - how far out does it listen to record sounds - #Range: 1 ~ 64 - radius = 8 - - #battery settings - [cyclic.blocks.sound.blocks.battery] - #RF/t charging rate for the battery item slot - #Range: 1 ~ 6400000 - charge = 8000 - - #fisher settings - [cyclic.blocks.sound.blocks.fisher] - #Chance to Fish from nearby water. Smaller values is slower fish - #Range: 1.0E-6 ~ 0.999 - chance = 0.06 - #Radius to Fish from nearby water - #Range: 1 ~ 32 - radius = 12 - - [cyclic.blocks.sound.blocks.ender_shelf] - #Controller Max distance to search (using manhattan distance) - #Range: 1 ~ 256 - controller_distance = 64 - #Each shelf has five rows. Set the number of books stored per row here - #Range: 1 ~ 1024 - books_per_row = 256 - - [cyclic.blocks.sound.blocks.terra_preta] - #Growth interval in ticks (100 would be every 5 seconds). - #Range: 1 ~ 64000 - growth_interval = 100 - #Chance that the crop will grow after the interval - #Range: 0.0 ~ 1.0 - growth_chance = 0.5 - #growth height above the soil - #Range: 2 ~ 32 - height = 8 - - [cyclic.blocks.sound.blocks.uncrafter] - #When searching for a recipe, does it ignore all NBT values (such as enchantments, RepairCost, Damage, etc). For example, if false it will not uncraft damaged or enchanted items - nbt_ignored = false - #Ticks used for each uncraft - #Range: 1 ~ 9999 - ticks = 60 - #ITEM IDS HERE. Block ALL recipes that output this item, no matter which recipe they use - ignore_list = ["minecraft:elytra", "minecraft:tipped_arrow", "minecraft:magma_block", "minecraft:stick", "spectrite:spectrite_arrow", "spectrite:spectrite_arrow_special", "techreborn:uumatter", "projecte:*"] - #RECIPE IDS HERE. Block these recipe ids from being reversed, but do not block all recipes for this output item - ignore_recipes = ["minecraft:white_dye_from_lily_of_the_valley", "minecraft:orange_dye_from_orange_tulip", "minecraft:magenta_dye_from_allium", "minecraft:magenta_dye_from_lilac", "minecraft:light_blue_dye_from_blue_orchid", "minecraft:yellow_dye_from_sunflower", "minecraft:yellow_dye_from_dandelion", "minecraft:pink_dye_from_peony", "minecraft:pink_dye_from_pink_tulip", "minecraft:light_gray_dye_from_oxeye_daisy", "minecraft:light_gray_dye_from_azure_bluet", "minecraft:light_gray_dye_from_white_tulip", "minecraft:blue_dye_from_cornflower", "minecraft:red_dye_from_poppy", "minecraft:red_dye_from_rose_bush", "minecraft:red_dye_from_tulip", "minecraft:black_dye_from_wither_rose", "minecraft:blue_dye", "minecraft:black_dye", "minecraft:brown_dye", "botania:cobweb", "minecraft:magma_cream", "minecraft:beacon", "minecraft:stick_from_bamboo_item", "minecraft:netherite_ingot_from_netherite_block", "mysticalagriculture:essence*", "mysticalagriculture:farmland_till", "refinedstorage:coloring_recipes*", "forcecraft:transmutation*", "cyclic:flower_purple_tulip", "cyclic:flower_absalon_tulip", "cyclic:flower_cyan", "cyclic:flower_lime_carnation", "cyclic:fireball", "cyclic:shapeless/spark"] - - #Ender Trigger settings - [cyclic.blocks.sound.blocks.eye_redstone] - #Maximum distance to activate - #Range: 2 ~ 256 - range = 32 - #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) - #Range: 1 ~ 20 - frequency = 5 - - #Sprinkler settings - [cyclic.blocks.sound.blocks.sprinkler] - #Tick rate. 20 will fire one block per second - #Range: 1 ~ 20 - ticks = 20 - #Radius - #Range: 1 ~ 32 - radius = 4 - #Water consumption - #Range: 0 ~ 1000 - water = 5 - - #terra_glass settings - [cyclic.blocks.sound.blocks.terra_glass] - #ticks between growth cycles - #Range: 1 ~ 10000 - timer = 100 - #growth height below the glass - #Range: 0 ~ 32 - height = 8 - - #experience_pylon settings - [cyclic.blocks.sound.blocks.experience_pylon] - #Radius to pickup xp orbs - #Range: 1 ~ 64 - radius = 16 - - #soundproofing settings - [cyclic.blocks.sound.blocks.soundproofing] - #Radius of sound proofing (distance from each block that it will listen) - #Range: 1 ~ 16 - radius = 6 + #battery settings + [cyclic.blocks.battery] + #RF/t charging rate for the battery item slot + #Range: 1 ~ 6400000 + charge = 8000 [cyclic.blocks.generator_fuel] #RF energy per tick generated while burning furnace fuel in this machine. Burn time in ticks is the same as furnace values, so 1 coal = 1600 ticks @@ -397,6 +308,15 @@ #Range: 0 ~ 64000 energy_cost = 10 + #fisher settings + [cyclic.blocks.fisher] + #Chance to Fish from nearby water. Smaller values is slower fish + #Range: 1.0E-6 ~ 0.999 + chance = 0.06 + #Radius to Fish from nearby water + #Range: 1 ~ 32 + radius = 12 + [cyclic.blocks.harvester] #Power per use harvester #Range: 0 ~ 64000 @@ -422,6 +342,15 @@ #Range: 0 ~ 16000 fluid_cost = 25 + #Ender Trigger settings + [cyclic.blocks.eye_redstone] + #Maximum distance to activate + #Range: 2 ~ 256 + range = 32 + #Tick delay between checks, faster checks can consume server resources (1 means check every tick; 20 means only check once per second) + #Range: 1 ~ 20 + frequency = 5 + [cyclic.blocks.peat] #Chance that Peat Bog converts to Peat when wet (is multiplied by the number of surrounding water blocks) #Range: 0.0010000000474974513 ~ 1.0 @@ -435,9 +364,37 @@ #Range: 0 ~ 512 height = 4 + #Sprinkler settings + [cyclic.blocks.sprinkler] + #Tick rate. 20 will fire one block per second + #Range: 1 ~ 20 + ticks = 20 + #Radius + #Range: 1 ~ 32 + radius = 4 + #Water consumption + #Range: 0 ~ 1000 + water = 5 + + #terra_glass settings + [cyclic.blocks.terra_glass] + #ticks between growth cycles + #Range: 1 ~ 10000 + timer = 100 + #growth height below the glass + #Range: 0 ~ 32 + height = 8 + + #experience_pylon settings + [cyclic.blocks.experience_pylon] + #Radius to pickup xp orbs + #Range: 1 ~ 64 + radius = 16 + + #soundproofing settings [cyclic.blocks.soundproofing] - #Radius to find and muffle sounds. - #Range: 1 ~ 128 + #Radius of sound proofing (distance from each block that it will listen) + #Range: 1 ~ 16 radius = 6 [cyclic.blocks.cables] @@ -486,6 +443,14 @@ #Range: 0 ~ 64000 energy_cost = 10 + [cyclic.blocks.ender_shelf] + #Controller Max distance to search (using manhattan distance) + #Range: 1 ~ 256 + controller_distance = 64 + #Each shelf has five rows. Set the number of books stored per row here + #Range: 1 ~ 1024 + books_per_row = 256 + [cyclic.blocks.uncraft] #Power per use uncraft #Range: 0 ~ 64000 @@ -509,6 +474,28 @@ #Range: 1 ~ 64000 fluid_cost = 100 + [cyclic.blocks.terra_preta] + #Growth interval in ticks (100 would be every 5 seconds). + #Range: 1 ~ 64000 + growth_interval = 100 + #Chance that the crop will grow after the interval + #Range: 0.0 ~ 1.0 + growth_chance = 0.5 + #growth height above the soil + #Range: 2 ~ 32 + height = 8 + + [cyclic.blocks.uncrafter] + #When searching for a recipe, does it ignore all NBT values (such as enchantments, RepairCost, Damage, etc). For example, if false it will not uncraft damaged or enchanted items + nbt_ignored = false + #Ticks used for each uncraft + #Range: 1 ~ 9999 + ticks = 60 + #ITEM IDS HERE. Block ALL recipes that output this item, no matter which recipe they use + ignore_list = ["minecraft:elytra", "minecraft:tipped_arrow", "minecraft:magma_block", "minecraft:stick", "spectrite:spectrite_arrow", "spectrite:spectrite_arrow_special", "techreborn:uumatter", "projecte:*"] + #RECIPE IDS HERE. Block these recipe ids from being reversed, but do not block all recipes for this output item + ignore_recipes = ["minecraft:white_dye_from_lily_of_the_valley", "minecraft:orange_dye_from_orange_tulip", "minecraft:magenta_dye_from_allium", "minecraft:magenta_dye_from_lilac", "minecraft:light_blue_dye_from_blue_orchid", "minecraft:yellow_dye_from_sunflower", "minecraft:yellow_dye_from_dandelion", "minecraft:pink_dye_from_peony", "minecraft:pink_dye_from_pink_tulip", "minecraft:light_gray_dye_from_oxeye_daisy", "minecraft:light_gray_dye_from_azure_bluet", "minecraft:light_gray_dye_from_white_tulip", "minecraft:blue_dye_from_cornflower", "minecraft:red_dye_from_poppy", "minecraft:red_dye_from_rose_bush", "minecraft:red_dye_from_tulip", "minecraft:black_dye_from_wither_rose", "minecraft:blue_dye", "minecraft:black_dye", "minecraft:brown_dye", "botania:cobweb", "minecraft:magma_cream", "minecraft:beacon", "minecraft:stick_from_bamboo_item", "minecraft:netherite_ingot_from_netherite_block", "mysticalagriculture:essence*", "mysticalagriculture:farmland_till", "refinedstorage:coloring_recipes*", "forcecraft:transmutation*", "cyclic:flower_purple_tulip", "cyclic:flower_absalon_tulip", "cyclic:flower_cyan", "cyclic:flower_lime_carnation", "cyclic:fireball", "cyclic:shapeless/spark"] + [cyclic.blocks.anti_beacon] #List of extra effects to clear. supports wildcard such as 'cyclic:*'. (This list is is used even if harmful_potions=false or true both) potion_list = ["minecraft:poison", "minecraft:*_poison", "minecraft:wither", "cyclic:gravity", "minecraft:weakness", "minecraft:slowness"] diff --git a/gradle.properties b/gradle.properties index 823617b4c..f3389931e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.daemon=false curse_id=239286 -mod_version=1.7.18-SNAPSHOT +mod_version=1.7.18 mc_version=1.18.2 forge_version=40.2.17 diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index abd9d2223..4da17bb9d 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -403,7 +403,11 @@ private static void initConfig() { CFG.pop(); //heart CFG.pop(); //items CFG.comment(WALL, " Block specific configs", WALL).push("blocks"); //////////////////////////////////////////////////////////////////////////////////// blocks - //buffer size for cables + TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions " + + "(no chunk loading is done, you have to do that on your own); " + + "This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; " + + "If you change it to false it will only work if the target is in the same dimension.") + .define("wireless_transfer_dimensional", true); TileAntiBeacon.HARMFUL_POTIONS = CFG.comment("If true, then all potions marked as harmful/negative will be used in addition to the 'anti_beacon.potion_list' for cures and immunities (used by both sponge and artemisbeacon).") .define("harmful_potions", true); TileAntiBeacon.RADIUS = CFG.comment("Radius to protect players and entities from potion effects being applied (used by both sponge and artemisbeacon). ") @@ -474,14 +478,6 @@ private static void initConfig() { TileAnvilVoid.FLUIDPAY = CFG.comment("Payment per void action, if not zero").defineInRange("fluid_cost", 25, 0, 16000); CFG.pop(); CFG.push("sound"); - CFG.comment(WALL, " Block specific configs", WALL) - .push("blocks"); - TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions " - + "(no chunk loading is done, you have to do that on your own); " - + "This affects blocks cyclic:wireless_energy, cyclic:wireless_item, cyclic:wireless_fluid, cyclic:wireless_transmitter; " - + "If you change it to false it will only work if the target is in the same dimension.") - .define("wireless_transfer_dimensional", true); - CFG.push("sound_recorder"); RECORDER_RADIUS = CFG.comment("Sound Recorder - how far out does it listen to record sounds").defineInRange("radius", 8, 1, 64); CFG.pop(); CFG.push("ender_shelf"); diff --git a/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java b/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java index 03ba4b280..9b6aeee3e 100644 --- a/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java +++ b/src/main/java/com/lothrazar/cyclic/event/ClientInputEvents.java @@ -64,18 +64,11 @@ public void onMouseReleasedPre(ScreenEvent.DrawScreenEvent.Pre event) { Minecraft mc = Minecraft.getInstance(); Screen screen = mc.screen; if (screen instanceof AbstractContainerScreen gui && !(screen instanceof CreativeModeInventoryScreen)) { - // if (gui.getSlotUnderMouse() != null) { - // System.out.println("DrawScreenEvent"); - // Slot slotHit = gui.getSlotUnderMouse(); - // ItemStack stackTarget = slotHit.getItem(); ItemStack maybeFood = mc.player.containerMenu.getCarried(); List boxes = ItemBaseCyclic.findAmmos(mc.player, ItemRegistry.LUNCHBOX.get()); - // if (held.isEdible()) { for (ItemStack box : boxes) { ItemLunchbox.setHoldingEdible(box, maybeFood.isEdible()); - // if (maybeFood.isEdible()) System.out.println(maybeFood + "DrawScreenEvent set edible " + box.getTag()); } - // } } } @@ -104,7 +97,6 @@ public void onMouseReleasedPre(ScreenEvent.MouseReleasedEvent.Pre event) { if (maybeFood.isEdible()) { int slotId = gui.getSlotUnderMouse().getContainerSlot(); SoundUtil.playSound(mc.player, SoundEvents.UI_BUTTON_CLICK); - // System.out.println("item Gui "); PacketRegistry.INSTANCE.sendToServer(new PacketItemGui(slotId, stackTarget.getItem())); event.setCanceled(true); return; diff --git a/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java b/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java index 55a2dc914..348305fd3 100644 --- a/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java +++ b/src/main/java/com/lothrazar/cyclic/item/lunchbox/ItemLunchbox.java @@ -46,6 +46,7 @@ public class ItemLunchbox extends ItemBaseCyclic { + private static final String HOLDING = "holding"; public static final int SLOTS = 7; public ItemLunchbox(Properties prop) { @@ -171,12 +172,11 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundTag nbt) { } public static void setHoldingEdible(ItemStack box, boolean edible) { - box.getOrCreateTag().putBoolean("holding", edible); + box.getOrCreateTag().putBoolean(HOLDING, edible); } public static int getColour(ItemStack stack) { - if (stack.hasTag() && stack.getTag().getBoolean("holding")) { - // System.out.println("00boxr!ender overla!y!"); + if (stack.hasTag() && stack.getTag().getBoolean(HOLDING)) { // green? return 0x00AAAAFF; return 0x000000FF; // 0xFFFF0011; }