[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 18:04:28 -08:00
1 parent 83698cb73c
commit 84c2239244
561 files changed
+8872 -9300

No files matched your search

@@ -1,7 +1,7 @@
package tconstruct.items.tools;
import cpw.mods.fml.client.FMLClientHandler;
import java.util.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -18,11 +18,14 @@ import net.minecraft.stats.StatList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import tconstruct.library.*;
import tconstruct.library.tools.*;
import tconstruct.tools.TinkerTools;
import cpw.mods.fml.client.FMLClientHandler;
public class Scythe extends Weapon {
public Scythe() {
super(4);
this.setUnlocalizedName("InfiTool.Scythe");
@@ -37,9 +40,8 @@ public class Scythe extends Weapon {
return materials;
}
static Material[] materials = new Material[] {
Material.web, Material.cactus, Material.plants, Material.leaves, Material.vine, Material.gourd
};
static Material[] materials = new Material[] { Material.web, Material.cactus, Material.plants, Material.leaves,
Material.vine, Material.gourd };
@Override
public Item getHeadItem() {
@@ -121,7 +123,7 @@ public class Scythe extends Weapon {
@Override
public String[] getTraits() {
return new String[] {"weapon", "melee", "harvest"};
return new String[] { "weapon", "melee", "harvest" };
}
/* Scythe Specific */
@@ -149,53 +151,55 @@ public class Scythe extends Weapon {
if (!cancelHarvest) {
Block localBlock = world.getBlock(xPos, yPos, zPos);
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
float localHardness = localBlock == null
? Float.MAX_VALUE
float localHardness = localBlock == null ? Float.MAX_VALUE
: localBlock.getBlockHardness(world, xPos, yPos, zPos);
if (localBlock
!= null) // && (block.blockMaterial == Material.leaves || block.isLeaves(world,
if (localBlock != null) // && (block.blockMaterial == Material.leaves ||
// block.isLeaves(world,
// xPos, yPos, zPos)))
{
for (Material material : materials) {
if (material == localBlock.getMaterial()) {
if (!player.capabilities.isCreativeMode) {
if (butter
&& localBlock instanceof IShearable
if (butter && localBlock instanceof IShearable
&& ((IShearable) localBlock)
.isShearable(stack, player.worldObj, xPos, yPos, zPos)) {
ArrayList<ItemStack> drops = ((IShearable) localBlock)
.onSheared(
stack,
player.worldObj,
xPos,
yPos,
zPos,
EnchantmentHelper.getEnchantmentLevel(
Enchantment.fortune.effectId, stack));
ArrayList<ItemStack> drops = ((IShearable) localBlock).onSheared(
stack,
player.worldObj,
xPos,
yPos,
zPos,
EnchantmentHelper.getEnchantmentLevel(
Enchantment.fortune.effectId,
stack));
Random rand = new Random();
if (!world.isRemote)
for (ItemStack dropStack : drops) {
float f = 0.7F;
double d = (double) (rand.nextFloat() * f)
+ (double) (1.0F - f) * 0.5D;
double d1 = (double) (rand.nextFloat() * f)
+ (double) (1.0F - f) * 0.5D;
double d2 = (double) (rand.nextFloat() * f)
+ (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(
player.worldObj,
(double) xPos + d,
(double) yPos + d1,
(double) zPos + d2,
dropStack);
entityitem.delayBeforeCanPickup = 10;
player.worldObj.spawnEntityInWorld(entityitem);
}
if (!world.isRemote) for (ItemStack dropStack : drops) {
float f = 0.7F;
double d = (double) (rand.nextFloat() * f)
+ (double) (1.0F - f) * 0.5D;
double d1 = (double) (rand.nextFloat() * f)
+ (double) (1.0F - f) * 0.5D;
double d2 = (double) (rand.nextFloat() * f)
+ (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(
player.worldObj,
(double) xPos + d,
(double) yPos + d1,
(double) zPos + d2,
dropStack);
entityitem.delayBeforeCanPickup = 10;
player.worldObj.spawnEntityInWorld(entityitem);
}
if (localHardness > 0f)
onBlockDestroyed(
stack, world, localBlock, xPos, yPos, zPos, player);
if (localHardness > 0f) onBlockDestroyed(
stack,
world,
localBlock,
xPos,
yPos,
zPos,
player);
player.addStat(
StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)],
1);
@@ -208,7 +212,11 @@ public class Scythe extends Weapon {
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos, true)) {
localBlock.onBlockDestroyedByPlayer(
world, xPos, yPos, zPos, localMeta);
world,
xPos,
yPos,
zPos,
localMeta);
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
// Workaround for dropping experience
if (!butter)
@@ -219,26 +227,34 @@ public class Scythe extends Weapon {
INetHandler handler = FMLClientHandler.instance()
.getClientPlayHandler();
if (handler instanceof NetHandlerPlayClient) {
NetHandlerPlayClient handlerClient =
(NetHandlerPlayClient) handler;
handlerClient.addToSendQueue(new C07PacketPlayerDigging(
0,
x,
y,
z,
Minecraft.getMinecraft().objectMouseOver.sideHit));
handlerClient.addToSendQueue(new C07PacketPlayerDigging(
2,
x,
y,
z,
Minecraft.getMinecraft().objectMouseOver.sideHit));
NetHandlerPlayClient handlerClient = (NetHandlerPlayClient) handler;
handlerClient.addToSendQueue(
new C07PacketPlayerDigging(
0,
x,
y,
z,
Minecraft
.getMinecraft().objectMouseOver.sideHit));
handlerClient.addToSendQueue(
new C07PacketPlayerDigging(
2,
x,
y,
z,
Minecraft
.getMinecraft().objectMouseOver.sideHit));
}
}
if (localHardness > 0f)
onBlockDestroyed(
stack, world, localBlock, xPos, yPos, zPos, player);
if (localHardness > 0f) onBlockDestroyed(
stack,
world,
localBlock,
xPos,
yPos,
zPos,
player);
}
} else {
world.setBlockToAir(xPos, yPos, zPos);
@@ -258,13 +274,12 @@ public class Scythe extends Weapon {
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(
entity.posX,
entity.posY,
entity.posZ,
entity.posX + 1.0D,
entity.posY + 1.0D,
entity.posZ + 1.0D)
.expand(1.0D, 1.0D, 1.0D);
entity.posX,
entity.posY,
entity.posZ,
entity.posX + 1.0D,
entity.posY + 1.0D,
entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D);
List<Entity> list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
for (Entity e : list) {
AbilityHelper.onLeftClickEntity(stack, player, e, this);