This commit is contained in:
Bernhard Bonigl committed 2014-07-30 10:52:40 +02:00
commit 2089804266
9 files changed
+893 -3

No files matched your search

@@ -4,6 +4,7 @@ import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -251,6 +252,7 @@ public class Battleaxe extends HarvestTool
final Block wood = world.getBlock(x, y, z);
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
final int meta = world.getBlockMetadata(x, y, z);
final int fortune = EnchantmentHelper.getFortuneModifier(player);
for (int yPos = y + 1; yPos < y + 9; yPos++)
{
Block block = world.getBlock(x, yPos, z);
@@ -280,6 +282,11 @@ public class Battleaxe extends HarvestTool
{
block.onBlockDestroyedByPlayer(world, x, yPos, z, localMeta);
}
// Workaround for dropping experience
int exp = block.getExpDrop(world, localMeta, fortune);
block.dropXpOnBlockBreak(world, x, y, z, exp);
block.harvestBlock(world, player, x, yPos, z, localMeta);
block.onBlockHarvested(world, x, yPos, z, localMeta, player);
onBlockDestroyed(stack, world, block, x, yPos, z, player);
@@ -150,7 +150,7 @@ public class Cleaver extends Weapon
ItemStack equipped = player.getCurrentEquippedItem();
if (equipped == stack)
{
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 2));
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 2, 2, true));
}
}
}
@@ -3,6 +3,7 @@ package tconstruct.items.tools;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -184,6 +185,7 @@ public class Excavator extends HarvestTool
break;
}
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
int fortune = EnchantmentHelper.getFortuneModifier(player);
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
{
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
@@ -221,6 +223,11 @@ public class Excavator extends HarvestTool
{
block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
}
// Workaround for dropping experience
int exp = block.getExpDrop(world, localMeta, fortune);
block.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
block.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
block.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
if (blockHardness > 0f)
@@ -6,6 +6,7 @@ import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@@ -283,6 +284,7 @@ public class Hammer extends HarvestTool
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
int toolLevel = tags.getInteger("HarvestLevel");
int fortune = EnchantmentHelper.getFortuneModifier(player);
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
{
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
@@ -321,6 +323,11 @@ public class Hammer extends HarvestTool
{
localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
}
// Workaround for dropping experience
int exp = localBlock.getExpDrop(world, localMeta, fortune);
localBlock.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
if (blockHardness > 0f)
@@ -3,6 +3,7 @@ package tconstruct.items.tools;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -198,6 +199,8 @@ public class LumberAxe extends HarvestTool
void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, Block bID, int meta, EntityPlayer player)
{
Block block;
final int fortune = EnchantmentHelper.getFortuneModifier(player);
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = y; yPos <= y + 1; yPos++)
@@ -246,6 +249,11 @@ public class LumberAxe extends HarvestTool
{
block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta);
}
// Workaround for dropping experience
int exp = localblock.getExpDrop(world, meta, fortune);
localblock.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
block.onBlockHarvested(world, xPos, yPos, zPos, meta, player);
onBlockDestroyed(stack, world, localblock, xPos, yPos, zPos, player);
@@ -280,6 +288,8 @@ public class LumberAxe extends HarvestTool
void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayer player)
{
final int fortune = EnchantmentHelper.getFortuneModifier(player);
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int yPos = y - 1; yPos <= y + 1; yPos++)
@@ -305,13 +315,17 @@ public class LumberAxe extends HarvestTool
if (!cancelHarvest)
{
WorldHelper.setBlockToAir(world, xPos, yPos, zPos);
if (!player.capabilities.isCreativeMode)
{
// TODO harvestBlock
int exp = block.getExpDrop(world, meta, fortune);
block.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
block.harvestBlock(world, player, xPos, yPos, zPos, meta);
onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player);
}
WorldHelper.setBlockToAir(world, xPos, yPos, zPos);
world.func_147479_m(xPos, yPos, zPos);
}
}
}
@@ -3,6 +3,7 @@ package tconstruct.library.tools;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -50,7 +51,14 @@ public abstract class DualHarvestTool extends HarvestTool
else
{
if (!player.capabilities.isCreativeMode)
{
// Workaround for dropping experience
int fortune = EnchantmentHelper.getFortuneModifier(player);
int exp = block.getExpDrop(world, meta, fortune);
block.dropXpOnBlockBreak(world, x, y, z, exp);
onBlockDestroyed(stack, world, block, x, y, z, player);
}
WorldHelper.setBlockToAir(world, x, y, z);
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
@@ -3,6 +3,7 @@ package tconstruct.library.tools;
import mantle.world.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@@ -46,6 +47,7 @@ public abstract class HarvestTool extends ToolCore
float blockHardness = block.getBlockHardness(world, x, y, z);
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z);
//Choose blocks that aren't too much harder than the first block. Stone: 2.0, Ores: 3.0
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness)
{
boolean cancelHarvest = false;
@@ -84,6 +86,12 @@ public abstract class HarvestTool extends ToolCore
{
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
}
// Workaround for dropping experience
int fortune = EnchantmentHelper.getFortuneModifier(player);
int exp = localBlock.getExpDrop(world, localMeta, fortune);
localBlock.dropXpOnBlockBreak(world, x, y, z, exp);
localBlock.harvestBlock(world, player, x, y, z, localMeta);
localBlock.onBlockHarvested(world, x, y, z, localMeta, player);
if (blockHardness > 0f)
@@ -288,4 +296,17 @@ public abstract class HarvestTool extends ToolCore
return used;
}
@Override
public int getHarvestLevel (ItemStack stack, String toolClass)
{
if (!(stack.getItem() instanceof HarvestTool) || !getHarvestType().equals(toolClass))
{
return -1;
}
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
int harvestLvl = tags.getInteger("HarvestLevel");
return harvestLvl;
}
}
@@ -918,7 +918,7 @@ public class TinkerSmeltery
// Items
Smeltery.addMelting(FluidType.getFluidType("AluminumBrass"), new ItemStack(TinkerTools.blankPattern, 4, 1), -50, TConstruct.ingotLiquidValue);
Smeltery.addMelting(gold, new ItemStack(TinkerTools.blankPattern, 4, 2), -50, TConstruct.ingotLiquidValue * 2);
Smeltery.addMelting(FluidType.getFluidType("Gold"), new ItemStack(TinkerTools.materials, 1, 36), 0, TConstruct.ingotLiquidValue);
Smeltery.addMelting(FluidType.getFluidType("Glue"), new ItemStack(TinkerTools.materials, 1, 36), 0, TConstruct.ingotLiquidValue);
Smeltery.addMelting(FluidType.getFluidType("Ender"), new ItemStack(Items.ender_pearl, 4), 0, 250);
Smeltery.addMelting(TinkerWorld.metalBlock, 10, 50, new FluidStack(moltenEnderFluid, 1000));