mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made XP drops from drill dependent on the forge event
This commit is contained in:
parent
d2a5f3bb17
commit
61d7b783b3
1 changed files with 7 additions and 4 deletions
|
@ -30,7 +30,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||||
import net.minecraft.network.play.server.SPacketBlockChange;
|
import net.minecraft.network.play.server.SPacketBlockChange;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
@ -360,8 +360,10 @@ public class WorldUtil{
|
||||||
boolean canHarvest = block.canHarvestBlock(world, pos, player);
|
boolean canHarvest = block.canHarvestBlock(world, pos, player);
|
||||||
|
|
||||||
//Send Block Breaking Event
|
//Send Block Breaking Event
|
||||||
|
int xp = -1;
|
||||||
if(player instanceof EntityPlayerMP){
|
if(player instanceof EntityPlayerMP){
|
||||||
if(ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).interactionManager.getGameType(), (EntityPlayerMP)player, pos) == -1){
|
xp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).interactionManager.getGameType(), (EntityPlayerMP)player, pos);
|
||||||
|
if(xp == -1){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,8 +391,9 @@ public class WorldUtil{
|
||||||
}
|
}
|
||||||
//Only drop XP when no Silk Touch is applied
|
//Only drop XP when no Silk Touch is applied
|
||||||
if(EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) <= 0){
|
if(EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) <= 0){
|
||||||
//Drop XP depending on Fortune Level
|
if(xp >= 0){
|
||||||
block.dropXpOnBlockBreak(world, pos, block.getExpDrop(state, world, pos, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack)));
|
block.dropXpOnBlockBreak(world, pos, xp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue