Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

雷击铁块转化空心磁铁块改为范围转化 #261

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public class AnvilCraftConfig implements ConfigData {
@ConfigEntry.BoundedDiscrete(max = 16, min = 1)
public int lightningStrikeDepth = 2;

@Comment("Maximum radius a lightning strike can reach")
@ConfigEntry.Gui.Tooltip
@ConfigEntry.BoundedDiscrete(max = 8, min = 0)
public int lightningStrikeRadius = 1;

@Comment("Maximum distance a magnet attracts")
@ConfigEntry.Gui.Tooltip
@ConfigEntry.BoundedDiscrete(max = 16, min = 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ public void onLightingStrike(@NotNull LightningStrikeEvent event) {
BlockState state = event.getLevel().getBlockState(pos);
if (state.is(Blocks.LIGHTNING_ROD)) pos = pos.below();
int depth = AnvilCraft.config.lightningStrikeDepth;
for (int i = 0; i < depth; i++) {
state = event.getLevel().getBlockState(pos);
if (state.is(Blocks.IRON_BLOCK)) {
BlockState state1 = ModBlocks.HOLLOW_MAGNET_BLOCK.get().defaultBlockState();
event.getLevel().setBlockAndUpdate(pos, state1);
int radius = AnvilCraft.config.lightningStrikeRadius;
for (int x = -radius; x <= radius; x++) {
for (int z = -radius; z <= radius; z++) {
for (int y = 0; y < depth; y++) {
BlockPos offset = pos.offset(x, -y, z);
state = event.getLevel().getBlockState(offset);
if (
!state.is(Blocks.IRON_BLOCK)
&& !state.is(ModBlocks.FERRITE_CORE_MAGNET_BLOCK.get())
&& !state.is(ModBlocks.MAGNET_BLOCK.get())
) continue;
BlockState state1 = ModBlocks.HOLLOW_MAGNET_BLOCK.get().defaultBlockState();
event.getLevel().setBlockAndUpdate(offset, state1);
}
}
pos = pos.below();
}
}
}
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/anvilcraft/lang/lzh.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "晶穴索之極距",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "雷擊之深",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "雷擊所至之極深",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "雷擊之域",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "雷擊所至之極徑",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "礠石塊之限",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "礠石塊引砧之極距",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "收執礠石之域",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/anvilcraft/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "使用晶洞搜索紫晶洞的最大半径",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "雷击深度",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "雷击可以达到的最大深度",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "雷击半径",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "雷击可以达到的最大半径",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "磁铁吸引距离",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "磁铁吸引铁砧的最远距离",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "手持磁铁吸引半径",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/anvilcraft/lang/zh_hk.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "使用晶洞搜索紫晶洞的最大半徑",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "雷擊深度",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "雷擊可以達到的最大深度",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "雷擊半徑",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "雷擊可以達到的最大半徑",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "磁鐵吸引距離",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "磁鐵吸引鐵砧的最遠距離",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "手持磁鐵吸引半徑",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/anvilcraft/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "使用晶洞搜索紫晶洞的最大半徑",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "雷擊深度",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "雷擊可以達到的最大深度",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "雷擊半徑",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "雷擊可以達到的最大半徑",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "磁鐵吸引距離",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "磁鐵吸引鐵砧的最遠距離",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "手持磁鐵吸引半徑",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "ǝpoǝb ǝɥʇ ɟo snıpɐɹ ɥɔɹɐǝs ɯnɯıxɐɯ ǝɥ⟘",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "ɥʇdǝᗡ ǝʞıɹʇS buıuʇɥbıꞀ",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "ɥɔɐǝɹ uɐɔ ǝʞıɹʇs buıuʇɥbıן ɐ ɥʇdǝp ɯnɯıxɐW",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "snıpɐᴚ ǝʞıɹʇS buıuʇɥbıꞀ",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "ɥɔɐǝɹ uɐɔ ǝʞıɹʇs buıuʇɥbıן ɐ snıpɐɹ ɯnɯıxɐW",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "ǝɔuɐʇsıᗡ sʇɔɐɹʇʇⱯ ʇǝubɐW",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "sʇɔɐɹʇʇɐ ʇǝubɐɯ ɐ ǝɔuɐʇsıp ɯnɯıxɐW",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "snıpɐᴚ sʇɔɐɹʇʇⱯ ɯǝʇI ʇǝubɐW",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "The maximum search radius of the geode",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "Lightning Strike Depth",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "Maximum depth a lightning strike can reach",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "Lightning Strike Radius",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "Maximum radius a lightning strike can reach",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "Magnet Attracts Distance",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "Maximum distance a magnet attracts",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "Magnet Item Attracts Radius",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "ǝpoǝb ǝɥʇ ɟo snıpɐɹ ɥɔɹɐǝs ɯnɯıxɐɯ ǝɥ⟘",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "ɥʇdǝᗡ ǝʞıɹʇS buıuʇɥbıꞀ",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "ɥɔɐǝɹ uɐɔ ǝʞıɹʇs buıuʇɥbıן ɐ ɥʇdǝp ɯnɯıxɐW",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "snıpɐᴚ ǝʞıɹʇS buıuʇɥbıꞀ",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "ɥɔɐǝɹ uɐɔ ǝʞıɹʇs buıuʇɥbıן ɐ snıpɐɹ ɯnɯıxɐW",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "ǝɔuɐʇsıᗡ sʇɔɐɹʇʇⱯ ʇǝubɐW",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "sʇɔɐɹʇʇɐ ʇǝubɐɯ ɐ ǝɔuɐʇsıp ɯnɯıxɐW",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "snıpɐᴚ sʇɔɐɹʇʇⱯ ɯǝʇI ʇǝubɐW",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
"text.autoconfig.anvilcraft.option.geodeRadius.@Tooltip": "The maximum search radius of the geode",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth": "Lightning Strike Depth",
"text.autoconfig.anvilcraft.option.lightningStrikeDepth.@Tooltip": "Maximum depth a lightning strike can reach",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius": "Lightning Strike Radius",
"text.autoconfig.anvilcraft.option.lightningStrikeRadius.@Tooltip": "Maximum radius a lightning strike can reach",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance": "Magnet Attracts Distance",
"text.autoconfig.anvilcraft.option.magnetAttractsDistance.@Tooltip": "Maximum distance a magnet attracts",
"text.autoconfig.anvilcraft.option.magnetItemAttractsRadius": "Magnet Item Attracts Radius",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod_id = anvilcraft
mod_name = AnvilCraft
mod_description = ...
mod_license = LGPL-3.0 license
mod_version = 1.2.1
mod_version = 1.2.2
mod_url = https://github.com/

maven_group=dev.dubhe
Expand Down
Loading