Skip to content

Commit

Permalink
feat: Config option to blacklist blocks from being absorbed with Abso…
Browse files Browse the repository at this point in the history
…rb Artefact
  • Loading branch information
WinDanesz committed Apr 1, 2024
1 parent ee81cf3 commit c733448
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/windanesz/ancientspellcraft/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ public static class GeneralSettings {
@Config.RangeInt(min = 100, max = 10000)
public int vault_key_usage_mana_cost = 5000;

@Config.Name("Absorb Object Block Blacklist")
public String[] absorb_object_block_blacklist = {};

@Config.Name("Runic Shield Armor Amount")
@Config.RequiresMcRestart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.Sets;
import com.windanesz.ancientspellcraft.AncientSpellcraft;
import com.windanesz.ancientspellcraft.Settings;
import com.windanesz.ancientspellcraft.registry.ASItems;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.ItemWizardArmour;
Expand Down Expand Up @@ -34,6 +35,9 @@
import net.minecraft.world.World;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

public class AbsorbObject extends SpellRay implements IClassSpell {
Expand Down Expand Up @@ -131,9 +135,12 @@ protected boolean onBlockHit(World world, BlockPos pos, EnumFacing side, Vec3d h
}

if (BlockUtils.isBlockUnbreakable(world, pos)) {return false;}
List<String> blacklist = new ArrayList<>(Arrays.asList(Settings.generalSettings.absorb_object_block_blacklist));
if (blacklist.contains(world.getBlockState(pos).getBlock().getRegistryName().toString())) {return false;}
// Reworked to respect the rules, but since we might break multiple blocks this is left as an optimisation
if (!EntityUtils.canDamageBlocks(caster, world)) {return false;}


boolean flag = false;

IBlockState state1 = world.getBlockState(pos);
Expand Down

0 comments on commit c733448

Please sign in to comment.