Added first two Material Traits (onBlock not in use actual, caused of Mojangs rework of blocking ability on weapons)

This commit is contained in:
Robert Sosnitzka
2016-05-14 12:50:50 +02:00
parent c1ba3a19f4
commit 2c6ea98c77
71 changed files with 364 additions and 189 deletions

View File

@@ -0,0 +1,29 @@
package com.sosnitzka.ztic_addon.util.traits;
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 slimeknights.tconstruct.library.traits.AbstractTrait;
/**
* Created by Robert on 14.05.2016.
*/
public class TraitInstable extends AbstractTrait {
public TraitInstable() {
super("instable", TextFormatting.DARK_RED);
}
@Override
public void afterBlockBreak(ItemStack tool, World world, IBlockState state, BlockPos pos, EntityLivingBase player, boolean wasEffective) {
if (player.getHealth() > 2) {
world.newExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 3, true, true);
}
}
}

View File

@@ -0,0 +1,30 @@
package com.sosnitzka.ztic_addon.util.traits;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import slimeknights.tconstruct.library.traits.AbstractTrait;
/**
* Created by Robert on 14.05.2016.
*/
public class TraitResonance extends AbstractTrait {
public TraitResonance() {
super("resonance", TextFormatting.AQUA);
}
@Override
public void onBlock(ItemStack tool, EntityPlayer player, LivingHurtEvent event) {
player.addChatComponentMessage(new TextComponentString(event.getEntity() + " " + event.getEntityLiving()));
// event.getEntityLiving().knockBack(event.getEntityLiving(), 20f, 20f, 20f);
// event.getSource().getEntity()
}
}