2026-03-30 10:28:45 +02:00

55 lines
1.6 KiB
Java

package com.hbm.items.tool;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemMS extends Item {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Lost but not forgotten");
}
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float a, float b, float c) {
if(!world.isRemote) {
if(world.getBlock(x, y, z) == ModBlocks.ntm_dirt) {
world.func_147480_a(x, y, z, false);
List<ItemStack> list = new ArrayList<ItemStack>();
list.add(new ItemStack(ModItems.ingot_u238m2, 1, 1));
list.add(new ItemStack(ModItems.ingot_u238m2, 1, 2));
list.add(new ItemStack(ModItems.ingot_u238m2, 1, 3));
for(ItemStack sta : list) {
float f = itemRand.nextFloat() * 0.8F + 0.1F;
float f1 = itemRand.nextFloat() * 0.8F + 0.1F;
float f2 = itemRand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, sta);
float f3 = 0.05F;
entityitem.motionX = (float) itemRand.nextGaussian() * f3;
entityitem.motionY = (float) itemRand.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) itemRand.nextGaussian() * f3;
if(!world.isRemote)
world.spawnEntityInWorld(entityitem);
}
return true;
}
}
return false;
}
}