Fixed tool material strength

This commit is contained in:
Kino 2016-12-28 18:27:23 -05:00
parent ce7ae6029d
commit 4e005b567d
5 changed files with 35 additions and 74 deletions

View file

@ -47,9 +47,9 @@ public class Aether
{
PlayerAetherManager.initialization();
SoundsAether.initialization();
ItemsAether.initialization();
BlocksAether.initialization();
AetherEntities.initialization();
BlocksAether.initialization();
ItemsAether.initialization();
AetherRecipes.initialization();
AchievementsAether.initialization();
AetherTileEntities.initialization();

View file

@ -130,7 +130,7 @@ public class BlocksAether
dungeon_block = registerMeta("dungeon_block", new BlockDungeonBase(false));
locked_dungeon_block = registerMeta("locked_dungeon_block", new BlockDungeonBase(true).setResistance(2500F));
dungeon_trap = registerMeta("dungeon_trap", new BlockDungeonTrap());
aether_portal = registerUBlock("aether_portal", new BlockAetherPortal());
aether_portal = register("aether_portal", new BlockAetherPortal()).setCreativeTab(null);
ambrosium_torch = register("ambrosium_torch", new BlockAmbrosiumTorch());
chest_mimic = register("chest_mimic", new BlockMimicChest());
treasure_chest = register("treasure_chest", new BlockTreasureChest());
@ -163,13 +163,13 @@ public class BlocksAether
holystone_stairs = register("holystone_stairs", new BlockAetherStairs(holystone.getDefaultState()));
holystone_brick_stairs = register("holystone_brick_stairs", new BlockAetherStairs(holystone_brick.getDefaultState()));
skyroot_double_slab = registerUBlock("skyroot_double_slab", new BlockAetherSlab("skyroot_double_slab", true, Material.WOOD).setHardness(2.0F).setResistance(5.0F));
carved_double_slab = registerUBlock("carved_double_slab", new BlockAetherSlab("carved_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F));
angelic_double_slab = registerUBlock("angelic_double_slab", new BlockAetherSlab("angelic_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F));
hellfire_double_slab = registerUBlock("hellfire_double_slab", new BlockAetherSlab("hellfire_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F));
holystone_double_slab = registerUBlock("holystone_double_slab", new BlockAetherSlab("holystone_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F));
mossy_holystone_double_slab = registerUBlock("mossy_holystone_double_slab", new BlockAetherSlab("mossy_holystone_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F));
holystone_brick_double_slab = registerUBlock("holystone_brick_double_slab", new BlockAetherSlab("holystone_brick_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F));
skyroot_double_slab = register("skyroot_double_slab", new BlockAetherSlab("skyroot_double_slab", true, Material.WOOD).setHardness(2.0F).setResistance(5.0F)).setCreativeTab(null);
carved_double_slab = register("carved_double_slab", new BlockAetherSlab("carved_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
angelic_double_slab = register("angelic_double_slab", new BlockAetherSlab("angelic_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
hellfire_double_slab = register("hellfire_double_slab", new BlockAetherSlab("hellfire_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
holystone_double_slab = register("holystone_double_slab", new BlockAetherSlab("holystone_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
mossy_holystone_double_slab = register("mossy_holystone_double_slab", new BlockAetherSlab("mossy_holystone_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
holystone_brick_double_slab = register("holystone_brick_double_slab", new BlockAetherSlab("holystone_brick_double_slab", true, Material.ROCK).setHardness(2.0F).setResistance(10.0F)).setCreativeTab(null);
skyroot_slab = registerSlab("skyroot_slab", new BlockAetherSlab("skyroot_slab", false, Material.WOOD).setHardness(2.0F).setResistance(5.0F), skyroot_double_slab);
carved_slab = registerSlab("carved_slab", new BlockAetherSlab("carved_slab", false, Material.ROCK).setHardness(2.0F).setResistance(10.0F), carved_double_slab);
@ -178,22 +178,6 @@ public class BlocksAether
holystone_slab = registerSlab("holystone_slab", new BlockAetherSlab("holystone_slab", false, Material.ROCK).setHardness(2.0F).setResistance(10.0F), holystone_double_slab);
mossy_holystone_slab = registerSlab("mossy_holystone_slab", new BlockAetherSlab("mossy_holystone_slab", false, Material.ROCK).setHardness(2.0F).setResistance(10.0F), mossy_holystone_double_slab);
holystone_brick_slab = registerSlab("holystone_brick_slab", new BlockAetherSlab("holystone_brick_slab", false, Material.ROCK).setHardness(2.0F).setResistance(10.0F), holystone_brick_double_slab);
Blocks.MOB_SPAWNER.setHarvestLevel("pickaxe", 0);
BlocksAether.ambrosium_ore.setHarvestLevel("pickaxe", 0);
BlocksAether.zanite_ore.setHarvestLevel("pickaxe", 1);
BlocksAether.gravitite_ore.setHarvestLevel("pickaxe", 2);
BlocksAether.icestone.setHarvestLevel("pickaxe", 2);
BlocksAether.enchanted_gravitite.setHarvestLevel("pickaxe", 2);
BlocksAether.icestone.setHarvestLevel("pickaxe", 1);
BlocksAether.aether_log.setHarvestLevel("axe", 0);
BlocksAether.holystone.setHarvestLevel("pickaxe", 0);
BlocksAether.mossy_holystone.setHarvestLevel("pickaxe", 0);
BlocksAether.dungeon_block.setHarvestLevel("pickaxe", 0);
BlocksAether.aether_grass.setHarvestLevel("shovel", 0);
BlocksAether.quicksoil.setHarvestLevel("shovel", 0);
BlocksAether.enchanted_aether_grass.setHarvestLevel("shovel", 0);
BlocksAether.aether_dirt.setHarvestLevel("shovel", 0);
}
public static Block registerSlab(String name, Block slab1, Block slab2)
@ -217,16 +201,6 @@ public class BlocksAether
return block;
}
public static Block registerUBlock(String name, Block block)
{
block.setUnlocalizedName(name);
GameRegistry.register(block.setRegistryName(Aether.locate(name)));
GameRegistry.register(new ItemBlock(block).setRegistryName(Aether.locate(name)));
return block;
}
public static Block registerMeta(String name, Block block)
{
GameRegistry.register(block.setRegistryName(Aether.locate(name)));

View file

@ -3,7 +3,10 @@ package com.legacy.aether.server.items.tools;
import java.util.Random;
import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
@ -25,7 +28,7 @@ public abstract class ItemAetherTool extends ItemTool
public ItemAetherTool(ToolMaterial toolMaterial, EnumAetherToolType toolType)
{
super(toolType.getDamageVsEntity(), 2.0F, toolMaterial, toolType.getToolBlockSet());
super(1.0F, 2.0F, toolMaterial, toolType.getToolBlockSet());
this.setCreativeTab(AetherCreativeTabs.tools);
this.toolType = toolType;
@ -49,18 +52,15 @@ public abstract class ItemAetherTool extends ItemTool
}
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass)
@Override
public int getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState)
{
int level = super.getHarvestLevel(stack, toolClass);
if (level == -1 && toolClass != null && toolClass.equals(this.toolClass))
{
if (blockState != null && blockState.getBlock().isToolEffective(this.toolClass, blockState))
{
return this.toolMaterial.getHarvestLevel();
}
else
{
return level;
}
}
return super.getHarvestLevel(stack, toolClass, player, blockState);
}
@Override
@ -72,8 +72,7 @@ public abstract class ItemAetherTool extends ItemTool
@Override
public float getStrVsBlock(ItemStack stack, IBlockState block)
{
float aetherStrength = this.toolType.getStrVsBlock(stack, block);
return aetherStrength == 4.0F ? aetherStrength : super.getStrVsBlock(stack, block);
return this.toolType.getStrVsBlock(stack, block) == 4.0F ? this.efficiencyOnProperMaterial : 1.0F;
}
@Override

View file

@ -18,13 +18,7 @@ public class ItemZaniteTool extends ItemAetherTool
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return this.calculateIncrease(stack, 4.0F);;
}
return this.calculateIncrease(stack, super.getStrVsBlock(stack, state));
return this.calculateIncrease(stack, this.toolType.getStrVsBlock(stack, state));
}
private float calculateIncrease(ItemStack tool, float original)

View file

@ -15,32 +15,34 @@ import com.legacy.aether.server.blocks.BlocksAether;
public enum EnumAetherToolType
{
PICKAXE(2.0F, Sets.newHashSet(new Block[]
PICKAXE(Sets.newHashSet(new Block[]
{
Blocks.COBBLESTONE, Blocks.DOUBLE_STONE_SLAB, Blocks.STONE_SLAB,
Blocks.STONE, Blocks.SANDSTONE, Blocks.MOSSY_COBBLESTONE, Blocks.IRON_ORE,
Blocks.IRON_BLOCK, Blocks.COAL_ORE, Blocks.GOLD_ORE, Blocks.GOLD_BLOCK,
Blocks.DIAMOND_ORE, Blocks.DIAMOND_BLOCK, Blocks.ICE, Blocks.NETHERRACK,
Blocks.LAPIS_ORE, Blocks.LAPIS_BLOCK, Blocks.REDSTONE_ORE, Blocks.LIT_REDSTONE_ORE,
Blocks.RAIL, Blocks.DETECTOR_RAIL, Blocks.GOLDEN_RAIL, Blocks.ACTIVATOR_RAIL,
Blocks.RAIL, Blocks.DETECTOR_RAIL, Blocks.GOLDEN_RAIL, Blocks.ACTIVATOR_RAIL, Blocks.MOB_SPAWNER,
BlocksAether.holystone, BlocksAether.holystone_brick, BlocksAether.mossy_holystone,
BlocksAether.enchanter, BlocksAether.incubator, BlocksAether.enchanter, BlocksAether.ambrosium_ore,
BlocksAether.icestone, BlocksAether.aerogel, BlocksAether.dungeon_block
}))
{
@Override
public boolean canHarvestBlock(ToolMaterial toolMaterial, IBlockState block)
public boolean canHarvestBlock(ToolMaterial toolMaterial, IBlockState state)
{
if (block.getBlock() == BlocksAether.zanite_ore || block.getBlock() == BlocksAether.zanite_block)
Block block = state.getBlock();
if (block == BlocksAether.zanite_ore || block == BlocksAether.zanite_block || block == BlocksAether.icestone)
{
return toolMaterial.getHarvestLevel() >= 1;
}
else if (block.getBlock() == BlocksAether.gravitite_ore || block.getBlock() == BlocksAether.enchanted_gravitite)
else if (block == BlocksAether.gravitite_ore || block == BlocksAether.enchanted_gravitite)
{
return toolMaterial.getHarvestLevel() >= 2;
}
return block.getBlock() == Blocks.OBSIDIAN ? toolMaterial.getHarvestLevel() == 3 : (block.getBlock() != Blocks.DIAMOND_BLOCK && block.getBlock() != Blocks.DIAMOND_ORE ? (block.getBlock() != Blocks.EMERALD_ORE && block.getBlock() != Blocks.EMERALD_BLOCK ? (block.getBlock() != Blocks.GOLD_BLOCK && block.getBlock() != Blocks.GOLD_ORE ? (block.getBlock() != Blocks.IRON_BLOCK && block.getBlock() != Blocks.IRON_ORE ? (block.getBlock() != Blocks.LAPIS_BLOCK && block.getBlock() != Blocks.LAPIS_ORE ? (block.getBlock() != Blocks.REDSTONE_ORE && block.getBlock() != Blocks.LIT_REDSTONE_ORE ? (block.getMaterial() == Material.ROCK ? true : (block.getMaterial() == Material.IRON ? true : block.getMaterial() == Material.ANVIL)) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 1) : toolMaterial.getHarvestLevel() >= 1) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 2);
return block == Blocks.OBSIDIAN ? toolMaterial.getHarvestLevel() == 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (state.getMaterial() == Material.ROCK ? true : (state.getMaterial() == Material.IRON ? true : state.getMaterial() == Material.ANVIL)) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 1) : toolMaterial.getHarvestLevel() >= 1) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 2);
}
@Override
@ -49,12 +51,12 @@ public enum EnumAetherToolType
return block != null && (block.getMaterial() == Material.IRON || block.getMaterial() == Material.ANVIL || block.getMaterial() == Material.ROCK) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(stack, block);
}
},
SHOVEL(1.0F, Sets.newHashSet(new Block[]
SHOVEL(Sets.newHashSet(new Block[]
{
Blocks.GRASS, Blocks.DIRT, Blocks.SAND, Blocks.GRAVEL, Blocks.SNOW,
Blocks.SNOW_LAYER, Blocks.CLAY, Blocks.FARMLAND, Blocks.SOUL_SAND,
Blocks.MYCELIUM, BlocksAether.aether_dirt, BlocksAether.aether_grass,
BlocksAether.aercloud, BlocksAether.enchanted_aether_grass
BlocksAether.aercloud, BlocksAether.enchanted_aether_grass, BlocksAether.quicksoil
}))
{
@Override
@ -64,7 +66,7 @@ public enum EnumAetherToolType
}
},
AXE(3.0F, Sets.newHashSet(new Block[]
AXE(Sets.newHashSet(new Block[]
{
Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.CHEST,
Blocks.DOUBLE_STONE_SLAB, Blocks.STONE_SLAB, Blocks.PUMPKIN,
@ -79,23 +81,15 @@ public enum EnumAetherToolType
}
};
private float damageVsEntity;
private Set<Block> toolBlockSet;
public float efficiencyOnProperMaterial = 4.0F;
EnumAetherToolType(float damageVsEntity, Set<Block> toolBlockSet)
EnumAetherToolType(Set<Block> toolBlockSet)
{
this.damageVsEntity = damageVsEntity;
this.toolBlockSet = toolBlockSet;
}
public float getDamageVsEntity()
{
return this.damageVsEntity;
}
public Set<Block> getToolBlockSet()
{
return this.toolBlockSet;