forked from TAIGA/TAIGA
Last traits added. Renamed most Items, Blocks & Traits.
This commit is contained in:
@@ -7,40 +7,40 @@ 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;
|
||||
import static slimeknights.tconstruct.tools.TinkerMaterials.*;
|
||||
|
||||
public class Materials {
|
||||
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);
|
||||
public static Material mindorite = new Material("mindorite", TextFormatting.DARK_GREEN);
|
||||
public static Material titanite = new Material("titanite", TextFormatting.GRAY);
|
||||
public static Material meteorite = new Material("meteorite", TextFormatting.GRAY);
|
||||
public static Material adamantite = new Material("adamantite", TextFormatting.GRAY);
|
||||
public static Material violium = new Material("violium", TextFormatting.DARK_GREEN).addTrait(stonebound, HandleMaterialStats.TYPE).addTrait(poisonous, HeadMaterialStats.TYPE);
|
||||
public static Material bismuth = new Material("bismuth", TextFormatting.GREEN).addTrait(splintering, HeadMaterialStats.TYPE).addTrait(splinters, HandleMaterialStats.TYPE);
|
||||
public static Material karmesine = new Material("karmesine", TextFormatting.DARK_RED).addTrait(aridiculous, HandleMaterialStats.TYPE).addTrait(superheat, HeadMaterialStats.TYPE);
|
||||
public static Material mindorite = new Material("mindorite", TextFormatting.AQUA).addTrait(cheap);
|
||||
public static Material titanite = new Material("titanite", TextFormatting.GRAY).addTrait(shocking, HandleMaterialStats.TYPE).addTrait(sharp, HeadMaterialStats.TYPE);
|
||||
public static Material meteorite = new Material("meteorite", TextFormatting.GRAY).addTrait(established, HandleMaterialStats.TYPE).addTrait(momentum, HeadMaterialStats.TYPE);
|
||||
public static Material adamantite = new Material("adamantite", TextFormatting.GRAY).addTrait(coldblooded, HeadMaterialStats.TYPE).addTrait(magnetic, HandleMaterialStats.TYPE);
|
||||
public static Material vibranium = new Material("vibranium", TextFormatting.GRAY).addTrait(resonance);
|
||||
public static Material ignitite = new Material("ignitite", TextFormatting.AQUA);
|
||||
public static Material palladium = new Material("palladium", TextFormatting.AQUA);
|
||||
public static Material eternite = new Material("eternite", TextFormatting.AQUA);
|
||||
public static Material mythril = new Material("mythril", TextFormatting.GRAY).addTrait(pulverizing, HeadMaterialStats.TYPE).addTrait(bentonite, HandleMaterialStats.TYPE);
|
||||
public static Material ignitite = new Material("ignitite", TextFormatting.RED).addTrait(hellish, HandleMaterialStats.TYPE).addTrait(flammable, HeadMaterialStats.TYPE);
|
||||
public static Material palladium = new Material("palladium", TextFormatting.DARK_GRAY).addTrait(dark);
|
||||
public static Material eternite = new Material("eternite", TextFormatting.AQUA).addTrait(writable2);
|
||||
public static Material mythril = new Material("mythril", TextFormatting.GRAY).addTrait(bentonite);
|
||||
|
||||
public static Material astrium = new Material("astrium", TextFormatting.LIGHT_PURPLE);
|
||||
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 astrium = new Material("astrium", TextFormatting.BLACK).addTrait(curvature);
|
||||
public static Material nitronite = new Material("nitronite", TextFormatting.DARK_AQUA).addTrait(uncertain);
|
||||
public static Material proxideum = new Material("proxideum", TextFormatting.LIGHT_PURPLE).addTrait(softy, HandleMaterialStats.TYPE).addTrait(lightweight);
|
||||
public static Material noctunyx = new Material("noctunyx", TextFormatting.LIGHT_PURPLE).addTrait(hollow);
|
||||
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);
|
||||
public static Material cryptogen = new Material("cryptogen", TextFormatting.DARK_GREEN).addTrait(randomize);
|
||||
public static Material fractoryte = new Material("fractoryte", TextFormatting.DARK_RED).addTrait(fracture, 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 terramite = new Material("terramite", TextFormatting.GRAY).addTrait(naturebound).addTrait(fragile);
|
||||
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);
|
||||
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);
|
||||
public static Material bysmuid = new Material("bysmuid", TextFormatting.AQUA);
|
||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY).addTrait(slaughtering, HeadMaterialStats.TYPE).addTrait(dissolving, HandleMaterialStats.TYPE);
|
||||
public static Material ultranite = new Material("ultranite", TextFormatting.AQUA).addTrait(pulverizing);
|
||||
public static Material nucleum = new Material("nucleum", TextFormatting.AQUA).addTrait(diffuse).addTrait(bright, HeadMaterialStats.TYPE);
|
||||
public static Material aegisalt = new Material("aegisalt", TextFormatting.AQUA).addTrait(analysing);
|
||||
public static Material bysmuid = new Material("bysmuid", TextFormatting.AQUA).addTrait(dense, HandleMaterialStats.TYPE).addTrait(sharp, HeadMaterialStats.TYPE);
|
||||
}
|
||||
|
@@ -37,8 +37,12 @@ public class ZTiC {
|
||||
public static final int VIBRANIUM = 7;
|
||||
public static final int ADAMANTITE = 8;
|
||||
public static final AbstractTrait instable = new TraitInstable();
|
||||
public static final AbstractTrait naturebound = new TraitNatureBound();
|
||||
public static final AbstractTrait uncertain = new TraitUncertain();
|
||||
public static final AbstractTrait softy = new TraitSofty();
|
||||
public static final AbstractTrait curvature = new TraitCurvature();
|
||||
public static final AbstractTrait resonance = new TraitResonance();
|
||||
public static final AbstractTrait frature = new TraitFracture();
|
||||
public static final AbstractTrait fracture = new TraitFracture();
|
||||
public static final AbstractTrait glimmer = new TraitGlimmer();
|
||||
public static final AbstractTrait garishly = new TraitGarishly();
|
||||
public static final AbstractTrait pulverizing = new TraitPulverizing();
|
||||
@@ -46,6 +50,7 @@ public class ZTiC {
|
||||
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 bright = new TraitBright();
|
||||
public static final AbstractTrait slaughtering = new TraitSlaughtering();
|
||||
public static final AbstractTrait haunted = new TraitHaunted();
|
||||
public static final AbstractTrait fragile = new TraitFragile();
|
||||
@@ -53,6 +58,9 @@ public class ZTiC {
|
||||
public static final AbstractTrait bentonite = new TraitBentonite();
|
||||
public static final AbstractTrait arcane = new TraitArcane();
|
||||
public static final AbstractTrait heroic = new TraitHeroic();
|
||||
public static final AbstractTrait hollow = new TraitHollow();
|
||||
public static final AbstractTrait diffuse = new TraitDiffuse();
|
||||
public static final AbstractTrait randomize = new TraitRandomize();
|
||||
|
||||
static final String MODID = "ztic_addon";
|
||||
static final String VERSION = "@VERSION@";
|
||||
@@ -101,7 +109,7 @@ public class ZTiC {
|
||||
registerTinkerMaterial("Solarium", solarium, solariumFluid, 1020, 13.78f, 4.64f, 1.15f, 0, 150, ADAMANTITE, false, true);
|
||||
registerTinkerMaterial("Fractoryte", fractoryte, fractoryteFluid, 1071, 7.65f, 7.75f, 1.15f, -250, 283, METEORITE, false, true);
|
||||
registerTinkerMaterial("Aegisalt", aegisalt, aegisaltFluid, 355, 8.88f, 3.18f, 1.00f, 175, 125, TITANITE, false, true);
|
||||
registerTinkerMaterial("Nocturnyx", noctunyx, noctunyxFluid, 713, 10.43f, 3.25f, 0.99f, -125, 183, METEORITE, false, true);
|
||||
registerTinkerMaterial("Noctunyx", noctunyx, noctunyxFluid, 713, 10.43f, 3.25f, 0.99f, -125, 183, METEORITE, false, true);
|
||||
registerTinkerMaterial("Nucleum", nucleum, nucleumFluid, 503, 11.30f, 3.22f, 1.05f, 100, 125, TITANITE, false, true);
|
||||
registerTinkerMaterial("Seismodium", seismodium, seismodiumFluid, 879, 13.85f, 4.19f, 1.17f, -75, 169, VIBRANIUM, false, true);
|
||||
registerTinkerMaterial("Lumixyl", lumixyl, lumixylFluid, 357, 4.64f, 5.92f, 1.05f, 15, 130, COBALT, false, true);
|
||||
|
@@ -54,7 +54,7 @@ public class TraitAnalysing extends AbstractTrait {
|
||||
}
|
||||
|
||||
private int getUpdateXP(int xp) {
|
||||
float exp = (float) random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + 8) * 50;
|
||||
float exp = (float) random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + 18) * 50;
|
||||
return Math.round(exp);
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ public class TraitBlind 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))) {
|
||||
if (random.nextFloat() <= 0.05 || (random.nextFloat() <= 0.1 && isNight(time))) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(400) + 200));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, random.nextInt(400) + 200));
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class TraitBlind extends AbstractTrait {
|
||||
@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))) {
|
||||
if (random.nextFloat() <= 0.05 || (random.nextFloat() <= 0.1 && isNight(time))) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, random.nextInt(400) + 200));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, random.nextInt(400) + 200));
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitBright extends AbstractTrait {
|
||||
|
||||
public TraitBright() {
|
||||
super("bright", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float damage(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, float newDamage, boolean isCritical) {
|
||||
int time = (int) target.getEntityWorld().getWorldTime();
|
||||
if (isDay(time)) {
|
||||
newDamage += damage / 2f;
|
||||
}
|
||||
return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||
|
||||
}
|
||||
|
||||
public boolean isDay(int time) {
|
||||
if (time < 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
|
||||
public class TraitCurvature extends AbstractTrait {
|
||||
|
||||
|
||||
public TraitCurvature() {
|
||||
super("curvature", TextFormatting.BLACK);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (random.nextFloat() <= 0.05 && world.provider.getDimension() != -1) {
|
||||
teleport(player, world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean wasCritical, boolean wasHit) {
|
||||
World w = player.getEntityWorld();
|
||||
if (random.nextFloat() <= 0.1 && w.provider.getDimension() != -1) {
|
||||
if (random.nextBoolean()) {
|
||||
teleport(player, w);
|
||||
} else {
|
||||
teleport(target, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
if (!w.isRemote && event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||
ItemStack i = new ItemStack(Items.ENDER_PEARL, random.nextInt(3));
|
||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void teleport(EntityLivingBase e, World w) {
|
||||
int x = e.getPosition().getX() + random.nextInt(250) - 125;
|
||||
int y = e.getPosition().getY();
|
||||
int z = e.getPosition().getZ() + random.nextInt(250) - 125;
|
||||
while (w.getBlockState(new BlockPos(x, y, z)).getBlock() != Blocks.AIR) {
|
||||
y++;
|
||||
}
|
||||
while (w.getBlockState(new BlockPos(x, y - 1, z)).getBlock() == Blocks.AIR) {
|
||||
y--;
|
||||
}
|
||||
e.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
/**
|
||||
* Created by Robert on 09.06.2016.
|
||||
*/
|
||||
public class TraitDiffuse extends AbstractTrait {
|
||||
|
||||
public TraitDiffuse() {
|
||||
super("diffuse", TextFormatting.DARK_GRAY);
|
||||
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 onBlockBreak(BlockEvent.BreakEvent event) {
|
||||
EntityPlayer player = event.getPlayer();
|
||||
if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
|
||||
event.setExpToDrop(this.getUpdateXP(event.getExpToDrop()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
if (!w.isRemote && event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getUpdateXP(int xp) {
|
||||
float exp = (float) random.nextFloat() * random.nextFloat() * random.nextFloat() * (xp + random.nextInt(10));
|
||||
if (random.nextBoolean())
|
||||
return Math.round(exp);
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
if (random.nextFloat() < 0.75) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -29,7 +29,7 @@ public class TraitHaunted extends AbstractTrait {
|
||||
target instanceof EntityBlaze || target instanceof EntityWitch || target instanceof EntityHorse) {
|
||||
((EntityLiving) target).tasks.taskEntries.clear();
|
||||
((EntityLiving) target).targetTasks.taskEntries.clear();
|
||||
((EntityLiving) target).tasks.addTask(0, new EntityAIPermanentPanic((EntityCreature) target, target.getAIMoveSpeed() + 2.0D));
|
||||
((EntityLiving) target).tasks.addTask(0, new EntityAIPermanentPanic((EntityCreature) target, target.getAIMoveSpeed() + 3.5D));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -19,10 +19,10 @@ public class TraitHeroic extends AbstractTrait {
|
||||
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);
|
||||
float calc = (float) (newDamage + (newDamage / 2) / (durability * durabilitymax / (durabilitymax - durability)));
|
||||
if ((float) durability < (float) (0.12 * durabilitymax)) {
|
||||
return super.damage(tool, player, target, damage, calc, isCritical);
|
||||
} else return super.damage(tool, player, target, damage, newDamage, isCritical);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,54 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
public class TraitHollow extends AbstractTrait {
|
||||
|
||||
public TraitHollow() {
|
||||
super("hollow", TextFormatting.DARK_GRAY);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
||||
int time = (int) player.getEntityWorld().getWorldTime();
|
||||
if (random.nextFloat() <= 0.2 || (random.nextFloat() <= 0.2 && isNight(time))) {
|
||||
((EntityLiving) target).setNoAI(true);
|
||||
if (target.getMaxHealth() < 200) {
|
||||
target.setHealth(target.getMaxHealth() * (1.8f - random.nextFloat() * 0.4f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
if (!w.isRemote && random.nextFloat() <= 0.2 && event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNight(int time) {
|
||||
if (time > 12500) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
|
||||
public class TraitNatureBound extends AbstractTrait {
|
||||
public static DamageSource splinter = new DamageSource("splinter").setDamageBypassesArmor();
|
||||
private static int chance = 10;
|
||||
|
||||
public TraitNatureBound() {
|
||||
super("naturebound", TextFormatting.GREEN);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||
// *20 because 20 ticks in a second
|
||||
if (!world.isRemote && entity instanceof EntityLivingBase && random.nextInt(20 * chance) == 0) {
|
||||
ToolHelper.healTool(tool, 1, (EntityLivingBase) entity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,175 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.monster.*;
|
||||
import net.minecraft.entity.passive.*;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
import slimeknights.tconstruct.world.entity.EntityBlueSlime;
|
||||
|
||||
import static com.sosnitzka.ztic_addon.Blocks.*;
|
||||
import static slimeknights.tconstruct.shared.TinkerCommons.oreArdite;
|
||||
import static slimeknights.tconstruct.shared.TinkerCommons.oreCobalt;
|
||||
|
||||
/**
|
||||
* Created by Robert on 03.06.2016.
|
||||
*/
|
||||
public class TraitRandomize extends AbstractTrait {
|
||||
|
||||
public TraitRandomize() {
|
||||
super("randomize", TextFormatting.DARK_RED);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
|
||||
if (ToolHelper.isToolEffective2(tool, event.getState())) {
|
||||
event.setNewSpeed((float) (event.getNewSpeed() + random.nextFloat() * 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) {
|
||||
if (random.nextFloat() <= .15 && target instanceof EntityLiving) {
|
||||
World w = player.getEntityWorld();
|
||||
Entity e = new EntityCow(w);
|
||||
if (!w.isRemote) {
|
||||
int i = random.nextInt(22);
|
||||
switch (i) {
|
||||
case 0:
|
||||
e = new EntityCow(w);
|
||||
break;
|
||||
case 1:
|
||||
e = new EntityPig(w);
|
||||
break;
|
||||
case 2:
|
||||
e = new EntityHorse(w);
|
||||
break;
|
||||
case 3:
|
||||
e = new EntityChicken(w);
|
||||
break;
|
||||
case 4:
|
||||
e = new EntityVillager(w);
|
||||
break;
|
||||
case 5:
|
||||
e = new EntityEnderman(w);
|
||||
break;
|
||||
case 6:
|
||||
e = new EntityPolarBear(w);
|
||||
break;
|
||||
case 7:
|
||||
e = new EntityIronGolem(w);
|
||||
break;
|
||||
case 8:
|
||||
e = new EntitySilverfish(w);
|
||||
break;
|
||||
case 9:
|
||||
e = new EntityCaveSpider(w);
|
||||
break;
|
||||
case 10:
|
||||
e = new EntityWolf(w);
|
||||
break;
|
||||
case 11:
|
||||
e = new EntityWitch(w);
|
||||
break;
|
||||
case 12:
|
||||
e = new EntityTNTPrimed(w);
|
||||
break;
|
||||
case 13:
|
||||
e = new EntityGhast(w);
|
||||
break;
|
||||
case 14:
|
||||
e = new EntitySpider(w);
|
||||
break;
|
||||
case 15:
|
||||
e = new EntitySkeleton(w);
|
||||
break;
|
||||
case 16:
|
||||
e = new EntityMagmaCube(w);
|
||||
break;
|
||||
case 17:
|
||||
e = new EntitySlime(w);
|
||||
break;
|
||||
case 18:
|
||||
e = new EntityBlueSlime(w);
|
||||
break;
|
||||
case 19:
|
||||
e = new EntityBat(w);
|
||||
break;
|
||||
case 20:
|
||||
e = new EntityPigZombie(w);
|
||||
break;
|
||||
case 21:
|
||||
e = new EntityBlaze(w);
|
||||
break;
|
||||
}
|
||||
e.setPosition(target.getPosition().getX(), target.getPosition().getY() + 0.1f, target.getPosition().getZ());
|
||||
e.setCustomNameTag("Missingno");
|
||||
((EntityLiving) e).setHealth(((EntityLiving) e).getHealth() * (random.nextInt(5) + 1));
|
||||
w.spawnEntityInWorld(e);
|
||||
target.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockHarvestDrops(ItemStack tool, BlockEvent.HarvestDropsEvent event) {
|
||||
float r = random.nextFloat();
|
||||
if (r > 0.95f) event.getDrops().clear();
|
||||
if (event.getDrops() != null) {
|
||||
if (r < 0.4f && event.getDrops().get(0).getItem() == Item.getItemFromBlock(Blocks.IRON_ORE)) {
|
||||
ItemStack change = new ItemStack(Item.getItemFromBlock(Blocks.IRON_ORE));
|
||||
int i = random.nextInt(11);
|
||||
switch (i) {
|
||||
case 0:
|
||||
change = new ItemStack(Item.getItemFromBlock(Blocks.GOLD_ORE));
|
||||
break;
|
||||
case 1:
|
||||
change = new ItemStack(Item.getItemFromBlock(Blocks.REDSTONE_ORE));
|
||||
break;
|
||||
case 2:
|
||||
change = new ItemStack(Item.getItemFromBlock(Blocks.LAPIS_ORE));
|
||||
break;
|
||||
case 3:
|
||||
change = new ItemStack(Item.getItemFromBlock(Blocks.DIAMOND_ORE));
|
||||
break;
|
||||
case 4:
|
||||
change = new ItemStack(Item.getItemFromBlock(Blocks.QUARTZ_ORE));
|
||||
break;
|
||||
case 5:
|
||||
change = new ItemStack(oreCobalt.getItem());
|
||||
break;
|
||||
case 6:
|
||||
change = new ItemStack(oreArdite.getItem());
|
||||
break;
|
||||
case 7:
|
||||
change = new ItemStack(titaniteOre);
|
||||
break;
|
||||
case 8:
|
||||
change = new ItemStack(bismuthOre);
|
||||
break;
|
||||
case 9:
|
||||
change = new ItemStack(tiberiumOre);
|
||||
break;
|
||||
case 10:
|
||||
change = new ItemStack(eterniteOre);
|
||||
break;
|
||||
}
|
||||
event.getDrops().set(0, change);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
/**
|
||||
* Created by Robert on 14.05.2016.
|
||||
*/
|
||||
public class TraitSofty extends AbstractTrait {
|
||||
private static final float chance = 0.2f;
|
||||
|
||||
public TraitSofty() {
|
||||
super("softy", TextFormatting.AQUA);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (!world.isRemote && state.getMaterial() != Material.ROCK && state.getMaterial() != Material.GROUND && random.nextFloat() < chance) {
|
||||
ToolHelper.healTool(tool, random.nextInt(10), player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,58 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
|
||||
public class TraitUncertain extends AbstractTrait {
|
||||
|
||||
|
||||
public TraitUncertain() {
|
||||
super("uncertain", TextFormatting.RED);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
if (random.nextFloat() <= 0.05) {
|
||||
if (!world.isRemote) {
|
||||
if (random.nextFloat() > 0.15f) {
|
||||
explode(world, player, pos.getX(), pos.getY(), pos.getZ());
|
||||
} else explode(world, null, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
ToolHelper.damageTool(tool, 5 + random.nextInt(10), null);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
if (!w.isRemote && event.getEntity() instanceof EntityMob && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||
ItemStack i = new ItemStack(Items.GUNPOWDER, random.nextInt(4));
|
||||
event.getDrops().add(0, new EntityItem(w, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void explode(World w, Entity e, double x, double y, double z) {
|
||||
w.newExplosion(e, x, y, z, 1.2f + random.nextFloat() * 35, random.nextBoolean(), true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user