mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Reimplement ItemToolAbility
I'll be very impressed if it works correctly right away. But, to my credit, it does compile
This commit is contained in:
parent
634836c549
commit
c190863785
@ -1,622 +0,0 @@
|
|||||||
package com.hbm.handler;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.hbm.config.ToolConfig;
|
|
||||||
import com.hbm.explosion.ExplosionNT;
|
|
||||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
|
||||||
import com.hbm.inventory.recipes.CentrifugeRecipes;
|
|
||||||
import com.hbm.inventory.recipes.CrystallizerRecipes;
|
|
||||||
import com.hbm.inventory.recipes.CrystallizerRecipes.CrystallizerRecipe;
|
|
||||||
import com.hbm.inventory.recipes.ShredderRecipes;
|
|
||||||
import com.hbm.items.ModItems;
|
|
||||||
import com.hbm.items.tool.IItemWithAbility;
|
|
||||||
import com.hbm.util.EnchantmentUtil;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public abstract class ToolAbility {
|
|
||||||
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) { return false; }
|
|
||||||
public abstract String getName();
|
|
||||||
public abstract String getFullName();
|
|
||||||
public abstract String getExtension();
|
|
||||||
public abstract boolean isAllowed();
|
|
||||||
|
|
||||||
public static class RecursionAbility extends ToolAbility {
|
|
||||||
|
|
||||||
int radius;
|
|
||||||
|
|
||||||
public RecursionAbility(int radius) {
|
|
||||||
this.radius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<ThreeInts> pos = new HashSet();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
Block b = world.getBlock(x, y, z);
|
|
||||||
|
|
||||||
if(b == Blocks.stone && !ToolConfig.recursiveStone)
|
|
||||||
return false;
|
|
||||||
if(b == Blocks.netherrack && !ToolConfig.recursiveNetherrack)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
pos.clear();
|
|
||||||
|
|
||||||
recurse(world, x, y, z, x, y, z, player, tool, 0);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final List<ThreeInts> offsets = new ArrayList<>(3*3*3-1);
|
|
||||||
|
|
||||||
static {
|
|
||||||
for (int dx = -1; dx <= 1; dx++) {
|
|
||||||
for (int dy = -1; dy <= 1; dy++) {
|
|
||||||
for (int dz = -1; dz <= 1; dz++) {
|
|
||||||
if (dx != 0 || dy != 0 || dz != 0) {
|
|
||||||
offsets.add(new ThreeInts(dx, dy, dz));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void recurse(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, IItemWithAbility tool, int depth) {
|
|
||||||
|
|
||||||
List<ThreeInts> shuffledOffsets = new ArrayList<>(offsets);
|
|
||||||
Collections.shuffle(shuffledOffsets);
|
|
||||||
|
|
||||||
for(ThreeInts offset : shuffledOffsets) {
|
|
||||||
breakExtra(world, x + offset.x, y + offset.y, z + offset.z, refX, refY, refZ, player, tool, depth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void breakExtra(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, IItemWithAbility tool, int depth) {
|
|
||||||
|
|
||||||
if(pos.contains(new ThreeInts(x, y, z)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
depth += 1;
|
|
||||||
|
|
||||||
if(depth > ToolConfig.recursionDepth)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pos.add(new ThreeInts(x, y, z));
|
|
||||||
|
|
||||||
//don't lose the ref block just yet
|
|
||||||
if(x == refX && y == refY && z == refZ)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(Vec3.createVectorHelper(x - refX, y - refY, z - refZ).lengthVector() > radius)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Block b = world.getBlock(x, y, z);
|
|
||||||
Block ref = world.getBlock(refX, refY, refZ);
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
int refMeta = world.getBlockMetadata(refX, refY, refZ);
|
|
||||||
|
|
||||||
if(!isSameBlock(b, ref))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(meta != refMeta)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(player.getHeldItem() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tool.breakExtraBlock(world, x, y, z, player, refX, refY, refZ);
|
|
||||||
|
|
||||||
recurse(world, x, y, z, refX, refY, refZ, player, tool, depth);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isSameBlock(Block b1, Block b2) {
|
|
||||||
|
|
||||||
if(b1 == b2) return true;
|
|
||||||
if((b1 == Blocks.redstone_ore && b2 == Blocks.lit_redstone_ore) || (b1 == Blocks.lit_redstone_ore && b2 == Blocks.redstone_ore)) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.recursion";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + getExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return " (" + radius + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityVein;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class HammerAbility extends ToolAbility {
|
|
||||||
|
|
||||||
int range;
|
|
||||||
|
|
||||||
public HammerAbility(int range) {
|
|
||||||
this.range = range;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.hammer";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + getExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return " (" + range + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityHammer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class HammerSilkAbility extends ToolAbility {
|
|
||||||
|
|
||||||
int range;
|
|
||||||
|
|
||||||
public HammerSilkAbility(int range) {
|
|
||||||
this.range = range;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
if(EnchantmentHelper.getSilkTouchModifier(player) || player.getHeldItem() == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ItemStack stack = player.getHeldItem();
|
|
||||||
EnchantmentUtil.addEnchantment(stack, Enchantment.silkTouch, 1);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(player instanceof EntityPlayerMP)
|
|
||||||
IItemWithAbility.standardDigPost(world, x, y, z, (EntityPlayerMP) player);
|
|
||||||
|
|
||||||
EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.hammersilk";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + getExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return " (" + range + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityHammer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SilkAbility extends ToolAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(EnchantmentHelper.getSilkTouchModifier(player) || player.getHeldItem() == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ItemStack stack = player.getHeldItem();
|
|
||||||
EnchantmentUtil.addEnchantment(stack, Enchantment.silkTouch, 1);
|
|
||||||
|
|
||||||
if(player instanceof EntityPlayerMP)
|
|
||||||
IItemWithAbility.standardDigPost(world, x, y, z, (EntityPlayerMP) player);
|
|
||||||
|
|
||||||
EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.silktouch";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilitySilk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class LuckAbility extends ToolAbility {
|
|
||||||
|
|
||||||
int luck;
|
|
||||||
|
|
||||||
public LuckAbility(int luck) {
|
|
||||||
this.luck = luck;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(EnchantmentHelper.getFortuneModifier(player) > 0 || player.getHeldItem() == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ItemStack stack = player.getHeldItem();
|
|
||||||
EnchantmentUtil.addEnchantment(stack, Enchantment.fortune, luck);
|
|
||||||
|
|
||||||
if(player instanceof EntityPlayerMP)
|
|
||||||
IItemWithAbility.standardDigPost(world, x, y, z, (EntityPlayerMP) player);
|
|
||||||
|
|
||||||
EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.luck";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + getExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return " (" + luck + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityLuck;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SmelterAbility extends ToolAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
List<ItemStack> drops = block.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
|
||||||
|
|
||||||
boolean doesSmelt = false;
|
|
||||||
|
|
||||||
for(int i = 0; i < drops.size(); i++) {
|
|
||||||
ItemStack stack = drops.get(i).copy();
|
|
||||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(stack);
|
|
||||||
|
|
||||||
if(result != null) {
|
|
||||||
result = result.copy();
|
|
||||||
result.stackSize *= stack.stackSize;
|
|
||||||
drops.set(i, result);
|
|
||||||
doesSmelt = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(doesSmelt) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
player.getHeldItem().damageItem(1, player);
|
|
||||||
|
|
||||||
for(ItemStack stack : drops)
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.smelter";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityFurnace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ShredderAbility extends ToolAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
//a band-aid on a gaping wound
|
|
||||||
if(block == Blocks.lit_redstone_ore)
|
|
||||||
block = Blocks.redstone_ore;
|
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(block, 1, meta);
|
|
||||||
ItemStack result = ShredderRecipes.getShredderResult(stack);
|
|
||||||
|
|
||||||
if(result != null && result.getItem() != ModItems.scrap) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, result.copy()));
|
|
||||||
player.getHeldItem().damageItem(1, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.shredder";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityShredder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CentrifugeAbility extends ToolAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
//a band-aid on a gaping wound
|
|
||||||
if(block == Blocks.lit_redstone_ore)
|
|
||||||
block = Blocks.redstone_ore;
|
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(block, 1, meta);
|
|
||||||
ItemStack[] result = CentrifugeRecipes.getOutput(stack);
|
|
||||||
|
|
||||||
if(result != null) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
player.getHeldItem().damageItem(1, player);
|
|
||||||
|
|
||||||
for(ItemStack st : result) {
|
|
||||||
if(st != null)
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, st.copy()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.centrifuge";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityCentrifuge;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CrystallizerAbility extends ToolAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
//a band-aid on a gaping wound
|
|
||||||
if(block == Blocks.lit_redstone_ore)
|
|
||||||
block = Blocks.redstone_ore;
|
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(block, 1, meta);
|
|
||||||
CrystallizerRecipe result = CrystallizerRecipes.getOutput(stack, Fluids.PEROXIDE);
|
|
||||||
|
|
||||||
if(result != null) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, result.output.copy()));
|
|
||||||
player.getHeldItem().damageItem(1, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.crystallizer";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityCrystallizer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MercuryAbility extends ToolAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
//a band-aid on a gaping wound
|
|
||||||
if(block == Blocks.lit_redstone_ore)
|
|
||||||
block = Blocks.redstone_ore;
|
|
||||||
|
|
||||||
int mercury = 0;
|
|
||||||
|
|
||||||
if(block == Blocks.redstone_ore)
|
|
||||||
mercury = player.getRNG().nextInt(5) + 4;
|
|
||||||
if(block == Blocks.redstone_block)
|
|
||||||
mercury = player.getRNG().nextInt(7) + 8;
|
|
||||||
|
|
||||||
if(mercury > 0) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.ingot_mercury, mercury)));
|
|
||||||
player.getHeldItem().damageItem(1, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.mercury";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityMercury;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ExplosionAbility extends ToolAbility {
|
|
||||||
|
|
||||||
float strength;
|
|
||||||
|
|
||||||
public ExplosionAbility(float strength) {
|
|
||||||
this.strength = strength;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
ExplosionNT ex = new ExplosionNT(player.worldObj, player, x + 0.5, y + 0.5, z + 0.5, strength);
|
|
||||||
ex.addAttrib(ExAttrib.ALLDROP);
|
|
||||||
ex.addAttrib(ExAttrib.NOHURT);
|
|
||||||
ex.addAttrib(ExAttrib.NOPARTICLE);
|
|
||||||
ex.doExplosionA();
|
|
||||||
ex.doExplosionB(false);
|
|
||||||
|
|
||||||
player.worldObj.createExplosion(player, x + 0.5, y + 0.5, z + 0.5, 0.1F, false);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getExtension() {
|
|
||||||
return " (" + strength + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "tool.ability.explosion";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + getExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed() {
|
|
||||||
return ToolConfig.abilityExplosion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,369 +0,0 @@
|
|||||||
package com.hbm.handler;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
|
||||||
import com.hbm.blocks.generic.BlockBobble.BobbleType;
|
|
||||||
import com.hbm.handler.threading.PacketThreading;
|
|
||||||
import com.hbm.items.ModItems;
|
|
||||||
import com.hbm.items.tool.IItemWithAbility;
|
|
||||||
import com.hbm.lib.ModDamageSource;
|
|
||||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
|
||||||
import com.hbm.potion.HbmPotion;
|
|
||||||
import com.hbm.util.ContaminationUtil;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
|
|
||||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
|
||||||
import com.hbm.util.ContaminationUtil.HazardType;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.item.EntityXPOrb;
|
|
||||||
import net.minecraft.entity.monster.EntityCreeper;
|
|
||||||
import net.minecraft.entity.monster.EntityMagmaCube;
|
|
||||||
import net.minecraft.entity.monster.EntityMob;
|
|
||||||
import net.minecraft.entity.monster.EntitySkeleton;
|
|
||||||
import net.minecraft.entity.monster.EntitySlime;
|
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.potion.Potion;
|
|
||||||
import net.minecraft.potion.PotionEffect;
|
|
||||||
import net.minecraft.util.DamageSource;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public abstract class WeaponAbility {
|
|
||||||
|
|
||||||
public abstract void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool);
|
|
||||||
public abstract String getName();
|
|
||||||
public abstract String getFullName();
|
|
||||||
|
|
||||||
public static class RadiationAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
float rad;
|
|
||||||
|
|
||||||
public RadiationAbility(float rad) {
|
|
||||||
this.rad = rad;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase)
|
|
||||||
ContaminationUtil.contaminate((EntityLivingBase)victim, HazardType.RADIATION, ContaminationType.CREATIVE, rad);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.radiation";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (" + rad + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class VampireAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
float amount;
|
|
||||||
|
|
||||||
public VampireAbility(float amount) {
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase) {
|
|
||||||
|
|
||||||
EntityLivingBase living = (EntityLivingBase) victim;
|
|
||||||
if(living.getHealth() <= 0) return;
|
|
||||||
living.setHealth(living.getHealth() - amount);
|
|
||||||
if(living.getHealth() <= 0) living.onDeath(DamageSource.magic);
|
|
||||||
player.heal(amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.vampire";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (" + amount + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class StunAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
int duration;
|
|
||||||
|
|
||||||
public StunAbility(int duration) {
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase) {
|
|
||||||
|
|
||||||
EntityLivingBase living = (EntityLivingBase) victim;
|
|
||||||
|
|
||||||
living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration * 20, 4));
|
|
||||||
living.addPotionEffect(new PotionEffect(Potion.weakness.id, duration * 20, 4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.stun";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (" + duration + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BlendAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
int divider;
|
|
||||||
|
|
||||||
public BlendAbility(int divider) {
|
|
||||||
this.divider = divider;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase) {
|
|
||||||
|
|
||||||
EntityLivingBase living = (EntityLivingBase) victim;
|
|
||||||
|
|
||||||
|
|
||||||
if(living.getHealth() <= 0.0F) {
|
|
||||||
int count = Math.min((int)Math.ceil(living.getMaxHealth() / divider), 250); //safeguard to prevent funnies from bosses with obscene health
|
|
||||||
world.playSoundEffect(living.posX, living.posY + living.height * 0.5, living.posZ, "mob.zombie.woodbreak", 0.5F, 1.0F);
|
|
||||||
victim.attackEntityFrom(ModDamageSource.turbofan, 100);
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
data.setString("type", "giblets");
|
|
||||||
data.setInteger("count", count * 4);
|
|
||||||
data.setInteger("ent", victim.getEntityId());
|
|
||||||
data.setInteger("cDiv", 5);
|
|
||||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, victim.posX, victim.posY + victim.height * 0.5, victim.posZ), new TargetPoint(victim.dimension, victim.posX, victim.posY + victim.height * 0.5, victim.posZ, 150));
|
|
||||||
living.entityDropItem(new ItemStack(ModItems.flesh, 10, 0), 0.0F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.blender";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (1:" + divider + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PhosphorusAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
int duration;
|
|
||||||
|
|
||||||
public PhosphorusAbility(int duration) {
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase) {
|
|
||||||
|
|
||||||
EntityLivingBase living = (EntityLivingBase) victim;
|
|
||||||
|
|
||||||
living.addPotionEffect(new PotionEffect(HbmPotion.phosphorus.id, duration * 20, 4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.phosphorus";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (" + duration + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class FireAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
int duration;
|
|
||||||
|
|
||||||
public FireAbility(int duration) {
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase) {
|
|
||||||
victim.setFire(duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.fire";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (" + duration + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ChainsawAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
int divider;
|
|
||||||
|
|
||||||
public ChainsawAbility(int divider) {
|
|
||||||
this.divider = divider;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase) {
|
|
||||||
|
|
||||||
EntityLivingBase living = (EntityLivingBase) victim;
|
|
||||||
|
|
||||||
if(living.getHealth() <= 0.0F) {
|
|
||||||
|
|
||||||
int count = Math.min((int)Math.ceil(living.getMaxHealth() / divider), 250); //safeguard to prevent funnies from bosses with obscene health
|
|
||||||
|
|
||||||
for(int i = 0; i < count; i++) {
|
|
||||||
living.entityDropItem(new ItemStack(ModItems.nitra_small), 1);
|
|
||||||
world.spawnEntityInWorld(new EntityXPOrb(world, living.posX, living.posY, living.posZ, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(player instanceof EntityPlayerMP) {
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
|
||||||
data.setString("type", "vanillaburst");
|
|
||||||
data.setInteger("count", count * 4);
|
|
||||||
data.setDouble("motion", 0.1D);
|
|
||||||
data.setString("mode", "blockdust");
|
|
||||||
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
|
|
||||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, living.posX, living.posY + living.height * 0.5, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
|
|
||||||
}
|
|
||||||
|
|
||||||
world.playSoundEffect(living.posX, living.posY + living.height * 0.5, living.posZ, "hbm:weapon.chainsaw", 0.5F, 1.0F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.chainsaw";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName()) + " (1:" + divider + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BeheaderAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityLivingBase && ((EntityLivingBase) victim).getHealth() <= 0.0F) {
|
|
||||||
|
|
||||||
EntityLivingBase living = (EntityLivingBase) victim;
|
|
||||||
|
|
||||||
if(living instanceof EntitySkeleton) {
|
|
||||||
|
|
||||||
if(((EntitySkeleton)living).getSkeletonType() == 0) {
|
|
||||||
living.entityDropItem(new ItemStack(Items.skull, 1, 0), 0.0F);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if(world.rand.nextInt(20) == 0)
|
|
||||||
living.entityDropItem(new ItemStack(Items.skull, 1, 1), 0.0F);
|
|
||||||
else
|
|
||||||
living.entityDropItem(new ItemStack(Items.coal, 3), 0.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if(living instanceof EntityZombie) {
|
|
||||||
living.entityDropItem(new ItemStack(Items.skull, 1, 2), 0.0F);
|
|
||||||
} else if(living instanceof EntityCreeper) {
|
|
||||||
living.entityDropItem(new ItemStack(Items.skull, 1, 4), 0.0F);
|
|
||||||
} else if(living instanceof EntityMagmaCube) {
|
|
||||||
living.entityDropItem(new ItemStack(Items.magma_cream, 3), 0.0F);
|
|
||||||
} else if(living instanceof EntitySlime) {
|
|
||||||
living.entityDropItem(new ItemStack(Items.slime_ball, 3), 0.0F);
|
|
||||||
} else if(living instanceof EntityPlayer) {
|
|
||||||
|
|
||||||
ItemStack head = new ItemStack(Items.skull, 1, 3);
|
|
||||||
head.stackTagCompound = new NBTTagCompound();
|
|
||||||
head.stackTagCompound.setString("SkullOwner", ((EntityPlayer) living).getDisplayName());
|
|
||||||
living.entityDropItem(head, 0.0F);
|
|
||||||
} else {
|
|
||||||
living.entityDropItem(new ItemStack(Items.rotten_flesh, 3, 0), 0.0F);
|
|
||||||
living.entityDropItem(new ItemStack(Items.bone, 2, 0), 0.0F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.beheader";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BobbleAbility extends WeaponAbility {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHit(World world, EntityPlayer player, Entity victim, IItemWithAbility tool) {
|
|
||||||
|
|
||||||
if(victim instanceof EntityMob && ((EntityMob) victim).getHealth() <= 0.0F) {
|
|
||||||
|
|
||||||
EntityMob mob = (EntityMob) victim;
|
|
||||||
|
|
||||||
int chance = 1000;
|
|
||||||
|
|
||||||
if(mob.getMaxHealth() > 20) {
|
|
||||||
chance = 750;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(world.rand.nextInt(chance) == 0)
|
|
||||||
mob.entityDropItem(new ItemStack(ModBlocks.bobblehead, 1, world.rand.nextInt(BobbleType.values().length - 1) + 1), 0.0F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "weapon.ability.bobble";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return I18n.format(getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,6 +4,9 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -17,10 +20,18 @@ public class AvailableAbilities {
|
|||||||
|
|
||||||
public AvailableAbilities addAbility(IBaseAbility ability, int level) {
|
public AvailableAbilities addAbility(IBaseAbility ability, int level) {
|
||||||
if (level < 0 || level >= ability.levels()) {
|
if (level < 0 || level >= ability.levels()) {
|
||||||
throw new IllegalArgumentException("Illegal level " + level + " for ability " + ability.getName());
|
MainRegistry.logger.warn("Illegal level " + level + " for ability " + ability.getName());
|
||||||
|
level = ability.levels() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abilities.containsKey(ability)) {
|
||||||
|
MainRegistry.logger.warn("Ability " + ability.getName() + " already had level " + abilities.get(ability) + ", overwriting with level " + level);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ability.isAllowed()) {
|
||||||
|
abilities.put(ability, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
abilities.put(ability, level);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +58,22 @@ public class AvailableAbilities {
|
|||||||
return Collections.unmodifiableMap(abilities);
|
return Collections.unmodifiableMap(abilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<IWeaponAbility, Integer> getWeaponAbilities() {
|
||||||
|
return abilities.keySet().stream().filter(a -> a instanceof IWeaponAbility).collect(Collectors.toMap(a -> (IWeaponAbility)a, a -> abilities.get(a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<IBaseAbility, Integer> getToolAbilities() {
|
||||||
|
return abilities.keySet().stream().filter(a -> a instanceof IToolAreaAbility || a instanceof IToolHarvestAbility).collect(Collectors.toMap(a -> a, a -> abilities.get(a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<IToolAreaAbility, Integer> getToolAreaAbilities() {
|
||||||
|
return abilities.keySet().stream().filter(a -> a instanceof IToolAreaAbility).collect(Collectors.toMap(a -> (IToolAreaAbility)a, a -> abilities.get(a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<IToolHarvestAbility, Integer> getToolHarvestAbilities() {
|
||||||
|
return abilities.keySet().stream().filter(a -> a instanceof IToolHarvestAbility).collect(Collectors.toMap(a -> (IToolHarvestAbility)a, a -> abilities.get(a)));
|
||||||
|
}
|
||||||
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return abilities.size();
|
return abilities.size();
|
||||||
}
|
}
|
||||||
@ -57,12 +84,12 @@ public class AvailableAbilities {
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(List list) {
|
public void addInformation(List list) {
|
||||||
boolean hasToolAbilities = abilities.keySet().stream().anyMatch(a -> a instanceof IToolAreaAbility || a instanceof IToolHarvestAbility);
|
Map<IBaseAbility, Integer> toolAbilities = getToolAbilities();
|
||||||
|
|
||||||
if (hasToolAbilities) {
|
if (!toolAbilities.isEmpty()) {
|
||||||
list.add("Abilities: ");
|
list.add("Abilities: ");
|
||||||
|
|
||||||
abilities.forEach((ability, level) -> {
|
toolAbilities.forEach((ability, level) -> {
|
||||||
list.add(" " + EnumChatFormatting.GOLD + ability.getFullName(level));
|
list.add(" " + EnumChatFormatting.GOLD + ability.getFullName(level));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -71,12 +98,12 @@ public class AvailableAbilities {
|
|||||||
list.add("Alt-click to open ability selection GUI!");
|
list.add("Alt-click to open ability selection GUI!");
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasWeaponModifiers = abilities.keySet().stream().anyMatch(a -> a instanceof IWeaponAbility);
|
Map<IWeaponAbility, Integer> weaponAbilities = getWeaponAbilities();
|
||||||
|
|
||||||
if (hasWeaponModifiers) {
|
if (!weaponAbilities.isEmpty()) {
|
||||||
list.add("Weapon modifiers: ");
|
list.add("Weapon modifiers: ");
|
||||||
|
|
||||||
abilities.forEach((ability, level) -> {
|
weaponAbilities.forEach((ability, level) -> {
|
||||||
list.add(" " + EnumChatFormatting.RED + ability.getFullName(level));
|
list.add(" " + EnumChatFormatting.RED + ability.getFullName(level));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import com.hbm.explosion.ExplosionNT;
|
|||||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||||
import com.hbm.handler.ThreeInts;
|
import com.hbm.handler.ThreeInts;
|
||||||
import com.hbm.inventory.OreDictManager;
|
import com.hbm.inventory.OreDictManager;
|
||||||
import com.hbm.items.tool.IItemWithAbility;
|
import com.hbm.items.tool.ItemToolAbility;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -27,18 +27,17 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
// The initial block is always implicitly broken and shouldn't be included.
|
// The initial block is always implicitly broken and shouldn't be included.
|
||||||
// If true is returned, no block breaking is handled by the tool
|
// If true is returned, no block breaking is handled by the tool
|
||||||
// (neither for the original block nor for the extras)
|
// (neither for the original block nor for the extras)
|
||||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, IItemWithAbility tool);
|
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool);
|
||||||
|
|
||||||
// region handlers
|
// region handlers
|
||||||
public static final IToolAreaAbility NONE = new IToolAreaAbility() {
|
public static final IToolAreaAbility NONE = new IToolAreaAbility() {
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
// TODO: null? empty? otherwise i18n
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, IItemWithAbility tool) {
|
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -73,7 +72,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
private Set<ThreeInts> pos = new HashSet<>();
|
private Set<ThreeInts> pos = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, IItemWithAbility tool) {
|
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||||
Block b = world.getBlock(x, y, z);
|
Block b = world.getBlock(x, y, z);
|
||||||
|
|
||||||
if(!ToolConfig.recursiveStone) {
|
if(!ToolConfig.recursiveStone) {
|
||||||
@ -112,7 +111,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private void recurse(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, IItemWithAbility tool, int depth, int radius) {
|
private void recurse(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, ItemToolAbility tool, int depth, int radius) {
|
||||||
List<ThreeInts> shuffledOffsets = new ArrayList<>(offsets);
|
List<ThreeInts> shuffledOffsets = new ArrayList<>(offsets);
|
||||||
Collections.shuffle(shuffledOffsets);
|
Collections.shuffle(shuffledOffsets);
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void breakExtra(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, IItemWithAbility tool, int depth, int radius) {
|
private void breakExtra(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, ItemToolAbility tool, int depth, int radius) {
|
||||||
if(pos.contains(new ThreeInts(x, y, z)))
|
if(pos.contains(new ThreeInts(x, y, z)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, IItemWithAbility tool) {
|
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||||
int range = rangeAtLevel[level];
|
int range = rangeAtLevel[level];
|
||||||
|
|
||||||
for(int a = x - range; a <= x + range; a++) {
|
for(int a = x - range; a <= x + range; a++) {
|
||||||
@ -233,7 +232,7 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, IItemWithAbility tool) {
|
public boolean onDig(int level, World world, int x, int y, int z, EntityPlayer player, ItemToolAbility tool) {
|
||||||
float strength = strengthAtLevel[level];
|
float strength = strengthAtLevel[level];
|
||||||
|
|
||||||
ExplosionNT ex = new ExplosionNT(player.worldObj, player, x + 0.5, y + 0.5, z + 0.5, strength);
|
ExplosionNT ex = new ExplosionNT(player.worldObj, player, x + 0.5, y + 0.5, z + 0.5, strength);
|
||||||
@ -249,4 +248,15 @@ public interface IToolAreaAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// endregion handlers
|
// endregion handlers
|
||||||
|
|
||||||
|
static final IToolAreaAbility[] abilities = {NONE, RECURSION, HAMMER, EXPLOSION};
|
||||||
|
|
||||||
|
static IToolAreaAbility getByName(String name) {
|
||||||
|
for(IToolAreaAbility ability : abilities) {
|
||||||
|
if(ability.getName().equals(name))
|
||||||
|
return ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import com.hbm.inventory.recipes.CrystallizerRecipes;
|
|||||||
import com.hbm.inventory.recipes.ShredderRecipes;
|
import com.hbm.inventory.recipes.ShredderRecipes;
|
||||||
import com.hbm.inventory.recipes.CrystallizerRecipes.CrystallizerRecipe;
|
import com.hbm.inventory.recipes.CrystallizerRecipes.CrystallizerRecipe;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.items.tool.IItemWithAbility;
|
import com.hbm.items.tool.ItemToolAbility;
|
||||||
import com.hbm.util.EnchantmentUtil;
|
import com.hbm.util.EnchantmentUtil;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -37,7 +37,7 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
|||||||
player.getHeldItem().damageItem(1, player);
|
player.getHeldItem().damageItem(1, player);
|
||||||
} else if (player instanceof EntityPlayerMP) {
|
} else if (player instanceof EntityPlayerMP) {
|
||||||
// Break the block conventionally
|
// Break the block conventionally
|
||||||
IItemWithAbility.standardDigPost(world, x, y, z, (EntityPlayerMP) player);
|
ItemToolAbility.standardDigPost(world, x, y, z, (EntityPlayerMP) player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,6 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
|||||||
public static final IToolHarvestAbility NONE = new IToolHarvestAbility() {
|
public static final IToolHarvestAbility NONE = new IToolHarvestAbility() {
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
// TODO: null? empty? otherwise i18n
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,4 +309,15 @@ public interface IToolHarvestAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// endregion handlers
|
// endregion handlers
|
||||||
|
|
||||||
|
static final IToolHarvestAbility[] abilities = {NONE, SILK, LUCK, SMELTER, SHREDDER, CENTRIFUGE, CRYSTALLIZER, MERCURY};
|
||||||
|
|
||||||
|
static IToolHarvestAbility getByName(String name) {
|
||||||
|
for(IToolHarvestAbility ability : abilities) {
|
||||||
|
if(ability.getName().equals(name))
|
||||||
|
return ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,6 @@ public interface IWeaponAbility extends IBaseAbility {
|
|||||||
public static final IWeaponAbility NONE = new IWeaponAbility() {
|
public static final IWeaponAbility NONE = new IWeaponAbility() {
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
// TODO: null? empty? otherwise i18n
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,4 +348,15 @@ public interface IWeaponAbility extends IBaseAbility {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// endregion handlers
|
// endregion handlers
|
||||||
|
|
||||||
|
static final IWeaponAbility[] abilities = {NONE, RADIATION, VAMPIRE, STUN, BLEND, PHOSPHORUS, FIRE, CHAINSAW, BEHEADER, BOBBLE};
|
||||||
|
|
||||||
|
static IWeaponAbility getByName(String name) {
|
||||||
|
for(IWeaponAbility ability : abilities) {
|
||||||
|
if(ability.getName().equals(name))
|
||||||
|
return ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
package com.hbm.handler.ability;
|
package com.hbm.handler.ability;
|
||||||
|
|
||||||
|
import com.hbm.util.ChatBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
public class ToolPreset {
|
public class ToolPreset {
|
||||||
public IToolAreaAbility areaAbility = IToolAreaAbility.NONE;
|
public IToolAreaAbility areaAbility = IToolAreaAbility.NONE;
|
||||||
public int areaAbilityLevel = 0;
|
public int areaAbilityLevel = 0;
|
||||||
@ -20,19 +26,69 @@ public class ToolPreset {
|
|||||||
this.harvestAbilityLevel = harvestAbilityLevel;
|
this.harvestAbilityLevel = harvestAbilityLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public ChatComponentText getMessage() {
|
||||||
|
if (isNone())
|
||||||
|
return ChatBuilder.start("[Tool ability deactivated]").color(EnumChatFormatting.GOLD).flush();
|
||||||
|
|
||||||
String areaPart = areaAbility.getFullName(areaAbilityLevel);
|
String areaPart = areaAbility.getFullName(areaAbilityLevel);
|
||||||
String harvestPart = harvestAbility.getFullName(harvestAbilityLevel);
|
String harvestPart = harvestAbility.getFullName(harvestAbilityLevel);
|
||||||
|
|
||||||
if (harvestPart.isEmpty() && areaPart.isEmpty())
|
ChatBuilder builder = ChatBuilder.start("[Enabled ");
|
||||||
return "[Tool ability deactivated]";
|
|
||||||
|
|
||||||
if (harvestPart.isEmpty())
|
if (!areaPart.isEmpty())
|
||||||
return "[Enabled " + areaPart + "]";
|
builder.next(areaPart);
|
||||||
|
|
||||||
if (areaPart.isEmpty())
|
if (!areaPart.isEmpty() && !harvestPart.isEmpty())
|
||||||
return "[Enabled " + harvestPart + "]";
|
builder.next(" + ");
|
||||||
|
|
||||||
return "[Enabled " + areaPart + " + " + harvestPart + "]";
|
if (!harvestPart.isEmpty())
|
||||||
|
builder.next(harvestPart);
|
||||||
|
|
||||||
|
return builder.colorAll(EnumChatFormatting.YELLOW).flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNone() {
|
||||||
|
return areaAbility == IToolAreaAbility.NONE && harvestAbility == IToolHarvestAbility.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
|
nbt.setString("area", areaAbility.getName());
|
||||||
|
nbt.setInteger("areaLevel", areaAbilityLevel);
|
||||||
|
nbt.setString("harvest", harvestAbility.getName());
|
||||||
|
nbt.setInteger("harvestLevel", harvestAbilityLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
areaAbility = IToolAreaAbility.getByName(nbt.getString("area"));
|
||||||
|
areaAbilityLevel = nbt.getInteger("areaLevel");
|
||||||
|
harvestAbility = IToolHarvestAbility.getByName(nbt.getString("harvest"));
|
||||||
|
harvestAbilityLevel = nbt.getInteger("harvestLevel");
|
||||||
|
|
||||||
|
areaAbilityLevel = Math.min(areaAbilityLevel, areaAbility.levels() - 1);
|
||||||
|
harvestAbilityLevel = Math.min(harvestAbilityLevel, harvestAbility.levels() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restrictTo(AvailableAbilities availableAbilities) {
|
||||||
|
int maxAreaLevel = availableAbilities.maxLevel(areaAbility);
|
||||||
|
|
||||||
|
if (maxAreaLevel == -1) {
|
||||||
|
areaAbility = IToolAreaAbility.NONE;
|
||||||
|
areaAbilityLevel = 0;
|
||||||
|
} else if (areaAbilityLevel > maxAreaLevel) {
|
||||||
|
areaAbilityLevel = maxAreaLevel;
|
||||||
|
} else if (areaAbilityLevel < 0) {
|
||||||
|
areaAbilityLevel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxHarvestLevel = availableAbilities.maxLevel(harvestAbility);
|
||||||
|
|
||||||
|
if (maxHarvestLevel == -1) {
|
||||||
|
harvestAbility = IToolHarvestAbility.NONE;
|
||||||
|
harvestAbilityLevel = 0;
|
||||||
|
} else if (harvestAbilityLevel > maxHarvestLevel) {
|
||||||
|
harvestAbilityLevel = maxHarvestLevel;
|
||||||
|
} else if (harvestAbilityLevel < 0) {
|
||||||
|
harvestAbilityLevel = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,14 +6,20 @@ import java.util.List;
|
|||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.handler.ability.AvailableAbilities;
|
||||||
import com.hbm.handler.ability.IBaseAbility;
|
import com.hbm.handler.ability.IBaseAbility;
|
||||||
import com.hbm.handler.ability.IToolAreaAbility;
|
import com.hbm.handler.ability.IToolAreaAbility;
|
||||||
import com.hbm.handler.ability.IToolHarvestAbility;
|
import com.hbm.handler.ability.IToolHarvestAbility;
|
||||||
import com.hbm.handler.ability.ToolPreset;
|
import com.hbm.handler.ability.ToolPreset;
|
||||||
import com.hbm.items.tool.ItemToolAbility;
|
import com.hbm.items.tool.ItemToolAbility;
|
||||||
|
import com.hbm.items.tool.ItemToolAbility.Configuration;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
import com.hbm.packet.toclient.PlayerInformPacket;
|
||||||
import com.hbm.util.EnumUtil;
|
import com.hbm.util.EnumUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
import com.hbm.util.Tuple.Pair;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
@ -32,9 +38,6 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
protected int ySize;
|
protected int ySize;
|
||||||
protected int insetWidth;
|
protected int insetWidth;
|
||||||
|
|
||||||
protected ItemToolAbility toolDef;
|
|
||||||
protected ItemStack toolStack;
|
|
||||||
|
|
||||||
public static class AbilityInfo {
|
public static class AbilityInfo {
|
||||||
public IBaseAbility ability;
|
public IBaseAbility ability;
|
||||||
public int textureU, textureV;
|
public int textureU, textureV;
|
||||||
@ -65,23 +68,19 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.MERCURY, 224, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.MERCURY, 224, 107));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: availability status for abilities; list of presets; selected preset index;
|
// TODO: Use availableAbilities
|
||||||
// TODO: Remove this in favor of current preset
|
protected ItemStack toolStack;
|
||||||
int selectionIdxArea = 0;
|
AvailableAbilities availableAbilities;
|
||||||
int selectedLevelArea = 0;
|
ItemToolAbility.Configuration config;
|
||||||
int selectionIdxHarvest = 0;
|
|
||||||
int selectedLevelHarvest = 0;
|
|
||||||
int selectedPreset = 0;
|
|
||||||
int totalPresets = 1;
|
|
||||||
|
|
||||||
int hoverIdxArea = -1;
|
int hoverIdxArea = -1;
|
||||||
int hoverIdxHarvest = -1;
|
int hoverIdxHarvest = -1;
|
||||||
int hoverIdxExtraBtn = -1;
|
int hoverIdxExtraBtn = -1;
|
||||||
|
|
||||||
public GUIScreenToolAbility(ItemToolAbility toolDef) {
|
public GUIScreenToolAbility(AvailableAbilities availableAbilities) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.toolDef = toolDef;
|
this.availableAbilities = availableAbilities;
|
||||||
this.xSize = 186; // Note: increased dynamically
|
this.xSize = 186; // Note: increased dynamically
|
||||||
this.ySize = 76;
|
this.ySize = 76;
|
||||||
|
|
||||||
@ -112,12 +111,13 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 76);
|
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 76);
|
||||||
|
|
||||||
// Draw the switches
|
// Draw the switches
|
||||||
hoverIdxArea = drawSwitches(abilitiesArea, selectionIdxArea, selectedLevelArea, guiLeft + 15, guiTop + 25, mouseX, mouseY);
|
ToolPreset activePreset = config.getActivePreset();
|
||||||
hoverIdxHarvest = drawSwitches(abilitiesHarvest, selectionIdxHarvest, selectedLevelHarvest, guiLeft + 15, guiTop + 45, mouseX, mouseY);
|
hoverIdxArea = drawSwitches(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, guiLeft + 15, guiTop + 25, mouseX, mouseY);
|
||||||
|
hoverIdxHarvest = drawSwitches(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, guiLeft + 15, guiTop + 45, mouseX, mouseY);
|
||||||
|
|
||||||
// Draw preset indicator
|
// Draw preset indicator
|
||||||
drawNumber(selectedPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
|
drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
|
||||||
drawNumber(totalPresets, guiLeft + insetWidth + 149, guiTop + 25);
|
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25);
|
||||||
|
|
||||||
// Draw extra buttons hover highlights
|
// Draw extra buttons hover highlights
|
||||||
int extraBtnsX = guiLeft + xSize - 86;
|
int extraBtnsX = guiLeft + xSize - 86;
|
||||||
@ -135,14 +135,14 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
|
|
||||||
if (hoverIdxArea != -1) {
|
if (hoverIdxArea != -1) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
if (hoverIdxArea == selectionIdxArea) {
|
if (abilitiesArea.get(hoverIdxArea).ability == activePreset.areaAbility) {
|
||||||
level = selectedLevelArea;
|
level = activePreset.areaAbilityLevel;
|
||||||
}
|
}
|
||||||
tooltipValue = abilitiesArea.get(hoverIdxArea).ability.getFullName(level);
|
tooltipValue = abilitiesArea.get(hoverIdxArea).ability.getFullName(level);
|
||||||
} else if (hoverIdxHarvest != -1) {
|
} else if (hoverIdxHarvest != -1) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
if (hoverIdxHarvest == selectionIdxHarvest) {
|
if (abilitiesHarvest.get(hoverIdxHarvest).ability == activePreset.harvestAbility) {
|
||||||
level = selectedLevelHarvest;
|
level = activePreset.harvestAbilityLevel;
|
||||||
}
|
}
|
||||||
tooltipValue = abilitiesHarvest.get(hoverIdxHarvest).ability.getFullName(level);
|
tooltipValue = abilitiesHarvest.get(hoverIdxHarvest).ability.getFullName(level);
|
||||||
} else if (hoverIdxExtraBtn != -1) {
|
} else if (hoverIdxExtraBtn != -1) {
|
||||||
@ -176,12 +176,13 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
drawTexturedModalRect(x + keepLeft + realMidWidth, y, u + keepLeft + midWidth, v, keepRight, height);
|
drawTexturedModalRect(x + keepLeft + realMidWidth, y, u + keepLeft + midWidth, v, keepRight, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int drawSwitches(List<AbilityInfo> abilities, int selectionIdx, int selectedLevel, int x, int y, int mouseX, int mouseY) {
|
protected int drawSwitches(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int x, int y, int mouseX, int mouseY) {
|
||||||
int hoverIdx = -1;
|
int hoverIdx = -1;
|
||||||
|
|
||||||
for (int i = 0; i < abilities.size(); ++i) {
|
for (int i = 0; i < abilities.size(); ++i) {
|
||||||
AbilityInfo abilityInfo = abilities.get(i);
|
AbilityInfo abilityInfo = abilities.get(i);
|
||||||
boolean available = true; // TODO
|
boolean available = availableAbilities.supportsAbility(abilityInfo.ability);
|
||||||
|
boolean selected = abilityInfo.ability == selectedAbility;
|
||||||
|
|
||||||
// Draw switch
|
// Draw switch
|
||||||
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16);
|
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16);
|
||||||
@ -190,11 +191,11 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
if (abilityInfo.ability.levels() > 1) {
|
if (abilityInfo.ability.levels() > 1) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
if (i == selectionIdx) {
|
if (selected) {
|
||||||
level = selectedLevel + 1;
|
level = selectedLevel + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Max allowed level instead?
|
// Note: only visual effect for the LEDs
|
||||||
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
|
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
|
||||||
int maxLevel = 5;
|
int maxLevel = 5;
|
||||||
|
|
||||||
@ -212,7 +213,7 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
hoverIdx = i;
|
hoverIdx = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == selectionIdx) {
|
if (selected) {
|
||||||
// Draw selection highlight
|
// Draw selection highlight
|
||||||
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18);
|
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18);
|
||||||
} else if (available && isHovered) {
|
} else if (available && isHovered) {
|
||||||
@ -242,7 +243,7 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
public void updateScreen() {
|
public void updateScreen() {
|
||||||
EntityPlayer player = this.mc.thePlayer;
|
EntityPlayer player = this.mc.thePlayer;
|
||||||
|
|
||||||
if(player.getHeldItem() == null || player.getHeldItem().getItem() != toolDef)
|
if(player.getHeldItem() == null || player.getHeldItem() != toolStack)
|
||||||
player.closeScreen();
|
player.closeScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,77 +254,29 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
if(Mouse.getEventButton() == -1) {
|
if(Mouse.getEventButton() == -1) {
|
||||||
int scroll = Mouse.getEventDWheel();
|
int scroll = Mouse.getEventDWheel();
|
||||||
|
|
||||||
if(scroll < 0 && selectedPreset > 0) selectedPreset -= 1;
|
if(scroll < 0) doPrevPreset(true);
|
||||||
if(scroll > 0 && selectedPreset < totalPresets - 1) selectedPreset += 1;
|
if(scroll > 0) doNextPreset(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int button) {
|
protected void mouseClicked(int mouseX, int mouseY, int button) {
|
||||||
|
ToolPreset activePreset = config.getActivePreset();
|
||||||
|
|
||||||
// Process switches
|
// Process switches
|
||||||
// TODO: Encapsulate in a method
|
handleSwitchesClicked(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, hoverIdxArea, mouseX, mouseY);
|
||||||
if (hoverIdxArea != -1) {
|
handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY);
|
||||||
boolean available = true; // TODO
|
|
||||||
|
|
||||||
if (available) {
|
|
||||||
int availableLevels = abilitiesArea.get(hoverIdxArea).ability.levels();
|
|
||||||
|
|
||||||
if (hoverIdxArea != selectionIdxArea || availableLevels > 1) {
|
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hoverIdxArea == selectionIdxArea) {
|
|
||||||
selectedLevelArea = (selectedLevelArea + 1) % availableLevels;
|
|
||||||
} else {
|
|
||||||
selectedLevelArea = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectionIdxArea = hoverIdxArea;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hoverIdxHarvest != -1) {
|
|
||||||
boolean available = true; // TODO
|
|
||||||
|
|
||||||
if (available) {
|
|
||||||
int availableLevels = abilitiesHarvest.get(hoverIdxHarvest).ability.levels();
|
|
||||||
|
|
||||||
if (hoverIdxHarvest == selectionIdxHarvest) {
|
|
||||||
selectedLevelHarvest = (selectedLevelHarvest + 1) % availableLevels;
|
|
||||||
} else {
|
|
||||||
selectedLevelHarvest = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectionIdxHarvest = hoverIdxHarvest;
|
|
||||||
|
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process extra buttons
|
// Process extra buttons
|
||||||
if (hoverIdxExtraBtn != -1) {
|
if (hoverIdxExtraBtn != -1) {
|
||||||
switch (hoverIdxExtraBtn) {
|
switch (hoverIdxExtraBtn) {
|
||||||
case 0:
|
case 0: doResetPresets(); break;
|
||||||
doResetPresets();
|
case 1: doDelPreset(); break;
|
||||||
break;
|
case 2: doAddPreset(); break;
|
||||||
case 1:
|
case 3: doZeroPreset(); break;
|
||||||
doDelPreset();
|
case 4: doNextPreset(false); break;
|
||||||
break;
|
case 5: doPrevPreset(false); break;
|
||||||
case 2:
|
case 6: doClose(); break;
|
||||||
doAddPreset();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
doZeroPreset();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
doNextPreset();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
doPrevPreset();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
doClose();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
|
||||||
@ -335,6 +288,31 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Pair<IBaseAbility, Integer> handleSwitchesClicked(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int hoverIdx, int mouseX, int mouseY) {
|
||||||
|
if (hoverIdx != -1) {
|
||||||
|
IBaseAbility hoveredAbility = abilities.get(hoverIdx).ability;
|
||||||
|
boolean available = availableAbilities.supportsAbility(hoveredAbility);
|
||||||
|
|
||||||
|
if (available) {
|
||||||
|
int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1;
|
||||||
|
|
||||||
|
if (hoveredAbility != selectedAbility || availableLevels > 1) {
|
||||||
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hoveredAbility == selectedAbility) {
|
||||||
|
selectedLevel = (selectedLevel + 1) % availableLevels;
|
||||||
|
} else {
|
||||||
|
selectedLevel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedAbility = hoveredAbility;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Pair<>(selectedAbility, selectedLevel);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char c, int key) {
|
protected void keyTyped(char c, int key) {
|
||||||
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||||
@ -351,46 +329,51 @@ public class GUIScreenToolAbility extends GuiScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void doResetPresets() {
|
protected void doResetPresets() {
|
||||||
// TODO
|
config.reset(availableAbilities);
|
||||||
totalPresets = 1;
|
|
||||||
selectedPreset = 0;
|
|
||||||
selectionIdxArea = 0;
|
|
||||||
selectedLevelArea = 0;
|
|
||||||
selectionIdxHarvest = 0;
|
|
||||||
selectedLevelHarvest = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doDelPreset() {
|
protected void doDelPreset() {
|
||||||
// TODO
|
if (config.presets.size() <= 1) {
|
||||||
if (totalPresets <= 1) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
totalPresets -= 1;
|
config.presets.remove(config.currentPreset);
|
||||||
selectedPreset -= 1;
|
config.currentPreset = Math.min(config.currentPreset, config.presets.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAddPreset() {
|
protected void doAddPreset() {
|
||||||
// TODO
|
config.presets.add(config.currentPreset + 1, new ToolPreset());
|
||||||
totalPresets += 1;
|
config.currentPreset += 1;
|
||||||
selectedPreset += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doZeroPreset() {
|
protected void doZeroPreset() {
|
||||||
// TODO
|
config.currentPreset = 0;
|
||||||
selectedPreset = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doNextPreset() {
|
protected void doNextPreset(boolean bound) {
|
||||||
// TODO
|
if (bound) {
|
||||||
selectedPreset = (selectedPreset + 1) % totalPresets;
|
if (config.currentPreset < config.presets.size() - 1) {
|
||||||
|
config.currentPreset += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
config.currentPreset = (config.currentPreset + 1) % config.presets.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doPrevPreset() {
|
protected void doPrevPreset(boolean bound) {
|
||||||
// TODO
|
if (bound) {
|
||||||
selectedPreset = (selectedPreset + totalPresets - 1) % totalPresets;
|
if (config.currentPreset > 0) {
|
||||||
|
config.currentPreset -= 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
config.currentPreset = (config.currentPreset + config.presets.size() - 1) % config.presets.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doClose() {
|
protected void doClose() {
|
||||||
this.mc.thePlayer.closeScreen();
|
this.mc.thePlayer.closeScreen();
|
||||||
|
|
||||||
|
MainRegistry.proxy.displayTooltip(config.getActivePreset().getMessage().getFormattedText(), MainRegistry.proxy.ID_TOOLABILITY);
|
||||||
|
|
||||||
|
this.mc.theWorld.playSoundAtEntity(this.mc.thePlayer, "random.orb", 0.25F, config.getActivePreset().isNone() ? 0.75F : 1.25F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,10 +3,9 @@ package com.hbm.items;
|
|||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.config.VersatileConfig;
|
import com.hbm.config.VersatileConfig;
|
||||||
import com.hbm.handler.BucketHandler;
|
import com.hbm.handler.BucketHandler;
|
||||||
import com.hbm.handler.ToolAbility;
|
import com.hbm.handler.ability.IToolAreaAbility;
|
||||||
import com.hbm.handler.ToolAbility.LuckAbility;
|
import com.hbm.handler.ability.IToolHarvestAbility;
|
||||||
import com.hbm.handler.ability.IWeaponAbility;
|
import com.hbm.handler.ability.IWeaponAbility;
|
||||||
import com.hbm.handler.WeaponAbility;
|
|
||||||
import com.hbm.handler.guncfg.*;
|
import com.hbm.handler.guncfg.*;
|
||||||
import com.hbm.interfaces.ICustomWarhead.SaltedFuel.HalfLifeType;
|
import com.hbm.interfaces.ICustomWarhead.SaltedFuel.HalfLifeType;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -4475,45 +4474,45 @@ public class ModItems {
|
|||||||
|
|
||||||
chainsaw = new ItemChainsaw(25, -0.05, MainRegistry.tMatChainsaw, EnumToolType.AXE, 5000, 1, 250,
|
chainsaw = new ItemChainsaw(25, -0.05, MainRegistry.tMatChainsaw, EnumToolType.AXE, 5000, 1, 250,
|
||||||
Fluids.DIESEL, Fluids.DIESEL_CRACK, Fluids.KEROSENE, Fluids.BIOFUEL, Fluids.GASOLINE, Fluids.GASOLINE_LEADED, Fluids.PETROIL, Fluids.PETROIL_LEADED, Fluids.COALGAS, Fluids.COALGAS_LEADED)
|
Fluids.DIESEL, Fluids.DIESEL_CRACK, Fluids.KEROSENE, Fluids.BIOFUEL, Fluids.GASOLINE, Fluids.GASOLINE_LEADED, Fluids.PETROIL, Fluids.PETROIL_LEADED, Fluids.COALGAS, Fluids.COALGAS_LEADED)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addHitAbility(new WeaponAbility.ChainsawAbility(10))
|
.addAbility(IWeaponAbility.CHAINSAW, 1)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setShears().setUnlocalizedName("chainsaw").setTextureName(RefStrings.MODID + ":chainsaw");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setShears().setUnlocalizedName("chainsaw").setTextureName(RefStrings.MODID + ":chainsaw");
|
||||||
|
|
||||||
schrabidium_sword = new ItemSwordAbility(75, 0, MainRegistry.tMatSchrab)
|
schrabidium_sword = new ItemSwordAbility(75, 0, MainRegistry.tMatSchrab)
|
||||||
.addHitAbility(IWeaponAbility.RADIATION, 1)
|
.addAbility(IWeaponAbility.RADIATION, 1)
|
||||||
.addHitAbility(IWeaponAbility.VAMPIRE, 0)
|
.addAbility(IWeaponAbility.VAMPIRE, 0)
|
||||||
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_sword").setTextureName(RefStrings.MODID + ":schrabidium_sword");
|
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_sword").setTextureName(RefStrings.MODID + ":schrabidium_sword");
|
||||||
|
|
||||||
schrabidium_pickaxe = new ItemToolAbility(20, 0, MainRegistry.tMatSchrab, EnumToolType.PICKAXE)
|
schrabidium_pickaxe = new ItemToolAbility(20, 0, MainRegistry.tMatSchrab, EnumToolType.PICKAXE)
|
||||||
.addHitAbility(new WeaponAbility.RadiationAbility(15F))
|
.addAbility(IWeaponAbility.RADIATION, 0)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(10))
|
.addAbility(IToolAreaAbility.RECURSION, 6)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(5))
|
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_pickaxe").setTextureName(RefStrings.MODID + ":schrabidium_pickaxe");
|
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_pickaxe").setTextureName(RefStrings.MODID + ":schrabidium_pickaxe");
|
||||||
|
|
||||||
schrabidium_axe = new ItemToolAbility(25, 0, MainRegistry.tMatSchrab, EnumToolType.AXE)
|
schrabidium_axe = new ItemToolAbility(25, 0, MainRegistry.tMatSchrab, EnumToolType.AXE)
|
||||||
.addHitAbility(new WeaponAbility.RadiationAbility(15F))
|
.addAbility(IWeaponAbility.RADIATION, 0)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(10))
|
.addAbility(IToolAreaAbility.RECURSION, 6)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(5))
|
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility())
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_axe").setTextureName(RefStrings.MODID + ":schrabidium_axe");
|
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_axe").setTextureName(RefStrings.MODID + ":schrabidium_axe");
|
||||||
|
|
||||||
schrabidium_shovel = new ItemToolAbility(15, 0, MainRegistry.tMatSchrab, EnumToolType.SHOVEL)
|
schrabidium_shovel = new ItemToolAbility(15, 0, MainRegistry.tMatSchrab, EnumToolType.SHOVEL)
|
||||||
.addHitAbility(new WeaponAbility.RadiationAbility(15F))
|
.addAbility(IWeaponAbility.RADIATION, 0)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(10))
|
.addAbility(IToolAreaAbility.RECURSION, 6)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(5))
|
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_shovel").setTextureName(RefStrings.MODID + ":schrabidium_shovel");
|
.setRarity(EnumRarity.rare).setUnlocalizedName("schrabidium_shovel").setTextureName(RefStrings.MODID + ":schrabidium_shovel");
|
||||||
|
|
||||||
schrabidium_hoe = new HoeSchrabidium(MainRegistry.tMatSchrab).setUnlocalizedName("schrabidium_hoe").setTextureName(RefStrings.MODID + ":schrabidium_hoe");
|
schrabidium_hoe = new HoeSchrabidium(MainRegistry.tMatSchrab).setUnlocalizedName("schrabidium_hoe").setTextureName(RefStrings.MODID + ":schrabidium_hoe");
|
||||||
@ -4521,294 +4520,282 @@ public class ModItems {
|
|||||||
titanium_sword = new ItemSwordAbility(6.5F, 0, MainRegistry.tMatTitan).setUnlocalizedName("titanium_sword").setTextureName(RefStrings.MODID + ":titanium_sword");
|
titanium_sword = new ItemSwordAbility(6.5F, 0, MainRegistry.tMatTitan).setUnlocalizedName("titanium_sword").setTextureName(RefStrings.MODID + ":titanium_sword");
|
||||||
titanium_pickaxe = new ItemToolAbility(4.5F, 0, MainRegistry.tMatTitan, EnumToolType.PICKAXE).setUnlocalizedName("titanium_pickaxe").setTextureName(RefStrings.MODID + ":titanium_pickaxe");
|
titanium_pickaxe = new ItemToolAbility(4.5F, 0, MainRegistry.tMatTitan, EnumToolType.PICKAXE).setUnlocalizedName("titanium_pickaxe").setTextureName(RefStrings.MODID + ":titanium_pickaxe");
|
||||||
titanium_axe = new ItemToolAbility(5.5F, 0, MainRegistry.tMatTitan, EnumToolType.AXE)
|
titanium_axe = new ItemToolAbility(5.5F, 0, MainRegistry.tMatTitan, EnumToolType.AXE)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("titanium_axe").setTextureName(RefStrings.MODID + ":titanium_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("titanium_axe").setTextureName(RefStrings.MODID + ":titanium_axe");
|
||||||
titanium_shovel = new ItemToolAbility(3.5F, 0, MainRegistry.tMatTitan, EnumToolType.SHOVEL).setUnlocalizedName("titanium_shovel").setTextureName(RefStrings.MODID + ":titanium_shovel");
|
titanium_shovel = new ItemToolAbility(3.5F, 0, MainRegistry.tMatTitan, EnumToolType.SHOVEL).setUnlocalizedName("titanium_shovel").setTextureName(RefStrings.MODID + ":titanium_shovel");
|
||||||
titanium_hoe = new ModHoe(MainRegistry.tMatTitan).setUnlocalizedName("titanium_hoe").setTextureName(RefStrings.MODID + ":titanium_hoe");
|
titanium_hoe = new ModHoe(MainRegistry.tMatTitan).setUnlocalizedName("titanium_hoe").setTextureName(RefStrings.MODID + ":titanium_hoe");
|
||||||
steel_sword = new ItemSwordAbility(6F, 0, MainRegistry.tMatSteel).setUnlocalizedName("steel_sword").setTextureName(RefStrings.MODID + ":steel_sword");
|
steel_sword = new ItemSwordAbility(6F, 0, MainRegistry.tMatSteel).setUnlocalizedName("steel_sword").setTextureName(RefStrings.MODID + ":steel_sword");
|
||||||
steel_pickaxe = new ItemToolAbility(4F, 0, MainRegistry.tMatSteel, EnumToolType.PICKAXE).setUnlocalizedName("steel_pickaxe").setTextureName(RefStrings.MODID + ":steel_pickaxe");
|
steel_pickaxe = new ItemToolAbility(4F, 0, MainRegistry.tMatSteel, EnumToolType.PICKAXE).setUnlocalizedName("steel_pickaxe").setTextureName(RefStrings.MODID + ":steel_pickaxe");
|
||||||
steel_axe = new ItemToolAbility(5F, 0, MainRegistry.tMatSteel, EnumToolType.AXE)
|
steel_axe = new ItemToolAbility(5F, 0, MainRegistry.tMatSteel, EnumToolType.AXE)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("steel_axe").setTextureName(RefStrings.MODID + ":steel_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("steel_axe").setTextureName(RefStrings.MODID + ":steel_axe");
|
||||||
steel_shovel = new ItemToolAbility(3F, 0, MainRegistry.tMatSteel, EnumToolType.SHOVEL).setUnlocalizedName("steel_shovel").setTextureName(RefStrings.MODID + ":steel_shovel");
|
steel_shovel = new ItemToolAbility(3F, 0, MainRegistry.tMatSteel, EnumToolType.SHOVEL).setUnlocalizedName("steel_shovel").setTextureName(RefStrings.MODID + ":steel_shovel");
|
||||||
steel_hoe = new ModHoe(MainRegistry.tMatSteel).setUnlocalizedName("steel_hoe").setTextureName(RefStrings.MODID + ":steel_hoe");
|
steel_hoe = new ModHoe(MainRegistry.tMatSteel).setUnlocalizedName("steel_hoe").setTextureName(RefStrings.MODID + ":steel_hoe");
|
||||||
|
|
||||||
alloy_sword = new ItemSwordAbility(8F, 0, MainRegistry.tMatAlloy)
|
alloy_sword = new ItemSwordAbility(8F, 0, MainRegistry.tMatAlloy)
|
||||||
.addHitAbility(IWeaponAbility.STUN, 0).setUnlocalizedName("alloy_sword").setTextureName(RefStrings.MODID + ":alloy_sword");
|
.addAbility(IWeaponAbility.STUN, 0).setUnlocalizedName("alloy_sword").setTextureName(RefStrings.MODID + ":alloy_sword");
|
||||||
|
|
||||||
alloy_pickaxe = new ItemToolAbility(5F, 0, MainRegistry.tMatAlloy, EnumToolType.PICKAXE)
|
alloy_pickaxe = new ItemToolAbility(5F, 0, MainRegistry.tMatAlloy, EnumToolType.PICKAXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(3)).setUnlocalizedName("alloy_pickaxe").setTextureName(RefStrings.MODID + ":alloy_pickaxe");
|
.addAbility(IToolAreaAbility.RECURSION, 0).setUnlocalizedName("alloy_pickaxe").setTextureName(RefStrings.MODID + ":alloy_pickaxe");
|
||||||
|
|
||||||
alloy_axe = new ItemToolAbility(7F, 0, MainRegistry.tMatAlloy, EnumToolType.AXE)
|
alloy_axe = new ItemToolAbility(7F, 0, MainRegistry.tMatAlloy, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(3))
|
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("alloy_axe").setTextureName(RefStrings.MODID + ":alloy_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("alloy_axe").setTextureName(RefStrings.MODID + ":alloy_axe");
|
||||||
|
|
||||||
alloy_shovel = new ItemToolAbility(4F, 0, MainRegistry.tMatAlloy, EnumToolType.SHOVEL)
|
alloy_shovel = new ItemToolAbility(4F, 0, MainRegistry.tMatAlloy, EnumToolType.SHOVEL)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(3)).setUnlocalizedName("alloy_shovel").setTextureName(RefStrings.MODID + ":alloy_shovel");
|
.addAbility(IToolAreaAbility.RECURSION, 0).setUnlocalizedName("alloy_shovel").setTextureName(RefStrings.MODID + ":alloy_shovel");
|
||||||
|
|
||||||
alloy_hoe = new ModHoe(MainRegistry.tMatAlloy).setUnlocalizedName("alloy_hoe").setTextureName(RefStrings.MODID + ":alloy_hoe");
|
alloy_hoe = new ModHoe(MainRegistry.tMatAlloy).setUnlocalizedName("alloy_hoe").setTextureName(RefStrings.MODID + ":alloy_hoe");
|
||||||
|
|
||||||
cmb_sword = new ItemSwordAbility(35F, 0, MainRegistry.tMatCMB)
|
cmb_sword = new ItemSwordAbility(35F, 0, MainRegistry.tMatCMB)
|
||||||
.addHitAbility(IWeaponAbility.STUN, 0)
|
.addAbility(IWeaponAbility.STUN, 0)
|
||||||
.addHitAbility(IWeaponAbility.VAMPIRE, 0).setUnlocalizedName("cmb_sword").setTextureName(RefStrings.MODID + ":cmb_sword");
|
.addAbility(IWeaponAbility.VAMPIRE, 0).setUnlocalizedName("cmb_sword").setTextureName(RefStrings.MODID + ":cmb_sword");
|
||||||
|
|
||||||
cmb_pickaxe = new ItemToolAbility(10F, 0, MainRegistry.tMatCMB, EnumToolType.PICKAXE)
|
cmb_pickaxe = new ItemToolAbility(10F, 0, MainRegistry.tMatCMB, EnumToolType.PICKAXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(3)).setUnlocalizedName("cmb_pickaxe").setTextureName(RefStrings.MODID + ":cmb_pickaxe");
|
.addAbility(IToolHarvestAbility.LUCK, 2).setUnlocalizedName("cmb_pickaxe").setTextureName(RefStrings.MODID + ":cmb_pickaxe");
|
||||||
|
|
||||||
cmb_axe = new ItemToolAbility(30F, 0, MainRegistry.tMatCMB, EnumToolType.AXE)
|
cmb_axe = new ItemToolAbility(30F, 0, MainRegistry.tMatCMB, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(3))
|
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("cmb_axe").setTextureName(RefStrings.MODID + ":cmb_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("cmb_axe").setTextureName(RefStrings.MODID + ":cmb_axe");
|
||||||
|
|
||||||
cmb_shovel = new ItemToolAbility(8F, 0, MainRegistry.tMatCMB, EnumToolType.SHOVEL)
|
cmb_shovel = new ItemToolAbility(8F, 0, MainRegistry.tMatCMB, EnumToolType.SHOVEL)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(3)).setUnlocalizedName("cmb_shovel").setTextureName(RefStrings.MODID + ":cmb_shovel");
|
.addAbility(IToolHarvestAbility.LUCK, 2).setUnlocalizedName("cmb_shovel").setTextureName(RefStrings.MODID + ":cmb_shovel");
|
||||||
|
|
||||||
cmb_hoe = new ModHoe(MainRegistry.tMatCMB).setUnlocalizedName("cmb_hoe").setTextureName(RefStrings.MODID + ":cmb_hoe");
|
cmb_hoe = new ModHoe(MainRegistry.tMatCMB).setUnlocalizedName("cmb_hoe").setTextureName(RefStrings.MODID + ":cmb_hoe");
|
||||||
|
|
||||||
elec_sword = new ItemSwordAbilityPower(12.5F, 0, MainRegistry.tMatElec, 500000, 1000, 100)
|
elec_sword = new ItemSwordAbilityPower(12.5F, 0, MainRegistry.tMatElec, 500000, 1000, 100)
|
||||||
.addHitAbility(IWeaponAbility.STUN, 2).setUnlocalizedName("elec_sword").setTextureName(RefStrings.MODID + ":elec_sword_anim");
|
.addAbility(IWeaponAbility.STUN, 2).setUnlocalizedName("elec_sword").setTextureName(RefStrings.MODID + ":elec_sword_anim");
|
||||||
|
|
||||||
elec_pickaxe = new ItemToolAbilityPower(6F, 0, MainRegistry.tMatElec, EnumToolType.PICKAXE, 500000, 1000, 100)
|
elec_pickaxe = new ItemToolAbilityPower(6F, 0, MainRegistry.tMatElec, EnumToolType.PICKAXE, 500000, 1000, 100)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(2)).setUnlocalizedName("elec_pickaxe").setTextureName(RefStrings.MODID + ":elec_drill_anim");
|
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("elec_pickaxe").setTextureName(RefStrings.MODID + ":elec_drill_anim");
|
||||||
|
|
||||||
elec_axe = new ItemToolAbilityPower(10F, 0, MainRegistry.tMatElec, EnumToolType.AXE, 500000, 1000, 100)
|
elec_axe = new ItemToolAbilityPower(10F, 0, MainRegistry.tMatElec, EnumToolType.AXE, 500000, 1000, 100)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(2))
|
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||||
.addHitAbility(new WeaponAbility.ChainsawAbility(15))
|
.addAbility(IWeaponAbility.CHAINSAW, 0)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setShears().setUnlocalizedName("elec_axe").setTextureName(RefStrings.MODID + ":elec_chainsaw_anim");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setShears().setUnlocalizedName("elec_axe").setTextureName(RefStrings.MODID + ":elec_chainsaw_anim");
|
||||||
|
|
||||||
elec_shovel = new ItemToolAbilityPower(5F, 0, MainRegistry.tMatElec, EnumToolType.SHOVEL, 500000, 1000, 100)
|
elec_shovel = new ItemToolAbilityPower(5F, 0, MainRegistry.tMatElec, EnumToolType.SHOVEL, 500000, 1000, 100)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(2)).setUnlocalizedName("elec_shovel").setTextureName(RefStrings.MODID + ":elec_shovel_anim");
|
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("elec_shovel").setTextureName(RefStrings.MODID + ":elec_shovel_anim");
|
||||||
|
|
||||||
desh_sword = new ItemSwordAbility(12.5F, 0, MainRegistry.tMatDesh)
|
desh_sword = new ItemSwordAbility(12.5F, 0, MainRegistry.tMatDesh)
|
||||||
.addHitAbility(IWeaponAbility.STUN, 0).setUnlocalizedName("desh_sword").setTextureName(RefStrings.MODID + ":desh_sword");
|
.addAbility(IWeaponAbility.STUN, 0).setUnlocalizedName("desh_sword").setTextureName(RefStrings.MODID + ":desh_sword");
|
||||||
|
|
||||||
desh_pickaxe = new ItemToolAbility(5F, -0.05, MainRegistry.tMatDesh, EnumToolType.PICKAXE)
|
desh_pickaxe = new ItemToolAbility(5F, -0.05, MainRegistry.tMatDesh, EnumToolType.PICKAXE)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(3))
|
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(2)).setUnlocalizedName("desh_pickaxe").setTextureName(RefStrings.MODID + ":desh_pickaxe");
|
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("desh_pickaxe").setTextureName(RefStrings.MODID + ":desh_pickaxe");
|
||||||
|
|
||||||
desh_axe = new ItemToolAbility(7.5F, -0.05, MainRegistry.tMatDesh, EnumToolType.AXE)
|
desh_axe = new ItemToolAbility(7.5F, -0.05, MainRegistry.tMatDesh, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(3))
|
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(2))
|
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("desh_axe").setTextureName(RefStrings.MODID + ":desh_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("desh_axe").setTextureName(RefStrings.MODID + ":desh_axe");
|
||||||
|
|
||||||
desh_shovel = new ItemToolAbility(4F, -0.05, MainRegistry.tMatDesh, EnumToolType.SHOVEL)
|
desh_shovel = new ItemToolAbility(4F, -0.05, MainRegistry.tMatDesh, EnumToolType.SHOVEL)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(3))
|
.addAbility(IToolAreaAbility.RECURSION, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(2)).setUnlocalizedName("desh_shovel").setTextureName(RefStrings.MODID + ":desh_shovel");
|
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("desh_shovel").setTextureName(RefStrings.MODID + ":desh_shovel");
|
||||||
|
|
||||||
desh_hoe = new ModHoe(MainRegistry.tMatDesh).setUnlocalizedName("desh_hoe").setTextureName(RefStrings.MODID + ":desh_hoe");
|
desh_hoe = new ModHoe(MainRegistry.tMatDesh).setUnlocalizedName("desh_hoe").setTextureName(RefStrings.MODID + ":desh_hoe");
|
||||||
|
|
||||||
cobalt_sword = new ItemSwordAbility(12F, 0, MainRegistry.tMatCobalt).setUnlocalizedName("cobalt_sword").setTextureName(RefStrings.MODID + ":cobalt_sword");
|
cobalt_sword = new ItemSwordAbility(12F, 0, MainRegistry.tMatCobalt).setUnlocalizedName("cobalt_sword").setTextureName(RefStrings.MODID + ":cobalt_sword");
|
||||||
cobalt_pickaxe = new ItemToolAbility(4F, 0, MainRegistry.tMatCobalt, EnumToolType.PICKAXE)
|
cobalt_pickaxe = new ItemToolAbility(4F, 0, MainRegistry.tMatCobalt, EnumToolType.PICKAXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(1)).setUnlocalizedName("cobalt_pickaxe").setTextureName(RefStrings.MODID + ":cobalt_pickaxe");
|
.addAbility(IToolHarvestAbility.LUCK, 0).setUnlocalizedName("cobalt_pickaxe").setTextureName(RefStrings.MODID + ":cobalt_pickaxe");
|
||||||
cobalt_axe = new ItemToolAbility(6F, 0, MainRegistry.tMatCobalt, EnumToolType.AXE)
|
cobalt_axe = new ItemToolAbility(6F, 0, MainRegistry.tMatCobalt, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(1))
|
.addAbility(IToolHarvestAbility.LUCK, 0)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("cobalt_axe").setTextureName(RefStrings.MODID + ":cobalt_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("cobalt_axe").setTextureName(RefStrings.MODID + ":cobalt_axe");
|
||||||
cobalt_shovel = new ItemToolAbility(3.5F, 0, MainRegistry.tMatCobalt, EnumToolType.SHOVEL)
|
cobalt_shovel = new ItemToolAbility(3.5F, 0, MainRegistry.tMatCobalt, EnumToolType.SHOVEL)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(1)).setUnlocalizedName("cobalt_shovel").setTextureName(RefStrings.MODID + ":cobalt_shovel");
|
.addAbility(IToolHarvestAbility.LUCK, 0).setUnlocalizedName("cobalt_shovel").setTextureName(RefStrings.MODID + ":cobalt_shovel");
|
||||||
cobalt_hoe = new ModHoe(MainRegistry.tMatCobalt).setUnlocalizedName("cobalt_hoe").setTextureName(RefStrings.MODID + ":cobalt_hoe");
|
cobalt_hoe = new ModHoe(MainRegistry.tMatCobalt).setUnlocalizedName("cobalt_hoe").setTextureName(RefStrings.MODID + ":cobalt_hoe");
|
||||||
|
|
||||||
ToolMaterial matDecCobalt = EnumHelper.addToolMaterial("HBM_COBALT2", 3, 2500, 15.0F, 2.5F, 75).setRepairItem(new ItemStack(ModItems.ingot_cobalt));
|
ToolMaterial matDecCobalt = EnumHelper.addToolMaterial("HBM_COBALT2", 3, 2500, 15.0F, 2.5F, 75).setRepairItem(new ItemStack(ModItems.ingot_cobalt));
|
||||||
cobalt_decorated_sword = new ItemSwordAbility(15F, 0, matDecCobalt)
|
cobalt_decorated_sword = new ItemSwordAbility(15F, 0, matDecCobalt)
|
||||||
.addHitAbility(IWeaponAbility.BOBBLE, 0).setUnlocalizedName("cobalt_decorated_sword").setTextureName(RefStrings.MODID + ":cobalt_decorated_sword");
|
.addAbility(IWeaponAbility.BOBBLE, 0).setUnlocalizedName("cobalt_decorated_sword").setTextureName(RefStrings.MODID + ":cobalt_decorated_sword");
|
||||||
cobalt_decorated_pickaxe = new ItemToolAbility(6F, 0, matDecCobalt, EnumToolType.PICKAXE)
|
cobalt_decorated_pickaxe = new ItemToolAbility(6F, 0, matDecCobalt, EnumToolType.PICKAXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(3)).setUnlocalizedName("cobalt_decorated_pickaxe").setTextureName(RefStrings.MODID + ":cobalt_decorated_pickaxe");
|
.addAbility(IToolHarvestAbility.LUCK, 2).setUnlocalizedName("cobalt_decorated_pickaxe").setTextureName(RefStrings.MODID + ":cobalt_decorated_pickaxe");
|
||||||
cobalt_decorated_axe = new ItemToolAbility(8F, 0, matDecCobalt, EnumToolType.AXE)
|
cobalt_decorated_axe = new ItemToolAbility(8F, 0, matDecCobalt, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(3))
|
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("cobalt_decorated_axe").setTextureName(RefStrings.MODID + ":cobalt_decorated_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("cobalt_decorated_axe").setTextureName(RefStrings.MODID + ":cobalt_decorated_axe");
|
||||||
cobalt_decorated_shovel = new ItemToolAbility(5F, 0, matDecCobalt, EnumToolType.SHOVEL)
|
cobalt_decorated_shovel = new ItemToolAbility(5F, 0, matDecCobalt, EnumToolType.SHOVEL)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(3)).setUnlocalizedName("cobalt_decorated_shovel").setTextureName(RefStrings.MODID + ":cobalt_decorated_shovel");
|
.addAbility(IToolHarvestAbility.LUCK, 2).setUnlocalizedName("cobalt_decorated_shovel").setTextureName(RefStrings.MODID + ":cobalt_decorated_shovel");
|
||||||
cobalt_decorated_hoe = new ModHoe(matDecCobalt).setUnlocalizedName("cobalt_decorated_hoe").setTextureName(RefStrings.MODID + ":cobalt_decorated_hoe");
|
cobalt_decorated_hoe = new ModHoe(matDecCobalt).setUnlocalizedName("cobalt_decorated_hoe").setTextureName(RefStrings.MODID + ":cobalt_decorated_hoe");
|
||||||
|
|
||||||
ToolMaterial matStarmetal = EnumHelper.addToolMaterial("HBM_STARMETAL", 3, 3000, 20.0F, 2.5F, 100).setRepairItem(new ItemStack(ModItems.ingot_starmetal));
|
ToolMaterial matStarmetal = EnumHelper.addToolMaterial("HBM_STARMETAL", 3, 3000, 20.0F, 2.5F, 100).setRepairItem(new ItemStack(ModItems.ingot_starmetal));
|
||||||
starmetal_sword = new ItemSwordAbility(25F, 0, matStarmetal)
|
starmetal_sword = new ItemSwordAbility(25F, 0, matStarmetal)
|
||||||
.addHitAbility(IWeaponAbility.BEHEADER, 0)
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.addHitAbility(IWeaponAbility.STUN, 1)
|
.addAbility(IWeaponAbility.STUN, 1)
|
||||||
.addHitAbility(IWeaponAbility.BOBBLE, 0).setUnlocalizedName("starmetal_sword").setTextureName(RefStrings.MODID + ":starmetal_sword");
|
.addAbility(IWeaponAbility.BOBBLE, 0).setUnlocalizedName("starmetal_sword").setTextureName(RefStrings.MODID + ":starmetal_sword");
|
||||||
starmetal_pickaxe = new ItemToolAbility(8F, 0, matStarmetal, EnumToolType.PICKAXE)
|
starmetal_pickaxe = new ItemToolAbility(8F, 0, matStarmetal, EnumToolType.PICKAXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(6))
|
.addAbility(IToolAreaAbility.RECURSION, 3)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(5))
|
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(3)).setUnlocalizedName("starmetal_pickaxe").setTextureName(RefStrings.MODID + ":starmetal_pickaxe");
|
.addAbility(IWeaponAbility.STUN, 1).setUnlocalizedName("starmetal_pickaxe").setTextureName(RefStrings.MODID + ":starmetal_pickaxe");
|
||||||
starmetal_axe = new ItemToolAbility(12F, 0, matStarmetal, EnumToolType.AXE)
|
starmetal_axe = new ItemToolAbility(12F, 0, matStarmetal, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(6))
|
.addAbility(IToolAreaAbility.RECURSION, 3)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(5))
|
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility())
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(3)).setUnlocalizedName("starmetal_axe").setTextureName(RefStrings.MODID + ":starmetal_axe");
|
.addAbility(IWeaponAbility.STUN, 1).setUnlocalizedName("starmetal_axe").setTextureName(RefStrings.MODID + ":starmetal_axe");
|
||||||
starmetal_shovel = new ItemToolAbility(7F, 0, matStarmetal, EnumToolType.SHOVEL)
|
starmetal_shovel = new ItemToolAbility(7F, 0, matStarmetal, EnumToolType.SHOVEL)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(6))
|
.addAbility(IToolAreaAbility.RECURSION, 3)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new LuckAbility(5))
|
.addAbility(IToolHarvestAbility.LUCK, 4)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(3)).setUnlocalizedName("starmetal_shovel").setTextureName(RefStrings.MODID + ":starmetal_shovel");
|
.addAbility(IWeaponAbility.STUN, 1).setUnlocalizedName("starmetal_shovel").setTextureName(RefStrings.MODID + ":starmetal_shovel");
|
||||||
starmetal_hoe = new ModHoe(matStarmetal).setUnlocalizedName("starmetal_hoe").setTextureName(RefStrings.MODID + ":starmetal_hoe");
|
starmetal_hoe = new ModHoe(matStarmetal).setUnlocalizedName("starmetal_hoe").setTextureName(RefStrings.MODID + ":starmetal_hoe");
|
||||||
|
|
||||||
centri_stick = new ItemToolAbility(3F, 0, MainRegistry.tMatElec, EnumToolType.MINER)
|
centri_stick = new ItemToolAbility(3F, 0, MainRegistry.tMatElec, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.CentrifugeAbility()).setMaxDamage(50).setUnlocalizedName("centri_stick").setTextureName(RefStrings.MODID + ":centri_stick");
|
.addAbility(IToolHarvestAbility.CENTRIFUGE, 0).setMaxDamage(50).setUnlocalizedName("centri_stick").setTextureName(RefStrings.MODID + ":centri_stick");
|
||||||
smashing_hammer = new ItemToolAbility(12F, -0.1, MainRegistry.tMatSteel, EnumToolType.MINER)
|
smashing_hammer = new ItemToolAbility(12F, -0.1, MainRegistry.tMatSteel, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility()).setMaxDamage(2500).setUnlocalizedName("smashing_hammer").setTextureName(RefStrings.MODID + ":smashing_hammer");
|
.addAbility(IToolHarvestAbility.SHREDDER, 0).setMaxDamage(2500).setUnlocalizedName("smashing_hammer").setTextureName(RefStrings.MODID + ":smashing_hammer");
|
||||||
drax = new ItemToolAbilityPower(10F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 500000000, 100000, 5000)
|
drax = new ItemToolAbilityPower(10F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 500000000, 100000, 5000)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(2))
|
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.RECURSION, 2).setUnlocalizedName("drax").setTextureName(RefStrings.MODID + ":drax");
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5)).setUnlocalizedName("drax").setTextureName(RefStrings.MODID + ":drax");
|
|
||||||
drax_mk2 = new ItemToolAbilityPower(15F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 1000000000, 250000, 7500)
|
drax_mk2 = new ItemToolAbilityPower(15F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 1000000000, 250000, 7500)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.addBreakAbility(new ToolAbility.CentrifugeAbility())
|
.addAbility(IToolHarvestAbility.CENTRIFUGE, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(3))
|
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 2)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.RECURSION, 4).setUnlocalizedName("drax_mk2").setTextureName(RefStrings.MODID + ":drax_mk2");
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(3))
|
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(7)).setUnlocalizedName("drax_mk2").setTextureName(RefStrings.MODID + ":drax_mk2");
|
|
||||||
drax_mk3 = new ItemToolAbilityPower(20F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 2500000000L, 500000, 10000)
|
drax_mk3 = new ItemToolAbilityPower(20F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 2500000000L, 500000, 10000)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.addBreakAbility(new ToolAbility.CentrifugeAbility())
|
.addAbility(IToolHarvestAbility.CENTRIFUGE, 0)
|
||||||
.addBreakAbility(new ToolAbility.CrystallizerAbility())
|
.addAbility(IToolHarvestAbility.CRYSTALLIZER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(4))
|
.addAbility(IToolHarvestAbility.LUCK, 3)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1))
|
.addAbility(IToolAreaAbility.HAMMER, 3)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.RECURSION, 5).setUnlocalizedName("drax_mk3").setTextureName(RefStrings.MODID + ":drax_mk3");
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(3))
|
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(4))
|
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(9)).setUnlocalizedName("drax_mk3").setTextureName(RefStrings.MODID + ":drax_mk3");
|
|
||||||
|
|
||||||
ToolMaterial matBismuth = EnumHelper.addToolMaterial("HBM_BISMUTH", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
|
ToolMaterial matBismuth = EnumHelper.addToolMaterial("HBM_BISMUTH", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
|
||||||
bismuth_pickaxe = new ItemToolAbility(15F, 0, matBismuth, EnumToolType.MINER)
|
bismuth_pickaxe = new ItemToolAbility(15F, 0, matBismuth, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(2))
|
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(5))
|
.addAbility(IWeaponAbility.STUN, 2)
|
||||||
.addHitAbility(new WeaponAbility.VampireAbility(2F))
|
.addAbility(IWeaponAbility.VAMPIRE, 0)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility())
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.setDepthRockBreaker().setUnlocalizedName("bismuth_pickaxe").setTextureName(RefStrings.MODID + ":bismuth_pickaxe");
|
.setDepthRockBreaker().setUnlocalizedName("bismuth_pickaxe").setTextureName(RefStrings.MODID + ":bismuth_pickaxe");
|
||||||
bismuth_axe = new ItemToolAbility(25F, 0, matBismuth, EnumToolType.AXE)
|
bismuth_axe = new ItemToolAbility(25F, 0, matBismuth, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.ShredderAbility())
|
.addAbility(IToolHarvestAbility.SHREDDER, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(2))
|
.addAbility(IToolHarvestAbility.LUCK, 1)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(10))
|
.addAbility(IWeaponAbility.STUN, 3)
|
||||||
.addHitAbility(new WeaponAbility.VampireAbility(3F))
|
.addAbility(IWeaponAbility.VAMPIRE, 1)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("bismuth_axe").setTextureName(RefStrings.MODID + ":bismuth_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("bismuth_axe").setTextureName(RefStrings.MODID + ":bismuth_axe");
|
||||||
|
|
||||||
|
|
||||||
ToolMaterial matVolcano = EnumHelper.addToolMaterial("HBM_VOLCANIC", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
|
ToolMaterial matVolcano = EnumHelper.addToolMaterial("HBM_VOLCANIC", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
|
||||||
volcanic_pickaxe = new ItemToolAbility(15F, 0, matVolcano, EnumToolType.MINER)
|
volcanic_pickaxe = new ItemToolAbility(15F, 0, matVolcano, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(3))
|
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addHitAbility(new WeaponAbility.FireAbility(5))
|
.addAbility(IWeaponAbility.FIRE, 0)
|
||||||
.addHitAbility(new WeaponAbility.VampireAbility(2F))
|
.addAbility(IWeaponAbility.VAMPIRE, 0)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility())
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.setDepthRockBreaker().setUnlocalizedName("volcanic_pickaxe").setTextureName(RefStrings.MODID + ":volcanic_pickaxe");
|
.setDepthRockBreaker().setUnlocalizedName("volcanic_pickaxe").setTextureName(RefStrings.MODID + ":volcanic_pickaxe");
|
||||||
volcanic_axe = new ItemToolAbility(25F, 0, matVolcano, EnumToolType.AXE)
|
volcanic_axe = new ItemToolAbility(25F, 0, matVolcano, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.SmelterAbility())
|
.addAbility(IToolHarvestAbility.SMELTER, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(3))
|
.addAbility(IToolHarvestAbility.LUCK, 2)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addHitAbility(new WeaponAbility.FireAbility(10))
|
.addAbility(IWeaponAbility.FIRE, 1)
|
||||||
.addHitAbility(new WeaponAbility.VampireAbility(3F))
|
.addAbility(IWeaponAbility.VAMPIRE, 1)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("volcanic_axe").setTextureName(RefStrings.MODID + ":volcanic_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("volcanic_axe").setTextureName(RefStrings.MODID + ":volcanic_axe");
|
||||||
|
|
||||||
ToolMaterial matChlorophyte = EnumHelper.addToolMaterial("HBM_CHLOROPHYTE", 4, 0, 75F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.powder_chlorophyte));
|
ToolMaterial matChlorophyte = EnumHelper.addToolMaterial("HBM_CHLOROPHYTE", 4, 0, 75F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.powder_chlorophyte));
|
||||||
chlorophyte_pickaxe = new ItemToolAbility(20F, 0, matChlorophyte, EnumToolType.MINER)
|
chlorophyte_pickaxe = new ItemToolAbility(20F, 0, matChlorophyte, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(4))
|
.addAbility(IToolHarvestAbility.LUCK, 3)
|
||||||
.addBreakAbility(new ToolAbility.CentrifugeAbility())
|
.addAbility(IToolHarvestAbility.CENTRIFUGE, 0)
|
||||||
.addBreakAbility(new ToolAbility.MercuryAbility())
|
.addAbility(IToolHarvestAbility.MERCURY, 0)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(10))
|
.addAbility(IWeaponAbility.STUN, 3)
|
||||||
.addHitAbility(new WeaponAbility.VampireAbility(5F))
|
.addAbility(IWeaponAbility.VAMPIRE, 2)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility())
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.setDepthRockBreaker().setUnlocalizedName("chlorophyte_pickaxe").setTextureName(RefStrings.MODID + ":chlorophyte_pickaxe");
|
.setDepthRockBreaker().setUnlocalizedName("chlorophyte_pickaxe").setTextureName(RefStrings.MODID + ":chlorophyte_pickaxe");
|
||||||
chlorophyte_axe = new ItemToolAbility(50F, 0, matChlorophyte, EnumToolType.AXE)
|
chlorophyte_axe = new ItemToolAbility(50F, 0, matChlorophyte, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(2))
|
.addAbility(IToolAreaAbility.HAMMER, 1)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(4))
|
.addAbility(IToolAreaAbility.RECURSION, 1)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(4))
|
.addAbility(IToolHarvestAbility.LUCK, 3)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(15))
|
.addAbility(IWeaponAbility.STUN, 4)
|
||||||
.addHitAbility(new WeaponAbility.VampireAbility(10F))
|
.addAbility(IWeaponAbility.VAMPIRE, 3)
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("chlorophyte_axe").setTextureName(RefStrings.MODID + ":chlorophyte_axe");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("chlorophyte_axe").setTextureName(RefStrings.MODID + ":chlorophyte_axe");
|
||||||
|
|
||||||
ToolMaterial matMese = EnumHelper.addToolMaterial("HBM_MESE", 4, 0, 100F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
ToolMaterial matMese = EnumHelper.addToolMaterial("HBM_MESE", 4, 0, 100F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
||||||
mese_pickaxe = new ItemToolAbility(35F, 0, matMese, EnumToolType.MINER)
|
mese_pickaxe = new ItemToolAbility(35F, 0, matMese, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(3))
|
.addAbility(IToolAreaAbility.HAMMER, 2)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.CrystallizerAbility())
|
.addAbility(IToolHarvestAbility.CRYSTALLIZER, 0)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(9))
|
.addAbility(IToolHarvestAbility.LUCK, 5)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(2.5F))
|
.addAbility(IToolAreaAbility.EXPLOSION, 3)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(5F))
|
.addAbility(IWeaponAbility.STUN, 3)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(10F))
|
.addAbility(IWeaponAbility.PHOSPHORUS, 0)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(15F))
|
.addAbility(IWeaponAbility.BEHEADER, 0)
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(10))
|
|
||||||
.addHitAbility(new WeaponAbility.PhosphorusAbility(60))
|
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility())
|
|
||||||
.setDepthRockBreaker().setUnlocalizedName("mese_pickaxe").setTextureName(RefStrings.MODID + ":mese_pickaxe");
|
.setDepthRockBreaker().setUnlocalizedName("mese_pickaxe").setTextureName(RefStrings.MODID + ":mese_pickaxe");
|
||||||
mese_axe = new ItemToolAbility(75F, 0, matMese, EnumToolType.AXE)
|
mese_axe = new ItemToolAbility(75F, 0, matMese, EnumToolType.AXE)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(3))
|
.addAbility(IToolAreaAbility.HAMMER, 2)
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(5))
|
.addAbility(IToolAreaAbility.RECURSION, 2)
|
||||||
.addBreakAbility(new ToolAbility.SilkAbility())
|
.addAbility(IToolHarvestAbility.SILK, 0)
|
||||||
.addBreakAbility(new ToolAbility.LuckAbility(9))
|
.addAbility(IToolHarvestAbility.LUCK, 5)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(2.5F))
|
.addAbility(IToolAreaAbility.EXPLOSION, 3)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(5F))
|
.addAbility(IWeaponAbility.STUN, 4)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(10F))
|
.addAbility(IWeaponAbility.PHOSPHORUS, 1)
|
||||||
.addBreakAbility(new ToolAbility.ExplosionAbility(15F))
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("mese_axe").setTextureName(RefStrings.MODID + ":mese_axe");
|
||||||
.addHitAbility(new WeaponAbility.StunAbility(15))
|
|
||||||
.addHitAbility(new WeaponAbility.PhosphorusAbility(90))
|
|
||||||
.addHitAbility(new WeaponAbility.BeheaderAbility()).setUnlocalizedName("mese_axe").setTextureName(RefStrings.MODID + ":mese_axe");
|
|
||||||
|
|
||||||
dnt_sword = new ItemSwordAbility(12F, 0, matMese).setUnlocalizedName("dnt_sword").setTextureName(RefStrings.MODID + ":dnt_sword");
|
dnt_sword = new ItemSwordAbility(12F, 0, matMese).setUnlocalizedName("dnt_sword").setTextureName(RefStrings.MODID + ":dnt_sword");
|
||||||
|
|
||||||
ToolMaterial matDwarf = EnumHelper.addToolMaterial("HBM_DWARVEN", 2, 0, 4F, 0.0F, 10).setRepairItem(new ItemStack(ModItems.ingot_copper));
|
ToolMaterial matDwarf = EnumHelper.addToolMaterial("HBM_DWARVEN", 2, 0, 4F, 0.0F, 10).setRepairItem(new ItemStack(ModItems.ingot_copper));
|
||||||
dwarven_pickaxe = new ItemToolAbility(5F, -0.1, matDwarf, EnumToolType.MINER)
|
dwarven_pickaxe = new ItemToolAbility(5F, -0.1, matDwarf, EnumToolType.MINER)
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(1)).setUnlocalizedName("dwarven_pickaxe").setMaxDamage(250).setTextureName(RefStrings.MODID + ":dwarven_pickaxe");
|
.addAbility(IToolAreaAbility.HAMMER, 0).setUnlocalizedName("dwarven_pickaxe").setMaxDamage(250).setTextureName(RefStrings.MODID + ":dwarven_pickaxe");
|
||||||
|
|
||||||
ToolMaterial matMeteorite = EnumHelper.addToolMaterial("HBM_METEORITE", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
ToolMaterial matMeteorite = EnumHelper.addToolMaterial("HBM_METEORITE", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
||||||
meteorite_sword = new ItemSwordMeteorite(9F, 0, matMeteorite).setUnlocalizedName("meteorite_sword").setTextureName(RefStrings.MODID + ":meteorite_sword");
|
meteorite_sword = new ItemSwordMeteorite(9F, 0, matMeteorite).setUnlocalizedName("meteorite_sword").setTextureName(RefStrings.MODID + ":meteorite_sword");
|
||||||
@ -4883,11 +4870,11 @@ public class ModItems {
|
|||||||
diamond_gavel = new WeaponSpecial(ToolMaterial.EMERALD).setUnlocalizedName("diamond_gavel").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":diamond_gavel");
|
diamond_gavel = new WeaponSpecial(ToolMaterial.EMERALD).setUnlocalizedName("diamond_gavel").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":diamond_gavel");
|
||||||
ToolMaterial matMeseGavel = EnumHelper.addToolMaterial("HBM_MESEGAVEL", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
ToolMaterial matMeseGavel = EnumHelper.addToolMaterial("HBM_MESEGAVEL", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.plate_paa));
|
||||||
mese_gavel = new ItemSwordAbility(250, 1.5, matMeseGavel)
|
mese_gavel = new ItemSwordAbility(250, 1.5, matMeseGavel)
|
||||||
.addHitAbility(IWeaponAbility.PHOSPHORUS, 0)
|
.addAbility(IWeaponAbility.PHOSPHORUS, 0)
|
||||||
.addHitAbility(IWeaponAbility.RADIATION, 2)
|
.addAbility(IWeaponAbility.RADIATION, 2)
|
||||||
.addHitAbility(IWeaponAbility.STUN, 3)
|
.addAbility(IWeaponAbility.STUN, 3)
|
||||||
.addHitAbility(IWeaponAbility.VAMPIRE, 4)
|
.addAbility(IWeaponAbility.VAMPIRE, 4)
|
||||||
.addHitAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("mese_gavel").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":mese_gavel");
|
.addAbility(IWeaponAbility.BEHEADER, 0).setUnlocalizedName("mese_gavel").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":mese_gavel");
|
||||||
|
|
||||||
multitool_hit = new ItemMultitoolPassive().setUnlocalizedName("multitool_hit").setCreativeTab(null).setTextureName(RefStrings.MODID + ":multitool_fist");
|
multitool_hit = new ItemMultitoolPassive().setUnlocalizedName("multitool_hit").setCreativeTab(null).setTextureName(RefStrings.MODID + ":multitool_fist");
|
||||||
multitool_dig = new ItemMultitoolTool(4.0F, MainRegistry.enumToolMaterialMultitool, ItemMultitoolTool.getAllBlocks()).setFull3D().setUnlocalizedName("multitool_dig").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":multitool_claw");
|
multitool_dig = new ItemMultitoolTool(4.0F, MainRegistry.enumToolMaterialMultitool, ItemMultitoolTool.getAllBlocks()).setFull3D().setUnlocalizedName("multitool_dig").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":multitool_claw");
|
||||||
|
|||||||
@ -1,181 +0,0 @@
|
|||||||
package com.hbm.items.tool;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
|
||||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
|
||||||
import net.minecraft.stats.StatList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
|
||||||
import net.minecraftforge.common.IShearable;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
|
||||||
|
|
||||||
public interface IItemWithAbility {
|
|
||||||
|
|
||||||
public boolean canHarvestBlock(Block par1Block, ItemStack itemStack);
|
|
||||||
public boolean isShears(ItemStack stack);
|
|
||||||
|
|
||||||
public default boolean canShearBlock(Block block, ItemStack stack, World world, int x, int y, int z) {
|
|
||||||
return this.isShears(stack) && block instanceof IShearable && ((IShearable) block).isShearable(stack, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public default void breakExtraBlock(World world, int x, int y, int z, EntityPlayer playerEntity, int refX, int refY, int refZ) {
|
|
||||||
|
|
||||||
if(world.isAirBlock(x, y, z))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!(playerEntity instanceof EntityPlayerMP))
|
|
||||||
return;
|
|
||||||
|
|
||||||
EntityPlayerMP player = (EntityPlayerMP) playerEntity;
|
|
||||||
ItemStack stack = player.getHeldItem();
|
|
||||||
|
|
||||||
Block block = world.getBlock(x, y, z);
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
|
|
||||||
if(!(canHarvestBlock(block, stack) || canShearBlock(block, stack, world, x, y, z)) || block == Blocks.bedrock || block == ModBlocks.stone_keyhole)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Block refBlock = world.getBlock(refX, refY, refZ);
|
|
||||||
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
|
|
||||||
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
|
|
||||||
|
|
||||||
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f || refBlock.getBlockHardness(world, refX, refY, refZ) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
|
|
||||||
if(event.isCanceled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(player.capabilities.isCreativeMode) {
|
|
||||||
block.onBlockHarvested(world, x, y, z, meta, player);
|
|
||||||
if(block.removedByPlayer(world, player, x, y, z, false))
|
|
||||||
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
|
|
||||||
|
|
||||||
if(!world.isRemote) {
|
|
||||||
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.getCurrentEquippedItem().func_150999_a(world, block, x, y, z, player);
|
|
||||||
|
|
||||||
if(!world.isRemote) {
|
|
||||||
|
|
||||||
if(canShearBlock(block, stack, world, x, y, z)) {
|
|
||||||
shearBlock(world, x, y, z, block, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
block.onBlockHarvested(world, x, y, z, meta, player);
|
|
||||||
|
|
||||||
if(block.removedByPlayer(world, player, x, y, z, true)) {
|
|
||||||
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
|
|
||||||
block.harvestBlock(world, player, x, y, z, meta);
|
|
||||||
block.dropXpOnBlockBreak(world, x, y, z, event.getExpToDrop());
|
|
||||||
}
|
|
||||||
|
|
||||||
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
|
||||||
if(block.removedByPlayer(world, player, x, y, z, true)) {
|
|
||||||
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
|
|
||||||
}
|
|
||||||
ItemStack itemstack = player.getCurrentEquippedItem();
|
|
||||||
if(itemstack != null) {
|
|
||||||
itemstack.func_150999_a(world, block, x, y, z, player);
|
|
||||||
|
|
||||||
if(itemstack.stackSize == 0) {
|
|
||||||
player.destroyCurrentEquippedItem();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Assumes a canShearBlock check has passed, will most likely crash otherwise! */
|
|
||||||
public static void shearBlock(World world, int x, int y, int z, Block block, EntityPlayer player) {
|
|
||||||
|
|
||||||
ItemStack held = player.getHeldItem();
|
|
||||||
|
|
||||||
IShearable target = (IShearable) block;
|
|
||||||
if(target.isShearable(held, player.worldObj, x, y, z)) {
|
|
||||||
ArrayList<ItemStack> drops = target.onSheared(held, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, held));
|
|
||||||
Random rand = new Random();
|
|
||||||
|
|
||||||
for(ItemStack stack : drops) {
|
|
||||||
float f = 0.7F;
|
|
||||||
double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
|
||||||
double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
|
||||||
double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
|
||||||
EntityItem entityitem = new EntityItem(player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, stack);
|
|
||||||
entityitem.delayBeforeCanPickup = 10;
|
|
||||||
player.worldObj.spawnEntityInWorld(entityitem);
|
|
||||||
}
|
|
||||||
|
|
||||||
held.damageItem(1, player);
|
|
||||||
player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void standardDigPost(World world, int x, int y, int z, EntityPlayerMP player) {
|
|
||||||
|
|
||||||
Block block = world.getBlock(x, y, z);
|
|
||||||
int l = world.getBlockMetadata(x, y, z);
|
|
||||||
world.playAuxSFXAtEntity(player, 2001, x, y, z, Block.getIdFromBlock(block) + (world.getBlockMetadata(x, y, z) << 12));
|
|
||||||
boolean flag = false;
|
|
||||||
|
|
||||||
if(player.capabilities.isCreativeMode) {
|
|
||||||
flag = removeBlock(world, x, y, z, false, player);
|
|
||||||
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
|
|
||||||
} else {
|
|
||||||
ItemStack itemstack = player.getCurrentEquippedItem();
|
|
||||||
boolean flag1 = block.canHarvestBlock(player, l);
|
|
||||||
|
|
||||||
if(itemstack != null) {
|
|
||||||
itemstack.func_150999_a(world, block, x, y, z, player);
|
|
||||||
|
|
||||||
if(itemstack.stackSize == 0) {
|
|
||||||
player.destroyCurrentEquippedItem();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flag = removeBlock(world, x, y, z, flag1, player);
|
|
||||||
if(flag && flag1) {
|
|
||||||
block.harvestBlock(world, player, x, y, z, l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* // Drop experience if (!player.capabilities.isCreativeMode && flag &&
|
|
||||||
* event != null) { block.dropXpOnBlockBreak(world, x, y, z,
|
|
||||||
* event.getExpToDrop()); }
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean removeBlock(World world, int x, int y, int z, boolean canHarvest, EntityPlayerMP player) {
|
|
||||||
Block block = world.getBlock(x, y, z);
|
|
||||||
int l = world.getBlockMetadata(x, y, z);
|
|
||||||
block.onBlockHarvested(world, x, y, z, l, player);
|
|
||||||
boolean flag = block.removedByPlayer(world, player, x, y, z, canHarvest);
|
|
||||||
|
|
||||||
if(flag) {
|
|
||||||
block.onBlockDestroyedByPlayer(world, x, y, z, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -25,7 +25,7 @@ public class ItemSwordAbility extends ItemSword {
|
|||||||
// was there a reason for this to be private?
|
// was there a reason for this to be private?
|
||||||
protected float damage;
|
protected float damage;
|
||||||
protected double movement;
|
protected double movement;
|
||||||
private AvailableAbilities hitAbilities = new AvailableAbilities();
|
private AvailableAbilities abilities = new AvailableAbilities();
|
||||||
|
|
||||||
public ItemSwordAbility(float damage, double movement, ToolMaterial material) {
|
public ItemSwordAbility(float damage, double movement, ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
@ -33,8 +33,8 @@ public class ItemSwordAbility extends ItemSword {
|
|||||||
this.movement = movement;
|
this.movement = movement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemSwordAbility addHitAbility(IWeaponAbility weaponAbility, int level) {
|
public ItemSwordAbility addAbility(IWeaponAbility weaponAbility, int level) {
|
||||||
this.hitAbilities.addAbility(weaponAbility, level);
|
this.abilities.addAbility(weaponAbility, level);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ public class ItemSwordAbility extends ItemSword {
|
|||||||
if(this == ModItems.mese_gavel)
|
if(this == ModItems.mese_gavel)
|
||||||
attacker.worldObj.playSoundAtEntity(victim, "hbm:weapon.whack", 3.0F, 1.F);
|
attacker.worldObj.playSoundAtEntity(victim, "hbm:weapon.whack", 3.0F, 1.F);
|
||||||
|
|
||||||
this.hitAbilities.get().forEach((ability, level) -> {
|
this.abilities.getWeaponAbilities().forEach((ability, level) -> {
|
||||||
((IWeaponAbility)ability).onHit(level, attacker.worldObj, (EntityPlayer) attacker, victim, this);
|
ability.onHit(level, attacker.worldObj, (EntityPlayer) attacker, victim, this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public class ItemSwordAbility extends ItemSword {
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||||
hitAbilities.addInformation(list);
|
abilities.addInformation(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canOperate(ItemStack stack) {
|
protected boolean canOperate(ItemStack stack) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
@ -11,24 +12,30 @@ import com.google.common.collect.Multimap;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.hbm.inventory.gui.GUIScreenToolAbility;
|
import com.hbm.inventory.gui.GUIScreenToolAbility;
|
||||||
import com.hbm.handler.HbmKeybinds;
|
import com.hbm.handler.HbmKeybinds;
|
||||||
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.extprop.HbmPlayerProps;
|
import com.hbm.extprop.HbmPlayerProps;
|
||||||
import com.hbm.handler.ToolAbility;
|
import com.hbm.handler.ability.AvailableAbilities;
|
||||||
import com.hbm.handler.ToolAbility.*;
|
import com.hbm.handler.ability.IBaseAbility;
|
||||||
|
import com.hbm.handler.ability.IToolAreaAbility;
|
||||||
|
import com.hbm.handler.ability.IToolHarvestAbility;
|
||||||
|
import com.hbm.handler.ability.ToolPreset;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.PlayerInformPacket;
|
import com.hbm.packet.toclient.PlayerInformPacket;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.util.ChatBuilder;
|
|
||||||
import com.hbm.handler.WeaponAbility;
|
|
||||||
|
|
||||||
import api.hbm.item.IDepthRockTool;
|
import api.hbm.item.IDepthRockTool;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@ -37,10 +44,17 @@ import net.minecraft.item.EnumRarity;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemTool;
|
import net.minecraft.item.ItemTool;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||||
|
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||||
|
import net.minecraft.stats.StatList;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
|
import net.minecraftforge.common.IShearable;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
|
||||||
public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDepthRockTool, IGUIProvider {
|
public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIProvider {
|
||||||
|
|
||||||
protected boolean isShears = false;
|
protected boolean isShears = false;
|
||||||
protected EnumToolType toolType;
|
protected EnumToolType toolType;
|
||||||
@ -48,8 +62,8 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
//was there a reason for this to be private?
|
//was there a reason for this to be private?
|
||||||
protected float damage;
|
protected float damage;
|
||||||
protected double movement;
|
protected double movement;
|
||||||
protected List<ToolAbility> breakAbility = new ArrayList() {{ add(null); }};
|
protected AvailableAbilities availableAbilities = new AvailableAbilities().addToolAbilities();
|
||||||
protected List<WeaponAbility> hitAbility = new ArrayList();
|
protected boolean rockBreaker = false;
|
||||||
|
|
||||||
public static enum EnumToolType {
|
public static enum EnumToolType {
|
||||||
|
|
||||||
@ -102,13 +116,14 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemToolAbility addBreakAbility(ToolAbility breakAbility) {
|
public ItemToolAbility addAbility(IBaseAbility ability, int level) {
|
||||||
this.breakAbility.add(breakAbility);
|
this.availableAbilities.addAbility(ability, level);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemToolAbility addHitAbility(WeaponAbility weaponAbility) {
|
public ItemToolAbility setDepthRockBreaker() {
|
||||||
this.hitAbility.add(weaponAbility);
|
this.rockBreaker = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,14 +139,14 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
|
|
||||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase attacker) {
|
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase attacker) {
|
||||||
|
|
||||||
if(!attacker.worldObj.isRemote && !this.hitAbility.isEmpty() && attacker instanceof EntityPlayer && canOperate(stack)) {
|
if(!attacker.worldObj.isRemote && attacker instanceof EntityPlayer && canOperate(stack)) {
|
||||||
|
|
||||||
for(WeaponAbility ability : this.hitAbility) {
|
this.availableAbilities.getWeaponAbilities().forEach((ability, level) -> {
|
||||||
ability.onHit(attacker.worldObj, (EntityPlayer) attacker, victim, this);
|
ability.onHit(level, attacker.worldObj, (EntityPlayer) attacker, victim, this);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.damageItem(2, attacker);
|
stack.damageItem(1, attacker);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -141,10 +156,19 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
|
|
||||||
World world = player.worldObj;
|
World world = player.worldObj;
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
|
|
||||||
if(!world.isRemote && (canHarvestBlock(block, stack) || canShearBlock(block, stack, world, x, y, z)) && this.getCurrentAbility(stack) != null && canOperate(stack))
|
if(!world.isRemote && (canHarvestBlock(block, stack) || canShearBlock(block, stack, world, x, y, z)) && canOperate(stack)) {
|
||||||
return this.getCurrentAbility(stack).onDig(world, x, y, z, player, block, meta, this);
|
Configuration config = getConfiguration(stack);
|
||||||
|
ToolPreset preset = config.getActivePreset();
|
||||||
|
|
||||||
|
preset.harvestAbility.preHarvestAll(preset.harvestAbilityLevel, world, player);
|
||||||
|
|
||||||
|
boolean result = preset.areaAbility.onDig(preset.areaAbilityLevel, world, x, y, z, player, this);
|
||||||
|
|
||||||
|
preset.harvestAbility.postHarvestAll(preset.harvestAbilityLevel, world, player);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -169,18 +193,35 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
return super.getDigSpeed(stack, block, meta);
|
return super.getDigSpeed(stack, block, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canOperate(ItemStack stack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||||
|
|
||||||
if(!canOperate(stack))
|
if(!canOperate(stack))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(this.getCurrentAbility(stack) instanceof SilkAbility)
|
if(this.getConfiguration(stack).getActivePreset().harvestAbility == IToolHarvestAbility.SILK)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return getDigSpeed(stack, block, 0) > 1;
|
return getDigSpeed(stack, block, 0) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBreakRock(World world, EntityPlayer player, ItemStack tool, Block block, int x, int y, int z) {
|
||||||
|
return canOperate(tool) && this.rockBreaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canShearBlock(Block block, ItemStack stack, World world, int x, int y, int z) {
|
||||||
|
return this.isShears(stack) && block instanceof IShearable && ((IShearable) block).isShearable(stack, world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShears(ItemStack stack) {
|
||||||
|
return this.isShears;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Multimap getItemAttributeModifiers() {
|
public Multimap getItemAttributeModifiers() {
|
||||||
|
|
||||||
@ -192,38 +233,13 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean hasEffect(ItemStack stack) {
|
public boolean hasEffect(ItemStack stack) {
|
||||||
return getCurrentAbility(stack) != null || stack.isItemEnchanted();
|
return stack.isItemEnchanted() || !getConfiguration(stack).getActivePreset().isNone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||||
|
|
||||||
if(this.breakAbility.size() > 1) {
|
availableAbilities.addInformation(list);
|
||||||
list.add("Abilities: ");
|
|
||||||
|
|
||||||
for(ToolAbility ability : this.breakAbility) {
|
|
||||||
|
|
||||||
if(ability != null) {
|
|
||||||
|
|
||||||
if(getCurrentAbility(stack) == ability)
|
|
||||||
list.add(" >" + EnumChatFormatting.GOLD + ability.getFullName());
|
|
||||||
else
|
|
||||||
list.add(" " + EnumChatFormatting.GOLD + ability.getFullName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list.add("Right click to cycle through abilities!");
|
|
||||||
list.add("Sneak-click to turn ability off!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.hitAbility.isEmpty()) {
|
|
||||||
|
|
||||||
list.add("Weapon modifiers: ");
|
|
||||||
|
|
||||||
for(WeaponAbility ability : this.hitAbility) {
|
|
||||||
list.add(" " + EnumChatFormatting.RED + ability.getFullName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.rockBreaker) {
|
if(this.rockBreaker) {
|
||||||
list.add("");
|
list.add("");
|
||||||
@ -233,85 +249,236 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||||
|
|
||||||
if(this.breakAbility.size() < 2 || !canOperate(stack))
|
if(!canOperate(stack))
|
||||||
return super.onItemRightClick(stack, world, player);
|
return super.onItemRightClick(stack, world, player);
|
||||||
|
|
||||||
|
Configuration config = getConfiguration(stack);
|
||||||
|
|
||||||
if(HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_ALT)) {
|
if(HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_ALT)) {
|
||||||
if(world.isRemote) player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
if(world.isRemote) player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(world.isRemote)
|
if(config.presets.size() < 2 || world.isRemote)
|
||||||
return super.onItemRightClick(stack, world, player);
|
return super.onItemRightClick(stack, world, player);
|
||||||
|
|
||||||
int i = getAbility(stack);
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if(player.isSneaking())
|
if(player.isSneaking()) {
|
||||||
i = 0;
|
config.currentPreset = 0;
|
||||||
|
|
||||||
setAbility(stack, i % this.breakAbility.size());
|
|
||||||
|
|
||||||
while(getCurrentAbility(stack) != null && !getCurrentAbility(stack).isAllowed()) {
|
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("[Ability ").nextTranslation(getCurrentAbility(stack).getName()).next(getCurrentAbility(stack).getExtension() + " is blacklisted!]").colorAll(EnumChatFormatting.RED).flush(), MainRegistry.proxy.ID_TOOLABILITY), (EntityPlayerMP) player);
|
|
||||||
|
|
||||||
|
|
||||||
i++;
|
|
||||||
setAbility(stack, i % this.breakAbility.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getCurrentAbility(stack) != null) {
|
|
||||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("[Enabled ").nextTranslation(getCurrentAbility(stack).getName()).next(getCurrentAbility(stack).getExtension() + "]").colorAll(EnumChatFormatting.YELLOW).flush(), MainRegistry.proxy.ID_TOOLABILITY), (EntityPlayerMP) player);
|
|
||||||
} else {
|
} else {
|
||||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("[Tool ability deactivated]").color(EnumChatFormatting.GOLD).flush(), MainRegistry.proxy.ID_TOOLABILITY), (EntityPlayerMP) player);
|
config.currentPreset = (config.currentPreset + 1) % config.presets.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
world.playSoundAtEntity(player, "random.orb", 0.25F, getCurrentAbility(stack) == null ? 0.75F : 1.25F);
|
setConfiguration(stack, config);
|
||||||
|
|
||||||
|
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(config.getActivePreset().getMessage(), MainRegistry.proxy.ID_TOOLABILITY), (EntityPlayerMP) player);
|
||||||
|
|
||||||
|
world.playSoundAtEntity(player, "random.orb", 0.25F, config.getActivePreset().isNone() ? 0.75F : 1.25F);
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToolAbility getCurrentAbility(ItemStack stack) {
|
public void breakExtraBlock(World world, int x, int y, int z, EntityPlayer playerEntity, int refX, int refY, int refZ) {
|
||||||
int ability = getAbility(stack) % this.breakAbility.size();
|
|
||||||
return this.breakAbility.get(ability);
|
if(world.isAirBlock(x, y, z))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!(playerEntity instanceof EntityPlayerMP))
|
||||||
|
return;
|
||||||
|
|
||||||
|
EntityPlayerMP player = (EntityPlayerMP) playerEntity;
|
||||||
|
ItemStack stack = player.getHeldItem();
|
||||||
|
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
|
if(!(canHarvestBlock(block, stack) || canShearBlock(block, stack, world, x, y, z)) || block == Blocks.bedrock || block == ModBlocks.stone_keyhole)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Block refBlock = world.getBlock(refX, refY, refZ);
|
||||||
|
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
|
||||||
|
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
|
||||||
|
|
||||||
|
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f || refBlock.getBlockHardness(world, refX, refY, refZ) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
|
||||||
|
if(event.isCanceled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Configuration config = getConfiguration(stack);
|
||||||
|
ToolPreset preset = config.getActivePreset();
|
||||||
|
|
||||||
|
preset.harvestAbility.onHarvestBlock(preset.harvestAbilityLevel, world, x, y, z, player, block, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getAbility(ItemStack stack) {
|
/** Assumes a canShearBlock check has passed, will most likely crash otherwise! */
|
||||||
|
public static void shearBlock(World world, int x, int y, int z, Block block, EntityPlayer player) {
|
||||||
|
|
||||||
if(stack.hasTagCompound())
|
ItemStack held = player.getHeldItem();
|
||||||
return stack.stackTagCompound.getInteger("ability");
|
|
||||||
|
|
||||||
return 0;
|
IShearable target = (IShearable) block;
|
||||||
|
if(target.isShearable(held, player.worldObj, x, y, z)) {
|
||||||
|
ArrayList<ItemStack> drops = target.onSheared(held, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, held));
|
||||||
|
Random rand = new Random();
|
||||||
|
|
||||||
|
for(ItemStack stack : drops) {
|
||||||
|
float f = 0.7F;
|
||||||
|
double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||||
|
double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||||
|
double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||||
|
EntityItem entityitem = new EntityItem(player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, stack);
|
||||||
|
entityitem.delayBeforeCanPickup = 10;
|
||||||
|
player.worldObj.spawnEntityInWorld(entityitem);
|
||||||
|
}
|
||||||
|
|
||||||
|
held.damageItem(1, player);
|
||||||
|
player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAbility(ItemStack stack, int ability) {
|
public static void standardDigPost(World world, int x, int y, int z, EntityPlayerMP player) {
|
||||||
|
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
int l = world.getBlockMetadata(x, y, z);
|
||||||
|
world.playAuxSFXAtEntity(player, 2001, x, y, z, Block.getIdFromBlock(block) + (world.getBlockMetadata(x, y, z) << 12));
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
if(player.capabilities.isCreativeMode) {
|
||||||
|
flag = removeBlock(world, x, y, z, false, player);
|
||||||
|
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
|
||||||
|
} else {
|
||||||
|
ItemStack itemstack = player.getCurrentEquippedItem();
|
||||||
|
boolean flag1 = block.canHarvestBlock(player, l);
|
||||||
|
|
||||||
|
flag = removeBlock(world, x, y, z, flag1, player);
|
||||||
|
|
||||||
|
if(itemstack != null) {
|
||||||
|
itemstack.func_150999_a(world, block, x, y, z, player);
|
||||||
|
|
||||||
|
if(itemstack.stackSize == 0) {
|
||||||
|
player.destroyCurrentEquippedItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Missing from other method, may be unneeded
|
||||||
|
if(flag && flag1) {
|
||||||
|
block.harvestBlock(world, player, x, y, z, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Added from other method, may be unneeded
|
||||||
|
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Why was this commented out?
|
||||||
|
// Drop experience
|
||||||
|
// if (!player.capabilities.isCreativeMode && flag && event != null) {
|
||||||
|
// block.dropXpOnBlockBreak(world, x, y, z, event.getExpToDrop());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean removeBlock(World world, int x, int y, int z, boolean canHarvest, EntityPlayerMP player) {
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
int l = world.getBlockMetadata(x, y, z);
|
||||||
|
block.onBlockHarvested(world, x, y, z, l, player);
|
||||||
|
boolean flag = block.removedByPlayer(world, player, x, y, z, canHarvest);
|
||||||
|
|
||||||
|
if(flag) {
|
||||||
|
block.onBlockDestroyedByPlayer(world, x, y, z, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Configuration {
|
||||||
|
public List<ToolPreset> presets;
|
||||||
|
public int currentPreset;
|
||||||
|
|
||||||
|
public Configuration() {
|
||||||
|
this.presets = null;
|
||||||
|
this.currentPreset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Configuration(List<ToolPreset> presets, int currentPreset) {
|
||||||
|
this.presets = presets;
|
||||||
|
this.currentPreset = currentPreset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
|
nbt.setInteger("ability", currentPreset);
|
||||||
|
|
||||||
|
NBTTagList nbtPresets = new NBTTagList();
|
||||||
|
|
||||||
|
for(ToolPreset preset : presets) {
|
||||||
|
NBTTagCompound nbtPreset = new NBTTagCompound();
|
||||||
|
preset.writeToNBT(nbtPreset);
|
||||||
|
nbtPresets.appendTag(nbtPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
nbt.setTag("abilityPresets", nbtPresets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
currentPreset = nbt.getInteger("ability");
|
||||||
|
|
||||||
|
NBTTagList nbtPresets = nbt.getTagList("abilityPresets", 10);
|
||||||
|
|
||||||
|
presets = new ArrayList<ToolPreset>(nbtPresets.tagCount());
|
||||||
|
|
||||||
|
for(int i = 0; i < presets.size(); i++) {
|
||||||
|
NBTTagCompound nbtPreset = nbtPresets.getCompoundTagAt(i);
|
||||||
|
ToolPreset preset = new ToolPreset();
|
||||||
|
preset.readFromNBT(nbtPreset);
|
||||||
|
presets.add(preset);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentPreset = Math.max(0, Math.min(currentPreset, presets.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(AvailableAbilities availableAbilities) {
|
||||||
|
currentPreset = 0;
|
||||||
|
|
||||||
|
presets = new ArrayList<ToolPreset>(availableAbilities.size());
|
||||||
|
presets.add(new ToolPreset());
|
||||||
|
|
||||||
|
availableAbilities.getToolAreaAbilities().forEach((ability, level) -> {
|
||||||
|
presets.add(new ToolPreset(ability, level, IToolHarvestAbility.NONE, 0));
|
||||||
|
});
|
||||||
|
|
||||||
|
availableAbilities.getToolHarvestAbilities().forEach((ability, level) -> {
|
||||||
|
presets.add(new ToolPreset(IToolAreaAbility.NONE, 0, ability, level));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restrictTo(AvailableAbilities availableAbilities) {
|
||||||
|
for (ToolPreset preset : presets) {
|
||||||
|
preset.restrictTo(availableAbilities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToolPreset getActivePreset() {
|
||||||
|
return presets.get(currentPreset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Configuration getConfiguration(ItemStack stack) {
|
||||||
|
Configuration config = new Configuration();
|
||||||
|
|
||||||
|
if(!stack.hasTagCompound()) {
|
||||||
|
config.reset(availableAbilities);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.readFromNBT(stack.stackTagCompound);
|
||||||
|
config.restrictTo(availableAbilities);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfiguration(ItemStack stack, Configuration config) {
|
||||||
if(!stack.hasTagCompound())
|
if(!stack.hasTagCompound())
|
||||||
stack.stackTagCompound = new NBTTagCompound();
|
stack.stackTagCompound = new NBTTagCompound();
|
||||||
|
|
||||||
stack.stackTagCompound.setInteger("ability", ability);
|
config.writeToNBT(stack.getTagCompound());
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canOperate(ItemStack stack) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemToolAbility setDepthRockBreaker() {
|
|
||||||
this.rockBreaker = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean rockBreaker = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canBreakRock(World world, EntityPlayer player, ItemStack tool, Block block, int x, int y, int z) {
|
|
||||||
return canOperate(tool) && this.rockBreaker;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isShears(ItemStack stack) {
|
|
||||||
return this.isShears;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -322,6 +489,6 @@ public class ItemToolAbility extends ItemTool implements IItemWithAbility, IDept
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return new GUIScreenToolAbility(this);
|
return new GUIScreenToolAbility(this.availableAbilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user