illusivesoulworks / veinmining

Minecraft Mod: A lightweight, highly configurable Vein Mining enchantment for tools.
Other
30 stars 16 forks source link

Restrict VeinMining to only ores #21

Closed DeJayDev closed 3 years ago

DeJayDev commented 3 years ago

Hi,

As mentioned in the Title, a method to force the default veinminer to only break items of an ore type (generically, think anything with a registry name that ends with _ore) would help "balance" the veinminer.

We're also noticing the block finding logic causing lag spikes

If I'm simply misunderstanding how the config works, here is the relevant section from my config (still mostly default)

    #List of whitelisted/blacklisted blocks or block tags
    blocks = []
    #Whether the blocks configuration is a whitelist or a blacklist
    #Allowed Values: BLACKLIST, WHITELIST
    blocksPermission = "BLACKLIST"

[groups]
    #List of groupings by block IDs or block tags, comma-separated
    groups = ["#forge:obsidian", "#forge:ores/coal", "#forge:ores/diamond", "#forge:ores/emerald", "#forge:ores/gold", "#forge:ores/iron", "#forge:ores/lapis", "#forge:ores/redstone", "#forge:ores/quartz", "#forge:ores/netherite_scrap", "#forge:ores/copper", "#forge:ores/tin", "#forge:ores/osmium", "#forge:ores/uranium", "#forge:ores/fluorite", "#forge:ores/lead", "#forge:ores/zinc", "#forge:ores/aluminum", "#forge:ores/nickel", "#forge:ores/silver", "#forge:ores/apatite", "#forge:ores/cinnabar", "#forge:ores/niter", "#forge:ores/ruby", "#forge:ores/sapphire", "#forge:ores/sulfur"]

This configuration still allows users to veinmine for example... yellow wool.

TheIllusiveC4 commented 3 years ago

You need to change the blocksPermission to "WHITELIST" and add the block types to the blocks list as outlined here: https://github.com/TheIllusiveC4/VeinMining/wiki/Configuration#ores-only

TheIllusiveC4 commented 3 years ago

We're also noticing the block finding logic causing lag spikes

You'll have to give me more information about when these lag spikes and how often in order for me to investigate. In addition, I'll need to see your entire configuration file.

DeJayDev commented 3 years ago

I haven't been able to reproduce the lag spikes, but regardless the above configuration isn't working for Nether Quartz.

I have a suspicion it has to do with Quartz not setting a good effective tool.

[enchantment]
    #The rarity of the enchantment
    #Allowed Values: COMMON, UNCOMMON, RARE, VERY_RARE
    rarity = "RARE"
    #The number of levels of the enchantment
    #Range: 1 ~ 5
    levels = 1
    #Whether or not to consider this enchantment as a treasure
    isTreasure = false
    #Whether or not this enchantment can be offered by villagers for trade
    isVillagerTrade = true
    #Whether or not this enchantment can generate in loot
    isLootable = true
    #Whether or not this enchantment can be applied at the enchanting table
    canApplyAtEnchantingTable = true
    #Whether or not this enchantment can be applied on books
    canApplyOnBooks = true
    #The minimum enchantability requirement for the first enchantment level
    #Range: 1 ~ 100
    minEnchantabilityBase = 15
    #The additional enchantability requirement for each enchantment level after the first
    #Range: 1 ~ 100
    minEnchantabilityPerLevel = 5
    #List of enchantments that cannot be applied together with this enchantment
    incompatibleEnchantments = []

["vein mining"]
    #Whether or not to require an effective tool to vein mine blocks
    requireEffectiveTool = true
    #The maximum number of blocks to mine without the enchantment
    #Range: 0 ~ 1000
    maxBlocksBase = 0
    #The maximum distance from the source block without the enchantment
    #Range: 0 ~ 1000
    maxDistanceBase = 0
    #The maximum number of blocks to mine per level of the enchantment
    #Range: 1 ~ 1000
    maxBlocksPerLevel = 50
    #The maximum distance from the source block per level of the enchantment
    #Range: 1 ~ 100
    maxDistancePerLevel = 15
    #Whether or not to vein mine diagonally, note this may lead to hidden drops if relocateDrops is false
    diagonalMining = true
    #Whether or not to stop vein mining when the tool can no longer be used
    limitedByDurability = true
    #Whether or not to move all drops to the same location
    relocateDrops = true
    #Whether or not the tool can break while mining additional blocks
    preventToolDestruction = true
    #Whether or not the tool takes damage from mining additional blocks
    addToolDamage = true
    #The multiplier to tool damage from mining additional blocks
    #Range: 0 ~ 1000
    toolDamageMultiplier = 1
    #Whether or not the player gets exhaustion from mining additional blocks
    addPlayerExhaustion = true
    #The multiplier to player exhaustion from mining additional blocks
    #Range: 0.0 ~ 1000.0
    playerExhaustionMultiplier = 1.0
    #List of whitelisted/blacklisted blocks or block tags
    blocks = ["#forge:ores", "#forge:obsidian", "minecraft:nether_gold_ore", "forge:ores/quartz"]
    #Whether the blocks configuration is a whitelist or a blacklist
    #Allowed Values: BLACKLIST, WHITELIST
    blocksPermission = "WHITELIST"

[groups]
    #List of groupings by block IDs or block tags, comma-separated
    groups = ["#forge:obsidian", "#forge:ores/coal", "#forge:ores/diamond", "#forge:ores/emerald", "#forge:ores/gold", "#forge:ores/iron", "#forge:ores/lapis", "#forge:ores/redstone", "#forge:ores/quartz", "#forge:ores/netherite_scrap", "#forge:ores/copper", "#forge:ores/tin", "#forge:ores/osmium", "#forge:ores/uranium", "#forge:ores/fluorite", "#forge:ores/lead", "#forge:ores/zinc", "#forge:ores/aluminum", "#forge:ores/nickel", "#forge:ores/silver", "#forge:ores/apatite", "#forge:ores/cinnabar", "#forge:ores/niter", "#forge:ores/ruby", "#forge:ores/sapphire", "#forge:ores/sulfur"]
TheIllusiveC4 commented 3 years ago

I haven't been able to reproduce the lag spikes, but regardless the above configuration isn't working for Nether Quartz.

I have a suspicion it has to do with Quartz not setting a good effective tool.

Wow, what a strange issue. You're right, Nether Quartz Ore does not have an effective tool. The really strange part is that it's the only ore that isn't listed in the PickaxeItem's effective blocks list, even though the very similar Nether Gold Ore is. I can't help but think this is an oversight, I'm not sure why else this would be the case.

Regardless, I think I can probably code a workaround for this.

DeJayDev commented 3 years ago

Let me know what you think?

Worst case I have a mod that I've been fixing bugs with and I can probably fix it with some mixin love. The issue is it's a modpack, so the fixed version would have to be able to be installed on the server only and not have the client freak out.

TheIllusiveC4 commented 3 years ago

Well if it comes down to it I can just fix it with mixin myself and have it in the mod natively, as this is behavior that I ought to fix universally since quartz ores rightly should be able to count pickaxes as effective tools.

TheIllusiveC4 commented 3 years ago

Alright figured out a way to fix it by using the Forge hook instead of my previous logic, which should be more complete in its checks. Try out version 0.11 once it's approved on CurseForge and let me know how it works out.