mirror of
https://github.com/GTNewHorizons/ForbiddenMagic.git
synced 2026-10-26 14:23:53 +00:00
Fix aoe on chameleon pickaxe (#23)
This commit is contained in:
1 parent
00c7848e7b
commit
aed566f241
4 files changed
+42
-7
No files matched your search
+12
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
dependencies {
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
|
||||
api("com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH")
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:BloodMagic:1.8.5:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.4-GTNH:api')
|
||||
@@ -10,4 +10,15 @@ dependencies {
|
||||
|
||||
|
||||
compileOnly('curse.maven:ee3-65509:2305023')
|
||||
|
||||
// deps may transitively add Baubles, so we replace it
|
||||
project.getConfigurations()
|
||||
.all(c -> {
|
||||
final DependencySubstitutions ds = c.getResolutionStrategy()
|
||||
.getDependencySubstitution();
|
||||
ds.substitute(ds.module("com.github.GTNewHorizons:Baubles"))
|
||||
.using(ds.module("com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH"))
|
||||
.withClassifier("dev")
|
||||
.because("Baubles-Expanded replaces Baubles");
|
||||
});
|
||||
}
|
||||
@@ -2,11 +2,14 @@ package fox.spiteful.forbidden.items;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -345,4 +348,14 @@ public class ForbiddenItems {
|
||||
}
|
||||
return new FocusUpgradeType(id, icon, name, text, aspects);
|
||||
}
|
||||
|
||||
public static boolean isEffective(ItemStack stack, Block block, int meta, Material[] materials) {
|
||||
if (ForgeHooks.isToolEffective(stack, block, meta)) {
|
||||
return true;
|
||||
} else {
|
||||
Material material = block.getMaterial();
|
||||
for (Material m : materials) if (m == material) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package fox.spiteful.forbidden.items.tools;
|
||||
|
||||
import static fox.spiteful.forbidden.items.ForbiddenItems.isEffective;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -14,7 +17,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -30,6 +32,9 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi
|
||||
public IIcon[] icon;
|
||||
int side;
|
||||
|
||||
static Material[] materials = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass,
|
||||
Material.piston, Material.anvil };
|
||||
|
||||
public ItemMorphPickaxe(ToolMaterial enumtoolmaterial) {
|
||||
super(enumtoolmaterial);
|
||||
this.setCreativeTab(Forbidden.tab);
|
||||
@@ -157,7 +162,7 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi
|
||||
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
|
||||
if (!player.worldObj.isRemote) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (ForgeHooks.isToolEffective(stack, block, meta)) {
|
||||
if (isEffective(stack, block, meta, materials)) {
|
||||
for (int aa = -1; aa <= 1; ++aa) {
|
||||
for (int bb = -1; bb <= 1; ++bb) {
|
||||
int xx = 0;
|
||||
@@ -179,7 +184,7 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi
|
||||
Block bl = world.getBlock(x + xx, y + yy, z + zz);
|
||||
meta = world.getBlockMetadata(x + xx, y + yy, z + zz);
|
||||
if (bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F
|
||||
&& ForgeHooks.isToolEffective(stack, bl, meta)) {
|
||||
&& isEffective(stack, bl, meta, materials)) {
|
||||
stack.damageItem(1, player);
|
||||
BlockUtils.harvestBlock(world, (EntityPlayer) player, x + xx, y + yy, z + zz, true, 2);
|
||||
}
|
||||
@@ -191,4 +196,5 @@ public class ItemMorphPickaxe extends ItemPickaxe implements IRepairable, IWarpi
|
||||
|
||||
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package fox.spiteful.forbidden.items.tools;
|
||||
|
||||
import static fox.spiteful.forbidden.items.ForbiddenItems.isEffective;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -14,7 +17,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -30,6 +32,9 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG
|
||||
public IIcon[] icon;
|
||||
int side;
|
||||
|
||||
static Material[] materials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow,
|
||||
Material.clay };
|
||||
|
||||
public ItemMorphShovel(ToolMaterial enumtoolmaterial) {
|
||||
super(enumtoolmaterial);
|
||||
this.setCreativeTab(Forbidden.tab);
|
||||
@@ -152,7 +157,7 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG
|
||||
return super.onBlockDestroyed(stack, world, block, x, y, z, player);
|
||||
if (!player.worldObj.isRemote) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (ForgeHooks.isToolEffective(stack, block, meta)) {
|
||||
if (isEffective(stack, block, meta, materials)) {
|
||||
for (int aa = -1; aa <= 1; ++aa) {
|
||||
for (int bb = -1; bb <= 1; ++bb) {
|
||||
int xx = 0;
|
||||
@@ -174,7 +179,7 @@ public class ItemMorphShovel extends ItemSpade implements IRepairable, IWarpingG
|
||||
Block bl = world.getBlock(x + xx, y + yy, z + zz);
|
||||
meta = world.getBlockMetadata(x + xx, y + yy, z + zz);
|
||||
if (bl.getBlockHardness(world, x + xx, y + yy, z + zz) >= 0.0F
|
||||
&& ForgeHooks.isToolEffective(stack, bl, meta)) {
|
||||
&& isEffective(stack, bl, meta, materials)) {
|
||||
stack.damageItem(1, player);
|
||||
BlockUtils.harvestBlock(world, (EntityPlayer) player, x + xx, y + yy, z + zz, true, 2);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user