Added the Terra Truncator (Terrasteel Axe). Also changed some mana cost values around.

This commit is contained in:
Lizbeth Rika committed 2015-05-15 22:40:55 +01:00
1 parent 35600d2782
commit a7db6e4139
15 files changed
+239 -16

No files matched your search

@@ -26,7 +26,7 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import vazkii.botania.common.item.equipment.tool.ItemTerraPick;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.lib.LibObfuscation;
import cpw.mods.fml.relauncher.ReflectionHelper;
@@ -168,6 +168,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.terraSword);
addItem(ModItems.thornChakram);
addItem(ModItems.terraPick);
addItem(ModItems.terraAxe);
addItem(ModItems.temperanceStone);
addItem(ModItems.terrasteelHelm);
if(Botania.thaumcraftLoaded)
@@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ItemTerraPick;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
public class TerraPickTippingRecipe implements IRecipe {
@@ -59,8 +59,6 @@ import vazkii.botania.common.item.equipment.bauble.ItemUnholyCloak;
import vazkii.botania.common.item.equipment.bauble.ItemWaterRing;
import vazkii.botania.common.item.equipment.tool.ItemEnderDagger;
import vazkii.botania.common.item.equipment.tool.ItemGlassPick;
import vazkii.botania.common.item.equipment.tool.ItemTerraPick;
import vazkii.botania.common.item.equipment.tool.ItemTerraSword;
import vazkii.botania.common.item.equipment.tool.bow.ItemCrystalBow;
import vazkii.botania.common.item.equipment.tool.bow.ItemLivingwoodBow;
import vazkii.botania.common.item.equipment.tool.elementium.ItemElementiumAxe;
@@ -73,6 +71,9 @@ import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelPick;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelShears;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelShovel;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelSword;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraAxe;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraSword;
import vazkii.botania.common.item.interaction.thaumcraft.ItemElementiumHelmRevealing;
import vazkii.botania.common.item.interaction.thaumcraft.ItemManaInkwell;
import vazkii.botania.common.item.interaction.thaumcraft.ItemManasteelHelmRevealing;
@@ -241,6 +242,7 @@ public final class ModItems {
public static Item recordGaia2;
public static Item temperanceStone;
public static Item incenseStick;
public static Item terraAxe;
public static void init() {
lexicon = new ItemLexicon();
@@ -373,6 +375,7 @@ public final class ModItems {
recordGaia2 = new ItemRecordGaia2();
temperanceStone = new ItemTemperanceStone();
incenseStick = new ItemIncenseStick();
terraAxe = new ItemTerraAxe();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
@@ -30,6 +30,7 @@ import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.elementium.ItemElementiumPick;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
public final class ToolCommons {
@@ -63,6 +64,10 @@ public final class ToolCommons {
}
public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int bx, int by, int bz, Block block, Material[] materialsListing, boolean silk, int fortune, float blockHardness, boolean dispose) {
removeBlockWithDrops(player, stack, world, x, y, z, bx, by, bz, block, materialsListing, silk, fortune, blockHardness, dispose, true);
}
public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int bx, int by, int bz, Block block, Material[] materialsListing, boolean silk, int fortune, float blockHardness, boolean dispose, boolean particles) {
if(!world.blockExists(x, y, z))
return;
@@ -91,7 +96,7 @@ public final class ToolCommons {
damageItem(stack, 1, player, 80);
} else world.setBlockToAir(x, y, z);
if(ConfigHandler.blockBreakParticles && ConfigHandler.blockBreakParticlesTool && !world.isRemote)
if(particles && !world.isRemote && ConfigHandler.blockBreakParticles && ConfigHandler.blockBreakParticlesTool)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blk) + (meta << 12));
}
}
@@ -10,8 +10,8 @@ import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ItemTerraPick;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelPick;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -72,17 +72,21 @@ public class ItemManasteelAxe extends ItemAxe implements IManaUsingItem, ISortab
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) {
ToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE);
ToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, getManaPerDamage());
return true;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) {
if (block.getBlockHardness(world, x, y, z) != 0F)
ToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE);
ToolCommons.damageItem(stack, 1, entity, getManaPerDamage());
return true;
}
public int getManaPerDamage() {
return MANA_PER_DAMAGE;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int s, float sx, float sy, float sz) {
@@ -104,7 +108,7 @@ public class ItemManasteelAxe extends ItemAxe implements IManaUsingItem, ISortab
@Override
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
if(!world.isRemote && player instanceof EntityPlayer && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) player, MANA_PER_DAMAGE * 2, true))
if(!world.isRemote && player instanceof EntityPlayer && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) player, getManaPerDamage() * 2, true))
stack.setItemDamage(stack.getItemDamage() - 1);
}
@@ -35,7 +35,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemManasteelSword extends ItemSword implements IManaUsingItem {
public static final int MANA_PER_DAMAGE = 51;
public static final int MANA_PER_DAMAGE = 60;
IIcon elucidatorIcon;
@@ -70,7 +70,7 @@ public class ItemManasteelSword extends ItemSword implements IManaUsingItem {
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) {
if(usesMana(par1ItemStack))
ToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE);
ToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, getManaPerDamage());
return true;
}
@@ -87,16 +87,20 @@ public class ItemManasteelSword extends ItemSword implements IManaUsingItem {
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) {
if(usesMana(stack) && block.getBlockHardness(world, x, y, z) != 0F)
ToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE);
ToolCommons.damageItem(stack, 1, entity, getManaPerDamage());
return true;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
if(!world.isRemote && player instanceof EntityPlayer && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) player, MANA_PER_DAMAGE * 2, true))
if(!world.isRemote && player instanceof EntityPlayer && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) player, getManaPerDamage() * 2, true))
stack.setItemDamage(stack.getItemDamage() - 1);
}
public int getManaPerDamage() {
return MANA_PER_DAMAGE;
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
@@ -0,0 +1,189 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [May 15, 2015, 6:55:34 PM (GMT)]
*/
package vazkii.botania.common.item.equipment.tool.terrasteel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.ISequentialBreaker;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelAxe;
import vazkii.botania.common.item.relic.ItemLokiRing;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker {
private static final int MANA_PER_DAMAGE = 100;
private static Map<Integer, List<BlockSwapper>> blockSwappers = new HashMap();
IIcon iconOn, iconOff;
public ItemTerraAxe() {
super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_AXE);
FMLCommonHandler.instance().bus().register(this);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
iconOn = IconHelper.forItem(par1IconRegister, this, 0);
iconOff = IconHelper.forItem(par1IconRegister, this, 1);
}
@Override
public IIcon getIconFromDamage(int p_77617_1_) {
return iconOn;
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
return player.isSneaking() ? iconOff : iconOn;
}
@Override
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
MovingObjectPosition raycast = ToolCommons.raytraceFromEntity(player.worldObj, player, true, 10);
if(raycast != null) {
breakOtherBlock(player, stack, x, y, z, x, y, z, raycast.sideHit);
ItemLokiRing.breakOnAllCursors(player, this, stack, x, y, z, raycast.sideHit);
}
return false;
}
@Override
public int getManaPerDamage() {
return MANA_PER_DAMAGE;
}
@Override
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side) {
if(!player.isSneaking()) {
ChunkCoordinates coords = new ChunkCoordinates(x, y, z);
addBlockSwapper(player.worldObj, player, stack, coords, coords, 32, false, true, new ArrayList());
}
}
@Override
public boolean disposeOfTrashBlocks(ItemStack stack) {
return false;
}
@SubscribeEvent
public void onTickEnd(TickEvent.WorldTickEvent event) {
if(event.phase == Phase.END) {
int dim = event.world.provider.dimensionId;
if(blockSwappers.containsKey(dim)) {
List<BlockSwapper> swappers = blockSwappers.get(dim);
List<BlockSwapper> swappersSafe = new ArrayList(swappers);
swappers.clear();
for(BlockSwapper s : swappersSafe)
if(s != null)
s.tick();
}
}
}
private static BlockSwapper addBlockSwapper(World world, EntityPlayer player, ItemStack stack, ChunkCoordinates origCoords, ChunkCoordinates coords, int steps, boolean leaves, boolean force, List<String> posChecked) {
BlockSwapper swapper = new BlockSwapper(world, player, stack, origCoords, coords, steps, leaves, force, posChecked);
int dim = world.provider.dimensionId;
if(!blockSwappers.containsKey(dim))
blockSwappers.put(dim, new ArrayList());
blockSwappers.get(dim).add(swapper);
return swapper;
}
private static class BlockSwapper {
final World world;
final EntityPlayer player;
final ItemStack stack;
final ChunkCoordinates origCoords;
final int steps;
final ChunkCoordinates coords;
final boolean leaves;
final boolean force;
final List<String> posChecked;
int ticks = 2;
BlockSwapper(World world, EntityPlayer player, ItemStack stack, ChunkCoordinates origCoords, ChunkCoordinates coords, int steps, boolean leaves, boolean force, List<String> posChecked) {
this.world = world;
this.player = player;
this.stack = stack;
this.origCoords = origCoords;
this.coords = coords;
this.steps = steps;
this.leaves = leaves;
this.force = force;
this.posChecked = posChecked;
}
void tick() {
Block blockat = world.getBlock(coords.posX, coords.posY, coords.posZ);
if(!force && blockat.isAir(world, coords.posX, coords.posY, coords.posZ))
return;
ToolCommons.removeBlockWithDrops(player, stack, world, coords.posX, coords.posY, coords.posZ, origCoords.posX, origCoords.posY, origCoords.posZ, null, ToolCommons.materialsAxe, EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack), 0F, false, !leaves);
if(steps == 0)
return;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int x = coords.posX + dir.offsetX;
int y = coords.posY + dir.offsetY;
int z = coords.posZ + dir.offsetZ;
String pstr = posStr(x, y, z);
if(posChecked.contains(pstr))
continue;
Block block = world.getBlock(x, y, z);
boolean log = block.isWood(world, x, y, z);
boolean leaf = block.isLeaves(world, x, y, z);
if(log || leaf) {
int steps = this.steps - 1;
steps = leaf ? this.leaves ? steps : 3 : steps;
addBlockSwapper(world, player, stack, origCoords, new ChunkCoordinates(x, y, z), steps, leaf, false, posChecked);
posChecked.add(pstr);
}
}
}
String posStr(int x, int y, int z) {
return x + ":" + y + ":" + z;
}
}
}
@@ -8,7 +8,7 @@
*
* File Created @ [May 20, 2014, 10:56:14 PM (GMT)]
*/
package vazkii.botania.common.item.equipment.tool;
package vazkii.botania.common.item.equipment.tool.terrasteel;
import java.awt.Color;
import java.util.List;
@@ -42,6 +42,7 @@ import vazkii.botania.common.item.ItemTemperanceStone;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemAuraRing;
import vazkii.botania.common.item.equipment.bauble.ItemGreaterAuraRing;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelPick;
import vazkii.botania.common.item.relic.ItemLokiRing;
import vazkii.botania.common.item.relic.ItemThorRing;
@@ -57,6 +58,7 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
private static final String TAG_TIPPED = "tipped";
private static final int MAX_MANA = Integer.MAX_VALUE;
private static final int MANA_PER_DAMAGE = 100;
private static final Material[] MATERIALS = new Material[] { Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
@@ -138,6 +140,11 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
return false;
}
@Override
public int getManaPerDmg() {
return MANA_PER_DAMAGE;
}
@Override
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side) {
if(!isEnabled(stack))
@@ -8,7 +8,7 @@
*
* File Created @ [Apr 14, 2014, 7:34:56 PM (GMT)]
*/
package vazkii.botania.common.item.equipment.tool;
package vazkii.botania.common.item.equipment.tool.terrasteel;
import java.util.List;
@@ -35,13 +35,16 @@ import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelSword;
import vazkii.botania.common.lib.LibItemNames;
public class ItemTerraSword extends ItemManasteelSword implements ILensEffect, ICraftAchievement {
private static final String TAG_ATTACKER_USERNAME = "attackerUsername";
private static final int MANA_PER_DAMAGE = 100;
public ItemTerraSword() {
super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_SWORD);
}
@@ -62,6 +65,11 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect, I
}
}
}
@Override
public int getManaPerDamage() {
return MANA_PER_DAMAGE;
}
public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) {
EntityManaBurst burst = new EntityManaBurst(player);
@@ -143,6 +143,7 @@ public final class LibItemNames {
public static final String RECORD_GAIA2 = "recordGaia2";
public static final String TEMPERANCE_STONE = "temperanceStone";
public static final String INCENSE_STICK = "incenseStick";
public static final String TERRA_AXE = "terraAxe";
public static final String[] LENS_NAMES = new String[] {
"lensNormal",