forked from TAIGA/TAIGA
New Traits, rebalanced traits!
This commit is contained in:
@@ -36,7 +36,7 @@ public class Materials {
|
||||
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);
|
||||
public static Material dyonite = new Material("dyonite", TextFormatting.GRAY).addTrait(slaughtering, HeadMaterialStats.TYPE);
|
||||
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);
|
||||
|
@@ -45,6 +45,7 @@ public class ZTiC {
|
||||
public static final AbstractTrait analysing = new TraitAnalysing();
|
||||
public static final AbstractTrait cascade = new TraitCascade();
|
||||
public static final AbstractTrait dark = new TraitDark();
|
||||
public static final AbstractTrait slaughtering = new TraitSlaughtering();
|
||||
|
||||
static final String MODID = "ztic_addon";
|
||||
static final String VERSION = "@VERSION@";
|
||||
|
@@ -23,10 +23,11 @@ public class TraitCascade extends AbstractTrait {
|
||||
float f = random.nextFloat();
|
||||
float b = 0.99F * calcBonus(tool);
|
||||
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
||||
double x = pos.getX();
|
||||
double y = pos.getY();
|
||||
double z = pos.getZ();
|
||||
for (int i = random.nextInt(50); i > 0; i--) {
|
||||
double x, y, z, sx, sy, sz;
|
||||
sx = x = pos.getX();
|
||||
sy = y = pos.getY();
|
||||
sz = z = pos.getZ();
|
||||
for (int i = random.nextInt(ToolHelper.getCurrentDurability(tool)); i > 0; i--) {
|
||||
int r = random.nextInt(3);
|
||||
int d = random.nextBoolean() ? 1 : -1;
|
||||
if (r == 0) x += d;
|
||||
@@ -35,10 +36,14 @@ public class TraitCascade extends AbstractTrait {
|
||||
BlockPos nextBlock = new BlockPos(x, y, z);
|
||||
if (world.getBlockState(nextBlock) == world.getBlockState(pos)) {
|
||||
world.destroyBlock(nextBlock, true);
|
||||
x = nextBlock.getX();
|
||||
y = nextBlock.getY();
|
||||
z = nextBlock.getZ();
|
||||
sx = x = nextBlock.getX();
|
||||
sy = y = nextBlock.getY();
|
||||
sz = z = nextBlock.getZ();
|
||||
ToolHelper.damageTool(tool, random.nextInt(2), player);
|
||||
} else {
|
||||
x = sx;
|
||||
y = sy;
|
||||
z = sz;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ public class TraitFracture extends AbstractTrait {
|
||||
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
|
||||
float f = random.nextFloat();
|
||||
float b = 0.99F * calcBonus(tool);
|
||||
if (!world.isRemote && tool.canHarvestBlock(state) && f >= b) {
|
||||
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
||||
RayTraceResult mop = ((ToolCore) tool.getItem()).rayTrace(world, (EntityPlayer) player, false);
|
||||
if (mop == null) return;
|
||||
for (int i = random.nextInt(9) + 1; i >= 0; i--) {
|
||||
|
@@ -0,0 +1,51 @@
|
||||
package com.sosnitzka.ztic_addon.traits;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.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;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
/**
|
||||
* Created by Robert on 09.06.2016.
|
||||
*/
|
||||
public class TraitSlaughtering extends AbstractTrait {
|
||||
|
||||
public TraitSlaughtering() {
|
||||
super("slaughtering", TextFormatting.DARK_RED);
|
||||
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) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
if (!w.isRemote && event.getEntity() instanceof EntityLiving && !(event.getEntity() instanceof EntityPlayer) && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||
Item i = event.getDrops().get(random.nextInt(event.getDrops().size())).getEntityItem().getItem();
|
||||
if (i != null) {
|
||||
event.getDrops().add(new EntityItem(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(i, random.nextInt(4) + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user