mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 11:49:37 +00:00
Finish tools and relics except some of Loki
This commit is contained in:
1 parent
27126c074d
commit
02ed9f1c84
9 files changed
+88
-89
No files matched your search
@@ -12,6 +12,8 @@ package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* An item that implements this can break multiple blocks at once
|
||||
@@ -20,7 +22,7 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ISequentialBreaker {
|
||||
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side);
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, BlockPos pos, BlockPos originPos, EnumFacing side);
|
||||
|
||||
public boolean disposeOfTrashBlocks(ItemStack stack);
|
||||
|
||||
|
||||
+6
-4
@@ -21,6 +21,8 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.ISortableTool;
|
||||
@@ -77,19 +79,19 @@ public class ItemManasteelPick extends ItemPickaxe implements IManaUsingItem, IS
|
||||
}
|
||||
|
||||
@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)
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase entity) {
|
||||
if(block.getBlockHardness(world, pos) != 0F)
|
||||
ToolCommons.damageItem(stack, 1, entity, getManaPerDmg());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int s, float sx, float sy, float sz) {
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float sx, float sy, float sz) {
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackAt = player.inventory.getStackInSlot(i);
|
||||
if(stackAt != null && TORCH_PATTERN.matcher(stackAt.getItem().getUnlocalizedName()).find()) {
|
||||
boolean did = stackAt.getItem().onItemUse(stackAt, player, world, x, y, z, s, sx, sy, sz);
|
||||
boolean did = stackAt.getItem().onItemUse(stackAt, player, world, pos, side, sx, sy, sz);
|
||||
if(stackAt.stackSize == 0)
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
|
||||
|
||||
+9
-7
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item.equipment.tool.manasteel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -25,6 +26,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
@@ -76,8 +78,8 @@ public class ItemManasteelShears extends ItemShears implements IManaUsingItem {
|
||||
|
||||
if(entity instanceof IShearable) {
|
||||
IShearable target = (IShearable)entity;
|
||||
if(target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) {
|
||||
ArrayList<ItemStack> drops = target.onSheared(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
|
||||
if(target.isShearable(itemstack, entity.worldObj, new BlockPos(entity))) {
|
||||
List<ItemStack> drops = target.onSheared(itemstack, entity.worldObj, new BlockPos(entity), EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
|
||||
|
||||
Random rand = new Random();
|
||||
for(ItemStack stack : drops) {
|
||||
@@ -97,15 +99,15 @@ public class ItemManasteelShears extends ItemShears implements IManaUsingItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) {
|
||||
if (player.worldObj.isRemote)
|
||||
return false;
|
||||
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
Block block = player.worldObj.getBlockState(pos).getBlock();
|
||||
if(block instanceof IShearable) {
|
||||
IShearable target = (IShearable)block;
|
||||
if(target.isShearable(itemstack, player.worldObj, x, y, z)) {
|
||||
ArrayList<ItemStack> drops = target.onSheared(itemstack, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
|
||||
if(target.isShearable(itemstack, player.worldObj, pos)) {
|
||||
List<ItemStack> drops = target.onSheared(itemstack, player.worldObj, pos, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
|
||||
Random rand = new Random();
|
||||
|
||||
for(ItemStack stack : drops) {
|
||||
@@ -114,7 +116,7 @@ public class ItemManasteelShears extends ItemShears implements IManaUsingItem {
|
||||
double d1 = rand.nextFloat() * f + (1D - f) * 0.5;
|
||||
double d2 = rand.nextFloat() * f + (1D - f) * 0.5;
|
||||
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, x + d, y + d1, z + d2, stack);
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, pos.getX() + d, pos.getY() + d1, pos.getZ() + d2, stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
+11
-9
@@ -19,6 +19,8 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
@@ -75,19 +77,19 @@ public class ItemManasteelShovel extends ItemSpade implements IManaUsingItem, IS
|
||||
}
|
||||
|
||||
@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)
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase entity) {
|
||||
if (block.getBlockHardness(world, pos) != 0F)
|
||||
ToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
|
||||
if(!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
|
||||
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, BlockPos pos, EnumFacing side, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
|
||||
if(!p_77648_2_.canPlayerEdit(pos, side, p_77648_1_))
|
||||
return false;
|
||||
else {
|
||||
UseHoeEvent event = new UseHoeEvent(p_77648_2_, p_77648_1_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_);
|
||||
UseHoeEvent event = new UseHoeEvent(p_77648_2_, p_77648_1_, p_77648_3_, pos);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
return false;
|
||||
|
||||
@@ -96,16 +98,16 @@ public class ItemManasteelShovel extends ItemSpade implements IManaUsingItem, IS
|
||||
return true;
|
||||
}
|
||||
|
||||
Block block = p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_);
|
||||
Block block = p_77648_3_.getBlockState(pos).getBlock();
|
||||
|
||||
if(p_77648_7_ != 0 && p_77648_3_.getBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_).isAir(p_77648_3_, p_77648_4_, p_77648_5_ + 1, p_77648_6_) && (block == Blocks.grass || block == Blocks.dirt)) {
|
||||
if(side != EnumFacing.DOWN && p_77648_3_.getBlockState(pos.up()).getBlock().isAir(p_77648_3_, pos.up()) && (block == Blocks.grass || block == Blocks.dirt)) {
|
||||
Block block1 = Blocks.farmland;
|
||||
p_77648_3_.playSoundEffect(p_77648_4_ + 0.5F, p_77648_5_ + 0.5F, p_77648_6_ + 0.5F, block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F);
|
||||
p_77648_3_.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, block1.stepSound.getStepSound(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getFrequency() * 0.8F);
|
||||
|
||||
if (p_77648_3_.isRemote)
|
||||
return true;
|
||||
else {
|
||||
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, block1);
|
||||
p_77648_3_.setBlockState(pos, block1.getDefaultState());
|
||||
ToolCommons.damageItem(p_77648_1_, 1, p_77648_2_, MANA_PER_DAMAGE);
|
||||
return true;
|
||||
}
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -86,8 +87,8 @@ 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)
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase entity) {
|
||||
if(usesMana(stack) && block.getBlockHardness(world, pos) != 0F)
|
||||
ToolCommons.damageItem(stack, 1, entity, getManaPerDamage());
|
||||
|
||||
return true;
|
||||
|
||||
+19
-20
@@ -22,6 +22,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
@@ -74,11 +75,11 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, 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);
|
||||
breakOtherBlock(player, stack, pos, pos, raycast.sideHit);
|
||||
ItemLokiRing.breakOnAllCursors(player, this, stack, pos, raycast.sideHit);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -90,9 +91,9 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side) {
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, BlockPos pos, BlockPos originPos, EnumFacing side) {
|
||||
if(shouldBreak(player)) {
|
||||
BlockPos coords = new BlockPos(x, y, z);
|
||||
BlockPos coords = new BlockPos(pos);
|
||||
addBlockSwapper(player.worldObj, player, stack, coords, coords, 32, false, true, new ArrayList());
|
||||
}
|
||||
}
|
||||
@@ -105,7 +106,7 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
@SubscribeEvent
|
||||
public void onTickEnd(TickEvent.WorldTickEvent event) {
|
||||
if(event.phase == Phase.END) {
|
||||
int dim = event.world.provider.dimensionId;
|
||||
int dim = event.world.provider.getDimensionId();
|
||||
if(blockSwappers.containsKey(dim)) {
|
||||
List<BlockSwapper> swappers = blockSwappers.get(dim);
|
||||
List<BlockSwapper> swappersSafe = new ArrayList(swappers);
|
||||
@@ -121,7 +122,7 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
private static BlockSwapper addBlockSwapper(World world, EntityPlayer player, ItemStack stack, BlockPos origCoords, BlockPos 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;
|
||||
int dim = world.provider.getDimensionId();
|
||||
if(!blockSwappers.containsKey(dim))
|
||||
blockSwappers.put(dim, new ArrayList());
|
||||
blockSwappers.get(dim).add(swapper);
|
||||
@@ -153,11 +154,11 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
}
|
||||
|
||||
void tick() {
|
||||
Block blockat = world.getBlock(coords.posX, coords.posY, coords.posZ);
|
||||
if(!force && blockat.isAir(world, coords.posX, coords.posY, coords.posZ))
|
||||
Block blockat = world.getBlockState(coords).getBlock();
|
||||
if(!force && blockat.isAir(world, coords))
|
||||
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);
|
||||
ToolCommons.removeBlockWithDrops(player, stack, world, coords, origCoords, null, ToolCommons.materialsAxe, EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack), 0F, false, !leaves);
|
||||
|
||||
if(steps == 0)
|
||||
return;
|
||||
@@ -165,27 +166,25 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
|
||||
for(int i = 0; i < 3; i++)
|
||||
for(int j = 0; j < 3; j++)
|
||||
for(int k = 0; k < 3; k++) {
|
||||
int x = coords.posX + i - 1;
|
||||
int y = coords.posY + j - 1;
|
||||
int z = coords.posZ + k - 1;
|
||||
String pstr = posStr(x, y, z);
|
||||
BlockPos pos = coords.add(i - 1, j - 1, k - 1);
|
||||
String pstr = posStr(pos);
|
||||
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);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
boolean log = block.isWood(world, pos);
|
||||
boolean leaf = block.isLeaves(world, pos);
|
||||
if(log || leaf) {
|
||||
int steps = this.steps - 1;
|
||||
steps = leaf ? leaves ? steps : 3 : steps;
|
||||
addBlockSwapper(world, player, stack, origCoords, new BlockPos(x, y, z), steps, leaf, false, posChecked);
|
||||
addBlockSwapper(world, player, stack, origCoords, pos, steps, leaf, false, posChecked);
|
||||
posChecked.add(pstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String posStr(int x, int y, int z) {
|
||||
return x + ":" + y + ":" + z;
|
||||
String posStr(BlockPos pos) {
|
||||
return pos.getX() + ":" + pos.getY() + ":" + pos.getZ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-21
@@ -22,10 +22,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
@@ -111,8 +109,8 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int s, float sx, float sy, float sz) {
|
||||
return player.isSneaking() && super.onItemUse(stack, player, world, x, y, z, s, sx, sy, sz);
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float sx, float sy, float sz) {
|
||||
return player.isSneaking() && super.onItemUse(stack, player, world, pos, side, sx, sy, sz);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,11 +127,11 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, 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);
|
||||
breakOtherBlock(player, stack, pos, pos, raycast.sideHit);
|
||||
ItemLokiRing.breakOnAllCursors(player, this, stack, pos, raycast.sideHit);
|
||||
// ^ Doable with API access through the IInternalMethodHandler.
|
||||
}
|
||||
|
||||
@@ -146,25 +144,24 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side) {
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, BlockPos pos, BlockPos originPos, EnumFacing side) {
|
||||
if(!isEnabled(stack))
|
||||
return;
|
||||
|
||||
World world = player.worldObj;
|
||||
Material mat = world.getBlock(x, y, z).getMaterial();
|
||||
Material mat = world.getBlockState(pos).getBlock().getMaterial();
|
||||
if(!ToolCommons.isRightMaterial(mat, MATERIALS))
|
||||
return;
|
||||
|
||||
if(world.isAirBlock(x, y, z))
|
||||
if(world.isAirBlock(pos))
|
||||
return;
|
||||
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(side);
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
boolean thor = ItemThorRing.getThorRing(player) != null;
|
||||
boolean doX = thor || direction.offsetX == 0;
|
||||
boolean doY = thor || direction.offsetY == 0;
|
||||
boolean doZ = thor || direction.offsetZ == 0;
|
||||
boolean doX = thor || side.getFrontOffsetX() == 0;
|
||||
boolean doY = thor || side.getFrontOffsetY() == 0;
|
||||
boolean doZ = thor || side.getFrontOffsetZ() == 0;
|
||||
|
||||
int origLevel = getLevel(stack);
|
||||
int level = origLevel + (thor ? 1 : 0);
|
||||
@@ -177,7 +174,7 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
if(range == 0 && level != 1)
|
||||
return;
|
||||
|
||||
ToolCommons.removeBlocksInIteration(player, stack, world, x, y, z, doX ? -range : 0, doY ? -1 : 0, doZ ? -range : 0, doX ? range + 1 : 1, doY ? rangeY * 2 : 1, doZ ? range + 1 : 1, null, MATERIALS, silk, fortune, isTipped(stack));
|
||||
ToolCommons.removeBlocksInIteration(player, stack, world, pos, new BlockPos(doX ? -range : 0, doY ? -1 : 0, doZ ? -range : 0), new BlockPos(doX ? range + 1 : 1, doY ? rangeY * 2 : 1, doZ ? range + 1 : 1), null, MATERIALS, silk, fortune, isTipped(stack));
|
||||
if(origLevel == 5)
|
||||
player.addStat(ModAchievements.rankSSPick, 1);
|
||||
}
|
||||
@@ -194,11 +191,6 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
iconTipped = IconHelper.forItem(par1IconRegister, this, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return pass == 1 && isEnabled(stack) ? iconOverlay : isTipped(stack) ? iconTipped : iconTool;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* File Created @ [Mar 29, 2015, 10:12:50 PM (GMT)]
|
||||
*/
|
||||
/*package vazkii.botania.common.item.relic;
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,6 +45,7 @@ import vazkii.botania.common.lib.LibItemNames;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
/*
|
||||
public class ItemExcaliber extends ItemManasteelSword implements IRelic, ILensEffect {
|
||||
|
||||
private static final String TAG_ATTACKER_USERNAME = "attackerUsername";
|
||||
@@ -119,8 +120,8 @@ public class ItemExcaliber extends ItemManasteelSword implements IRelic, ILensEf
|
||||
@Override
|
||||
public Multimap getItemAttributeModifiers() {
|
||||
Multimap multimap = HashMultimap.create();
|
||||
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 10, 0));
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 0.3, 1));
|
||||
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Weapon modifier", 10, 0));
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Weapon modifier", 0.3, 1));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@@ -220,4 +221,4 @@ public class ItemExcaliber extends ItemManasteelSword implements IRelic, ILensEf
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
*/
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -90,7 +91,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
int cost = Math.min(cursorCount, (int) Math.pow(Math.E, cursorCount * 0.25));
|
||||
|
||||
if(heldItemStack == null && event.action == Action.RIGHT_CLICK_BLOCK && player.isSneaking()) {
|
||||
if(originCoords.posY == -1 && lookPos != null) {
|
||||
if(originCoords.getY() == -1 && lookPos != null) {
|
||||
setOriginPos(lokiRing, lookPos.blockX, lookPos.blockY, lookPos.blockZ);
|
||||
setCursorList(lokiRing, null);
|
||||
if(player instanceof EntityPlayerMP)
|
||||
@@ -138,7 +139,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
}
|
||||
}
|
||||
|
||||
public static void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side) {
|
||||
public static void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if(lokiRing == null || player.worldObj.isRemote || !(item instanceof ISequentialBreaker))
|
||||
return;
|
||||
@@ -152,12 +153,9 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
|
||||
for(int i = 0; i < cursors.size(); i++) {
|
||||
BlockPos coords = cursors.get(i);
|
||||
int xp = x + coords.posX;
|
||||
int yp = y + coords.posY;
|
||||
int zp = z + coords.posZ;
|
||||
Block block = world.getBlock(xp, yp, zp);
|
||||
breaker.breakOtherBlock(player, stack, xp, yp, zp, x, y, z, side);
|
||||
ToolCommons.removeBlockWithDrops(player, stack, player.worldObj, xp, yp, zp, x, y, z, block, new Material[] { block.getMaterial() }, silk, fortune, block.getBlockHardness(world, xp, yp, zp), dispose);
|
||||
Block block = world.getBlockState(coords).getBlock();
|
||||
breaker.breakOtherBlock(player, stack, coords, coords, side);
|
||||
ToolCommons.removeBlockWithDrops(player, stack, player.worldObj, coords, pos, block, new Material[] { block.getMaterial() }, silk, fortune, block.getBlockHardness(world, coords), dispose);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,11 +177,11 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
|
||||
MovingObjectPosition lookPos = Minecraft.getMinecraft().objectMouseOver;
|
||||
|
||||
if(lookPos != null && !player.worldObj.isAirBlock(lookPos.blockX, lookPos.blockY, lookPos.blockZ) && lookPos.entityHit == null) {
|
||||
if(lookPos != null && !player.worldObj.isAirBlock(lookPos.getBlockPos()) && lookPos.entityHit == null) {
|
||||
List<BlockPos> list = getCursorList(stack);
|
||||
BlockPos origin = getOriginPos(stack);
|
||||
|
||||
if(origin.posY != -1) {
|
||||
if(origin.getY() != -1) {
|
||||
for(BlockPos coords : list) {
|
||||
coords.posX += origin.posX;
|
||||
coords.posY += origin.posY;
|
||||
@@ -224,10 +222,10 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
return new BlockPos(x, y, z);
|
||||
}
|
||||
|
||||
private static void setOriginPos(ItemStack stack, int x, int y, int z) {
|
||||
ItemNBTHelper.setInt(stack, TAG_X_ORIGIN, x);
|
||||
ItemNBTHelper.setInt(stack, TAG_Y_ORIGIN, y);
|
||||
ItemNBTHelper.setInt(stack, TAG_Z_ORIGIN, z);
|
||||
private static void setOriginPos(ItemStack stack, BlockPos pos) {
|
||||
ItemNBTHelper.setInt(stack, TAG_X_ORIGIN, pos.getX());
|
||||
ItemNBTHelper.setInt(stack, TAG_Y_ORIGIN, pos.getY());
|
||||
ItemNBTHelper.setInt(stack, TAG_Z_ORIGIN, pos.getZ());
|
||||
}
|
||||
|
||||
private static List<BlockPos> getCursorList(ItemStack stack) {
|
||||
@@ -251,7 +249,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
if(cursors != null) {
|
||||
int i = 0;
|
||||
for(BlockPos cursor : cursors) {
|
||||
NBTTagCompound cursorCmp = cursorToCmp(cursor.posX, cursor.posY, cursor.posZ);
|
||||
NBTTagCompound cursorCmp = cursorToCmp(cursor);
|
||||
cmp.setTag(TAG_CURSOR_PREFIX + i, cursorCmp);
|
||||
i++;
|
||||
}
|
||||
@@ -261,18 +259,18 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
|
||||
ItemNBTHelper.setCompound(stack, TAG_CURSOR_LIST, cmp);
|
||||
}
|
||||
|
||||
private static NBTTagCompound cursorToCmp(int x, int y, int z) {
|
||||
private static NBTTagCompound cursorToCmp(BlockPos pos) {
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
cmp.setInteger(TAG_X_OFFSET, x);
|
||||
cmp.setInteger(TAG_Y_OFFSET, y);
|
||||
cmp.setInteger(TAG_Z_OFFSET, z);
|
||||
cmp.setInteger(TAG_X_OFFSET, pos.getX());
|
||||
cmp.setInteger(TAG_Y_OFFSET, pos.getY());
|
||||
cmp.setInteger(TAG_Z_OFFSET, pos.getZ());
|
||||
return cmp;
|
||||
}
|
||||
|
||||
private static void addCursor(ItemStack stack, int x, int y, int z) {
|
||||
private static void addCursor(ItemStack stack, BlockPos pos) {
|
||||
NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_CURSOR_LIST, false);
|
||||
int count = cmp.getInteger(TAG_CURSOR_COUNT);
|
||||
cmp.setTag(TAG_CURSOR_PREFIX + count, cursorToCmp(x, y, z));
|
||||
cmp.setTag(TAG_CURSOR_PREFIX + count, cursorToCmp(pos));
|
||||
cmp.setInteger(TAG_CURSOR_COUNT, count + 1);
|
||||
ItemNBTHelper.setCompound(stack, TAG_CURSOR_LIST, cmp);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user