forked from TAIGA/TAIGA
Added separate handle and head traits for several materials, to specify them more.
This commit is contained in:
@@ -9,7 +9,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
@@ -22,20 +21,28 @@ public class TraitDark extends AbstractTrait {
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (random.nextFloat() <= 0.1) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 300));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 300));
|
||||
ToolHelper.healTool(tool, random.nextInt(51) + 10, null);
|
||||
int time = (int) world.getWorldTime();
|
||||
if (random.nextFloat() <= 0.05 || (random.nextFloat() <= 0.3 && isNight(time))) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(400) + 200));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, random.nextInt(400) + 200));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
if (random.nextFloat() <= 0.1) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 300));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 300));
|
||||
ToolHelper.healTool(tool, random.nextInt(51) + 10, null);
|
||||
int time = (int) player.getEntityWorld().getWorldTime();
|
||||
if (random.nextFloat() <= 0.05 || (random.nextFloat() <= 0.3 && isNight(time))) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(400) + 200));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, random.nextInt(400) + 200));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNight(int time) {
|
||||
if (time > 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user