mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Fix original block not being affected by ability
This commit is contained in:
parent
05562018fc
commit
92b9ab2369
@ -24,10 +24,8 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public interface IToolAreaAbility extends IBaseAbility {
|
||||
// Should call tool.breakExtraBlock on a bunch of blocks.
|
||||
// The initial block is always implicitly broken and shouldn't be included.
|
||||
// If true is returned, no block breaking is handled by the tool
|
||||
// (neither for the original block nor for the extras)
|
||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool);
|
||||
// The initial block should be included if you want it broken!
|
||||
public void onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool);
|
||||
|
||||
// Whether breakExtraBlock is called at all. Currently only false for explosion
|
||||
public default boolean allowsHarvest(int level) {
|
||||
@ -49,8 +47,8 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
return false;
|
||||
public void onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
tool.breakExtraBlock(world, x, y, z, player, x, y, z);
|
||||
}
|
||||
};
|
||||
|
||||
@ -89,21 +87,24 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
private Set<ThreeInts> pos = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
public void onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
Block b = world.getBlock(x, y, z);
|
||||
|
||||
if(b == Blocks.stone && !ToolConfig.recursiveStone) {
|
||||
return false;
|
||||
tool.breakExtraBlock(world, x, y, z, player, x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
if(b == Blocks.netherrack && !ToolConfig.recursiveNetherrack)
|
||||
return false;
|
||||
if(b == Blocks.netherrack && !ToolConfig.recursiveNetherrack) {
|
||||
tool.breakExtraBlock(world, x, y, z, player, x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
pos.clear();
|
||||
|
||||
recurse(world, x, y, z, x, y, z, player, tool, 0, radiusAtLevel[level]);
|
||||
|
||||
return false;
|
||||
tool.breakExtraBlock(world, x, y, z, player, x, y, z);
|
||||
}
|
||||
|
||||
private final List<ThreeInts> offsets = new ArrayList<ThreeInts>(3*3*3-1) {{
|
||||
@ -201,22 +202,16 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
public void onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
int range = rangeAtLevel[level];
|
||||
|
||||
for(int a = x - range; a <= x + range; a++) {
|
||||
for(int b = y - range; b <= y + range; b++) {
|
||||
for(int c = z - range; c <= z + range; c++) {
|
||||
|
||||
if(a == x && b == y && c == z)
|
||||
continue;
|
||||
|
||||
tool.breakExtraBlock(world, a, b ,c, player, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@ -254,7 +249,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
public void onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||
float strength = strengthAtLevel[level];
|
||||
|
||||
ExplosionNT ex = new ExplosionNT(player.worldObj, player, x + 0.5, y + 0.5, z + 0.5, strength);
|
||||
@ -265,8 +260,6 @@ public interface IToolAreaAbility extends IBaseAbility {
|
||||
ex.doExplosionB(false);
|
||||
|
||||
player.worldObj.createExplosion(player, x + 0.5, y + 0.5, z + 0.5, 0.1F, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// endregion handlers
|
||||
|
||||
@ -167,11 +167,9 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
|
||||
|
||||
preset.harvestAbility.preHarvestAll(preset.harvestAbilityLevel, world, player);
|
||||
|
||||
boolean result = preset.areaAbility.onDig(preset.areaAbilityLevel, world, x, y, z, player, this);
|
||||
preset.areaAbility.onDig(preset.areaAbilityLevel, world, x, y, z, player, this);
|
||||
|
||||
preset.harvestAbility.postHarvestAll(preset.harvestAbilityLevel, world, player);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user