Skip to content

Commit

Permalink
patches for doorbell sound not-nullable and charm configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Dec 30, 2023
1 parent d697eca commit eb0cac1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/lothrazar/cyclic/block/DoorbellButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
12 changes: 8 additions & 4 deletions src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -118,6 +119,9 @@ public class ConfigRegistry {
private static ConfigValue<List<? extends String>> MBALL_IGNORE_LIST;
private static ConfigValue<List<? extends String>> 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;
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/com/lothrazar/cyclic/item/bauble/CharmBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions update.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"

},
Expand Down Expand Up @@ -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"
}
}

0 comments on commit eb0cac1

Please sign in to comment.