Spring Cleaning (#127)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
koolkrafter5andgithub-actions[bot] authored and GitHub committed 2026-05-12 20:52:29 +02:00
1 parent 1544c1bf0d
commit 3b2b31f733
413 files changed
+9272 -17658

No files matched your search

@@ -12,12 +12,13 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
@@ -33,7 +34,6 @@ import gregtech.common.blocks.GTBlockOre;
public class BoundPickaxe extends ItemPickaxe implements IBindable {
public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity;
public int rightClickCost = 10000;
@SideOnly(Side.CLIENT)
@@ -47,8 +47,6 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
public BoundPickaxe() {
super(AlchemicalWizardry.bloodBoundToolMaterial);
this.maxStackSize = 1;
this.efficiencyOnProperMaterial = 12.0F;
this.damageVsEntity = 5;
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setEnergyUsed(5);
setHarvestLevel("pickaxe", 7);
@@ -68,10 +66,10 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc2"));
addBindingInformation(par1ItemStack, par3List);
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean adv) {
tooltip.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc1"));
tooltip.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc2"));
addBindingInformation(stack, tooltip);
}
@Override
@@ -92,64 +90,68 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
return par1ItemStack;
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
if (checkRightClick(item, world, player)) {
return item;
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
Vec3 blockVec = SpellHelper.getEntityBlockVector(player);
int posX = (int) (blockVec.xCoord);
int posY = (int) (blockVec.yCoord);
int posZ = (int) (blockVec.zCoord);
boolean silkTouch = EnchantmentHelper.getSilkTouchModifier(par3EntityPlayer);
int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer);
boolean silkTouch = EnchantmentHelper.getSilkTouchModifier(player);
int fortuneLvl = EnchantmentHelper.getFortuneModifier(player);
HashMultiset<ItemType> dropMultiset = HashMultiset.create();
for (int i = -5; i <= 5; i++) {
for (int j = -5; j <= 5; j++) {
for (int k = -5; k <= 5; k++) {
Block block = par2World.getBlock(posX + i, posY + j, posZ + k);
int meta = par2World.getBlockMetadata(posX + i, posY + j, posZ + k);
int x = posX + i;
int y = posY + j;
int z = posZ + k;
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if (checkPermissions(world, x, y, z, block, meta, player)) continue;
if (block != null && block.getBlockHardness(par2World, posX + i, posY + j, posZ + k) != -1) {
float str = func_150893_a(par1ItemStack, block);
if (block == null || block.getBlockHardness(world, x, y, z) == -1
|| !world.canMineBlock(player, x, y, z)) {
continue;
}
if (str > 1.1f && par2World.canMineBlock(par3EntityPlayer, posX + i, posY + j, posZ + k)) {
if (silkTouch && block
.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta)) {
dropMultiset.add(new ItemType(block, meta));
} else {
ArrayList<ItemStack> itemDropList;
if (AlchemicalWizardry.isGregTechLoaded && block instanceof GTBlockOre) {
itemDropList = ((GTBlockOre) block).getDropsForPlayer(
par2World,
posX + i,
posY + j,
posZ + k,
meta,
fortuneLvl,
par3EntityPlayer);
} else {
itemDropList = block
.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
}
// getStrVsBlock
if (func_150893_a(item, block) <= 1f) {
continue;
}
if (silkTouch && block.canSilkHarvest(world, player, x, y, z, meta)) {
dropMultiset.add(new ItemType(block, meta));
} else {
ArrayList<ItemStack> itemDropList;
if (AlchemicalWizardry.isGregTechLoaded && block instanceof GTBlockOre ore) {
itemDropList = ore.getDropsForPlayer(world, x, y, z, meta, fortuneLvl, player);
} else {
itemDropList = block.getDrops(world, x, y, z, meta, fortuneLvl);
}
if (itemDropList != null) {
for (ItemStack stack : itemDropList)
dropMultiset.add(ItemType.fromStack(stack), stack.stackSize);
}
}
par2World.setBlockToAir(posX + i, posY + j, posZ + k);
if (itemDropList != null) {
for (ItemStack stack : itemDropList)
dropMultiset.add(ItemType.fromStack(stack), stack.stackSize);
}
}
world.setBlockToAir(x, y, z);
}
}
}
dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ);
dropMultisetStacks(dropMultiset, world, posX, posY + player.getEyeHeight(), posZ);
return par1ItemStack;
return item;
}
public static boolean checkPermissions(World world, int x, int y, int z, Block block, int meta,
EntityPlayer player) {
final BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(x, y, z, world, block, meta, player);
return MinecraftForge.EVENT_BUS.post(event);
}
public static void dropMultisetStacks(Multiset<ItemType> dropMultiset, World world, double x, double y, double z) {
@@ -169,20 +171,13 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
if (!(par3Entity instanceof EntityPlayer)) {
public void onUpdate(ItemStack item, World world, Entity entity, int slot, boolean held) {
if (!(entity instanceof EntityPlayer player)) {
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setItemDamage(0);
checkPassiveDrain(item, world, player);
item.setItemDamage(0);
}
/**
@@ -190,55 +185,35 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
* sword
*/
@Override
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) // getStrVsBlock
{
if (!IBindable.isActive(par1ItemStack)) {
return 0.0F;
}
return super.func_150893_a(par1ItemStack, par2Block);
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
EntityLivingBase par3EntityLivingBase) {
return IBindable.isActive(par1ItemStack);
public float func_150893_a(ItemStack item, Block block) { // getStrVsBlock
return !IBindable.isActive(item) ? 0.0F : super.func_150893_a(item, block);
}
@Override
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6,
EntityLivingBase par7EntityLivingBase) {
public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase attacker) {
return IBindable.isActive(item);
}
if (par7EntityLivingBase instanceof EntityPlayer) {
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, drainCost());
@Override
public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z,
EntityLivingBase user) {
if (user instanceof EntityPlayer player) {
EnergyItems.syphonBatteries(item, player, drainCost());
}
return true;
}
@Override
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D() {
return true;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
@Override
public int getItemEnchantability() {
return 30;
}
/**
* FORGE: Overridden to allow custom tool effectiveness
*/
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!IBindable.isActive(stack)) {