From eb0cac17a9ea3c992776378f52cebcc95be1b1a6 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sat, 30 Dec 2023 07:01:41 -0800 Subject: [PATCH] patches for doorbell sound not-nullable and charm configs --- gradle.properties | 2 +- .../com/lothrazar/cyclic/block/DoorbellButton.java | 12 +++++++++++- .../com/lothrazar/cyclic/config/ConfigRegistry.java | 12 ++++++++---- .../com/lothrazar/cyclic/item/bauble/CharmBase.java | 12 ++++-------- update.json | 5 ++--- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index 997a64805..ac939d402 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.daemon=false # as needed run/server.properties : online-mode=false curse_id=239286 -mod_version=1.10.2 +mod_version=1.10.3 mc_version=1.19.4 forge_version=45.1.0 diff --git a/src/main/java/com/lothrazar/cyclic/block/DoorbellButton.java b/src/main/java/com/lothrazar/cyclic/block/DoorbellButton.java index 52c00de29..b31a55e91 100644 --- a/src/main/java/com/lothrazar/cyclic/block/DoorbellButton.java +++ b/src/main/java/com/lothrazar/cyclic/block/DoorbellButton.java @@ -4,8 +4,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.ButtonBlock; import net.minecraft.world.level.block.SimpleWaterloggedBlock; @@ -64,8 +67,15 @@ public boolean isSignalSource(BlockState state) { return true; } + @Override + protected void playSound(Player p, LevelAccessor level, BlockPos pos, boolean isOn) { + if (isOn) { + level.playSound(p, pos, this.getSound(isOn), SoundSource.BLOCKS); + } + } + @Override protected SoundEvent getSound(boolean isOn) { - return isOn ? SoundRegistry.DOORBELL_MIKEKOENIG.get() : null; + return SoundRegistry.DOORBELL_MIKEKOENIG.get(); } } diff --git a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java index b49f34d1e..c4fc6274e 100644 --- a/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java +++ b/src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java @@ -74,7 +74,6 @@ import com.lothrazar.cyclic.item.TeleporterWandItem; import com.lothrazar.cyclic.item.bauble.AutoCaveTorchItem; import com.lothrazar.cyclic.item.bauble.AutoTorchItem; -import com.lothrazar.cyclic.item.bauble.CharmBase; import com.lothrazar.cyclic.item.elemental.IceWand; import com.lothrazar.cyclic.item.elemental.WaterSpreaderItem; import com.lothrazar.cyclic.item.ender.ItemProjectileDungeon; @@ -98,6 +97,8 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; +import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; +import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.fml.loading.FMLPaths; public class ConfigRegistry { @@ -118,6 +119,9 @@ public class ConfigRegistry { private static ConfigValue> MBALL_IGNORE_LIST; private static ConfigValue> DISARM_IGNORE_LIST; private static final String WALL = "####################################################################################"; + public static IntValue CHARM_LUCK; + public static DoubleValue CHARM_SPEED; + public static DoubleValue CHARM_ATTACKSPEED; public static BooleanValue OVERRIDE_TRANSPORTER_SINGLETON; public static BooleanValue GENERATE_FLOWERS; public static BooleanValue CYAN_PODZOL_LEGACY; @@ -363,9 +367,9 @@ private static void initConfig() { MaterialRegistry.OBS_LEG = CFG.comment("Damage Reduction").defineInRange("leg", 10, 1, 99); CFG.pop(); ItemProjectileDungeon.RANGE = CFG.comment("Range in all directions to search for spawner").defineInRange("spawner_seeker.range", 64, 1, 256); - CharmBase.CHARM_LUCK = CFG.comment("Boost given by item charm_luck").defineInRange("charm_luck.boost", 10, 0, 100); - CharmBase.CHARM_SPEED = CFG.comment("Boost given by item charm_speed").defineInRange("charm_speed.boost", 0.5F, 0, 2F); - CharmBase.CHARM_ATTACKSPEED = CFG.comment("Boost given by item charm_attackspeed").defineInRange("charm_attack_speed.boost", 0.5F, 0, 2F); + CHARM_LUCK = CFG.comment("Boost given by item charm_luck").defineInRange("charm_luck.boost", 10, 0, 100); + CHARM_SPEED = CFG.comment("Boost given by item charm_speed").defineInRange("charm_speed.boost", 0.5F, 0, 2F); + CHARM_ATTACKSPEED = CFG.comment("Boost given by item charm_attackspeed").defineInRange("charm_attack_speed.boost", 0.5F, 0, 2F); AutoTorchItem.LIGHT_LEVEL = CFG.comment("Light level limit for placing torches").defineInRange("charm_torch.light_level", 9, 0, 15); CFG.comment(WALL, " Caving Torch Charm settings", WALL).push("caving_torch"); AutoCaveTorchItem.LIGHT_LIMIT = CFG.comment("Light level at which to start placing down a torch").defineInRange("light_limit", 7, 0, 14); diff --git a/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java b/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java index b8020aee8..40df8f393 100644 --- a/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java +++ b/src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java @@ -2,6 +2,7 @@ import java.util.UUID; import com.lothrazar.cyclic.ModCyclic; +import com.lothrazar.cyclic.config.ConfigRegistry; import com.lothrazar.cyclic.data.Const; import com.lothrazar.cyclic.registry.ItemRegistry; import com.lothrazar.cyclic.util.CharmUtil; @@ -25,15 +26,10 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.ForgeMod; public abstract class CharmBase extends ItemBaseToggle { - public static IntValue CHARM_LUCK; - public static DoubleValue CHARM_SPEED; - public static DoubleValue CHARM_ATTACKSPEED; private static final int FIREPROTSECONDS = 10; private static final int FALLDISTANCESECONDS = 5; private static final int FALLDISTANCELIMIT = 5; // was 6 in 1.12.2 @@ -150,15 +146,15 @@ private static void toggleAttribute(Player player, Item charm, Attribute attr, U static final AttributeModifier.Operation MUL = AttributeModifier.Operation.MULTIPLY_BASE; static void charmSpeed(Player player) { - toggleAttribute(player, ItemRegistry.CHARM_SPEED.get(), Attributes.MOVEMENT_SPEED, ID_SPEED, CHARM_SPEED.get().floatValue(), 0, ADD); + toggleAttribute(player, ItemRegistry.CHARM_SPEED.get(), Attributes.MOVEMENT_SPEED, ID_SPEED, ConfigRegistry.CHARM_SPEED.get().floatValue(), 0, ADD); } static void charmLuck(Player player) { - toggleAttribute(player, ItemRegistry.CHARM_LUCK.get(), Attributes.LUCK, ID_LUCK, 0, CHARM_LUCK.get(), ADD); + toggleAttribute(player, ItemRegistry.CHARM_LUCK.get(), Attributes.LUCK, ID_LUCK, 0, ConfigRegistry.CHARM_LUCK.get(), ADD); } static void charmAttackSpeed(Player player) { - toggleAttribute(player, ItemRegistry.CHARM_ATTACKSPEED.get(), Attributes.ATTACK_SPEED, ID_ATTACKSPEED, CHARM_ATTACKSPEED.get().floatValue(), 0, ADD); + toggleAttribute(player, ItemRegistry.CHARM_ATTACKSPEED.get(), Attributes.ATTACK_SPEED, ID_ATTACKSPEED, ConfigRegistry.CHARM_ATTACKSPEED.get().floatValue(), 0, ADD); } static void charmSwimming(Player player) { diff --git a/update.json b/update.json index adbc2fe83..aa8076b65 100644 --- a/update.json +++ b/update.json @@ -6,7 +6,7 @@ "1.18.2-latest": "1.7.17", "1.19.2-latest":"1.8.2", "1.19.3-latest":"1.9.0", - "1.19.4-latest":"1.10.2", + "1.19.4-latest":"1.10.3", "1.20-latest":"1.12.1" }, @@ -149,8 +149,7 @@ "1.19.4":{ "1.10.0":"Ported to MC-1.19.4 (from 1.19.3-1.9.0)" ,"1.10.1" :"Fix #2221 visual gui fluid bars. backport #2282 tags for tool types. Fix multi-jump enchant #2256 and fix #2248 Cant open the Extended Inventory after eating the Ender Inventory Cake. Fix 'Apple of lofty stature' not syncing when you rejoin the world, meaning the Step Height Disabled wasnt turning it off #2296 #2258. Exp boost no longer gives XP if the original harvest had a zero drop (stone/dirt etc) fix #2283. Fix render_type of Melter and Solidifier. Melter and Solidifier now drain the 'rf per tick' from recipe constrantly, instead of one batch drain at the end (and fix bug #2284)" - ,"1.10.2":"Fix buttons rendering a second version when hovering for a tooltip. (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.10.3":"#2332 Patch doorbell crash. Patch InvocationTargetException: null errors coming from IHasClickToggle" } }