mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-25 06:24:54 +00:00
Spotless
This commit is contained in:
156 files changed
+14896
-13422
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package magicbees.item;
|
||||
|
||||
import forestry.api.arboriculture.IToolGrafter;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -9,53 +10,49 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.arboriculture.IToolGrafter;
|
||||
|
||||
public class ItemGrafter extends Item implements IToolGrafter {
|
||||
|
||||
public ItemGrafter() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
|
||||
this.setHarvestLevel("grafter", 3);
|
||||
}
|
||||
public ItemGrafter() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
|
||||
this.setHarvestLevel("grafter", 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) {
|
||||
return 100f;
|
||||
}
|
||||
@Override
|
||||
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) {
|
||||
return 100f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) {
|
||||
int damage = 1;
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
if (block == ThaumcraftHelper.leaf)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z) & 1;
|
||||
if (meta == 0 || meta == 1)
|
||||
{
|
||||
double chance = Math.random();
|
||||
if (chance <= Config.thaumcraftSaplingDroprate)
|
||||
{
|
||||
this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemstack.damageItem(damage, entityLiving);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) {
|
||||
int damage = 1;
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
if (block == ThaumcraftHelper.leaf) {
|
||||
int meta = world.getBlockMetadata(x, y, z) & 1;
|
||||
if (meta == 0 || meta == 1) {
|
||||
double chance = Math.random();
|
||||
if (chance <= Config.thaumcraftSaplingDroprate) {
|
||||
this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemstack.damageItem(damage, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void dropItem(World world, int x, int y, int z, ItemStack item) {
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, item);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
protected void dropItem(World world, int x, int y, int z, ItemStack item) {
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, item);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user