mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
83698cb73c
commit
84c2239244
561 files changed
+8872
-9300
No files matched your search
@@ -1,15 +1,11 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import mantle.player.PlayerUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -18,11 +14,21 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
public class LumberAxe extends AOEHarvestTool {
|
||||
|
||||
public LumberAxe() {
|
||||
super(0, 1, 1);
|
||||
this.setUnlocalizedName("InfiTool.LumberAxe");
|
||||
@@ -49,25 +55,22 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z,
|
||||
EntityLivingBase player) {
|
||||
if (block != null && block.getMaterial() == Material.leaves) return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, block, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = {Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd};
|
||||
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd };
|
||||
|
||||
/* Lumber axe specific */
|
||||
|
||||
/*
|
||||
* @Override public void onUpdate (ItemStack stack, World world, Entity
|
||||
* entity, int par4, boolean par5) { super.onUpdate(stack, world, entity,
|
||||
* par4, par5); if (entity instanceof EntityPlayer) { EntityPlayer player =
|
||||
* (EntityPlayer) entity; ItemStack equipped =
|
||||
* player.getCurrentEquippedItem(); if (equipped == stack) {
|
||||
* player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); }
|
||||
* } }
|
||||
* @Override public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
* super.onUpdate(stack, world, entity, par4, par5); if (entity instanceof EntityPlayer) { EntityPlayer player =
|
||||
* (EntityPlayer) entity; ItemStack equipped = player.getCurrentEquippedItem(); if (equipped == stack) {
|
||||
* player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); } } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
@@ -89,18 +92,17 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
|
||||
if (wood == null) return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge)
|
||||
if (detectTree(world, x, y, z)) {
|
||||
TreeChopTask chopper = new TreeChopTask(this, stack, new ChunkPosition(x, y, z), player, 128);
|
||||
try {
|
||||
FMLCommonHandler.instance().bus().register(chopper);
|
||||
} catch (LinkageError l) {
|
||||
PlayerUtils.sendChatMessage(player, "Well, that's embarrassing, you missed!");
|
||||
FMLLog.warning("Unable to spawn TreeChopTask due to LinkageError");
|
||||
}
|
||||
// custom block breaking code, don't call vanilla code
|
||||
return true;
|
||||
if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge) if (detectTree(world, x, y, z)) {
|
||||
TreeChopTask chopper = new TreeChopTask(this, stack, new ChunkPosition(x, y, z), player, 128);
|
||||
try {
|
||||
FMLCommonHandler.instance().bus().register(chopper);
|
||||
} catch (LinkageError l) {
|
||||
PlayerUtils.sendChatMessage(player, "Well, that's embarrassing, you missed!");
|
||||
FMLLog.warning("Unable to spawn TreeChopTask due to LinkageError");
|
||||
}
|
||||
// custom block breaking code, don't call vanilla code
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
@@ -142,8 +144,7 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
for (int offX = 0; offX < d; offX++) {
|
||||
for (int offY = 0; offY < d; offY++) {
|
||||
for (int offZ = 0; offZ < d; offZ++) {
|
||||
int xPos = pos.chunkPosX - 1 + offX,
|
||||
yPos = pos.chunkPosY - 1 + offY,
|
||||
int xPos = pos.chunkPosX - 1 + offX, yPos = pos.chunkPosY - 1 + offY,
|
||||
zPos = pos.chunkPosZ - 1 + offZ;
|
||||
Block leaf = world.getBlock(xPos, yPos, zPos);
|
||||
if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos)) {
|
||||
@@ -170,8 +171,8 @@ public class LumberAxe extends AOEHarvestTool {
|
||||
public Queue<ChunkPosition> blocks = Lists.newLinkedList();
|
||||
public Set<ChunkPosition> visited = new THashSet<>();
|
||||
|
||||
public TreeChopTask(
|
||||
AOEHarvestTool tool, ItemStack stack, ChunkPosition start, EntityPlayer player, int blocksPerTick) {
|
||||
public TreeChopTask(AOEHarvestTool tool, ItemStack stack, ChunkPosition start, EntityPlayer player,
|
||||
int blocksPerTick) {
|
||||
this.world = player.getEntityWorld();
|
||||
this.player = player;
|
||||
this.tool = tool;
|
||||
|
||||
Reference in new issue
Block a user