Growlith1223 / ArsMagica2

Ars Magica 2 Bug Tracker
65 stars 31 forks source link

Bootleg (Temporary) Fix to Radius and Dig #204

Closed ProfHugo closed 7 years ago

ProfHugo commented 7 years ago

For some reason "modified add" was miscounting ONLY radius modifiers (see #143). Here's a bootleg fix that fixes the calculation for it, it just adds 1 more block of radius if there are any radius modifiers in the spell. It's more preferable if the root cause for this could be found and fixed instead of bootleg fixing this, but this should work for now.

Fixes #143

ProfHugo commented 7 years ago

Woops, did overlook that. One question, does FTB Utilities uses canHarvestBlock and/or canSilkHarvest? Because if so, I can just put a check to see if the player (caster) can indeed harvest the block at pos, instead of relying on the premade harvestBlock method.

edit: nvm I'm stupid

ProfHugo commented 7 years ago

@Growlith1223 Is it a good idea to use fireBlockHarvesting from forgeEventFactory? It does go through onBlockBreakEvent (which many chunkclaimer uses) and seems very appealing

edit: lul the old code uses world.destoryBlock() anyways (I dun get it, doesn't harvestblock also set the block to air, or am I missing something here?

code from current state dig:

if (hardness != -1 && state.getBlock().getHarvestLevel(state) <= SpellUtils.getModifiedInt_Add(2, stack, caster, null, world, SpellModifiers.MINING_POWER)) {
            state.getBlock().harvestBlock(world, (EntityPlayer)caster, blockPos, state, null, stack);
            world.destroyBlock(blockPos, false);
            EntityExtension.For(caster).deductMana(hardness * 1.28f);
        } 
ProfHugo commented 7 years ago

One question @Growlith1223, are there any other methods that destroys the block and passes thru onBlockBreak (and have player parameter for canceling purposes)?

TheIcyOne commented 7 years ago

Should probably move 354840b to its own branch.

ProfHugo commented 7 years ago

woops yeah completely forgot about this pull request. I guess ur right, for now imma close this because this has been left untouched for way too long