forked from TAIGA/TAIGA
Lot of traits!
This commit is contained in:
@@ -7,12 +7,13 @@ import slimeknights.tconstruct.library.materials.HeadMaterialStats;
|
||||
import slimeknights.tconstruct.library.materials.Material;
|
||||
|
||||
import static com.sosnitzka.ztic_addon.ZTiC.*;
|
||||
import static slimeknights.tconstruct.tools.TinkerMaterials.enderference;
|
||||
|
||||
public class Materials {
|
||||
public static Material arcanite = new Material("arcanite", TextFormatting.LIGHT_PURPLE).addTrait(arcane, HeadMaterialStats.TYPE).addTrait(dark, HandleMaterialStats.TYPE);
|
||||
public static Material tiberium = new Material("tiberium", TextFormatting.LIGHT_PURPLE).addTrait(instable);
|
||||
public static Material prometheum = new Material("prometheum", TextFormatting.LIGHT_PURPLE).addTrait(haunted, HeadMaterialStats.TYPE).addTrait(dark, HandleMaterialStats.TYPE);
|
||||
public static Material rubium = new Material("rubium", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material arcanite = new Material("arcanite", TextFormatting.LIGHT_PURPLE).addTrait(arcane, HeadMaterialStats.TYPE).addTrait(blind);
|
||||
public static Material tiberium = new Material("tiberium", TextFormatting.GREEN).addTrait(instable);
|
||||
public static Material prometheum = new Material("prometheum", TextFormatting.DARK_PURPLE).addTrait(haunted, HeadMaterialStats.TYPE).addTrait(blind);
|
||||
public static Material rubium = new Material("rubium", TextFormatting.RED).addTrait(enderference, HeadMaterialStats.TYPE).addTrait(blind);
|
||||
public static Material violium = new Material("violium", TextFormatting.DARK_GREEN).addTrait(analysing);
|
||||
public static Material bismuth = new Material("bismuth", TextFormatting.DARK_GREEN);
|
||||
public static Material karmesine = new Material("karmesine", TextFormatting.DARK_GREEN);
|
||||
@@ -30,14 +31,14 @@ public class Materials {
|
||||
public static Material nitronite = new Material("nitronite", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material proxideum = new Material("proxideum", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material noctunyx = new Material("noctunyx", TextFormatting.LIGHT_PURPLE);
|
||||
public static Material imperomite = new Material("imperomite", TextFormatting.DARK_GREEN);
|
||||
public static Material imperomite = new Material("imperomite", TextFormatting.DARK_GREEN).addTrait(heroic);
|
||||
public static Material cryptogen = new Material("cryptogen", TextFormatting.DARK_GREEN);
|
||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED).addTrait(frature, HeadMaterialStats.TYPE).addTrait(fragile, HandleMaterialStats.TYPE);
|
||||
public static Material seismodium = new Material("seismodium", TextFormatting.DARK_GREEN).addTrait(cascade, HeadMaterialStats.TYPE).addTrait(fragile, HandleMaterialStats.TYPE);
|
||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED).addTrait(frature, HeadMaterialStats.TYPE).addTrait(fragile);
|
||||
public static Material seismodium = new Material("seismodium", TextFormatting.DARK_GREEN).addTrait(cascade, HeadMaterialStats.TYPE).addTrait(fragile);
|
||||
public static Material terramite = new Material("terramite", TextFormatting.GRAY);
|
||||
public static Material lumixyl = new Material("lumixyl", TextFormatting.YELLOW).addTrait(glimmer);
|
||||
public static Material solarium = new Material("solarium", TextFormatting.RED).addTrait(garishly);
|
||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY).addTrait(slaughtering, HeadMaterialStats.TYPE).addTrait(dissolving, HandleMaterialStats.TYPE);
|
||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY).addTrait(slaughtering, HeadMaterialStats.TYPE).addTrait(dissolving);
|
||||
public static Material ultranite = new Material("ultranite", TextFormatting.AQUA);
|
||||
public static Material nucleum = new Material("nucleum", TextFormatting.AQUA);
|
||||
public static Material aegisalt = new Material("aegisalt", TextFormatting.AQUA);
|
||||
|
@@ -44,6 +44,7 @@ public class ZTiC {
|
||||
public static final AbstractTrait pulverizing = new TraitPulverizing();
|
||||
public static final AbstractTrait analysing = new TraitAnalysing();
|
||||
public static final AbstractTrait cascade = new TraitCascade();
|
||||
public static final AbstractTrait blind = new TraitBlind();
|
||||
public static final AbstractTrait dark = new TraitDark();
|
||||
public static final AbstractTrait slaughtering = new TraitSlaughtering();
|
||||
public static final AbstractTrait haunted = new TraitHaunted();
|
||||
@@ -51,6 +52,7 @@ public class ZTiC {
|
||||
public static final AbstractTrait dissolving = new TraitDissolving();
|
||||
public static final AbstractTrait bentonite = new TraitBentonite();
|
||||
public static final AbstractTrait arcane = new TraitArcane();
|
||||
public static final AbstractTrait heroic = new TraitHeroic();
|
||||
|
||||
static final String MODID = "ztic_addon";
|
||||
static final String VERSION = "@VERSION@";
|
||||
|
@@ -22,16 +22,15 @@ public class TraitArcane extends AbstractTrait {
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
int time = (int) world.getWorldTime();
|
||||
if (random.nextFloat() <= 0.1 && isNight(time)) {
|
||||
ToolHelper.healTool(tool, random.nextInt(21) + 1, null);
|
||||
ToolHelper.healTool(tool, random.nextInt(15) + 1, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
int time = (int) player.getEntityWorld().getWorldTime();
|
||||
if (random.nextFloat() <= 0.1 && isNight(time)) {
|
||||
ToolHelper.healTool(tool, random.nextInt(21) + 1, null);
|
||||
ToolHelper.healTool(tool, random.nextInt(15) + 1, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,47 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitBlind extends AbstractTrait {
|
||||
|
||||
public TraitBlind() {
|
||||
super("blind", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,13 +1,8 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
|
||||
/**
|
||||
@@ -20,22 +15,13 @@ public class TraitDark extends AbstractTrait {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
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));
|
||||
}
|
||||
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||
int time = (int) target.getEntityWorld().getWorldTime();
|
||||
if (isNight(time)) {
|
||||
newDamage += damage / 2f;
|
||||
}
|
||||
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
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) {
|
||||
|
@@ -19,11 +19,16 @@ public class TraitDissolving extends AbstractTrait {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
// high chance to remove XP, low chance to double,triple or quatruple dropped Experience
|
||||
@SubscribeEvent
|
||||
public void onXpDrop(LivingExperienceDropEvent event) {
|
||||
EntityPlayer player = event.getAttackingPlayer();
|
||||
if (random.nextFloat() < 0.3 && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||
float r = random.nextFloat();
|
||||
if (r <= 0.75 && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||
event.setDroppedExperience(0);
|
||||
}
|
||||
if (r > 0.95 && player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||
event.setDroppedExperience(event.getDroppedExperience() * (random.nextInt(3) + 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -67,13 +68,13 @@ public class TraitGarishly extends AbstractTrait {
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
int i = random.nextInt(10);
|
||||
if (i == 9) event.getDrops().clear();
|
||||
else if (i == 1 || i == 2 || i == 3) {
|
||||
ItemStack stack = new ItemStack(Item.getItemFromBlock(event.getWorld().getBlockState(event.getPos()).getBlock()), i);
|
||||
float r = random.nextFloat();
|
||||
if (r > 0.9f) event.getDrops().clear();
|
||||
else if (r < 0.5f && r > 0.4f && event.getWorld().getBlockState(event.getPos()).getMaterial() == Material.ROCK) {
|
||||
ItemStack stack = new ItemStack(Item.getItemFromBlock(event.getWorld().getBlockState(event.getPos()).getBlock()), random.nextInt(5));
|
||||
event.getDrops().add(0, stack);
|
||||
ToolHelper.damageTool(tool, i * 2, event.getHarvester());
|
||||
} else if (i == 0 && random.nextBoolean())
|
||||
ToolHelper.damageTool(tool, random.nextInt(6) + 1, event.getHarvester());
|
||||
} else if (r < 1 && random.nextBoolean())
|
||||
event.getWorld().setBlockState(event.getPos(), Blocks.LAVA.getDefaultState());
|
||||
}
|
||||
|
||||
|
@@ -39,15 +39,15 @@ public class TraitGlimmer extends AbstractTrait {
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (random.nextFloat() <= 0.02) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 300));
|
||||
if (random.nextFloat() <= 0.05) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
if (random.nextFloat() <= 0.05) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 300));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, random.nextInt(600) + 300));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,34 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
/**
|
||||
* Created by Robert on 30.06.2016.
|
||||
*/
|
||||
public class TraitHeroic extends AbstractTrait {
|
||||
|
||||
public TraitHeroic() {
|
||||
super("heroic", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||
int durability = ToolHelper.getCurrentDurability(tool);
|
||||
int durabilitymax = ToolHelper.getMaxDurability(tool);
|
||||
float bonus = (float) (0.01f + ((2.5f - 0.2f) / (durability - durabilitymax - 1)) * (durability - durabilitymax));
|
||||
System.out.println("Dura: " + durability + " DuraMax: " + durabilitymax);
|
||||
System.out.println("Modifier: " + bonus);
|
||||
return super.damage(tool, player, target, damage, newDamage * bonus, isCritical);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
||||
System.out.println("Damage: " + damage);
|
||||
}
|
||||
|
||||
}
|
@@ -29,6 +29,7 @@ public class TraitPulverizing extends AbstractTrait {
|
||||
int durability = ToolHelper.getCurrentDurability(tool);
|
||||
int maxDurability = ToolHelper.getMaxDurability(tool);
|
||||
float speed = ToolHelper.getMiningSpeedStat(tool);
|
||||
tool.setItemDamage(tool.getItemDamage() + 1);
|
||||
return speed * (maxDurability - maxDurability / 10) / (durability);
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,6 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
@@ -25,14 +24,6 @@ public class TraitSlaughtering extends AbstractTrait {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onXpDrop(LivingExperienceDropEvent event) {
|
||||
EntityPlayer player = event.getAttackingPlayer();
|
||||
if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||
event.setDroppedExperience(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
|
Reference in New Issue
Block a user